text
stringlengths 28
935k
| meta
stringlengths 137
139
| red_pajama_subset
stringclasses 1
value |
---|---|---|
\section{Introduction}
\begin{figure}[t]
\centering \includegraphics[width=0.95\columnwidth]{Fig_TNVP_Artist.pdf}
\caption{An illustration of age progression from forensic artist and our TNVP model. Given an input $I$ of a subject at 34 years old \cite{patterson2007comparison}, a forensic artist rendered his age-progressed faces at 40s, 50s, 60s and 70s by reference to his familial photos $I_f$. Without using $I_f$, our TNVP can aesthetically produce his age-progressed faces.}
\label{fig:TNVP_Artist}
\end{figure}
\begin{table*} [!t]
\small
\centering
\caption{Comparing the properties between our TNVP approach and other age progression methods, where \xmark $ \: $ represents \textit{unknown} or \textit{not directly applicable} properties.
Deep learning (DL), Dictionary (DICT), Prototype (PROTO), AGing pattErn Subspace (AGES), Composition (COMP), Probabilistic Graphical Models (PGM), Log-likelihood (LL), Adversarial (ADV) }
\begin{tabular}{| p{2cm}| p {1.4cm} | p {1.35cm}| p {1.1cm}| p {1.3cm}| p {1.1cm}| p {1.1cm}| p {1.3cm}| p {1.5cm}| p {1.15cm}|}
\hline
& Our TNVP & TRBM\cite{Duong_2016_CVPR} & RNN\cite{wang2016recurrent} & acGAN\cite{antipov2017face} & HFA\cite{yang2016face} & CDL\cite{Shu_2015_ICCV} & IAAP\cite{kemelmacher2014illumination} & HAGES\cite{tsai2014human} & AOG\cite{suo2012concatenational} \\ \hline \hline
\textbf{Model Type} & DL & DL & DL & DL & DICT & DICT & PROTO & AGES & COMP \\ \hline
\textbf{Architecture} & PGM+CNN & PGM & CNN & CNN & Bases & Bases & \xmark & \xmark & Graph \\ \hline
\textbf{Loss Function} & LL & LL & $\ell_2$ & ADV+$\ell_2$ & LL+$\ell_0$ & $\ell_2+\ell_1$ & \xmark & $\ell_2$ & \xmark \\ \hline
\hline
\textbf{Tractable} &\cmark & \xmark & \cmark & \cmark & \cmark & \cmark & \xmark & \cmark & \xmark \\ \hline
\textbf{Non-Linearity} &\cmark &\cmark
& \cmark & \cmark & \xmark & \xmark & \xmark & \xmark & \xmark \\ \hline
\end{tabular}\label{tab:TenMethodSumm}
\end{table*}
Face age progression is known as the problem of aesthetically predicting individual faces at different ages.
Aesthetically synthesizing faces of a subject at different development stages is a very challenging task. Human aging is very complicated and differs from one individual to the next. Both \textit{intrinsic factors} such as heredity, gender, and ethnicity, and \textit{extrinsic factors}, i.e. environment and living styles, jointly contribute to this process and create large aging variations between individuals.
As illustrated in Figure \ref{fig:TNVP_Artist}, given a face of a subject at the age of 34 \cite{patterson2007comparison}, a set of closely related family faces has to be provided to a forensic artist as references to generate multiple outputs of his faces at 40’s, 50’s, 60’s, and 70’s.
In recent years, automatic age progression has become a prominent topic and attracted considerable interest from the computer vision community.
The conventional methods \cite{geng2007automatic, lanitis2002toward, patterson2006automatic, suo2012concatenational} simulated face aging by adopting parametric linear models such as Active Appearance Models (AAMs) and 3D Morphable Models (3DMM) to interpret the face geometry and appearance before combining with physical rules or anthropology prior knowledge. Some other approaches \cite{rowland1995manipulating,burt1995perception,kemelmacher2014illumination}
predefined some prototypes and transferred the difference between them to produce age-progressed face images.
However, since face aging is a non-linear process, these linear models have lots of difficulties
and the quality of their synthesized results is still limited.
Recently, deep learning based models \cite{Duong_2016_CVPR,wang2016recurrent} have also come into place and produced more plausible results. In \cite{wang2016recurrent}, Recurrent Neural Networks (RNN) are used to model the intermediate states between two consecutive age groups for better aging transition. However, it still has the limitations of producing blurry results by the use of a fixed reconstruction loss function, i.e. $\ell_2$-norm. Meanwhile, with the advantages of graphical models, the Temporal Restricted Boltzmann Machines (TRBM) has shown its potential in the age progression task \cite{Duong_2016_CVPR}. However, its partition function is intractable and needs some approximations during training process.
\subsection{Contributions of this Work}
This paper presents a novel generative probabilistic model, named Temporal Non-Volume Preserving (TNVP) transformation, for age progression. This modeling approach enjoys the strengths of both probabilistic graphical models to produce better image synthesis quality by avoiding the regular reconstruction loss function, and deep residual networks (ResNet) \cite{He_2016_CVPR} to improve the highly non-linear feature generation.
The proposed TNVP guarantees a \textit{tractable} log-likelihood density estimation, \textit{exact} inference and evaluation for embedding the feature transformations between faces in consecutive age groups.
In our framework, the long-term face aging is first considered as a composition of short-term stages. Then our TNVP models are constructed to capture the facial aging features transforming between two successive age groups.
By incorporating the design of ResNet \cite{He_2016_CVPR} based Convolutional Neural Network (CNN) layers in the structure, our TNVP is able to efficiently capture the non-linear facial aging feature related variance.
In addition, it can be robustly employed on face images in the wild without strict alignments or any complicated preprocessing steps.
Finally, the connections between latent variables of our TNVP can act as ``memory'' and contribute to produce a smooth age progression between faces while preserving the identity throughout the transitions.
In summary, the novelties of our approach are three-fold. \textbf{(1)} We propose a novel generative probabilistic models with tractable density function to capture the non-linear age variances. \textbf{(2)} The aging transformation can be effectively modeled using our TNVP. Similar to other probabilistic models, our TNVP is more advanced in term of embedding the complex aging process. \textbf{(3)} Unlike previous aging approaches that suffer from a burdensome preprocessing to produce the dense correspondence between faces, our model is able to synthesize realistic faces given any input face in the wild.
Table \ref{tab:TenMethodSumm} compares the properties between our TNVP approach and other age progression methods.
\begin{figure*}[t]
\centering \includegraphics[width=2\columnwidth]{Fig_TNVP_AgeProgression.png}
\caption{The proposed TNVP based age progression framework. The long-term face aging is decomposed into multiple short-term stages. Then given a face in age group $i$, our TNVP model is applied to synthesize face in the next age group. Each side of our TNVP is designed as a deep ResNet network to efficiently capture the non-linear facial aging features.}
\label{fig:TNVP_AgeProgression}
\end{figure*}
\section{Related Work}
This section reviews various age progression approaches which can be divided into four groups: \textit{prototyping}, \textit{modeling},
\textit{reconstructing}, and
\textit{deep learning-based approaches}.
\textit{Prototyping approaches} use the age prototypes to synthesize new face images. The average faces of people in the same age group are used as the prototypes \cite{rowland1995manipulating}. The input image can be transformed into the age-progressed face by adding the differences between the prototypes of two age groups \cite{burt1995perception}.
Recently, Kemelmacher-Shlizerman et al. \cite{kemelmacher2014illumination} proposed to construct sharper average prototype faces from a large-scale set of images in combining with subspace alignment and illumination normalization.
\textit{Modeling-based approaches} represent facial shape and appearance via a set of parameters and model facial aging process via aging functions.
Lanitis et al. \cite{lanitis2002toward} and Pattersons et al. \cite{patterson2006automatic} proposed to use AAMs parameters together with four aging functions for modeling both general and specific aging processes.
Luu et al. \cite{luu2009Automatic} incorporated common facial features of siblings and parents to age progression.
Geng et al. \cite{geng2007automatic} proposed an AGing pattErn Subspace (AGES) approach to construct a subspace for \textit{aging patterns} as a chronological sequence of face images. Later, Tsai et al. \cite{tsai2014human} improved the stability of AGES by adding subject's characteristics clue.
Suo et al. \cite{suo2010compositional, suo2012concatenational} modeled a face using a three-layer And-Or Graph (AOG) of smaller parts, i.e. eyes, nose, mouth, etc. and learned the aging process for each part by applying a Markov chain.
\textit{Reconstructing-based methods} reconstruct the aging face from the combination of an aging basis in each group.
Shu et al. \cite{Shu_2015_ICCV} proposed to build aging coupled dictionaries (CDL) to represent personalized aging pattern by preserving personalized facial features.
Yang et al. \cite{yang2016face} proposed to model person-specific and age-specific factors separately via sparse representation hidden factor analysis (HFA).
Recently, \textit{deep learning-based approaches} are being developed to exploit the power of deep learning methods.
Duong et al. \cite{Duong_2016_CVPR} employed Temporal Restricted Boltzmann Machines (TRBM) to model the non-linear aging process with geometry constraints
and spatial DBMs to model a sequence of reference faces and wrinkles of adult faces.
Similarly, Wang et al. \cite{wang2016recurrent} modeled aging sequences using a recurrent neural network with a two-layer gated recurrent unit (GRU).
Conditional Generative Adversarial Networks (cGAN) is also applied to synthesize aged images in \cite{antipov2017face}.
\section{Our Proposed Method}
The proposed TNVP age-progression architecture consists of three main steps. (1) Preprocessing; (2) Face variation modeling via mapping functions; and (3) Aging transformation embedding.
With the structure of the mapping function, our TNVP model is tractable and highly non-linear. It is optimized using a log-likelihood objective function that produces sharper age-progressed faces compared to the regular $\ell_2$-norm based reconstruction models.
Figure \ref{fig:TNVP_AgeProgression} illustrates our TNVP-based age progression architecture.
\begin{figure}[t]
\centering \includegraphics[width=0.9\columnwidth]{Fig_PreprocessingCompare.pdf}
\caption{Comparisons between the preprocessing processes of our approach and other aging approaches: IAAP \cite{kemelmacher2014illumination}, RNN based \cite{wang2016recurrent}, and TRBM based \cite{Duong_2016_CVPR} models. Our preprocessing is easy to run, less dependent on the landmarking tools, and efficiently deals with in-the-wild faces. \cmark represents ``included in the preprocessing steps''.
}
\label{fig:PreprocessingCompare}
\end{figure}
\subsection{Preprocessing} \label{sec:Preprocessing}
Figure \ref{fig:PreprocessingCompare} compares our preprocessing step with other recent age progression approaches, including Illumination Aware Age Progression (IAAP) \cite{kemelmacher2014illumination}, RNN based \cite{wang2016recurrent}, and TRBM based Age Progression \cite{Duong_2016_CVPR} models.
In those approaches, burdensome face normalization steps are applied to obtain the dense correspondence between faces.
The use of a large number of landmark points makes them highly depend on the stability of landmarking methods that are challenged in the wild conditions. Moreover, masking the faces with a predefined template requires a separate shape adjustment for each age group in later steps.
In our method, given an image, the facial region is simply detected and aligned according to fixed positions of four landmark points, i.e. two eyes and two mouth corners. By avoiding complicated preprocessing steps, our proposed architecture has two advantages. Firstly, a small number of landmark points, i.e. only four points, leverages the dependency to the quality of any landmarking method. Therefore, it helps to increase the robustness of the system. Secondly, parts of the image background are still included, and thus it implicitly embed the shape information during the modeling process. From the experimental results, one can easily notice the change of the face shape when moving from one age group to the next.
\subsection{Face Aging Modeling}
Let $\mathcal{I} \subset \mathbb{R}^D$ be the image domain and $\{\mathbf{x}^t, \mathbf{x}^{t-1}\} \in \mathcal{I}$ be observed variables encoding the texture of face images at age group $t$ and $t-1$, respectively.
In order to embed the aging transformation between these faces, we first define a bijection mapping function from the image space $\mathcal{I}$ to a latent space $\mathcal{Z}$ and then model the relationship between these latent variables. Formally, let $\mathcal{F}: \mathcal{I} \rightarrow \mathcal{Z}$ define a bijection from an observed variable $\mathbf{x}$ to its corresponding latent variable $\mathbf{z}$ and $\mathcal{G}:\mathcal{Z} \rightarrow \mathcal{Z}$ be an aging transformation function modeling the relationships between variables in latent space.
As illustrated in Figure \ref{fig:TNVP_Structure}, the relationships between variables are defined as in Eqn. \eqref{eqn:ModelFormulation}.
\begin{equation}
\begin{split}\label{eqn:ModelFormulation}
\mathbf{z}^{t-1}& = \mathcal{F}_1 (\mathbf{x}^{t-1}; \theta_1)\\
\mathbf{z}^{t} &= \mathcal{H}(\mathbf{z}^{t-1},\mathbf{x}^t; \theta_2, \theta_3) \\& = \mathcal{G}(\mathbf{z}^{t-1};\theta_3) + \mathcal{F}_2(\mathbf{x}^t;\theta_2)
\end{split}
\end{equation}
where $\mathcal{F}_1, \mathcal{F}_2$ define the bijections of $\mathbf{x}^{t-1}$ and $\mathbf{x}^t$ to their latent variables, respectively. $\mathcal{H}$ denotes the summation of $\mathcal{G}(\mathbf{z}^{t-1};\theta_3)$ and $\mathcal{F}_2(\mathbf{x}^t;\theta_2)$.
$\theta = \{\theta_1,\theta_2,\theta_3 \}$ present the parameters of functions $\mathcal{F}_1, \mathcal{F}_2$ and $\mathcal{G}$, respectively.
Indeed, given a face image in age group $t-1$, the probability density function can be formulated as in Eqn. \eqref{eqn:likelihood}.
\begin{figure}[t]
\centering \includegraphics[width=0.95\columnwidth]{Fig_TNVP_Structure.pdf}
\caption{Our proposed TNVP structure with two mapping units. Both transformations $\mathcal{S}$ and $\mathcal{T}$ can be easily formulated as compositions of CNN layers.}
\label{fig:TNVP_Structure}
\end{figure}
\small
\begin{eqnarray}
\begin{split} \label{eqn:likelihood}
p_{X^t}(\mathbf{x}^t|\mathbf{x}^{t-1};\theta)&=p_{X^t}(\mathbf{x}^t|\mathbf{z}^{t-1};\theta)\\
&=p_{Z^t}(\mathbf{z}^t|\mathbf{z}^{t-1};\theta)\left|\frac{\partial \mathcal{H}(\mathbf{z}^{t-1}, \mathbf{x}^t;\theta_2, \theta_3)}{\partial \mathbf{x}^t}\right|\\
&=p_{Z^t}(\mathbf{z}^t|\mathbf{z}^{t-1};\theta)\left|\frac{\partial \mathcal{F}_2(\mathbf{x}^t;\theta_2)}{\partial \mathbf{x}^t}\right|
\end{split}
\end{eqnarray}
\normalsize
where $p_{X^t}(\mathbf{x}^t|\mathbf{x}^{t-1};\theta)$ and $p_{Z^t}(\mathbf{z}^t|\mathbf{z}^{t-1};\theta)$ are the distribution of $\mathbf{x}^t$ conditional on $\mathbf{x}^{t-1}$ and the distribution of $\mathbf{z}^t$ conditional on $\mathbf{z}^{t-1}$, respectively.
In Eqn. \eqref{eqn:likelihood}, the second equality is obtained using the change of variable formula. $\frac{\partial \mathcal{F}_2(\mathbf{x}^t;\theta_2)}{\partial \mathbf{x}^t}$ is the Jacobian.
Using this formulation, instead of estimating the density of a sample $\mathbf{x}^t$ conditional on $\mathbf{x}^{t-1}$ directly in the complicated high-dimensional space $\mathcal{I}$, the assigned task can be accomplished by computing the density of its corresponding latent point $\mathbf{z}^t$ given $\mathbf{z}^{t-1}$ associated with the Jacobian determinant $\left|\frac{\partial \mathcal{F}_2(\mathbf{x}^t;\theta_2)}{\partial \mathbf{x}^t}\right|$.
There are some recent efforts to achieve the tractable inference process via approximations \cite{kingma2013auto} or specific functional forms \cite{dinh2016density,germain2015made, larochelle2011neural}. Section \ref{subsec:mappingfun} introduces a non-linear bijection function that enables the exact and tractable mapping from the image space $\mathcal{I}$ to a latent space $\mathcal{Z}$ where the density of its latent variables can be computed exactly and efficiently. As a result, the density evaluation of the whole model becomes exact and tractable.
\subsection{Mapping function as CNN layers}
\label{subsec:mappingfun}
In general, a bijection function between two high-dimensional domains, i.e. image and latent spaces, usually produces a large Jacobian matrix and is expensive for its determinant computation. Therefore, in order to enable the tractable property for $\mathcal{F}$ with lower computational cost, $\mathcal{F}$ is presented as a composition tractable mapping unit $f$ where each unit can be represented as a combination of several convolutional layers. Then the bijection function $\mathcal{F}$ can be formulated as a deep convolutional neural network.
\subsubsection{Mapping unit} \label{sec:MappingUnit}
Given an input $\mathbf{x}$, a unit $f:\mathbf{x} \rightarrow \mathbf{y}$ defines a mapping between $\mathbf{x}$ to an intermediate latent state $\mathbf{y}$ as in Eqn. \eqref{eqn:maskedConvolution}.
\small
\begin{equation} \label{eqn:maskedConvolution}
\begin{split}
\mathbf{y} = \mathbf{x}' + (1-\mathbf{b}) \odot \left[ \mathbf{x} \odot \exp(\mathcal{S}(\mathbf{x}')) + \mathcal{T}(\mathbf{x}') \right]
\end{split}
\end{equation}
\normalsize
where $\mathbf{x}'=\mathbf{b} \odot \mathbf{x}$; $\odot$ denotes the Hadamard product; $\mathbf{b} = [1,\cdots, 1, 0, \cdots, 0]$ is a binary mask where the first $d$ elements of $\mathbf{b}$ is set to one and the rest is zero; $\mathcal{S}$ and $\mathcal{T}$ represent the scale and the translation functions, respectively.
The Jacobian of this transformation unit is given by
\begin{equation}
\begin{split}
\frac{\partial f}{\partial \mathbf{x}} &=
\begin{bmatrix}
\frac{\partial \mathbf{y}_{1:d}}{\partial \mathbf{x}_{1:d}} & \frac{\partial \mathbf{y}_{1:d}}{\partial \mathbf{x}_{d + 1:D}} \\
\frac{\partial \mathbf{y}_{d+1:D}}{\partial \mathbf{x}_{1:d}} & \frac{\partial \mathbf{y}_{d+1:D}}{\partial \mathbf{x}_{d+1:D}}
\end{bmatrix}
\\
&=
\begin{bmatrix}
\mathbb{I}_d & 0 \\
\frac{\partial \mathbf{y}_{d+1:D}}{\partial \mathbf{x}_{1:d}} & \text{diag}\left(\exp(\mathcal{S}(\mathbf{x}_{1:d}))\right)
\end{bmatrix}
\end{split}
\end{equation}
where $\text{diag}\left(\exp(\mathcal{S}(\mathbf{x}_{1:d}))\right)$ is the diagonal matrix such that $\exp(\mathcal{S}(\mathbf{x}_{1:d}))$ is their diagonal elements.
This form of $\frac{\partial f}{\partial \mathbf{x}}$ provides two nice properties for the mapping unit $f$.
Firstly, since the Jacobian matrix $\frac{\partial f}{\partial \mathbf{x}}$ is triangular, its determinant can be efficiently computed as,
\small
\begin{equation} \label{eqn:determinant_unit}
\left|\frac{\partial f}{\partial \mathbf{x}}\right| = \prod_j \exp(s_j) =\exp\left( \sum_j s_j\right)
\end{equation}
\normalsize
where $\mathbf{s} = \mathcal{S}(\mathbf{x}_{1:d})$. This property also introduces the tractable feature for $f$.
Secondly, the Jacobian of the two functions $\mathcal{S}$ and $\mathcal{T}$ are not required in the computation of $\left|\frac{\partial f}{\partial \mathbf{x}}\right|$. Therefore, any non-linear function can be chosen for $\mathcal{S}$ and $\mathcal{T}$.
From this property, the functions $\mathcal{S}$ and $\mathcal{T}$ are set up as a composition of CNN layers in ResNet (i.e. residual networks) \cite{He_2016_CVPR} style with skip connections. This way, high level features can be extracted during the mapping process and improve the generative capability of the proposed model. Figure \ref{fig:TNVP_MappingUnit} illustrates the structure of a mapping unit $f$.
The inverse function $f^{-1}:\mathbf{y} \rightarrow \mathbf{x}$ is also derived as
\begin{equation} \label{eqn:invertMappingUnit}
\small
\begin{split}
\mathbf{x} = & \mathbf{y}' + (1-\mathbf{b}) \odot \left[ (\mathbf{y} - \mathcal{T}(\mathbf{y}')) \odot \exp(-\mathcal{S}(\mathbf{y}')) \right]
\end{split}
\end{equation}
where $\mathbf{y}'=\mathbf{b} \odot \mathbf{y}$.
\begin{figure}[t]
\centering \includegraphics[width=1.0\columnwidth]{Fig_MappingUnit.pdf}
\caption{An illustration of mapping unit $f$ whose transformations $\mathcal{S}$ and $\mathcal{T}$ are represented with 1-residual-block CNN network.}
\label{fig:TNVP_MappingUnit}
\end{figure}
\subsubsection{Mapping function} \label{sec:MappingFunction}
The bijection mapping function $\mathcal{F}$ is formulated by composing a sequence of mapping units $\{f_1, f_2, \cdots, f_n\}$.
\begin{equation}
\small
\mathcal{F} = f_1 \circ f_2 \circ \cdots \circ f_n
\label{eqn:MappingFunc}
\end{equation}
The Jacobian of $\mathcal{F}$ is no more difficult than its units and still remains tractable.
\begin{equation}
\small
\begin{split}
\frac{\partial \mathcal{F}}{\partial \mathbf{x}} = \frac{\partial f_1}{\partial \mathbf{x}} \cdot \frac{\partial f_2}{\partial f_1} \dots \frac{\partial f_n}{\partial f_{n-1}}
\end{split}
\end{equation}
Similarly, the derivations of its determinant and inverse are
\begin{eqnarray}
\small
\begin{aligned} \label{eqn:DeterminantMappingFunction}
\left|\frac{\partial \mathcal{F}}{\partial \mathbf{x}}\right| &= \left|\frac{\partial f_1}{\partial \mathbf{x}}\right| \cdot \left|\frac{\partial f_2}{\partial f_1}\right| \dots {\left| {\frac{\partial f_n}{\partial f_{n-1}}} \right|}\\
\mathcal{F}^{-1} & = \left(f_1 \circ f_2 \circ \cdots \circ f_n\right)^{-1} = f_1^{-1} \circ f_2^{-1} \circ \dots \circ f_n^{-1}
\end{aligned}
\end{eqnarray}
Since each mapping unit leaves part of its input unchanged (i.e. due to the zero-part of the mask $\mathbf{b}$), we alternatively change the binary mask $\mathbf{b}$ to $1-\mathbf{b}$ in the sequence so that every component of $\mathbf{x}$ can be jointed through the mapping process.
As mentioned in the previous section, since each mapping unit is set up as a composition of CNN layers, the bijection $\mathcal{F}$ with the form of Eqn. \eqref{eqn:MappingFunc} becomes a deep convolutional networks that maps its observed variable $\mathbf{x}$ in $\mathcal{I}$ to a latent variable $\mathbf{z}$ in $\mathcal{Z}$.
\subsection{The aging transform embedding}
In the previous section, we present the invertible mapping function $\mathcal{F}$ between a data distribution $p_X$ and a latent distribution $p_Z$. In general, $p_Z$ can be chosen as a prior probability distribution such that it is simple to compute and its latent variable $z$ is easily sampled. In our system, a Gaussian distribution is chosen for $p_Z$, but our proposed model can still work well with any other prior distributions. Since the connections between $\mathbf{z}^{t-1}$ and $\mathbf{z}^t$ embed the relationship between variables of different Gaussian distributions, we further assume that their joint distribution is a Gaussian.
The transformation $\mathcal{G}$ between $\mathbf{z}^{t-1}$ and $\mathbf{z}^t$ is formulated as,
\begin{equation}
\mathcal{G}(\mathbf{z}^{t-1};\theta_3) = \mathbf{W} \mathbf{z}^{t-1} + \mathbf{b_\mathcal{G}}
\end{equation}
where $\theta_3=\{\mathbf{W, \mathbf{b_\mathcal{G}}}\}$ is the transform parameters representing connecting weights of latent-to-latent interactions and the bias.
From Eqn. \eqref{eqn:ModelFormulation} and Figure \ref{fig:TNVP_Structure}, the latent variable $\mathbf{z}^t$ is computed from two sources: (1) the mapping from observed variable $\mathbf{x}^t$ defined by $\mathcal{F}_2(\mathbf{x}^t; \theta_2)$ and (2) the aging transformation from $\mathbf{z}^{t-1}$ defined by $\mathcal{G}(\mathbf{z}^{t-1};\theta_3)$. The joint distribution $p_{Z^t, Z^{t-1}}(\mathbf{z}^t,\mathbf{z}^{t-1})$ is given by
\small
\begin{eqnarray}
\begin{aligned}
\label{eqn:JointDistribution}
\mathbf{z}^{t-1} &\sim \mathcal{N}(0,\mathbb{I})\\
\mathcal{F}_2(\mathbf{x}^t,\theta_2) = \bar{\mathbf{z}}^{t} &\sim \mathcal{N}(0,\mathbb{I})\\
p_{Z^t, Z^{t-1}}(\mathbf{z}^t,\mathbf{z}^{t-1}; \theta) & \sim \mathcal{N}
\left(
\begin{bmatrix}
\mathbf{b_{\mathcal{G}}}\\
0
\end{bmatrix}
,
\begin{bmatrix}
\mathbf{W}^T\mathbf{W} + \mathbb{I} & \mathbf{W} \\
\mathbf{W} & \mathbb{I}
\end{bmatrix}
\right)
\end{aligned}
\end{eqnarray}
\normalsize
\begin{figure*}[t]
\centering \includegraphics[width=1.9\columnwidth]{Fig_AgeProgressResults_all.pdf}
\caption{Age Progression Results against FG-NET and MORPH. Given input images, plausible age-progressed faces in different age ranges are automatically synthesized. \textbf{Best viewed in color.}}
\label{fig:TNVP_AgeProgressedFaces}
\end{figure*}
\subsection{Model Learning}
The parameters $\theta=\{\theta_1, \theta_2, \theta_3\}$ of the model are optimized to maximize the log-likelihood:
\begin{equation}
\theta_1^*, \theta_2^*, \theta_3^*=\arg \max_{\theta_1, \theta_2, \theta_3} \log p_{X^t}(\mathbf{x}^t|\mathbf{x}^{t-1}; \theta_1, \theta_2, \theta_3)
\end{equation}
From Eqn. \eqref{eqn:likelihood}, the log-likelihood can be computed as
\small
\begin{eqnarray}
\begin{split} \nonumber
\log p_{X^t}(\mathbf{x}^t|\mathbf{x}^{t-1}; \theta) = &\log p_{Z^t}(\mathbf{z}^t|\mathbf{z}^{t-1},\theta) + \log \left|\frac{\partial \mathcal{F}_2(\mathbf{x}^t; \theta_2)}{\partial \mathbf{x}^t}\right|\\
= &\log p_{Z^t, Z^{t-1}}(\mathbf{z}^t,\mathbf{z}^{t-1}; \theta)\\
- & \log p_{Z^{t-1}}(\mathbf{z}^{t-1};\theta_1) + \log \left|\frac{\partial \mathcal{F}_2(\mathbf{x}^t;\theta_2)}{\partial \mathbf{x}^t}\right|
\end{split}
\end{eqnarray}
\normalsize
where the first two terms are the two density functions and can be computed using Eqn. \eqref{eqn:JointDistribution} while the third term (i.e. the determinant) is obtained using Eqns. \eqref{eqn:DeterminantMappingFunction} and \eqref{eqn:determinant_unit}.
Then the Stochastic Gradient Descent (SGD) algorithm is applied to optimal parameter values.
\subsection{Model Properties}
\textbf{Tractability and Invertibility}: With the specific structure of the bijection $\mathcal{F}$, our proposed graphical model has the capability of modeling arbitrary complex data distributions while keeping the inference process tractable. Furthermore, from Eqns. \eqref{eqn:invertMappingUnit} and \eqref{eqn:DeterminantMappingFunction}, the mapping function is invertible. Therefore, both inference (i.e. mapping from image to latent space) and generation (i.e. from latent to image space) are exact and efficient.
\textbf{Flexibility}: as presented in Section \ref{sec:MappingUnit}, our proposed model introduces the freedom of choosing the functions $\mathcal{S}$ and $\mathcal{T}$ for their structures. Therefore, different types of deep learning models can be easily exploited to further improve the generative capability of the proposed TNVP.
In addition, from Eqn. \eqref{eqn:maskedConvolution}, the binary mask $\mathbf{b}$ also provides the flexibility for our model if we consider this as a template during the mapping process. Several masks can be used in different levels of mapping units to fully exploit the structure of the data distribution of the image domain $\mathcal{I}$.
Although our TNVP shares some similar features with RBM and its family such as TRBM,
the log-likelihood estimation of TNVP is tractable while that in RBM is intractable and requires some approximations during training process. Compared to other methods, our TNVP also shows its advantages in high-quality synthesized faces (by avoiding the $\ell_2$ reconstruction error as in \textit{Variational Autoencoder}) and efficient training process (i.e. avoid maintaining a good balance between generator and discriminator as in case of GANs).
\begin{figure*}[t]
\centering \includegraphics[width=1.9\columnwidth]{Fig_Comparison_all.png}
\caption{Comparisons between our TNVP against other approaches: IAAP \cite{kemelmacher2014illumination}, TRBM-based \cite{Duong_2016_CVPR}, Exemplar based (EAP) \cite{shen2011exemplar}, and Craniofacial Growth (CGAP) \cite{ramanathan2006modeling} models. \textbf{Best viewed in color.}}
\label{fig:TNVP_Comparison}
\end{figure*}
\section{Experimental Results}
\subsection{Databases}
We train our TNVP system using AginG Faces in the Wild (AGFW) \cite{Duong_2016_CVPR} and a subset of the Cross-Age Celebrity Dataset (CACD) \cite{chen14cross}. Two other public aging databases, i.e. FG-NET \cite{fgNetData} and MORPH \cite{ricanek2006morph}, are used for testing.
\textbf{AginG Faces in the Wild (AGFW)}: consists of 18,685 images that covers faces from 10 to 64 years old. On average, after dividing into 11 age groups with the span of 5 years, each group contains 1700 images.
\textbf{Cross-Age Celebrity Dataset (CACD)} is a large-scale dataset with 163446 images of 2000 celebrities. The age range is from 14 to 62 years old.
\textbf{FG-NET} is a common aging database that consists of 1002 images of 82 subjects and has the age range from 0 to 69. Each face is manually annotated with 68 landmarks.
\textbf{MORPH} includes two albums, i.e. MORPH-I and MORPH-II. The former consists of 1690 images of 515 subjects and the latter provides a set of 55134 photos from 13000 subjects. We use MORPH-I for our experiments.
\subsection{Implementation details}
In order to train our TNVP age progression model, we first select a subset of 572 celebrities from CACD as in the training protocol of \cite{Duong_2016_CVPR}.
All images of these subjects are then classified into 11 age groups ranging from 10 to 65 with the age span of 5 years.
Next, the aging sequences for each subject are constructed by collecting and combining all image pairs that cover two successive age groups of that subject.
This process results in 6437 training sequences.
All training images from these sequences and the AGFW dataset are then preprocessed as presented in Section \ref{sec:Preprocessing}.
After that, a two-step training process is applied to train our TNVP age progression model.
In the first step, using faces from AGFW, all mapping functions (i.e. $\mathcal{F}_1, \mathcal{F}_2$) are pretrained to obtain the capability of face interpretation and high-level feature extraction. Then in the later step, our TNVP model is employed to learn the aging transformation between faces presented in the face sequences.
For the model configuration, the number of units for each mapping function is set to 10.
In each mapping unit $f_i$, two Residual Networks with rectifier non-linearity and skip connections are set up for the two transformations $\mathcal{S}$ and $\mathcal{T}$. Each of them contains 2 residual blocks with 32 feature maps. The convolutional filter size is set to $3 \times 3$.
The training time for TNVP model is 18.75 hours using a machine of Core i7-6700 @3.4GHz CPU, 64.00 GB RAM and a single NVIDIA GTX Titan X GPU and TensorFlow environment. The training batch size is 64.
\begin{figure*}[!t]
\centering
\begin{subfigure}{0.6\columnwidth}
\centering
\includegraphics[width=1.03\columnwidth]{fgnet_roc.eps}
\caption{ROC curves of FGNET pairs}
\label{fig:FG_ROC_Small}
\end{subfigure} %
\begin{subfigure}{0.62\columnwidth}
\centering
\includegraphics[width=0.88\columnwidth]{megaface_cmc.eps}
\caption{CMC curves on MegaFace}
\label{fig:megaface_CMC}
\end{subfigure} %
\begin{subfigure}{0.8\columnwidth}
\centering
\includegraphics[width=1.02\columnwidth]{megaface_roc.eps}
\caption{ROC curves on MegaFace}
\label{fig:megaface_ROC}
\end{subfigure}
\caption{
From left to right: (a) ROC curves of face verification from 1052 pairs synthesized from different age progression methods; (b) ROC and (c) CMC curves of different face matching methods and the improvement of CL method using our age-progressed faces (under the protocol of MegaFace challenge 1).}
\label{fig:megaface}
\end{figure*}
\subsection{Age Progression}
After training, our TNVP age progression system is applied to all faces over 10 years old from FG-NET and MORPH.
As illustrated in Figure \ref{fig:TNVP_AgeProgressedFaces}, given input faces at different ages, our TNVP is able to synthesize realistic age-progressed faces in different age ranges. Notice that none of the images in FG-NET or MORPH is presented in the training data.
From these results, one can easily see that our TNVP not only efficiently embed the specific aging information of each age group to the input faces but also robustly handles in-the-wild variations such as expressions, illumination, and poses.
Particularly, beards and wrinkles naturally appear in the age-progressed faces around the ages of 30-49 and over 50, respectively. The face shape is also implicitly handled in our model and changes according to different individuals and age groups.
Moreover, by avoiding the $\ell_2$ reconstruction loss and taking the advantages of maximizing log-likelihood, sharper synthesized results with aging details are produced by our proposed model.
We compare our synthesized results with other recent age progression works whose results are publicly available such as IAAP \cite{kemelmacher2014illumination}, TRBM-based model \cite{Duong_2016_CVPR} in Figure \ref{fig:TNVP_Comparison}. The real faces of the subjects at target ages are provided for reference.
Other approaches, i.e. Exemplar based Age Progression (EAP) \cite{shen2011exemplar} and Craniofacial Growth (CGAP) model \cite{ramanathan2006modeling}, are also included for further comparisons.
Notice that since our TNVP model is trained using the faces ranging from 10 to 64 years old, we choose the ones with ages close to 10 years old during the comparison. These results again show the advantages of our TNVP model in term of efficiently handling the non-linear variations and aging embedding.
\subsection{Age-Invariant face verification}
In this experiment, we validate the effectiveness of our TNVP model by showing the performance gain for cross-age face verification using our age-progressed faces. In both testing protocols, i.e. small-scale with images pairs from FG-NET and large-scale benchmark on Megaface Challenge 1, our aged faces have show that they can provide $\textbf{10 - 40}\%$ improvement on top of the face recognition model without re-train it on cross-age databases.
We employ the deep face recognition model \cite{wen2016discriminative}, named Center Loss (CL), which is among the state-of-the-art for this experiment.
Under the \textit{small-scale protocol}, in FG-NET database, we randomly pick 1052 image pairs with the age gap larger than 10 years of either the same or different person. This set is denoted as \textbf{A} consisting of a positive list of 526 image pairs of the same person and a negative list of 526 image pairs of two different subjects.
From each image pair of set \textbf{A}, using the face with younger age, we synthesize an age-progressed face image at the age of the older one using our proposed TNVP model. This forms a new matching pair, i.e. the aged face vs. the original face at older age. Applying this process for all pairs of set \textbf{A}, we obtain a new set denoted as set $\mathbf{{B}_1}$.
To compare with IAAP \cite{tsai2014human} and TRBM \cite{Duong_2016_CVPR} methods, we also construct two other sets of image pairs similarly and denote them as set $\mathbf{{B}_2}$ and $\mathbf{{B}_3}$, respectively.
Then, the False Rejection Rate-False Acceptance Rate (FRR-FAR) is computed and plotted under the Receiver Operating Characteristic (ROC) curves for all methods (Fig. \ref{fig:FG_ROC_Small}).
Our method achieves an improvement of $\textbf{30}\%$ on matching performance over the original pair (set \textbf{A}) while IAAP and TRBM slightly increase the rates.
In addition, the advantages of our model is also experimented on the \textit{large-scale Megaface} \cite{kemelmacher2016megaface} challenge 1 with the FGNET test set. Practical face recognition models should achieve high performance against having gallery set of millions of distractors and probe set of people at various ages.
In this testing, 4 billion pairs are generated between the probe and gallery sets where the gallery includes one million distractors.
Thus, only improvements on Rank-1 identification rate with one million distractors gallery and verification rate at low FAR are meaningful \cite{kemelmacher2016megaface}.
Table \ref{tb:megaface_test} shows the results of rank-1 identification results with one million distractors. As shown in Fig. \ref{fig:megaface_CMC}, Rank-1 identification accuracy drops when the number of distractors increases.
The TAR-FAR and ROC curves\footnote{The results of other methods are provided in MegaFace website.} are presented in Fig. \ref{fig:megaface_ROC}.
From these results, using our aged face images not only improve face verification results by $\textbf{10}\%$ compared to the original model in \cite{wen2016discriminative} but also outperform most of the models trained with a small training set. The model from DeepSense achieves the best performance under the cross-age training set while the original model trained solely on CASIA WebFace dataset \cite{yi2014learning} having $ < 0.49$M images with no cross-age information. We achieve better performance on top of this original model by simply synthesizing aged images without re-training.
\begin{table}[!t]
\small
\centering
\caption{Rank-1 Identification Accuracy with one million Distractors (MegaFace Challenge 1 - FGNET). Protocol ``small" means $\leq$0.5M images trained. ``Cross-age" means trained with cross-age faces (e.g. in CACD, MORPH, etc.). Center Loss (CL) model in \cite{wen2016discriminative}}
\label{tb:megaface_test}
\begin{tabular}{|l|c|c|c|}
\hline
\textbf{Methods} & \textbf{Protocol} & \textbf{Cross-age} & \textbf{Accuracy}\\ \hline \hline
Barebones\_FR & Small & Y & 7.136 \% \\
3DiVi & Small & Y & 15.78 \% \\
NTechLAB & Small & Y & 29.168 \% \\
DeepSense & Small & Y & 43.54 \% \\
\hline \hline
CL \cite{wen2016discriminative} & Small & \textbf{N} & 38.79\% \\
\textbf{CL + TNVP} & Small & \textbf{N} & \textbf{47.72}\% \\
\hline
\end{tabular}
\end{table}
\section{Conclusion}
This paper has presented a novel generative probabilistic model with a tractable density function for age progression. The model inherits the strengths of both probabilistic graphical model and recent advances of ResNet. The non-linear age-related variance
and the aging transformation between age groups are efficiently captured.
Given the log-likelihood objective function, high-quality age-progressed faces can be produced. In addition to a simple preprocessing step, geometric constraints are implicitly embedded during the learning process.
The evaluations in both quality of synthesized faces and cross-age verification showed the robustness of our TNVP.
{\small
\bibliographystyle{ieee}
| {'timestamp': '2017-03-28T02:02:23', 'yymm': '1703', 'arxiv_id': '1703.08617', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08617'} | arxiv |
\section{Introduction}
\label{sec:intro}
Data analytics clusters are shifting from on-disk processing toward in-memory computing. The increasing demand for interactive, iterative data analytics and the stalling speed of disk I/O force data-parallel systems to persist large volumes of data in memory to provide low latency \cite{power2010piccolo,zaharia2012resilient,ananthanarayanan2012pacman:,li2014tachyon}. Despite the continuous drop in RAM prices and the increasing availability of high-RAM servers, memory cache remains a constrained resource in large clusters. Efficient cache management, therefore, plays a pivotal role for in-memory data analytics.
Caching is a classical problem and has been well studied in storage systems, databases, operating systems, and web servers. Yet, caching in data-parallel clusters has a defining characteristic that differentiates it from previous systems: cluster applications have clear semantics of data dependency, expressed as directed acyclic graphs (DAGs) of compute tasks. The DAG sketches out the task execution plan which dictates the underlying data access pattern, i.e., how data is computed and reused as input of descendant tasks. Fig.~\ref{DAGExample} shows an example DAG, where the computations of data blocks $E$ and $F$ depend on block $D$, and the corresponding tasks can only be scheduled after block $D$ has been derived from block $B$.
\begin{figure}[htbp]
\centering\includegraphics[width=4cm]{DAGExample}
\caption{An example of the data dependency DAG of an application. Each block represents a dataset. Blocks $A$, $B$, and $C$ are input datasets already cached in memory. Block $D$ is an intermediate dataset derived from $B$. Block $E$ ($F$) is the final result derived from both $A$ and $D$ ($C$ and $D$).}
\label{DAGExample}
\end{figure}
However, existing caching policies in prevalent data analytic systems \cite{zaharia2012resilient,marz2014apachestorm,shinnar2012m3r:} are \emph{agnostic} to the data dependency DAGs. Instead, they predict application-specific data access patterns based on historical information (e.g., frequency and recency). For instance, in Spark, the \texttt{BlockManager} evicts data blocks that are \emph{least recently used} (LRU) in the presence of high memory pressure \cite{zaharia2012resilient}. The LRU policy can be highly inefficient with low hit ratio. Referring back to the example of Fig.~\ref{DAGExample}, suppose that the cache can hold 3 blocks (assuming unit block size), and blocks $A$, $B$ and $C$ are cached at the beginning. Now to derive block $D$ and persist it in memory, the LRU policy will evict either block $A$ or $C$, as block $B$ has been recently used in the computation of block $D$, even though it will not be referenced again in the future.
We show through this toy example that simply relying on the historical information can result in erroneous cache decisions.
In this paper, we ask how the application semantics of data dependency should be exploited to optimize cache management? Ideally, the solution should take full use of the DAG information and can be easily implemented as an efficient cache management policy with low overhead. In addition, the policy should be generally applicable to a wide range of in-memory computing frameworks.
We propose a novel cache replacement policy, Least Reference Count (LRC), that always evicts the data block whose \emph{reference count} is the smallest. The reference count is defined, for each data block, as the number of \emph{unmaterialized} child blocks derived from it.
LRC provides benefits over existing cache management policies in three aspects. First, LRC can timely detect \emph{inactive} data blocks with \emph{zero} reference count. Such blocks are likely not be used again in the remaining computations\footnote{Unless re-computation is needed due to machine failures or stragglers.} and can be safely evicted from the memory.
Second, compared with the historical information such as the block access recency and frequency, the reference count serves as a more accurate indicator of the likelihood of future data access. Intuitively, the higher the reference count a block has, the more child blocks depend on it, and the more likely the block is needed in the downstream computations. We show through empirical studies in Sec.~\ref{sec:background} that caching data blocks with the highest reference count increases the hit ratio by up to 119\% in comparison with caching the most recently used data. Third, the reference count can be accurately tracked at runtime with negligible overhead, making LRC a lightweight solution for all DAG-based systems.
We have prototyped LRC as a pluggable memory manager in Spark (details in Sec.~\ref{sec:lrc}). To demonstrate the efficacy of LRC, we have conducted extensive evaluations through EC2 deployment, including both the single- and multi-tenant experiments at scale. Compared to LRU---the default cache management policy in Spark---LRC retains the same application performance using only 40\%
of cache spaces. When operating with the same memory footprint, LRC is capable of
reducing the application runtime by up to 60\%. Our implementation can be easily adapted to other DAG-based data parallel systems and can also be extended to multi-tenant cache sharing systems such as Tachyon \cite{li2014tachyon}.
The remainder of the paper is organized as follows. In Sec.~\ref{sec:background}, we demonstrate the inefficiency of existing cache policies by characterizing data access patterns in parallel processing systems through empirical studies. We present the design of LRC policy and elaborate its implementation details in Sec.~\ref{sec:lrc}. Evaluation results are reported in Sec.~\ref{sec:evaluation}. We survey related work in Sec.~\ref{sec:related} and conclude the paper in Sec.~\ref{sec:conclusion}.
\section{Background And Motivation}
\label{sec:background}
In this section, we give the background information and motivate the need for a new cache policy through empirical studies. Unless otherwise specified, we shall limit our discussion to the context of Spark \cite{zaharia2012resilient}. However, nothing precludes applying the discussion to other frameworks such as Tez \cite{saha2015apache} and Storm \cite{marz2014apachestorm}.
\subsection{Semantics of Data Dependency}
Cluster applications such as machine learning, web search, and social network typically consist of complex \emph{workflows}, available as directed acyclic graphs (DAGs) to the cluster scheduler. These DAGs provide rich semantics of the underlying data access patterns, which entails a myriad of cache optimization opportunities that, so far, have not been well explored.
In Spark, data is managed through an easy-to-use memory abstraction called Resilient Distributed Datasets (RDDs) \cite{zaharia2012resilient}. An RDD is a collection of immutable datasets partitioned across a group of machines. Each machine stores a subset of RDD partitions (blocks), in memory or on disk. An RDD can be created directly from a file in a distributed storage system (e.g., HDFS \cite{shvachko2010hadoop}, Amazon S3 \cite{S3}, and Tachyon \cite{li2014tachyon}) or computed from other RDDs through a user-defined transformation. The DAG presents the workflow of RDD computations.
Whenever a job is submitted to the Spark driver, its DAG of RDDs becomes readily available to a driver component, \texttt{\texttt{DAGScheduler}} \cite{zaharia2012resilient}. The \texttt{DAGScheduler} then traverses the job DAG using depth-first search (DFS) and continuously submits \emph{runnable} tasks (i.e., those whose parent RDDs have all been computed) to the cluster scheduler to compute unmaterialized RDDs. Therefore, the cache manager can easily retrieve the DAG information from the \texttt{DAGScheduler}.
This information sheds light into the underlying data access patterns, based on which the cache manager can decide which RDD block should be kept in memory.
It is worth emphasizing that the availability of data dependency DAGs of compute jobs is not limited to Spark, but generally found in other parallel frameworks such as Apache Tez \cite{saha2015apache}: the Tez programming API allows the programmer to explicitly define the workflow DAG of an application, which is readily available to the Tez scheduler beforehand.
We caution that the actual data access sequence, though critically depends on
the dependency DAGs, cannot be fully characterized \emph{beforehand}. To see this, we refer back
to the previous example in Fig.~\ref{DAGExample}. After block $D$ has been computed, the cluster scheduler submits two task sets, say $T_1$ and $T_2$, to respectively compute data blocks $E$ and $F$ (noting that $A$ and $C$ are assumed to be in memory at the beginning). In this case, which block, $E$ or $F$, is computed first depends on the scheduling order of $T_1$ and $T_2$, which dictates the access order of blocks $A$ and $C$. We see from this simple example that there remains some uncertainty in the data access sequence, even with the dependency DAG available \emph{a priori}. It is such an uncertainty that rules out the use of the optimal offline cache policy, Belady's MIN \cite{belady1966study}, to maximize the cache hit ratio.
\subsection{Recency- and Frequency-Based Cache Management}
Despite the availability of the dependency DAGs, prevalent cache management
policies are agnostic toward this information. Instead, they
predict data access patterns based on the historical information, notably
\emph{recency} and \emph{frequency}.
\begin{itemize}
\item \textbf{Least Recently Used (LRU)}: The LRU policy \cite{mattson1970evaluation} makes room for new data by evicting the cached blocks that have not been accessed for the longest period of time.
LRU is the \emph{de facto} cache management policy deployed in today's in-memory data analytics systems \cite{zaharia2012resilient,marz2014apachestorm,saha2015apache,li2014tachyon}. It predicts the
access pattern based on the short-term data popularity, meaning the recently accessed data is assumed
to be likely used again in the near future.
\item \textbf{Least Frequently Used (LFU)}: The LFU policy \cite{aho1971principles} keeps
track of the access frequency of each
data block, and the one that has been accessed the least frequently
has the highest priority to be evicted.
Unlike LRU, LFU predicts the access pattern based on the long-term data popularity, meaning
the frequently accessed data is assumed to be likely used again in the future.
\end{itemize}
Both LRU and LFU are very easy to implement. However, their obliviousness to
the application semantics of data dependency frequently result in inefficient,
even erroneous, cache decisions, as we show in the next subsection.
\subsection{Characterizing the Data Access Pattern}
\label{sec:data_access_patter}
To illustrate the need for being dependency-aware, we characterize the data
access patterns in typical analytics benchmarks through empirical studies. We
show that simply relying on the recency and frequency information for cache
management would waste a large portion of memory
to persist \emph{inactive data} that will never be used in downstream computations.
\vspace{.4em}
\noindent \textbf{Methodology.}
We ran SparkBench \cite{li2015sparkbench:}, a comprehensive benchmarking suite, in an Amazon EC2 \cite{ec2} cluster consisting of 10 \texttt{m4.large} instances. We measured the memory footprints and
characterized the data access patterns of 15 applications in SparkBench, including machine learning, graph computation, SQL queries, streaming, etc. Table~\ref{tab:SparkBench-all} summarizes the workload suite we used in our empirical studies.
\begin{table}[tbp]
\centering
\renewcommand{\arraystretch}{0.8}
\caption{An overview of SparkBench suite \cite{li2015sparkbench:}.}
\begin{tabularx}{.48\textwidth}{@{} *2{|>{\centering\arraybackslash}X} @{}|}
\hline
\textbf{Application Type } & \textbf{Workload } \bigstrut\\
\hline
\multirow{3}[6]{*}{Machine Learning } & \emph{Logistic Regression} \bigstrut\\
\cline{2-2} & \emph{Support Vector Machine (SVM)} \bigstrut\\
\cline{2-2} & \emph{Matrix Factorization} \bigstrut\\
\hline
\multirow{3}[6]{*}{Graph Computation } & \emph{Page Rank} \bigstrut\\
\cline{2-2} & \emph{SVD Plus Plus} \bigstrut\\
\cline{2-2} & \emph{Triangle Count} \bigstrut\\
\hline
\multirow{2}[4]{*}{SQL Queries} & \emph{Hive} \bigstrut\\
\cline{2-2} & \emph{RDD Relation} \bigstrut\\
\hline
\multirow{2}[4]{*}{ Streaming Workloads } & \emph{Twitter Tag} \bigstrut\\
\cline{2-2} & \emph{Page View} \bigstrut\\
\hline
\multirow{5}[10]{*}{Other Workloads } & \emph{Connected Component} \bigstrut\\
\cline{2-2} & \emph{Strongly Connected Component} \bigstrut\\
\cline{2-2} & \emph{Shortest Paths} \bigstrut\\
\cline{2-2} & \emph{Label Propagation} \bigstrut\\
\cline{2-2} & \emph{Pregel Operation} \bigstrut\\
\hline
\end{tabularx}%
\label{tab:SparkBench-all}%
\end{table}%
\vspace{.4em}
\noindent \textbf{Data Access Patterns.}
Our experiments have identified two common access patterns across applications.
\emph{1) Most data goes inactive quickly and will never be referenced again.}
Fig.~\ref{DeadDataCDF} shows the distribution of inactive data cached in memory throughout the execution of 15 applications. We find that inactive data accounts for a large portion of memory footprint during the execution, with the median and 95th percentile being 77\% and 99\%, respectively. The dominance of inactive data blocks is in line with the data flow model where intermediate data is used by ``nearby'' computations in DAGs and therefore has a short life cycle. Keeping inactive data long in memory wastes cache spaces, inevitably resulting in low hit ratio.
\emph{2) Data goes inactive in \emph{waves}, often aligned with the generation of new data.} We further micro-benchmarked the memory footprint of total generated data against that of inactive data blocks cached during the execution of each application. Fig.~\ref{JobDeadData} shows the results for a representative application that computes the connected components of a given graph. The execution progress is measured in terms of the number of tasks completed. We see clearly that the data is produced and consumed in \emph{waves}, shown in Fig.~\ref{JobDeadData} as the lockstep along with the submission of new jobs following the DAG. Meaning that when a child RDD has been computed, its parents may go inactive.
\begin{figure}[tbp]
\centering\includegraphics[width=6cm]{total_ratio}
\caption{Distribution of inactive data cached during the execution of SparkBench \cite{li2015sparkbench:}.}
\label{DeadDataCDF}
\end{figure}
\begin{figure}[tbp]
\centering\includegraphics[width=6cm]{ConnectedComponentJob}
\caption{Memory footprints of intermediate data generated and inactive blocks cached during the execution of \emph{Connected Component}, an application in SparkBench \cite{li2015sparkbench:}.}
\label{JobDeadData}
\end{figure}
\vspace{.4em}
\noindent \textbf{Inefficiency of LRU and LFU.}
We learn from the empirical studies that the key to efficient cache
replacement is to timely evict inactive data blocks. Unfortunately, neither
LRU nor LFU is capable of doing so. We refer back to the example of
Fig.~\ref{DAGExample}, where each block is of a unit size, and the memory
cache can persist three blocks in total. We start with LRU. Without loss
of generality, assume that the three blocks $A$, $B$, and $C$ are already in
memory at the beginning, with the recency rank $C > B > A$, i.e., from the most-%
recently-used (MRU) position to the least-recently-used (LRU).
Fig.~\ref{LRUCache} illustrates what happens in an LRU cache when data block
$D$ is materialized and then cached. Since block $D$ is derived from $B$, the
latter is firstly referenced as an input at time $t_1$ and is elevated to the
MRU position. Soon later, block $D$ has been materialized at time $t_2$ and
is cached at the MRU position, pushing the least-recently-used block $A$ out
of the memory. However, this would incur expensive tear-and-wear cost, in that
block $A$ will soon be reloaded in memory to compute block $E$. In fact, we
see that the optimal decision is to evict block $B$, as it becomes inactive
and will never be used again. This simple example shows that
LRU is unable to evict inactive data in time, but it has to
wait \emph{passively} until the data demotes to the LRU position, which may
take a long time.
\begin{figure}[tb]
\centering\includegraphics[width=7cm]{figures/LRUCache}
\caption{An example showing that LRU is unable to timely detect and evict
inactive data.}
\label{LRUCache}
\end{figure}
We note that the LFU policy suffers from a similar problem. In the
previous example, to cache block $D$, the LFU policy would evict either block
$A$ or $C$ while retaining block $B$ in memory, because block $B$ has a
historical access record (in the computation of $D$), but the other two do
not.
To summarize, simply relying on the historical information, be it access
recency or frequency, is incapable of detecting inactive data in time. Efficient cache
management therefore must factor in the semantics of data dependency DAG. We
show how this can be achieved in the next section.
\section{Dependency-Aware Cache Management}
\label{sec:lrc}
In this section, we present a new cache management policy, Least Reference
Count (LRC), which makes the cache replacement decisions based on the data
dependency DAG. We also describe our implementation in Spark.
\subsection{Least Reference Count (LRC)}
We start with the definition of \emph{reference count}.
\begin{definition}[Reference count]
For each data block $b$, the \emph{reference count} is define as the number of
child blocks that are derived from $b$, but have not yet been computed.
\end{definition}
Back to the example of Fig.~\ref{DAGExample}, upon the DAG submission, blocks $A$, $B$, and $C$
all have reference count 1, while block $D$ has reference count 2.
The Least Reference Count (LRC) policy keeps track of the \emph{reference
count} of each data block, and whenever needed, it evicts the data
block whose \emph{reference count} is the smallest.
\vspace{.4em}
\noindent \textbf{Properties of LRC.}
The LRC policy has two nice properties that makes it highly efficient.
First, inactive data with zero reference count can be quickly detected and
evicted. Repeating the previous example of Fig.~\ref{DAGExample}, let blocks
$A$, $B$, and $C$ be in memory at the beginning, and the cache is full. Once
block $D$ has been computed, block $B$ becomes inactive with zero reference
count. Block $B$ is hence evicted to make room for block $D$.
Second, compared to recency and frequency, reference count serves as a more
accurate indicator of the likelihood of future data access. Intuitively, the
higher the reference count a block has, the more compute tasks depend on it,
and the more likely the block is needed in the near future.
To validate this intuition, we ran SparkBench applications on 10
\texttt{m4.large} EC2 instances. Specifically, whenever a data block is
accessed, we measure the \emph{cache priority rank} (in percentile) of the
block with respect to three metrics: the recency of last access, historical
access frequency, and reference count. A block having a top rank with respect
to a certain metric (say, top 1\% in recency) is likely cached in memory if
the corresponding cache policy is used (say, LRU). Fig.~\ref{AccessCDF} shows
the CDF of the measured ranks across 15 SparkBench applications. We see that
the reference count consistently gives higher ranks than the other two
metrics, meaning that it is the most accurate indicator of which data will be
accessed next. For example, suppose that the cache can accommodate the
top 10\% ranked data blocks, each of a uniform size. Caching data blocks ranked
top in the reference count leads to the highest cache hit ratio of 46\%, which
is $2.19\times$ ($46\times$) compared with the recency (frequency) rank.
\begin{figure}[tb]
\centering\includegraphics[width=6cm]{figures/SparkBenchAccessCDF}
\caption{Distribution of the cache priority ranks of accessed data blocks with respect to
recency, frequency, and reference count. The workloads cover all SparkBench
applications \cite{li2015sparkbench:}.}
\label{AccessCDF}
\end{figure}
\subsection{LRC-Online}
We note that accurately computing the reference count requires extracting the
\emph{entire} data dependency DAG in an application. However, in systems such
as Spark and Tez, only the DAG information of a \emph{compute job} is readily
available, upon the job submission. A cluster application typically runs as a
workflow of several jobs. The data dependency between these jobs is usually
runtime information not available \emph{a priori}, and can be very complex if
jobs are executed iteratively. We address this challenge through two approaches.
First, studies of production traces reveal that a large portion of cluster
workloads are \emph{recurring} applications \cite{ferguson2012jockey}, which are run
periodically when new data becomes available. For these applications, we can
learn their DAGs from previous runs.
Second, for the \emph{non-recurring} applications, such as interactive ad-hoc
queries, we propose \emph{LRC-Online} that online updates the data dependency
DAG of the application whenever a new job is submitted. Continuing the
example of Fig.~\ref{DAGExample}, we assume that the computations of block $E$
and $F$ belong to two different jobs, as illustrated in
Fig.~\ref{DAGExampleByJob}. Let Job 1 be submitted first, and the reference
count of block $D$ turns to 1. While this is inaccurate as block $D$ is also
used to compute block $F$, LRC-Online will soon correct its value after Job 2
has been submitted.
\begin{figure}[tbp]
\centering\includegraphics[width=4cm]{DAGExampleByJob}
\caption{An example DAG where blocks $E$ and $F$ are respectively computed
by Job 1 and Job 2. The former is scheduled earlier than the latter.}
\label{DAGExampleByJob}
\end{figure}
LRC-Online extends the application of LRC to the multi-tenant environments,
where multiple tenants share common input datasets. Despite the potential online
DAG profiling errors, our experiment results in Sec.~\ref{sec:evaluation}
show that the performance of LRC-Online remains close to that of
LRC with the offline DAG information of applications.
\subsection{Spark Implementation}
We have prototyped LRC and LRC-Online as a pluggable block manager in Spark.
We next elaborate our implementation details.
\vspace{.4em}
\noindent \textbf{Architecture overview.}
Fig.~\ref{Implementation} gives an architecture overview of our cache manager, where
the shaded boxes highlight our implementation modules. The cache manager consists of a
centralized controller on the master node and several distributed
\texttt{RDDMonitor}s that collect cache statistics on worker nodes and report
to the controller periodically. The controller has two key components: (1)
\texttt{AppDAGAnalyzer} that learns the data-dependency DAGs from previous runs for
recurring applications, or
in an online fashion for non-recurring applications, and (2) \texttt{CacheManagerMaster} that implements the main logic of the LRC and LRC-Online policies.
We summarize the key APIs of our implementation in Table~\ref{tab:API}.
\vspace{.4em}
\noindent \textbf{Workflow.}
Whenever an application is submitted, the Spark driver is launched on the
master node. The driver creates a \texttt{SparkContext} within which two
controller modules, \texttt{CacheManagerMaster} and \texttt{AppDAGAnalyzer},
are instantiated. By default, the driver also instantiates
\texttt{DAGScheduler} to parse job DAGs and
\texttt{BlockManagerMasterEndpoint} to communicate the cache information with
the \texttt{BlockManager} of workers. The driver then informs worker nodes to
launch Spark executors, which results in the deployment of
\texttt{BlockManager} and \texttt{RDDMonitor} across the cluster. Once the
connection between the executor and the driver has been established,
\texttt{RDDMonitor} starts to report RDD block status to
\texttt{CacheManagerMaster}, who maintains the reference count profile based
on the DAG information provided by \texttt{DAGScheduler} and
\texttt{AppDAGAnalyzer}. When the profile needs update due to a job
submission or a block access at the worker nodes, \texttt{CacheManagerMaster} notifies
\texttt{BlockManagerMasterEndPoint} in the driver to send updated reference
profile to \texttt{BlockManager} on the corresponding workers. The
\texttt{BlockManager} on each worker makes the eviction decisions \emph{locally}
based on the reference count profile it receives, and reports the events of
block access and eviction to \texttt{RDDMonitor} who then forwards the update
to the \texttt{CacheManagerMaster}.
\begin{figure}[tbp]
\centering\includegraphics[width=7cm]{architecture_new}
\caption{Overall system architecture of the proposed application-aware cache manager in Spark. Our implementation modules are highlighted as shaded boxes.
}\label{Implementation}
\end{figure}
\begin{table}[tbp]
\centering
\caption{Key APIs of our Spark implementation.}
\begin{tabularx}{.48\textwidth}{|l|X|X|r|}
\hline
\textbf{API } & \textbf{Description} \bigstrut\\
\hline
\texttt{parseDAG} & The \texttt{CacheManagerMaster} parses the DAG information obtained from the \texttt{DAGScheduler} and returns the profiled reference count for each RDD. \bigstrut\\
\hline
\texttt{updateReferenceCount} & The \texttt{CacheManagerMaster} sends the parsed reference count profile to the corresponding \texttt{RDDMonitor}. \bigstrut\\
\hline
\texttt{reportRDDStatus} & The \texttt{RDDMonitor} informs the \texttt{CacheManagerMaster} of the status of the cached RDD blocks.\bigstrut\\
\hline
\texttt{updateReferenceCount} & Upon receiving the reference count updating message, the \texttt{RDDMonitor} updates reference counts of the corresponding RDD blocks.\bigstrut\\
\hline
\texttt{getReferenceCount} & When caching an RDD block, the \texttt{BlockManager} searches the local profile to get its reference count. If not found, ask the \texttt{BlockManagerMasterEndPoint} for update.\bigstrut\\
\hline
\texttt{decrementReferenceCount} & When an RDD block is referenced, the \texttt{RDDMonitor} deducts the its reference count in the maintained profile.\bigstrut\\
\hline
\texttt{evictBlocks} & When the cache is full, the \texttt{BlockManager} evicts the data with the least reference count.\bigstrut\\
\hline
\end{tabularx}%
\label{tab:API}%
\end{table}%
\subsection{Discussion}
\noindent \textbf{Communication overhead.} To reduce the communication
overhead, each worker maintains the reference count profile locally and
synchronizes with the controller through a minimum number of message
exchanges. The \texttt{CacheManagerMaster} sends reference count updates to
the corresponding workers only when necessary. In particular, there are two
cases where the update is needed: 1) When a new job DAG is received from the
\texttt{DAGScheduler}, the \texttt{CacheManagerMaster} notifies workers to update
the reference count of the corresponding RDD blocks; 2) when an RDD block has
been referenced, and the block has replicas on the other workers, all those
workers should be notified to have a consistent reference count of the block.
By default, RDD blocks are not replicated across the cluster, and our implementation
checks the Spark configuration to decide if such an update can be avoided.
\vspace{.4em}
\noindent \textbf{Fault tolerance.} It is possible that a worker
may lose connection to the driver at runtime, which results in a task
failure. In this case, the reference count profile maintained by the
\texttt{CacheManagerMaster} will be inaccurate as the failed tasks will be
rescheduled soon. To address this inconsistency issue, the
\texttt{CacheManagerMaster} records the job ID upon receiving a job DAG from
\texttt{DAGScheduler}. This way, the \texttt{CacheManagerMaster} can quickly
detect job re-computation if the same job ID has been spotted before.
The consistency check for the reference count can then be applied.
\section{Evaluation}
\label{sec:evaluation}
In this section, we evaluate the performance of our cache manager through EC2
deployment against typical application workloads in SparkBench suite
\cite{li2015sparkbench:}. We first investigate how being dependency-aware
helps speed up a \emph{single} application with much shorter runtime, and how
such a benefit can be achieved even when the DAG information is profiled
online. We next evaluate the performance of LRC in a \emph{multi-tenant}
environment where multiple applications run in a shared cluster. These
applications have data dependency in between and compete for the
memory caches against each other.
\vspace{.4em}
\noindent \textbf{Cluster deployment.}
Our implementation is based on Spark 1.6.1. In order to highlight the
performance difference of memory read-write and disk I/O, we disabled the OS
page cache using memory buffer by triggering direct
disk I/O from/to the hard disk. We deployed a 20-node EC2 cluster for the single-tenant experiments
and increased the cluster size to 50 nodes for the multi-tenant experiments.
Each node we used in the EC2 deployment is an \texttt{m4.large} instance \cite{ec2},
with a dual-core 2.4 GHz Intel Xeon E5-2676 v3 (Haswell) processor and 8
GB memory.
\begin{table}[tbp]
\centering
\caption{Impact of memory caches on the application runtime. We compare
against the two extreme cases: caching all data in memory versus caching none.}
\begin{tabularx}{.48\textwidth}{|l|X|X|X|r|}
\hline
\textbf{Workload} & \textbf{Cache All} & \textbf{Cache None} \bigstrut\\
\hline
\emph{Page Rank} & 56 s & 552 s \bigstrut\\
\hline
\emph{Connected Component} & 34 s & 72 s \bigstrut\\
\hline
\emph{Shortest Paths} & 36 s & 78 s \bigstrut\\
\hline
\emph{K-Means} & 26 s & 30 s \bigstrut\\
\hline
\emph{Pregel Operation} & 42 s & 156 s \bigstrut\\
\hline
\emph{Strongly Connected Component} & 126 s & 216 s \bigstrut\\
\hline
\emph{Label Propagation} & 34 s & 37 s \bigstrut\\
\hline
\emph{SVD Plus Plus} & 55 s & 120 s \bigstrut\\
\hline
\emph{Triangle Count} & 84 s & 99 s \bigstrut\\
\hline
\emph{Support Vector Machine (SVM)} & 72 s & 138 s \bigstrut\\
\hline
\end{tabularx}%
\label{tab:characterizaiton}%
\end{table}%
\subsection{Single-Tenant Experiment}
We start with a simple scenario where a single tenant runs an application in a
small private cluster consisting of 20 nodes. We ran typical application
workloads in SparkBench and measured the cache hit ratio as well as the
application runtime using different memory management policies, including
LRU, LRC, and LRC-Online.
\vspace{.4em}
\noindent \textbf{Relevance of memory caches.}
It is worth emphasizing that memory caches may become irrelevant for some
applications. For example, we have observed in SparkBench that some applications
are compute-intensive, and their runtime is mostly dictated by the CPU cycles. Some applications,
on the other hand, need to shuffle large volumes of data,
and their performance is bottlenecked by the network. These applications benefit little from
efficient cache management and do not see a significant runtime improvement even if
the system caches all data in memory.
In order to differentiate from these applications, we respectively measured
the application runtime in two extreme cases: 1) the system has large enough
memory and caches all data, and 2) the system caches no data at all. We
summarize our measurement results in Table~\ref{tab:characterizaiton}. We see
that some SparkBench applications, notably \emph{K-Means}, \emph{Label
Propagation} and \emph{Triangle Count}, have almost the same runtime in the
two cases, meaning that memory caches are irrelevant to their performance. We
therefore exclude these applications from evaluations
but focus on four memory-intensive workloads
whose performance critically depends on cache management: \emph{Page Rank},
\emph{Pregel Operation}, \emph{Connected Component}, and \emph{SVD Plus Plus}.
Table~\ref{tab:testedworkloads} summarizes the input data sizes of these
workloads.
\begin{comment}
\begin{table}[htbp]
\centering
\renewcommand{\arraystretch}{0.8}
\caption{Application Characterization--Runtime with Sufficient and No RDD Cache}
\begin{tabularx}{.4\textwidth}{lXXr}
\hline
\textbf{Workload } & \textbf{Sufficient Cache} &\textbf{No Cache} \bigstrut\\
\hline
Page Rank & 56s & 552s \bigstrut\\
\hline
Connected Component & 34s &72s \bigstrut\\
\hline
Shortest Paths & 36s & 78s \bigstrut\\
\hline
KMeans & 26s & 30s \bigstrut\\
\hline
Pregel Operation & 42s & 156s \bigstrut\\
\hline
Strongly Connected Component & 126s & 216s \bigstrut\\
\hline
Lable Propagation & 34s & 37s \bigstrut\\
\hline
SVD Plus Plus & 55s & 120s \bigstrut\\
\hline
Triangle Count & 84s & 99s \bigstrut\\
\hline
SVM & 72s & 138s \bigstrut\\
\hline
\end{tabularx}%
\label{tab:characterizaiton}%
\end{table}%
\end{comment}
\begin{table}[tbp]
\centering
\caption{Summary of workload input data size.}
\begin{tabularx}{.48\textwidth}{@{} *2{|>{\centering\arraybackslash}X} @{}|}
\hline
\textbf{Workload } & \textbf{Input Data Size} \bigstrut\\
\hline
\emph{Page Rank} & 480 MB \bigstrut\\
\hline
\emph{Pregel Operation} & 120 MB \bigstrut\\
\hline
\emph{Connected Component} & 280 MB \bigstrut\\
\hline
\emph{SVD Plus Plus} & 540 MB \bigstrut\\
\hline
\end{tabularx}%
\label{tab:testedworkloads}%
\end{table}%
\begin{figure*}[tbp]
\centering\includegraphics[width=1.0\textwidth]{MicroExp_Hit}
\caption{Cache hit ratio under the three cache management policies with different
cache sizes.}
\label{hitratio_single}
\end{figure*}
\begin{figure*}[tbp]
\centering\includegraphics[width=1.0\textwidth]{MicroExp_Runtime}
\caption{Application runtime under the three cache management policies with different
cache sizes.}
\label{runtime_single}
\end{figure*}
\vspace{.4em}
\noindent \textbf{Cache hit ratio and application runtime.}
We ran each application using
three cache replacement policies, i.e., LRU, LRC, and LRC-Online, with different memory cache sizes.
In particular, we configured \texttt{storage.memoryFraction} in the
legacy Spark to throttle the memory
used for RDD caching to a given size. We measured the cache hit ratio and the
application runtime against different cache sizes and depict the results in
Fig.~\ref{hitratio_single} and Fig.~\ref{runtime_single}, respectively.
The results have been averaged over 5 runs.
As expected, the less availability of the memory caches in the cluster, the smaller the cache
hit ratio (Fig.~\ref{hitratio_single}), and the longer the application runs
(Fig.~\ref{runtime_single}). Regardless of the cache size, the two LRC algorithms
consistently outperform LRU, the default cache management policy in Spark, across all
applications. The benefits achieved by
the LRC policy, in terms of the application speedup, varies with different
cache sizes as well as the application workloads. In particular,
compared to the default LRU policy, our LRC algorithm reduces the
runtime of \emph{Page Rank} by 60\% (from 170 s to 64 s) when the cluster cache size is 5.5 GB.
Table~\ref{tab:maximum saving} summarizes the largest runtime savings of LRC over LRU
for each application we evaluated.
The efficiency of LRC policy can also be illustrated from a different
perspective, in that LRC requires much smaller cache spaces than that of LRU,
but it is able to achieve the same cache hit ratio. For example, to achieve
the target hit ratio of 0.7 for \emph{Pregel Operation}, LRU requires 0.55 GB
memory caches. In comparison, LRC requires only 0.22 GB, an equivalent of 60\% saving
of cache spaces.
We make another interesting observation that for different applications, the cache
hit ratio has different impact on their runtime. For example, the workload of
\emph{Page Rank} suffers from the most significant slowdown, from 67 s to 320
s, when the cache hit ratio decreases from 1 to 0.85. The reason is that the
computation of \emph{Page Rank} consists of some large RDDs, and their cache
miss critically increases the total runtime. For \emph{Connected Component},
salient slowdown is observed when the cache hit ratio drops from 0.7 to 0.4;
for \emph{SVD Plus Plus}, we observe a linear slowdown with respect to the
decrease of cache hit ratio.
\begin{table*}[tbp]
\centering
\caption{Summary of the maximum reduction of application runtime over LRU.}
\begin{tabular}{|c|c|c|c|c||c|c|}
\hline
\textbf{Workload} & \textbf{Cache Size} & \textbf{LRU} & \textbf{LRC} & \textbf{LRC-Online} & \textbf{Speedup by LRC} & \textbf{Speedup by LRC-Online} \bigstrut\\
\hline
\emph{Page Rank} & 6.6 GB & 169.3 s & 68.4 s & 84.5 s & 59.58\% & 50.06\% \bigstrut\\
\hline
\emph{Pregel Operation} & 0.22 GB & 121.9 s & 66.3 s & 75.9 s & 45.64\% & 37.74\% \bigstrut\\
\hline
\emph{Connected Component} & 2.2 GB & 50.6 s & 27.6 s & 29.9 s & 45.47\% & 40.97\% \bigstrut\\
\hline
\emph{SVD Plus Plus} & 0.88 GB & 254.3 s & 177.6 s & 223.9 s & 30.17\% & 11.96\% \bigstrut\\
\hline
\end{tabular}%
\label{tab:maximum saving}%
\end{table*}%
\vspace{.4em}
\noindent \textbf{LRC-Online.}
As discussed in the previous section, when the \emph{entire} application DAG
cannot be retrieved \emph{a priori}, we can profile the submitted job DAGs at
runtime using LRC-Online. We now evaluate how such an online approach
can approximate the LRC policy with offline knowledge of application DAG.
We see through Fig.~\ref{hitratio_single} and Fig.~\ref{runtime_single},
that LRC-Online is a close approximation of LRC for all applications
except \emph{SVD Plus Plus}. As illustrated in Table~\ref{tab:maximum
saving}, with online profiling, LRC can only speed up the application by
$12\%$, as opposed to $30\%$ provided by the offline algorithm.
We attribute the performance loss of LRC-Online to the fact that the
datasets generated in the current job might be referenced by another in the
future, whose DAG is yet available to the \emph{DAGScheduler}. Therefore, the
reference count of the dataset calculated at the current stage may not be
accurate. To quantify the inaccuracy of online profiling, we measure
\emph{reference distance}, for each data reference, as the number of
intermediate jobs from the \emph{source job} where the data is generated to
the \emph{destination job} where the data is used. Intuitively, the longer the
reference distance is, the greater chance it is that referencing the block in
the future may encounter a cache miss. This is because without knowing the
entire application DAG beforehand, LRC-Online can only tell the data
dependency in the current job, and will likely evict all the generated data
blocks after the source job has completed.
Table~\ref{tab:reference distance} summarizes the average reference distance of
the data blocks generated in each application. All applications but \emph{SVD Plus Plus}
have reference distance less than 1, meaning that most of the generated data is
likely used either by the current job or the next one. This result is in line with
the observation made in Fig.~\ref{JobDeadData}, where intermediate data
goes inactive in waves and in lockstep with job submission.
\emph{SVD Plus Plus}, on the other hand, has the longest reference distance,
which explains its performance loss with LRC-Online.
\begin{table}[htbp]
\centering
\caption{Average reference distance.}
\begin{tabularx}{.48\textwidth}{@{} *2{|>{\centering\arraybackslash}X} @{}|}
\hline
\textbf{Workload} & \textbf{Average Reference Distance} \bigstrut\\
\hline
PageRank & 0.95 \bigstrut\\
\hline
PregelOperation & 0.73 \bigstrut\\
\hline
ConnectedComponent & 0.74 \bigstrut\\
\hline
SVDPlusPlus & 1.71 \bigstrut\\
\hline
\end{tabularx}%
\label{tab:reference distance}%
\end{table}%
\begin{table}[htbp]
\centering
\caption{Summary of workloads used in the multi-tenant experiment.}
\begin{tabularx}{.48\textwidth}{@{} *3{|>{\centering\arraybackslash}X} @{}|}
\hline
\textbf{Tenant Index} & \textbf{Workload} & \textbf{Input Data Size}\bigstrut\\
\hline
1-8 & ConnectedComponent & 745.4 MB \bigstrut\\
\hline
9-16 & PregelOperation & 66.9 MB \bigstrut\\
\hline
\end{tabularx}%
\label{tab:testedworkloads with multi-tenants}%
\end{table}%
To summarize, LRC-Online is a practical solution that well approximates
LRC and consistently outperforms the LRU policy across applications.
\subsection{Multi-Tenant Experiment}
We now investigate how our cache manager performs in a multi-tenant
environment through a 50-node EC2 deployment. Notice that the Spark driver
unifies the indexing of jobs and RDDs for all tenants. Once a job is
submitted, the RDDs in its DAG are indexed incrementally based on the unified
index. In this case, the offline RDD reference count is unavailable because
the order of actual job submission sequence from multiple tenants is uncertain
due to runtime dynamics. Therefore, the data dependency DAG can only be determined
online. For this reason, we compare the performance of LRC-Online against LRU.
In the first set of experiments, we emulated 16 tenants submitting jobs
simultaneously to the Spark driver, with different cache sizes. The
workload profile of the tenants is given in Table~\ref{tab:testedworkloads
with multi-tenants}. In the second experiment, we fixed the total cache size
to be 1.26 GB and increased the number of tenants from 8 to 20.
\begin{figure}[htbp]
\centering\includegraphics[width=0.48\textwidth]{MacroExp_Cache}
\caption{Cache hit ratio and total runtime with different cache sizes in the multi-tenant experiment.}\label{MacroExp_Cache}
\end{figure}
Fig.~\ref{MacroExp_Cache} and Fig.~\ref{MacroExp_Tenant} show the results. We
find that LRC-Online is capable of achieving larger performance gains over LRU
with smaller cache sizes or with more tenants. This suggests that leveraging the
application semantics of data dependency is of great significance,
especially when the cluster memory caches are heavily competed.
\begin{figure}[htbp]
\centering\includegraphics[width=0.48\textwidth]{MacroExp_Tenant}
\caption{Cache hit ratio and total runtime with different numbers of tenants.}\label{MacroExp_Tenant}
\end{figure}
\begin{comment}
\begin{figure*}[!htb]
\minipage{0.33\textwidth}
\includegraphics[width=\linewidth]{PregelOperation_Hit}
\caption{Cache Hit Ratio of \emph{Pregel Operation}.}\label{hit_po}
\endminipage\hfill
\minipage{0.33\textwidth}
\includegraphics[width=\linewidth]{PregelOperation_Runtime}
\caption{Application Runtime of \emph{Pregel Operation}.}\label{runtime_po}
\endminipage\hfill
\minipage{0.33\textwidth}%
\includegraphics[width=\linewidth]{ConnectedComponent_Hit}
\caption{Cache Hit Ratio of \emph{Connected Component}.}\label{hit_cc}
\endminipage
\end{figure*}
\begin{figure*}[!htb]
\minipage{0.33\textwidth}
\includegraphics[width=\linewidth]{ConnectedComponent_Runtime}
\caption{Application Runtime of \emph{Connected Component}.}\label{runtime_cc}
\endminipage\hfill
\minipage{0.33\textwidth}
\includegraphics[width=\linewidth]{SVDPlusPlus_Hit}
\caption{Cache Hit Ratio of \emph{SVD Plus Plus}.}\label{hit_svdpp}
\endminipage\hfill
\minipage{0.33\textwidth}%
\includegraphics[width=\linewidth]{SVDPlusPlus_Runtime}
\caption{Application Runtime of \emph{SVD Plus Plus}.}\label{runtime_svdpp}
\endminipage
\end{figure*}
\end{comment}
\section{Related Work}
\label{sec:related}
\noindent \textbf{Traditional Caching on a Single Machine.}
Memory caching has a long history and has been widely employed in storage systems \cite{chen1994raid}, databases \cite{stonebraker1981operating}, file systems \cite{nelson1988caching}, web servers \cite{cao1997cost}, operating systems \cite{baker2011megastore}, and processors \cite{henning2000spec}. Over the years, a vast amount of caching algorithms have been proposed. These algorithms run on a single machine and can be broadly divided into two categories:
\emph{Recency/frequency-based policies:} LRU \cite{mattson1970evaluation} and LFU \cite{aho1971principles} are the two widely used caching algorithms. As shown in Section \ref{sec:background}, neither algorithm adapts well to the data access pattern in data analytic clusters even though they are simple to implement.
\emph{Hint-based policies:} Many cache policies evict/prefetch data blocks through hints from applications \cite{cao1996implementation,patterson1995informed}, which are provided by the programmers to indicate what data will be referenced again and when. Nevertheless, inserting such hints can be difficult to the programmer, who has to carefully examine the underlying data access pattern.
\vspace{.4em}
\noindent \textbf{Cache Management in Parallel Processing Systems.}
Despite the significant performance impact of memory caches, cache management remains a relatively unchartered territory in data parallel systems. Prevalent parallel frameworks (e.g., Spark \cite{zaharia2012resilient}, Tez \cite{saha2015apache}, and Tachyon \cite{li2014tachyon}) simply employ LRU to manage cached data on cluster machines, which results in a significant performance loss \cite{ananthanarayanan2012pacman:,xu2016memtune:}.
To our knowledge, the recently proposed MemTune \cite{xu2016memtune:} is the only caching system that leverages the application semantics. MemTune dynamically adjusts the memory share for task computation and data caching in Spark and evicts/prefetches data as needed. As opposed to our proposal that accounts for the entire DAG and its dependencies, MemTune only considers locally dependent blocks of currently runnable tasks. Moreover, when it comes to a multi-tenant environment, the complexity of MemTune is also multiplied, as MemTune keeps track of all the submitted DAGs and traverses them at runtime to search for the downstream tasks whenever a task completes. In comparison, LRC parses the job DAG upon job submission and only sends the reference count profile to the corresponding worker node. The reference count updating message is light and simple compared to the DAG structure itself, and can be easily applied to any DAG-based system and even heterogeneous environments running different systems, like Tachyon \cite{li2014tachyon}.
Recent works \cite{pu2016fairride:,kunjir2015robus} have also studied the problem of cache allocation for multiple users with shared files in clusters, where fairness is the main objective to achieve. We view these works orthogonal to our proposed research. Once the cache space of each application has been allocated by some fair sharing policies, we can leverage the application-specific semantics for efficient cache management.
\begin{comment}
Cache management is a well studied topic. There have been many studies on classical cache replacement policies, such as LRU and LFU, which have been widely adopted in conventional caches \cite{o1993lru}, \cite{breslau1999web}. The expected performance of LRU is analyzed in \cite{che2002hierarchical} by approximating the cache eviction time -- the time since the last request after which an item will be evicted from the cache. There are also works \cite{lee2001lrfu}\cite{karedla1994caching} that combine LRU and LFU to adapt to the variant data access pattern.
Recently, a number of cache management mechanisms specially tailored for the distributed in-memory processing systems have also been designed. Tachyon \cite{li2014tachyon} provides a distributed memory layer to share data across multiple frameworks. CRAMM \cite{yang2006cramm} offers dynamic JVM heap management to accommodate variant compute demands. MegaStore \cite{baker2011megastore} specially tunes the cache management to provide consistent storage guarantees for interactive online applications. The LRC policy proposed in this paper differentiates from them in that LRC factors in the scheduling information and relies on data dependency to improve the cache management.
FairRide \cite{pu2016fairride:} offers a solution to guarantee the fairness of cache sharing in multi-tenant in-memory processing systems: probabilistically block requests to the data cached by other users. LRC strives to make the best use of the available cache space of each user, thus it is orthogonal and can be applied atop FairRide.
MEMTUNE \cite{xu2016memtune:} is the work most related to our study as it also leverages the DAG information to guide the cache management. Specifically, it focuses on dynamically adjusting the memory fraction for computation and caching, as well as prefetching the data of the next compute stage in the DAG. Compared to MemTune, LRC keeps a broader horizon of the future data dependency by aggregating the reference count in the entire job, rather than only one stage afterwards. Besides, the practicality of MemTune is hindered in a multi-tenant environment, as for a shared memory pool, individual adjustment to the memory fraction of computation/cache is inapplicable. LRC can be naturally extended to the multi-tenant systems, and can also easily assign priority to different users by normalizing the reference count.
\end{comment}
\section{Concluding Remark}
\label{sec:conclusion}
In this paper, we proposed a dependency-aware cache management policy, Least
Reference Count (LRC), which evicts data blocks whose reference count is the
smallest. The reference count is defined, for each data block, as the number
of dependent child blocks that have not been computed yet. With LRC, inactive
data blocks can be timely detected and evicted, saving cache spaces for more
useful data. In addition, we showed that reference count serves as an
accurate indicator of the likelihood of future data access.
We have implemented LRC as a pluggable cache manager
in Spark, and evaluated its performance through EC2 deployment. Experimental
results show that compared to the popular LRU policy, our LRC implementation
is capable of achieving the same application
performance at the expense of only 40\% of cache spaces. When using the same
amount of memory caches, LRC can reduce the application runtime by up to 60\%.
\section*{Acknowledgements}
\label{sec:ack}
We thank Chengliang Zhang for helping on the implementation of LRC-Online and the deployment of
multi-tenant experiments. We thank the anonymous reviewers for their invaluable feedback.
This research was partly supported by the Hong Kong Research Grants Council under Grant No.~16200214.
| {'timestamp': '2017-03-27T02:03:38', 'yymm': '1703', 'arxiv_id': '1703.08280', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08280'} | arxiv |
\section{Introduction}
\label{Introduction}
The \emph{expert advices} or \emph{consultancies} provided by the expert consultants (ECs) mainly doctors can be thought of as one of the most indispensable events that occurs in the hospital(s) or medical unit(s) on a regular basis. Over the past few years, there had been a perplexing growth in the demand of ECs (especially \emph{doctors}) during some critical surgical processes (or operations) that are taking place in the operation theatres (OTs) of the hospitals. The unprecedented growth in the demand of the ECs, has made ECs \emph{busy} and \emph{scarce} in nature. It is to be noted that, this unique nature ($i.e.$ busy and scarce) of ECs in the healthcare lobby provides an edge to the research community in the healthcare domain to think of: \emph{How to manage or schedule these limited (or \emph{scarce}) ECs in the OTs of the hospitals, during some censorious healthcare situation?} In order to answer the above coined question, previously, there had been a spate of research work in the direction of handling the issues of scheduling the in-house ECs especially doctors ~\cite{Carter_2001, Vassilacopoulos_1985} and nurses ~\cite{ Weil_1995} in an efficient and effective manner. In \cite{Carter_2001, Vassilacopoulos_1985, Beaulieu_2000, Wang_2007} different techniques are discussed and presented to schedule the physicians that are in-house to the hospitals in an efficient way for some critical operations that are taking place in the OTs of that hospitals. In past, the work had been also done in the direction of managing the OTs and the hospitals during the patient congestion scenario. The work in ~\cite{cardoen_b_2010, Blake_J_1997, Demeulemeester_E_2010} focuses on the question of: \emph{how to effectively and efficiently plan and schedule the OTs?} In ~\cite{Dexter_2004, Dexter_2003, Demeulemeester_E_2010} the work has been done for allocating OTs on time to increase operating room efficiency.\\
More importantly, in healthcare domain, one scenario that may be thought of as a challenging issue is, say; in certain critical medical cases, there may be a requirement of some external manpower in the form of ECs (mainly doctors) that are not available in-house to the hospitals. Now, the immediate \emph{natural} question that came in the mind is that, \emph{how to have some external expertise mainly in the form of doctors that are not available in-house to the hospitals?} Surprisingly, literature is very limited for this problem in healthcare domain. This interesting situation of taking expert consultancy from outside of the in-house medical unit during
some censorious medical scenario (mainly \emph{surgical} process) was taken care by \emph{Starren et. al.} ~\cite{Starren_JB_2014}. Moreover, the introduction of such a pragmatic field of study in the healthcare domain by \emph{Starren et. al.} ~\cite{Starren_JB_2014} has given rise to several open questions for the researchers, such as: (a) \emph{which ECs are to be considered as the possible expertise provider in the consultancy arena}? (b) \emph{What incentives policies in the form of perks and facilities are to be presented in-front of the ECs, so as to drag as many ECs as possible in the consultancy arena}?\\
In ~\cite{Vikash2015EAS}, the problem of hiring one or more doctors for a patient from outside of the admitted hospital for some critical operation under monetary environment (experts are charging for their services) with the \emph{infinite budget} are addressed. With the consideration that, ECs are having some social connections in real life, \emph{Singh et. al.} ~\cite{DBLP:journals/corr/SinghM16a} considered a budgeted setting of the problem in ~\cite{Vikash2015EAS} motivated by ~\cite{Singer:2014:BFM:2692359.2692366} for hiring \emph{k} doctors out of the available \emph{n} doctors ($k < n$), such that the total payment made to the ECs do not exceed the total budget of a patient.
As opposed to the money involved hiring of ECs as mentioned in ~\cite{Vikash2015EAS, DBLP:journals/corr/SinghM16a}, another market of hiring ECs can be thought of where the ECs are providing their
expertise free of cost.
Recently, \emph{Singh et. al.} ~\cite{DBLP:journals/corr/SinghM16} have addressed this idea, where the expert services are distributed free of cost. For hiring ECs in \emph{money free} environment ($i.e.$ money is not involved in any sense) they have utilized the idea of one sided strict preference (in this case strict preference from patient side) over the available doctors in the consultancy arena.\\
In this paper, we have tried to model the \emph{ECs hiring problem} as a two sided preference market in healthcare domain motivated by ~\cite{DBLP:journals/corr/abs-1104-2872, Dughmi:2010:TAW:1807342.1807394, Gale_AMM_1962, Shapley_2013}. The idea behind studying the \emph{ECs hiring problem} as a more appealing two sided preference market is that, in this environment, the members present in two different communities have the privilege to provide the strict preference ordering over all the available members of the opposite community. For example, in our case, we have two communities (or parties) in the consultancy arena: (a) \emph{Patient party} (b) \emph{Doctor party}. So, the members of the \emph{patient party} provide strict preference ordering over all the available members (or the subset of available members) in the \emph{doctor party} and \emph{vice versa}.
\subsection{Our Contributions}
\noindent The main contributions of our work are as follows.\\
$\bullet$ We have tried to model the \emph{ECs hiring problem} as a two sided matching problem in healthcare domain. \\
$\bullet$ We propose two mechanisms: a naive approach $i.e.$ \emph{\textbf{ra}ndomized \textbf{m}echanism for \textbf{h}iring \textbf{e}xpert \textbf{c}onsultants} (RAMHECs) and a \emph{truthful} and \emph{optimal} mechanism; namely \emph{\textbf{t}ruthful \textbf{o}ptimal \textbf{m}echanism for \textbf{h}iring \textbf{e}xpert \textbf{c}onsultants} (TOMHECs).\\
$\bullet$ We have also proved that for any instance of \emph{n} patients and \emph{n} doctors the allocation done by TOMHECs results in \emph{stable}, \emph{truthful}, and \emph{optimal} allocation for requesting party.\\
$\bullet$ TOMHECs establish an upper bound of $O(kn^2)$ on the number of iterations required to determine a \emph{stable} allocation for any instance of \emph{n} patients and \emph{n} doctors.\\
$\bullet$ A substantial amount of analysis and simulation are done to validate the performance of RAMHECs and TOMHECs via \emph{optimal} allocation measure.
\noindent The remainder of the paper is structured as follows. Section \textbf{2} describes our proposed model. Some required definitions are discussed in section \textbf{3}. Section \textbf{4} illustrates the proposed mechanisms. Further analytic-based analysis of the mechanisms are carried out in section \textbf{5}. A detailed analysis of the experimental results is carried out in section \textbf{6}. Finally, conclusions are drawn and some future directions are depicted in section \textbf{7}.
\section{System model}
We consider the scenario, where there are multiple hospitals \emph{say} \emph{n} given as $\hbar = \{\hbar_1, \hbar_2, \ldots, \hbar_n\}$. In each hospital $\hbar_i \in \hbar$, there exists several patients with different diseases (in our case patients and doctors are categorized based on the diseases and areas of expertise respectively.) belonging to different income group that requires somewhat partial or complete expert consultancies from outside of the admitted hospitals. By partial expert consultancies it is meant that, the part of expertise from the overall required expert consultancies. The set of \emph{k} different categories is given as: $\boldsymbol{\mathcal{C}} = \{c_1, c_2, \ldots, c_k\}$. The set of all the admitted patients in different categories to different hospitals is given as:
$\boldsymbol{\mathcal{P}} = \bigcup\limits_{\hbar_k \in \hbar} \bigcup\limits_{c_i \in \boldsymbol{\mathcal{C}}} \bigcup\limits_{j=1}^{\mathring{\hbar}_{k}^{i}} p_{i(j)}^{\hbar_k}$
where $p_{i(j)}^{\hbar_{k}}$ is the patient \emph{j} belonging to $c_i$ category admitted to $\hbar_{k}$ hospital. The expression $\mathring{\hbar}_{k}^{i}$ in term $p_{i(\mathring{\hbar}_{k}^{i})}^{\hbar_{k}}$ indicates the total number of patients in hospital $\hbar_k$ belonging to $c_i$ category. The patients who need
consultancy may belong to different income bars.
So, in this
scenario, each hospital tries to select the patient from the
lowest income bar in a particular category (say $c_i$ category)
who will get the free consultation.
On the other hand, there are several doctors having different expertise associated with different hospitals say $\boldsymbol{\mathcal{H}} = \{\mathcal{H}_1, \mathcal{H}_2, \ldots, \mathcal{H}_n\}$. The set of all the available doctors in different categories associated with different hospitals is given as: $\boldsymbol{\mathcal{D}} = \bigcup\limits_{\mathcal{H}_k \in \mathcal{H}} \bigcup\limits_{c_j \in \boldsymbol{\mathcal{C}}} \bigcup\limits_{i=1}^{\mathring{\mathcal{H}}_{k}^{i}} d_{j(i)}^{\mathcal{H}_k}$
where $d_{i(j)}^{\mathcal{H}_k}$ is the doctor \emph{j} belonging to $c_i$ category associated to $\mathcal{H}_k$ hospital. The expression $\mathring{\mathcal{H}}_{k}^{j}$ in term $d_{j(\mathring{\mathcal{H}}_{k}^{j})}^{\mathcal{H}_{k}}$ indicates the total number of doctors associated with hospital $\mathcal{H}_k$ in $c_j$ category. Our model captures only a single category say $c_i$ but it is to be noted that our proposed model works well for the system considering multiple categories simultaneously. Only thing is that we have to repeat the process \emph{k} times as \emph{k} categories are existing. For simplicity purpose, in any category $c_i$ we have considered the number of patients and number of doctors are same $i.e.$ \emph{n} along with an extra constraint that each of the members of the participating parties provides a strict preference ordering over all the available members of the opposite party. But, one can think of the situation where there are \emph{n} number of patients and \emph{m} number of doctors in a category such that $m \neq n$ ($m>n$ or $m<n$). Moreover, the condition that every members of the participating party is providing the strict preference ordering over all the available members of the opposite community is not essential and can be relaxed for all the three cases ($i.e.$ $m=n$, $m<n$, and $m>n$).
\begin{figure}[H]
\centering
\includegraphics[scale=0.80]{model.eps}
\caption{System model}
\label{fig:1}
\end{figure}
By relaxation, it is meant that the members of the participating parties may provide the strict preference ordering over the subset of the members of the opposite party.
At a
particular time several doctors ($>$ n) are providing their willingness to impart free consultancy to some patients present
in the consultancy arena in a particular category as shown
in the right side of the Figure \ref{fig:1}. In the schematic diagram shown in Figure \ref{fig:1}, for representation purpose one doctor is selected from all the interested doctors from each hospital belonging to a particular category $c_i$.
But in general one can think of the situation where multiple doctors can be selected from the available doctors from a particular hospital in a particular category $c_i$ such that $|\boldsymbol{\mathcal{P}}_i| = \sum_{\mathcal{H}_j \in \boldsymbol{\mathcal{H}}} \dot{\mathcal{H}}_{j}^{i}$; where $0 \leq \dot{\mathcal{H}}_{j}^{i} \leq n $ is the number of doctors selected from hospital $\mathcal{H}_j$ in $c_i$ category and placed into the consultancy arena.
Following the above discussed criteria, the third party selects
$n$ doctors out of all the doctors in a particular category $c_i$ as
a possible expert consultant and is given as $\boldsymbol{\mathcal{D}}_{i} = \{d_{i(1)}^{\mathcal{H}_1}, d_{i(2)}^{\mathcal{H}_2}, \ldots, d_{i(n)}^{\mathcal{H}_n} \}$ and a set of selected patients from $c_i$ category is given as $\boldsymbol{\mathcal{P}}_{i} = \{p_{i(1)}^{\hbar_{1}}, p_{i(2)}^{\hbar_{2}}, \ldots, p_{i(n)}^{\hbar_{n}}\}$. If not specified explicitly, \emph{n} denotes the total number of patients and the total number of doctors that are participating in the consultancy arena in any category $c_i$. For placing \emph{n} doctors in the
consultancy arena from the available doctors, the third party
can take the help of the qualification of the doctors and number of successful operations or consultancies given so far by
that doctor.
Each patient $p_{i(j)}^{\hbar_k}$ reveals a strict preference ordering over the participating set of doctors $\boldsymbol{\mathcal{D}}_i$ in a category $c_{i}$ and also each doctor $d_{i(t)}^{\mathcal{H}_k}$ provides the strict preference ordering over the set of participating patients of category $c_{i}$ in the consultancy arena. The strict preference ordering of the patient $p_{i(k)}^{\hbar_{j}}$ over the set of doctors $\boldsymbol{\mathcal{D}}_{i}$ is denoted by $\succ_{k}^{i}$. More formally, the significance of $d_{i(\ell)}^{\mathcal{H}_j} \succ_{k}^{i} d_{i(m)}^{\mathcal{H}_k}$ is that the patient $p_{i(k)}^{\hbar_t}$ ranks doctor $d_{i(\ell)}^{\mathcal{H}_j}$ above the doctor $d_{i(m)}^{\mathcal{H}_k}$. The preference profile of all the patients for \emph{k} different categories is denoted as $\succ = \{\succ^{1}, \succ^{2}, \ldots, \succ^{k}\}$, where $\succ^{i}$ denotes the preference profile of all the patients in category $c_i$ over all the doctors in set $\boldsymbol{\mathcal{D}}_{i}$ represented as $\succ^{i} = \{\succ_{1}^{i}, \succ_{2}^{i}, \ldots, \succ_{n}^{i}\}$. The preference profile of all the patients in $c_i$ category except the patient \emph{r} is given as $\succ_{-r}^{i} = \{\succ_{1}^{i}, \succ_{2}^{i}, \ldots, \succ_{r-1}^{i}, \succ_{r+1}^{i}, \ldots \succ_{n}^{i}\} $. On the other hand, the doctors may give preferences based on the location
where he/she (henceforth he) and the patients are located. The strict preference ordering of the doctor $d_{j(t)}^{\mathcal{H}_k}$ is denoted by $\curlyeqsucc_{j}^{t}$ over the set of patients $\boldsymbol{\mathcal{P}}_{j}$, where $p_{j(\ell)}^{\hbar_k} \curlyeqsucc_{j}^{t} p_{j(m)}^{\hbar_i}$ means that doctor $d_{j(t)}^{\mathcal{H}_k}$ ranks $p_{j(\ell)}^{\hbar_k}$ above $p_{j(m)}^{\hbar_i}$. The set of preferences of all the doctors in \emph{k} different categories is denoted as $\curlyeqsucc = \{\curlyeqsucc_{1}, \curlyeqsucc_{2}, \ldots, \curlyeqsucc_{k}\}$, where $\curlyeqsucc_{j}$ contains the strict preference ordering of all the doctors in $c_j$ category over all the patients in set $\boldsymbol{\mathcal{P}}_{j}$ represented as $\curlyeqsucc_{j} = \{\curlyeqsucc_{j}^{1}, \curlyeqsucc_{j}^{2}, \ldots, \curlyeqsucc_{j}^{n}\}$. The strict preference ordering of all the doctors in $c_j$ category except the doctor \emph{s} is represented as $\curlyeqsucc_{j}^{-s} = \{\curlyeqsucc_{j}^{1}, \curlyeqsucc_{j}^{2}, \ldots, \curlyeqsucc_{j}^{s-1}, \curlyeqsucc_{j}^{s+1}, \ldots, \curlyeqsucc_{j}^{n}\}$.
It is to be noted that the allocation of the doctors to the patients for category $c_i$ under consideration is captured by the allocation function $\mathcal{A}_i$: $\succ$ $\times$ $\curlyeqsucc$ $\rightarrow$ $\boldsymbol{\mathcal{P}}_i$ $\times$ $\boldsymbol{\mathcal{D}}_i$. The resulting allocation vector is given as $\boldsymbol{\mathcal{A}} = \{\mathcal{A}_{1}, \mathcal{A}_{2}, \ldots, \mathcal{A}_{k}\}$. Each allocation vector
$\mathcal{A}_{i} \in \boldsymbol{\mathcal{A}}$ denotes the patient-doctor pairs belonging to
the $c_i$ category denoted as $\mathcal{A}_{i} = \bigcup_{j=1;k=1}^{n;n} a_{jk}^{i}$, where each $a^{i}_{lm} \in \mathcal{A}_{i}$ is a pair $\{p_{i(l)}^{\hbar_k}, d_{i(m)}^{\mathcal{H}_j}\}$. The matching between the patients and doctors for any category $c_i$ is captured by the
mapping function $\boldsymbol{\mathcal{M}}: \boldsymbol{\mathcal{P}}_i \cup \boldsymbol{\mathcal{D}}_i$ \textrightarrow $\boldsymbol{\mathcal{D}}_i \cup \boldsymbol{\mathcal{P}}_i$. More formally, $
\boldsymbol{\mathcal{M}}(p_{i(j)}^{\hbar_k}) = d_{i(k)}^{\mathcal{H}_\ell} $ means that patient $p_{i(j)}^{\hbar_k}$ is matched to $d_{i(k)}^{\mathcal{H}_\ell}$ doctor and
$\boldsymbol{\mathcal{M}}(d_{i(\ell)}^{\mathcal{H}_k}) = p_{i(t)}^{\hbar_\ell} $ means that doctor $d_{i(\ell)}^{\mathcal{H}_k}$ is matched to $p_{i(t)}^{\hbar_\ell}$.
\section{Required definitions}
\begin{definition}\label{d2}
\textbf{Blocking pair}: Fix a category $c_k$. We say that a pair $p_{k(i)}^{\hbar_t}$ and $d_{k(j)}^{\mathcal{H}_{\ell}}$ form a \emph{blocking pair} for matching $\boldsymbol{\mathcal{M}}$, if the following three conditions holds: (i) $\boldsymbol{\mathcal{M}}(p_{k(i)}^{\hbar_t}) \neq d_{k(j)}^{\mathcal{H}_{\ell}}$, (ii) $d_{k(j)}^{\mathcal{H}_{\ell}}$ $\succ_{i}^{k}$ $\boldsymbol{\mathcal{M}}(p_{k(i)}^{\hbar_t})$, and (iii) $p_{k(i)}^{\hbar_t}$ $\curlyeqsucc_{k}^{j}$ $\boldsymbol{\mathcal{M}}(d_{k(j)}^{\mathcal{H}_{\ell}})$.
\end{definition}
\begin{definition}\label{d3}
\textbf{Stable matching}: Fix a category $c_k$. A matching $\boldsymbol{\mathcal{M}}$ is \emph{stable} if there is no pair $p_{k(i)}^{\hbar_t}$ and $d_{k(j)}^{\mathcal{H}_{\ell}}$ such that it satisfies the conditions mentioned in (i)-(iii) in Definition 1.
\end{definition}
\begin{definition}\label{d4}
\textbf{Perfect matching}: Fix a category $c_k$. A matching $\boldsymbol{\mathcal{M}}$ is \emph{perfect matching} if there exists one-to-one matching between the members of $\boldsymbol{\mathcal{P}}_k$ and $\boldsymbol{\mathcal{D}}_k$.
\end{definition}
\begin{definition} \label{d5}
\textbf{Patient-optimal stable allocation}: Fix a category $c_k$. A matching $\boldsymbol{\mathcal{M}}$ is \emph{patient optimal}, if there exists no stable matching $\boldsymbol{\mathcal{M}}'$ such that $\boldsymbol{\mathcal{M}}'(p_{k(j)}^{\hbar_t}) \succ_{j}^{k} \boldsymbol{\mathcal{M}}(p_{k(j)}^{\hbar_t})$ or $\boldsymbol{\mathcal{M}}'(p_{k(j)}^{\hbar_t}) =_{j}^{k} \boldsymbol{\mathcal{M}}(p_{k(j)}^{\hbar_t})$ for at least one $p_{i(j)}^{\hbar_t} \in \boldsymbol{\mathcal{P}}_i$. Similar is the situation for \emph{doctor-optimal stable allocation}.
\end{definition}
\begin{definition}\label{d1}
\textbf{Strategy-proof for requesting party}: Fix a category $c_k$. Given the preference profile $\succ^{k}$ and $\curlyeqsucc_k$ of the patients and doctors in $c_k$ category, a mechanism $\mathbb{M}$ is \emph{strategy-proof} (\emph{truthful}) for the requesting party if for each members of the requesting party $\mathcal{A}_k$ is preferred over $\hat{\mathcal{A}}_k$; where $\hat{\mathcal{A}}_k$ is the allocation when at least one member in requesting party is misreporting.
\end{definition}
\section{Proposed mechanisms}
The idea behind proposing randomized mechanism $i.e.$ RAMHECs is to better understand the more robust and philosophically strong \emph{optimal} mechanism TOMHECs. The further illustration of the mechanisms are done under the consideration that patient party is requesting. Moreover, one can utilize the same road map of the mechanisms by considering doctors as the requesting party. This can easily be done by just interchanging their respective roles in the mechanisms.
\subsection{RAMHECs}
The idea lies behind the construction of \emph{initialization phase} is to handle the system consisting \emph{k} different categories. The algorithm is depicted in Algorithm 1.
\subsubsection{Upper bound analysis of RAMHECs}
The overall running time of RAMHECs is $O(1) + O(kn) = O(kn)$.
\subsubsection{Correctness of RAMHECs}
The correctness of RAMHECs is proved with the loop invariant technique ~\cite{Coreman_2009, Gries_2009}. The \emph{loop invariant} that we have to prove is that at the end of the $i^{th}$ iteration each of the patients in $c_j$ category gets one distinct doctor allocated. We must show three things for the \emph{loop invariant} technique to be true.\\
\textbf{Initialization:} It is true prior to the first iteration of the \emph{while} loop. Just before the first iteration of the \emph{while} loop $\mathcal{A}_j \leftarrow \phi$. This confirms that $\mathcal{A}_j$ contains no patient-doctor pair prior to the first iteration of the \emph{while} loop.\\
\textbf{Maintenance:} The \emph{loop invariant} to be true, we have to show that if it is true before each iteration of \emph{while} loop, it remains true before the next iteration. The body of the \emph{while} loop allocates a doctor to a patient in a particular category $i.e.$ each time $\mathcal{A}_j$ is incremented by 1. Just before the $i^{th}$ iteration, the $\mathcal{A}_j$ data structure contains $(i-1)$ number of patient-doctor pairs. After the $i^{th}$ iteration, the $\mathcal{A}_j$ data structure contains $i$ patient-doctor pairs. This way at the end of the $i^{th}$ iteration all the $i$ patients gets a distinct doctor and the \emph{patient-doctor} pairs are stored in $\mathcal{A}_j$ $[1 \ldotp \ldotp i]$.\\
\textbf{Termination:} The third property is to check, what happens when the \emph{while} loop terminates. The condition causing the \emph{while} loop to terminate is that, for any category $c_j$, each of the patients are allocated with one distinct doctor leading to \emph{n} patient-doctor pairs in $\mathcal{A}_j$ data structure. Because each loop iteration increments $\mathcal{A}_j$ by 1, we must have $|\mathcal{A}_j| = n$ when all \emph{n} patients are already processed. So, when the loop terminates we have a data structure $\mathcal{A}_j$ $[1 \ldotp \ldotp n]$ that is already processed and it consists of \emph{n} patient-doctor pairs.\\
If the RAMHECs is true for a particular category $c_j \in \boldsymbol{\mathcal{C}}$ it will remain true when all category in $\boldsymbol{\mathcal{C}}$ taken simultaneously. Hence, the RAMHECs is correct.
\begin{algorithm}[H]
\caption{RAMHECs ($\boldsymbol{\mathcal{D}}$, $\boldsymbol{\mathcal{P}}$, $\boldsymbol{\mathcal{C}}$, $\succ$, $\curlyeqsucc$)}
\begin{algorithmic}[1]
\Output $\boldsymbol{\mathcal{A}} = \{\mathcal{A}_1, \mathcal{A}_2, \ldots, \mathcal{A}_k\}$
\State \textbf{begin}
\NoNumber{/* \textbf{Initialization phase} */ }
\State $\boldsymbol{\mathcal{A}} \leftarrow \phi$
\For{each $c_i \in \boldsymbol{\mathcal{C}}$}
\State $k$ $\leftarrow$ $0$, $i$ $\leftarrow$ $0$, $d^{*}$ $\leftarrow$ $\phi$, $p^{*}$ $\leftarrow$ $\phi$, $\mathcal{A}_i \leftarrow \phi$, $\mathcal{P}^* \leftarrow \phi$, $\mathcal{D}^* \leftarrow \phi$
\State $i$ $\leftarrow$ \emph{select}($\boldsymbol{\mathcal{P}}$) \Comment{return the index of patient from patient set.}
\State $\mathcal{P}^*$ $\leftarrow$ $\mathcal{P}_i$
\State $i$ $\leftarrow$ \emph{select}($\boldsymbol{\mathcal{D}}$) \Comment{return the index of doctor from doctor set.}
\State $\mathcal{D}^{*}$ $\leftarrow$ $\mathcal{D}_i$
\NoNumber{/* \textbf{Allocation phase} */}
\While {$|\mathcal{A}_i| \neq n$}
\State $t \leftarrow rand(\mathcal{P}^*)$ \Comment{return index of randomly selected patient.}
\State $p^{*}$ $\leftarrow$ $p_{i(t)}^{\hbar_k}$
\State $k$ $\leftarrow$ $rand$($\succ_{t}^i$, $\mathcal{D}^*$) \Comment{returns the index of randomly selected doctor from the patient \emph{t} preference list.}
\State $d^{*}$ $\leftarrow$ $d_{i(k)}^{\mathcal{H}_{\ell}}$
\State $\mathcal{A}_{i}$ $\leftarrow$ $\mathcal{A}_i$ $\cup$ $\{(p^{*}$, $d^{*})\}$
\State $\mathcal{P}_i$ $\leftarrow$ $\mathcal{P}_i$ $\setminus$ $p^{*}$ \Comment{Removes the allocated patients from available patient list.}
\State $\mathcal{D}_i$ $\leftarrow$ $\mathcal{D}_i$ $\setminus$ $d^{*}$ \Comment{Removes the allocated doctors from available doctor list.}
\EndWhile
\State $\boldsymbol{\mathcal{A}}$ $\leftarrow$ $\boldsymbol{\mathcal{A}}$ $\cup$ $\mathcal{A}_i$
\EndFor
\Return $\boldsymbol{\mathcal{A}}$
\State \textbf{end}
\end{algorithmic}
\end{algorithm}
\subsubsection{Illustrative example}
For understanding purpose, let the category be $c_3$ (say \emph{eye surgery}). The set of patient from 4 different hospitals $\hbar$ = $\{\hbar_1, \hbar_2, \hbar_3, \hbar_4\}$ is given as: $\boldsymbol{\mathcal{P}}_{3} = \{p_{3(1)}^{\hbar_2}, p_{3(2)}^{\hbar_3}, p_{3(3)}^{\hbar_4}, p_{3(4)}^{\hbar_1}\}$. The set of available doctors engaged to 4 different hospitals $\mathcal{H}$ = $\{\mathcal{H}_1, \mathcal{H}_2, \mathcal{H}_3, \mathcal{H}_4\}$ is given as: $\boldsymbol{\mathcal{D}}_3$ = $\{d_{3(1)}^{\mathcal{H}_3}, d_{3(2)}^{\mathcal{H}_1}, d_{3(3)}^{\mathcal{H}_4}, d_{3(4)}^{\mathcal{H}_2}\}$.
The preference profile of patient set $\mathcal{P}_{3}$ is given as: $p_{3(1)}^{\hbar_2}$ = [$d_{3(4)}^{\mathcal{H}_2} \succ_{1}^{3} d_{3(3)}^{\mathcal{H}_4} \succ_{1}^{3} d_{3(1)}^{\mathcal{H}_3} \succ_{1}^{3} d_{3(2)}^{\mathcal{H}_1}$], $ p_{3(2)}^{\hbar_3}$ = [$d_{3(3)}^{\mathcal{H}_4} \succ_{2}^{3} d_{3(4)}^{\mathcal{H}_2} \succ_{2}^{3} d_{3(2)}^{\mathcal{H}_1} \succ_{2}^{3} d_{3(1)}^{\mathcal{H}_3}$], $p_{3(3)}^{\hbar_4}$ = [$d_{3(4)}^{\mathcal{H}_2} \succ_{3}^{3} d_{3(2)}^{\mathcal{H}_1} \succ_{3}^{3} d_{3(1)}^{\mathcal{H}_3} \succ_{3}^{3} d_{3(3)}^{\mathcal{H}_4}$], $ p_{3(4)}^{\hbar_1}$ = [$d_{3(2)}^{\mathcal{H}_1} \succ_{4}^{3} d_{3(3)}^{\mathcal{H}_4} \succ_{4}^{3} d_{3(4)}^{\mathcal{H}_2} \succ_{4}^{3} d_{3(1)}^{\mathcal{H}_3}$]. Similarly, the preference profile of doctor set $\mathcal{D}_3$ is given as: $d_{3(1)}^{\mathcal{H}_3}$ = [$p_{3(1)}^{\hbar_2} \curlyeqsucc_{3}^{1} p_{3(2)}^{\hbar_3} \curlyeqsucc_{3}^{1} p_{3(4)}^{\hbar_1} \curlyeqsucc_{3}^{1} p_{3(3)}^{\hbar_4}$], $d_{3(2)}^{\mathcal{H}_1}$ = [$p_{3(2)}^{\hbar_3} \curlyeqsucc_{3}^{2} p_{3(4)}^{\hbar_1} \curlyeqsucc_{3}^{2} p_{3(1)}^{\hbar_2} \curlyeqsucc_{3}^{2} p_{3(3)}^{\hbar_4}$], $d_{3(3)}^{\mathcal{H}_4}$ = [$p_{3(3)}^{\hbar_4} \curlyeqsucc_{3}^{3} p_{3(1)}^{\hbar_2} \curlyeqsucc_{3}^{3} p_{3(2)}^{\hbar_3} \curlyeqsucc_{3}^{3} p_{3(4)}^{\hbar_1}$], $d_{3(4)}^{\mathcal{H}_2}$ = [$p_{3(4)}^{\hbar_1} \curlyeqsucc_{3}^{4} p_{3(3)}^{\hbar_4} \curlyeqsucc_{3}^{4} p_{3(1)}^{\hbar_2} \curlyeqsucc_{3}^{4} p_{3(2)}^{\hbar_3}$]. Given the preference profiles,
\emph{while} loop in line 9-17 randomly selects patient $p_{3(3)}^{\hbar_4}$ from the available patients list $\mathcal{P}_3$. Line 12 of the RAMHECs randomly selects doctor $d_{3(4)}^{\mathcal{H}_2}$ from the available preference ordering of $p_{3(3)}^{\hbar_4}$. At the end of first iteration of the \emph{while} loop, the RAMHECs captures $(p_{3(3)}^{\hbar_4}, d_{3(4)}^{\mathcal{H}_2})$ pair in the $\mathcal{A}_3$ data structure.
In the similar fashion, the remaining allocation is done. The final patient-doctor allocation pair done by the mechanism is $\mathcal{A}_3$ = $\{(p_{3(3)}^{\hbar_4}, d_{3(4)}^{\mathcal{H}_2}), (p_{3(2)}^{\hbar_3}, d_{3(3)}^{\mathcal{H}_4}), (p_{3(4)}^{\hbar_1}, d_{3(1)}^{\mathcal{H}_3}), (p_{3(1)}^{\hbar_2}, d_{3(2)}^{\mathcal{H}_1})\}$.
\subsection{TOMHECs}
Our main focus is to propose a mechanism that satisfy the two important economic properties: \emph{truthfulness}, and \emph{optimality} .
The TOMHECs is illustrated in Algorithm 2.
\subsubsection{Running time}
The total running time of TOMHECs is given as: $T(n)= \sum_{i=1}^{k}(O(1) + (\sum_{i=1}^{n} O(n)))= O(kn^2)$
\\
\begin{breakablealgorithm}
\caption{TOMHECs ($\boldsymbol{\mathcal{D}}$, $\boldsymbol{\mathcal{P}}$, $\boldsymbol{\mathcal{C}}$, $\succ$, $\curlyeqsucc$)}
\begin{algorithmic}[1]
\Output $\boldsymbol{\mathcal{A}} = \{\mathcal{A}_1, \mathcal{A}_2, \ldots, \mathcal{A}_k\}$
\State \textbf{begin}
\NoNumber{/* \textbf{Initialization phase} */ }
\State $i$ $\leftarrow$ $0$, $\boldsymbol{\mathcal{A}} \leftarrow \phi$
\NoNumber{/* \textbf{Allocation phase} */ }
\For{each $c_i \in \boldsymbol{\mathcal{C}}$}
\State $\mathcal{A}_i \leftarrow \phi$
\State $i$ $\leftarrow$ \emph{select}($\boldsymbol{\mathcal{P}}$)
\State $\mathcal{P}^*$ $\leftarrow$ $\boldsymbol{\mathcal{P}}_i$
\State $i$ $\leftarrow$ \emph{select}($\boldsymbol{\mathcal{D}}$)
\State $\mathcal{D}^{*}$ $\leftarrow$ $\boldsymbol{\mathcal{D}}_i$
\For{each $d_{i(j)}^{\mathcal{H}_k} \in \mathcal{D}^* $}
\State $\Pi(d_{i(j)}^{\mathcal{H}_k}) \leftarrow \phi$ \emph{\Comment{$\Pi(d_{i(j)}^{\mathcal{H}_k})$ data structure keeps track of set of $p_{i(j)}^{\hbar_k} \in \boldsymbol{\mathcal{P}}_i$ requesting to $d_{i(j)}^{\mathcal{H}_k}$.}}
\EndFor
\While {$|\mathcal{A}_i| \neq n$}
\For{each free patient $p_{i(j)}^{\hbar_k} \in \boldsymbol{\mathcal{P}}_i$}
\State $d^*$ $\leftarrow$ select most preferred doctor from $\succ_{j}^{i}$ not approached till now.
\State $\Pi(d^*) \leftarrow \Pi(d^*)$ $\cup$ $p_{i(j)}^{\hbar_k}$
\EndFor
\For{each engaged doctor $d_{i(j)}^{\mathcal{H}_k} \in \boldsymbol{\mathcal{D}}_i$}
\If {$|\Pi(d_{i(j)}^{\mathcal{H}_k})| > 1$}
\State $p^{*}$ $\leftarrow$ select\_best($\curlyeqsucc_{i}^{j}$, $\Pi(d_{i(j)}^{\mathcal{H}_k})$)
\If {$(p_{i(j)}^{\hbar_k}, d_{i(j)}^{\mathcal{H}_k}) \in \mathcal{A}_i$ \textbf{and} $p^{*} \curlyeqsucc_{i}^{j} p_{i(j)}^{\hbar_k}$}
\State $\mathcal{A}_i$ $\leftarrow$ $\mathcal{A}_i$ $\setminus$ $(p_{i(j)}^{\hbar_k}, d_{i(j)}^{\mathcal{H}_k})$
\State $\mathcal{A}_i \leftarrow \mathcal{A}_i \cup (p^*, d_{i(j)}^{\mathcal{H}_k}) $
\State $\Pi(d_{i(j)}^{\mathcal{H}_k})$ $\leftarrow$ $\Pi(d_{i(j)}^{\mathcal{H}_k}) \setminus \Pi(d_{i(j)}^{\mathcal{H}_k}) - \{p^*\}$
\ElsIf{$(p_{i(j)}^{\hbar_k}, d_{i(j)}^{\mathcal{H}_k}) \notin \mathcal{A}_i$}
\State $\mathcal{A}_i \leftarrow \mathcal{A}_i \cup (p^*, d_{i(j)}^{\mathcal{H}_k}) $
\State $\Pi(d_{i(j)}^{\mathcal{H}_k})$ $\leftarrow$ $\Pi(d_{i(j)}^{\mathcal{H}_k}) \setminus \Pi(d_{i(j)}^{\mathcal{H}_k}) - \{p^*\}$
\EndIf
\ElsIf{$|\Pi(d_{i(j)}^{\mathcal{H}_k})| == 1$}
\If{$(\Pi(d_{i(j)}^{\mathcal{H}_k}), d_{i(j)}^{\mathcal{H}_k}) \notin \mathcal{A}_i$}
\State $\mathcal{A}_i \leftarrow \mathcal{A}_i \cup (\Pi(d_{i(j)}^{\mathcal{H}_k}), d_{i(j)}^{\mathcal{H}_k})$
\EndIf
\EndIf
\EndFor
\EndWhile
\State $\boldsymbol{\mathcal{A}}$ $\leftarrow$ $\boldsymbol{\mathcal{A}}$ $\cup$ $\mathcal{A}_i$
\EndFor
\Return $\boldsymbol{\mathcal{A}}$
\State \textbf{end}
\end{algorithmic}
\end{breakablealgorithm}
\subsubsection{Correctness of the TOMHECs}
The correctness of the TOMHECs is proved with the \emph{loop invariant} technique ~\cite{Coreman_2009, Gries_2009}.\\
The \emph{loop invariant}: Fix a category $c_i$. At the start of $\ell^{th}$ iteration of the \emph{while} loop, the number of temporarily processed patient-doctor pairs or in other words the number of patient-doctor pairs held by $\mathcal{A}_i$ is given as: $|\cup_{j=1}^{\ell-1} \mathcal{A}'_j|$, where $\mathcal{A}'_j$ is the net patient-doctor pairs temporarily maintained in the set $\mathcal{A}'_j$ at the $j^{th}$ iteration. So, on an average the number of patients or doctors (whomsoever is greater) that are to be explored in further iterations are $n - |\cup_{j=1}^{\ell-1} \mathcal{A}'_j|$. From the construction of the TOMECs it is clear that after any $\ell^{th}$ iteration this condition holds: $0 \leq n - |\cup_{i=1}^{\ell} \mathcal{A}'_j| \leq n$; where $1 \leq \ell \leq n^2$. The net minimum number of patient-doctor pairs that can be processed temporarily at any iteration may be \emph{zero}. Hence, inequality $0 \leq n - |\cup_{i=1}^{\ell} \mathcal{A}'_j| \leq n$ is always \emph{true}. We must show three things for this \emph{loop invariant} to be true.\\
\textbf{Initialization:} It is true prior to the first iteration of the \emph{while} loop. Just before the first iteration of the \emph{while} loop, in TOMHECs the inequality $0 \leq n - |\cup_{i=1}^{\ell} \mathcal{A}'_j| \leq n$ blows down to $0 \leq n - 0 \leq n$ $\Rightarrow$ $0 \leq n \leq n$ $i.e.$ no patient-doctor pair is temporarily added to $\mathcal{A}_i$ prior to the first iteration of \emph{while} loop. This confirms that $\mathcal{A}_i$ contains no patient-doctor pair.\\
\textbf{Maintenance:} For the \emph{loop invariant} to be true, if it is true before each iteration of the \emph{while} loop, it remains true before the next iteration of the \emph{while} loop. The body of \emph{while} loop allocates doctor(s) to the patient(s) with each doctor is allocated to a patient; $i.e.$ each time the cardinality of $\mathcal{A}_i$ is either incremented by some amount or remains similar to previous iteration. Just before the $\ell^{th}$ iteration the patient-doctor pairs temporarily added to $A_i$ are $\cup_{i=1}^{\ell-1} \mathcal{A}'_j$. So, one can conclude from here that the number of patient-doctor pairs that are left is given by inequality: $0 \leq n - |\cup_{i=1}^{\ell-1} \mathcal{A}'_j| \leq n$. After the $(\ell-1)^{th}$ iteration, the available number of patient-doctor pair $n - |\cup_{i=1}^{\ell-1} \mathcal{A}'_j| \geq 0$ can be captured under two cases:\\
\textbf{Case 1:} If $|\mathcal{A}_i| = n$:
This case will lead to exhaust all the remaining patient-doctor pair in the current $\ell^{th}$ iteration and no patient-doctor pair is left for the next iteration. The inequality $ n - (|\cup_{i=1}^{\ell-1} \mathcal{A}'_i \cup \mathcal{A}'_{\ell}|)$ = $ n - (|\cup_{i=1}^{\ell} \mathcal{A}'_i |) = n - |\mathcal{A}_i|$ = 0. Hence, it means that all the remaining patient-doctor is absorbed in this iteration and no patient-doctor pair is left for processing.\\
\textbf{Case 2:}
If $|\mathcal{A}_i| < n$:
This case captures the possibility that there may be the scenario when few patient-doctor pairs from the remaining patient-doctor pairs may still left out; leaving behind some of the pairs for further iterations. So, the inequality $n - (|\cup_{i=1}^{\ell-1} \mathcal{A}'_i \cup \mathcal{A}'_{\ell}|) > 0$ $\Rightarrow$ $n > n - (|\cup_{i=1}^{\ell} \mathcal{A}'_i |) > 0$ is satisfied.\\
\indent From Case 1 and Case 2, at the end of $\ell^{th}$ iteration the loop invariant is satisfied.\\
\textbf{Termination:} It is clear that in each iteration the cardinality of output data structure $i.e.$ $\mathcal{A}_i$ either incremented by some amount or remains as the
previous iteration. This indicates that at some $\ell^{th}$ iteration the loop terminates by dissatisfying the condition of the while loop $|\mathcal{A}_i| \neq n$ at line 12. When the loop terminates it is for sure that $|\mathcal{A}_i| = n$. We can say $n - |\cup_{i=1}^{\ell} \mathcal{A}'_i| = 0 \Rightarrow 0 \leq n$. Thus, this inequality indicates that all the \emph{n} patient and doctors in $c_i$ category are processed and each patient allocated a best possible doctor when the loop terminates.\\
If the TOMHECs is true for the $c_i \in \boldsymbol{\mathcal{C}}$ category it will remain true when all category in $\boldsymbol{\mathcal{C}}$ taken simultaneously. Hence, the TOMHECs is correct.
\subsubsection{Example}
Considering the initial set-up discussed in section 4.1.3. According to line 13-16 of TOMHECs each of the patients $p_{3(1)}^{\hbar_2}$, $p_{3(2)}^{\hbar_3}$, $p_{3(3)}^{\hbar_4}$, and $p_{3(4)}^{\hbar_1}$ are requesting to the most preferred doctor from their respective preference list $i.e.$ $d_{3(4)}^{\mathcal{H}_2}$, $d_{3(3)}^{\mathcal{H}_4}$, $d_{3(4)}^{\mathcal{H}_2}$, and $d_{3(2)}^{\mathcal{H}_1}$ respectively. In the next step, we will check if any requested doctor among $d_{3(1)}^{\mathcal{H}_3}$, $d_{3(2)}^{\mathcal{H}_1}$, $d_{3(3)}^{\mathcal{H}_4}$, and $d_{3(4)}^{\mathcal{H}_2}$ has got the multiple request from the patients in $\boldsymbol{\mathcal{P}}_3$. Now, it can be seen that, in the first iteration of TOMHECs doctor $d_{3(4)}^{\mathcal{H}_2}$ have got requests from patients $p_{3(1)}^{\hbar_2}$, and $p_{3(3)}^{\hbar_4}$. As each doctor can be assigned to only one patient, so this competitive environment between patient $p_{3(1)}^{\hbar_2}$, and $p_{3(3)}^{\hbar_4}$ can be resolved by considering the strict preference ordering of doctor $d_{3(4)}^{\mathcal{H}_2}$ over the available patients in $\boldsymbol{\mathcal{P}}_3$. From the strict preference ordering of doctor $d_{3(4)}^{\mathcal{H}_2}$ it is clear that patient $p_{3(3)}^{\hbar_4}$ is preferred over patient $p_{3(1)}^{\hbar_2}$. Hence, patient $p_{3(1)}^{\hbar_2}$ is rejected. So, for the meanwhile $p_{3(2)}^{\hbar_3}$ gets a doctor $d_{3(3)}^{\mathcal{H}_4}$, $p_{3(3)}^{\hbar_4}$ gets a doctor $d_{3(4)}^{\mathcal{H}_2}$, and $p_{3(4)}^{\hbar_1}$ gets a doctor $d_{3(2)}^{\mathcal{H}_1}$. Now, as the patient $p_{3(1)}^{\hbar_2}$ do not get his/her (henceforth his) most preferred doctor $i.e.$ $d_{3(4)}^{\mathcal{H}_2}$ from his preference list. So, he will request the second best doctor $i.e. $ $d_{3(3)}^{\mathcal{H}_4}$ from his preference list. As doctor $d_{3(3)}^{\mathcal{H}_4}$ is already been requested by $p_{3(2)}^{\hbar_3}$, the similar situation now occurs in case of doctor $d_{3(3)}^{\mathcal{H}_4}$ where patients $p_{3(1)}^{\hbar_2}$ and $p_{3(2)}^{\hbar_3}$ are simultaneously requesting to doctor $d_{3(3)}^{\mathcal{H}_4}$. Looking at the preference list of $d_{3(3)}^{\mathcal{H}_4}$, we get, patient $p_{3(1)}^{\hbar_2}$ is preferred over $p_{3(2)}^{\hbar_3}$. So, patient $p_{3(2)}^{\hbar_3}$ is rejected. Now, $p_{3(2)}^{\hbar_3}$ request the second best doctor $i.e.$ $d_{3(4)}^{\mathcal{H}_2}$ from his preference list. In
the similar fashion, the remaining allocation is done. The final allocation is:$\{(p_{3(1)}^{\hbar_2}, d_{3(3)}^{\mathcal{H}_4}), (p_{3(2)}^{\hbar_3}, d_{3(1)}^{\mathcal{H}_3}), (p_{3(3)}^{\hbar_4}, d_{3(4)}^{\mathcal{H}_2}), (p_{3(4)}^{\hbar_1}, d_{3(2)}^{\mathcal{H}_1})\}$.
\subsection{Several properties}
The proposed TOMHECs has several compelling properties. These properties are discussed next.
\begin{proposition}\label{p1}
The matching computed by the Gale-Shapley mechanism ~\cite{Gale_AMM_1962, Shapley_2013} results in a stable matching.
\end{proposition}
\begin{proposition}\label{p2}
A stable matching computed by Gale-Shapley mechanism ~\cite{Gale_AMM_1962, Shapley_2013} is requesting party optimal.
\end{proposition}
\begin{proposition}\label{p3}
Gale-Shapley mechanism ~\cite{Gale_AMM_1962, Shapley_2013} is truthful for the requesting party.
\end{proposition}
Following the above mentioned propositions and motivated by ~\cite{Gale_AMM_1962, Shapley_2013} we have proved that the TOMHECs results in \emph{stable}, \emph{optimal}, and \emph{truthful} allocation when all the \emph{k} different categories are taken simultaneously.
\begin{mylemma}\label{d1}
TOMHECs results in a stable allocation for the requesting party (patient party or doctor party).
\end{mylemma}
\begin{proof}
Fix a category $c_i \in \boldsymbol{\mathcal{C}}$. Let us suppose for the sake of contradiction there exists a \emph{blocking pair} $(p_{i(j)}^{\hbar_k}, d_{i(j)}^{\mathcal{H}_l})$ that results in an unstable matching $\boldsymbol{\mathcal{M}}$ for the requesting party. As their exists a \emph{blocking pair} $(p_{i(j)}^{\hbar_k}, d_{i(j)}^{\mathcal{H}_l})$ it may be due to the case that $(p_{i(j)}^{\hbar_k}, d_{i(k)}^{\mathcal{H}_j})$ and $(p_{i(k)}^{\hbar_j}, d_{i(j)}^{\mathcal{H}_l})$ are their in the resultant matching $\boldsymbol{\mathcal{M}}$. This situation will arise only when $d_{i(j)}^{\mathcal{H}_l} \succ_{j}^{i} d_{i(k)}^{\mathcal{H}_j}$ $i.e.$ in the strict preference ordering of patient $p_{i(j)}^{\hbar_k}$ doctor $d_{i(j)}^{\mathcal{H}_l}$ is preferred over doctor $d_{i(k)}^{\mathcal{H}_j}$. From the matching result $\boldsymbol{\mathcal{M}}$ obtained, it can be seen that in-spite the fact that $d_{i(j)}^{\mathcal{H}_l} \succ_{j}^{i} d_{i(k)}^{\mathcal{H}_j}$; $d_{i(j)}^{\mathcal{H}_l}$ is not matched with $p_{i(j)}^{\hbar_k}$ by the TOMHECs. So, this upset may happen only when doctor $d_{i(j)}^{\mathcal{H}_l}$ received a proposal from a patient $p_{i(k)}^{\hbar_j}$ to whom $d_{i(j)}^{\mathcal{H}_l}$ prefers over $p_{i(j)}^{\hbar_k}$ $i.e.$ $p_{i(k)}^{\hbar_j} \curlyeqsucc_{i}^{j} p_{i(j)}^{\hbar_k}$. Hence, this contradicts the fact that the $(p_{i(j)}^{\hbar_k}, d_{i(j)}^{\mathcal{H}_l})$ is a \emph{blocking pair}. As their exists no \emph{blocking pair}, it can be said that the resultant matching by TOMHECs is \emph{stable}.\\
From our claim that, the TOMHECs results in a \emph{stable} matching in a particular category $c_i$, it must be true for any category. Hence, it must be true for the system considering the \emph{k} categories simultaneously.
\end{proof}
\begin{mylemma}\label{d2}
A stable allocation resulted by TOMHECs is requesting party (patient or doctor) optimal.
\end{mylemma}
\begin{proof}
Fix a category $c_i$. Let us suppose for the sake of contradiction that the allocation set $\boldsymbol{\mathcal{M}}$ obtained using TOMHECs is not an \emph{optimal} allocation for requesting party (say \emph{patient party}). Then, from \emph{Lemma} \ref{d1} there
exists a \emph{stable} allocation $\boldsymbol{\mathcal{M}'}$ such that $\boldsymbol{\mathcal{M}'}(p_{i(j)}^{\hbar_k}) \succ_{j}^{i} \boldsymbol{\mathcal{M}}(p_{i(j)}^{\hbar_k})$ or $\boldsymbol{\mathcal{M}'}(p_{i(j)}^{\hbar_k}) =_{j}^{i} \boldsymbol{\mathcal{M}}(p_{i(j)}^{\hbar_k})$ for at least one patient $p_{i(j)}^{\hbar_k}$ $\in$ $\boldsymbol{\mathcal{P}}_i$. Therefore, it must be the case that, some patient $p_{i(j)}^{\hbar_k}$ proposes to $\boldsymbol{\mathcal{M}'}(p_{i(j)}^{\hbar_k})$ before $\boldsymbol{\mathcal{M}}(p_{i(j)}^{\hbar_k})$ since $\boldsymbol{\mathcal{M}'}(p_{i(j)}^{\hbar_k}) \succ_{i}^{j} \boldsymbol{\mathcal{M}}(p_{i(j)}^{\hbar_k})$ and is rejected by $\boldsymbol{\mathcal{M}'}(p_{i(j)}^{\hbar_k})$. Since doctor $\boldsymbol{\mathcal{M}'}(p_{i(j)}^{\hbar_k})$ rejects patient $p_{i(j)}^{\hbar_k}$, the doctor $\boldsymbol{\mathcal{M}'}(p_{i(j)}^{\hbar_k})$ must have received a better proposal from a patient $p_{i(k)}^{\hbar_j}$ to whom doctor $\boldsymbol{\mathcal{M}'}(p_{i(j)}^{\hbar_k})$ prefers over $p_{i(j)}^{\hbar_k}$ $i.e.$ $p_{i(k)}^{\hbar_j} \curlyeqsucc_{i}^{j} p_{i(j)}^{\hbar_k}$. Since, this is the first iteration at which a doctor rejects a patient under $\boldsymbol{\mathcal{M}'}$. It follows that the allocation $\boldsymbol{\mathcal{M}}$ is preferred over allocation $\boldsymbol{\mathcal{M}'}$ for the patient $p_{i(j)}^{\hbar_k}$. Hence, this contradicts the fact that the allocation set $\boldsymbol{\mathcal{M}}$ obtained using TOMHECs is not an \emph{optimal} allocation. As their exists an optimal allocation $\boldsymbol{\mathcal{M}}$.\\
Form our claim that, the TOMHECs results in \emph{optimal} allocation in a particular category $c_i$, it must be true for any category. Hence, it must be true for the system considering the \emph{k} categories simultaneously.
\end{proof}
\begin{mylemma}\label{d3}
A stable allocation resulted by TOMHECs is requesting party (patient or doctor) truthful.
\end{mylemma}
\begin{proof}
Fix a category $c_i$. Let us suppose for the sake of contradiction that the matching set $\boldsymbol{\mathcal{M}}$ obtained using TOMHECs is not a \emph{truthful} allocation for requesting party (say \emph{patient party}). The TOMHECs results in \emph{stable} matching $\boldsymbol{\mathcal{M}}$ when all the members of the proposing party reports their true preferences. Now, let's say a patient $p_{i(j)}^{\hbar_k}$ misreport his preference list $\succ_{j}^{i}$ and getting better off in the resultant matching $\boldsymbol{\mathcal{M}}'$. Let $\mathcal{P}'_i$ be the set of patients who are getting better off in $\boldsymbol{\mathcal{M}}'$ as against $\boldsymbol{\mathcal{M}}$. Let $\mathcal{D}'_i$ be the set of doctors matched to patients in $\mathcal{P}'_i$ in matching $\boldsymbol{\mathcal{M}}'$. Let $d_{i(k)}^{\mathcal{H}_\ell}$ be the doctor that $p_{i(j)}^{\hbar_k}$ gets in $\boldsymbol{\mathcal{M}}'$. Since $\boldsymbol{\mathcal{M}}$ is \emph{stable}, we know that $d_{i(k)}^{\mathcal{H}_{\ell}}$ cannot prefer $p_{i(j)}^{\hbar_k}$ to the patient got in $\boldsymbol{\mathcal{M}}$, because this would make ($p_{i(j)}^{\hbar_k}$, $d_{i(k)}^{\mathcal{H}_\ell}$) a \emph{blocking pair} in $\boldsymbol{\mathcal{M}}$ (see \textbf{Lemma 1}). In other words, doctor $\boldsymbol{\mathcal{M}}(d_{i(k)}^{\mathcal{H}_\ell})$ $\curlyeqsucc_{i}^{k}$ $p_{i(j)}^{\hbar_k}$. Now, if $\boldsymbol{\mathcal{M}}(d_{i(k)}^{\mathcal{H}_\ell})$ patient would not improve in $\boldsymbol{\mathcal{M}}'$ then $\boldsymbol{\mathcal{M}}(d_{i(k)}^{\mathcal{H}_\ell})$ $\curlyeqsucc_{i}^{k}$ $p_{i(j)}^{\hbar_k}$. Hence, $d_{i(k)}^{\mathcal{H}_\ell}$ can not be matched with $p_{i(j)}^{\hbar_k}$ in $\boldsymbol{\mathcal{M}}'$, a contradiction. Therefore, patient in $\boldsymbol{\mathcal{M}}$ also improves in $\boldsymbol{\mathcal{M}}'$. That is, $\mathcal{D}'_i$ is not the only set of doctors in $\boldsymbol{\mathcal{M}}'$ of those patient who are getting better off in $\boldsymbol{\mathcal{M}}$; but also the set of doctors where patient in $\boldsymbol{\mathcal{M}}$ improve in $\boldsymbol{\mathcal{M}}'$. In other words, each doctor in $\mathcal{D}_i$ is matched to two different patient from $\mathcal{P}_i$ in match $\boldsymbol{\mathcal{M}}$ and $\boldsymbol{\mathcal{M}}'$, being better off in $\boldsymbol{\mathcal{M}}$ than in $\boldsymbol{\mathcal{M}}'$. It can also be proved using $\textbf{Lemma 1}$ that $\boldsymbol{\mathcal{M}}'$ is not stable; a contradiction that terminates the proof.\\
From our claim that, the TOMHECs results in a \emph{truthful} matching in a particular category $c_i$, it must be true for any category. Hence, it must be true for the system considering the \emph{k} categories simultaneously.
\end{proof}
\section{Further analytics-based analysis}
In order to provide sufficient reasoning to our simulation results presented in section 6, the two proposed mechanisms are in general analyzed on the ground of the expected distance of allocation done by the mechanisms from the top most preference. As a warm up, first the the analysis is done for any patient \emph{j}, to estimate the expected distance of allocation from the top most preference. After that the analysis is extended to more general setting where all the patients present in the system are considered. It is to be noted that the results revealed by the simulations can easily be verified by the lemmas below.
\begin{mylemma}\label{d0}
The allocation resulted by RAMHECs for any patient (or doctor) j being considered first is on an average $\frac{n}{2}$ distance away from its most preferred doctor (or patient) $i.e.~ E[Z] \simeq \frac{n}{2}$; where $Z$ is the random variable measuring the distance from the top most preference.
\end{mylemma}
\begin{proof}
Fix a category $c_i \in \boldsymbol{\mathcal{C}}$, and an arbitrary patient \emph{j} being considered first. In RAMHECs, for any arbitrary patient (AP) being considered first are allotted a random doctor from his preference list. The index position of the doctor in the preference list is decided by \emph{k}, where $k = 1, 2, \ldots, n$. Now, when a doctor is selected randomly from the preference list any of these \emph{k} ($1 \leq k \leq n$) may be selected. So any index \emph{k} could be the outcome of the experiment (allocation of a doctor) and it is to be noted that selection of any such \emph{k} is equally likely. Therefore, for each \emph{k} such that $1 \leq k \leq n$ any $k^{th}$ doctor can be selected with probability $\frac{1}{n}$. For $k = 1, 2, \ldots, n$, we define indicator random variable $X_k$ where
\begin{equation*}
X_k = I\{k^{th}~ doctor~ selected~ from~ patients'~ preference~ list\}
\end{equation*}
\begin{equation*}
X_k =
\begin{cases}
1, & \textit{if $k^{th}$ doctor is selected} \\
0, & \textit{otherwise}
\end{cases}
\end{equation*}
Taking expectation both side, we get;
\begin{equation*}
E[X_k] = E[I\{k^{th}~ doctor~ selected~ from~ patients'~ preference~ list\}]
\end{equation*}
As always with the \emph{indicator random variable}, the expectation is just the probability of the corresponding event \cite{Coreman_2009}:
\begin{equation*}
E[X_k]= 1 \cdot Pr\{X_k=1\} + 0 \cdot Pr\{X_k=0\} = 1 \cdot Pr\{X_k=1\} = \frac{1}{n}
\end{equation*}
For a given call to RAMHECs, the indicator random variable $X_k$ has the value 1 for exactly one value of \emph{k}, and it is 0 for all other \emph{k}. For $X_k=1$, we can measure the distance of $k^{th}$ allocated doctor from the most preferred doctor in the patient \emph{j}'s preference list. So, let $d_k$ be the distance of $k^{th}$ allocation from the best preference. More formally, it can be represented in the case analytic form as:
\begin{align*}
Z =
\begin{cases}
d_0: &\textit{If $1^{st}$ agent is selected from the preference list}~ (k=1)\\
d_1: &\textit{If $2^{nd}$ agent is selected from the preference list}~ (k=2)\\
\mathrel{\makebox[\widthof{=}]{\vdots}} & \mathrel{\makebox[\widthof{=}]{\vdots}} \\
d_{n-1}: & \textit{If $n^{th}$ agent is selected from the preference list}~ (k=n)
\end{cases}
\end{align*}
Where $Z$ is the random variable measuring the distance of the allocation from the patient's top most preference. Here, $d_0=0$, $d_1=1$, $d_2=2$, $\ldots$, $d_{n-1}=n-1$.
It is to be observed that, once the doctor \emph{k} is selected from the patient \emph{j}'s preference list, the value calculation of $d_k$ is no way dependent on \emph{k}. Now,
observe that the random variable $Z$ that we really care about can be formulated as:
\begin{equation*}
Z = \sum_{k=1}^{n}X_k \cdot d_{k-1}
\end{equation*}
Taking expectation both side. We get;
\begin{equation*}
\hspace*{-35mm}E[Z] = E\Bigg[\sum_{k=1}^{n}X_k \cdot d_{k-1}\Bigg]
\end{equation*}
\begin{equation*}
\hspace*{38mm} = \sum_{k=1}^{n}E[X_k \cdot d_{k-1}] ~~~~~~~~~~(by ~linearity ~of ~expectation)
\end{equation*}
\begin{equation*}
\hspace*{38mm} = \sum_{k=1}^{n}E[X_k] \cdot E[d_{k-1}] ~~~~~~~~~~(X_k ~and ~d_{k-1} ~are ~independent)
\end{equation*}
\begin{equation*}
= \sum_{k=1}^{n}\frac{1}{n} \cdot E[d_{k-1}] = \frac{1}{n} \sum_{k=1}^{n} E[d_{k-1}]
\end{equation*}
\begin{equation*}
\hspace*{39mm} = \frac{1}{n} \sum_{k=1}^{n} d_{k-1} ~~~~(once ~\emph{k}~ is~ fixed ~ d_{k-1} ~becomes ~constant)
\end{equation*}
\begin{equation*}
\hspace*{-28mm} = \frac{1}{n} \cdot \frac{(n-1)(n)}{2}
\end{equation*}
\begin{equation*}
\hspace*{-28mm} = \frac{(n-1)}{2} \simeq \frac{n}{2},
\end{equation*}
as claimed.
\end{proof}
\begin{mylemma}\label{d00}
In RAMHECs, $E[D] \simeq \frac{n^2}{16}$; where $D$ is the total distance of all the patients in the system from the top most preference.
\end{mylemma}
\begin{proof}
Fix a category $c_i \in \boldsymbol{\mathcal{C}}$. We are analyzing, the expected distance of the allocations done to the patients by RAMHECs from the top most preferences. For this purpose, as there are \emph{n} patients, the index of these patients are captured by \emph{i} such that $i = 1, 2, \ldots, n$. Without loss of generality, the patients are considered in some order. The index position of the doctor in any patient \emph{j}'s preference list is decided by \emph{k}, where $k = 1, 2, \ldots, n$. For any patient \emph{i} ($1\leq i\leq n$) selected first, when a doctor is selected randomly from the preference list any of the available $k$ ($1\leq k \leq n$) doctors can be selected. So, any index \emph{k} could be the outcome of the experiment (allocation of doctor) and any such \emph{k} is equally likely. But what could the case, if instead of considering the patient in the first place, say a patient is selected in $i^{th}$ iteration. In that case, from the construction of RAMHECs the length of the preference list of the patient under consideration would be $n-i+1$. So, when a doctor is selected randomly from the preference list, any of the $(n-i+1)$ doctors may be selected. It is to be noted that the selection of any of the $(n-i+1)$ doctors is equally likely. Therefore, for a patient under consideration in $i^{th}$ iteration, for each \emph{k} such that $1 \leq k \leq n-i+1$ any $k^{th}$ doctor can be selected with probability $\frac{1}{n-i+1}$. Here, we are assuming that each agent's top preferences are still remaining when that agent is considered by the RAMHECs. To get the lower bound this is the best possible setting. If an agent is not provided that list, he will be further away from his top most preference. For each patient \emph{i} and for $k = 1, 2, \ldots, n$, we define indicator random variable $X_{ik}$ where
\begin{equation*}
X_{ik} = I\{k^{th}~ doctor~ selected~ from~ patient ~i's~ preference~ list\}
\end{equation*}
\begin{equation*}
X_{ik} =
\begin{cases}
1, & \textit{if $k^{th}$ doctor is selected from patient i's preference list} \\
0, & \textit{otherwise}
\end{cases}
\end{equation*}
Taking expectation both side, we get;
\begin{equation*}
E[X_{ik}] = E[I\{k^{th}~ doctor~ selected~ from~ patient ~i~ preference~ list\}]
\end{equation*}
As always with the \emph{indicator random variable}, the expectation is just the probability of the corresponding event:
\begin{equation*}
E[X_{ik}]= 1 \cdot Pr\{X_{ik}=1\} + 0 \cdot Pr\{X_{ik}=0\} = 1 \cdot Pr\{X_{ik}=1\} = \frac{1}{n-i+1}
\end{equation*}
For a given call to RAMHECs, the indicator random variable $X_{ik}$ has the value 1 for exactly one value of \emph{k}, and it is 0 for all other \emph{k}. For $X_{ik}=1$, we can measure the distance of $k^{th}$ allocated doctor from the most preferred doctor in the patient \emph{j}'s preference list. So, let $d_{ik}$ be the distance of $k^{th}$ allocation from the best preference. More formally, it can be represented in the case analytic form as:
\begin{align*}
D =
\begin{cases}
d_{i0}: &\textit{If $1^{st}$ agent is selected from the preference list}~ (k=1)\\
d_{i1}: &\textit{If $2^{nd}$ agent is selected from the preference list} ~(k=2)\\
\mathrel{\makebox[\widthof{=}]{\vdots}} & \mathrel{\makebox[\widthof{=}]{\vdots}} \\
d_{i(n-1)}: & \textit{If $n^{th}$ agent is selected from the preference list~ (k=n)}
\end{cases}
\end{align*}
Where $D$ is the total distance of all the patients in the system from the top most preference.
It is to be observed that, once the doctor \emph{k} is selected from the patient \emph{j}'s preference list, the value calculation of $d_k$ is no way dependent on \emph{k}. Now,
observe that the random variable $D$ that we really care about is given as:
\begin{equation*}
\hspace*{-50mm}D \geq \sum_{i=1}^{n}\sum_{k=1}^{n-i+1}X_{ik} \cdot d_{ik}
\end{equation*}
Taking expectation both side. We get;
\begin{equation*}
\hspace*{-45mm}E[D] \geq E[\sum_{i=1}^{n}\sum_{k=1}^{n-i+1}X_{ik} \cdot d_{ik}]
\end{equation*}
\begin{equation*}
\hspace*{31mm} = \sum_{i=1}^{n}\sum_{k=1}^{n-i+1}E[X_{ik} \cdot d_{ik}] ~~~~~~~~~~(by ~linearity ~of ~expectation)
\end{equation*}
\begin{equation*}
\hspace*{31mm} = \sum_{i=1}^{n}\sum_{k=1}^{n-i+1}E[X_{ik}] \cdot E[d_{ik}] ~~~~~~~~~~(X_{ik} ~and ~d_{ik} ~are ~independent)
\end{equation*}
\begin{equation*}
\hspace*{-28mm}= \sum_{i=1}^{n}\sum_{k=1}^{n-i+1}\frac{1}{n-i+1} \cdot d_{ik}
\end{equation*}
\begin{equation*}
\hspace*{-40mm} \geq \sum_{i=1}^{n}\sum_{k=1}^{n-i+1} \frac{1}{n} \cdot d_{ik}
\end{equation*}
\begin{equation*}
\hspace*{-41mm} = \frac{1}{n} \sum_{i=1}^{n}\sum_{k=1}^{n-i+1} d_{ik}
\end{equation*}
\begin{equation*}
\hspace*{-09mm} = \frac{1}{n} \Bigg[\sum_{i=1}^{\frac{n}{2}}\sum_{k=1}^{n-i+1} d_{ik} + \sum_{i=\frac{n}{2}}^{n}\sum_{k=1}^{n-i+1} d_{ik}\Bigg]
\end{equation*}
\begin{equation*}
\hspace*{05mm} \geq \frac{1}{n} \Bigg[\sum_{i=1}^{\frac{n}{2}}\sum_{k=1}^{n-i+1} d_{ik}\Bigg] + \Bigg[\sum_{i=\frac{n}{2}}^{n}\sum_{k=1}^{n-i+1} 0\Bigg] ~~~(\footnotemark \footnotetext{discarding~ the~ lower~ order~ terms})
\end{equation*}
\begin{equation*}
\hspace*{-35mm} \geq \frac{1}{n} \Bigg[\sum_{i=1}^{\frac{n}{2}}\sum_{k=\frac{n}{2}}^{n-i+1} d_{ik}\Bigg]
\end{equation*}
\begin{equation*}
\hspace*{-25mm} \geq \frac{1}{n} \Bigg[\sum_{i=1}^{\frac{n}{2}}\sum_{k=\frac{n}{2}}^{n-i+1} d_{i\frac{n}{2}}\Bigg] ~~~(\footnotemark \footnotetext{replacing~ each~ term~ of~ the~ series~ by~ its~ first~ term})
\end{equation*}
\begin{equation*}
\hspace*{-35mm} = \frac{1}{n} \Bigg[\sum_{i=1}^{\frac{n}{2}}\sum_{k=\frac{n}{2}}^{n-i+1} \frac{n}{2}\Bigg]
\end{equation*}
\begin{equation*}
\hspace*{-35mm}= \frac{1}{2} \Bigg[\sum_{i=1}^{\frac{n}{2}}\sum_{k=\frac{n}{2}}^{n-i+1} 1\Bigg]
\end{equation*}
\begin{equation*}
\hspace*{-35mm} \geq \Bigg(\frac{1}{2} \sum_{j=1}^{\frac{n}{2}} j\Bigg) -1
\end{equation*}
\begin{equation*}
\hspace*{-33mm} = \frac{1}{2}\Bigg[\frac{\frac{n}{2}(\frac{n}{2}+1)}{2}\Bigg]-1
\end{equation*}
\begin{equation*}
\hspace*{-30mm} = \frac{n^2+2n-16}{16} \simeq \frac{n^2}{16}
\end{equation*}
as claimed. It is to be observed that for each agent, the expected distance of allocation done by RAMHECs from the top preference in an amortized sense is $\frac{n}{16}$.
\end{proof}
\begin{mylemma}\label{d01}
The expected number of rejections for any arbitrary patient (or doctor) j resulted by TOMHECs is constant. If the probability of any k length rejection is considered as $\frac{1}{2}$ $i.e.$ $Pr\{Y_k=1\}= \frac{1}{2}$ then $E[Y] = 2$; where $Y$ is the random variable measuring the total number of rejections made to the patient (or doctor) under consideration.
\end{mylemma}
\begin{proof}
Fix a category $c_i \in \boldsymbol{\mathcal{C}}$, and an arbitrary patient \emph{j}. To analyze the expected number of rejections suffered by the patient under consideration in case of TOMHECs, we capture the total number of rejections done to any patient \emph{j} by a random variable $Y$. So, the expected number of rejections suffered by any patient \emph{j} is given as $E[Y]$. It is considered that the rejection by any member $k = 0, \ldots, n-1$, present on the patients' \emph{j} preference list is an independent experiment. It means that, the \emph{m} length rejections suffered by an arbitrary patient \emph{j} is no way dependent on any of the previous $m-1$ rejections. Let us suppose for each $0 \leq k \leq n-1 $, the probability of rejection by any $k^{th}$ doctor be $\frac{1}{2}$ (it can be any value between 0 and 1 depending on the scenario). For $k=0,\ldots, n-1$, we define indicator random variable $Y_k$ where
\begin{equation*}
Y_k = I\{k~length~rejection\}
\end{equation*}
\begin{equation*}
Y_k =
\begin{cases}
1, & \textit{if k length rejection} \\
0, & \textit{otherwise}
\end{cases}
\end{equation*}
Taking expectation both side, we get;
\begin{equation*}
E[Y_k] = E[I\{k~length~rejection\}]
\end{equation*}
As always with the \emph{indicator random variable}, the expectation is just the probability of the corresponding event:
\begin{equation*}
E[Y_k]= 1 \cdot Pr\{Y_k=1\} + 0 \cdot Pr\{Y_k=0\} = 1 \cdot Pr\{Y_k=1\} = \Bigg(\frac{1}{2}\Bigg)^k
\end{equation*}
Observe that the random variable $Y$ that we really care about is given as,
\begin{equation*}
Y = \sum_{k=0}^{n-1}Y_k
\end{equation*}
Taking expectation both side. We get;
\begin{equation*}
E[Y] = E\Bigg[\sum_{k=0}^{n-1}Y_k \Bigg]
\end{equation*}
\begin{equation*}
\hspace*{62mm}= \sum_{k=0}^{n-1}E[Y_k] ~~~~~~~(by ~linearity ~of ~expectation)
\end{equation*}
\begin{equation*}
\hspace*{33mm}= \sum_{k=0}^{n-1}\Bigg(\frac{1}{2}\Bigg)^{k} < \sum_{k=0}^{\infty}\Bigg(\frac{1}{2}\Bigg)^{k}
\end{equation*}
\begin{equation*}
\hspace*{13mm} = \frac{1}{1-(\frac{1}{2})} = 2
\end{equation*}
as claimed. Moreover, if we consider the probability of $k^{th}$ rejection as $\frac{2}{3}$ then, the expected number of rejections will be given as 3 $i.e$ $E[Y]=3$. Similarly, $E[Y]=10$ if the probability of $k^{th}$ rejection is taken as $\frac{9}{10}$. It means that, even with the high probability of rejection to any arbitrary patient \emph{j} by the members of the proposed party, there is a chance that after constant number of rejections patient \emph{j} will be allocated a good doctor according to his choice. Hence, we can say that each agent's allocation is not far away from his top most preference.
\end{proof}
\begin{mylemma}\label{d02}
In TOMHECs, $E[R] = 2n$, where $R$ is the random variable measuring the total number of rejections made to all the patients.
\end{mylemma}
\begin{proof}
Fix a category $c_i \in \boldsymbol{\mathcal{C}}$. We are analyzing the total number of rejections suffered by all the patients in expectation. For this purpose, as there are \emph{n} patients, the index of these patients are captured by \emph{i} such that $i = 1, 2, \ldots, n$. The index position of the doctor in any patient $j's$ preference list is decided by \emph{k}, where $k=1, 2, \ldots, n$. We capture the total number of rejections done to all patients by a random variable $R$. So, the expected number of rejections suffered by all the patients is given as $E[R]$. It is considered that the rejection by any member $k = 1, \ldots, n-1$, present on the patients' \emph{i} preference list is an independent experiment. It means that, the \emph{m} length rejections suffered by an arbitrary patient \emph{i} is no way dependent on any of the previous $m-1$ rejections. Let us suppose for each patient \emph{i} and for each $1 \leq k \leq n-1 $, the probability of rejection by any $k^{th}$ doctor be $\frac{1}{2}$ (it can be any value between 0 and 1 depending on the scenario). For $k=1,\ldots, n-1$, we define indicator random variable $R_{ik}$ where
\begin{equation*}
R_{ik} = I\{k~length~rejection~of i^{th} ~patient\}
\end{equation*}
\begin{equation*}
R_{ik} =
\begin{cases}
1, & \textit{if k length rejection of $i^{th}$ patient} \\
0, & \textit{otherwise}
\end{cases}
\end{equation*}
Taking expectation both side, we get;
\begin{equation*}
E[R_{ik}] = E[I\{k~length~rejection~of~ i^{th}~ patient\}]
\end{equation*}
As always with the \emph{indicator random variable}, the expectation is just the probability of the corresponding event:
\begin{equation*}
E[R_{ik}]= 1 \cdot Pr\{R_{ik}=1\} + 0 \cdot Pr\{R_{ik}=0\} = 1 \cdot Pr\{R_{ik}=1\} = \Bigg(\frac{1}{2}\Bigg)^k
\end{equation*}
Observe that the random variable $R$ that we really care about is given as,
\begin{equation*}
R = \sum_{i=1}^{n}\sum_{k=1}^{n-i}R_{ik}
\end{equation*}
Taking expectation both side. We get;
\begin{equation*}
E[R] = E\Bigg[\sum_{i=1}^{n}\sum_{k=1}^{n-i}R_{ik} \Bigg]
\end{equation*}
\begin{equation*}
\hspace*{62mm}= \sum_{i=1}^{n}\sum_{k=1}^{n-i}E[R_{ik}] ~~~~~~~(by ~linearity ~of ~expectation)
\end{equation*}
\begin{equation*}
\hspace*{17mm}= \sum_{i=1}^{n}\sum_{k=1}^{n-i}\Bigg(\frac{1}{2}\Bigg)^{k}
\end{equation*}
\begin{equation*}
\hspace*{17mm} < \sum_{i=1}^{n}\sum_{k=0}^{\infty}\Bigg(\frac{1}{2}\Bigg)^{k}
\end{equation*}
\begin{equation*}
\hspace*{13mm} = \sum_{k=0}^{n-1}\frac{1}{1-(\frac{1}{2})} = 2n
\end{equation*}
as claimed.
\end{proof}
\begin{corollary}
It is to be observed that for each patient, the expected number of rejections in case of TOMHECs in an amortized sense is $O(1)$. As we have shown that for all n agents, the expected number of rejection are $O(n)$.
\end{corollary}
\section{Experimental findings}
The experiments are carried out in this section to compare the efficacy of the TOMHECs based on the preference lists of the doctors and patients generated randomly using \emph{Random} library in Python. RAMHECs is considered as the benchmark mechanism.
\subsection{Simulation setup}
For creating a real world healthcare scenario we have considered 10 different categories of patients and doctors for our simulation purpose.
One of the scenarios that is taken into consideration is, say there are equal number of patients and doctors present in each of the categories along with the assumption that each of the patients are providing strict preference ordering (generated randomly) over all the available doctors and also each of the doctors are providing strict preference ordering over all the available patients. Second scenario is the case where, there are equal number of patients and doctors are present in the market. Each of the members in the respective parties are providing the strict preference ordering over the subset of the members of the opposite community. The other two scenarios $i.e.$ $m<n$ and $m>n$ with partial preference are not shown due to page limit.
\subsection{Performance metrics}
The efficacy of TOMHECs is measured under the banner of two important parameters: (a) \textbf{Satisfaction level ($\boldsymbol{\eta_{\ell}}$):} It is defined as the sum over the difference between the index of the doctor (patient) allocated from the patient's (doctor's) preference list to the index of the most preferred doctor (patient) by the patient (doctor) from his/her preference list. Considering the \emph{requesting party}, the $\boldsymbol{\eta_\ell^j}$ for $c_j$ category is defined as: $\boldsymbol{\eta_\ell^{j}} = \sum_{i=1}^{n} \bigg(\overline{\xi}_{i} - \xi_i \bigg)$; where, $\overline{\xi}_{i}$ is the index of the doctor (patient) allocated from the initially provided preference list of the patients (doctors) \emph{i}, and $\xi_i$ is the index of the most preferred doctor (patient) in the initially provided preference list of patient (doctor) \emph{i}. For \emph{k} categories, $\boldsymbol{\eta_\ell} = \sum_{j=1}^{k}\sum_{i=1}^{n} \bigg(\overline{\xi}_{i} - \xi_i \bigg)$. It is to be noted that lesser the value of satisfaction level higher will be the satisfaction of patients or doctors. (b) {\textbf{Number of preferable allocation ($\boldsymbol{\zeta}$):} The term "\emph{preferable allocation}" refers to the allocation of most preferred doctor or patient from the revealed preference lists by the patients or the doctors respectively. For a particular patient or doctor the \emph{preferable allocation} is captured by the function $f: \boldsymbol{\mathcal{P}}_{i} \rightarrow \{0, 1\}$. For the category $c_i$, the number of preferable allocation (NPA) is defined as the number of patients (doctors) getting their first choice from the initially provided preference list. So, $\boldsymbol{\zeta_i} = \sum_{j=1}^{n} f(p_{i(j)}^{\hbar_\ell})$. For \emph{k} categories $\boldsymbol{\zeta} = \sum_{i=1}^{k}\sum_{j=1}^{n} f(p_{i(j)}^{\hbar_\ell})$.
\subsection{Simulation directions}
The three directions are seen for measuring the performance of TOMHECs, they are: (1) All the patients and doctors are reporting their true preference list. (2) When fraction of total available members of the \emph{requesting party} are misreporting their preference lists. (3) When fraction of total available members of the \emph{requested party} are misreporting their preference lists.
\subsection{Result analysis}
In this section, the result is simulated for the above mentioned three cases and discussed.
\begin{table}[H]
\caption{Abbreviations used in simulation}
\label{tab:1}
\centering
\vspace{4mm}
\scalebox{0.75}{
\begin{tabular}{|c|| l|l|}
\hline
\textbf{Abbreviation} & \textbf{Description}\\
\hline
\hline
RAMHECs-P & Patients allocation using RAMHECs without variation.\\
\hline
TOMHECs-P & Patients allocation using TOMHECs without variation.\\
\hline
RAMHECs-D & Doctors allocation using RAMHECs without variation.\\
\hline
TOMHECs-D & Doctors allocation using TOMHECs without variation.\\
\hline
TOMHECs-PS & Patients allocation using TOMHECs with small variation.\\
\hline
TOMHECs-DS & Doctors allocation using TOMHECs with small variation.\\
\hline
TOMHECs-PM & Patients allocation using TOMHECs with medium variation.\\
\hline
TOMHECs-DM & Doctors allocation using TOMHECs with medium variation.\\
\hline
TOMHECs-PL & Patients allocation using TOMHECs with large variation.\\
\hline
TOMHECs-DL & Doctors allocation using TOMHECs with large variation.\\
\hline
\end{tabular}
}
\end{table}
\paragraph*{\textbf{Expected amount of patients/doctors deviating}}
The following analysis motivated
by \cite{Coreman_2009} justifies the idea of choosing the parameters of variation. Let $\chi_{j}$ be the random variable associated with the event in which $j^{th}$ patient in $c_i$ category varies its true preference ordering.
Thus, $\chi_{j}$ = \{$j^{th}$ patient varies preference ordering\}.
$\chi = \sum_{j =1}^{n} \chi_j$. We can write $E[\chi]$ = $\sum_{j =1}^{n} E[\chi_j]$ = $\sum_{j=1}^{n} 1/8$ = $n/8$. Here,
Pr$\{j^{th}$ \emph{patient varies preference ordering}$\}$ is the probability that given a patient whether he will vary his
true preference ordering. The probability of that is taken as $1/8$ (small variation).\\
Our result analysis is broadly classified into four categories:\\
\noindent $\bullet$ \textbf{Case 1a: Requesting party with full preference (FP)}
In Figure \ref{fig:sim1a} and Figure \ref{fig:sim2a}, it can be seen that the \emph{satisfaction level} of the requesting party in case of TOMHECs is more as compared to RAMHECs. As TOMHECs always allocates the most preferred member from the preference list. Under the \emph{manipulative} environment of the \emph{requesting party}, it can be seen in Figure \ref{fig:sim1a} and Figure \ref{fig:sim2a} that, the \emph{satisfaction level} of the system in case of TOMHECs with large variation is less than the \emph{satisfaction level} of the system in case of TOMHECs with medium variation is less than the \emph{satisfaction level} of the system in case of TOMHECs with small variation is less than the \emph{satisfaction level} of the system in case of TOMHECs. It is natural from the construction of TOMHECs. Considering the second parameter $i.e.$ \emph{number of preferable allocation}, it can be seen in Figure \ref{fig:sim1b} and Figure \ref{fig:sim2b} that the NPA of the requesting party in case of TOMHECs is more as compared to RAMHECs.
\begin{figure}[H]
\begin{subfigure}[b]{0.48\textwidth}
\centering
\includegraphics[scale=0.30]{graphs/graph_EL/FP_PR_ELP.eps}
\subcaption{$\boldsymbol{\eta_{\ell}}$ of patients}
\label{fig:sim1a}
\end{subfigure}%
\begin{subfigure}[b]{0.48\textwidth}
\centering
\includegraphics[scale=0.30]{graphs/graph_EL/FP_DR_ELD.eps}
\subcaption{$\boldsymbol{\eta_{\ell}}$ of doctors}
\label{fig:sim2a}
\end{subfigure}
\caption{$\boldsymbol{\eta_{\ell}}$ of requesting party with $m==n$}
\end{figure}
\begin{figure}[H]
\begin{subfigure}[b]{0.48\textwidth}
\centering
\includegraphics[scale=0.17]{graphs/graph_BA/FP_PR_BAP.eps}
\subcaption{$\boldsymbol{\zeta}$ of patients}
\label{fig:sim1b}
\end{subfigure}%
\begin{subfigure}[b]{0.48\textwidth}
\centering
\includegraphics[scale=0.17]{graphs/graph_BA/FP_DR_BAD.eps}
\subcaption{$\boldsymbol{\zeta}$ of doctors}
\label{fig:sim2b}
\end{subfigure}
\caption{$\boldsymbol{\zeta}$ of requesting party with $m==n$}
\end{figure}
\noindent Under the \emph{manipulative} environment of the \emph{requesting party}, it can be seen in Figure \ref{fig:sim1b} and Figure \ref{fig:sim2b} that, the NPA of the system in case of TOMHECs with large variation is less than the NPA of the system in case of TOMHECs with medium variation is less than the NPA of the system in case of TOMHECs with small variation is less than the NPA of the system in case of TOMHECs. It is natural from the construction of TOMHECs.\\
\noindent $\bullet$ \textbf{Case 1b: Requesting party with partial preference (PP)}
In Figure \ref{fig:sim3a} and Figure \ref{fig:sim4a}, it can be seen that the \emph{satisfaction level} of the requesting party in case of TOMHECs is more as compared to RAMHECs. As TOMHECs always allocates the most preferred member from the preference list.
\begin{figure}[H]
\begin{subfigure}[b]{0.48\textwidth}
\centering
\includegraphics[scale=0.30]{graphs/graph_EL/PP_EQ_PR_ELP.eps}
\subcaption{$\boldsymbol{\eta_{\ell}}$ of patients}
\label{fig:sim3a}
\end{subfigure}%
\begin{subfigure}[b]{0.48\textwidth}
\centering
\includegraphics[scale=0.30]{graphs/graph_EL/PP_EQ_DR_ELD.eps}
\subcaption{$\boldsymbol{\eta_{\ell}}$ of doctors}
\label{fig:sim4a}
\end{subfigure}
\caption{$\boldsymbol{\eta_{\ell}}$ of requesting party with $m==n$}
\end{figure}
\noindent Under the \emph{manipulative} environment of the \emph{requesting party}, it can be seen in Figure \ref{fig:sim3a} and Figure \ref{fig:sim4a} that, the \emph{satisfaction level} of the system in case of TOMHECs with large variation is less than the \emph{satisfaction level}
\begin{figure}[H]
\begin{subfigure}[b]{0.48\textwidth}
\centering
\includegraphics[scale=0.17]{graphs/graph_BA/PP_EQ_PR_BAP.eps}
\subcaption{$\boldsymbol{\zeta}$ of patients}
\label{fig:sim3b}
\end{subfigure}%
\begin{subfigure}[b]{0.48\textwidth}
\centering
\includegraphics[scale=0.17]{graphs/graph_BA/PP_EQ_DR_BAD.eps}
\subcaption{$\boldsymbol{\zeta}$ of doctors}
\label{fig:sim4b}
\end{subfigure}
\caption{$\boldsymbol{\zeta}$ of requesting party with $m==n$}
\end{figure}
\noindent of the system in case of TOMHECs with medium variation and even less than RAMHECs is less than the \emph{satisfaction level} of the system in case of TOMHECs with small variation even less than RAMHECs is less than the \emph{satisfaction level} of the system in case of TOMHECs. It is natural from the construction of TOMHECs. Considering the second parameter $i.e.$ \emph{number of preferable allocation}, it can be seen in Figure \ref{fig:sim3b} and Figure \ref{fig:sim4b} that the NPA of the requesting party in case of TOMHEcs is more as compared to RAMHECs. Under the \emph{manipulative} environment of the \emph{requesting party}, it can be seen in Figure \ref{fig:sim3b} and Figure \ref{fig:sim4b} that, the NPA of the system in case of TOMHECs with large variation is less than the NPA of the system in case of TOMHECs with medium variation is less than the NPA of the system in case of TOMHECs with small variation is less than the NPA of the system in case of TOMHECs.\\
$\bullet$ \textbf{Case 2a: Requested party with full preference (FP)}
In Figure \ref{fig:sim5a}, Figure \ref{fig:sim6a} and Figure \ref{fig:sim5b}, Figure \ref{fig:sim6b}, it can be seen that the \emph{satisfaction} \emph{level} and the NPA respectively of the requested party in case of TOMHECs is more as compared to RAMHECs. It can be seen from Figure \ref{fig:sim1a}-\ref{fig:sim2b} and Figure \ref{fig:sim5a}-\ref{fig:sim6b} that the TOMHECs is requesting party optimal. It is natural from the construction of TOMHECs.
\begin{figure}[H]
\begin{subfigure}[b]{0.48\textwidth}
\centering
\includegraphics[scale=0.30]{graphs/graph_EL/FP_DR_ELP.eps}
\subcaption{$\boldsymbol{\eta_{\ell}}$ of patients}
\label{fig:sim5a}
\end{subfigure}%
\begin{subfigure}[b]{0.48\textwidth}
\centering
\includegraphics[scale=0.30]{graphs/graph_EL/FP_PR_ELD.eps}
\subcaption{$\boldsymbol{\eta_{\ell}}$ of doctors}
\label{fig:sim6a}
\end{subfigure}
\caption{$\boldsymbol{\eta_{\ell}}$ of requested party with $m==n$}
\end{figure}
\begin{figure}[H]
\begin{subfigure}[b]{0.48\textwidth}
\centering
\includegraphics[scale=0.17]{graphs/graph_BA/FP_DR_BAP.eps}
\subcaption{$\boldsymbol{\zeta}$ of patients}
\label{fig:sim5b}
\end{subfigure}%
\begin{subfigure}[b]{0.48\textwidth}
\centering
\includegraphics[scale=0.17]{graphs/graph_BA/FP_PR_BAD.eps}
\subcaption{$\boldsymbol{\zeta}$ of doctors}
\label{fig:sim6b}
\end{subfigure}
\caption{$\boldsymbol{\zeta}$ of requested party with $m==n$}
\end{figure}
$\bullet$ \textbf{Case 2b: Requested party with partial preference (PP)}
In Figure \ref{fig:sim7a}, Figure \ref{fig:sim8a} and Figure \ref{fig:sim7b}, Figure \ref{fig:sim8b}, it can be seen that the \emph{satisfaction level} and the NPA respectively of the requested party in case of TOMHECs is more as compared to RAMHECs.
\begin{figure}[H]
\begin{subfigure}[b]{0.48\textwidth}
\centering
\includegraphics[scale=0.30]{graphs/graph_EL/PP_EQ_DR_ELP.eps}
\subcaption{$\boldsymbol{\eta_{\ell}}$ of patients}
\label{fig:sim7a}
\end{subfigure}%
\begin{subfigure}[b]{0.48\textwidth}
\centering
\includegraphics[scale=0.30]{graphs/graph_EL/PP_EQ_PR_ELD.eps}
\subcaption{$\boldsymbol{\eta_{\ell}}$ of doctors}
\label{fig:sim8a}
\end{subfigure}
\caption{$\boldsymbol{\eta_{\ell}}$ of requested party with $m==n$}
\end{figure}
\begin{figure}[H]
\begin{subfigure}[b]{0.48\textwidth}
\centering
\includegraphics[scale=0.17]{graphs/graph_BA/PP_EQ_DR_BAP.eps}
\subcaption{$\boldsymbol{\zeta}$ of patients}
\label{fig:sim7b}
\end{subfigure}%
\begin{subfigure}[b]{0.48\textwidth}
\centering
\includegraphics[scale=0.17]{graphs/graph_BA/PP_EQ_PR_BAD.eps}
\subcaption{$\boldsymbol{\zeta}$ of doctors}
\label{fig:sim8b}
\end{subfigure}
\caption{$\boldsymbol{\zeta}$ of requested party with $m==n$}
\end{figure}
\section{Conclusions and future works}
We have tried to model the \emph{ECs hiring problem} as a two sided matching problem in healthcare domain. This paper proposed an \emph{optimal} and \emph{truthful} mechanism, namely TOMHECs to allocate the ECs to the patients.
The more general settings are of \emph{n} patients and \emph{m} doctors ($m \neq n$ or $m == n$) with the constraint that members of the \emph{patient party} and \emph{doctor party} can provide the preference ordering (not necessarily strict) over the subset of the members of the opposite party can be thought of as our future work.
\section*{Acknowledgement}
\noindent We would like to thank Prof. Y. Narahari and members of the Game Theory Lab. at Department of CSA, IISc Bangalore for their useful advices. We would like to thank the faculty members, and PhD research scholars of the department for their valuable suggestions. We highly acknowledge the effort undertaken by Ministry of Electronics and Information Technology, Media Lab Asia, Government of India through the Visvesvaraya scheme.
\bibliographystyle{elsarticle-num}
| {'timestamp': '2017-09-20T02:06:56', 'yymm': '1703', 'arxiv_id': '1703.08698', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08698'} | arxiv |
\section{Introduction}
\label{sec:intro}
In almost all control systems today, data is processed and transferred between the system's components periodically.
While periodic system design is often convenient and well understood,
it involves an inherent limitation: data is processed and transmitted at predetermined time instants, irrespective of the current state of the system or the information content of the data. That is, system resources are used regardless of whether there is any need for processing and communication or not. This becomes prohibitive when resources are scarce, such as in networked or cyber-physical systems, where multiple agents share a communication medium.
Owing to the limitations of traditional design methodologies for resource-constrained problems, aperiodic or event-based
strategies have recently received a lot of attention \cite{Le11,Lu16}.
With event-based methods, data is transmitted or processed only when certain \emph{events} indicate that an update is required, for example, to meet some control or estimation specification. Thus, resources are used \emph{only when required} and saved otherwise.
\begin{figure}[tb]
\centering
\includegraphics[width=0.7\columnwidth]{figure_EBSE_problem}
\caption{Distributed state estimation problem.
Multiple distributed sensors make observations $y_i$ of a dynamic system and communicate to estimator nodes via a common bus network. The development of an event-based scheme allowing all estimators to estimate the full system state $x$, but with limited inter-agent communication, is the objective of this article.
}
\label{fig:networkArchitecture}
\end{figure}
In this article, a novel event-based scheme for distributed state estimation is proposed. We consider the system shown in Fig\/.\/~ \ref{fig:networkArchitecture}, where multiple sensors observe a dynamic system and transmit data to estimator agents over a common bus. Each estimator agent shall estimate the full state of the dynamic system, for example, for the purpose of monitoring or control.
In order to limit network traffic,
local event triggers on each sensor ensure that updates are sent only when needed. The common bus ensures that transmitted data reaches all agents in the network, which will allow for efficient triggering decisions and the availability of full state information on all agents.
The proposed approach for distributed event-based estimation emulates a classic
discrete-time state observer
design up to guaranteed bounds, but with limited communication. \emph{Emulation-based design} is one common approach in event-based control literature (see \cite{Lu16}), where an event-based control system is designed so as to
emulate the behavior of a given continuous or periodic control system. However, to the best of the author's knowledge, emulation-based design has not been considered for state estimation.
While the focus of this article is on state estimation, we also show stability of the event-based control system resulting when local estimates are used for feedback control.
In particular, this articles makes the following main contributions:
\begin{enumerate}
\item First emulation-based design for distributed event-based state estimation replicating a centralized discrete-time linear observer.
\item Stability proofs for the resulting distributed and switching estimator dynamics under generic communication or computation imperfections (bounded disturbances).
\item Extension
to distributed event-based control, where local estimates are used for feedback.
\item Experimental validation on an unstable networked control system.
\end{enumerate}
Preliminary results of those herein were presented in the conference papers \cite{Tr12,Tr14}; this article has been completely rewritten and new results added.
\pagestyle{plain}
\subsection{Related work}
Early work on event-based state estimation (EBSE) concerned problems with a single sensor and estimator node
(see \cite{Le11} and references therein).
Typically, the optimal triggering strategies have
time-varying thresholds for finite-horizon problems, and constant thresholds for infinite-horizon problems, \cite[p.~340]{Le11}. Because long-term behavior (stability) is of primary interest herein,
we consider constant thresholds.
Different types of stationary triggering policies have been suggested in literature. With the \emph{send-on-delta} (SoD) protocol \cite{Mi06}, transmissions are triggered based on the difference of the current and last-transmitted measurement.
\emph{Innovation-based triggering} \cite{TrDAn11}
places a threshold on the measurement innovation; that is, the difference of the current measurement and its prediction based on a process model.
Wu \emph{et al.} \cite{WuJiJoSh13} use the same trigger, but apply a transformation to decorrelate the innovation. Considering the variance of the innovation instead yields \emph{variance-based triggering} \cite{TrDAn14b}.
Marck and Sijs \cite{MaSi10} proposed \emph{relevant sampling}, where the relative entropy of prior and posterior state distribution is employed as a measure of information gain.
We use innovation-based triggers herein, which have been shown to be
effective for EBSE, \cite{TrCa15}.
Different estimation algorithms have been proposed for EBSE, with particular emphasis on how to (approximately) incorporate information contained in `negative' events (instants when no data is transmitted), \cite{SiLa12,SiNoHa13,ShChSh15}.
If one ignores the extra information from negative events in favor of a straightforward implementation, a time-varying Kalman filter (KF) can be used (e\/.\/g\/.\/~ \cite{TrDAn11}). Herein, we use the same structure as the standard KF, but with pre-computed switching gains, thus achieving the lowest computational complexity of all mentioned algorithms.
To the best of the author's knowledge, \emph{distributed} EBSE with multiple sensor/estimator nodes and general coupled dynamics was first studied in \cite{TrDAn11}.
While Yook \emph{et al.} \cite{YoTiSo02} had previously proposed the use of state estimators for the purpose of saving communication, they do not employ state estimation in the usual sense. Instead of \emph{fusing} model-based predictions with incoming data, they \emph{reset} parts of the state vector.
Later results on distributed EBSE include \cite{BaBeCh12,ShChSh14c,ShChSh15,YaZhZhYa14,LiWaHeZh15,WeMoSiHaSh16}. In contrast to the scenario herein, they consider either a centralized fusion node, or simpler SoD-type triggers, which are less effective for estimation, \cite{TrCa15}.
None of the mentioned references treats the problem of emulating a centralized observer design with a distributed and event-triggered implementation.
When the event-based state estimators are connected to state-feedback controllers (discussed in Sec\/.\/~ \ref{sec:control}), this represents a \emph{distributed event-based control} system.
Wang \emph{et al.} \cite{WaLe11} and Mazo Jr \emph{et al.} \cite{MaTa11}
were among the first to discuss distributed or decentralized
event-based control.
In contrast to these works, we neither assume perfect state measurements, nor a centralized controller as in \cite{MaTa11}, nor have a restriction on the dynamic couplings \cite{WaLe11}, but we rely on a common bus network supporting all-to-all communication.
\subsection{Notation}
\label{sec:notation}
The terms \emph{state observer} and \emph{state estimator} are used synonymously in this article.
$\field{R}$, $\field{N}$, and $\field{N}_N$ denote real numbers, positive integers, and the set $\{1, 2, \dots, N\}$, respectively.
Where convenient, vectors are expressed as tuples $(v_1, v_2, \dots)$, where $v_i$ may be vectors themselves, with dimension and stacking clear from context.
For a vector $v$ and matrix $A$, $\|v\|$ denotes some vector H\"older norm \cite[p.~344]{Be05}, and $\|A\|$ the induced matrix norm.
For a
sequence $v = \{v(0), v(1), \dots \}$, $\|v\|_\infty$ denotes the $\ell^\infty$ norm $\|v\|_\infty := \sup\nolimits_{k\geq 0} \, \|v(k)\|$.
For an estimate of $x(k)$ computed from measurement data until time $\ell \leq k$, we write $\hat{x}(k|\ell)$; and use $\hat{x}(k)=\hat{x}(k|k)$.
A matrix is called stable if all its eigenvalues have magnitude strictly less than one.
Expectation is denoted by $\mathbb{E}[\cdot]$.
\section{Problem statement: distributed state estimation with reduced communication}
\label{sec:problemFormulation}
We introduce the considered networked dynamic system and state the estimation problem addressed in this article.
\subsection{Networked dynamic system}
We consider the networked estimation scenario in Fig\/.\/~ \ref{fig:networkArchitecture}. The dynamic system is described by linear discrete-time dynamics
\begin{align}
x(k) &= A x(k-1) + B u(k-1) + v(k-1) \label{eq:system_x} \\
y(k) &= C x(k) +w(k) \label{eq:system_y}
\end{align}
with sampling time $T_\text{s}$, state $x(k) \in \field{R}^n$, control input $u(k) \in \field{R}^{q}$, measurement $y(k) \in \field{R}^{p}$, disturbances $v(k) \in \field{R}^n$, $w(k) \in \field{R}^{p}$, and all matrices of corresponding dimensions. We assume that $(A,B)$ is stabilizable and $(A,C)$ is detectable.
No specific assumptions on the characteristics of the disturbances $v(k)$ and $w(k)$ are made; they can be random variables or deterministic disturbances.
Each of the $N_\text{sen}$ sensor agents (cf\/.\/~ Fig\/.\/~ \ref{fig:networkArchitecture}) observes part of the dynamic process through
measurements $y_i(k) \in \field{R}^{p_i}$, $i \in \field{N}_{N_\text{sen}}$. The vector $y(k)$ thus represents the collective measurements of all $N_\text{sen}$ agents,
\begin{align}
y(k) &= ( y_1(k), y_2(k), \dots, y_{N_\text{sen}}(k) ) \\
y_i(k) &= C_i x(k) +w_i(k) \qquad \forall \, i \in \field{N}_{N_\text{sen}} \label{eq:system_yi}
\end{align}
with $C_i \in \field{R}^{p_i \times n}$ and $w_i(k) \in \field{R}^{p_i}$.
Agents can be heterogeneous with different types and dimensions of measurements, and no local observability assumption is made (i\/.\/e\/.\/~ $(A,C_i)$ can be not detectable).
Each of the $N_\text{est}$ estimator agents (cf\/.\/~ Fig\/.\/~ \ref{fig:networkArchitecture}) shall reconstruct the full state
for the purpose of, for example, having full information at different monitoring stations, distributed optimal decision making,
or local state-feedback control.
Overall, there are $N = N_\text{sen} + N_\text{est}$ agents, and we use $i=1, \dots, N_\text{sen}$ to index the sensor agents, and $i=1+N_\text{sen}, \dots, N_\text{est}+N_\text{sen}$ for the estimator agents.
While the primary concern is the development of an event-based approach to the \emph{distributed state estimation} problem in Fig\/.\/~ \ref{fig:networkArchitecture}, we shall also address \emph{distributed control} when the local estimates are used for feedback.
For this, we consider the control input decomposed as
\begin{equation}
u(k) = ( u_1(k), u_2(k), \dots, u_{N_\text{est}}(k) )
\label{eq:u_decomposed}
\end{equation}
with $u_i(k) \in \field{R}^{q_i}$ the input computed on estimator agent $i + N_\text{sen}$.
All agents are connected over a common-bus network; that is, if one agent communicates, all agents will receive the data.
We assume that the network bandwidth is such that, in the worst case, all agents can communicate in one time step $T_\text{s}$, and contention is resolved via low-level protocols.
Moreover, agents are assumed to be synchronized in time, and network communication is abstracted as instantaneous.
\begin{remark}
The common bus is a key component of the developed event-based approach.
It will allow the agents to compute consistent estimates and use these for effective triggering decisions (while inconsistencies can still happen due to data loss or delay).
Wired networks with a shared bus architecture
such as Controller Area Network (CAN) or other
fieldbus systems
are common in industry \cite{Th05}.
Recently, Ferrari \emph{et al.}\ \cite{FeZiMoTh12}
have proposed a common bus concept also for multi-hop low-power wireless networks.
\end{remark}
\subsection{Reference design}
\label{sec:referenceDesign}
We assume that a centralized, discrete-time state estimator design is given, which we seek to emulate with the event-based design to be developed herein:
\begin{align}
\hat{x}_\text{c}(k|k-1) &= A \hat{x}_\text{c}(k-1|k-1) + B u(k-1) \label{eq:FCSE1} \\
\hat{x}_\text{c}(k|k) &= \hat{x}_\text{c}(k|k-1) + L \big(y(k) - C \, \hat{x}_\text{c}(k|k-1) \big)
\label{eq:FCSE2}
\end{align}
where the estimator gain $L \in \field{R}^{n \times p}$ has been designed to achieve desired estimation performance, and the estimator is initialized with some $\hat{x}_\text{c}(0) = \hat{x}_\text{c}(0|0)$.
For example, \eqref{eq:FCSE1}, \eqref{eq:FCSE2} can be a Kalman filter representing the optimal Bayesian estimator for Gaussian noise,
or a Luenberger observer designed via pole placement
to achieve a desired dynamic response.
At any rate, a reasonable observer design will ensure stable estimation error dynamics
\begin{align}
\epsilon_\text{c}(k) &:= x(k) - \hat{x}_\text{c}(k) = (I\!-\!LC)A \epsilon_\text{c}(k\!-\!1) + (I\!-\!LC)v(k\!-\!1) - Lw(k).
\label{eq:closedLoopCentralized_est}
\end{align}
We thus assume that $(I-LC)A$ is stable, which is always possible since $(A,C)$ is detectable.
It follows \cite[p.~212--213]{CaDe91} that there exist $m_\text{c}>0$ and $\rho_\text{c} \in [0,1)$ such that
\begin{equation}
\|((I-LC)A)^k \| \leq m_\text{c} \rho_\text{c}^k .
\label{eq:expStabCentral}
\end{equation}
\subsection{Problem statement}
\label{sec:objective}
The main objective of this article is
an EBSE design that approximates the reference design of Sec\/.\/~ \ref{sec:referenceDesign}
with guaranteed bounds:
\begin{problem}
\label{pro:EBSE}
Develop a distributed EBSE design for the scenario in Fig\/.\/~ \ref{fig:networkArchitecture}, where each estimator agent ($i = N_\text{sen}, \dots, N_\text{sen} + N_\text{est}$) locally computes an estimate $\hat{x}_i(k)$ of the state $x(k)$, and each sensor agent ($i = 1, \dots, N_\text{sen}$) makes individual transmit decisions for its local measurements $y_i(k)$. The design shall emulate the centralized estimator \eqref{eq:FCSE1}, \eqref{eq:FCSE2} bounding the difference $\|\hat{x}_\text{c}(k) - \hat{x}_i(k)\|$, but with reduced communication of sensor measurements.
\end{problem}
Furthermore, we address distributed control based on the EBSE design:
\begin{problem}
\label{pro:EBC}
Design distributed control laws for computing control inputs $u_i(k)$ (cf\/.\/~ \eqref{eq:u_decomposed}) locally
from the event-based estimates $\hat{x}_i(k)$ so as to
achieve stable closed-loop dynamics (bounded $x$).
\end{problem}
For state estimation in general, both the measurement signal $y$ and the control input $u$ must be known (cf\/.\/~ \eqref{eq:FCSE1}, \eqref{eq:FCSE2}).
For simplicity, we first focus on the reduction of sensor measurements and assume
\begin{assum}
\label{ass:knownInput}
The input $u$ is known by all agents.
\end{assum}
\noindent
This is the case, for example, when estimating a process without control input (i\/.\/e\/.\/~ $u=0$),
when $u$ is an a-priori known reference signal, or when $u$ is broadcast periodically over the shared bus.
In particular, if the components $u_i(k)$
are computed by different agents as in Problem~ \ref{pro:EBC}, Assumption~ \ref{ass:knownInput} requires the agents to exchange their inputs over the bus at every step $k$.
Reducing measurement communication, but periodically exchanging inputs may be a viable solution when there are more measurements than control inputs (as is the case for the experiment presented in Sec\/.\/~ \ref{sec:experimentsBC}).
Later, in Sec\/.\/~ \ref{sec:control}, an extension of the results is presented, which does not require Assumption~ \ref{ass:knownInput} and periodic exchange of inputs by employing event-triggering protocols also for the inputs.
\section{Event-based state estimation with a single sensor-estimator link}
\label{sec:singleAgent}
In order to develop the main ideas of the EBSE approach, we first consider Problem~ \ref{pro:EBSE} for the simpler, but relevant special case with $N_\text{sen} = N_\text{est} = 1$; that is, a single sensor transmits data over a network link to a remote estimator (also considered in \cite{Le11,MaSi10,SiLa12,WuJiJoSh13,TrCa15}, for instance).
For the purpose of this section, we make the simplifying assumption of a prefect communication link:
\begin{assum}
\label{ass:idealComm}
Transmission from sensor to estimator is instantaneous
and no data is lost.
\end{assum}
\noindent
For a sufficiently fast network link,
this may be ensured by low-level protocols using acknowledgments and re-transmissions. However, this assumption is made for the sake of simplicity in this section, and omitted again in the later sections.
We propose the event-based architecture depicted in Fig\/.\/~ \ref{fig:EBSE_SingleAgent}.
The key idea is to replicate the remote state estimator at the sensor; the sensor agents then knows what the estimator knows, and thus also when the estimator is in need of new data.
The \emph{State Estimator} and \emph{Event Trigger},
which together form the EBSE algorithm, are explained next.
\begin{figure}[tb]
\centering
\subfigure[Single sensor/estimator agent]{%
\label{fig:EBSE_SingleAgent}
\includegraphics[width=0.65\columnwidth]{figure_EBSE_SingleAgent}}
\\[5mm]
\subfigure[Multiple sensor/estimator agents]{%
\label{fig:EBSE_MultiAgent}
\includegraphics[width=0.8\columnwidth]{figure_EBSE_multiAgent}}
\caption{Proposed event-based state estimation architectures. Dashed arrows indicate event-based communication, while solid ones indicate periodic communication.
\subcaption{(a)}{Single sensor/estimator case: The sensor agent implements a copy of the remote \emph{State Estimator} to trigger a data transmission (\emph{Event Trigger}) whenever an update is needed at the remote agent.}
\subcaption{(b)}{Multiple sensor/estimator case: Each agent implements a copy of the State Estimator for making transmit decisions (Sensors) or having full state information available (Estimators). The common bus supports data exchange between all agents; $\mathcal{Y}(k)$ denotes the set of measurements communicated at time $k$. Disturbances $d_i$ model differences in the agents' estimates, e\/.\/g\/.\/~ from imperfect communication.}
}
\label{fig:EBSE_arch}
\end{figure}
\subsection{State estimator}
\label{sec:StateEstimator}
Both sensor and remote agent implement the state estimator (cf\/.\/~ Fig\/.\/~ \ref{fig:EBSE_SingleAgent}).
The estimator recursively computes an estimate $\hat{x}_i(k) = \hat{x}_i(k|k)$ of the system state $x(k)$ from the available measurements:
\begin{align}
\hat{x}_i(k|k-1) &= A \hat{x}_i(k-1|k-1) + B u(k-1) \label{eq:EBSE1_single} \\
\hat{x}_i(k|k) &= \hat{x}_i(k|k-1) + \gamma(k) L \big(y(k) - C \, \hat{x}_i(k|k-1) \big) \label{eq:EBSE2_single}
\end{align}
with $i=1$ for the sensor, $i=2$ for the estimator, $L$ as in \eqref{eq:FCSE2},
and $\gamma(k) \in \{0,1\}$ denoting the sensor's decision of transmitting $y(k)$ ($\gamma(k)=1$), or not ($\gamma(k)=0$).
By Assumption~ \ref{ass:idealComm}, both estimators have the same input data.
If, in addition, they are initialized identically,
both estimates are identical, i\/.\/e\/.\/~ $\hat{x}_1(k) = \hat{x}_2(k)$ for all $k$. Hence, the sensor has knowledge about the estimator and can exploit this for the triggering decision.
\subsection{Event trigger}
\label{sec:EventTriggerMeas}
The sensor transmits a measurement if, and only if, the remote estimator cannot predict the measurement accurately enough based on its state prediction.
Specifically, $y(k)$ is transmitted when the remote prediction $\hat{y}(k) = C \hat{x}_2(k|k-1)$ deviates from $y(k)$ by more than a tolerable threshold $\delta^\text{est} \geq 0$.
Since $\hat{x}_1(k|k-1) = \hat{x}_2(k|k-1)$, the sensor can make this decision without requiring communication from the remote estimator:
\begin{equation}
\text{transmit $y(k)$}
\; \Leftrightarrow \;
\text{$\gamma(k) = 1$}
\; \Leftrightarrow \;
\| y(k) - C \hat{x}_1(k|k-1) \| \geq \delta^\text{est} .
\label{eq:eventTrigger_MB}
\end{equation}
Tuning $\delta^\text{est}$ allows the designer to trade off the sensor's frequency of events (and, hence, the communication rate) for estimation performance.
This choice of the trigger will be instrumental in bounding
the difference between the event-based and the centralized estimator, as will be seen in the subsequent stability analysis.
The trigger is also called \emph{innovation-based trigger} and was previously proposed in different contexts in \cite{YoTiSo02,TrDAn11,WuJiJoSh13}.
The innovation trigger \eqref{eq:eventTrigger_MB} can also be realized without the local state estimator on the sensor by periodically communicating estimates from the remote estimator to the sensor. However, the proposed architecture
avoids this additional communication.
\subsection{Stability analysis}
\label{sec:idealStabAnalysis}
The estimator update equations \eqref{eq:EBSE1_single}, \eqref{eq:EBSE2_single} and the triggering rule (\ref{eq:eventTrigger_MB}) together constitute the proposed event-based state estimator. The estimator \eqref{eq:EBSE1_single}, \eqref{eq:EBSE2_single} is a switching observer, whose switching modes are governed by the event trigger \eqref{eq:eventTrigger_MB}.
For arbitrary switching, stability of the switching observer is \emph{not} implied by stability of the centralized design (see e\/.\/g\/.\/~ \cite{BoLu02}). Hence, proving stability is an essential, non-trivial requirement for the event-based design.
\subsubsection{Difference to centralized estimator}
Addressing Problem~ \ref{pro:EBSE}, we first prove a bounded difference to
the centralized reference estimator $\hat{x}_c(k)$.
Using \eqref{eq:FCSE1}, \eqref{eq:FCSE2}, \eqref{eq:EBSE1_single}, and \eqref{eq:EBSE2_single}, the difference $e_i(k) = \hat{x}_c(k) - \hat{x}_i(k)$ can be written as
\begin{align}
e_i(k)
&=A e_i(k\!-\!1)
+ L \big( y(k) - C \hat{x}_\text{c}(k|k\!-\!1) \big) - \gamma(k) L \big( y(k) - C \hat{x}_i(k|k-1) \big) \nonumber \\
&=(I-LC)A e_i(k-1)
+ (1-\gamma(k)) L \big( y(k) - C \hat{x}_i(k|k-1) \big)
\label{eq:epsilon_ci}
\end{align}
where the last equation was obtained by adding and subtracting $L ( y(k) - C \hat{x}_i(k|k\!-\!1) )$.
The error $e_i(k)$ is governed by the stable centralized estimator dynamics $(I-LC)A$
with an extra input term,
which is bounded by the choice of the event-trigger (\ref{eq:eventTrigger_MB}): for $\gamma(k)=0$, $L (y(k) - C \hat{x}_i(k|k-1))$ is bounded by (\ref{eq:eventTrigger_MB}), and for $\gamma(k)=1$, the extra term vanishes.
We thus have the following result:
\begin{theorem}
\label{thm:epsilon_ci_idealized}
Let Assumptions \ref{ass:knownInput} and \ref{ass:idealComm} be satisfied, $(I-LC)A$ be stable, and $\hat{x}_1(0) = \hat{x}_2(0) = x_0$ for some $x_0 \in \field{R}^n$. Then, the difference $e_i(k)$ between the centralized estimator and the EBSE \eqref{eq:EBSE1_single}, \eqref{eq:EBSE2_single}, and \eqref{eq:eventTrigger_MB} is bounded by
\begin{equation}
\| e_i \|_\infty \leq m_\text{c} \| e_i(0) \| + \frac{m_\text{c}}{1-\rho_\text{c}} \|L\| \delta^\text{\normalfont{est}} =: e_i^\text{max}.
\label{eq:thm_epsilon_ci_idealized}
\end{equation}
\end{theorem}
\begin{proof}
From the assumptions, it follows that $\hat{x}_1(k) = \hat{x}_2(k)$ and $\hat{x}_1(k|k-1) = \hat{x}_2(k|k-1)$. From the previous argument, we have
\begin{equation}
\| (1-\gamma(k)) L \big( y(k) - C \hat{x}_i(k|k-1) \big) \|
\leq
\| L \| \delta^\text{\normalfont{est}} .
\end{equation}
The bound \eqref{eq:thm_epsilon_ci_idealized} then follows from \cite[p.~218, Thm. 75]{CaDe91} and exponential stability of $e_i(k) = (I-LC)A e_i(k-1)$ (cf\/.\/~ \eqref{eq:expStabCentral}).
\end{proof}
The first term in \eqref{eq:thm_epsilon_ci_idealized}, $m_\text{c} \| e_i(0) \|$, is due to possibly different initial conditions between the EBSE and the centralized estimator,
and $m_\text{c} \|L\| \delta^\text{est} / (1-\rho_\text{c})$ represents the asymptotic bound. Choosing $\delta^\text{est}$ small enough, $e_i(k)$ can hence be made arbitrarily small as $k \to \infty$,
and, for $\delta^\text{est} = 0$,
the performance of the centralized estimator is recovered.
The bound (\ref{eq:thm_epsilon_ci_idealized}) holds irrespective of the nature of the disturbances $v$ and $w$ in \eqref{eq:system_x}, \eqref{eq:system_y} (no assumption on $v$, $w$ is made in Theorem~ \ref{thm:epsilon_ci_idealized}). In particular, it also holds for the case of unbounded disturbances such as Gaussian noise.
\subsubsection{Estimation error}
\label{sec:estErrSingle}
The actual estimation error $\epsilon_i$ of agent $i$ is
\begin{align}
\epsilon_i(k) &:= x(k) - \hat{x}_i(k)
= \epsilon_\text{c}(k) + e_i(k) .
\label{eq:estError_ei}
\end{align}
Theorem~ \ref{thm:epsilon_ci_idealized} can be used to deduce properties of the estimation error $\epsilon_i$ from properties of the centralized estimator.
We exemplify this for the case of bounded, as well as stochastic disturbances $v$ and $w$.
\begin{corollary}
\label{cor:estErrDet}
Let $\|v\|_\infty \leq v^\text{max}$, $\|w\|_\infty \leq w^\text{max}$, $\| e_i \|_\infty \leq e_i^\text{max}$ be bounded, and $(I-LC)A$ be stable. Then,
the event-based estimation error \eqref{eq:estError_ei} is bounded by
\begin{equation}
\| \epsilon_i \|_\infty \leq \epsilon_\text{c}^\text{max} + e_i^\text{max}
\label{eq:bound_epsiloni_deterministic}
\end{equation}
with $\epsilon_\text{c}^\text{max}:= m_\text{c} \| \epsilon_\text{c}(0) \| + \frac{m_\text{c}}{1-\rho_\text{c}} (\|I-LC\| v^\text{\normalfont{max}} + \|L\| w^\text{\normalfont{max}})$.
\end{corollary}
\begin{proof}
The bound $\epsilon_\text{c}^\text{max}$ on the centralized estimation error $\epsilon_\text{c}(k)$ follows directly from \eqref{eq:closedLoopCentralized_est}, exponential stability \eqref{eq:expStabCentral}, and \cite[p.~218, Thm. 75]{CaDe91}. The result \eqref{eq:bound_epsiloni_deterministic} is then immediate from \eqref{eq:estError_ei}.
\end{proof}
\begin{corollary}
\label{cor:estErrStoch}
Let $v$, $w$, $x(0)$ be random variables with $\mathbb{E}[v(k)] = 0$, $\mathbb{E}[w(k)] = 0$, $\mathbb{E}[x(0)] = x_0$, and the centralized estimator be initialized with $\hat{x}_\text{c}(0) = x_0$. Let $\| e_i \|_\infty \leq e_i^\text{max}$ be bounded, and $(I-LC)A$ be stable.
Then, the expected event-based estimation error \eqref{eq:estError_ei} is bounded by
\begin{equation}
\| \mathbb{E}[\epsilon_i(k)] \| \leq e_i^\text{max} \quad \forall k.
\label{eq:bound_epsiloni_stochastic}
\end{equation}
\end{corollary}
\begin{proof}
From \eqref{eq:closedLoopCentralized_est}, it follows $\mathbb{E}[ \epsilon_\text{c}(k) ] = (I-LC)A \mathbb{E}[ \epsilon_\text{c}(k-1) ]$, and thus $\mathbb{E}[ \epsilon_\text{c}(k) ] = 0$ by recursion from $\mathbb{E}[ \epsilon_\text{c}(0) ] = \mathbb{E}[x(0)] - x_0 = 0$. Therefore,
\begin{align}
\| \mathbb{E}[\epsilon_i(k)] \|
&= \| \mathbb{E}[e_i(k)] \|
\leq \mathbb{E}[ \|e_i(k) \| ]
\leq e_i^\text{max}
\end{align}
where the first inequality follows from Jensen's inequality, and the last from $\| e_i(k) \| \leq e_i^\text{max}$.
\end{proof}
\section{Event-based state estimation with multiple agents}
\label{sec:multiAgent}
We extend the ideas of the previous section to the general multi-agent case in Problem~ \ref{pro:EBSE}.
While the assumption of perfect communication (Assumption~ \ref{ass:idealComm}) may possibly be realizable for few agents, it becomes unrealistic as the number of agents increases. Thus, we generalize the stability analysis to the case where agents' estimates can differ.
\subsection{Architecture}
We propose the distributed event-based architecture depicted in Fig\/.\/~ \ref{fig:EBSE_MultiAgent} for the multi-agent problem.
Adopting the key idea of the single agent case (cf\/.\/~ Fig\/.\/~ \ref{fig:EBSE_SingleAgent}), each agent implements a copy of the state estimator for making transmit decisions.
The common bus network ensures that, if a measurement is transmitted, it is broadcast to all other units. For the estimators to be consistent, the sensor agents also listen to the measurement data $\mathcal{Y}(k)$ broadcast by other units.
The proposed EBSE scheme is \emph{distributed} in the sense that data from distributed sensors is required for stable state estimation, and that transmit decisions are made locally by each agent.
\subsection{Event trigger}
\label{sec:EventTriggerMeas_Multi}
In analogy to the single agent case \eqref{eq:eventTrigger_MB}, each agent $i$, $i \in \field{N}_{N_\text{sen}}$, uses the following event triggering rule:
\begin{equation}
\text{transmit $y_i(k)$}
\; \Leftrightarrow \;
\| y_i(k) - C_i \hat{x}_i(k|k-1) \| \geq \delta^\text{est}_i .
\label{eq:eventTrigger_MB_multi}
\end{equation}
The prediction $\hat{y}_i(k) = C_i \hat{x}_i(k|k-1)$ computed by agent $i$ is representative also for all other agents' predictions of the same measurement, $\hat{y}_{i}^j(k) = C_i \hat{x}_j(k|k-1)$, as long as $\hat{x}_i(k|k-1) \approx \hat{x}_j(k|k-1)$, which is to be established in the stability analysis below.
Being able to approximately represent the other agents' knowledge
is the basis for making effective transmit decisions in the proposed approach.
For later reference, we introduce $\delta^\text{est} := (\delta^\text{est}_1, \dots, \delta^\text{est}_{N_\text{sen}})$ and the index sets of transmitting and not-transmitting agents:
\begin{align}
I(k) &:= \{ i \in \field{N}_{N_\text{sen}} \, | \, \| y_i(k) - C_i \hat{x}_i(k|k\!-\!1) \| \geq \delta^\text{est}_i \}
\label{eq:I} \\
I^\text{c}(k) &:= \{ i \in \field{N}_{N_\text{sen}} \, | \, \| y_i(k) - C_i \hat{x}_i(k|k\!-\!1) \| < \delta^\text{est}_i \} = \field{N}_{N_\text{sen}} \setminus I(k).
\label{eq:Ibar}
\end{align}
\subsection{State estimator}
Extending the event-based estimator \eqref{eq:EBSE1_single}, \eqref{eq:EBSE2_single} to the multi sensor case, we propose the following estimator update for all agents ($i \in \mathbb{N}_N$):
\begin{align}
\hat{x}_i(k|k-1) &= A \hat{x}_i(k-1|k-1) + B u(k-1) \label{eq:EBSE1_multi} \\
\hat{x}_i(k|k) &= \hat{x}_i(k|k-1) + \!\! \sum_{\ell \in I(k)} \!\! L_\ell \big( y_\ell(k) - C_\ell \hat{x}_i(k|k-1) \big) \label{eq:EBSE2ideal_multi}
\end{align}
where $L_\ell \in \field{R}^{n \times p_\ell}$ is the submatrix of the centralized gain $L = [L_1, L_2, \dots, L_{N_\text{sen}}]$ corresponding to $y_\ell$.
Rewriting \eqref{eq:FCSE2} as
\begin{align}
\hat{x}_\text{c}(k|k) &= \hat{x}_\text{c}(k|k-1) + \!\! \sum_{\ell\in \field{N}_{N_\text{sen}}} \! L_\ell \big( y_\ell(k) - C_\ell \hat{x}_\text{c}(k|k-1) \big)
\label{eq:FCSE2_rewritten}
\end{align}
we see that \eqref{eq:EBSE2ideal_multi} is the same as the centralized update, but only updating with a subset $I(k) \subset \field{N}_{N_\text{sen}}$ of all measurements.
If, at time $k$, no measurement is transmitted (i\/.\/e\/.\/~ $I(k) = \emptyset$), then the summation in (\ref{eq:EBSE2ideal_multi})
vanishes;
that is, $\hat{x}_i(k|k) = \hat{x}_i(k|k-1)$.
To account for differences in any two agents' estimates, e\/.\/g\/.\/~ from unequal initialization, different computation accuracy, or imperfect communication,
we introduce a generic disturbance signal $d_i$ acting on each estimator (cf\/.\/~ Fig\/.\/~ \ref{fig:EBSE_MultiAgent}). For the stability analysis, we thus replace \eqref{eq:EBSE2ideal_multi} with
\begin{align}
\hat{x}_i(k|k) &= \hat{x}_i(k|k\!-\!1) \! + \! \sum\limits_{\ell \in I(k)} \!\! L_\ell \big( y_\ell(k) - C_\ell \hat{x}_i(k|k\!-\!1) \big) +d_i(k). \label{eq:EBSE2_multi}
\end{align}
The disturbances are assumed to be bounded:
\begin{assum}
\label{ass:bounded_di}
For all $i \in \field{N}_{N}$, $\|d_i \|_\infty \leq d_i^\text{\normalfont{max}}$.
\end{assum}
\noindent
This assumption is realistic, when $d_i$ represent imperfect initialization or different computation accuracy, for example.
Even though the assumption may not hold for modeling packet drops in general,
the developed method was found to be effective also for this case in the example of Sec\/.\/~ \ref{sec:simulationExample}.
\subsection{Stability analysis}
We discuss stability of the distributed EBSE system given by the process \eqref{eq:system_x}, \eqref{eq:system_yi}, the (disturbed) estimators \eqref{eq:EBSE1_multi}, \eqref{eq:EBSE2_multi}, and the triggering rule \eqref{eq:eventTrigger_MB_multi}.
We first consider the difference between the centralized and event-based estimate, $e_i(k) = \hat{x}_c(k) - \hat{x}_i(k)$.
By straightforward manipulation using \eqref{eq:FCSE1}, \eqref{eq:EBSE1_multi}, \eqref{eq:FCSE2_rewritten}, and \eqref{eq:EBSE2_multi}, we obtain
\begin{align}
e_i(k)
&=A e_i(k\!-\!1)
+ \sum\limits_{\ell \in \field{N}_{N_\text{sen}}} L_\ell \big( y_\ell(k) - C_\ell \hat{x}_\text{c}(k|k\!-\!1) \big)
-\!\!\underbrace{\sum\limits_{\ell \in I(k)} L_\ell \big( y_\ell(k) - C_\ell \hat{x}_i(k|k-1) \big)}_{
\sum_{\ell \in \field{N}_{N_\text{sen}}} \! L_\ell (\, \ldots \,) \,\,
- \,\, \sum_{\ell \in I^\text{c}(k)} \! L_\ell (\, \ldots \,)
} -d_i(k) \nonumber \\
&=(I-LC)A e_i(k-1) +\!\! \sum\limits_{\ell \in I^\text{c}(k)} L_\ell \big( y_\ell(k) - C_\ell \hat{x}_i(k|k-1) \big) -d_i(k)
\label{eq:epsilon_ci_multi} \\
&=(I-LC)A e_i(k-1) \nonumber \\
&\phantom{=}+\!\! \sum\limits_{\ell \in I^\text{c}(k)} L_\ell \big( y_\ell(k) - C_\ell \hat{x}_\ell(k|k-1) \big) -d_i(k) -\!\! \sum\limits_{j \in I^\text{c}(k)} L_j C_j A e_{ij}(k-1)
\label{eq:epsilon_ci_di}
\end{align}
where $e_{ij}(k) := \hat{x}_i(k) - \hat{x}_j(k)$ is the inter-agent error,
and we used $\hat{x}_i(k|k-1) - \hat{x}_\ell(k|k-1) = A e_{i \ell}(k-1)$.
The error dynamics \eqref{eq:epsilon_ci_di} are governed by stable dynamics $e_i(k) =(I-LC)A e_i(k-1)$ with three input terms.
The term $\sum_{\ell \in I^\text{c}(k)} L_\ell ( y_\ell(k) - C_\ell \hat{x}_\ell(k|k-1) )$ is analogous to the last term in \eqref{eq:epsilon_ci} and bounded by the event triggering \eqref{eq:eventTrigger_MB_multi} (cf\/.\/~ \eqref{eq:Ibar}). The last two terms are due to the disturbance $d_i$ and resulting inter-agent differences $e_{ij}$.
To bound $e_i$, $e_{ij}$ must also be bounded, which is established next.
\subsubsection{Inter-agent error}
\label{sec:interAgentError}
The inter-agent error can be written as
\begin{align}
e_{ij}(k)
&= \hat{x}_i(k) - \hat{x}_j(k)
=A e_{ij}(k-1)
\nonumber \\
&\phantom{=} + \sum\nolimits_{\ell \in I(k)} L_\ell \big( y_\ell(k) - C_\ell \hat{x}_i(k|k-1) \big) +d_i(k) \nonumber \\
&\phantom{=} - \sum\nolimits_{\ell \in I(k)} L_\ell \big( y_\ell(k) - C_\ell \hat{x}_j(k|k-1) \big) -d_j(k) \nonumber \\
&=
\tilde{A}_{I(k)} \, e_{ij}(k-1)
+d_i(k) -d_j(k) \label{eq:epsij_dyn}
\end{align}
where $\tilde{A}_{J}$ is defined for some subset $J \subseteq \field{N}_{N_\text{sen}}$ by
\begin{equation}
\tilde{A}_{J} := (I - \sum_{\ell \in J} L_\ell C_\ell)A .
\end{equation}
Hence, the inter-agent error $e_{ij}(k)$ is governed by the time-varying dynamics $e_{ij}(k) = \tilde{A}_{I(k)} e_{ij}(k-1)$. Unfortunately, one cannot, in general, infer stability of the inter-agent error (and thus the event-based estimation error \eqref{eq:epsilon_ci_di}) from stability of the centralized design.
A counterexample is presented in \cite{Tr14}.
A sufficiency result for stability of the inter-agent error can be obtained by considering the dynamics \eqref{eq:epsij_dyn} under arbitrary switching; that is, with $\tilde{A}_{J}$ for all subsets $J \subseteq \field{N}_{N_\text{sen}}$. The following result is adapted from \cite[Lemma~3.1]{MuTr15}.
\begin{lemma}
Let Assumption~ \ref{ass:bounded_di} hold, and let the matrix inequality
\begin{equation}
\tilde{A}_{J}^\text{T} P \tilde{A}_{J} - P < 0
\label{eq:LMI_cond}
\end{equation}
be satisfied for some positive definite $P \in \field{R}^{n \times n}$ and for all subsets $J \subseteq \field{N}_{N_\text{sen}}$.
Then, for given initial errors $e_{ij}(0)$ ($i,j \in \field{N}_N$), there exists $e^\text{max} \in \field{R}$, $e^\text{max} \geq 0$, such that
\begin{equation}
\| e_{ij} \|_\infty \leq e^\text{max}, \quad \text{for all $i,j \in \field{N}_N$ and the Euclidean norm $\| . \|$.}
\label{eq:bounded_eij}
\end{equation}
\label{lem:bounded_eij}
\end{lemma}
\begin{proof}
Under \eqref{eq:LMI_cond}, the error dynamics \eqref{eq:epsij_dyn} are input-to-state stable (ISS) following the proof of \cite[Lemma~3.1]{MuTr15} ($A_\text{cl}(J)$ replaced with $\tilde{A}_{J}$).
With Assumption~ \ref{ass:bounded_di}, ISS guarantees boundedness of the inter-agent error $e_{ij}$ and thus the existence of $e^\text{max}_{ij} \geq 0$ (possibly dependent on the initial error $e_{ij}(0)$) such that
\begin{equation}
\| e_{ij} \|_\infty \leq e^\text{max}_{ij} .
\end{equation}
Finally, \eqref{eq:bounded_eij} is obtained by taking the maximum over all $e^\text{max}_{ij}$.
\end{proof}
The stability test is conservative because the event trigger \eqref{eq:eventTrigger_MB_multi} will generally not permit arbitrary switching. Since $J \subseteq \field{N}_{N_\text{sen}}$ also includes the empty set (i\/.\/e\/.\/~ $\tilde{A}_{\emptyset} = A$), the test can only be used for open-loop stable dynamics \eqref{eq:system_x}.
In Sec\/.\/~ \ref{sec:syncAvg}, we present an alternative approach to obtained bounded $e_{ij}$ for arbitrary systems.
\subsubsection{Difference to centralized estimator}
With the preceding lemma, we can now establish boundedness of the estimation error \eqref{eq:epsilon_ci_di}.
\begin{theorem}
\label{thm:epsilon_ci_notIdealized}
Let Assumptions \ref{ass:knownInput} and \ref{ass:bounded_di} and the conditions of Lemma~ \ref{lem:bounded_eij} be satisfied,
and let $(I-LC)A$ be stable.
Then, the difference $e_i(k)$ between the centralized estimator and the EBSE \eqref{eq:eventTrigger_MB_multi}, \eqref{eq:EBSE1_multi}, \eqref{eq:EBSE2_multi} is bounded by
\begin{equation}
\| e_i \|_\infty \leq m_\text{c} \| e_i(0) \|
+ \frac{m_\text{c}}{1-\rho_\text{c}}
\big(
\|L\| \|\delta^\text{\normalfont{est}} \|
+ d_i^\text{\normalfont{max}}
+ \bar{m} N_\text{sen} e^\text{max}
\big)
=: e_i^{\text{\normalfont{max}}}
\label{eq:thm_epsilon_ci_notIdealized}
\end{equation}
with $m_\text{c}$, $\rho_\text{c}$ as in \eqref{eq:expStabCentral}, and $\bar{m} := \max_{j \in \field{N}_{N_\text{sen}}} \| L_jC_jA \|$.
\end{theorem}
\begin{proof}
We can establish the following bounds (for all $k$)
\begin{align}
&\Big\| \sum\limits_{\ell \in I^\text{c}(k)} L_\ell \big( y_\ell(k) - C_\ell \hat{x}_\ell(k|k-1) \big) \Big\|
\stackrel{\text{\eqref{eq:Ibar}}}{\leq} \|L\| \|\delta^\text{\normalfont{est}} \| \\
&\| d_i(k) \|
\stackrel{\text{Ass.~\ref{ass:bounded_di}}}{\leq} d_i^\text{max} \\
&\Big\| \sum\limits_{j \in I^\text{c}(k)} L_j C_j A e_{ij}(k-1) \Big\|
\leq \sum\limits_{j \in I^\text{c}(k)} \|L_j C_j A\| \|e_{ij}(k-1)\|
\stackrel{\text{Lemma~\ref{lem:bounded_eij}}}{\leq} \bar{m} N_\text{sen} e^\text{max} .
\end{align}
The result \eqref{eq:thm_epsilon_ci_notIdealized} then follows from \eqref{eq:epsilon_ci_di}, stability of $(I-LC)A$, and \cite[p.~218, Thm. 75]{CaDe91}.
\end{proof}
\subsubsection{Synchronous estimator resets}
\label{sec:syncAvg}
We present a straightforward extension of the event-based communication scheme, which guarantees stability even if the inter-agent error dynamics \eqref{eq:epsij_dyn} cannot be shown to be stable (e.g., if Lemma~ \ref{lem:bounded_eij} does not apply).
Since the inter-agent error $e_{ij}(k)$ is the difference between the state estimates by agent $i$ and $j$,
we can make it zero
by resetting the two agents' state estimates to the same value, for example, their average.
Therefore, a straightforward way to guarantee
bounded inter-agent errors is to periodically reset all agents' estimates to their joint average.
Clearly, this strategy increases the communication load on the network. If, however, the disturbances $d_i$ are small or only occur rarely, the required resetting period can typically be large relative to the underlying sampling time $T_\text{s}$.
We assume that the resetting happens after all agents have made their estimator updates \eqref{eq:EBSE2_multi}.
Let $\hat{x}_i(k-)$ and $\hat{x}_i(k+)$ denote agent $i$'s estimate at time $k$ before and after resetting, and let $K \in \field{N}$ be the fixed resetting period. Each agent $i$ implements the following synchronous averaging:
\begin{align}
&\text{If $k$ a multiple of $K$:}
\!\!\!&& \text{transmit $\hat{x}_i(k-)$;} \label{eq:syncAvg} \\
& && \text{receive $\hat{x}_j(k-), j \in \field{N}_N \!\setminus \!\{i \}$;} \nonumber \\
& && \text{set $\hat{x}_i(k+) = \sum_{j=1}^{N} \hat{x}_j(k-)$.} \nonumber
\end{align}
We assume that the network capacity is such that the mutual exchange of the estimates can happen in one time step,
and no data is lost in the transfer.
In other scenarios, one could take several time steps to exchange all estimates, at the expense of a delayed reset.
The synchronous averaging period $K$ can be chosen from simulations assuming a model for the inter-agent disturbances $d_i$ (e\/.\/g\/.\/~ packet drops).
We have the following stability result for EBSE with synchronous averaging \eqref{eq:syncAvg}.
\begin{theorem}
\label{thm:epsilon_ci_syncAvg}
Let Assumptions \ref{ass:knownInput} and \ref{ass:bounded_di} be satisfied and $(I-LC)A$ be stable. Then, the difference $e_i(k)$ between the centralized estimator and the EBSE with synchronous averaging given by \eqref{eq:eventTrigger_MB_multi}, \eqref{eq:EBSE1_multi}, \eqref{eq:EBSE2_multi}, and \eqref{eq:syncAvg} is bounded.
\end{theorem}
\begin{proof}
Since the agent error \eqref{eq:epsilon_ci_di} is affected by the resetting \eqref{eq:syncAvg}, we first rewrite $e_i(k)$ in terms of the average estimate $\bar{x}(k) := \avg( \hat{x}_i(k) ) := \frac{1}{N} \sum\nolimits_{i=1}^N \hat{x}_i(k)$. Defining $\bar{e}(k) := \hat{x}_\text{c}(k) - \bar{x}(k)$ and $\bar{e}_i(k) := \bar{x}(k) - \hat{x}_i(k)$, we have $e_i(k) = \bar{e}(k) + \bar{e}_i(k)$ and will establish the claim by showing boundedness of $\bar{e}_i(k)$ and $\bar{e}(k)$ separately.
For the average estimate $\bar{x}(k)$,
we obtain from \eqref{eq:EBSE1_multi}, \eqref{eq:EBSE2_multi},
\begin{align*}
&\bar{x}(k|k-1) = A \bar{x}(k-1) + B u(k-1) \\
&\bar{x}(k) = \bar{x}(k|k\!-\!1) + \!\!\! \sum_{\ell \in I(k)} \!\! L_\ell \big( y_\ell(k) - C_\ell \bar{x}(k|k\!-\!1) \big) + \bar{d}(k)
\end{align*}
where $\bar{x}(k|k-1) := \avg(\hat{x}_i(k|k-1))$
and $\bar{d}(k) := \avg(d_i(k))$.
The dynamics of the error $\bar{e}_i(k)$ are described by
\begin{align}
\bar{e}_i(k)
&=
\tilde{A}_{I(k)} \bar{e}_i(k-1)
+\bar{d}(k)-d_i(k)
\label{eq:epsj} \\
\bar{e}_i(k+) &= 0, \qquad \text{for $k = \kappa K$ with some $\kappa \in \field{N}$} \label{eq:epsj_reset}
\end{align}
where \eqref{eq:epsj} is obtained by direct calculation analogous to \eqref{eq:epsij_dyn}, and \eqref{eq:epsj_reset} follows from \eqref{eq:syncAvg}.
Since $\bar{d}(k)$, $d_i(k)$,
and $\tilde{A}_{I(k)}$ are all bounded, boundedness of $\bar{e}_i$ for all $i \in \field{N}_N$ follows.
Since $\bar{e}(k) = \avg_i(e_i(k))$, we obtain from \eqref{eq:epsilon_ci_di}
\begin{align}
\bar{e}(k)
&= (I-LC)A \bar{e}(k-1) \nonumber \\
&\phantom{=}+ \sum\limits_{\ell \in I^\text{c}(k)} L_\ell \big( y_\ell(k) - C_\ell \hat{x}_\ell(k|k-1) \big) -\bar{d}(k) \nonumber \\
&\phantom{=}- \sum\limits_{j \in I^\text{c}(k)} L_j C_j A \bar{e}_{j}(k-1)
\label{eq:eavg}
\end{align}
where
we used $\avg_i(e_{ij}(k)) = \avg_i (\hat{x}_i(k) - \hat{x}_j(k)) = \bar{x}(k) - \hat{x}_j(k) = \bar{e}_j(k)$.
Note that \eqref{eq:eavg} fully describes the evolution of $\bar{e}(k)$. In particular, the resetting \eqref{eq:syncAvg} does not affect $\bar{e}(k)$ because, at $k=\kappa K$, it holds
\begin{align}
\bar{e}(k+) &= \hat{x}_\text{c}(k) - \frac{1}{N} \sum_{j=1}^N \hat{x}_j(k+) \nonumber \\
&=\hat{x}_\text{c}(k) - \frac{1}{N} \sum_{j=1}^N \Big( \frac{1}{N} \sum_{\ell=1}^N \hat{x}_\ell(k-) \Big) \nonumber \\
&=\hat{x}_\text{c}(k) - \frac{1}{N} \sum_{\ell=1}^N \hat{x}_\ell(k-) = \bar{e}(k-) .
\end{align}
All input terms in \eqref{eq:eavg} are bounded: $\bar{d}$ by Assumption~ \ref{ass:bounded_di}, $\sum_{\ell \in I^\text{c}(k)} L_\ell (y_\ell(k) - C_\ell \hat{x}_\ell(k|k-1))$ by \eqref{eq:Ibar},
and $\bar{e}_j$
by the previous argument.
The claim then follows from stability of $(I-LC)A$.
\end{proof}
\subsubsection{Estimation error}
\label{sec:estErrMulti}
By means of \eqref{eq:estError_ei} with Theorem~ \ref{thm:epsilon_ci_notIdealized} or Theorem~ \ref{thm:epsilon_ci_syncAvg}, properties about the agent's estimation error $\epsilon_i(k) = x(k) - \hat{x}_i(k)$ can be derived given properties of the disturbances $v$, $w$, and the centralized estimator.
For example, Corollaries \ref{cor:estErrDet} and \ref{cor:estErrStoch} apply analogously also for the multi-agent case.
\section{Distributed control}
\label{sec:control}
In this section, we address Problem~ \ref{pro:EBC}; that is,
the scenario where the local estimates $\hat{x}_i$ on the $N_\text{est}$ estimators are used for feedback control.
Recall the decomposition \eqref{eq:u_decomposed} of the control input, where $u_i(k)$ is the input computed on estimator agent $i + N_\text{sen}$.
Assume a centralized state-feedback design is given
\begin{equation}
u(k) = F \, x(k)
\label{eq:stateFeedback}
\end{equation}
with controller gain $F \in \field{R}^{q \times n}$ such that $A+BF$ is stable.
We propose the distributed state-feedback control law
\begin{equation}
u_i(k) = F_i \, \hat{x}_{i+N_\text{sen}}(k), \quad i \in \field{N}_{N_\text{est}}
\label{eq:stateFeedbackDistributed}
\end{equation}
where $F_i \in \field{R}^{q_i \times n}$ is the part of the gain matrix $F$ in \eqref{eq:stateFeedback} corresponding to the local input $u_i$. Same as for the emulation-based estimator design in previous sections, the feedback gains do not need to be specifically designed, but can simply be taken from the centralized design \eqref{eq:stateFeedback}.
\subsection{Closed-loop stability analysis}
Using \eqref{eq:estError_ei} and \eqref{eq:stateFeedbackDistributed}, the state equation \eqref{eq:system_x} can be rewritten as
\begin{align}
x(k) &= (A+BF) x(k-1) - \! \sum_{i \in \field{N}_{N_\text{est}}} \! B_i F_i \, \epsilon_{i+N_\text{sen}}(k-1) + v(k-1)
\label{eq:stateEquationWFeedback}
\end{align}
where $\epsilon_{i+N_\text{sen}}(k-1)$ are the estimation errors of the estimator agents (cf\/.\/~ Sec\/.\/~ \ref{sec:estErrMulti}). Closed-loop stability can then be deduced leveraging the results of Sec\/.\/~ \ref{sec:multiAgent}.
\begin{theorem}
\label{thm:boundednessControl}
Let the assumptions of either Theorem~ \ref{thm:epsilon_ci_notIdealized} or Theorem~ \ref{thm:epsilon_ci_syncAvg} be satisfied, $A+BF$ be stable, and $v$ and $w$ bounded.
Then, the state
of the closed-loop
control system given by \eqref{eq:system_x}, \eqref{eq:system_y}, \eqref{eq:eventTrigger_MB_multi}, \eqref{eq:EBSE1_multi}, \eqref{eq:EBSE2_multi}, \eqref{eq:stateFeedbackDistributed}, and (possibly) \eqref{eq:syncAvg}
is bounded.
\end{theorem}
\begin{proof}
Since $(I-LC)A$ is stable and $v$, $w$ bounded, it follows from \eqref{eq:closedLoopCentralized_est} that the estimation error $\epsilon_\text{c}(k)$ of the centralized observer is also bounded. Thus, \eqref{eq:estError_ei} and Theorem~ \ref{thm:epsilon_ci_notIdealized} or \ref{thm:epsilon_ci_syncAvg} imply that all $\epsilon_i$, $i \in \mathbb{N}_N$, are bounded.
Hence, it follows from \eqref{eq:stateEquationWFeedback}, stability of $A+BF$, and bounded $v$ that $x$ is also bounded.
\end{proof}
Satisfying Assumption~ \ref{ass:knownInput} for the above result requires the periodic communication of all inputs over the bus.
While this increases the network load, it can be a viable option if the number of inputs is comparably small. Next, we briefly present an alternative scheme, where the communication of inputs is reduced also by means of event-based protocols.
\subsection{Event-based communication of inputs}
Each estimator agent computes
$u_i(k)$ according to \eqref{eq:stateFeedbackDistributed}
and broadcasts an update to the other agents whenever there has been a significant change:
\begin{equation}
\text{transmit $u_i(k)$} \;\;
\Leftrightarrow \;\;
\|u_i(k) - u_{i, \text{last}}(k) \| \geq \delta^\text{ctrl}_i
\label{eq:eventTriggerCtrl}
\end{equation}
where $\delta^\text{ctrl}_i \geq 0$ is a tuning parameter, and $u_{i, \text{last}}(k)$ is the last input that was broadcast by agent $i$.
Each agent $i$ maintains an estimate $\hat{u}^i(k) \in \field{R}^q$ of the complete input vector $u(k)$;
agent $i$'s estimate of agent $j$'s input is
\begin{equation}
\hat{u}^i_j(k)
=
\begin{cases}
u_j(k) & \text{if \eqref{eq:eventTriggerCtrl} triggered} \\
\hat{u}^i_j(k-1) & \text{otherwise}.
\end{cases}
\label{eq:inputEstSingle}
\end{equation}
The agent then uses $\hat{u}^i(k-1) = ( \hat{u}^i_1(k-1), \hat{u}^i_2(k-1), \dots, \hat{u}_N(k-1) )$
instead of the true input $u(k-1)$ for the estimator update \eqref{eq:EBSE1_multi}.
Since the error $\tilde{u}^i(k) := u(k) - \hat{u}^i(k)$ from making this approximate update is bounded by the event trigger \eqref{eq:eventTriggerCtrl}, the stability results presented in Sec\/.\/~ \ref{sec:multiAgent} can be extended to this case.
The details are omitted, but can be found in \cite{Tr15arxiv}.
\section{Experiments}
\label{sec:experiments}
To illustrate the proposed approach for event-based state estimation, we present numerical simulations of a benchmark problem \cite{GrHiJuEtAl14} and summarize experimental results from \cite{Tr12}.
Both are examples of the multi-agent case where local estimates are used for control.
\subsection{Numerical simulation of a thermo-fluid benchmark process}
\label{sec:simulationExample}
We consider distributed event-based control of a thermo-fluid process, which has been proposed as a benchmark problem in \cite{GrHiJuEtAl14,SiStGrLu15}.
Matlab files to run the simulation example are provided as supplementary material (\url{http://tiny.cc/DEBSEsuppl}).
The process has two tanks containing fluids, whose level and temperature are to be regulated by controlling the tanks' inflows, as well as heating and cooling units. Both tanks are subject to step-like disturbances, and their dynamics are coupled through cross-flows between the tanks. Each tank is associated with a control agent responsible for computing commands to the respective actuators. Each agent can sense the temperature and level of its tank. For details on the process, refer to \cite{GrHiJuEtAl14,SiStGrLu15}.
\subsubsection{System description}
\label{sec:SystemDescriptionThermofluid}
The discrete-time linear model \eqref{eq:system_x}, \eqref{eq:system_y}
is obtained by zero-order hold discretization with $T_\text{s} = 0.2 \, \text{s}$ of the continuous-time model given in \cite[Sec.~5.8]{GrHiJuEtAl14}.
The process dynamics are stable.
The states and inputs of the system are summarized in Table~\ref{tab:StatesAndInputsThermofluid}.
Noisy state measurements
\begin{equation*}
y(k) = x(k) + w(k)
\end{equation*}
are available,
where $w(k)$ is uniformly distributed.
The numerical parameters of the model are available in the supplementary files.
\begin{table}
\renewcommand{\arraystretch}{1.1}
\caption{States and inputs of the thermo-fluid process.
}
\label{tab:StatesAndInputsThermofluid}
\centering
\begin{tabular}{lll}
\hline
{\bf States} && {\bf Unit} \\
\hline
$x_1(k)$ & level tank 1 & m \\
$x_2(k)$ & temperature tank 1 & K \\
$x_3(k)$ & level tank 2 & m \\
$x_4(k)$ & temperature tank 2 & K \\
\hline
{\bf Inputs} && {\bf Unit} \\
\hline
$u_{11}(k)$ & inflow tank 1 & 1 (normalized) \\
$u_{12}(k)$ & cooling tank 1 & 1 (normalized) \\
$u_{21}(k)$ & inflow tank 2 & 1 (normalized) \\
$u_{22}(k)$ & heating tank 2 & 1 (normalized) \\
\hline
\end{tabular}
\end{table}
Similar to the distributed architecture in \cite{SiStGrLu15}, we consider two agents (one for each tank) exchanging data with each other over a network link, see Fig\/.\/~ \ref{fig:EBC_MultiAgent} (with $N=2$) and Table~ \ref{tab:AgentsThermofluid} for inputs/output definitions.
Each agents combines the functions of sensing, estimation, and control. To save computational resources, an agent runs a single estimator and uses it for both event triggering \eqref{eq:eventTrigger_MB_multi} and feedback control \eqref{eq:stateFeedbackDistributed} (see \cite{TrDAn11} for an alternative architecture with two estimators).
\begin{table}[tb]
\caption{Agents in the thermo-fluid example. Agent 1 measures $y_1 = (y_{11}, y_{12})$ (level and temperature) of its tank and is responsible for controlling $u_1 = (u_{11}, u_{12})$ (inflow and cooling); and Agent 2 accordingly.
}
\label{tab:AgentsThermofluid}
\centering
\begin{tabular}{|l|ll|}
\hline
{\bf Agent \#} & 1 & 2 \\ \hline
{\bf Actuator} & $u_1 = (u_{11}, u_{12})$ & $u_2 = (u_{21}, u_{22})$ \\ \hline
{\bf Sensors} & $y_1 = (y_{11}, y_{12})$ & $y_2 = (y_{21}, y_{22})$ \\ \hline
\end{tabular}
\end{table}
\begin{figure}[tb]
\centering
\includegraphics[width=0.55\columnwidth]{figure_EBC_multiAgent}
\caption{Distributed, event-based control architecture in the experiments of Sec\/.\/~ \ref{sec:experiments}. $N$ spatially distributed agents observe and control a dynamic system and exchange data with each other via a common bus. Compared to Fig\/.\/~ \ref{fig:EBSE_MultiAgent}, the agents combine the functions of sensing/triggering, estimation, and additionally feedback control. The State Estimator serves both for making the triggering decision and for feedback control.}
\label{fig:EBC_MultiAgent}
\end{figure}
In order to study the effect of imperfect communication, we simulate random packet drops
such that a transmitted measurement $y_i(k)$ is lost with probability 0.05, independent of previous drops.
Packet drops can be represented by the disturbance $d_i(k)$ in \eqref{eq:EBSE2_multi} as
follows: if $y_\ell(k)$, $\ell \in I(k)$ is a measurement not received at agent $i$, then $d_i(k) = -L_\ell ( y_\ell(k) - C_\ell \hat{x}_i(k|k-1) )$ accounts for the lost packet.
For simplicity, we assume that communicated inputs are never lost.
\subsubsection{Event-based design}
Each agent implements the event triggers \eqref{eq:eventTrigger_MB_multi} and \eqref{eq:eventTriggerCtrl}, the estimator \eqref{eq:EBSE1_multi}, \eqref{eq:EBSE2ideal_multi}, and the distributed control \eqref{eq:stateFeedbackDistributed}. Triggering decisions are made individually for the two sensors of each agent, but jointly for both inputs (cf\/.\/~ Table~ \ref{tab:AgentsThermofluid}).
For the design of the centralized observer \eqref{eq:FCSE1}, \eqref{eq:FCSE2}, we chose $L =$ $\diag(0.1, 0.05, 0.1, 0.05)$ as observer gain, leading to stable $(I-LC)A$.
For this design, the inter-agent error dynamics \eqref{eq:epsij_dyn} are also stable: by direct calculation, one can verify that \eqref{eq:LMI_cond} is satisfied with $P = \diag(500, 1, 500, 1)$ for all subsets $J \subseteq \{1,2,3,4\}$ (cf\/.\/~ supplementary material). Lemma \ref{lem:bounded_eij} thus guarantees that \eqref{eq:epsij_dyn} is stable, and synchronous resetting \eqref{eq:syncAvg} not necessary.
The state-feedback gain $F$ is obtained from an LQR design,
which involves full couplings between all states in contrast to the decentralized design in \cite{SiStGrLu15}.
The triggering thresholds
are set to $\delta^\text{est}_{11} = \delta^\text{est}_{21} = 0.01 \, \text{m}$, $\delta^\text{est}_{12} = \delta^\text{est}_{22} = 0.2 \, \text{K}$, and $\delta^\text{ctrl}_1 = \delta^\text{ctrl}_2 = 0.02$.
\subsubsection{Simulation results}
The state trajectories of a $2000 \, \text{s}$ simulation run under event-based communication are shown in Fig\/.\/~ \ref{fig:exampleSimRum_thermoFluid_x}.
Step-wise disturbances $v$
(gray shaded areas) with comparable magnitudes as in \cite{SiStGrLu15} cause the states to deviate from zero.
Especially at times when disturbances are active, the event-based estimate is slightly inferior to the centralized one, as is expected due to the reduced number of measurements.
\begin{figure}[tbp]
\centering
\includegraphics{figure_exampleSimRum_thermoFluid_x}
\caption{State trajectories for the thermo-fluid simulation example. {\bf Black (dashed):} the actual states $x$; {\bf black (solid):} event-based estimate $\hat{x}_1$ by Agent 1; {\bf gray:} centralized estimate $\hat{x}_\text{c}$. The centralized estimate is shown for comparison and not available on any of the agents. The gray shaded areas indicate periods where step-wise process disturbances are active.}
\label{fig:exampleSimRum_thermoFluid_x}
\end{figure}
The average communication rates for event-based input and sensor transmissions
are given in Fig\/.\/~ \ref{fig:exampleSimRum_thermoFluid_comm}. Clearly, communication rates increase in the periods where the disturbances are active, albeit not the same for all sensors and inputs. At times when there is no disturbance, communication rates are very low.
\begin{figure}[tbp]
\centering
\includegraphics{figure_exampleSimRum_thermoFluid_comm}
\caption{Event-based communication rates for the thermo-fluid simulation example: communication of level measurements $y_{11}$ and $y_{21}$ in {\bf black (dotted)}, for temperature measurements $y_{12}$ and $y_{22}$ in {\bf black (solid)}, and for the inputs $u_1$ and $u_2$ in {\bf gray}. Communication rates are computed as the moving average over 100 steps (0.0 meaning no communication and 1.0 full communication).}
\label{fig:exampleSimRum_thermoFluid_comm}
\end{figure}
Figure \ref{fig:exampleSimRum_thermoFluid_e12} shows the inter-agent error $e_{12}$.
Jumps in the error signals are caused by dropped packets, with decay afterward due to stable dynamics \eqref{eq:epsij_dyn}.
\begin{figure}[tbp]
\centering
\includegraphics{figure_exampleSimRum_thermoFluid_e12}
\caption{Inter-agent error $e_{12}$ for the thermo-fluid example. Jumps in error are caused by packet drops, and the decay afterward is due to stable inter-agent dynamics \eqref{eq:epsij_dyn} as ensured by Lemma~ \ref{lem:bounded_eij}.}
\label{fig:exampleSimRum_thermoFluid_e12}
\end{figure}
\subsection{Experiments on the Balancing Cube}
\label{sec:experimentsBC}
The proposed emulation-based approach to event-based estimation was applied in \cite{Tr12} for stabilizing the Balancing Cube \cite{TrDAn12b} (see Fig\/.\/~ \ref{fig:BC}).
In this section, we summarize the main results from the experimental study reported in \cite{Tr12}. For details, we refer to these citations.
\begin{figure}[tbp]
\centering
\includegraphics[width=9cm]{Cube01_b_lowerRes}
\caption{The Balancing Cube \cite{TrDAn12b} can balance autonomously one any one of its corners or edges. Six rotating arms, which constitute the control agents, collaboratively keep the system in balance. Here, the cube is shown while balancing on an edge, which was the configuration used for the experiments in \cite{Tr12}. (Photo: Carolina Flores, IDSC, ETH Zurich; \copyright 2012 IEEE. Reprinted, with permission, from \cite{TrDAn12b}.)
}
\label{fig:BC}
\end{figure}
\subsubsection{System description}
The cube is stabilized through six rotating arms on its rigid structure (see Fig\/.\/~ \ref{fig:BC}). Each arm constitutes a control agent equipped with sensors (angle encoder and rate gyroscopes), a DC motor, and a computer. The computers are connected over a CAN bus, which supports the exchange of sensor data between all agents (including the worst case of all agents communicating within one sampling time $T_\text{s} = 1/60 \, \text{s}$).
Each agent thus combines the functions sensing, triggering, estimation, and control as in Fig\/.\/~ \ref{fig:EBC_MultiAgent} ($N=6$).
\subsubsection{Event-based design}
A model \eqref{eq:system_x}, \eqref{eq:system_y} representing linearized dynamics about the equilibrium configuration shown in Fig\/.\/~ \ref{fig:BC} is used for designing the centralized observer \eqref{eq:FCSE1}, \eqref{eq:FCSE2} (as a steady-state Kalman filter) and the controller \eqref{eq:stateFeedback} (linear quadratic regulator).
Each agent makes individual triggering decisions for its angle sensor and for its rate gyroscope with thresholds $\delta^\text{ang} = \unit[0.008]{rad}$ and $\delta^\text{gyro} = \unit[0.004]{rad/s}$, respectively.
In the experiments, control inputs $u_i$ were communicated periodically between all agents. Synchronous resetting \eqref{eq:syncAvg} was \emph{not} applied, even though stability of the inter-agent error \eqref{eq:epsij_dyn} cannot be shown using Lemma~ \ref{lem:bounded_eij} because of unstable open-loop dynamics.
Despite the absence of a formal proof, the system was found to be stable in balancing experiments.
\subsubsection{Experimental results}
Figure \ref{fig:BC_commRates}
shows typical communication rates for some sensors during balancing.
The desired behavior of event-based communication is well visible: feedback happens \emph{only when necessary} (e\/.\/g\/.\/~ instability or disturbances). Overall, the network traffic could be reduced by about 78\%
at only a mild decrease in estimation performance.
\begin{figure}[tbp]
\centering
\includegraphics{figure_experimentPushRedComm_rates}
\caption{Experimental communication rates on the Balancing Cube (reproduced from \cite{Tr12}). The communication rates (between 0 and 1) are computed as moving average over the last 100 time steps. The rate gyroscopes generally transmit at higher rates than the angle sensors since they observe the unstable mode of the system. The angle measurements can be predicted well from the process model; thus only little communication is necessary (e\/.\/g\/.\/~ Agent 4 does not transmit over $30 \, \text{s}$). Caused by an external disturbance applied at $10 \, \text{s}$ on Agent 1 (pushing the arm), the communication rate of Agent 1 goes up temporarily.
}
\label{fig:BC_commRates}
\end{figure}
\section{Concluding remarks}
Simplicity of design and implementation are key features of the emulation-based approach to event-based state estimation developed herein.
The approach directly builds on a classic centralized, linear, discrete-time state observer design. Essentially, only the even triggers \eqref{eq:eventTrigger_MB_multi} and \eqref{eq:eventTriggerCtrl},
and (for some problems) synchronous resetting \eqref{eq:syncAvg} must be added.
The estimator structure, as well as the transmitted quantities
remain unchanged, and no redesign of gains is necessary.
The performance of the periodic design can be recovered by choosing small enough triggering thresholds, which simplifies tuning in practice. Thus, implementation of the event-based system requires minimal extra effort,
and virtually no additional design knowledge.
With the proposed event-based method, the average communication load in a networked control system can be significantly reduced, as demonstrated in the simulations and experiment in this article.
\section{Acknowledgment}
This work was supported in part by the Swiss National Science Foundation, the Max Planck Society, and the Max Planck ETH Center for Learning Systems.
\bibliographystyle{iet}
{\small | {'timestamp': '2017-03-27T02:05:46', 'yymm': '1703', 'arxiv_id': '1703.08342', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08342'} | arxiv |
\section{Introduction}
Counting objects in digital images is a process that is time consuming and prone to errors due to fatigue of human annotators. The goal of this research area is to have a system that takes as input an image and returns a count of the objects inside and justification for the prediction in the form of object localization.
The classical approach to counting involves fine-tuning edge detectors to segment objects from the background \cite{Sankur2004} and counting each one. A large challenge here is dealing with overlapping objects which require methods such as the watershed transformation \cite{Beucher1994}. These approaches have many hyperparameters specifically for each task and are complicated to build.
The core of modern approaches was described by Lempitsky and Zisserman in 2010 \cite{Lempitsky2010}. Given labels with point annotations of each object, they construct a density map of the image. Here, each object predicted takes up a density of 1, so a sum of the density map will reveal the total number of objects in the image. This method naturally accounts for overlapping objects We extend this idea and focus on two main areas:
\begin{enumerate}
\item We propose \textit{redundant counting} instead of a density map approach in order to average over errors.
\item We propose a novel construction of networks and training that can apply to counting tasks with very complicated objects.
\end{enumerate}
\begin{figure}
\begin{center}
\includegraphics[width=0.95\columnwidth]{kernel.pdf}
\caption{Comparing how a single row of the count map can be calculated for single cell. Above the line in red are the values that the network is trained to predict when a Gaussian kernel is used. Below in green are the values when the square kernel is used. The square kernel is the same size as the receptive field.}
\label{fig:kernel}
\vspace{-20pt}
\end{center}
\end{figure}
We repose the problem of predicting a density map to instead predict a count map which contains \textit{redundant counts} based on the receptive field of a smaller regression network. The regression network predicts a count of the objects that exist inside this frame as shown in Figure \ref{fig:network1}.
By processing the image in a fully convolutional way \cite{Long2015} each pixel is going to be accounted for some number of times, the number of windows which include it, which is the size of each window, (i.e., $32 \times 32 = 1024$). To recover the true count we can take the average of all these predictions. Figure \ref{fig:kernel} illustrates how this change in kernel makes more sense with respect to the receptive field of the network that must make predictions. Using the Gaussian density map forces the model to predict specific values based on how far the cell is from the center of the receptive field. This is a harder task than just predicting the existence of the cell in the receptive field. A comparison of these two types of count maps is shown in Figure \ref{fig:gausvsq}.
To perform this prediction we focus on a method using deep learning \cite{LeCun2015} and convolutional neural networks \cite{LeCun1998} like Xie \cite{Xie2016} and Arteta \cite{Arteta16} have. They utilized networks similar to FCN-8 \cite{Long2015} which form bottlenecks at the core of the network to capture complex relationships in different parts of the image. Instead, we pad the borders of the input image so that the receptive field of the regression network will redundantly count the correct number of times. This way we do not bottleneck the representation in any way.
\begin{figure}[th]
\begin{center}
\includegraphics[width=0.5\columnwidth]{gaus-kernel.png}%
\includegraphics[width=0.5\columnwidth]{sq-kernel.png}%
\caption{Comparison between annotations using Gaussian and square kernels. }
\label{fig:gausvsq}
\end{center}
\end{figure}
\section{Related Work}
The idea of counting with a density map began with Lempitsky and Zisserman in 2010 \cite{Lempitsky2010} where they used dense SIFT features from the image as input to a linear regression to predict a density map. We predict redundant counts instead of a density map. Although a summation over the output of the model is taken over both causes, our method is explicitly designed to tolerate the errors when predictions are made.
However, the density map of objects does count multiple times indirectly. It needs to properly predict a density map of objects which is generated from a small Gaussian with the mean at the point annotation. The values they need to predict vary as some are at the mean and some are not. It doesn't take into account the receptive field so the objects may be in view and the network has to suppress its prediction.
Many approaches were introduced to predict a better density map. Fiaschi 2012 \cite{Fiaschi2012} used a regression forest instead of a linear model to make the density prediction based on BoW-SIFT features. Arteta 2014 \cite{Arteta2014} proposed an interactive counting algorithm which would extend this algorithm to more dynamically learn to count various concepts in the image. Xie 2016 \cite{Xie2016} introduced deep neural networks to this problem. Their method built a network which would convolve a $100 \times 100$ region to a $100 \times 100$ density map. Once this network was trained it can be run in a fully convolutional way similar to our method. However, these approaches focus on predicting a density map which differentiates them from our work.
Arteta 2016 \cite{Arteta16} discuss new approaches past the density model. Their focus is different than our work. They tackle the problem of incorporating multiple point annotations from noisy crowd sourced data. They also utilize segmentation of the background to filter our erroneous predictions that may happen there.
In Segui \cite{Segui2015} their method takes the entire image as input and output a single count value using fully connected layers to break the spatial relationship. They discover that a network can learn to count and while doing this they learn features for identifying the objects such as MNIST digits. We use this idea in that the regression network is learning to count the $32 \times 32$ frame. But we expect it to produce errors so we perform this task redundantly.
Xie in 2015 \cite{Xie2015} presented an interesting idea similar to the direction we are going in. Their goal is to predict a proximity map which consists of cone shaped distributions over each cell which smooths each cell prediction using surrounding detections. This cone extended only 5 pixels from the point annotation which was the average size of the cell. However, this approach is more in line with a density map than a count map.
\section{Fully Convolutional Redundant Counting}
\begin{table}[]
\begin{center}
\caption{Notation used in this paper.}
\label{tab:notation}
\begin{tabular}{l l}
\toprule
Symbol & Description \\
\midrule
$I$ & input image \\
$T$ & target image, constructed from $L$ \\
$L$ & image of point notations \\
$s$ & stride length \\
$r$ & width / length of receptive field \\
$R(x,y)$ & receptive field associated with $x,y$ \\
$F(I)$ & map of predicted counts for $I$ \\
$N$ & number of training / validation images \\
\bottomrule
\end{tabular}
\end{center}
\end{table}
\subsection{Problem Statement}
We would like to obtain the count of objects in an input image $I$ being given only a few training examples with point annotations of each object. The objects to count are often very small, and the overall image very large. Because counting is labor-intensive, there are often few labeled images in practice.
\begin{figure}
\begin{center}
\includegraphics[width=1.0\columnwidth]{Count-ception-arch.pdf}
\caption{The Count-ception network architecture that is used for the regression network. Each intermediate tensor is labeled (filter size) x \# filters There are two points in the network where the size is reduced. The $3 \times 3$ convolutions are padded so they do not reduce the size. Batch Normalization layers are inserted after each convolution but not pictured here.}
\label{fig:network-arch}
\end{center}
\end{figure}
\subsection{Overview of Technique}
\textbf{Motivation}: We want to merge the idea of networks that count everything in their receptive field by Segui \cite{Segui2015} with the density map of objects by Lempitsky and Zisserman \cite{Lempitsky2010} using fully convolutional processing like Xie \cite{Xie2016} and Arteta \cite{Arteta16}.
\textbf{Technique}: Instead of using a CNN that takes the entire image as input and produces a single prediction for the number of objects we use a smaller network that is run over the image to produce an intermediate count map. This smaller network is trained to count the number of objects in its receptive field. More formally; we process the image $I$ with this network in a fully convolutional way to produce a matrix $F(I)$ that represents the counts of objects for a specific receptive field $r \times r$ of a sub-network that performs the counting. A high-level overview:
\begin{enumerate}
\item Pre-process image by padding
\item Process image in a fully convolutional way
\item Combine all counts together into total count for image
\end{enumerate}
The fully convolutional network processes an image by applying a network with a small receptive field on the entire image. This has two effects which reduce overfitting. First, by being small, the fully convolutional network has much fewer parameters than a network trained on the entire image. Second, by splitting up an image, the fully convolutional network has much more training data to fit parameters on.
The following discussions will consider a receptive field of $32$ for simplicity and in order to have concrete examples. This method can be used with any receptive field size. An overview of the process is shown in Figure \ref{fig:shapes}.
\begin{figure}
\begin{center}
\includegraphics[width=1.0\columnwidth]{shapes2.pdf}%
\caption{Here is the pipeline for $r=32$ given an input image that is $256 \times 256$. The input image is padded and convolved to calculate the prediction count map which should match the target count map. The count map will be non-zero after $r/2$ from the border of the input image. A loss is calculated between the prediction count map and target count map in order to update the weights of the counting network to better match the target count map.}
\label{fig:shapes}
\end{center}
\end{figure}
\subsection{Input}
We want to count target objects in an image $I$. This image has multiple target objects that are labelled with single point labels $L$.
Because the counting network only reduces the dimensions from $(32 \times 32) \rightarrow (1 \times 1)$ the input $I$ must be padded in order to deal with objects that appear on the border. Objects on the border of the image will at most be in the receptive field of a network with only one column or row overlapping the input image. For $r=32$ a pixel in $F(I)$ can only be 15 pixels from the border of $I$.
$F(I)$ is meant to align with the target $T$. It is important that these be aligned such that the receptive field of the network aligns with the proper regression target.
\subsubsection{Constructing the target image $T$}
The target image can be constructed from a point-annotated map $L$, the same size as the input image $I$, where each object is annotated by a single pixel. This is desirable because labeling with dots is much easier than drawing the boundaries for segmentation.
Let $R(x,y)$ be the set of pixel locations in the receptive field corresponding to $T[x,y]$. Then we can construct the target image $T$:
\begin{equation}
T[x,y]=\sum_{(x',y') \in R(x,y)} L[x',y']
\end{equation}
Here $T[x,y]$ is the sum of cells contained in a region the size of the $r \times r$ receptive field. This will become the regression target for the $r \times r$ region of the image.
\subsection{Fully Convolutional Redundant Counting}
We use fully convolutional networks with a receptive field of $32 \times 32$. The output of the fully convolutional network on the entire $320 \times 320$ image is $287 \times 287$ pixels. This yields a fully convolutional network output image larger than the original input. Each pixel in the output will represent the count of targets in that receptive field.
To perform this mapping we propose the Count-ception architecture which is adapted from the Inception family of networks by Szegedy et. al. \cite{Szegedy2015a}. Our proposed model is shown in Figure \ref{fig:network-arch}. At the core of the model Inception units are used to perform 1x1 (pad 0) and 3x3 (pad 1) convolutions at multiple layers without reducing the size of the tensor. After every convolution a Leaky ReLU activation is applied \cite{Maas}. We notice an improvement of the regression predictions with the Leaky ReLU during training because the output can be pushed to zero and then recover to predict the correct count.
Our modifications are in the down sampling layers. We removed the max pooling and stride=2 convolutions. They are replaced by large convolutions. This makes it easier to calculate the receptive field of the network because strides add a modulus to the calculation of the count map size.
We perform this down sampling in two locations using large filters to greatly reduce the size of the tensor. A necessity in allowing the model to train is utilizing Batch Normalization layers \cite{Ioffe2015} after every convolution.
\subsection{Loss Functions and Regularization}
We tried many combinations of loss functions and found $L1$ loss to perform the best.
\begin{equation}
\min||F(I) - T||_1
\end{equation}
Xie found that the $L2$ penalty was too harsh to the network during training. We reached the same conclusion for our configuration and chose an $L1$ loss instead. We also tried to combine this basic pixel-wise loss with a loss based on the overall prediction in the entire image. We found this caused over-fitting and provided no assistance in training. The network would simply learn artifacts in each image in order to correctly predict the overall counts.
\subsection{Combining Sub-Image Counts}
The above loss is a surrogate objective to the real count that we want. We intentionally count each cell multiple times in order to average over possible errors. With a stride of 1, each target is counted once for each pixel in its receptive field. As the stride increases, the number of redundant counts decreases
\begin{equation}
\text{\# redundant counts} = \left(\frac{r}{s}\right)^2
\end{equation}
In order to recover the true count we divide the sum of all pixels by the number of redundant counts.
\begin{equation}
\text{\# true counts} =
\frac{\sum_{x,y} F(I)[x,y]}{
\text{\# redundant counts}}
\end{equation}
There are many benefits to using redundant counts. If the pixel label is not exactly at the center of the cell, or even outside the cell, the network can still learn because on average the cell will appear in the receptive field.
\subsection{Limitations}
With this approach we sacrifice the ability to localize each cell exactly with $x,y$ coordinates. Viewing the predicted count map can localize where the detection came from (shown in Figure \ref{fig:detections}) but not to a specific coordinate. For many applications accurate counting is more important than exact localization. Another issue with this approach is that a correct overall count may not come from correctly identifying cells and could be the network adapting to the average prediction for each regression. One common example is if the training data contains many images without cells the network may predict 0 in order to minimize the loss. A solution similar to Curriculum Learning \cite{Bengio2009} is to first train on a more balanced set of examples and then take well performing networks and train them on more sparse datasets.
\section{Datasets}
\begin{figure}[!ht]
\centering
\begin{subfigure}[b]{0.3\columnwidth}
\includegraphics[width=\columnwidth]{cell1.png}
\caption{VGG Cells}
\end{subfigure}
~
\begin{subfigure}[b]{0.3\columnwidth}
\includegraphics[width=\columnwidth]{cell2.png}
\caption{MBM Cells}
\end{subfigure}
~
\begin{subfigure}[b]{0.3\columnwidth}
\includegraphics[width=\columnwidth]{cell3.png}
\caption{Adipocyte Cells}
\label{fig:adi}
\end{subfigure}
\caption{Examples of cells in each dataset used for evaluation.}
\end{figure}
\textbf{VGG Cells}: To compare with the state of the art we first use the standard benchmark dataset which was introduced by Lempitsky and Zisserman in 2010 \cite{Lempitsky2010}. There are 200 images with a 256x256 resolution that contain simulated bacterial cells from fluorescence-light microscopy created by \cite{Lehmussola2007}. Each image contains 174 $\pm$ 64 cells which overlap and are at various focal distances simulating real life imaging with a microscope.
\textbf{MBM Cells}: We also use a real dataset based on the BM dataset introduced by Kainz et al. in 2015 \cite{Kainz2015} which consists of eleven $1,200 \times 1,200$ resolution images of bone marrow from height healthy individuals. The standard staining procedure used depicts in blue the nuclei of the various cell types present whereas the other cell constituents appear in various shades of pink and red. We modified this dataset in two ways to create the MBM dataset (Modified BM). First the $1,200 \times 1,200$ images were cropped to $600 \times 600$ in order to process the images in memory on the GPU and also to smooth out evaluation errors during training for a better comparison. This yields a total of 44 images containing 126 $\pm$ 33 cells (identified nuclei). In addition, the ground truth annotations were updated after visual inspection to capture a number of unlabeled nuclei with the help of domain experts.
\textbf{Adipocyte Cells}:
Our final dataset is a human subcutaneous adipose tissue dataset obtained from the Genotype Tissue Expression Consortium (GTEx) \cite{lonsdale2013genotype}. 200 Regions Of Interest (ROI) representing adipocyte cells were sampled from high resolution histology slides by using a sliding window of 1700 $\times$ 1700. Images were then down sampled to 150 $\times$ 150, representing a suitable scale in which cells could be counted using a 32 $\times$ 32 receptive field. The average cell count across all images is 165$\pm$44.2. Adipocytes can vary in size dramatically (20-200$\mu$) \cite{mclaughlin2014subcutaneous} and given they are densely packed adjoining cells with few gaps, they represent a difficult test-case for automated cell counting procedures.
\begin{table*}[htbp]
\small
\centering
\caption{Comparison of test set mean absolute error (MAE) of counts per image with prior work. Out of all images in each dataset, $N$ images are randomly selected for the training set, $N$ for the validation set, and a fixed size is used for the testing set. At least 10 runs using different random splits and different network initializations are used to calculate the mean and standard deviation.}
\label{tab:overall}
\textbf{VGG Cells} (200 Images Total)
{%
\begin{tabular}{c c c c c}
\toprule
Method & $N=8$ & $N=16$ & $N=32$ & $N=50$\\
\midrule
Predict Average Count &
$52.5 \pm 2.4 $ &
$52.5 \pm 2.3$ &
$52.2 \pm 2.3$ &
$52.1 \pm 2.4$\\
Cell Profiler &
\multicolumn{4}{c}{$-- 7.9 \pm 0.3 --$} \\
Lempitsky and Zisserman (2010) &
$4.9 \pm 0.7 $ &
$3.8 \pm 0.2$ &
$3.5 \pm 0.2$ &
$N/A$\\
Fiaschi et al. (2012) &
$3.4\pm 0.1$ &
$N/A$ &
$3.2 \pm 0.1$ &
$N/A$\\
Arteta et al. (2014) &
$4.5\pm 0.6$ &
$3.8\pm 0.3$ &
$3.5\pm 0.1$ &
$N/A$\\
FCRN-A, Xie (2016) &
$3.9 \pm 0.5$ &
$3.4 \pm 0.2$ &
$2.9 \pm 0.2$ &
$2.9 \pm 0.2${\color{red}\textsuperscript{*}} \\
Count-ception (Proposed) &
$3.9 \pm 0.4$ &
$2.9 \pm 0.5$ &
$2.4 \pm 0.4$ &
\textbf{$2.3 \pm 0.4$}\\
\bottomrule
\multicolumn{5}{p{10cm}}{
\vspace{-5pt}
{\color{red}\textsuperscript{*}}\footnotesize Reported in their work as $N=64$.}
\end{tabular}
}
\vspace{10pt}
\textbf{MBM Cells} (44 Images Total)
{%
\begin{tabular}{c c c c}
\toprule
Method & $N=5$ & $N=10$ & $N=15$\\
\midrule
Predict Average Count &
$29.4 \pm 2.3$ &
$28.6 \pm 1.6$ &
$28.2 \pm 1.6$\\
Cell Profiler -single & \multicolumn{3}{c}{$ -- 19.8 \pm 4.2 --$} \\
Cell Profiler -multiple{\color{red}\textsuperscript{**}} & \multicolumn{3}{c}{$ -- 12.8 \pm 3.1 --$} \\
FCRN-A, Xie (2016) &
$28.9 \pm 22.6$ &
$22.2 \pm 11.6$ &
$21.3\pm 9.4$ \\
Count-ception (Proposed) &
$12.6 \pm 3.0$ &
$10.7 \pm 2.5$ &
\textbf{$8.8 \pm 2.3$} \\
\bottomrule
\multicolumn{4}{p{10cm}}{
\vspace{-5pt}
{\color{red}\textsuperscript{**}}\footnotesize Cell Profiler results were obtained using a single pipeline (single) and using three different pipelines (multiple) to account for color differences in two of the eleven images.}
\end{tabular}
}
\vspace{10pt}
\textbf{Adipocyte Cells} (200 Images Total)
{%
\begin{tabular}{c c c c}
\toprule
Method & $N=10$ & $N=25$ & $N=50$\\
\midrule
Predict Average Count &
$33.8 \pm 3.1$ &
$33.6 \pm 3.0$ &
$33.5 \pm 2.9$\\
Count-ception (Proposed) &
$25.1 \pm 2.9$ &
$21.9 \pm 2.8$ &
$19.4 \pm 2.2$ \\
\bottomrule
\end{tabular}
}
\end{table*}
\section{Experiments}
First, we compare the overall performance of our proposed model to existing approaches in Table \ref{tab:overall} for each dataset. For each dataset we follow the evaluation protocol used by Lempitsky and Zisserman in 2010 that has been used by all future papers. In this evaluation protocol, training, validation, and testing subsets are used. The held-out testing set size is fixed for all experiments while training and validation sizes ($N$) are varied to simulate lower or higher numbers of labeled examples. The algorithm trains on the training set only while being able to early stop by evaluating its performance on the validation set. The size of the training and validation sets are varied together for simplicity.
The results of the algorithm using at least 10 random splits are computed and we present the mean and standard deviation. The testing set size remains constant in order to provide constant evaluation. If the testing set were chosen to be all remaining examples ($|$Testing$|$ = $|$Total$|-2N$) instead of a fixed size then smaller $N$ values would be less impacted by difficult examples in the test set because examples are not sampled with replacement.
As a practitioner baseline comparison we compare our results to Cell Profiler's \cite{Carpenter2006} which uses segmentation to perform object identification and counting. This is representative of how cells are typically counted in biology laboratories. To do so, we designed two main different pipelines and evaluated the error on 10 splits of 100 randomly chosen images for the synthetic dataset (VGG Cells) and on 10 splits of 10 images for the bone marrow dataset (MBM Cells) to mimic the experimental setup in place since Cell Profiler does not use a training set. For the MBM Cells, we report the performance using the same pipeline (single) for all images and using three slightly modified versions of the pipeline (multiple) where a parameter was adjusted to account for color differences seen in 8 of the 44 images.
Among other methods we compare with Xie's FCRN-A network \cite{Xie2016}. Only Xie's and our method (Count-ception) are neural network based approaches. Our network is sufficiently deeper than the Xie's FCRN-A network and that representational power together with our redundant counting we are able to perform significantly better. We show in \S \ref{sec:redundant} that the performance of our model matches that of Xie's when the redundant counting is disabled by changing the stride to eliminate redundant counting.
\subsection{Training}
In order to train the network we used the Adam optimization technique \cite{Kingma2014a} with a learning rate of 0.005 and a batch size of 4 images. The training runs for 1000 epochs and the best model based on the validation set error is evaluated on the test set. The weights of the network were initialized using the Glorot initialization method \cite{Glorot2010} adjusted for ReLU gain.
\subsection{Redundant Counting}
\label{sec:redundant}
We claim redundant counting is significant to the success of the method. By increasing the stride we can reduce double counting until there is none. We present the reader Table \ref{tab:stride} which indicates that a stride of 1, meaning the maximum amount of redundant counting patch\_size$^2$, is the optimal choice. As we increase the stride to equal the patch size where no redundant counting is occurring the accuracy is reduced.
The power of this algorithm is in the redundant counting. However, increasing the redundant count is complicated. The receptive field could be increased but this will add more parameters which cause the network to overfit the training data. We explored a receptive field of 64x64 and found that it did not perform better. Another approach could be to use dilated convolutions \cite{Yu2016} which would be equivalent to scaling up the input image resolution.
\begin{table}[]
\begin{center}
\caption{Comparison of different strides ($s$) in order to reduce the redundant counting. Results are compared using the mean absolute error of the output predictions. For these experiments we use $N=32$ examples. Here Train \& Test means the stride was set at that value for training and testing. Having a larger stride during training means seeing less data. A network trained with $s=32$ has seen 32 times less data that with $s=1$. In the Test Only case the network was trained with $s=1$ and then evaluation on the test set was limited to different strides so less redundant predictions are made.}
\begin{tabular}{c c c c c}
\toprule
Stride & $s=1$ & $s=8$ & $s=16$ & $s=32$ \\
\midrule
\hspace{-5pt}Train \& Test &
2.4$\pm$0.4 &
3.5$\pm$0.1 &
4.0$\pm$0.2 &
5.2$\pm$0.4 \\
Test Only &
2.4$\pm$0.4 &
2.5$\pm$0.4 &
2.7$\pm$0.3 &
3.0$\pm$0.3 \\
\bottomrule
\end{tabular}
\label{tab:stride}
\end{center}
\end{table}
\subsection{Runtime and Implementation}
The run-time of this algorithm is not trivial. We explored models with less parameters and found they could not achieve the same performance. Shorter models (fewer layers) or narrower models (less filters per layer) tended to not have enough representational power to count correctly. Making the network wider would cause the model to overfit. The complexity of the Inception modules were significant to the performance of the model.
The network was implemented in lasagne (version 0.2.dev1) \cite{lasagne} and Theano (version 0.9.0rc2.dev) \cite{theano} using the libgpuarray backend. The source code and data will be made available online\footnote{\url{https://github.com/ieee8023/countception}}.
\begin{figure*}
\centering
\begin{subfigure}[b]{1.0\textwidth}
\includegraphics[width=\columnwidth]{detection1.png}
\vspace{-15pt}
\caption{VGG Cell detection}
\end{subfigure}
\vspace{12pt}
\begin{subfigure}[b]{1.0\textwidth}
\includegraphics[width=\columnwidth]{detection.png}
\vspace{-15pt}
\caption{MBM Cell detection}
\end{subfigure}
\vspace{12pt}
\begin{subfigure}[b]{1.0\textwidth}
\includegraphics[width=\columnwidth]{detection3.png}
\vspace{-15pt}
\caption{Adipocyte Cell detection}
\end{subfigure}
\caption{Example predicted count maps of images held out of training for each dataset. On the left is the image. In the center is the correct output which would result in the correct count of cells. On the right is the predicted count map.}
\label{fig:detections}
\end{figure*}
\section{Conclusion}
In this work we rethink the density map method by Lempitsky and Zisserman \cite{Lempitsky2010} and instead predict counts in a redundant fashion in order to average over errors and reduce overfitting. This \textit{redundant counting} approach merges ideas by Segui \cite{Segui2015} of networks that count everything in their receptive field with ideas by Lempitsky and Zisserman of using the density map of objects together with ideas by Xie \cite{Xie2016} and Arteta \cite{Arteta16} of using fully convolutional processing.
We call our new approach Count-ception because our approach utilizes a counting network internally to perform the \textit{redundant counting}. We demonstrate that this approach outperforms existing approaches and can also perform well with very complicated cell structure even where the cell walls adjoin other cells. This approach is promising for tasks with different sizes of objects which have complicated structure. However, the method has some limitations. Although the count map can be used for localization it cannot easily provide $x,y$ locations of objects.
\section{Acknowledgments}
This work is partially funded by a grant from the U.S. National Science Foundation Graduate Research Fellowship Program (grant number: DGE-1356104) and the Institut de valorisation des donn\'{e}es (IVADO). This work utilized the supercomputing facilities managed by the Montreal Institute for Learning Algorithms, NSERC, Compute Canada, and Calcul Queb\'{e}c. We also thank NVIDIA for donating a DGX-1 computer used in this work.
{\small
\bibliographystyle{ieee}
| {'timestamp': '2017-07-25T02:08:42', 'yymm': '1703', 'arxiv_id': '1703.08710', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08710'} | arxiv |
\section{Introduction}
HTKS \cite{mcclelland2012self,mcclelland2014predictors} is a game-like cognitive assessment method, designed for children between four and eight years of age. During the HTKS assessment, a child responds to a sequence of requests, such as ``touch your head'' or ``touch your toes''. The cognitive challenge stems from the fact that the children are instructed to interpret these requests not literally, but by touching a different body part than the one stated. For example, a child may be instructed to touch her toes in response to the request ``touch your head''. HTKS has been shown to be related to measures of cognitive flexibility, working memory, and inhibitory control. At the same time, HTKS has also been shown to be useful in predicting academic achievement growth for prekindergarten and kindergarten children.
In our prior work, we have developed the CogniLearn system \cite{cognilearn}, that can be used to record the motion of human subjects as they play the HTKS game, and that also analyzes that motion so as to assess how accurately the subjects executed the requested tasks. In CogniLearn, a \textit{Microsoft Kinect V2} camera is used for recording human motion. Then, we use the DeeperCut method \cite{insafutdinov2016deepercut} to perform body pose estimation in each frame. Finally, using the body pose estimates from DeeperCut we use a classification module that determines whether the subject touched his or her head, shoulders, knees, or toes. The CogniLearn system compares the part that was touched with the part that should have been touched based on the rules of the game, and assesses the overall accuracy score of the person playing the game.
The rest of the paper is organized as follows: In Section \ref{section_related} we discuss related work in this area. In Section \ref{section_method} we describe the proposed improvements to the prior version of the CogniLearn system. A quantitative evaluation of these improvements is offered in the experiments (Section \ref{section_experiments}).
\section{Related Work}
\label{section_related}
Several deep-learning methods have been proposed in recent years for video analysis and activity recognition \cite{donahue2015long,gattupalli2016evaluation,scalable}, offering significantly improved accuracy compared to previous approaches\cite{leightley2013human,xia2013spatio}. Deep learning methods have also been used in supervised or unsupervised manner in different tasks in computer vision \cite{insafutdinov2016deepercut, ghaderi2016selective}, oftentimes producing state-of-the-art results.
In \cite{cognilearn} we have introduced the CogniLearn system, which is used for automated video capture and performance assessment during the HTKS assessment. CogniLearn is designed to provide meaningful data and measures that can benefit therapists and cognitive experts. More specifically, the motion analysis and evaluation module provides systematic feedback regarding the performance of the HTKS tasks to the human experts. In this paper, we build upon the CogniLearn system, and we suggest some specific improvements in the motion analysis module, that lead to higher recognition accuracy.
\\
\begin{figure}
\centering
\includegraphics[height=2in, width=2in]{imgs/frame1.png}
\caption{A sample human body pose estimation on a frame using DeeperCut \cite{insafutdinov2016deepercut}.}
\label{fig:humanBodyEstimatedFrame}
\end{figure}
\section{Our Method}
\label{section_method}
We use DeeperCut \cite{insafutdinov2016deepercut} to estimate the location of human body parts in each color frame of the video. Figure \ref{fig:humanBodyEstimatedFrame} shows a video frame where we have superimposed the body part locations estimated by DeeperCut. Each color frame of a test video sequence is provided as input to the DeeperCut method. The output of the algorithm is the image location of 12 body parts: head, shoulder(right and left), elbow(right and left), wrist(right and left), hip, knee(right and left), ankle(right and left).
After we obtain the body part locations from DeeperCut, we perform an additional step, in order to estimate whether the human, at that frame, is touching his or her head, shoulders, knees, or toes. As a first step, we define a distance $D$ between hands and head, hands and shoulder, hands and knees, and hands and ankles. Using $\|\cdot\|$ to denote Euclidean norms, this distance is defined as follows:
\begin{equation}
D(\mathrm{head})= \frac{\|\mathrm{lh} - \mathrm{head}\| + \|\mathrm{rh} - \mathrm{head}\|}{2}
\end{equation}
\begin{equation}
D(\mathrm{shoulders})= \frac{\|\mathrm{lh} - \mathrm{ls}\| + \|\mathrm{rh} - \mathrm{rs}\|}{2}
\end{equation}
\begin{equation}
D(\mathrm{knees})= \frac{\|\mathrm{lh} - \mathrm{lk}\| + \|\mathrm{rh} - \mathrm{rk}\|}{2}
\end{equation}
\begin{equation}
D(\mathrm{ankles})= \frac{\|\mathrm{lh} - \mathrm{la}\| + \|\mathrm{rh} - \mathrm{ra}\|}{2}
\end{equation}
In the above definitions, $\mathrm{head}$ stands for the $(x,y)$ pixel location of the center of the head in the color frame, as estimated by DeeperCut. Similarly, $\mathrm{lh}$ and $\mathrm{rh}$ stand for the locations the left and right hand, $\mathrm{ls}$ and $\mathrm{rs}$ stand for the locations of the left and right shoulder, $\mathrm{lk}$ and $\mathrm{rk}$ stand for the locations of the left and right knee, and $\mathrm{la}$ and $\mathrm{ra}$ stand for the locations of the left and right ankle.For example, $\|\mathrm{lh} - \mathrm{head}\|$ denotes the Euclidean distance between the left hand and the center of the head.
Based on these $D$ values, one approach for estimating the body part that is being touched is to simply select the body part for which the $D$ score is the smallest. This was the approach used in \cite{cognilearn}. However, when the person touches the toes or knees, this approach does not work well. When a person bends down to touch the knees or toes with the hands, the head inevitably also gets near to the knees or toes. In that case, two issues may arise. The first one is that the accuracy of the body joint estimator is decreased. The second issue is that the detected location for the head is near the detected locations for the knees or toes. As a result, for example, when the hands are touching the toes, it frequently happens that the distance of hands to the head is estimated to be smaller than distance of the hands to the toes. These two issues can lead to inaccuracies. As we see in Table \ref{tab:oldRes}, in the original CogniLearn results of \cite{cognilearn}, 9.33\% of toe frames are classified as head frames, and 14.00\% of toe frames are classified as knee frames.
In this paper, we propose two heuristic rules to improve the classification accuracy of toe frames: \\
\textbf{Rule 1}: If the distance between the head and the hip is less than a predefined threshold, we can immediately conclude that the hands are touching the toes. \\
\textbf{Rule 2}: Sometimes, when the hands are touching the head, the distance between the hands and the head is estimated to be longer than the distance between the hand and the shoulders. To address this issue, we add a constant bias value to the distance between hands and shoulders, before comparing it with the distance between the hands and the head.
\\
In the experiments, we demonstrate that these two rules significantly improve the classification accuracy on toe and head frames, while only minimally affecting the classification accuracy on frames where the hands touch the shoulders or knees.
\section{Experiments}
\label{section_experiments}
For our experiments, we use the same dataset that was used in the original CogniLearn paper \cite{cognilearn}. The dataset includes color videos from 15 participants, whose ages are between 18 and 30 years (while the HTKS assessment has been designed for children between the ages of 4 and 8, at this time we still do not have recorded data available from children of that age). In total, the dataset contains over 60,000 video frames. Figure \ref{fig:example} shows examples of test frames correctly recognized by our algorithm. The green letter in top left of the images shows the classification output of our system (``T'' stands for ``toes'', ``K'' stands for ``knees'').
\begin{figure}[t]
\centering
\subfigure[ ]
\includegraphics[width=0.16\textwidth]{samples/genral1.png}
}
\quad
\subfigure[ ]
\includegraphics[width=.16\textwidth]{samples/genral2.png}
}
\caption{Results using the full method described in this paper, i.e., when both Rule 1 and Rule 2 are used. On the left, we see a frame where the hands touch the toes. On the right, we see a frame where the hands touch the knees. The green letter on the top left of each frame is the classification output of the system, where ``T'' stands for ``toes'', ``K'' stands for ``knees''.}
\label{fig:example}
\end{figure}
Our method is applied on each color frame separately.
The goal of our method is to classify each frame into one of four classes, corresponding respectively to whether the human is touching his or her head, shoulders, knees, or toes. Ground truth information is provided for 4,443 video frames, and we use those frames as our test set. The ground truth specifies, for each frame, which of the four classes belongs to. Accuracy is simply measured as the percentage of test frames for which the output of our system matched the ground truth.
We should emphasize that the results that we present are user-independent. None of the 15 subjects appearing in the test set is used to train any part of our models. The only module that uses training is DeeperCut, and we use the pretrained model that has been made available by the authors of \cite{insafutdinov2016deepercut}.
\subsection{Results}
Table \ref{tab:oldRes} shows the confusion matrix reported in the original CogniLearn paper \cite{cognilearn}. As we can see in that table, shoulder and knee frames are recognized at rather high accuracies of 99.63\% and 98.17\% respectively. However, head and toes frames are recognized with lower accuracies, 94.47\% and 76.46\% respectively. This paper was primarily motivated by the need to improve the accuracy for those two cases.
\begin{table}[!th]
\caption{Confusion matrix reported by \cite{cognilearn}. Rows correspond to ground truth labels, and columns correspond to classification outputs.}
\label{tab:oldRes}
\centering
\begin{tabular}{|c|c|c|c|c|c|c|}
\cline{3-6}
\multicolumn{2}{c|}{} & \multicolumn{4}{c|}{Recognized} & \multicolumn{1}{|c}{} \\
\cline{3-7}
\multicolumn{2}{c|}{} & Head & Shoulder & Knee & Toe & \footnotesize{Sum} \\ \hline
\multirow{4}{*}{\begin{turn}{-90} Real \end{turn}} & Head & \textbf{94.47} &5.53 & 0.00& 0.00 & \small{100}\\ \cline{2-7} & Shoulder & 0.12& \textbf{99.63} &0.25& 0.00 & \small{100} \\ \cline{2-7}
& Knee & 0.00 & 0.54 & \textbf{98.17} & 1.29 & \small{100} \\ \cline{2-7}
& Toe & 9.33 & 0.21 & 14.00 & \textbf{76.46} & \small{100} \\ \cline{2-7}
\hline
\end{tabular}
\end{table}
In Table \ref{table:ruleOneTwoRes} we report the results from the method proposed in this paper (i.e, when we apply both Rule 1 and Rule 2 from Section \ref{section_method}. As we can see, the accuracy for all four categories is more than 94.7\%. The accuracy for head frames is marginally improved compared to \cite{cognilearn}. The accuracy for shoulder and knee frames is slightly worse compared to \cite{cognilearn}. At the same time, the accuracy for toe frames is now 97.19\%, significantly higher than the accuracy of 76.46\% reported in \cite{cognilearn}.
\begin{table}[!t]
\caption{Confusion matrix obtained using the full method described in this paper, i.e., when both Rule 1 and Rule 2 are added to the method of \cite{cognilearn}. Rows correspond to ground truth labels, and columns correspond to classification outputs.}
\label{table:ruleOneTwoRes}
\centering
\begin{tabular}{|c|c|c|c|c|c|c|}
\cline{3-6}
\multicolumn{2}{c|}{} & \multicolumn{4}{c|}{Recognized} & \multicolumn{1}{|c}{} \\
\cline{3-7}
\multicolumn{2}{c|}{} & Head & Shoulder & Knee & Toe & \footnotesize{Sum} \\ \hline
\multirow{4}{*}{\begin{turn}{-90} Real \end{turn}} & Head & \textbf{94.78} & 3.39 & 0.26& 1.57 & \small{100}\\ \cline{2-7} & Shoulder & 0.50& \textbf{99.25} &0.12& 0.12 & \small{100} \\ \cline{2-7}
& Knee & 0.00 & 0.60 & \textbf{97.22} & 2.18 & \small{100} \\ \cline{2-7}
& Toe & 0.76 & 0.00 & 2.05 & \textbf{97.19} & \small{100} \\ \cline{2-7}
\hline
\end{tabular}
\end{table}
Finally, in Table \ref{tab:ruleOneRes} we show results using a partial implementation of our method, applying only Rule 1, and not Rule 2. We note that the overall accuracy is mostly similar to what we get when we combine Rules 1 and 2. Overall, Rule 1 is by far the biggest contributor to the improvements we obtain over the original results of \cite{cognilearn}. At the same time, the accuracy for head frames improves from 93.21\% to 94.78\% when we use Rules 1 and 2, compared to using only Rule 1. Rule 2 was explicitly designed to reduce the percentage of head frames that were classified as shoulder frames. Indeed, using Rule 2 (together with Rule 1) reduces that percentage from 4.96\% (obtained using only Rule 1) to 3.39\%.
\begin{table}[!t]
\caption{Confusion matrix obtained by adding Rule 1 to the method of \cite{cognilearn}. Rows correspond to ground truth labels, and columns correspond to classification outputs.}
\label{tab:ruleOneRes}
\centering
\begin{tabular}{|c|c|c|c|c|c|c|}
\cline{3-6}
\multicolumn{2}{c|}{} & \multicolumn{4}{c|}{Recognized} & \multicolumn{1}{|c}{} \\
\cline{3-7}
\multicolumn{2}{c|}{} & Head & Shoulder & Knee & Toe & \footnotesize{Sum} \\ \hline
\multirow{4}{*}{\begin{turn}{-90} Real \end{turn}} & Head & \textbf{93.21} & 4.96 & 0.26 & 1.57 & \small{100}\\ \cline{2-7} & Shoulder & 0.37& \textbf{99.39} &0.12& 0.12 & \small{100} \\ \cline{2-7}
& Knee & 0.00 & 0.60 & \textbf{97.22} & 2.18 & \small{100} \\ \cline{2-7}
& Toe & 0.76 & 0.00 & 2.05 & \textbf{97.19} & \small{100} \\ \cline{2-7}
\hline
\end{tabular}
\end{table}
Table \ref{tab:overall} shows the overall classification accuracy. In that table, the overall accuracy is defined as the average of the accuracies over the four different classes. The overall accuracy improves from the 92.18\% rate of \cite{cognilearn} to 96.75\% when we add Rule 1, and to 97.11\% when we also add Rule 2.
\begin{table}[ht!]
\caption{Comparisons in accuracy between the original results of \cite{cognilearn}, the results obtained by adding Rule 1 to the method of \cite{cognilearn}, and the results obtained by adding both Rule 1 and Rule 2 to the method of \cite{cognilearn} }
\begin{tabular}{| c | c | c | c | c |c |}
\hline
& \textbf{Overall} & \textbf{H} & \textbf{S} & \textbf{K} & \textbf{T} \\
\hline \hline
Original\cite{cognilearn} & 92.18 & 94.47 & \textbf{99.63} & \textbf{98.17}&76.46 \\
\hline
Rule 1 & 96.75 & 93.21 & 99.39 & 97.22 & 97.19 \\
\hline
Rules 1,2 combined & \textbf{97.11} & \textbf{94.78} & 99.25 & 97.22 & \textbf{97.19} \\
\hline
\end{tabular}
\label{tab:overall}
\end{table}
Figure \ref{samples} shows some sample test frames. More specifically, from each of the four classes we show an example that was classified correctly, and an example that was classified incorrectly. We note that separating the head from the shoulder class can be quite challenging at times, because the distribution of hand positions does not vary much between the two classes. Separating knees and toes can also be difficult, because in frames belonging to both classes the knees are typically occluded, and there is significant overlap between the arms and the legs. This leads to errors in the estimated positions of the hands and the knees.
\begin{figure}[ht]
\centering
\subfigure[ ]
\includegraphics[width=0.16\textwidth]{samples/Hok.png}
}
\quad
\subfigure[ ]
\includegraphics[width=.16\textwidth]{samples/Hnok.png}
}
\subfigure[]
\includegraphics[width=0.16\textwidth]{samples/Sok.png}
}
\quad
\subfigure[]
\includegraphics[width=.16\textwidth]{samples/Snok.png}
}
\subfigure[]
\includegraphics[width=0.16\textwidth]{samples/Kok.png}
}
\quad
\subfigure[]
\includegraphics[width=.16\textwidth]{samples/Knok.png}
}
\subfigure[]
\includegraphics[width=0.16\textwidth]{samples/Tok.png}
}
\quad
\subfigure[]
\includegraphics[width=.16\textwidth]{samples/Tnok.png}
}
\caption{Example test frames, with the classification output superimposed. The classification output is correct for the examples on the left column, and incorrect for the examples on the right column. The ground truth is: ``head'' for row 1, ``shoulders'' for row 2, ``knees'' for row 3, ``toes'' for row 4.}
\label{samples}
\end{figure}
\section{Conclusions and Future Work}
We have propose a method for improving the accuracy of the original CogniLearn\cite{cognilearn} system in recognizing, for each video frame, whether the human is touching the head, shoulders, knees, or toes in that frame. The experiments have shown that our improvements lead to significantly better accuracy, especially for frames where the human touches the toes. In those cases, the accuracy increased from the 76.46\% rate in \cite{cognilearn} to 97.19\%.
Our project of automatically capturing and analyzing performance in the HTKS test is still in its initial stages. A high priority for us is to obtain data from children between the ages of 4 and 8, as that is the target age group for the HTKS test. Also, we plan to explore using the depth modality of the Kinect camera in addition to the color modality that we have used in \cite{cognilearn} and in this paper. Finally, we should note that the HTKS assessment includes a ``self-correction'' category, in which the subject has started doing an incorrect motion and then self-corrected \cite{mcclelland2014predictors}. In the near future we plan to work on developing methods for identifying such self-correction cases, so that our assessment fully matches the formal HTKS description.
\section*{Acknowledgments}
This work was partially supported by National Science Foundation grants IIS-1055062, CNS-1338118, CNS-1405985, and IIS-1565328. Any opinions, findings, and conclusions or recommendations expressed in this publication are those of the authors, and do not necessarily reflect the views of the National Science Foundation.
\bibliographystyle{abbrv}
| {'timestamp': '2017-03-28T02:04:14', 'yymm': '1703', 'arxiv_id': '1703.08697', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08697'} | arxiv |
\section{Introduction}
\label{sec:intro}
In several network scenarios optimization problems arise in which an aggregate cost
function, sum of local cost functions, needs to be minimized in a distributed
way.
A typical approach in distributed optimization is to develop
algorithms in which the processors in the network reach consensus on a minimizer
of the problem.
However, when the dimension of the decision variable depends on the number of
agents in the network the consensus approach gives rise to algorithms which
scale badly with the network size.
Enforcing consensus on the entire vector of decision variables is not necessary
in many important applications, since the nodes are interested in computing only
part of the decision vector, namely only some local variables of interest.
In this paper we consider a partitioned problem set-up in which the aggregate
function is the sum of local functions, each one depending only on a portion of
the decision vector.
For this set-up our goal is to design a distributed algorithm in which the nodes
compute only a local portion of interest of the entire solution vector, so that
the whole minimizer can be obtained by stacking together the local portions.
This partitioned set-up has been introduced in~\cite{erseghe2012distributed}
where a distributed ADMM-based algorithm is proposed.
In~\cite{carli2013distributed} some concrete motivating scenarios are
described for the same set-up and a dual decomposition algorithm is proposed. In
both the above references the algorithms are designed for a synchronous network
with a fixed communication graph.
In~\cite{necoara2016parallel}, an analogous problem formulation is considered
within a parallel context. The authors propose a coordinate
descent method and derive its convergence rate.
In \cite{todescato2015robust} the authors propose a distributed algorithm for a
partitioned quadratic program under lossy communication.
A distributed ADMM-based algorithm with applications in MPC is proposed
in~\cite{mota2015distributed} to deal with an unconstrained optimization problem
with local domains which is related to the set-up in this paper.
Usually, distributed approaches need a common clock (e.g., because a diminishing
(time-varying) step-size is used).
We want to avoid this limitation designing an asynchronous, event-triggered
protocol based on local and independent timers, \cite{notarnicola2015randomized}.
A Newton-Raphson consensus strategy is proposed in~\cite{zanella2012asynchronous}
to solve unconstrained, convex optimization problems under asynchronous,
symmetric gossip communications.
In~\cite{dimarogonas2012distributed} a self-triggered communication protocol is
considered. Based on an error condition a distributed, continuous-time algorithm
is developed.
In~\cite{wei20131} an asynchronous ADMM-based distributed method is proposed for a
separable, constrained optimization problem with a convergence rate $O(1/t)$.
A distributed, asynchronous algorithm for constrained optimization based
on random projections is proposed in~\cite{lee2013asynchronous}.
The asynchronous, distributed algorithm we design in this paper is based on a
(randomized) coordinate descent method.
In~\cite{nesterov2012efficiency} the coordinate method for huge scale optimization
has been introduced.
This powerful approach has been extended to deal with (convex) composite
objective functions and parallel scenarios,
see~\cite{richtarik2012parallel,richtarik2014iteration,necoara2016parallel}.
In~\cite{necoara2013random} a coordinate approach to solve linearly constrained
problems has been proposed.
Using a coordinate ADMM-based approach, in~\cite{bianchi2014stochastic}
a distributed, asynchronous algorithm is developed.
Regarding non-convex optimization problems, in~\cite{patrascu2015efficient}, the
authors extend the coordinate approach to large-scale non-convex optimization
proving the rate of convergence of their algorithms.
A parallel algorithm based on local strongly convex approximations is exploited
in~\cite{facchinei2015parallel} to cope with non-convex optimization problems.
The latter approach has been extended to a distributed context in~\cite{dilorenzo2016next}.
In~\cite{binetti2014distributed}, the authors proposed an auction-based
distributed algorithm for non-convex optimization.
As main paper contribution we propose an asynchronous, distributed algorithm to
solve partitioned, big-data non-convex optimization problems. The proposed
primal algorithm is based on local updates involving the minimization of a
strongly convex, quadratic approximation of the objective function. Each node
constructs this approximation by exchanging information only with neighboring
nodes. The updates at each node are regulated by a local timer that triggers
independently from the ones of the other nodes.
We prove the convergence in probability of the distributed algorithm by showing
that it is equivalent to a generalized coordinate descent method for the
minimization of non-convex composite functions.
The generalized coordinate descent algorithm extends the one proposed
in~\cite{patrascu2015efficient} and thus represents a side interesting result.
The paper is organized as follows. In Section~\ref{sec:setup} we present the
problem set-up. In Section~\ref{sec:algorithm} we propose our algorithm and
prove its convergence in Section~\ref{sec:analysis}. Finally, in
Section~\ref{sec:simulations} we show some
simulations.
\paragraph*{Notation}
Consider a vector $x\in{\mathbb{R}}^n$ partitioned in $N$ block-components as follows
\begin{align}
x= [ x_1^\top, \ldots, x_N^\top ]^\top,
\label{eq:x_partitions}
\end{align}
where, for all $i\in \until{N}$, we have $x_i\in {\mathbb{R}}^{n_i}$ and
$\sum_{i=1}^N n_i=n$.
Moreover, consider a block decomposition of the $N\times N$ identity
matrix $I=[U_1, \ldots, U_N]$, where for all $i\in\until{N}$ each
$U_i\in{\mathbb{R}}^{n\times n_i}$. Then we can write $x_i = U_i^\top x$
and $x = \sum_{i=1}^N U_ix_i$.
For a function $\map{\varphi}{{\mathbb{R}}^n}{{\mathbb{R}}}$, we denote $\nabla_{x_i}
\varphi(\bar{x}) = U_i^\top \nabla \varphi(\bar{x})$ the ``partial'' gradient of
$\varphi$ with respect to $x_i\in{\mathbb{R}}^{n_i}$.
\section{Optimization problem set-up}
\label{sec:setup}
We consider a network of $N$ nodes which can interact according to a
fixed, undirected communication graph $\mathcal{G} = (\until{N}, \mathcal{E}} \newcommand{\FF}{\mathcal{F})$,
where
$\mathcal{E}} \newcommand{\FF}{\mathcal{F}\subseteq \until{N} \times \until{N}$ is the set of edges. That is, the edge
$(i,j)$ models the fact that node $i$ and $j$ can exchange information. We
denote by $\mathcal{N}_i$ the set of \emph{neighbors} of node $i$ in the fixed graph
$\mathcal{G}$, i.e., $\mathcal{N}_i := \left\{j \in \until{N} \mid (i,j) \in \mathcal{E}} \newcommand{\FF}{\mathcal{F} \right\}$,
and by $|\mathcal{N}_i|$ its cardinality. Here we assume that the graph contains also
self-edges, so that $\mathcal{N}_i$ contains also $i$.
We want to stress that the fixed graph only models, for each node, the set of
possible neighbors the node can communicate with. On top of this graph, we will
consider an asynchronous communication protocol described later.
We start by a common set-up in distributed optimization, i.e., the minimization
of a separable cost function composed by two contributions, i.e.,
$\min_{x\in{\mathbb{R}}^n} \: \: \sum_{i=1}^N f_i(x) + g_i(x)$,
where $f_i : {\mathbb{R}}^n \to {\mathbb{R}}$ and $g_i : {\mathbb{R}}^n \to {\mathbb{R}} \cup\{+\infty\}$,
with $N,n \in\natural$. Usually this composite structure of the objective
functions, is used to split the effective cost into a smooth part (modeling some
local objective) and a (possibly) non-smooth one being a regularization term or
a constraint.\footnote{A constraint
$x\in \ensuremath{\operatorname{\cap}}_{i\in\until{N}} X_i\subset{\mathbb{R}}^n$ is modeled by setting
$g_i(x) = I_{X_i}(x)$, with $I_{X_i}(x)=0$ $\forall x\in X_i$ and
$I_{X_i}(x)=+\infty$ otherwise.}
In this paper we consider problems in which the composite function
has
a \emph{partitioned structure}, that we next describe. Let the decision
variable $x\in{\mathbb{R}}^n$ be partitioned as stated in~\eqref{eq:x_partitions}, then
the sub-vector $x_i\in {\mathbb{R}}^{n_i}$ with $n_i \ll n$, represents the relevant
information at node $i$.
Each local objective $f_i$ has a sparsity consistent with the interaction graph,
namely, for $i\in \until{N}$, the function $f_i$ depends only on the component
of node $i$ and of its neighbors. To highlight this property we let
$f_i:{\mathbb{R}}^{\sum_{j \in \mathcal{N}_i} n_j} \rightarrow {\mathbb{R}}$ and
write $f_i ( x_{\mathcal{N}_i} )$. Also, each function $g_i$ depends only on the
component $x_i$, i.e., $g_i:{\mathbb{R}}^{n_i} \rightarrow {\mathbb{R}} \cup \{+\infty\}$.
In light of the described structure, the problem we aim at solving in a
distributed way can be written as
\begin{align}
\min_{x \in {\mathbb{R}}^n} \: &\: \sum_{i=1}^N f_i (x_{\mathcal{N}_i} ) + g_i(x_i),
\label{eq:partitioned_problem}
\end{align}
where node $i$ knows only the functions $f_i$ and $g_i$. We call this problem
\emph{partitioned} (due to the structure of the functions $f_i$ and $g_i$) and
\emph{big-data} (since the dimension of the decision variable depends on the
number of nodes).
Note that, in this partitioned scenario, network structure and objective function
are inherently related. That is, nodes that share a variable are neighbors in
the communication graph.
As pointed out in the introduction this set-up appears in
several interesting applications~\cite{carli2013distributed}.
In the following assumptions we state the main properties of problem
\eqref{eq:partitioned_problem}.
\begin{assumption}
For all $i\in\until{N}$, $f_i$
is a smooth function of $x_{\mathcal{N}_i}$. In particular,
$f_i$ has block-coordinate Lipschitz continuous gradient, i.e.,
for all $j\in \mathcal{N}_{i}$ there exists constants $L_{ij} > 0$ such that
for all $x_{\mathcal{N}_i} \in {\mathbb{R}}^{\sum_{\ell \in \mathcal{N}_i } n_\ell}$
and $s_j \in {\mathbb{R}}^{n_j}$ it holds
\begin{align*}
\| \nabla_{x_j} f_i(x_{\mathcal{N}_i}+U_{ij} s_j) - \nabla_{x_j} f_i(x_{\mathcal{N}_i}) \| \le L_{ij} \| s_j\|.
\end{align*}%
where $U_{ij}$ is a suitable matrix such that $U_{ij} s_j$ is a vector in
${\mathbb{R}}^{\sum_{\ell \in \mathcal{N}_{i}} n_\ell }$ with $j$-th block-component
equal to $s_j$ and all the other ones equal to zero.
\oprocend
\label{ass:Lipschitz_f_i}
\end{assumption}
In light of Assumption~\ref{ass:Lipschitz_f_i}, it is easy to show
that the following lemma holds.
\begin{lemma}
Let Assumption~\ref{ass:Lipschitz_f_i} hold, then the aggregate function
$f(x) := \sum_{i=1}^N f_i ( x_{\mathcal{N}_i} )$ has block-coordinate Lipschitz
continuous gradient. In particular, for all $i\in\until{N}$, the partial
gradient $\nabla_{x_i} f$ has Lipschitz constant given by
$L_i := \sum_{j\in \mathcal{N}_{i} } L_{ij}$.
%
\end{lemma}
\begin{proof}
The proof follows straight by simply writing the norm of the aggregate cost
$f$ and then bounding each term of its gradient by using its block Lipschitz
constant.
\end{proof}
\begin{remark}
Note that one can assume directly that $\nabla_{x_i} f$ is Lipschitz
continuous, but while the condition we impose can be checked in a distributed
way, the weaker one needs a global knowledge of the cost $f$.\oprocend
\end{remark}
\begin{assumption}
For all $i\in\until{N}$, the function $g_i$
is a proper, closed, proper, convex
function.
\oprocend
\label{ass:convex_g_i}
\end{assumption}
We stress that we have not assumed any convexity condition on $f_i$, thus
optimization problem~\eqref{eq:partitioned_problem} is non-convex in general.
Finally, we state the following assumption which
is quite standard for non-convex scenarios.
\begin{assumption}
The cost $V(x):=\sum_{i=1}^N f_i (x_{\mathcal{N}_i} ) + g_i(x_i)$
of problem~\eqref{eq:partitioned_problem} is a coercive function.
\oprocend
\label{ass:coercive}
\end{assumption}
Assumption~\ref{ass:coercive} guarantees that at least a local
minimum for problem~\eqref{eq:partitioned_problem} exists.
Figure~\ref{fig:partitions} visualizes the sparsity structure for a function
partitioned according to a path graph of $N = 4$ nodes. Each $i$-th column
shows the variables on which $f_i$ depends, while along each $i$-th row it is
possible to see in which functions a variable $x_i$ appears. It is worth
noticing that the sparsity in the $i$-th row shows the consistency that needs to
be maintained among neighboring nodes on variable $x_i$.
\begin{figure}[!ht]
\centering
\begin{tikzpicture}[scale=1]
\def0.2{0.2}
\def5pt{5pt}
\foreach \y[evaluate=\y as \eval using int(5-\y)] in {1,...,4}
\draw[gray, line width=1pt, rounded corners=5pt,
fill=gray!10,opacity=0.6]
(0.5,\eval - 0.2) rectangle (4.5, \eval + 0.2);
\foreach \x in {1,...,4}
\draw[gray, line width=1pt, rounded corners=5pt,
fill=gray!25,opacity=0.6]
(\x - 0.2 , 0.5) rectangle (\x + 0.2, 4.5);
\foreach \y[evaluate=\y as \eval using int(5-\y)] in {1,...,4}
\draw[gray, line width=1pt, rounded corners=5pt]
(0.5,\eval - 0.2) node[above left,black]{$x_\y$} rectangle (4.5, \eval + 0.2);
\foreach \x in {1,...,4}
\draw[gray, line width=1pt, rounded corners=5pt]
(\x - 0.2 , 0.5) rectangle (\x + 0.2, 4.5)
node[above = 0.1cm, draw=black!70, line width=1.5pt,
xshift=-0.2cm, minimum size = 0.5cm, circle, text=black] (f\x) {$f_{\x}$};
\draw[line width=1.5pt, black!70] (f1) -- (f2);
\draw[line width=1.5pt, black!70] (f2) -- (f3);
\draw[line width=1.5pt, black!70] (f3) -- (f4);
\fill[black!70] (4,1) circle (2.pt);
\fill[black!70] (1,3) circle (2.pt);
\fill[black!70] (1,4) circle (2.pt);
\fill[black!70] (2,2) circle (2.pt);
\fill[black!70] (2,3) circle (2.pt);
\fill[black!70] (3,3) circle (2.pt);
\fill[black!70] (3,1) circle (2.pt);
\fill[black!70] (3,2) circle (2.pt);
\fill[black!70] (4,2) circle (2.pt);
\fill[black!70] (2,4) circle (2.pt);
\end{tikzpicture}
\caption{
Partitioned optimization problem over a path graph of $N\!=\!4$ nodes.
}
\label{fig:partitions}
\end{figure}
\section{Distributed optimization algorithm}
\label{sec:algorithm}
In this section we present our asynchronous distributed algorithm.
In order to develop our algorithm, we need to introduce some
technical tools: (i) the asynchronous communication protocol
necessary to manage the overall behavior of the algorithm,
and (ii) the local approximation model that each node will use to perform
its local (descent) update.
We consider an asynchronous communication protocol where each node
$i\in\until{N}$ has its own concept of time defined by a local timer $\tau_i$,
which randomly and independently of the other nodes triggers when to awake
itself. The timers trigger according to exponential distributions with a common
parameter.
We denote $T_i$ a realization drawn by node $i$.
Between two triggering events the node is in an \emph{idle} mode, i.e., it
continuously receives messages from neighboring nodes and updates some internal
variables. When a trigger occurs, it switches into an \emph{awake} mode in which
it updates its local variable and transmits the updated information to its
neighbors.
A formal discussion on this protocol is given in~\cite{notarnicola2015randomized}.
The proposed distributed algorithm is based on \emph{local} quadratic, strongly-convex
approximations of the cost function that each node computes.
Formally, each node $i\in \until{N}$ constructs the following local
approximation of the entire cost function at a fixed $\bar{x} \in{\mathbb{R}}^n$
(neglecting the constant term $f(\bar{x})$ which does not affect the
optimization),
\begin{align}
\label{eq:local_approximation_pb}
q_i(s_i; \bar{x}) &\! :=
\nabla_{x_i} f( \bar{x} ) ^\top s_i
+ \frac{1}{2} \| s_i \|^2_{Q_i(\bar{x})} \! + g_i(\bar{x}_i + s_i)\\
&\,=\sum_{j\in\mathcal{N}_i} \!\! \nabla_{x_i} f_j( \bar{x}_{\mathcal{N}_j} ) ^\top s_i
+ \frac{1}{2} \| s_i \|^2_{Q_i(\bar{x})} \! + g_i(\bar{x}_i + s_i) \notag
\end{align}
with $Q_i(x) \in {\mathbb{R}}^{n_i\times n_i}$ a symmetric, positive definite matrix
satisfying the following assumption.
\begin{assumption}
For any $x \in {\mathbb{R}}^n$ and $i\in\until{N}$ it holds that $Q_i(x)\succeq L_i I$.
\oprocend
\label{ass:Hi}
\end{assumption}
Intuitively Assumption~\ref{ass:Hi} guarantees the strong convexity of
$q_i$. The role of the Lipschitz constant $L_i$ in the bound will be clear in the
analysis of the algorithm given in Section~\ref{sec:analysis}.
Informally, the asynchronous distributed optimization algorithms is as follows.
A node $i$ takes care of modifying the variable $x_i$. We denote $\sx{i}$ the
current state of node $i$, which is the estimated optimal value of the variable
$x_i$. Consistently we denote $\sx{\mathcal{N}_i}$ the vector of states of nodes in
$\mathcal{N}_i$.
When a node $i$ wakes up, it updates its state $\sx{i}$ by moving in the
direction obtained from the minimization of its local approximation
$q_i (s_i; \sx{})$, being $\sx{}$ the current value of the decision
variable. Then, it sends to each neighbor $j\in\mathcal{N}_i$ the updated $x_i$ and
$\nabla_{x_j} f_i(\sx{\mathcal{N}_i})$.
When in idle, node $i$ is in a listening mode. If an updated
$\nabla_{x_i} f_j(\sx{\mathcal{N}_j})$ is received from a neighbor $j$ no computation
is needed. If $\sx{j}$ is also received ($j$ was an awake node) the following
happens. Node $i$ updates the partial gradients of its local function $f_i$
according to the new $\sx{j}$, and sends back the updated partial gradients to
its neighbors.
In order to highlight the difference between updated and old variables at node
$i$ during the awake phase, we denote the updated ones with a ``$+$'' symbol, e.g.,
as ${\sx{i}}^+$.
We want to stress two important aspects of the idle/awake cycle. First, these
two phases are regulated by local timers without the need of any central
clock. Second, when in idle a node only receives messages and from time to time
evaluates a partial gradient, which takes a negligible time compared to the
computation performed in the awake phase.
The distributed algorithm is formally reported in the table below (from the perspective of
node $i$).
\begin{algorithm}
\renewcommand{\thealgorithm}{}
\floatname{algorithm}{Distributed Algorithm}
\begin{algorithmic}[0]
\Statex \textbf{Processor state}:
$\sx{i}$\medskip
\Statex \textbf{Initialization}: set $\tau_i = 0$ and get a realization $T_i$ \medskip
\Statex \textbf{Evolution}:
\Label \texttt{\textbf{\textit{IDLE:}}}
\StatexIndent[0.5] \textsc{while:} $\tau_i \leq T_i$ \textsc{do}:\medskip
\StatexIndent[1] receive $\sx{j}$ and/or $\nabla_{x_i} f_j(\sx{\mathcal{N}_j})$ from $j\in \mathcal{N}_i$\medskip
\StatexIndent[1] evaluate $\nabla_{x_j} f_i ( \sx{\mathcal{N}_i} )$ and send it to $j\in\mathcal{N}_i$
\medskip
\StatexIndent[0.5] go to \texttt{\textbf{\textit{AWAKE}}}.
\vspace{0.2cm}
\Label \texttt{\textbf{\textit{AWAKE:}}}
\StatexIndent[0.5] \vspace{-0.8cm}
\begin{flalign}
\hspace*{0.8em}\text{compute} & \hspace{1cm} d_i = \mathop{\rm argmin}_{s_i} q_i (s_i; \sx{}) &&
\label{eq:alg_descent}
\end{flalign}
\StatexIndent[0.5] \vspace{-0.6cm}
\begin{flalign}
\hspace*{0.8em}\text{update} & \hspace{1.7cm} \sx{i}^+ = \sx{i} + d_i &&
\label{eq:alg_update}
\end{flalign}
\StatexIndent[0.5] broadcast $\sx{i}^+$, $\nabla_{x_j} f_i (
\sx{\mathcal{N}_i}^+)$ to $j\in\mathcal{N}_i$ \medskip
\StatexIndent[0.5] set $\tau_i=0$, get a new realization $T_i$ and go to
\texttt{\textbf{\textit{IDLE}}}.
\end{algorithmic}
\caption{Partitioned Coordinate Descent}
\label{alg:algorithm}
\end{algorithm}
We point out some aspects involving the local
approximation~\eqref{eq:local_approximation_pb}
that each node uses in its local computations.
First, it is worth noting $q_i(s_i; \sx{})$ does not depend on the entire state
$\sx{}$, but only on $\sx{\mathcal{N}_j}$, $j\in\mathcal{N}_i$ and therefore is constructed
by node $i$ by using only information from its neighbors. Moreover, node $i$
does not needed the expression of neighboring cost functions $f_j$ to build
$q_i(s_i; \sx{})$, but only the gradients $\nabla_{x_i} f_j$. In some special
cases (discussed in the following paragraph), $Q_i(x)$ could include second order
information of $f_j$, $j\in\mathcal{N}_i$, i.e., $\nabla_{x_i,x_i}^2 f_j$, that should
be sent together with the gradients.
Second, different choices for the weight matrix $Q_i(x)$ are allowed.
By exploiting the block Lipschitz continuity of the gradient of $f$, a
first simple choice is to set $Q_i(x) := L_i I$ for all $i\in\until{N}$ and
$x\in {\mathbb{R}}^n$.
Motivated by existing works in the literature,
e.g.,~\cite{facchinei2015parallel}, non diagonal choices for $Q_i(x)$ are
reasonable: for instance, assuming $f\in \mathcal{C}} \newcommand{\DD}{\mathcal{D}^2$, one can select a second order
approximation, i.e., set $Q_i(x):=\nabla^2_{x_i,x_i} f(x) + \epsilon_i I$ for a
sufficiently large $\epsilon_i>0$ for all $i\in\until{N}$. As mentioned above
this information can be constructed in a distributed manner.
Third and final, recalling the definition of the proximal operator
$\map{\mathbf{prox}_{\alpha,\varphi}}{{\mathbb{R}}^n}{{\mathbb{R}}^n}$ of a closed, proper, convex
function $\map{\varphi}{{\mathbb{R}}^n}{{\mathbb{R}}\cup \{+\infty\}}$ given by
$\mathbf{prox}_{\alpha,\varphi} (v) := \mathop{\rm argmin}_{x} \big( \varphi(x) + \frac{1}{2\alpha}
\| x - v\|^2 \big)$
with $\alpha>0$, we have that for $Q_i(x)= L_i I$ the update law described
in~\eqref{eq:alg_descent}-\eqref{eq:alg_update}, can be rephrased in term of
proximal operators and, thus, leading to a distributed coordinate proximal
gradient method.
On this regard it is worth noting that our algorithm, with a general expression
for $Q_i$, can be written in terms of a generalized, weighted version of the
proximal operator as follows.
Given a positive definite matrix $W \in {\mathbb{R}}^{n \times n}$, we define
\begin{align}
\label{eq:gen_prox_operator}
\mathbf{prox}_{W, \varphi} (v) := \mathop{\rm argmin}_x \Big\{ \varphi(x) +
\frac{1}{2} \big\| x - v \big\|^2_{W^{-1}} \Big\},
\end{align}
thus,
the iteration~\eqref{eq:alg_descent}-\eqref{eq:alg_update} can be recast as
\begin{align*}
\sx{i}^+ & = \mathbf{prox}_{Q_i(\sx{})^{-1}, g_i} \Big( \sx{i} -
Q_i(\sx{})^{-1} \sum_{j\in\mathcal{N}_i} \!\! \nabla_{x_i} f_j( \sx{\mathcal{N}_j} ) \Big).
\end{align*}
\section{Convergence analysis of the Partitioned Coordinate Descent distributed
algorithm}
\label{sec:analysis}
In this section we prove the convergence in probability of the proposed
algorithm.
First, it is worth pointing out that being the algorithm asynchronous, for the
analysis we need to carefully formalize the concept of algorithm iterations.
We will use a nonnegative integer variable $t$ indexing a change in the whole
state $\sx{} = [\sx{1}^\top \ldots \sx{N}^\top]^\top$ of the distributed algorithm.
In particular, each triggering will induce an \emph{iteration} of the
distributed optimization algorithm and will be indexed with $t$.
We want to stress that this (integer) variable $t$
does not need to be known by the agents.
That is, this timer is not a common clock and is only introduced for the
sake of analysis.
\begin{theorem}
Let Assumptions~\ref{ass:Lipschitz_f_i}, \ref{ass:convex_g_i},
\ref{ass:coercive} and~\ref{ass:Hi} hold true. Then, the Partitioned
Coordinate Descent distributed algorithm generates a sequence
$x(t):=[\sx{1}(t)^\top, \ldots, \sx{N}(t)^\top]^\top$ (obtained stacking the nodes'
states) such that the random variable $V(x(t))$ converges almost surely, i.e.,
there exists a random variable $V^\star$ such that
\begin{align*}
\Pr \Big( V(x(t) ) = V^\star \Big) = 1.
\end{align*}
Moreover, any limit point $x^\star$ of
$[\sx{1}(t)^\top, \ldots, \sx{N}(t)^\top]^\top$ is a \emph{stationary} point
of problem~\eqref{eq:partitioned_problem} and, thus, satisfies its first
order optimality condition, i.e., there exists a subgradient $\widetilde\nabla g ( x^\star )$
of $g$ at $x^\star$ such that $\nabla f( x^\star ) + \widetilde\nabla g ( x^\star ) = 0$. \oprocend
%
\label{thm:nonconvex_coordinate}%
\end{theorem}%
\subsection{Coordinate descent method for composite non-convex minimization}
\label{sec:coordinate_method}
In this subsection we consider a more general composite optimization problem and
prove a result that is instrumental to the convergence proof of our distributed
algorithm. We introduce a generalization of the algorithm proposed
in~\cite{nesterov2013gradient,richtarik2014iteration,patrascu2015efficient}
based on the quadratic approximation introduced in~\eqref{eq:local_approximation_pb}.
We present the algorithm for problem~\eqref{eq:partitioned_problem}, but we want
to stress that the algorithm can be applied to a general function
$\map{f}{{\mathbb{R}}^n}{{\mathbb{R}}}$ with block-Lipschitz continuous gradient.
This will be clear from the analysis.
We consider a coordinate descent method based on selecting a random
block-component, say $x_i$, of $x$ at each iteration and updating
only $x_i$ through a suitable descent rule.
The descent step is based on the quadratic approximation of the cost function
given in \eqref{eq:local_approximation_pb}.
The coordinate descent method is formally summarized in the table below.
\begin{algorithm}[H]
\renewcommand{\thealgorithm}{}
\begin{algorithmic}[0]
\StatexIndent[-0.3] Choose a random block $i_t \! \in \! \until{N}$ with probability
$p_{i_t}$
\StatexIndent[-0.3] Compute a descent direction $d_{i_t}$ solving
\begin{align}
\label{eq:cd_descent_dir}
d_{i_t} = \mathop{\rm argmin}_{s_i} \, q_{i_t} (s_i;x(t))
\end{align}
\StatexIndent[-0.3] Update the decision variable according to
\begin{align}
\label{eq:cd_update}
\begin{split}
x_{i_t}(t+1) & = x_{i_t}(t) + d_{i_t}
\\
x_j(t+1) & = x_j(t), \hspace{1cm} \text{for all } j \neq {i_t}
\end{split}
\end{align}
\end{algorithmic}
\caption{Generalized Coordinate Descent Algorithm}
\label{alg:nonconvex_CD}
\end{algorithm}
In the following we present results for the theoretical convergence
of the generalized coordinate descent algorithm.
\begin{lemma}
Let Assumption~\ref{ass:Lipschitz_f_i}, \ref{ass:convex_g_i}, \ref{ass:Hi} hold.
Let $x(t)$ be the random sequence generated by Generalized Coordinate Descent Algorithm,
then for all $t\ge 0$ it holds
\begin{align*}
V(x(t+1)) \le V(x(t)) - \frac{L_{i_t} }{2} \|d_{i_t} \|^2.
\end{align*}
\label{lem:descent_cost}
\end{lemma}
\begin{proof}
From Assumption~\ref{ass:Lipschitz_f_i} (Lipschitz continuity of $\nabla f$),
we can write the well-known descent lemma (see \cite[Proposition
A.24]{bertsekas1999nonlinear}),
for all $i\in\until{N}$ and for all $\bar{x}\in{\mathbb{R}}^n$
\begin{align*}
\begin{split}
V( \bar{x}+U_is_i) & \le f( \bar{x} ) + \nabla_{x_i} f( \bar{x} ) ^\top s_i
\\
& \hspace{0.4cm} + \frac{L_i}{2} \|s_i\|^2 + g_i(\bar{x}_i+s_i) + \textstyle \sum_{j\neq i} g_j(\bar{x}_j),
\end{split}
\end{align*}
with $U_i$ introduced in the \emph{Notation} paragraph.
Since $Q_i$ satisfies Assumption~\ref{ass:Hi}, then we can generalize the above
descent condition by introducing a uniform bound depending
on the Lipschitz constant of block $i$, i.e.,
\begin{align*}
\begin{split}
V( \bar{x} +U_is_i) & \le f( \bar{x} ) + \nabla_{x_i} f( \bar{x} ) ^\top s_i
\\
& + \frac{1}{2} \|s_i\|^2_{Q_i(\bar{x})} \!+\! g_i(\bar{x}_i+s_i) \!+\! \textstyle \sum_{j\neq i} g_j(\bar{x}_j)
\end{split}
\end{align*}
Due the partitioned structure of $f$, the explicit expression of $\nabla_{x_i} f(x)$
actually depends only on $f_j$, $j \in \mathcal{N}_i$, thus the latter condition can be further
rephrased as
\begin{align}
V(\bar{x}+U_is_i) \leq q_i(s_i ; \bar{x} ) + f(\bar{x}) + \textstyle \sum_{j\neq i} g_j(\bar{x}_j).
\label{eq:descent_pb}
\end{align}
with $q_i(s_i ; \bar{x} )$ defined as in~\eqref{eq:local_approximation_pb}.
Consider a descent direction $d_{i_t}$ computed as in~\eqref{eq:cd_descent_dir},
then $d_{i_t}$ satisfies the first order necessary condition of optimality
for problem~\eqref{eq:cd_descent_dir}
\begin{align}
\label{eq:FNC}
\nabla_{x_{i_t}} f(x(t)) \!+\! Q_{i_t}(x(t)) d_{i_t}
\!+\! \widetilde{\nabla} g_{i_t} ( x_{i_t} (t)+d_{i_t}) = 0,
\end{align}
where $\widetilde{\nabla} g_{i_t} \in{\mathbb{R}}^{m_{i_t}}$ is a particular subgradient of $g_{i_t}$.
Starting form equation~\eqref{eq:descent_pb} with the following identification
$\bar{x} = x(t)$ and $\bar{x}+U_{i_t} d_{i_t} = x(t+1)$, and adding and
subtracting the term $g_{i_t} (x_{i_t}(t) )$ we obtain
\begin{align*}
\begin{split}
V(x(t+1) ) & \le
V ( x(t) ) + \nabla_{x_{i_t}} f ( x(t) ) ^\top\! d_{i_t} \!\!+\! \frac{1}{2} \|d_{i_t}\|^2_{Q_{i_t} (x(t))}
\\
&\hspace{0.5cm} + g_{i_t} (x_{i_t} (t) + d_{i_t} ) - g_{i_t} (x_{i_t} (t))
\\
& \le V ( x(t) ) + \nabla_{x_{i_t}} f ( x(t) ) ^\top d_i
\\
&\hspace{0.5cm} + \frac{1}{2} \|d_{i_t}\|^2_{Q_{i_t}(x(t))} + \widetilde{\nabla} g_{i_t} (x_{i_t}(t) +d_{i_t})^\top d_{i_t}
\\
& \le V ( x(t) ) - \frac{1}{2} \|d_{i_t}\|^2_{Q_{i_t} (x(t))}
\\
& \le V ( x(t) ) - \frac{L_i}{2} \|d_{i_t}\|^2
\end{split}
\end{align*}
where we used the convexity of $g_{i_t}$, the optimality condition~\eqref{eq:FNC} and the uniform bound
in Assumption~\ref{ass:Hi}.
\end{proof}
\begin{theorem}
Let Assumptions~\ref{ass:Lipschitz_f_i}, \ref{ass:convex_g_i},
\ref{ass:coercive} and~\ref{ass:Hi} hold true. Then, the Generalized
Coordinate Descent Algorithm generates a sequence $x(t)$ such that the random
variable $V(x(t))$ converges almost surely. Moreover, any limit point
$x^\star$ of $x(t)$ is a stationary point of $V$ and, thus, satisfies the
first order necessary condition for optimality for
problem~\eqref{eq:partitioned_problem}, i.e., there exists a subgradient
$\widetilde \nabla g ( x^\star )$ of $g$ at $x^\star$ such that
%
\begin{align*}
\nabla f( x^\star ) + \widetilde\nabla g ( x^\star ) = 0
\end{align*}%
\label{thm:theorem_nonconvex_coordinate}%
\end{theorem}
\begin{proof}
The result is proven by following the same line as in~\cite[Theorem~1]{patrascu2015efficient}
where the generalized Lemma~\ref{lem:descent_cost} is used in place
of~\cite[Lemma~3]{patrascu2015efficient}.
\end{proof}
\subsection{Proof of Theorem~\ref{thm:nonconvex_coordinate}}
\label{sec:theorem_proof}
Our proof strategy is based on showing that the iterations of the asynchronous
distributed algorithm can be written as the iterations of an ad-hoc version of
the coordinate descent method for composite non-convex functions given in
Section~\ref{sec:coordinate_method}.
\emph{Timer model and uniform node extraction.}
Since the timers trigger independently according to the same exponential
distribution, then from an external, global perspective, the induced awaking
process of the nodes corresponds to the following: only one node per iteration
wakes up randomly, uniformly and independently from previous iterations.
Thus, each triggering, which induces an \emph{iteration} of the distributed
optimization algorithm and is indexed with $t$, corresponds to the (uniform)
selection of a node in $\until{N}$ that becomes awake.
We denote $i_t$ the extracted node. Notice that node $i_t$ changes the value of
its state $\sx{i_t}$ while all the other states are not changed by the
algorithm.
\emph{State consistency (inductive argument).} Next we show by induction that if
all the nodes have a consistent and updated information before a node $i$ gets
awake, then the same holds after the update. By consistent we mean that for a
variable $x_\ell$, all the nodes in $\mathcal{N}_\ell$ have the same state
$\sx{\ell}$. By updated we mean that each node $\ell$ has an updated value of
the gradients $\nabla_{x_\ell} f_j$, $j\in\mathcal{N}_\ell$.
First, node $i$ changes only its state $\sx{i}$ relative to the variable
$x_i$. This variable is shared only with neighbors $j\in\mathcal{N}_i$, which receive the new
state $\sx{i}$ after the update.
As regards the gradients, the ones affected by the change of the variable $x_i$
are $\nabla_{x_i} f_j$, with $j\in\mathcal{N}_i$. Notice that these
gradients are only used by nodes $k\in\mathcal{N}_j$. But after the broadcast
performed by $i$, each idle $j\in\mathcal{N}_i$ receives the updated $\sx{i}$,
updates the gradients, and sends them to its neighbors $k\in\mathcal{N}_j$.
The variables and gradients for the rest of the nodes in the network are not
changed by the update of node $i$.
\emph{Coordinate descent equivalence and convergence.} Finally, we simply notice
that, thanks to the consistency argument just shown, steps
\eqref{eq:alg_descent}-\eqref{eq:alg_update} correspond to steps
\eqref{eq:cd_descent_dir}-\eqref{eq:cd_update}.
Thus, we have shown that our distributed algorithm implements the centralized
coordinate method and therefore inherits its convergence properties. By
invoking Theorem~\ref{thm:theorem_nonconvex_coordinate}, the proof follows.
\section{Numerical simulations on a non-convex constrained quadratic program}
\label{sec:simulations}
In this section we present a numerical example showing the
effectiveness of the proposed algorithm.
We consider an undirected connected Erd\H{o}s-R\'enyi random
graph $\mathcal{G}$, with parameter $0.2$, connecting $N=50$ nodes
and we test the distributed algorithm on a partitioned non-convex
constrained quadratic program in the form
\begin{align}
\min_{x\in{\mathbb{R}}^n} &\: \sum_{i=1}^N x_{\mathcal{N}_i}^\top
H_i x_{\mathcal{N}_i} + r_i^\top x_{\mathcal{N}_i} + I_{X_i}(x_i),
\label{eq:numerical_problem}
\end{align}
where each $x_i\in {\mathbb{R}}$ for all $i\in\until{N}$ and each cost matrix
$H_i \in {\mathbb{R}}^{|\mathcal{N}_i|\times |\mathcal{N}_i|}$ is only symmetric (\emph{not}
positive definite). We construct $H_i$ as the difference between a positive
definite matrix $\tilde{H}_i \in {\mathbb{R}}^{|\mathcal{N}_i|\times |\mathcal{N}_i|}$ and a
suitable scaled version of the identity matrix. Finally, each function
$I_{X_i}$ denotes the indicator function of the segment $X_i = [-\ell_i,u_i]$,
i.e., we constrain each $x_i$ to lie into an interval. We set $\ell_i = -30$
and $u_i = 20$ for all $i\in\until{N}$.
Problem~\eqref{eq:numerical_problem} fits our set-up described in
Section~\ref{sec:setup} by defining
\begin{align*}
f_i ( x_{\mathcal{N}_i} ) := x_{\mathcal{N}_i} ^\top H_i x_{\mathcal{N}_i} + r_i^ \top x_{\mathcal{N}_i}
\end{align*}
and
\begin{align*}
& g_i (x_i) := I_{X_i}(x_i) =
\begin{cases}
x_i & \text{ if } \ell_i \le x_i \le u_i
\\
+\infty & \text{ otherwise.}
\end{cases}
\end{align*}
Moreover, we use the local approximation $q_i(s_i,\sx{} )$
as in~\eqref{eq:local_approximation_pb} with
$Q_i = \frac{1}{\alpha_i} I $
with $\alpha_i=0.01$ for all $i\in\until{N}$.
In Figure~\ref{fig:x} we plot the evolution of two selected components
of the decision variable $x$ at each iteration $t$ (defined as discussed
in Section~\ref{sec:analysis}), i.e., $x_i (t)$, $i = 14, 48$. The horizontal dotted
lines represent the centralized solution.
Since the algorithm is asynchronous and based on a coordinate approach, we plot
the rate of convergence with respect to the normalized iterations $t/N$ in order to show
the effective behavior with respect to the global time.
\begin{figure}[!htbp]
\centering
%
\includegraphics[scale=0.8]{fig_x}
%
\caption{
Evolution of two decision variables $x_i$, $i=14,48$, for
the distributed algorithm.
}
\label{fig:x}
\end{figure}
In Figure~\ref{fig:cost} we show the difference, in logarithmic scale,
between the cost $V(x(t))$ at each iteration $t$ and the value of $V$
attained at the limit point $x^\star$ of $x(t)$ (proven to be a stationary point).
\begin{figure}[!htbp]
\centering
%
\includegraphics[scale=0.8]{fig_cost}
%
\caption{
Evolution of the cost error, in logarithmic scale, for the distributed algorithm.
}
\label{fig:cost}
\end{figure}
\section{Conclusions}
\label{sec:conclusions}
In this paper we have proposed an asynchronous, distributed algorithm to solve
partitioned, big-data non-convex optimization problems. The main idea is
that each node updates its local variable by minimizing a suitable, local
quadratic approximation of the cost, built via an information exchange with
neighboring nodes. We prove the convergence of the distributed algorithm by
showing that it corresponds to a proper instance of a coordinate descent method.
\section*{Acknowledgments}
The authors would like to thank Angelo Coluccia e Massimo Frittelli for their
help and suggestions.
\bibliographystyle{IEEEtran}
| {'timestamp': '2017-03-27T02:06:26', 'yymm': '1703', 'arxiv_id': '1703.08370', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08370'} | arxiv |
\subsection{Training Strategy for Smart Augmentation}
During the training phase, we have two networks: Network A, which generates data; and network B, which is the network that will perform a desired task (such as classification). The main goal is to train network B to do some specific task while there are not enough representative samples in the given dataset. To do so, we use another network A to generate new samples.
This network accepts several inputs from the same class (the sample selection could be random, or it could use some form of clustering, either in the pixel space or in the feature space) and generates an output which approximates data from that class.
This is done by minimizing the loss function LA which accepts out1 and image i as input. Where out1 is the output of network A and mage i is a selected sample from the same class as the input. The only constraint on the network A is that the input and output of this network should be the same shape and type. For example, if N samples of a P-channel image are fed to network A, the output will be a single P-channel image.
\subsection{The Generative Network A and Loss Function}
The loss function can be further parameterized by the inclusion of $\alpha$ and $\beta$ as $f(L_A, L_B; \alpha, \beta)$. In the experiments and results sections of this paper, we examine how these can impact final accuracy.
\begin{figure*}[h!]
\label{smartaugManyA}
\includegraphics[width=\textwidth]{figures/drawing1ppNEW.png}
\caption{Smart augmentation with more than one network A}
\end{figure*}
Network A can either be implemented as a single network (figure 2) or as multiple networks, as in figure 1. Using more than one network A has the advantage that the networks can learn class-specific augmentations that may not be suitable for other classes, but which work well for the given class.
\begin{figure*}[h!]
\includegraphics[width=\textwidth]{figures/drawing1p2new.png}
\caption{Diagram illustrating the reduced smart augmentation concept with just one network A}
\end{figure*}
Network A is a neural network, such as a generative model, with the difference that network A is being influenced by network B in the back propagation step, and network A accepts multiple samples as input simultaneously instead of just one at a time. This causes the data generated by network A to converge to the best choices to train network B for that specific task, and at the same time, it is controlled by loss function LA in a way that ensures that the outputs are similar to other members of its class.
The overall loss function during training is $f(LA,LB)$ where $f$ is a function whose output is a transformation of LA and LB. This function could be an epoch-dependent function i.e. the function could change with the epoch number.
In the training process, the error back-propagates from network B to network A. This tunes network A to generate the best augmentations for network B. After training is finished, Network A is cut out of the model and network B is used in the test process.
The joint information between data samples is exploited to both reduce overfitting and to increase the accuracy of the target network during training.
\subsection{How Smart Augmentation Works}
The proposed method uses a network (network A) to learn the best sample blending for the specific problem. The output of network A is the used for the input of network B. The idea is to use network A to learn the best data augmentation to train network B.
Network A accepts several samples from the same class in the dataset and generates a new sample from that class, and this new sample should reduce the training loss for network B.
In figure 3 we see an output of network A designed to do the gender classification. The image on the left is a merged image of the other two. This image represents a sample from the class ``male'' that does not appear in the dataset, but still, has the identifying features of its class.
\begin{figure}[h]
\includegraphics[width=8cm]{figures/fig2.png}
\caption{ The image on the left is created by a learned combination of the two images on the right. This type of image transformation helped increase the accuracy of network B. The image was not produced to be an ideal approximation of a face but instead, contains features that helped network B better generalize the concept of gender which is the task it was trained for. }
\end{figure}
Notice that in figure 3, an image was created with an open mouth and open eyes from two images. The quality of the face image produced by network A does not matter. Only its ability to help network B better generalize.
Our approach is most applicable to classification tasks but may also have applications in any approach where the selective blending of sample features improves performance. Our observations show that this approach can reduce overfitting and increase accuracy.
In the following sections, we evaluate several implementations of our smart augmentation technique on various datasets to show how it can improve accuracy and prevent overfitting. We also show that with smart augmentation, we can train a very small network to perform as well as (or better than) a much larger network that produces state of the art results.
\section{Methods}
Experiments were conducted on NVIDIA Titan X GPU's running a pascal architecture with python 2.7, using the Theano \cite{2016arXiv160502688short} and Lasange frameworks.
\subsection{Data Preparation}
To evaluate our method, we chose 4 datasets with characteristics that would allow us to examine the performance of the algorithm on specific types of data.
Since the goal of our paper is to measure the impact of the proposed technique, we do not attempt to provide a comparison of techniques that work well on these databases. For such a comparison we refer to \cite{MAICS2016} for gender datasets or \cite{zhou2014learning} for the places dataset.
\subsubsection{Highly constrained faces dataset (db1)}
Our first dataset, db1 was composed from the AR faces database \cite{arface} with a total of 4,000 frontal faces of male and female subjects. The data was split into subject exclusive training, validation, and testing sets, with 70\% for training, 20\% for validation, and 10\% for testing. All face images were reduced to 96X96 grayscale with pixel values normalized between 0 and 1.
\subsubsection{Augmented, highly constrained faces dataset (db1a)}
To compare traditional augmentation with smart augmentation and to examine the effect of traditional augmentation on smart augmentation, we created an augmented version of db1 with every combination of flipping, blurring, and rotation (-5,-2,0,2,5 degrees with the axis of rotation at the center of the image). This resulted in a larger training set of 48360 images. The test and validation sets were unaltered from db1. The data was split into a subject exclusive training, validation, and testing sets with 70\% for training, 20\% for validation, and 10\% for testing. All face images were reduced to 96X96 with pixel values normalized between 0 and 1.
\subsubsection{FERET}
Our second dataset, db2, was the FERET dataset. We converted FERET to grayscale and reduced the size of each image to 100X100 with pixel values normalized between 0 and 1. The data was split into subject exclusive training, validation, and testing sets, with 70\% for training, 20\% for validation and 10\% for testing.
\begin{figure}[ht!]
\includegraphics[width=2cm]{figures/f1.jpg}
\includegraphics[width=2cm]{figures/f2.jpg}
\includegraphics[width=2cm]{figures/f3.jpg}
\includegraphics[width=2cm]{figures/f4.jpg}
\caption{Arbitrarily selected images from FERET demonstrate similarities in lighting, pose, subject, background, and other photographic conditions. }
\end{figure}
Color FERET \cite{phillips2000feret} Version 2 was collected between December 1993 and August 1996 and made freely available with the intent of promoting the development of face recognition algorithms. The images are labeled with gender, pose, and name.
Although FERET contains a large number of high-quality images in different poses and with varying face obstructions (beards, glasses, etc), they all have certain similarities in quality, background, pose, and lighting that make them very easy for modern machine learning methods to correctly classify. In our experiments, we use all images in FERET for which gender labels exist.
\subsubsection{Adience}
Our third dataset, db3, was Adience. We converted Adience to grayscale images with size 100x100 and normalized the pixel values between 0 and 1. The data was split into subject exclusive training, validation, and testing sets, with 70\% for training, 20\% for validation and 10\% for testing.
\begin{figure}[ht!]
\includegraphics[width=2cm]{figures/a1.jpg}
\includegraphics[width=2cm]{figures/a2.jpg}
\includegraphics[width=2cm]{figures/a3.jpg}
\includegraphics[width=2cm]{figures/a4.jpg}
\caption{Arbitrarily selected images from the Adience show significant variations in lighting, pose, subject, background, and other photographic conditions. }
\end{figure}
\subsubsection{DB4}
Our fourth dataset, db4, was the MIT places dataset \cite{zhou2014learning}. The MIT PLACES dataset is a machine learning database containing has 205 scene categories and 2.5 million labeled images.
The Places Dataset is unconstrained and includes complex scenery in a variety of lighting conditions and environments.
We restricted ourselves to just the first two classes in the dataset (Abbey and Airport). Pixel values were normalized between 0 and 1. The "small dataset," which had been rescaled to 256x256 with 3 color channels, was used for all experiments without modification except for normalization of the pixel values between 0 and 1.
\begin{figure}[ht!]
\includegraphics[width=2cm]{figures/ab1.jpg}
\includegraphics[width=2cm]{figures/ab2.jpg}
\includegraphics[width=2cm]{figures/air1.jpg}
\includegraphics[width=2cm]{figures/air2.jpg}
\caption{Example images from the MIT places dataset showing two examples from each of the two classes (abbey and airport) used in our experiments. }
\end{figure}
\section{Experiments}
In these experiments, we call network B the network that is being trained for a specific task (such as classification). We call network A the network that learns augmentations that help train network B.
All experiments are run for 1000 epochs. The test accuracy reported is for the network that had the highest score on the validation set during those 1000 epochs.
To analyze the effectiveness of Smart Augmentation, we performed 30 experiments using 4 datasets with different parameters. A brief overview of the experiments can be seen in Table I. The experiments were conducted with the motivation of answering the following questions:
\begin{enumerate}
\item Is there any difference in accuracy between using smart augmentation and not using it? (Is smart augmentation effective?)
\item If smart augmentation is effective, is it effective on a variety of datasets?
\item As the datasets become increasingly unconstrained, does smart augmentation perform better or worse?
\item What is the effect of increasing the number of channels in the smart augmentation method?
\item Can smart augmentation improve accuracy over traditional augmentation?
\item If smart augmentation and traditional augmentation are combined, are the results better or worse than not combining them?
\item Does altering the $\alpha$ and $\beta$ parameters change the results?
\item Does Smart Augmentation increase or decrease overfitting as measured by train/test loss ratios?
\item If smart augmentation decreases overfitting, can we use it to replace a large complex network with a simpler one without losing accuracy?
\item What is the effect of the number of network A's on the accuracy? Does training separate networks for each class improve the results?
\end{enumerate}
As listed below, we used three neural network architectures with varied parameters and connection mechanisms. In our experiments, these architectures were combined in various ways as specified in table \ref{fullexperiments}.
\begin{itemize}
\item Network $B_1$ is a simple, small Convolutional neural network, trained as a classifier, that takes an image as input, and outputs class labels with a softmax layer. This network is illustrated in figure 7.
\item Network $B_2$ is a unmodified implementation of VGG16 as described in \cite{simonyan2014very}. Network $B_2$ is a large network that takes an image as input and outputs class labels with a softmax layer.
\item Network $A$ is a Convolutional neural network that takes one or more images as input and outputs a modified image.
\end{itemize}
\begin{figure}[h]
\includegraphics[width=9cm]{figures/implementation2.png}
\caption{Illustration of network $B_1$}
\end{figure}
\begin{figure}[h]
\includegraphics[width=9cm]{figures/netAAlone.png}
\caption{Illustration of network $A$}
\end{figure}
\begin{table}[]
\centering
\caption{Full listing of experiments.}
\label{fullexperiments}
\begin{tabular}{|c|c|c|c|c|c|c|c|c|}
\hline
Exp & DB &Net A & A ch & Net B & $\alpha$ & $\beta$ & LR & Momentum \\ \hline
1 & db1 & 1 & 1 & B\_1 & 0.3 & 0.7 & 0.01 & 0.9 \\ \hline
2 & db1 & 1 & 2 & B\_1 & 0.3 & 0.7 & 0.01 & 0.9 \\ \hline
3 & db1 & 1 & 3 & B\_1 & 0.3 & 0.7 & 0.01 & 0.9 \\ \hline
4 & db1 & 1 & 4 & B\_1 & 0.3 & 0.7 & 0.01 & 0.9 \\ \hline
5 & db1 & 1 & 5 & B\_1 & 0.3 & 0.7 & 0.01 & 0.9 \\ \hline
6 & db1 & 1 & 6 & B\_1 & 0.3 & 0.7 & 0.01 & 0.9 \\ \hline
7 & db1 & 1 & 7 & B\_1 & 0.3 & 0.7 & 0.01 & 0.9 \\ \hline
8 & db1 & 1 & 8 & B\_1 & 0.3 & 0.7 & 0.01 & 0.9 \\ \hline
9 & db1 & 2 & 1 & B\_1 & 0.3 & 0.7 & 0.005 & 0.9 \\ \hline
10 & db1 & 2 & 2 & B\_1 & 0.3 & 0.7 & 0.005 & 0.9 \\ \hline
11 & db1 & 2 & 3 & B\_1 & 0.3 & 0.7 & 0.005 & 0.9 \\ \hline
12 & db1 & 2 & 4 & B\_1 & 0.3 & 0.7 & 0.005 & 0.9 \\ \hline
13 & db1 & 2 & 5 & B\_1 & 0.3 & 0.7 & 0.005 & 0.9 \\ \hline
14 & db1 & 2 & 6 & B\_1 & 0.3 & 0.7 & 0.005 & 0.9 \\ \hline
15 & db1 & 2 & 7 & B\_1 & 0.3 & 0.7 & 0.005 & 0.9 \\ \hline
16 & db1 & 2 & 8 & B\_1 & 0.3 & 0.7 & 0.005 & 0.9 \\ \hline
17 & db1 & NA & NA & B\_1 & NA & NA & 0.01 & 0.9 \\ \hline
18 & db1a & NA & NA & B\_1 & NA & NA & 0.01 & 0.9 \\ \hline
19 & db1a & 1 & 2 & B\_1 & 0.3 & 0.7 & 0.01 & 0.9 \\ \hline
20 & db1a & 2 & 2 & B\_1 & 0.3 & 0.7 & 0.005 & 0.9 \\ \hline
21 & db2 & NA & NA & B\_1 & NA & NA & 0.01 & 0.9 \\ \hline
22 & db2 & 1 & 2 & B\_1 & 0.3 & 0.7 & 0.01 & 0.9 \\ \hline
23 & db3 & NA & NA & B\_1 & NA & NA & 0.01 & 0.9 \\ \hline
24 & db3 & 1 & 2 & B\_1 & 0.3 & 0.7 & 0.01 & 0.9 \\ \hline
25 & db4 & NA & NA & B\_2 & NA & NA & 0.005 & 0.9 \\ \hline
26 & db4 & NA & NA & B\_1 & NA & NA & 0.005 & 0.9 \\ \hline
27 & db4 & 1 & 2 & B\_1 & 0.3 & 0.7 & 0.01 & 0.9 \\ \hline
28 & db4 & 1 & 2 & B\_1 & 0.7 & 0.3 & 0.01 & 0.9 \\ \hline
29 & db4 & 2 & 2 & B\_1 & 0.7 & 0.3 & 0.005 & 0.9 \\ \hline
30 & db4 & 2 & 2 & B\_1 & 0.3 & 0.7 & 0.005 & 0.9 \\ \hline
\end{tabular}
\end{table}
\subsection{Smart Augmentation with one Network A on the Gender Classification Task}
Experiments 1-8, 19,22, and 24 as seen in table \ref{fullexperiments} were trained for gender classification using the same technique as illustrated in figure 9. In these experiments, we use smart augmentation to train a network (network B) for gender classification using the specified database.
\begin{figure*}[h]
\includegraphics[width=\textwidth]{figures/implementation1.png}
\caption{Diagram of simplified implementation of Smart Augmentation showing network A and network B}
\end{figure*}
The first, $k$ images are randomly selected from the same class (male or female) in the dataset. These $k$ samples are merged into $k$ channels of a single sample. The grayscale values of the first image, $img_0$, are mapped to channel 0 and the grayscale values of the second image $im_1$ are mapped to channel 1 and so on until we reach the number of channels specified in the experiments table. This new $k$ channel image is fed into the network A. Network A is a fully convolutional neural network (See figure 8) which accepts images as the input and gives the images with the same size at the output in a single channel.
An additional grayscale image is then randomly selected from the same class in the dataset (this image should not be any of those images selected in step 1). The loss function for this network A is calculated as the mean squared error between this randomly selected image and the output of network A. The output of network A, and the target image is then fed into network B as separate inputs. Network B is a typical deep neural network with two convolutional layers followed by batch normalization and max-pooling steps after each convolutional layer. Two fully connected layers are placed at the end of the network. The first of these layers has 1024 units and the second dense layer is made of two units as the output of network B using softmax. Each dense layer takes advantage of the drop-out technique in order to avoid over-fitting. The loss function of network B is calculated as the categorical cross-entropy between the outputs and the targets.
The total loss of the whole model is a linear combination of the loss functions of two networks. This approach is designed to train a network A that generates samples which reduce the error for network B. The validation loss was calculated only for network B, without considering network. This allows us to compare validation loss with and without smart augmentation.
Our models were trained using Stochastic Gradient Descent with Nesterov Momentum \cite{sutskever2013importance}, learning rate 0.01 and momentum 0.9. The lasagne library used to train the network in python.
In these experiments, we varied the number of input channels and datasets used. Specifically, we trained a network B from scratch with 1-8 input channels with a single network A on db1, 2 channels on network A for db2 and 3, and 2 channels on network db1a as shown in the table of experiments.
\subsection{Smart Augmentation with two Network A's on the Gender Classification Task}
In experiments 9-16 and 20 we evaluate a different implementation of smart augmentation, containing a separate network A for each class. As before, the first $k$ images are randomly selected from the same class (male or female) in the dataset. These $k$ samples are merged into $k$ channels of a single sample.The grayscale values of the first image, $img_0$, are mapped to channel 0 and the grayscale values of the second image, $im_1$, are mapped to channel 1, and so on until we reach the number of channels specified in the experiments table just as before. Since we now have two network A's, it is important to separate out the loss functions for each network as illustrated in figure 9.
All other loss functions are calculated the same way as before.
One very important difference is the updated learning rate (0.005). While performing initial experiments we noticed that using a learning rate above 0.005 led to the ``dying RELU'' problem and stopped effective learning within the first two epochs. This network is also more sensitive to variations in batch size.
The goal of these experiments was to examine how using multiple network A’s impacts accuracy and overfitting compared to just using one network A. We also wanted to know if there were any differences when trained on a manually augmented database (experiment 20).
\begin{figure*}[h]
\includegraphics[width=\textwidth]{figures/implementation3.png}
\caption{Diagram of our implementation of Smart Augmentation with one network A for each class}
\end{figure*}
\subsection{Training without Smart Augmentation on the Gender Classification Task}
In these experiments, we train a network (network B) to perform gender classification without applying network A during the training stage. These experiments (23, 21, 18, and 17) are intended to serve as a baseline comparison of what network B can learn without smart augmentation on a specific dataset (db3,db2, db1a, and db1 respectively). In this way, we measure any improvement given by smart augmentation. A full implementation of Network B is shown in figure 7.
\begin{figure}[h]
\includegraphics[width=9cm]{figures/implementation2.png}
\caption{Diagram of implementation of network B without Smart Augmentation}
\end{figure}
This network has the same architecture as the network B presented in the previous experiment except that it does not utilize a network A.
As before, two fully connected layers are placed at the end of the network. The first of these layers has 1024 units, and the second dense layer has two units (one for each class). Each dense layer takes advantage of the drop-out technique in order to avoid over-fitting.
All loss functions (training, validation, and testing loss) were calculated as the categorical cross-entropy between the outputs and the targets.
As before, models were trained using Stochastic Gradient Descent with Nesterov Momentum \cite{sutskever2013importance}, learning rate 0.01 and momentum 0.9. The lasagne library was used to train the network in python.
\subsection{Experiments on the places dataset}
In the previous experiments in this section, we used 3 different face datasets. In experiments 25 - 30 we examine the suitability of Smart Augmentation with color scenes from around the world from the MIT Places dataset to evaluate our method on data of a completely different topic. We varied the $\alpha$ and $\beta$ parameter in our global loss function so that we could identify how they influence results. Unlike in previous experiments, we also retained color information.
Experiment 25 utilized a VGG16 trained from scratch as a classifier, chosen because VGG16 models have performed very well on the places dataset in public competitions \cite{zhou2014learning}. The input to network A was 256x256 RGB images and the output was determined by a 2 class softmax classifier.
In experiment 26 we use a network B, identical in all respects to the one used in the previous subsection, except that we use the lower learning rate specified in the experiments table and take in color images about places instead of gender.
These two experiments (25,26) involved simple classifiers to establish a baseline against which other experiments on the same dataset could be evaluated.
In experiments 27-28, $k$ images were randomly selected from the same class (abbey or airport) in the dataset. These $k$ samples are merged into $k \times 3$ channels of a single sample. The values of the first three channels of image $img_0$ are mapped to channel 0-2, and the first three channels of the second image $im_1$ are mapped to channels 3-5, and so on, until we reach the number of channels specified in the experiments table multiplied by the number of color channels in the source images. This new $k \times 3$ channel image is used by network A. Network A is a fully convolutional neural network) which accepts images as the input, and outputs just one image.
An additional image is then randomly selected from the same class in the dataset. The loss function for network A is calculated as the mean squared error between the randomly selected image and the output of network A. The output of network A, and the target image is then fed into network B as separate inputs. Network B is a typical deep neural network with two convolutional layers followed by batch normalization and max-pooling steps after each convolutional layer. Two fully connected layers are placed at the end of the network. The first of these layers has 1024 units and the second dense layer is made of two units as the output of network B using softmax. Each dense layer takes advantage of the drop-out technique in order to avoid over-fitting. The loss function of network B is calculated as the categorical cross-entropy between the outputs and the targets.
The total loss of the whole model is a linear combination of the loss functions of two networks. This approach is designed to train a network A that generates samples that reduce the error for network B. The validation loss was calculated only for network B, without considering network A. This allows us to compare validation loss with and without smart augmentation.
Our models were trained using Stochastic Gradient Descent with Nesterov Momentum \cite{sutskever2013importance}, learning rate 0.005 and momentum 0.9. The Lasagne library was used to train the network in python.
In these experiments, we varied the number of input channels and datasets used. Specifically, we trained a network B from scratch with 1-8 input channels on network A on db1, 2 channels on network A for db2 and 3, and 2 channels on network db1a as shown in the table of experiments.
In experiments 29-30, $k$ images are randomly selected from the same class (abbey or airport) in the dataset. These $k$ samples are merged into $k \times 3$ channels of a single sample. The values of the first three channels in image $img_0$ are mapped to channel 0-2 and the first three channels of the second image $im_1$ are mapped to channels 3-5 and so on until we reach the number of channels specified in the experiments table multiplied by the number of color channels in the source images. This new $k\times 3$ channel image is fed into the network A. Network A is a fully convolutional neural network which accepts images as the input and outputs a single color image.
An additional image is then randomly selected from the same class in the dataset. The loss function for each network A is calculated as the mean squared error between the randomly selected image and the output of network A. The output of network A, and the target image is then fed into network B as separate inputs. Network B is a typical deep neural network with two convolutional layers followed by batch normalization and max-pooling steps after each convolutional layer. Two fully connected layers are placed at the end of the network. The first of these layers has 1024 units, and the second dense layer is made of two units as the output of network B using softmax. Each dense layer takes advantage of the drop-out technique in order to avoid over-fitting. The loss function of network B is calculated as the categorical cross-entropy between the outputs and the targets.
The total loss of the whole model is a linear combination of the loss functions of the two networks. This approach is designed to train a network A that generates samples that reduce the error for network B. The validation loss was calculated only for network B, without considering network A. This allows us to compare validation loss with and without smart augmentation.
Our models were trained using Stochastic Gradient Descent with Nesterov Momentum \cite{sutskever2013importance}, learning rate 0.005 and momentum 0.9. The lasagne library was used to train the network in python.
In these experiments, we varied the number of input channels and datasets used. Specifically, we trained a network B from scratch with 1-8 input channels on network A on db1, 2 channels on network A for db2 and 3, and 2 channels on network db1a as shown in the table of experiments.
\section{Results}
\begin{table}[]
\centering
\caption{Results of Experiments on Face Datasets}
\label{faceresults}
\begin{tabular}{|c|c|c|c|c|}
\hline
\multicolumn{5}{|c|}{\textbf{Experiments on Face Datasets}} \\ \hline
\textbf{Dataset} & \textbf{\#Net As} & \textbf{Input Channels} & \textbf{Augmented} & \textbf{Test Accuracy} \\ \hline
AR Faces & 1 & 1 & no & 0.927746 \\ \hline
AR Faces & 1 & 2 & no & 0.924855 \\ \hline
AR Faces & 1 & 3 & no & 0.950867 \\ \hline
AR Faces & 1 & 4 & no & 0.916185 \\ \hline
AR Faces & 1 & 5 & no & 0.910405 \\ \hline
AR Faces & 1 & 6 & no & 0.933526 \\ \hline
AR Faces & 1 & 7 & no & 0.916185 \\ \hline
AR Faces & 1 & 8 & no & 0.953757 \\ \hline
AR Faces & 2 & 1 & no & 0.869942188 \\ \hline
AR Faces & 2 & 2 & no & 0.956647396 \\ \hline
AR Faces & 2 & 3 & no & 0.942196548 \\ \hline
AR Faces & 2 & 4 & no & 0.942196548 \\ \hline
AR Faces & 2 & 5 & no & 0.907514453 \\ \hline
AR Faces & 2 & 6 & no & 0.933526039 \\ \hline
AR Faces & 2 & 7 & no & 0.916184962 \\ \hline
AR Faces & 2 & 8 & no & 0.924855471 \\ \hline
AR Faces & 0 & NA & no & 0.881502867 \\ \hline
AR Faces & 0 & NA & yes & 0.890173435 \\ \hline
AR Faces & 1 & 2 & yes & 0.956647396 \\ \hline
AR Faces & 2 & 2 & yes & 0.956647396 \\ \hline
Adience & 0 & NA & no & 0.700206399 \\ \hline
Adience & 1 & 2 & no & 0.760577917 \\ \hline
FERET & 0 & NA & no & 0.835242271 \\ \hline
FERET & 1 & 2 & no & 0.884581506 \\ \hline
\end{tabular}
\end{table}
\begin{table}[]
\centering
\caption{Results of Experiments on Place Dataset}
\label{my-label}
\begin{tabular}{|c|c|c|c|c|}
\hline
\multicolumn{5}{|c|}{\textbf{Experiments on MIT places dataset}} \\ \hline
\textbf{\#Net As} & \textbf{Target Network} & \textbf{Test Accuracy} & \textbf{A} & \textbf{B} \\ \hline
0 & VGG16 & 98.5 & NA & NA \\ \hline
0 & Small net B & 96.5 & NA & NA \\ \hline
1 & Small net B & 98.75 & 0.3 & 0.7 \\ \hline
1 & Small net B & 99\% & 0.7 & 0.3 \\ \hline
2 & Small net B & 99\% & 0.7 & 0.3 \\ \hline
2 & Small net B & 97.87\% & 0.3 & 0.7 \\ \hline
\end{tabular}
\end{table}
The results of experiments 1-30 as shown in Table I are listed in tables II and III and are listed in the same order as in the corresponding experiments table. These results are explained in detail in the subsections below.
\subsection{Smart Augmentation with one Network A on the Gender Classification Task}
In figure 12, we show the training and validation loss for experiments 1 and 17. As can be observed, the rate of overfitting was greatly reduced when smart augmentation was used compared to when it was not used.
Without smart augmentation, network B had an accuracy of 88.15 for the AR faces dataset; for the rest of this subsection, this result is used as a baseline by which other results on that dataset are evaluated.
\begin{figure*}[h]
\includegraphics[width=\textwidth]{losses.png}
\caption{Training and validation losses for experiments 1 and 17, showing reductions in overfitting by using Smart Augmentation. The smaller difference between training loss and validation loss caused by the smart augmentation technique shows how this approach helps the network B to learn more general features for this task. To avoid confusion, we remind the reader that the loss for smart augmentation is given by $f(L_A, L_B; \alpha, \beta)$. This means that the loss graphs are a combination of the losses of two networks whereas the losses without smart augmentation are only $f( L_B)$. }
\end{figure*}
One can see how the smart augmentation technique could prevent network B from overfitting in the training stage. The smaller difference between training loss and validation loss caused by the smart augmentation technique shows how this approach helps the network B to learn more general features for this task.
Network B also had higher accuracy on the test set when trained with smart augmentation.
In figures 13 and 14 we show examples of the kinds of images network A learned to generate. In these figures, the image on the left side is the blended image of the other two images produced by network A.
\begin{figure}[h]
\includegraphics[width=8cm]{figures/fig10.png}
\caption{The image on the left is a learned combination of the two images on the right as produced by network A}
\end{figure}
\begin{figure}[h]
\includegraphics[width=2.666cm]{figures/fig11a.png}
\includegraphics[width=2.666cm]{figures/fig11b.png}
\includegraphics[width=2.666cm]{figures/fig11c.png}
\caption{The image on the left is a learned combination of the two images on the right as produced by network A}
\end{figure}
We observe an improvement in accuracy from 83.52\% to 88.46\% from smart augmentation on Feret with 2 inputs and an increase from 70.02\% to 76.06\% on the adience dataset.
We see that there is no noticeable pattern when we vary the number of inputs for network A. Despite the lack of a pattern, a significant difference was observed with 8 and 3 channels providing the best results at 95.38\% and 95.09\% respectively. At the lower end, 7, 5, and 4 channels performed the worst, with accuracies of 91.62\%, 91.04\%, and 91.04\%.
Recall that the accuracy without network A was: 88.15\% for the AR faces dataset.
We suspect that much of the variation in accuracy reported above may be due to chance. Since in this particular experiment, images are chosen randomly there may be times when 2 or more images with very helpful mutual information are present by chance and the opposite is also possible. It is interesting that when 3 and 8 channels were used for network A, the accuracy was over 95\%.
\subsection{Smart Augmentation and Traditional Augmentation}
We note that traditional augmentation improved the accuracy from 88.15\% to 89.08\% without smart augmentation on the gender classification task. When we add smart augmentation we realize an improvement in accuracy to 95.66\%
The accuracy of the same experiment when we used 2 networks A's was also 95.66\% which seems to indicate that both configurations may have found the same optima when smart augmentation was combined with traditional augmentation.
This demonstrates that smart augmentation can be used with traditional augmentation to further improve accuracy. In all cases examined so far, Smart Augmentation performed better than traditional augmentation. However, since there are no practical limits on the types of traditional augmentation that can be performed, there is no way to guarantee that manual augmentation could not find a better augmentation strategy. This is not a major concern since we do not claim that smart augmentation should replace traditional augmentation. We only claim that smart augmentation can help with regularization.
\subsection{Smart Augmentation with two Network A's on the Gender Classification Task}
In this subsection, we discuss the results of our two network architecture when trained on the gender classification set.
These experiments show that approaches which use a distinct network A for each class, tend to slightly outperform networks with just 1 network A. This seems to provide support for our initial idea that one network A should be used for each class so that class-specific augmentations could be more efficiently learned. If the networks with just 1 and 0 input channels are excluded, we see an average increase in accuracy from 92.94\% to 93.19\% when smart augmentation is used, with the median accuracy going from 92.49\% to 93.35\%.
There is only one experiment where smart augmentation performed worse than not using smart augmentation. This can be seen in the 9th row of table II where we use only one channel which caused the accuracy to dip to 86.99\%, contrasted with 88.15\% when no smart augmentation is used. This is expected because when only one channel is used, mutual information can not be effectively utilized. This experiment shows the importance of always using at least 2 channels.
\subsection{Experiments on the Places Dataset}
As with previously discussed results, when the places dataset is used, networks with multiple network A's performed slightly better. We also notice that when $\alpha$ is higher than $\beta$ an increase in accuracy is realized.
The most significant results of this set of experiments is the comparison between smart augmentation, VGG 16, and network B trained alone. Note that a small network B trained alone (no Smart Augmentation) had an accuracy of 96.5\% compared to VGG 16 (no Smart Augmentation) at 98.5\%. When the same small network B was trained with smart augmentation we see accuracies ranging from 98.75\% to 99\% which indicates that smart augmentation, in some cases, can allow a much smaller network to replace a larger network.
\section{Discussion and Conclusion}
Smart Augmentation has shown the potential to increase accuracy by demonstrably significant measures on all datasets tested. In addition, it has shown potential to achieve similar or improved performance levels with significantly smaller network sizes in a number of tested cases.
In this paper, we discussed a new regularization approach, called ``Smart Augmentation'' to automatically learn suitable augmentations during the process of training a deep neural network. We focus on learning augmentations that take advantage of the mutual information within a class. The proposed solution was tested on progressively more difficult datasets starting with a highly constrained face database and ending with a highly complex and unconstrained database of places. The various experiments presented in this work demonstrate that our method is appropriate for a wide range of tasks and demonstrates that it is not biased to any particular type of image data.
As a primary conclusion, these experiments demonstrate that the augmentation process can be automated, specifically in nontrivial cases where two or more samples of a certain class are merged in nonlinear ways resulting in improved generalization of a target network. The results indicate that a deep neural network can be used to learn the augmentation task in this way at the same time the task is being learned. We have demonstrated that smart augmentation can be used to reduce overfitting during the training process and reduce the error during testing.
It is worthwhile to summarize a number of additional observations and conclusions from the various experiments documented in this research.
Firstly, no linear correlation between the number of samples mixed by network A and accuracy was found so long as at least 2 samples are used.
Secondly, it was shown that Smart Augmentation is effective at reducing error and decreasing overfitting and that this is true regardless of how unconstrained the database is.
Thirdly, these experiments demonstrated that better accuracy could be achieved with smart augmentation than with traditional augmentation alone. It was found that altering the $\alpha$ and $\beta$ parameters of the loss function slightly impacts results but more experiments are needed to identify if optimal parameters can be found.
Finally, it was found that Smart Augmentation on a small network achieved better results than those obtained by a much larger network (VGG 16). This will help enable more practical implementations of CNN networks for use in embedded systems and consumer devices where the large size of these networks can limit their usefulness.
Future work may include expanding Smart Augmentation to learn more sophisticated augmentation strategies and performing experiments on larger datasets with larger numbers of data classes. A statistical study to identify the number of channels that give the highest probability of obtaining optimal results could also be useful.
\section{Acknowledgements}
This research is funded under the SFI Strategic Partnership Program by Science Foundation Ireland (SFI) and FotoNation Ltd. Project ID: 13/SPP/I2868 on Next Generation Imaging for Smartphone and Embedded Platforms.
This work is also supported by an Irish Research Council Employment Based Programme Award. Project ID: EBPPG/2016/280
We gratefully acknowledge the support of NVIDIA Corporation with the donation of a Titan X GPU used for this research.
\newpage
\IEEEtriggeratref{12}
\bibliographystyle{IEEEtran}
| {'timestamp': '2017-03-27T02:06:38', 'yymm': '1703', 'arxiv_id': '1703.08383', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08383'} | arxiv |
\section{Introduction}
\noindent
Rich Lenski's experiments in long term evolution
\cite{Lenski:2015:PRoySocB}
in which the BEACON team evolved bacteria for more than 60\,000
generations
and found continued beneficial adaptive mutations,
prompts the same question in computation based evolution.
What happens if we allow artificial evolution,
specifically genetic programming~(GP) with crossover
\cite{koza:book,banzhaf:1997:book,poli08:fieldguide},
to evolve for tens of thousands, even a hundred thousand generations.
Firstly we expect bloat%
\footnote{%
GP's tendency to evolve non parsimonious solutions
has been known since the beginning of genetic programming.
E.g.~it is mentioned in
Jaws \cite[page~7]{koza:book}.
\label{p.intronsbloat}
Walter Tackett \cite[page~45]{Tackett:1994:thesis}
credits Andrew Singleton with
the theory that GP bloats due to the
cumulative increase in
non-functional code, known as introns.
The theory says these
protect other parts of the same tree by deflecting genetic
operations from the functional code by simply offering more
locations for genetic operations.
The bigger the introns, the more chance they will be hit by crossover
and so the less chance crossover will disrupt the useful part of
the tree.
Hence bigger trees tend to have children with higher fitness than
smaller trees.
See also
\cite{kinnear:altenberg,kinnear:angeline}.},
and so we need a GP system not only able to run for
$10^{5}$~generations
but also able to process trees with in excess of a 100 million nodes.
Section~\ref{sec:results} describes our target system
which is able to do this on a Linux desktop computer.
Section~\ref{sec:size}
shows we do indeed see bloat but after a few hundred generations we
start to see surprises.
Tree growth is not continuous.
Indeed we see many generations where the trees get smaller.
As we look at the very long term distribution of fitness
in Section~\ref{sec:fit}
we do not get the whole population
reaching one fitness value
and everyone having that fitness in all subsequent generations.
Section~\ref{sec:fit}
also applies existing theory
to give a mathematical model
of fitness convergence's impact on selection.
Section~\ref{sec:introns}
discusses introns and constants.
By introns we mean
subtrees which cannot impact on the program's output,
even if modified by crossover.
A constant
is simply a
subtree whose output is the same for all input test cases.
Although introns are well known in GP,
we find constants are also required to explain the observed long
term evolution.
In
Section~\ref{p.smallmums}
we confirm the asymmetry of the GP crossover
and the importance of the first parent,
which gives the offspring's root node
and show this becomes even more important in long term evolution.
(Since this parent typically gives more genetic material
we call it the mother, or simply mum.)
Section~\ref{sec:entropy}
looks at the distribution of values within the large evolved trees
and particularly
how combining values within the evolving trees leads to constants.
Section~\ref{sec:multifit}
considers the evolution of multiple solutions as
an alternative to classic bloat as protection
from disruptive crossover.
However it
concludes that although multiple solutions within the highly evolved
programs are possible, they do not
explain the evolution seen.
Whereas
Section~\ref{sec:constants}
shows the fraction of constants in highly evolved trees
is fairly stable despite huge fluctuations in the size of the trees
containing them.
Section~\ref{sec:shape}
shows the classic fractal Flajolet random distribution of trees~\cite{langdon:2000:fairxo}
still applies to highly evolved trees.
It also shows,
as expected,
the Flajolet distribution
also applies to the
sub trees within them.
Finally Section~\ref{sec:code}
demonstrates the common assumption that useful code
clusters around the root node
and shows that in the longer term this code becomes highly stable
and is surrounded and is protected by many thousands of useless
instructions
composed of both introns and constants.
Section~\ref{sec:endbloat}
proposes a lose limit to bloat
in extremely long GP runs.
The limit turns out to be somewhat ragged.
Nevertheless Section~\ref{sec:endbloat}
provides some experimental evidence for it
in runs lasting one hundred
thousand generations.
\subsection{Background}
\noindent
There has been some work in evolutionary computing
and artificial life looking at the extended evolutionary process itself
rather than focusing on solving a problem.
For example,
Harvey's Species Adaptation Genetic Algorithms (SAGA)~\cite{harvey:1997:ob}
argued in favour of variable length representation
(such as we use in genetic programming)
to allow continued evolutionary adaptation.
Whilst more recently Lewis' TMBL system \cite{Lewis:2010:cec}
turned to the power of parallel processing GPUs to
investigate the long term
gathering of small mutations over many generations.
McPhee~\cite[sect.~1.2]{mcphee:2001:EuroGP}
reported that his earlier studies which had reported the first 100
generations of the INC-IGNORE problem could not safely be extrapolated
to long term evolution
but considered runs of up to 3000 generations.
McPhee~\cite{mcphee:2001:EuroGP}
found ``increasing amount of noise''
in the evolution of their linear unary trees
and say it was unclear if their tree lengths would be bounded.
As in our previous work~\cite{langdon:2000:quad}
we will use binary tree GP\@.
However previously~\cite{langdon:2000:quad}
we
only considered the first few hundred generations,
whilst in the next sections
we shall investigate many tens of thousands.
\section{Results}
\label{sec:results}
\noindent
Following \cite{langdon:2000:quad},
the generational GP was run with a population of 500
(see Table~\ref{gp.details}).
All parents were selected using independent tournaments of size seven
to select both parents used by each crossover.
One child was created by each crossover.
For simplicity, all crossover points are chosen uniformly at random.
I.e.\ there was no bias in favour of functions
\cite{koza:book}.
Mutation was not used.
Since we will evolve trees with more than a hundred million nodes
it is essential to use a compact representation and fast fitness
evaluation,
therefore we use Poli's Sub-machine code GP
\cite{poli:1999:aigp3}
on a 64 bit processor
which allows us to process all 64 fitness cases simultaneously.
\begin{table
\setlength{\temp}{\textwidth}
\settowidth{\tempa}{Fitness cases:}
\addtolength{\temp}{-\tempa}
\addtolength{\temp}{-2\tabcolsep}
\caption{\label{gp.details}
Long term evolution of 6-Mux trees
}
\begin{tabular}{@{}lp{\temp}@{}}\hline
Terminal set: \rule[1ex]{0pt}{6pt} & D0 D1 D2 D3 D4 D5 \\
Function set: & AND OR NAND NOR \\
Fitness cases: & All $2^6$ combinations of inputs D0..D5\\
Selection: & tournament size 7 using the number of correct fitness cases
\\
Population: & 500. Panmictic, non-elitist, generational.
\\
Parameters: &
Initial population created at random using ramped half and half
\cite{koza:book} with depth between 2 and 6.
100\%~subtree crossover~\cite{koza:book}.
10\,000~generations
(runs cut short on any tree reaching hard limit of a million nodes).
\\\hline
\end{tabular}
\end{table}
\subsection{Evolution of Size}
\label{sec:size}
\noindent
In all cases we do see enormous increases in size
(see Figure~\ref{fig:bmux6_100_3L2_size}).
Except for runs in Section~\ref{sec:endbloat},
in each case the run was cut short because bloat became so severe that
further crossovers where inhibited by the hard size limit
of a million nodes (see Table~\ref{gp.details}).
In the initial generations,
we do see explosive growth in tree size
and this continues even after a tree with max fitness is found.
Indeed bloat continues even as the first time
everyone in the population has the same fitness value
($1^{\rm st}$ convergence).
\begin{figure}
\centerline{\includegraphics[scale=1.175]{graph/bmux6_100_3L2_size}}
\vspace*{-2ex}
\caption{\label{fig:bmux6_100_3L2_size}
Evolution of tree size in first 6-mux run.
(This run
aborted after 5355 gens by first crossover to hit
million node limit.)
Because of computational cost, the
average number of effective instructions
(i.e.~not introns or blocked by constants)
is plotted~($+$) every 100 gens.
(Mean
effective code
497.)
}
\end{figure}
If everyone in the population has the same fitness,
selection appears to become random
and children are as likely to be smaller than their parents
as they are likely to be bigger.
If selection is switched off for many generations,
we do indeed see an apparently random walk in average tree size,
with falls and rises.
However tree size cannot go negative
and once the population contains only small trees
crossover cannot escape and the trees remain tiny forever.
That is, we have a gambler's ruin.
(We return to this in Section~\ref{sec:endbloat}.)
Although after the time where almost everyone in the population
has the same fitness value,
we do see falls in average tree size as well as increases,
this is not a simple random walk.
For example,
in Figure~\ref{fig:bmux6_100_3L2_size} there are substantial
falls in size which take place over many generations
during which
the number of generations in which the trees are smaller on average
v.\ the number in which they are bigger, is too large to be simply random.
This might be due to the discovery of
smaller than average individuals of max fitness
but with a higher than average effective fitness,
however we were unable to find hard evidence to support this hypothesis.
(Effective fitness is simply fitness rescaled to take into account the
disruptive effects of crossover and mutation
\cite[sec.~14.2]{nordin:thesis},
\cite[page~187]{banzhaf:1997:book}
\cite{Stephens:1999:ECJ},
\cite{langdon:fogp}.)
Even after the population has converged to the point
where everyone has the same fitness
($1^{\rm st}$ convergence),
crossover can still be disruptive
so there are generations with lower fitness individuals.
Since they never have children but
(as we will see in Section~\ref{p.smallmums}
on page~\pageref{p.smallmums})
they tend to be smaller than average,
they lead to increases in tree size.
Figure~\ref{fig:updown}
shows the ratio of generations where average tree size increased
to where it decreased
v.\
the number of unfit trees in the parent
generation.
To limit noise,
we do not plot
data with $\le 5$ instances
where size increased or
where it decreased.
\begin{figure}
\centerline{\includegraphics[scale=1.175]{graph/updown}}
\vspace*{-2ex}
\caption{\label{fig:updown}
Impact of poor fitness individuals on average tree size in next generation.
Ratio of cases where mean tree size increased to where it fell
v.~number of trees with fitness $<64$ in parent generation.
Nine runs after first time 100\% population has max fitness.
Dotted line is median linear regression.
}
\end{figure}
After the population $1^{\rm st}$ converges, tournament selection has no problem
immediately removing
unfit children and so
in later generations
there are either none or very few of them.
Thus the average tree size is largely the same as in the previous
generation plus some random variation.
Nonetheless over thousands of generations the removal of smaller trees
is sufficient to continue to bloat the population.
\subsection{Fitness Convergence}
\label{sec:fit}
\noindent
At the start of the run better trees evolve
which
tournament selection chooses to be
the parents for many crossovers.
These often succeed in propagating the parents'
abilities to their children.
So, as expected, the number of individuals with maximum fitness
in the population grows rapidly
towards 100\%.
However as
Figure~\ref{fig:bmux6_100_fitness} shows,
typically it does not remain at 100\%
but hovers slightly below 100\%.
There is a good deal of stochastic fluctuation and so
Figure~\ref{fig:bmux6_100_fitness} shows the value smoothed
over thirty generations.
A third of generations after generation~312
also only contain trees with max fitness.
But almost as many~(28\%) have one low fitness individual
and 18\% have two.
Figure~\ref{fig:bmux6_100_fitness} also shows a general
downward trend towards fitness convergence
as the trees tend to get bigger without a corresponding increase in the
size of their effective code
(shown with $+$ in Figure~\ref{fig:bmux6_100_3L2_size}).
\begin{figure
\centerline{\includegraphics[scale=1.175]{graph/bmux6_100_fitness}}
\vspace*{-2ex}
\caption{\label{fig:bmux6_100_fitness}
Evolution of low fitness in first 6-mux pop=500 run.
All poor fitness trees (runts)
first removed in gen~312.
(Plot has been smooth over
30 generations.)
After generation 312, there are at most 11 trees with fitness $<64$
(gens 1238, 2866
and one 10, gen 2262).
(Mean prog size in background.)
}
\end{figure}
Figure~\ref{fig:bmux6_noselection},
(page~\pageref{fig:bmux6_noselection})
shows
once a GP run has found a tree with max fitness,
the impact of fitness selection on subsequent generations falls rapidly
in line with theory.
I.e.\ the expected number of tournaments $y$ using some aspect of fitness
is given by
\mbox{$y=2\times {\rm popsize} \left(1-(1-x/{\rm popsize})^7\right)$}
where $x$ is the number of poor fitness trees in the population
and the tournament size is 7.
Near the origin
$y \approx 14 x$.
In a typical run, after first fitness convergence,
two thirds of generations contain one, two or more poor children.
Meaning on average in $2/3^{\rm rds}$ of populations,
fitness selection plays some role in the choice of
parents for
14, 28 or more children.
\begin{figure}
\centerline{\includegraphics[scale=1.175]{graph/bmux6_noselection}}
\vspace*{-2ex}
\caption{\label{fig:bmux6_noselection}
Convergence of typical GP population leads to reduction in fitness
variation and so fewer tournaments using any aspect of fitness.
Except where a population converges to fitness below 64,
all runs
follow the theoretical curve
\mbox{$2\times {\rm popsize} \left(1-(1-x/{\rm popsize})^{\rm tourn\ size}\right)$}.
}
\end{figure}
\subsection{Introns}
\label{sec:introns}
\noindent
The functions available to evolution are AND, OR,
NAND and NOR\@.
If, for all fitness test cases, an input to an AND node is~0,
then the AND's output will also always be~0.
Whereas if an input to
NAND is always~0
NAND's output is always~1.
Similarly always~1 for OR gives always~1,
and it gives always~0 for NOR\@.
Our GP system does not pre-define such constants,
however they can be readily evolved in many ways.
E.g.\
0 can be created by taking any leaf and anding it with its inverse.
Given these four combinations of functions and 0 and 1,
the other input to the function has no impact on the nodes output.
Indeed, since our function set has no side-effects,
the whole subtree leading to
the input has no impact.
Some GP systems may be optimised to avoid even evaluating it.
Further, not only can it have no effect in the current tree,
any genetic changes to it also have no effect.
Meaning children who only differ from their parent in
such subtrees are guaranteed to have exactly the same fitness as their
parent.
In genetic programming we have been calling such subtrees ``introns''.
Although it does not use this information,
our GP system was modified to recognise and report such introns.
\subsection{The Importance of Mothers}
\label{p.smallmums}
\noindent
Figure~\ref{fig:bmux6_100_runt}
shows the size of
low fitness children is highly correlated with the parent
(mother) which they inherent their root node from.
Figure~\ref{fig:bmux6_100_runt_hist}~(left) shows that
crossovers which change fitness
tend to remove more code than they add
but this effect is dwarfed by the factor that
90\% of mothers of unsuccessful
offspring are smaller than average
and on average the difference is much bigger
than the change in size caused by
the damaging crossover,
see Figure~\ref{fig:bmux6_100_6_mum} (right).
However
(as we shall see in the next section page~\pageref{p.bmux6_100_xo})
in many cases the fraction of the new population with worse
fitness than their mothers
is far smaller than the fraction of introns
and the difference is largely made up by the protection afforded by
constants.
\begin{figure*
\begin{tabular}{@{}c@{\hspace{\columnsep}}c@{}}
\rule{\halfwidth}{0pt} &
\rule{\halfwidth}{0pt}\\
\includegraphics[scale=1.18607]{graph/bmux6_100_runt_mum}
&
\includegraphics[scale=1.18607]{graph/bmux6_100_runt_dad}
\end{tabular}
\vspace*{-2ex}
\caption{\label{fig:bmux6_100_runt}
Size of all 6695 children (typical run)
with fitness less than their parents
compared to size of their parents (x-axis)
which both have max fitness~(64).
Note strong correlation with root node parent
(mum).
}
\end{figure*}
\begin{figure*
\begin{tabular}{@{}c@{\hspace{\columnsep}}c@{}}
\rule{\halfwidth}{0pt} &
\rule{\halfwidth}{0pt}\\
\includegraphics[scale=1.2]{graph/bmux6_100_runt_hist}
&
\includegraphics[scale=1.2]{graph/bmux6_100_6_mum}
\end{tabular}
\vspace*{-2ex}
\caption{\label{fig:bmux6_100_runt_hist}
Left:
Change in size of 6695 poor fitness children (typical run)
(Decile bins used for changes bigger than 8).
More than half
(3428) of the children are smaller than their 1st parent,
2018~(30\%) larger
and 1249~(19\%) the same size.
\label{fig:bmux6_100_6_mum}
Right:
Distribution of size of 1st parent (mum) relative to population mean
for all 6695 low fitness ($<64$) children (typical run)
where both parents have max fitness~(64).
90\%
of the mums
are smaller than average.
(Same data as Figure~\protect\ref{fig:bmux6_100_runt}.)
}
\end{figure*}
\subsection{Entropy \& Evolution of Robust Constants}
\label{sec:entropy}
\noindent
Although all the components in
the evolved trees are deterministic
they lead to progressive information loss
(entropy reduction).
When the components are deeply nested
(i.e.~the trees are large)
the loss may be complete,
leading to
subtrees
whose output is independent
of their leafs.
We call such zero entropy subtrees constants.
$$\mbox{Entropy is }\ \
S= -64\left(p \log_2(p) + q \log_2(q)\right)$$
where $p$ is the fraction of the 64 fitness cases which are true
(and $q$ for zero).
We use $\log_2$ so that entropy is expressed in bits.
Notice in these experiments
the entropy of all leafs is 64 bits
and all constants have entropy of zero.
With our,
deliberately symmetric,
function set,
the entropy of a function with identical inputs
is the same as that of those inputs.
Whilst the entropy of a function whose inputs are two different leafs
will be
$S= -64\left(\frac{3}{4}\log_2\left(\frac{3}{4}\right) + \frac{1}{4}\log_2\left(\frac{1}{4}\right)\right) = 51.92
\ \mbox{bits} $
I.e.\ lower than that of either input.
This is generally true of any program:
the entropy of each step is typically lower than the entropy of its
inputs and cannot be higher.
(This is reasonable since no deterministic system can
increase the information content of its input.)
Another way to view this is that the impact of each leaf is diluted
in each function by the effect of the leafs attached
(possible indirectly)
to the function's other input.
This suggests leafs in a function's subtree but separated from it by
many intermediate levels of the subtree would tend to have less impact
on it.
If the path from any code to the root node passes through a zero
entropy function,
it cannot effect the output of the tree
and we call it ineffective code.
Large evolved trees
contain evolved constants.
For example both trees in
Figure~\ref{fig:bmux6_100_id_200000}
(page~\pageref{fig:bmux6_100_id_200000})
contain three constants
created by OR functions.
The whole of the subtree below the constant can be replaced by the
constant without changing the program's output in any way.
Evolved
constants are resilient to changes in the subtree
beneath them.
In a typical run
after the first
time the population converges
so that everyone has maximum fitness
(i.e.\ generation 312)
only one or two crossovers made in subtrees headed by a
constant reduce the child's fitness.
\label{p.bmux6_100_xo}
On average over 500 generations after generation 312,
99.6\% of children are modified only in code below a constant,
on average in each generation
of these
1.9
(0.38\% of the population)
do not have maximum fitness.
The remaining 0.4\% of crossovers, give rise to on average 0.8
poor fitness children
(0.16\% of the population).
\subsection{Evolution of High Fitness Within Trees}
\label{sec:multifit}
\noindent
A potential alternative way for GP individuals to protect their
children in the evolving population might be to contain
multiple instances of high fitness code
so that crossover between descendants
would have some chance of copying complete
high fitness code (building blocks).
This would also require the insertion point to be receptive.
However if we take the view that the
high fitness code must itself be a subtree,
then Figure~\ref{fig:bmux6_100_nsol} shows this does not happen.
In all our pop=500 runs,
even after thousands of generations,
on average
there are less than a handful of
subtrees per individual which themselves have max fitness.
Since they are so few
they stand very little chance of being selected as a
crossover point in trees of several hundred thousand nodes.
Figure~\ref{fig:pTraceDynamic_anal}
(page~\pageref{fig:pTraceDynamic_anal})
shows good agreement between
the observed occurrence of whole tree insertion crossovers
and theory based on the size of the trees.
Between
gen~312 (the first time the whole population reached max fitness)
and
generation 1828
there were
758\,500 crossovers.
Based on tree sizes, about 60
should have caused the whole of one parent to be inserted into the other.
Although they give rise to children which contain multiple
subtrees with fitness~64
these do not spread through the population
and the average number of such subtrees remains near~1.0
until much later
(see Figure~\ref{fig:bmux6_100_nsol}).
\begin{figure
\centerline{\includegraphics[scale=1.175]{graph/bmux6_100_nsol}}
\vspace*{-2ex}
\caption{\label{fig:bmux6_100_nsol}
Evolution of average number of 6-mux subtrees in the population
with max fitness~(64)
(typical GP run).
Notice several thousand generations where there is almost exactly one
per tree in the population.
Only after extreme bloat (dotted line)
do we sometimes
get $>1$
subtrees with fit=64.
}
\end{figure}
\begin{figure
\centerline{\includegraphics[scale=1.175]{graph/pTraceDynamic_anal}}
\vspace*{-2ex}
\caption{\label{fig:pTraceDynamic_anal}
Count of number of whole trees inserted~$+$
(i.e.\ crossover point at root of second parent).
Showing agreement with theory (solid line).
The count is started from the first time the population
converges to 100\% max fitness
and is shown for the next 500 generations.
For ease of comparison the average size of trees is shown dotted.
The expected rate of increase falls as trees get bigger.
}
\end{figure}
\subsection{Evolution of Constants}
\label{sec:constants}
\noindent
With our \cite{langdon:2000:quad}
Boolean function set,
evolution readily assembles constants
and these rapidly spread through the population.
The exact ratios vary between runs.
(Figure~\ref{fig:bmux6_100_constant},
page~\pageref{fig:bmux6_100_constant},
shows their evolution in a typical run.)
After a few hundred generations,
functions which evaluate to the same value for all test cases
occupy a few percent of the whole population
and once evolved these fractions are fairly stable to the end of the run.
Such high densities of constants reflect the large fraction of introns
and ineffective code in the highly evolved trees.
\begin{figure
\centerline{\includegraphics[scale=1.175]{graph/bmux6_100_constant}}
\vspace*{-2ex}
\caption{\label{fig:bmux6_100_constant}
Evolution of average fraction of nodes in the population
which evaluate to a constant
(typical GP run).
Notice several thousand generations where the
fraction of the evolving population which are constant is almost unchanging.
}
\end{figure}
\subsection{Evolution of Tree Size and Depth}
\label{sec:shape}
\noindent
Figure~\ref{fig:bmux6_100_sized}
(page~\pageref{fig:bmux6_100_sized})
shows the distribution of subtrees
within a highly evolved population at generation 2500.
As expected
\cite{langdon:1999:sptfs},
in no case are trees either maximally short and bushy or
maximally tall and thin.
Instead both trees and subtrees lie near the
mean size v.~depth limit
calculated by Flajolet for random binary trees of a given size~%
\cite{flajlet:1982:ahbt}.
Random trees have the fractal like property that often
there is a leaf close to their root node and
this is also true of subtrees within them.
\begin{figure
\centerline{\includegraphics[scale=1.42857]{graph/bmux6_100_sized}}
\vspace*{-2ex}
\caption{\label{fig:bmux6_100_sized}
Generation 2500 of typical 6-mux run.
Highly evolved trees ($\times$) lie close to Flajolet line (dotted parabola).
As predicted their subtrees are also like random trees
\protect\cite{langdon:1999:sptfs}.
}
\end{figure}
If we compare the evolved distribution of tree sizes
with Poli's limiting distribution
\cite{poli:2007:eurogp}
the match is good but
the actual distribution does differ significantly from theory,
see Figure~\ref{fig:bmux6_100_poli}.
Nonetheless the theory does predict both the extended tail to very
small trees and the upper tail.
It also predicts reasonably well the location of the peak.
\begin{figure*
\begin{tabular}{@{}p{\halfwidth}p{\halfwidth}@{}}
\includegraphics{graph/bmux6_100_poli}
&
\includegraphics{graph/bmux6_100_poli_splot}
\end{tabular}
\vspace*{-2ex}
\caption{\label{fig:bmux6_100_poli}
Distribution of highly evolved fit trees in a typical run
(decile bins).
Left:
Generation 2500.
The dotted line shows
Poli's theoretical limiting distribution for random crossover
\cite[Eq~24]{poli:2007:eurogp}
(arity $a=2$, $p_{a}$ set to fit observed mean: 82482.1).
Right:
Generations 0 to 2500.
Colour indicates by how much each decile bin exceeds
value plus
three standard deviations
predicted by
Poli's limiting distribution \cite{poli:2007:eurogp}.
Note log scales.
}
\end{figure*}
The generation (2500) depicted in Figure~\ref{fig:bmux6_100_poli}~(left)
is not atypical.
If we look at all generations leading up to it,
after generation 35,
in every case
at some point one or more groups of trees have more similar sizes than
predicted by unfettered random crossover
(colour in Figure~\ref{fig:bmux6_100_poli} right).
Suggesting even the very modest degree of fitness selection continues
to have an impact on the population (even when the trees get smaller
with time).
Again the distribution predicts the tails reasonable well.
\subsection{Evolution of Effective Code}
\label{sec:code}
\noindent
Figure~\ref{fig:bmux6_100_3L2_size}
(page~\pageref{fig:bmux6_100_3L2_size})
has already shown that
the size of effective code is fairly stable.
Figure~\ref{fig:bmux6_100_id_200000}
shows the effective code in two typical trees separated by 100
generations.
(I.e.\ at generation 400 and 500.)
Notice even after 100 generations the effective part of the evolved
trees is little changed.
Indeed if we look at the effective code in every tree
in the population at generation 500
(Figure~\ref{fig:bmux6_100_250000}
page~\pageref{fig:bmux6_100_250000})
we see they are also very similar.
Typically
the effective part of the code lies in a few hundred nodes
around the root node (yellow)
which is protected against crossover by evolved constants.
The constants head large sacrificial subtrees of ineffective code.
Figure~%
\ref{fig:bmux6_100_250000}
shows the effective code is conserved
over many generations.
We see this in all pop=500 runs
(except 102, gets stuck at fitness=62).
However the details of the evolved effective code differ
from run to run.
\begin{figure*
\setlength{\temp}{\textwidth}
\centerline{\includegraphics[width=0.99\temp]{graph/bmux6_100_id_200000.pdf}}
\vspace*{-2ex}
\centerline{\includegraphics[width=0.99\temp]{graph/bmux6_100_id_250000.pdf}}
\vspace*{-2ex}
\caption{\label{fig:bmux6_100_id_200000}
Typical 6-mux effective code with max fitness~(64).
Top: generation 400.
The whole program is 15\,495 instructions but only
111 are effective.
Bottom: generation 500.
Only the
141 effective out of 16\,831 instructions shown.
Notice similarity.
See also Figure~\protect\ref{fig:bmux6_100_250000}
which shows all high fitness trees in generation 500.
}
\end{figure*}
\begin{figure*
\begin{tabular}{@{}p{\halfwidth}@{\hspace{\columnsep}}p{\halfwidth}@{}}
\includegraphics[width=\halfwidth]{graph/bmux6_100_250000}
&
\includegraphics[width=\halfwidth]{graph/bmux6_100_500000}
\\
\includegraphics[width=\halfwidth]{graph/bmux6_100_1000000}
&
\includegraphics[width=\halfwidth]{graph/bmux6_100_2000000}
\end{tabular}
\vspace*{-2ex}
\caption{
\label{fig:bmux6_100_250000}
\label{fig:bmux6_100_500000}
\label{fig:bmux6_100_1000000}
\label{fig:bmux6_100_2000000}
Effective code in a population of 500 binary trees
after 500, 1000, 2000 and 4000 generations.
(Each panel showing the 496-500 trees
with max fitness.)
Note the similarity of the effective code even though separated by
thousands of generations.
By generation 4000
although the trees range in size from 843 to 328\,723
the effective code is limited to the
721
nodes shown
(0.2\% of the total).
Almost all the population have 82 effective nodes in common
(yellow).
Darker colours indicate effective code
which only occurs in $\le$148~(blue) or $\le$22~(black) trees.
Code which does not effect any program's output
is not plotted.
}
\end{figure*}
\section{A Limit to Bloat}
\label{sec:endbloat}
\noindent
Can bloat continue forever?
Even in these extended runs fitness selection is needed to sustain the
tree size \cite{Langdon:1997:bloatWSC2},
in that if we turn off selection, the number of nodes in the
population executes an apparently random walk.
However, a population of very small trees,
represents an absorbing state
from which it may take crossover a long time to escape.
Indeed
a population of all leafs can be constructed by crossover but it
cannot escape it.
The presence of an absorbing state converts the random walk into a
gambler's ruin.
Once trees become so big that the population contains no
low fitness individuals, tree size executes a gamblers ruin
towards zero.
Although the step size increases with tree size, it
appears highly unlikely for the population to migrate to tiny trees
which crossover cannot escape,
without transitioning through a regime where small trees
have low fitness
and hence fitness selection will kick back in to grow the
trees again.
We speculate that in a finite population
it will become possible that the bloated trees become so large that in
any generation the expected number of times
crossover disrupts the high fitness core
near the root node falls well below one per generation
Thus removing the driving force which has been growing the trees.
Hence their may be a balancing point with the gambler's ruin
near
$$\mbox{tree size} \approx {\rm popsize} \times \mbox{core codesize}$$
In the above experiments
$500 \times 497 = 248\,500$.
Figure~\ref{fig:bmux6_p50_size}
(page~\pageref{fig:bmux6_p50_size})
shows ten extended runs with a
reduced population size and no size limits.
The smaller population size means GP is usually no longer able to solve the
problem nevertheless as expected
the run shows similar characteristics to the
larger population.
The size of the core code is not known but
we would anticipate it would be no bigger than in runs
where high fitness trees do evolve.
Thus we had anticipated an edge to bloat at about 25\,000.
All ten extended runs with the small population behaved similarly.
They all bloated
(max tree size between
3\,600\,000
and 115\,000\,000)
but at the end of each run the average tree size was between
0.01\%
and 6\% of the maximum tree size.
(Only two runs reach max fitness~64.)
Across ten runs and over 100\,000 generations
the median mean tree size in the population was
42\,507
and the median smallest was
10\,513.
\begin{figure
\centerline{\includegraphics[scale=0.175]{graph/bmux6_p50_size}}
\vspace*{-2ex}
\caption{
\label{fig:bmux6_p50_size}
Extended runs pop=50.
Blue horizontal
curve shows number of GP individuals
with
fitness $< 64$
(rescaled by 0.5
and
smoothed).
In populations with huge trees,
even the smallest tree is big
and
in many gens
whole pop
has same fitness.
Without a fitness differential, tree size may rise or fall.
}
\end{figure}
\section{Conclusions}
\label{sec:conclude}
\noindent
We have studied long term evolution
(far longer than anything reported in GP).
In our populations
after thousands, even tens of thousands, of generations
trees evolve to be extremely stable so that
there may be tens or even hundreds of generations where everyone
has the same fitness.
This means that there is no selection
and we see
bloat become an apparently random walk,
with both increases and {\em falls} in program size.
Further we suggest,
in finite populations,
bloat is naturally limited by
a gambler's ruin process.
The evolved (albeit narrowly defined) introns
do not explain the extreme fitness convergence seen.
Instead we have described the evolution of functions with constant
output
(zero entropy).
These shelter the root node
and are evolved to be resilient to crossover.
The evolved
constants form a protective ring
around highly stable effective code centred on the root node
and head huge
sacrificial subtrees of ineffective code.
(These may contain 100\,000s of useless instructions.)
This ineffective code is primarily responsible for the low number of
low fitness individuals found in highly evolved populations.
Even after evolving for thousands of generations,
in small populations,
we continue to see the impact of fitness selection on
the distribution of tree sizes.
And, although the distribution of tree sizes versus their depths
is close to that of random trees,
the distribution of tree sizes does not approach the limiting
distribution we predicted assuming no fitness~\cite{poli:2007:eurogp}.
GP code
available via anonymous
\href{ftp://ftp.cs.ucl.ac.uk/genetic/gp-code/GPbmux6.tar.gz}
{FTP}
and
\href{http://www.cs.ucl.ac.uk/staff/W.Langdon/ftp/gp-code/GPbmux6.tar.gz}
{\tt http://www.cs.ucl.ac.uk/staff/W.Langdon/ftp/}
\href{http://www.cs.ucl.ac.uk/staff/W.Langdon/ftp/gp-code/GPbmux6.tar.gz}
{\tt gp-code/GPbmux6.tar.gz}
\bibliographystyle{splncs}
| {'timestamp': '2017-03-27T02:08:46', 'yymm': '1703', 'arxiv_id': '1703.08481', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08481'} | arxiv |
\section{Conclusions and Future Work}
Our framework discovers the evolution of today's news stories from large news archives. We have presented case studies that demonstrate the possibility of using the resulting evolution-related documents as training data to predict the relevant entities for future news articles. Based on our case studies, we plan to expand our work in the direction of prediction where our framework will be able to generate warnings regarding insurgent activities, predict a timeline for developing a new concept, and forecast emerging stories. Furthermore, we plan to incorporate user feedback to improve the performance of our framework by modifying the optimization hyperparameters to meet the user's expectations.
\section{Experimental Results}
For our experiments, we use a corpus of 400,842 New York Times articles published between January 2000 and June 2016. The corpus contains 3,320,886 unique entities. To the best of our knowledge, there are no publicly available labeled benchmark datasets that can allow us to perform a supervised evaluation of our framework. Our evaluations are based on a combination of statistics- and human participant-based studies. We seek to answer the following questions.
\begin{enumerate}
\item How well does our approach reflect the evolution of a story? (Section~\ref{sec:exp:contin})
\item How does our method compare to other methods such as clustering and similarity-based storytelling? (Section~\ref{sec:exp:comp})
\item How do the various proposed regularizations impact story quality? (Section~\ref{sec:use})
\item How does the statistical significance for the position of the turning points change while modifying the different hyper-parameters of our optimization? (Section~\ref{sec:exp:sig})
\item What is the repeatability of the optimization? (Section~\ref{sec:exp:rep})
\item Can we use the set of highly relevant documents with respect to a seed document to predict which entities are expected to appear in a future document? (Section~\ref{sec:exp:pred})
\end{enumerate}
\subsection{Evaluation of Chain Continuity} \label{sec:exp:contin}
The lack of a benchmark dataset makes it very difficult to evaluate the performance of our optimization framework. To address this issue, we designed a user study motivated by the work of Shahaf \textit{et al.}~\cite{shahaf_connecting_2010}. We picked four different topics and two different random documents related to each topic as seed documents. The topics selected were \textit{aviation}, \textit{Brexit}, \textit{ISIS}, and \textit{tensions between North and South Korea}. Four evaluators were asked to score three topics each, so that each topic had a total of six evaluations\footnote{Evaluation questions available at: \url{https://storyeval.herokuapp.com/}}.
For each segment, we selected the document with the highest weight. Four past documents were selected for each seed document. Users evaluated four criteria on a scale of 1 to 5, with five being the best, for each sequence:
\begin{itemize}
\item \textit{Familiarity:} How familiar the person is with this topic.
\item \textit{Relevance:} Do the documents seem relevant to the topic?
\item \textit{Coherence} Is the chain coherent? A lower score is provided if there is a document in the chain that does not belong to the topic.
\item \textit{Broadness:} Does each document provide new information guaranteeing a slight shift in topic over time?
\end{itemize}
The average scores per criterion are presented in Fig.~\ref{fig:human_range}. The results indicate that our algorithm performs, on average, above a score of 3, which indicates that the chains are coherent, relevant, and broad enough to capture evolution. An interesting observation is that the \textit{Brexit} topic, which had the lowest average familiarity score, also has the lowest scores for coherence and relevance, indicating that such a study might be biased toward the familiarity of the topic.
\begin{figure}
\includegraphics[width=\linewidth]{human_range}
\caption{ Average scores obtained for each metric per topic, a higher score is better (max. 5.0). \label{fig:human_range}}
\centering
\end{figure}
\subsection{Comparison with Other Methods} \label{sec:exp:comp}
We compare the outcomes of our framework with two other methods: (1) a $k$-means clustering, which combines the time feature with entities and (2) a similarity-based approach where consecutive nearest neighbors are selected as a chain starting with the seed document. We selected one best document per time-segment for this evaluation using our method. For the $k$-means clustering based approach we selected one document closest to the centroid of each cluster as a relevant document. For the similarity-based approach, we used the sequence of documents generated from the seed document as a path. Notice that the two alternative approaches focus on distance or similarity, while our objective function is designed to capture diffusion. Hossain \textit{et al.} introduced the concept of \textit{dispersion coefficient} in evaluating the Storytelling algorithm \cite{hossain_storytelling_2012}. We use the same concept to evaluate the quality of a chain of documents $\{d_0$, $d_1$, . . ., $d_{n-1}\}$, containing $n$ articles.
\begin{equation*}
\psi = 1 - \frac{1}{n-2}\sum_{i=0}^{n-3}\sum_{j=i+2}^{n-1} \text{disp}(d_i, d_j)
\end{equation*}
\noindent where
\begin{equation*}
\text{disp}(d_i, d_j) =
\begin{cases}
\frac{1}{n+i-j} &\quad\text{if soergel}(d_i, d_j) < \theta \\
0 &\quad\text{otherwise}
\end{cases}
\end{equation*}
The dispersion coefficient of a chain of documents is 1.0 only if consecutive pairs of documents meet a distance threshold $\theta$. The coefficient is 0 when every pair of documents in the chain satisfies the distance threshold.
We generated chains for 116 different seed documents using all three approaches under consideration. Figure~\ref{fig:diffusion} compares the average dispersion coefficient versus the distance threshold. Figure~\ref{fig:diffusion} shows that the average dispersion of our diffusion-based method provides the highest dispersion coefficients for any distance threshold. This indicates that our method generates chains with smooth transition of topics, which is our goal.
\begin{figure}
\includegraphics[width=\columnwidth]{diffusion}
\caption{ Comparison of average dispersion coefficient for stories created using our diffusion based approach, a clustering based algorithm, and a similarity based technique. Our approach results in the best (highest) dispersion. \label{fig:diffusion}}
\centering
\end{figure}
\subsection{Use Case Study} \label{sec:use}
In this experiment, we perform a use case study to compare the results of our diffusion-based approach with two preliminary versions of our objective function, as well as with the similarity-based approach described in Sec.~\ref{sec:exp:comp}. We execute each of these methods for the same seed document and select the document in the middle of each segment. The number of segments is set to 5.
Fig.~\ref{fig:stories}(a) shows the story generated using the formulation presented in Sec.~\ref{subsec:v1}. In this case, because the date penalty was not included, one event overlaps with the other, and thus only four segments are obtained. The topics of each document are about the European Union, but lack a common thread. Fig.~\ref{fig:stories}(b) shows a story generated using by optimizing the objective function presented in Sec.~\ref{subsec:v3}, which is in the continuous space and includes the date and similarity penalties. An analysis of this story shows that there is no coherent thread, which is caused by the lack of weights that indicate the relevance of a document.
Fig.~\ref{fig:stories}(c) shows the story resulting from our diffusion-based approach. At first glance, some of the articles seem disconnected from a continuous thread. However, after a brief analysis, we can find a very relevant thread: the first article is about the financial assistance required by Greece and Portugal because of the severe crisis. The second article mentions how Germany made efforts to keep Greece in the Euro zone, because of fear of the consequences of Greece leaving. The next article mentions the future plans of the German chancellor with respect to the European Union and the imposed austerity, and in particular mentions that Britain's prime minister expected the support from Ms. Merkel. The article before the seed document mentions the latest European crisis, and how several countries were ``rebelling'' against the German-mandated austerity. The seed document talks about immigration being one of the main motivations for Brexit. The article mentions that there was an influx of immigrants on 2015, presumably escaping from the economical crisis in their countries of origin. This is a coherent and relevant thread consisting of different events, which was our ultimate goal.
The story obtained using the similarity-based approach, shown in Fig.~\ref{fig:stories}(d), is also coherent and relevant. However, the story completely revolves around Brexit, and a simple keyword search about the topic would probably return similar results. Thus, we consider that our result provides a better insight into the possible paths that lead to the event described in the seed document.
\begin{figure}
\includegraphics[width=\linewidth]{stories}
\caption{Stories generated using (a) the objective function presented in Sec.~\ref{subsec:v1}, (b) the formulation presented in Sec.~\ref{subsec:v3}, (c) our diffusion-based approach and (d) a similarity-based approach. \label{fig:stories}}
\centering
\end{figure}
\subsection{Statistical Significance Analysis} \label{sec:exp:sig}
Evaluation using precision, recall, and other variants does not apply in the context of our work because of the lack of labeled datasets suitable for our task.
An alternative approach, other than the user studies and quality-evaluation using an unsupervised metric like dispersion coefficient, is to use a statistical analysis of the significance (p-value) as a sanity check to make sure that our formulation obtains results that have a very low probability of being obtained by random chance.
Our objective function has several user-modifiable parameters that can change analytic viewpoints. In this section, we will explore how the significance changes with varying parameters.
For our problem, we defined $p_{TP}$ as the p-value for the turning points vector $\mathcal{T}$. We generated $m$ random samples $\mathcal{T}_S$ which are of the same size as $\mathcal{T}$. Then, we compared each of the $m$ random samples with $\mathcal{T}$ by computing their element-wise difference and comparing it to a tolerance $\beta$, i.e., $(\mathcal{T}_s-\mathcal{T}) \leq \beta$. We counted the number of times this condition was satisfied in an auxiliary variable $a$. Finally, we returned $p_{TP} = \frac{a}{m}$.
The experiments were conducted by computing the $p_{TP}$ of several different configurations. We precomputed 100,000 random samples. Then, we used a number of random seed document sets and ran the optimization routine for different configurations. We finally averaged the $p$ values across the documents.
One of the configurations relates to the publication dates of the articles. The dates are scaled to a continuous range. In Fig.~\ref{fig:significance}(a), it is evident that the $p_{TP}$ value significantly decreases while increasing the \textit{maximum date} value. This is because the range for the turning points increases with the scaling. Fig.~\ref{fig:significance}(a) also shows that our approach generates statistically significant results with any value of the variance for the gamma function $\hat{\sigma}^2$, and that the change in significance while varying this parameter is limited.
\begin{figure*}
\includegraphics[width=\linewidth]{significance}
\begin{flushleft}
\hspace{3.8cm}\textbf{(a)}\hspace{5.9cm}\textbf{(b)}\hspace{5.1cm}\textbf{(c)}
\end{flushleft}
\caption{Significance of turning points vector vs. (a) variance of gamma function, (b) topical divergence and (c) date overlap penalty. Each data series includes a predicted trend line as well as upper and lower 95\% confidence lines. \label{fig:significance}}
\centering
\end{figure*}
The standard deviation parameter for overlap $\sigma$ controls the width of the bell-shaped curve shown in Fig.~\ref{fig:overlap}. A penalty is added if any of the previous turning points fall within this curve. Figure~\ref{fig:significance}(c) shows that as the overlap $\sigma$ increases, the $p_{TP}$ value increases. The maximum topical divergence parameter is used during the candidate generation stage to filter documents that are above this value. Figure~\ref{fig:significance}(b) shows that when the topical divergence increases, the $p_{TP}$ value decreases, albeit slightly. In general, our approach generates statistically significant results even with varying parameters.
\subsection{Local Optimization: Repeatability of Concepts } \label{sec:exp:rep}
One of the crucial elements of local optimization, as used in our framework, is that it may produce multiple results with different executions for the same set of seed documents and configurations. From an analytic perspective, multiple results for the same seed set provide a deeper understanding of the evolution. However, too much diversity in the results for the same seed set may be overwhelming for users. In this experiment, we analyze the repeatability of the results, in particular for the turning points, for the same set of seed sets. We selected random seed documents from different topics and repeated the optimization 100 times for each seed keeping track of the resulting turning-point vector, each time with a different initialization for the optimization routine. The collected vectors were compared pairwise and grouped into \textit{buckets} based on similarity. To define similarity in this context, we first define a match as when the distance between two turning points from different vectors is below a threshold, $\zeta$. Two vectors are similar if the number of matches is above a \textit{minimum match} parameter. Ideally, the number of buckets should be small (close to 1). If the number of buckets is 100, this means that none of the pairs of vectors fulfill the conditions mentioned above.
\begin{figure}
\includegraphics[width=\columnwidth]{repeatability}
\caption{Number of buckets as a function of distance threshold $\zeta$, with varying minimum matches. \label{fig:repeat}}
\centering
\end{figure}
In Fig.~\ref{fig:repeat}, we observe how the average of the number of buckets for the seed documents changes with respect to the distance threshold $\zeta$ and a \textit{minimum matches} score. $\zeta$ is varied from one to 100, since this is the range of the publication dates in this experiment, while the number of \textit{minimum matches} is changed from one to four.
Figure~\ref{fig:repeat} shows that as the distance threshold increases, the number of buckets rapidly decreases. This indicates that, even with different initializations of the optimization routine with multiple executions for the same seed, we obtain similar chains and time segments. This helps the user to keep the analysis focused on a relevant set of evolving concepts for the same seed document.
\subsection{Prediction} \label{sec:exp:pred}
Our framework provides past documents as an evolution of the story of a given seed document. All the past documents have associated weights reflecting their importance in the evolution.
These relevant documents can be used to study the evolution over time of the prominent entities found in the seed document. In this experiment, we examine if we can leverage these relevant documents to not only study the evolution of the entities in the past, but also to predict, using a simple linear regression, the future evolution. A more specific question is: which entities will appear in an article published in the future given a seed document?
For this experiment, we divided the set of relevant documents based on the segments into a training dataset (four segments) and a testing dataset (one segment). Next, we built a table which consists of all pairs of words in all pairs of the documents of the training set. This table contains the difference in publication dates, as well as a pair of entities and corresponding tf-idf weights that appear in a pair of documents. That is, the training data reflects how far in time a pair of entities may appear and what are the tf-idf scores of those entities when they appear. We built a linear regression model for each of the terms appearing in the \textit{future} documents, taking into account the difference in publication dates as an extra feature.
\begin{figure}
\includegraphics[scale=0.6]{prediction_original}\\
(a)A word-cloud of a seed document.\\
\includegraphics[width=\columnwidth]{prediction_expected}
(b) On the left, we show the ground truth while on the right we show the predicted word-clouds. The words are sized according to the original and predicted weights, respectively. The publication date difference between the seed document and the predicted documents ranges between 4 and 10 days.
\caption{An experiment on predicting a future document.
\label{fig:wc_orig}}
\centering
\end{figure}
When a new prediction is requested, we use the linear regression models that include the entities of the seed document, to predict the weight of the entities in the \textit{future} document. In Fig.~\ref{fig:wc_orig}(a), we show the word-cloud of a sample seed document. We then use our algorithm to predict how the word-clouds of three future documents would look like in a range between 4 and 10 days after the publication date of the original article. The actual and predicted word-clouds are presented in Fig.~\ref{fig:wc_orig}(b). As can be seen, even with a simple linear regression-based prediction model, for most of the cases the predicted documents have a match of at least two of the entities from the ground truth (e.g., \textit{Paris attack}, \textit{Belgium}, and \textit{Paris}). The advantage of using the output of our model for prediction is that we exploit both the similarity of documents within a segment, and the diffusion of a topic across segments, to obtain better results.
We expect that a more sophisticated algorithm would be able to improve these results. The main disadvantage of this method is that if no entities from the seed document appear in the training set, then no entities can be predicted, and of course, unseen entities will not be predicted.
\section{Introduction}
The pervasiveness of the Internet has greatly facilitated editors to publish a large number of news articles everyday in any topic, practically without any restrictions of page-limits. Thus, the number of articles available to avid readers increases every day at a very fast pace. Many business and government organizations track these news articles to study public sentiments, business directions, progression of events, and many other aspects of economic and socio-political issues. However, tracking topics from different perspectives is a difficult task given that one news-story of today's interest could have evolved from another story of the past, thus forming a chain of relevant events. This leads to the concept of \textit{diffusion theory}~\cite{angulo_concepts_1980} which refers to the change of the distributional patterns of a phenomenon over time.
\begin{figure}[!b]
\includegraphics[width=\columnwidth]{example_diffusion.pdf}\\
(a) A diffusion-based story.\\
\includegraphics[width=\columnwidth]{example_similarity}\\
(b) A similarity-based story.
\caption{ A diffusion-based approach captures documents from the past reflecting a smooth transition of the evolving story. In contrast, a similarity-based approach focuses on a narrow range of the timeline.
\label{fig:diffusionandsimilarity}}
\centering
\end{figure}
While capturing such diffusions over a timeline is still a challenge, researchers have targeted the problem of tracking stories in different guises, e.g., storytelling \cite{hossain_storytelling_2012,kumar_algorithms_2008}, storyboarding \cite{md_abdul_kader_connecting_2016}, connecting the dots \cite{shahaf_connecting_2010,hossain_connecting_2012}, and metro maps \cite{shahaf_information_2015}. Most of these methods find underlying connections between articles using a similarity-based network of documents. Their objective is mainly focused on generating a cohesive thread of a story. An extensive usage of cohesion may result in stories that revolve around a single \textit{chapter} of the evolving thread of the story. Figure~\ref{fig:diffusionandsimilarity} (a) illustrates a scenario generated using our diffusion-based approach, which captures the articles published in the past reflecting the evolution of the story. Figure~\ref{fig:diffusionandsimilarity}(b) presents the results obtained, for the same seed document, using a similarity-based approach to track past documents similar to the article of interest. While our approach brings out the underlying diffusion of concepts and their progression over time, the similarity-based approach provides a coherent story that revolves around a single event --- a drone strike in Kunduz, as shown in both examples.
This paper presents a novel framework that takes as input a large corpus of documents, along with a user-specified set of seed documents. The framework runs through a palette of natural language processing (NLP) and other preprocessing tasks before it reaches its core objective function, which generates a storyline by finding and combining turning points that lead to the seed story. The end-product of the framework is a concise chain of documents from a multitude of news articles to help the user identify the evolution of a story, as shown in Fig.~\ref{fig:diffusionandsimilarity}(a).
The contributions of this paper can be summarized as follows:
\begin{itemize}
\item \textbf{Evolution:} We propose a novel method to discover a chain of documents published in the past given a set of seed documents, where the chain reflects evolution of the concepts in the seed documents.
\item \textbf{Diffusion and similarity:} Our proposed technique captures the underlying diffusion of concepts and has the flexibility to incorporate the similarity concepts from the state-of-the-art methods.
\item \textbf{Prediction:} We demonstrate the potential of the outcome generated by our approach as a tool to predict future states of an evolving story.
\item \textbf{Evaluation:} We conduct a set of experiments to quantitatively evaluate different aspects of our model. Additionally, a human participant-based study demonstrates that the discovered story lines were satisfactory.
\end{itemize}
\section{Related Work} \label{sec:related_work}
Several problems and tasks related to our work have been well studied. These problems include \textit{summarization}, \textit{event detection}, \textit{event extraction}, \textit{event evolution}, \textit{event prediction} and \textit{storytelling}, also known as \textit{connecting the dots}. \textit{Summarization} consists of extracting the most important sentences from a text corpus to help the user understand the main idea of the set of documents~\cite{allan_temporal_2001,radev_newsinessence:_2005,yan_evolutionary_2011,nenkova_survey_2012,binh_tran_structured_2013}.
\textit{Event detection} consists of detecting temporal bursts of highly correlated documents~\cite{yang_learning_1999,yang_improving_2000,kleinberg_bursty_2002}, while \textit{event extraction} aims at obtaining useful knowledge regarding these events~\cite{kuzey_fresh_2014,rospocher_building_2016}. \textit{Event evolution}~\cite{yu_tracking_2015,wu_event_2016} and \textit{topic evolution}~\cite{jo_web_2011,kim_topic_2011,wang_understanding_2013} study how these abstract concepts (\textit{events} and \textit{topics}) evolve over time, based on latent relations within the corpus and temporal information encoded in each document.
The \textit{event prediction} through text mining problem has also been addressed in the literature. Radinsky \textit{et al.}~\cite{radinsky_learning_2012} described a system that uses \textit{causality extraction} to obtain pairs of terms that have a causal relation and that are later used to train a prediction algorithm. Luo \textit{et al.}~\cite{luo_measuring_2016} also address this problem by introducing the concept of \textit{semantic uncertainty}, which is used to estimate the \textit{most certain} next state based on the current state, or event. This approach is particularly useful when there is limited historical data available.
The main component of our framework is focused on the problem of \textit{storytelling}, or \textit{connecting the dots}. There are several approaches that aim to solve this problem for different types of datasets, such as scientific articles~\cite{hossain_connecting_2012}, entity networks~\cite{faloutsos_fast_2004,fang_rex:_2011,hossain_helping_2011}, image collections~\cite{heath_image_2010,suen_nifty:_2013} and document collections~\cite{nallapati_event_2004,kumar_algorithms_2008,shahaf_connecting_2010,ahmed_unified_2011,gillenwater_discovering_2012,zhu_finding_2014,shahaf_information_2015,gu_personalized_2016,wu_event_2016}. Most of the work on this problem uses graph-based representations of a document or entity set~\cite{faloutsos_fast_2004,nallapati_event_2004,hossain_storytelling_2012,gillenwater_discovering_2012,zhu_finding_2014}. \textit{Storytelling} has several different applications, such as intelligence analysis~\cite{hossain_helping_2011,hossain_storytelling_2012}, news recommendation~\cite{gu_personalized_2016}, search engines~\cite{fang_rex:_2011,zhu_finding_2014}, and social network analysis~\cite{faloutsos_fast_2004,suen_nifty:_2013,ning_uncovering_2015}.
Solutions to the \textit{connecting the dots} problem include the use of probabilistic approaches, such as random walks~\cite{shahaf_connecting_2010,zhu_finding_2014,shahaf_information_2015,gu_personalized_2016,wu_event_2016}, Monte Carlo simulations~\cite{ahmed_unified_2011} and determinantal point processes (DPP)~\cite{gillenwater_discovering_2012}. Shahaf \textit{et al.}~\cite{shahaf_connecting_2010} introduced the concept of coherence and coverage to assess the quality of a chain limited by two user-specified endpoints, and then extended this work by building \textit{metro maps}~\cite{shahaf_information_2015} which are formed by several coherent chains that intersect at some points, forming a map-like structure. Gillenwater \textit{et al.} also obtain several coherent chains using a DPP-based model.
Our work has several differences with respect to the previously mentioned methods. First, we use an optimization-based approach similar to the one presented by Shahaf \textit{et al.}~\cite{shahaf_connecting_2010}, but we introduce the concept of \textit{diffusion} to identify the evolution of the concepts in the seed documents. The use of diffusion allows our framework to create stories based on a combination of different events, which is not possible using previously proposed methods.
Second, our work discovers the most relevant documents associated with each turning point to provide a concise summary for each turning point event. Third, we leverage the topic distribution of each document to reduce our search space while keeping important documents for our optimization.
Finally, we suggest the possibility of using the resulting relevant documents to build a regression framework for entity prediction.
\section{Problem Description} \label{sec:problem}
This work focuses on news articles and the entities within the news. The entities detected are persons, organizations, and locations.
Let $\mathcal{D} = \{d_1, d_2,\ldots, d_{|\mathcal{D}|}\}$ be the set of documents and $\mathcal{E} = \{e_1, e_2,\ldots, e_{\mathcal{E}}\}$ be the set of entities in the news corpus. Each document $ d \in \mathcal{D} $ contains a set of entities $ \mathcal{E}_d \subset \mathcal{E}$. Additionally, each document $d$ contains its publication date $t_d$. As part of the preprocessing steps, we apply topic modeling using Latent Dirichlet Allocation (LDA)~\cite{blei_latent_2003} on $\mathcal{D}$, obtaining a topic distribution $T_d$ for each document $d$.
\subsection{What is the expected outcome?} \label{sec:problem:outcome}
Let the user input be a set of seed documents $\mathcal{D}_{seed} \subset \mathcal{D}$, where $|\mathcal{D}_{seed}| \geq 1$. We define a \textit{turning point} in the story $\tau \in \mathcal{T}$ as a specific date in which the story under analysis has a significant change. Let $\mathcal{S}$ be a vector where each element, defined as \textit{segment}, is a pair of consecutive turning points such that $|\mathcal{S}| = |\mathcal{T}| - 1$, and $\mathcal{S} = [(\tau_1,\tau_2), (\tau_2, \tau_3),\cdots,(\tau_{|\mathcal{T}|-1}, \tau_{|\mathcal{T}|})]$.
Our main goal is to split the set of documents in $|\mathcal{S}|$ segments by finding $|\mathcal{T}|-2$ turning points, since the first and last turning points are fixed. For each segment $s \in \mathcal{S}$ we want to find a subset of documents $\mathcal{D}^{s} \subset \mathcal{D}$ that help the user study the evolution of the prominent entities in $\mathcal{D}_{seed}$ through various different events.
\section{Methodology} \label{sec:method}
Our framework comprises two main stages: (1) preprocessing, which creates document and topic models from a text corpus and (2) story generation, which takes a set of seed documents and other constraints as inputs and, via an optimization routine, outputs a story formed by relevant documents that have a common thread, but that belong to different events. Fig.~\ref{fig:framework} illustrates this framework.
\subsection{Preprocessing}
In the preprocessing stage, our framework: (1) extracts entities (e.g., person, location, organization) from the documents, (2) represents each document as a vector of entities, and (3) obtains a topic distribution for each document in our corpus.
We extract entities from the text corpus using standard Named Entity Recognizers~\cite{alias-i_lingpipe_2008,finkel_incorporating_2005}.
Our framework leverages a tf-idf model with cosine normalization \cite{hossain_storytelling_2012} to generate weights $w(e, d)$ for each entity $e \in \mathcal{E}$ in each document $d \in \mathcal{D}$.
\subsection{Story generation} \label{sec:method:candidate}
In this stage, our framework furnishes a candidate set of documents $\mathcal{D}_c \subset \mathcal{D}$ from the entire dataset that satisfy some temporal and topical constraints with respect to the seed documents $\mathcal{D}_{seed}$. The temporal and topical constraints are driven by user input regarding how far back in time the algorithm should track to detect an origin, or, how much deviation the algorithm should allow in terms of topic distribution as compared with the seed set.
The temporal criteria establishes that all of the candidate documents must have been published before the most recent seed document and within a certain minimum threshold $t_{\min}$, i.e., $d_i$ can only be part of $\mathcal{D}_c$ if $t_{\min}< t_{i} < \max(t_{seed})$, where $t_i$ is the publication date of document $d_i$.
The topical criteria expresses, in terms of topic distributions, how much deviation the candidate documents can have from the seed documents when optimizing for a diffusion and cohesion objective. For each document $d_{seed} \in \mathcal{D}_{seed}$, we compute the KL-divergence~\cite{kullback_information_1951}, or \textit{topical divergence}, between the topic distribution of the seed document $T_{d_{seed}}$ and the $T_d$ of all the documents $d \in \mathcal{D}$. Document $d$ is included in $\mathcal{D}_c$, only if $\forall d_{seed} \in \mathcal{D}_{seed} \left( \text{KL-divergence}(T_d,T_{d_{seed}}) \leq \alpha \right)$, where $T_d$ is the topic distribution of document $D$, obtained using the LDA \cite{blei_latent_2003} and $\alpha$ is a user-defined parameter. In Section~\ref{sec:method:formalizing}, we will refer to $\mathcal{D}_c$ by $\mathcal{D}$, for simplicity.
Finally, the framework optimizes fitment of a story model that identifies turning points of the story over a timeline and provides relevant documents within each segment. The outcome of the optimization routine helps understand the evolution of the news-story described in the seed document(s). This essential is further described in Section~\ref{sec:method:formalizing}.
\section{Formalizing Our Approach} \label{sec:method:formalizing}
In this section, we gradually introduce the concepts and formulations that give shape to our model, which has the goal of obtaining a coherent story from separate events. We present our ideas iteratively and explain why and how new penalty terms were developed to achieve our goal.
\subsection{Defining incoherence}
The objective is to ensure that the documents within each time segment of $\mathcal{S}$ are coherent. A simplistic approach is to minimize the distance of all pairs of documents within each time segment. For simplicity, we use the notation $d^s$, to indicate the segment $s$ to which document $d$ belongs to, i.e., $d^{1}$ is defined as a document in the segment between $\tau_1$ and $\tau_2$. We define this distance as incoherence:
\begin{equation} \label{eq:incoherence1}
\text{incoherence}_1(s) = \frac{\sum_{i \neq j}^{|P^s|}{||d_i^s-d_j^s||_{\varrho}}}{|P^s|}
\end{equation}
\noindent where $\mathcal{S}$ is the set of segments, $d^s$ is a document s.t. $d^s \in D^s$, where $D^s$ is the set of candidate documents that are within segment $s$. $P^s$ is a set of pairs $(i, j)$ that represent the different 2-permutations of the indices of pairs of documents $d_i^s$ and $d_j^s$, computed using the following equation.
\begin{equation} \label{eq:perms}
|P^s|=\frac{|D^s|!}{2(|D^s|-2)!}=\frac{|D^s|^2-|D^s|}{2}
\end{equation}
\subsection{Defining a distance metric and forming an initial objective function} \label{subsec:v1}
In Eq.~\ref{eq:incoherence1}, the distance computation between the weight vectors of two documents is represented as $||\cdot||_\varrho$, where $\varrho$ is substituted by the distance measure chosen. We prefer the Soergel distance between a pair of documents $d_i$ and $d_j$, defined in Eq.~\ref{eq:soergel}.
\begin{equation} \label{eq:soergel}
\text{soergel}(d_i, d_j) = \frac{\sum_{e \in \mathcal{E}}\left|w(d_i,t)-w(d_j,t)\right|}{\sum_{e \in \mathcal{E}}\max\left(w(d_i,t),w(d_j,t)\right)}
\end{equation}
\noindent where $\mathcal{E}$ is the set of all the entities that appear in the dataset, and $w(d, e)$ is the tf-idf weight of entity $e$ for document $d$.
The initial objective function is thus defined as Eq.~\ref{eq:v1}, where $s$ represents the current segment.
\begin{equation} \label{eq:v1}
\mathcal{F}_1(\mathcal{T}) = \sum_{s=1}^{|\mathcal{S}|}{\text{incoherence}}_1(s)
\end{equation}
This initial objective function is not enough to serve the purpose of capturing evolution in terms of diffusion. Eq. \ref{eq:v1} tends to generate one very large segment and many small ones, which is undesirable. Ideally, two documents that were published at distant dates should not belong to the same segment.
Another limitation of the approach in Eq. \ref{eq:v1} is that it uses hard assignments of documents to a single segment, while we would prefer a soft membership of documents to time segments for better analytic flexibility.
\subsection{Including penalty based on time segmentation}
To tackle the problem of generating small segments, we include a new term in our definition of \textit{incoherence}. The new term helps by avoiding segments containing document pairs with distant publication dates. Therefore, a solution with many small segments or a solution with a very large segment will not be the optimal. This term is simply a date difference penalty ($\text{date}_\Delta$).
\begin{equation} \label{eq:date_diff}
\text{date}_\Delta(i, j)=|t_{i}-t_{j}|
\end{equation}
\noindent where $t_{i}$ is the publication date of document $d_{i}$. Although Eq. \ref{eq:date_diff} provides date differences, in practice, we normalize the values to a smaller range and the user can flexibly modify the normalization range.
With this new term, we can redefine incoherence as Eq.~\ref{eq:incoherence2}.
\begin{equation} \label{eq:incoherence2}
\text{incoherence}_2(s) = \frac{\sum_{i < j}^{|P^s|}{\text{soergel}(d_i, d_j)*\text{date}_\Delta(i, j)}}{|P^s|}
\end{equation}
The objective function has the same form of Eq.~\ref{eq:v1}, but uses the new incoherence equation. The advantage of this new formulation is that it reduces the incidence of very small segments significantly. However, the current objective function is not capable of capturing the essence of \textit{diffusion} or \textit{turning point} because it only takes into account coherence of each segment. This can result in very similar segments that do not show the evolution of a story. Another disadvantage is that a document can only be assigned to a single segment, and thus only discrete optimization routines can be used.
\subsection{Introducing unconnectedness}
While we prefer similar documents within a segment, we expect high dissimilarity between the documents of different segments. We call this property of diffusion across segments \textit{unconnectedness}. We expect high \textit{unconnectedness} as expressed by Eq.~\ref{eq:unconn}.
\begin{equation}\label{eq:unconn}
\text{unconnectedness}(s) =\frac{\sum_{i=1}^{|D^s|}\sum_{j=1}^{|G^s|}{\text{soergel}(d_i^s, g_j^s)}}{|D^s|*|G^s|}
\end{equation}
\noindent where $G^s = D - D^s$ is the set of documents that are not within segment $s$, and $g^s \in G^s$.
Combining $\text{unconnectedness}$ with the original objective function, we obtain the following equation.
\begin{equation} \label{eq:v2_distance}
\mathcal{F}_2(\mathcal{T})=\sum_{s=1}^{|\mathcal{S}|}{\left(\text{incoherence}_2(s)-\text{unconnectedness}(s)\right)}
\end{equation}
In practice, we normalized and rescaled these two terms to adjust the importance of minimizing incoherence and maximizing unconnectedness. However, a major problem with this formulation is that because of the conflicting objectives, we cannot easily define which penalty should have the largest effect.
\subsection{Changing to segment similarity} \label{subsec:v3}
To eliminate the conflicting objectives issue, and to obtain a smooth formulation, we introduce the concept of similarity between segments. This penalty, formalized as Eq.~\ref{eq:similarity1}, will measure how similar documents from one segment are with respect to the documents in the other segments.
\begin{equation} \label{eq:similarity1}
\text{similarity}_1(s) = \frac{\sum_{i=1}^{|D^s|}\sum_{j=1}^{|G^s|}{\mathrm{e}^{-{\text{soergel}(d_i^s, g_j^s)}}}}{|D^s|*|G^s|}
\end{equation}
We seek to minimize $\text{similarity}(s)$ for each segment $s$. The updated objective function is:
\begin{equation} \label{eq:v2}
\mathcal{F}_3(\mathcal{T})=\sum_{s=1}^{|\mathcal{S}|}{\left(\text{incoherence}_2(s) * \text{similarity}_1(s)\right)}
\end{equation}
Eq. \ref{eq:v2} allows minimization of incoherence and similarity simultaneously without keeping track of the importance of each other since they are represented as factors. However, this formulation still suffers from two issues: (1) a news article can only belong to a single segment, which means only discrete optimization routines can be used, and (2) it is possible to have several articles that are irrelevant to the story within each segment. We address these issues in the following subsections.
\subsection{From discrete to continuous}
The objective function of Eq. \ref{eq:v2} considers discrete assignments of documents to time segments. This results in lesser flexibility in terms of smoothness and use of optimization routines. To indicate the certainty that a document with time stamp $t$ belongs to a continuous range of time, in our case a segment, where $t^s_L$ is the lower limit or a turning point and $t^s_H$ is the upper limit, a membership function can be defined as:
\begin{equation} \label{eq:gamma}
\gamma(t, t^s_L, t^s_H)=
\begin{cases}
\frac{1}{\sqrt[]{2\pi \hat{\sigma}^2}}\mathrm{e}^{\left(-\frac{(t - t^{s}_L -\hat{\sigma}^2)^2}{2 \hat{\sigma}^2}\right)} &\quad\text{if } t\le t^s_L\\
\frac{1}{\sqrt[]{2\pi\hat{\sigma}^2}}
&\quad\text{if } t^s_L < t < t^s_H\\
\frac{1}{\sqrt[]{2\pi \hat{\sigma}^2}}\mathrm{e}^{\left(-\frac{(t - t^{s}_H + \hat{\sigma}^2)^2}{2 \hat{\sigma}^2}\right)} &\quad\text{if } t^s_H\le t
\end{cases}
\end{equation}
\begin{figure}
\includegraphics[height=1in]{gamma}
\caption{The $\gamma(t, t^s_L, t^s_H)$ function as described in Eq.\ref{eq:gamma}. \label{fig:gamma}}
\centering
\end{figure}
Although Eq.\ref{eq:gamma} is partitioned, it is continuous and smooth because the membership function is formed by two halves of different Gaussian distributions, and a linear section that connects both, as shown in Fig.~\ref{fig:gamma}. The means of the distributions are the lower and higher limits, and the standard deviation $\hat{\sigma}$ for both is selected by the user to modify the shape of the membership function. This score is not a probability, but we can obtain the probability that time stamp $t$ belongs to segment $s$ by dividing the score over the sum of the membership values of $t$ for all segments in $\mathcal{S}$.
With this new concept of membership function, we must update our previous definitions.
\begin{equation}
\text{incoherence}_3(s) = \frac{\sum_{i, j}^{|D| \times |D|}{\Phi *\text{soergel}(d_i, d_j)*\text{date}_\Delta(i, j)}}{\sum_{i, j}^{|D| \times |D|}{\Phi}}
\end{equation}
where
\begin{equation}
\Phi = \gamma(t_{i}, t^s_L, t^s_H)*\gamma(t_{j}, t^s_L, t^s_H)
\end{equation}
Segment similarity can be redefined as:
\begin{equation}
\text{similarity}_2(s) = \frac{\sum_{i,j}^{|D|\times |D|}{\phi*\mathrm{e}^{-{\text{soergel}(d_i, d_j)}}}}{\sum_{i,j}^{|D|\times |D|}{\phi}}
\end{equation}
where
\begin{equation}
\phi = \gamma(t_{i}, t^s_L, t^s_H)*\left(1-\gamma(t_{j}, t^s_L, t^s_H)\right)
\end{equation}
The objective function has the same form of Eq.~\ref{eq:v2}, but uses the new incoherence and similarity equations.
The main advantage of this new formulation is that it is suitable to be used with a larger variety of optimization routines. However, a new problem is introduced with this objective function, which is that it tends to overlap the turning points. Furthermore, we still have the problem of many documents being irrelevant to a segment.
\subsection{Introducing segment overlap penalty}
To avoid overlap of segments (as shown in Fig.~\ref{fig:overlap}) we include a penalty that is high when two turning points are very close to each other. It is defined as:
\begin{equation} \label{eq:overlap}
\text{overlap}=\left(1 + \sum_{m,n, m < n}^{|\mathcal{S}|-1\times |\mathcal{S}|-1}{e^{\left(-\frac{(t^{m} - t^{n})^2}{2 \sigma^2}\right)}}\right)
\end{equation}
\noindent where $t^m$ and $t^n$ are the publication date of two different documents, and $\sigma$ is a hyperparameter that allows the user to set a threshold defining the degree of the allowed overlap.
\begin{figure}
\includegraphics[]{overlap}
\caption{Potential overlap of turning points. \label{fig:overlap}}
\centering
\end{figure}
The objective function with the $\text{overlap}$ penalty is:
\begin{equation} \label{eq:v3}
\mathcal{F}_4(\mathcal{T}) = \sum_{t=1}^{|\mathcal{S}|}\left(\text{incoherence}_3(s)*\text{similarity}_2(s)\right)*\text{overlap}
\end{equation}
\subsection{Adding weights as a relevance factor}
It is difficult for a user to analyze a massive amount of candidate documents given only the time segments. Our framework mitigates this problem by providing a score with each document representing how important it is for this study. This score is a variable for the optimization routine and it is used in the objective function. The variable is represented as a vector $\mathcal{W}$ of length equal to the number of candidate documents. A weight of 1.0 indicates that the document is relevant and 0.0 indicates that it is not.
The updated definitions are Eq.~\ref{eq:incoherence3} and Eq.~\ref{eq:similarity2}, where $w_i \in \mathcal{W}$ is the weight for document $d_i$.
\begin{equation}\label{eq:incoherence3}
\text{incoherence}_4(s) = \frac{\sum_{i, j}^{|D| \times |D|}{w_i * w_j * \Phi *\text{soergel}(d_i, d_j)*\text{date}_\Delta(i, j)}}{\sum_{i, j}^{|D| \times |D|}{w_i * w_j * \Phi}}
\end{equation}
\begin{equation} \label{eq:similarity2}
\text{similarity}_3(s) = \frac{\sum_{i,j}^{|D|\times |D|}{w_i * w_j * \phi * \mathrm{e}^{-\text{soergel}(d_i, d_j)}}}{\sum_{i,j}^{|D|\times |D|}{w_i * w_j * \phi}}
\end{equation}
The objective function has the same form of Eq.~\ref{eq:v3}, but uses the new incoherence and similarity formulations and has $\mathcal{W}$ as input. However, a new problem emerges --- the optimal value is when all the weights are set to zero.
\subsection{Uniformity penalty}
To ensure that only a subset of $\mathcal{D}$ is truly relevant, and to avoid the degenerate case where the optimal value is with all the weights set to zero, we need to minimize the uniformity of the weights vector $\mathcal{W}$. A completely uniform vector $\mathcal{W}$, i.e., all zeros or all ones, will result in a high penalty, while a completely non-uniform weights vector will result in no penalty. The uniformity penalty is:
\begin{equation} \label{eq:uniformity}
\text{uniformity} = \left(1 + \sum_{s=1}^{|\mathcal{S}|}{\left(1 - \frac{\left(\left|\left|\frac{\mathcal{W}_s * \Gamma_s^\top}{\sum{\mathcal{W}_s * \Gamma_s^\top}}\right|\right|_2*\sqrt{|\mathcal{W}_s|}\right)-1}{\sqrt{|\mathcal{W}_s|}-1}\right)}\right)
\end{equation}
\noindent where $\Gamma_e$ is a vector of values returned by the membership function (Eq.~\ref{eq:gamma} for the documents that fall in segment $s$).
\subsection{The final objective function} \label{sec:method:optimization}
The final objective function is shown below.
\begin{equation} \label{eq:v4}
\mathcal{F}_5(\mathcal{T}, \mathcal{W}) = \sum_{s=1}^{|\mathcal{S}|}\left(\text{incoherence}_4(s)*\text{similarity}_3(s)\right)*\text{overlap}*\text{uniformity}
\end{equation}
The objective function is minimized for two vectors: $\mathcal{S}$ and $\mathcal{W}$. The elements $s \in \mathcal{S}$ are bounded between $[0, date_{max}]$ where $date_{max}$ is the value representing the publication date of the most recent news article while 0 represents the earliest document on the candidate dataset. The elements $w \in \mathcal{W}$ are bounded between $[0, 1]$, as stated earlier. We used the quasi-newton limited memory algorithm for bound constrained optimization (L-BFGS-B)~\cite{zhu_algorithm_1997} to minimize our objective function.
| {'timestamp': '2017-12-22T02:08:18', 'yymm': '1703', 'arxiv_id': '1703.08593', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08593'} | arxiv |
\section{Introduction}
\label{Sec.1}
Scene text detection has drawn great interests from both computer vision and machine learning communities because of its great value in practical uses and the technical challenges.
Owing to the significant achievements of deep convolutional neural network (CNN) based generic object detection in recent years, scene text detection also has been greatly improved by regarding text words or lines as objects.
High performance methods for object detection like Faster-RCNN \cite{faster-rcnn}, SSD \cite{ssd} and YOLO \cite{yolo} have been modified to detect horizontal scene texts \cite{deep-text} \cite{yolo-text} \cite{ctpn} \cite{textbox} and gained great improvements.
However, for multi-oriented text detection, methods like Faster-RCNN and SSD which work well for object and horizontal text detection may not be good choices. To illustrate the reasons, first we explain the definitions of indirect and direct regression in detection task.
\begin{figure}
\label{Fig.direct_indirect_regression}
\centering
\subfigure[]{
\includegraphics[scale=0.14]{figures/indirect_regression-eps-converted-to.pdf}}
\subfigure[]{
\includegraphics[scale=0.14]{figures/direct_regression-eps-converted-to.pdf}}
\caption{Visualized explanation of indirect and direct regression. The solid green lines are boundaries of text ``Gallery'', the dash blue lines are boundaries of text proposal, and the dashed yellow vectors are the ground truths of regression task. (a) The indirect regression predicts the offsets from a proposal. (b) The direct regression predicts the offsets from a point.}
\end{figure}
\noindent \textbf{Indirect Regression.} \ For most CNN based detection methods like Fast-RCNN \cite{fast-rcnn}, Faster-RCNN, SSD, Multi-Box \cite{multibox}, the regression task is trained to regress the offset values from a proposal to the corresponding ground truth (See Fig.\hyperref[Fig.direct_indirect_regression]{1}.a). We call these kinds of approaches indirect regression.
\noindent \textbf{Direct Regression.} \ For direct regression based methods, the regression task directly outputs values corresponding with the position and size of an object from a given point (See Fig.\hyperref[Fig.direct_indirect_regression]{1}.b). Take DenseBox \cite{densebox} as an instance, this model learns to directly predict offsets from bounding box vertexes to points in region of interest.
\begin{figure}
\label{Fig.anchor_not_suitable}
\centering
\includegraphics[scale=0.14]{figures/anchor_not_suitable-eps-converted-to.pdf}
\caption{Illustration for the deficiency of anchor mechanism in detecting long and heavily inclined text words or lines. The solid yellow lines are boundaries of the text line and the dashed lines are boundaries of anchors. There is no anchor that has sufficient overlap with the text line in this image.}
\end{figure}
Indirect regression based detection methods may not be effective for multi-oriented text detection, even methods like Faster-RCNN and SSD have reached state-of-the-art performance for object detection and are also implemented for horizontal scene text detection.
The reasons are mainly in three folds.
First, there are few robust methods to generate word-level or line-level proposals for multi-oriented text. Most previous methods could only provide proposals of character-level by extracting connected components.
Second, anchor mechanism in Faster-RCNN may not be an effective solution to generate text proposals. The anchor mechanism can be deemed as rectangular proposals of various sizes and aspect ratios being evenly placed on an image, and setting proposals which have high overlap with ground truths as positive, otherwise as ``NOT CARE'' or negative. However, for multi-oriented scene texts which are long and heavily inclined, there may be no proper anchor that has sufficient overlap with them as shown in Fig.\hyperref[Fig.anchor_not_suitable]{2}.
Third, adopting anchor mechanism may cause the detection system less efficient. Taking horizontal scene text detection as instance, unlike generic objects, horizontal scene texts tend to have larger variation in sizes and aspect ratios, which requires more complicate design of anchors. The anchors used in \cite{deep-text} \cite{textbox} are much more than traditional Faster-RCNN in both scale and aspect ratio. As to multi-oriented text detection, inclined text proposals may be generated by adopting multi-oriented anchors like \cite{dmpn}, however, this will cost much more running time in the meanwhile and the proposal may not be an optimal choice. Based on the analysis above, direct regression based methods which need no proposals beforehand could be a better choice to produce the irregular quadrilateral boundaries for multi-oriented scene texts.
In this paper, we propose a novel multi-oriented text detection method based on direct regression. Our method is particularly beneficial for localizing quadrilateral boundaries of incidental scene texts which are hard to identify the constitute characters and have large variations in scales and perspective distortions.
On the ICDAR2015 Incidental Scene Text benchmark, we obtain F1-measure of 81\%, which is a new state-of-the-art and surpass the second placed method by a large margin. On other popular datasets of focused images, the proposed method also reaches the state-of-the-art performance.
The proposed method has several novelties and advantages.
First, this is the first direct regression based method for multi-oriented scene text detection.
Second, the whole pipeline of the proposed method only has two parts in which one is a convolutional neural network and the other is a one-step post processing call Recalled Non-Maximum Suppression. Modules like line grouping and word partition are removed which saves much effort on tuning parameters.
Third, since our method could predict irregular quadrilateral boundaries, it has great superiority in incidental texts detection task which needs to localize four vertexes of each word-level text.
The rest of this paper is organized as follows: In Section \hyperref[Sec.2]{2} we give a brief review of scene text detection and generic object detection, in Section \hyperref[Sec.3]{3} we introduce details of our proposed method, in Section \hyperref[Sec.4]{4} we present the results on benchmarks and the rationality analysis of the performance, as well as comparisons to other scene text detection systems, and in Section \hyperref[Sec.5]{5} we conclude this paper.
\section{Related Work}
\label{Sec.2}
\noindent{\textbf{Scene Text Detection.}} \ Most scene text detection methods \cite{fcn-text} \cite{ctpn} \cite{huang2013text} \cite{mser1} \cite{yfpan} treat text as a composite of characters, so they first localize character or components candidates and then group them into a word or text line.
Even for multi-oriented text, methods like \cite{yao2012detecting} \cite{yin2015multi} \cite{kang2014orientation} also follow the same strategy and the multi-oriented line grouping is accomplished by either rule based methods or more complex graphic model.
However, for texts in the ICDAR2015 Incidental Scene Text Dataset \cite{karatzas2015icdar}, some blurred or low resolution characters in a word could not be well extracted, which hinders the performance of localization.
Recently, some text detection methods discard the text composition and take text words or lines as generic objects.
The method in \cite{symmetry-text} makes use of the symmetric feature of text lines and tries to detect text line as a whole.
Despite the novelty of this work, the feature it uses is not robust for cluttered images.
The method in \cite{yolo-text} adopts the framework for object detection in \cite{yolo}, but the post-processing relies on the text sequentiality.
The methods in \cite{deep-text} and \cite{textbox} are based on Faster-RCNN \cite{faster-rcnn} and SSD \cite{ssd} respectively. They both attempt to convert text detection into object detection and the performance on horizontal text detection demonstrate their effectiveness. However, constrained by the deficiency of indirect regression, those two methods may not be suitable for multi-oriented scene text detection.
The method in \cite{dmpn} rotates the anchors into more orientations and tries to find the best proposal to match the multi-oriented text. Deficiency of this method is that the best matched proposal may not be an optimal choice since the boundary shape of scene texts is arbitrary quadrilateral while the proposal shape is parallelogram.
\noindent{\textbf{Generic Object Detection.}} \ Most generic object detection frameworks are multi-task structure with a classifier for recognition and a regressor for localization.
According to the distinction of regressor, we divide these methods into direct and indirect regression.
The direct regression based methods like \cite{densebox} predict size and localization of objects straightforwardly.
The indirect regression based methods like \cite{fast-rcnn} \cite{faster-rcnn} \cite{multibox} \cite{ssd} predict the offset from proposals to the corresponding ground truths.
It should be noted that, the proposals here can be generated by either class-agnostic object detection methods like \cite{uijlings2013selective} or simple clustering \cite{multibox}, as well as anchor mechanism \cite{faster-rcnn} \cite{ssd}.
Although most of the recent state-of-the-art approaches are indirect regression based methods, considering the wide variety of texts in scale, orientation, perspective distortion and aspect ratio, direct regression might have the potential advantage of avoiding the difficulty in proposal generation for multi-oriented texts. This is the main contribution of this paper.
\section{Proposed Methodology}
\label{Sec.3}
The proposed detection system is diagrammed in Fig.\hyperref[Fig.whole_pipeline]{3}. It consists of four major parts: the first three modules, namely convolutional feature extraction, multi-level feature fusion, multi-task learning, together constitute the network part, and the last post processing part performs recalled NMS, which is an extension of traditional NMS.
\begin{figure*}
\label{Fig.whole_pipeline}
\centering
\includegraphics[scale=0.26]{figures/pipelinePNG-eps-converted-to.pdf}
\caption{Overview of the proposed text detection method.}
\end{figure*}
\subsection{Network Architecture}
\label{Sec.3.1}
The convolutional feature extraction part is designed so that the maximum receptive field is larger than the input image size $S$.
This ensures the regression task could see long texts and give more accurate boundary prediction.
Considering that the text feature is not as complicated as that of generic objects, our network tends to employ less parameters than models designed for ImageNet to save computation.
The feature fusion part referring to the design in \cite{fcn} combine convolutional features from four streams to capture texts of multiple scales.
However, to reduce computation, we only up-sample the fused feature to quarter size of the input image.
The multi-task part has two branches.
The classification task output $\mathcal{M}_{cls}$ is a $\frac{S}{4} \times \frac{S}{4}$ 2nd-order tensor and it can be approximated as down-sampled segmentation between text and non-text for input images. Elements in $\mathcal{M}_{cls}$ with higher score are more likely to be text, otherwise non-text;
The regression task output $\mathcal{M}_{loc}$ is a $\frac{S}{4} \times \frac{S}{4} \times 8$ 3rd-order tensor.
The channel size of $\mathcal{M}_{loc}$ indicates that we intend to output 8 coordinates, corresponding to the quadrilateral vertexes of the text.
The value at $\left(w, h, c\right)$ in $\mathcal{M}_{loc}$ is denoted as $L_{\left(w, h, c\right)}$, which means the offset from coordinate of a quadrilateral vertex to that of the point at $\left(4w, 4h\right)$ in input image, and therefore, the quadrilateral $\mathcal{B} \left(w, h\right)$ can be formulated as
\begin{equation}
\begin{split}
& \mathcal{B} \left(w, h\right) = \\ & \left\{ L_{\left(w, h, 2n\! -\! 1\right)}\! +\! 4w, L_{\left(w, h, 2n\right)}\! +\! 4h \big| n \in \left\{1,2,3,4\right\}\right\}
\end{split}
\end{equation}
By combining outputs of these two tasks, we predict a quadrilateral with score for each point of $\frac{S}{4} \times \frac{S}{4}$ map.
More detailed structure and parameterized configuration of the network is shown in Fig.\hyperref[Fig.network_structure]{4}.
\begin{figure}
\label{Fig.network_structure}
\centering
\includegraphics[scale=0.12]{figures/network_details-eps-converted-to.pdf}
\caption{Structure of the network.
Left: Detailed components of the convolutional feature extraction and multi-level feature fusion.
The ``ConvUnit(w, h, n)'' represents a convolutional layer of n $w \times h$ kernels, connected by a batch normalization layer and a ReLU layer.
The ``UpSample(n)'' represents a deconvolution layer of $n \times n$ kernels with stride $n$.
Right: The design of multi-task module. ``Scale\&Shift'' is used to stretch and translate the values.}
\end{figure}
\subsection{Ground Truth and Loss Function}
\label{Sec.3.2}
The full multi-task loss $\mathcal{L}$ can be represented as
\begin{equation}
\mathcal{L} = \mathcal{L}_{cls} + \lambda_{loc} \cdot \mathcal{L}_{loc},
\end{equation}
\noindent where $\mathcal{L}_{cls}$ and $\mathcal{L}_{loc}$ represent loss for classification task and regression task respectively. The balance between two losses is controlled by the hyper-parameter $\lambda_{loc}$.
\noindent \textbf{Classification task.}
Although the ground truth for classification task can be deemed as a down-sampled segmentation between text and non-text, unlike the implementation in \cite{fcn-text}, we do not take all pixels within text region as positive, instead, we only regard pixels around the text center line within distance $r$ as positive and enclose positive region with an ``NOT CARE'' boundary as transition from positive to negative (shown in Fig.\hyperref[Fig.gt_input]{5}). The parameter $r$ is proportional to the short side of text boundaries and its value is 0.2.
Furthermore, text is taken as a positive sample only when its short side length ranges in $\left[32 \times 2^{-1}, 32 \times 2^{1} \right]$. If the short side length falls in $\left[32 \times 2^{-1.5}, 32 \times 2^{-1}\right) \cup \left(32 \times 2^{1}, 32 \times 2^{1.5}\right]$, we take the text as ``NOT CARE'', otherwise negative. ``NOT CARE'' regions do not contribute to the training objective. Ground truths designed in this way reduce the confusion between text and non-text, which is beneficial for discriminative feature learning.
The loss function $\mathcal{L}_{cls}$ chosen for classification task is the hinge loss. Denote the ground truth for a given pixel as $y^{\ast}_{i} \in \left\{0, 1\right\}$ and predicted value as $\hat{y_{i}}$, $\mathcal{L}_{cls}$ is formulated as
\begin{equation}
\mathcal{L}_{cls} = \frac{1}{S^{2}} \sum_{i \in \mathcal{L}_{cls}} \text{max}\left(0, \text{sign}\left(0.5 - y^{\ast}_{i}\right) \cdot \left(\hat{y_{i}} - y^{\ast}_{i} \right) \right)^{2}
\end{equation}
Besides this, we also adopt the class balancing and hard negative sample mining as introduced in \cite{densebox} for better performance and faster loss convergence. Hence during training, the predicted values for ``NOT CARE'' region and easily classified negative area are forced to zero, the same as the ground truth.
\noindent \textbf{Regression task.}
Considering that the ground truth values of regression task vary within a wide range, we use a $Scale \& Shift$ module (shown in Fig.\hyperref[Fig.network_structure]{4}) for fast convergence. $Scale \& Shift$ takes the value $z$ from a sigmoid neuron as input and stretch $z$ into $ \hat{z}$ by
\begin{equation}
\hat{z} = 800 \cdot z - 400, \ z \in \left(0, 1\right)
\end{equation}
Here we assume that the maximum positive text size is less than 400. We also use a sigmoid neuron to normalize the values before $Scale \& Shift$ for steady convergence.
According to \cite{fast-rcnn}, the loss function $\mathcal{L}_{loc}$ used in regression task is defined as follows. Denote the ground truth for a given pixel as $z^{\ast}_{i}$ and predicted value as $\hat{z_{i}}$, $\mathcal{L}_{loc}$ is formulated as
\begin{equation}
\mathcal{L}_{loc} = \sum_{i \in \mathcal{L}_{loc}}^{} \left[y^{\ast}_i > 0\right] \cdot \text{smooth}_{L_1} \left(z^{\ast}_{i} - \hat{z_{i}}\right) ,
\end{equation}
\begin{equation}
\text{smooth}_{L_1}\left(x\right) =
\left\{\begin{matrix}
0.5x^2 & \text{if} \left | x \right | < 1 , \\
\left |x\right | - 0.5 & \text{otherwise} .
\end{matrix}\right.
\end{equation}
We choose smooth $L_1$ loss here because it is less sensitive to outliers compared with $L_2$ loss. During training stage, smooth $L_1$ loss need less careful tuning of learning rate and decreases steadily.
\begin{figure}
\label{Fig.gt_input}
\centering
\subfigure[]{
\includegraphics[scale=0.23]{figures/gtmappng-eps-converted-to.pdf}}
\subfigure[]{
\includegraphics[scale=0.3]{figures/input_patch-eps-converted-to.pdf}}
\caption{Visualized ground truths of multi-task. (a) The left map is the ground truth for classification task, where the yellow regions are positive, enclosed by ``NOT CARE'' regions colored in light sea-green. The right map is the ground truth of ``top-left'' channel for regression task. Values grow smaller from left to right within a word region as pixels are farther from the top left corner. (b) The corresponding input image of the ground truths.}
\end{figure}
\subsection{Recalled Non-Maximum Suppression}
\label{Sec.3.3}
After getting the outputs produced by multi-task learning, each point of the output map is related with a scored quadrilateral.
To filter the non-text region, we only preserve points with high score in classification task. However, there will be still densely overlapped quadrilaterals for a word or text line. To reduce the redundant results we propose a post-processing method called Recalled Non-Maximum Suppression.
The Recalled NMS is a trade-off solution for two problems: (i) when texts are close, quadrilaterals between two words are often retained because of the difficulty in classifying pixels within word space, (ii) if we solve problem (i) by simply retaining quadrilaterals with higher score, text region with relative lower confidence will be discarded and the overall recall will be sacrificed a lot. The Recalled NMS could both remove quadrilaterals within text spaces and maintain the text region with low confidence.
The Recalled NMS has three steps as shown in Fig.\hyperref[Fig.recalled_nms]{6}.
\begin{itemize}
\setlength{\itemsep}{0pt}
\setlength{\parsep}{0pt}
\setlength{\parskip}{0pt}
\item First, we get suppressed quadrilaterals $\mathcal{B}_{sup}$ from densely overlapped quadrilaterals $\mathcal{B}$ by traditional NMS.
\item Second, each quadrilateral in $\mathcal{B}_{sup}$ is switched to the one with highest score in $\mathcal{B}$ beyond a given overlap. After this step, quadrilaterals within word space are changed to those of higher score and low confidence text region are preserved as well.
\item Third, after the second step we may get dense overlapped quadrilaterals again, and instead of suppression, we merge quadrilaterals in $\mathcal{B}_{sup}$ which are close to each other.
\end{itemize}
\begin{figure}[H]
\label{Fig.recalled_nms}
\centering
\includegraphics[scale=0.1]{figures/R-NMS-eps-converted-to.pdf}
\caption{Three steps in Recalled NMS. Left: results of traditional NMS (quadrilaterals in red are false detection). Middle: recalled high score quadrilaterals. Right: merging results by closeness.}
\end{figure}
\subsection{Network Implementation}
\label{Sec.3.4}
The training samples of $320 \times 320$ are cropped from scaled images rotated randomly by $0, \ {\pi}/{2}, \ \pi, \ \text{or} \ {3\pi}/{2}$.
The task balance index $\lambda_{loc}$ is raised from 0.01 to 0.5 after the classification task gets well trained. The network should learn what the text is first and then learn to localize the text.
In testing, we adopt a multi-scale sliding window strategy in which window size is $320 \times 320$, sliding stride is $160$ and multi-scale set is $\left\{2^{-5}, 2^{-4}, \cdots, 2^{1}\right\}$.
Pixels on $\mathcal{M}_{cls}$ are deemed as text if their values are higher than $0.7$.
In post processing, the only parameter, overlap ratio, in Recalled NMS is 0.5.
\section{Experiments}
\label{Sec.4}
We evaluate our method on three benchmarks: ICDAR2015 Incidental Scene Text, MSRA-TD500 and ICDAR2013. The first two datasets have multi-oriented texts and the third one has mostly horizontal texts. For fair comparison we also list recent state-of-the-art methods on these benchmarks.
\subsection{Benchmark Description}
\label{Sec.4.1}
\noindent \textbf{ICDAR2015 Incidental Scene Text.} This dataset is recently published for ICDAR2015 Robust Reading Competition. It contains 1000 training images and 500 test images. Different from previous scene text datasets where texts are well captured in high resolution, this dataset contains texts with various scales, resolution, blurring, orientations and viewpoint.
The annotation of bounding box (actually quadrilateral) also differs greatly from previous ones which has 8 coordinates of four corners in a clock-wise manner.
In evaluation stage, word-level predictions are required.
\noindent \textbf{MSRA-TD500.} This dataset contains 300 training images and 200 test images, where there are many multi-oriented text lines. Texts in this dataset are stably captured with high resolution and are bi-lingual of both English and Chinese.
The annotations of MSRA-TD500 are at line level which casts great influence on optimizing regression task.
Lacking of line level annotation and sufficient bi-lingual training data, we did not use the training set and instead, we utilize the generalization of our model trained on English word-level data.
\noindent \textbf{ICDAR2013 Focused Scene Text.} This dataset lays more emphasis on horizontal scene texts. It contains 229 training images and 233 test images which are well captured and clear. The evaluation protocol is introduced in \cite{karatzas2013icdar}.
\subsection{Implementation Details}
\label{Sec.4.2}
The network is optimized by stochastic gradient descent (SGD) with back-propagation and the max iteration is $2 \times 10^{5}$. We adopt the ``multistep'' strategy in Caffe \cite{caffe} to adjust learning rate. For the first $3 \times 10^{4}$ iterations the learning rate is fixed to be $10^{\text{-}2}$ and after that it is reduced to $10^{\text{-}3}$ until the $10^5$th iteration. For the rest $10^5$ iterations, the learning rate keeps $10^{\text{-}4}$. Apart from adjusting learning rate, the hard sample ratio mentioned in Sec.\hyperref[Sec.3.2]{3.2} is increased from 0.2 to 0.7 at the $3 \times 10^4$th iteration. Weight decay is $4 \times 10^{\text{-}4}$ and momentum is 0.9. All layers except in regression task are initialized by ``xavier'' \cite{glorot2010understanding} and the rest layers are initialized to a constant value zero for stable convergence.
The model is optimized on training datasets from ICDAR2013 and ICDAR2015, as well as 200 negative images (scene images without text) collected from the Internet. The whole experiments are conducted on Caffe and run on a workstation with 2.9GHz 12-core CPU, 256G RAM, GTX Titan X and Ubuntu 64-bit OS.
\subsection{Experimental Results}
\label{Sec.4.3}
\noindent \textbf{ICDAR2015 Incidental Scene Text.}
The results shown in Tab.\hyperref[Tab.1]{1} indicates that the proposed method outperforms previous approaches by a large margin in both precision and recall.
To demonstrate the effectiveness of Recalled NMS, we also list the result adopting traditional NMS as the post processing. From Tab.\hyperref[Tab.1]{1} we can see the Recalled NMS give a higher precision mainly because of filtering quadrilaterals between text lines.
Note that the method in \cite{dmpn} which ranks second is indirect regression based multi-oriented text detection and it also treats text detection as object detection. The large margin between our method and this method demonstrates our analysis on the deficiency of indirect regression and superiority of direct regression for multi-oriented text detection.
Some examples of our detection results are shown in Fig.\hyperref[Fig.icdar15_result]{7}.
\begin{table}
\label{Tab.1}
\small
\renewcommand\arraystretch{1.2}
\centering
\caption{Comparison of methods on ICDAR2015 Incidental Scene Text dataset. R-NMS is short for Recalled NMS and T-NMS is short for traditional NMS.}
\begin{tabular}{|c|c|c|c|}
\hline
Algorithm & Precision & Recall & F-measure \\
\hline
\hline
{Proposed (R-NMS)} & \textbf{0.82} & \textbf{0.80} & \textbf{0.81} \\
\hline
{Proposed (T-NMS)} & {0.81} & {0.80} & {0.80} \\
\hline
Liu \emph{et al.} \cite{dmpn} & {0.73} & {0.68} & {0.71} \\
\hline
Tian \emph{et al.} \cite{ctpn} & 0.74 & 0.52 & 0.61 \\
\hline
Zhang \emph{et al.} \cite{fcn-text} & 0.71 & 0.43 & 0.54 \\
\hline
StradVision2 \cite{karatzas2015icdar} & 0.77 & 0.37 & 0.50 \\
\hline
StradVision1 \cite{karatzas2015icdar} & 0.53 & 0.46 & 0.50 \\
\hline
NJU-Text \cite{karatzas2015icdar} & 0.70 & 0.36 & 0.47 \\
\hline
AJOU \cite{karatzas2015icdar} & 0.47 & 0.47 & 0.47 \\
\hline
HUST\_MCLAB \cite{karatzas2015icdar} & 0.44 & 0.38 & 0.41 \\
\hline
\end{tabular}
\end{table}
\begin{figure*}
\label{Fig.icdar15_result}
\centering
\includegraphics[scale=0.09]{figures/c4-1-eps-converted-to.pdf}
\includegraphics[scale=0.09]{figures/c4-2-eps-converted-to.pdf}
\includegraphics[scale=0.09]{figures/c4-3-eps-converted-to.pdf}
\includegraphics[scale=0.09]{figures/c4-4-eps-converted-to.pdf}
\includegraphics[scale=0.09]{figures/c4-5-eps-converted-to.pdf}
\includegraphics[scale=0.09]{figures/c4-6-eps-converted-to.pdf}
\includegraphics[scale=0.09]{figures/c4-7-eps-converted-to.pdf}
\includegraphics[scale=0.09]{figures/c4-8-eps-converted-to.pdf}
\caption{Detection examples of our model on ICDAR2015 Incidental Scene Text benchmark.}
\end{figure*}
\noindent \textbf{MSRA-TD500.} The results of our method on this dataset are shown in Tab.\hyperref[Tab.2]{2}, with comparisons to other representative results of state-of-the art methods.
It is shown that our method could reach the state-of-the-art performance. It should be noted that we did not adopt the provided training set or any other Chinese text data.
Since our method could only detect text in word level, we implement line grouping method based on heuristic rules in post processing.
Our model shows strong compatibility for both English and Chinese, however, we still fail to detect Chinese text lines that have wide character spaces or complex background.
Part of our detection results are shown in Fig.\hyperref[Fig.td500_result]{8}.
\begin{table}
\label{Tab.2}
\small
\renewcommand\arraystretch{1.2}
\centering
\caption{Comparison of methods on MSRA-TD500 dataset.}
\begin{tabular}{|c|c|c|c|}
\hline
Algorithm & Precision & Recall & F-measure \\
\hline
\hline
Proposed & 0.77 & \textbf{0.70} & \textbf{0.74} \\
\hline
Zhang \emph{et al.} \cite{fcn-text} & \textbf{0.83} & 0.67 & 0.74 \\
\hline
Yin \emph{et al.} \cite{yin2015multi} & 0.81 & 0.63 & 0.71 \\
\hline
Kang \emph{et al.} \cite{kang2014orientation} & 0.71 & 0.62 & 0.66 \\
\hline
Yao \emph{et al.} \cite{yao2012detecting} & 0.63 & 0.63 & 0.60 \\
\hline
\end{tabular}
\end{table}
\begin{figure}
\label{Fig.td500_result}
\centering
\subfigure[] {
\label{Fig.sub.td500_result_1}
\includegraphics[width=4cm, height=3cm]{figures/td-1-eps-converted-to.pdf}}
\subfigure[] {
\label{Fig.sub.td500_result_3}
\includegraphics[width=4cm, height=3cm]{figures/td-3-eps-converted-to.pdf}}
\subfigure[] {
\label{Fig.sub.td500_result_7}
\includegraphics[width=4cm, height=3cm]{figures/td2-3-eps-converted-to.pdf}}
\subfigure[] {
\label{Fig.sub.td500_result_8}
\includegraphics[width=4cm, height=3cm]{figures/td2-4-eps-converted-to.pdf}}
\caption{Detection examples of our model on MSRA-TD500. (a)-(b) Chinese text can also be detected due to the model generalization. (c)-(d) Some failure cases for complicated background or wide character space. False and miss detected texts are enclosed by red lines.}
\end{figure}
\noindent \textbf{ICDAR2013 Focused Scene Text.} The detection results of our method on the ICDAR2013 dataset are shown in Tab.\hyperref[Tab.icdar13_result]{3}.
The performance of our method is also the new state-of-the-art.
Apart from the precision, recall and F-measure, we also list the time cost of our method for per image.
From the Tab.\hyperref[Tab.icdar13_result]{3} we can see our method is also competitively fast in running speed.
Failed cases are mainly caused by single character text and the inability to enclose letters at either end.
Part of our detection results are shown in Fig.\hyperref[Fig.icdar13_result]{9}.
\begin{table}
\label{Tab.icdar13_result}
\small
\renewcommand\arraystretch{1.2}
\centering
\caption{Comparison of methods on ICDAR2013 Focused Scene Text dataset.}
\begin{tabular}{|c|c|c|c|c|}
\hline
Algorithm & Precision & Recall & F-measure & Time \\
\hline
\hline
Proposed & 0.92 & 0.81 & \textbf{0.86} & 0.9s \\
\hline
Liao \emph{et al.} \cite{textbox} & 0.88 & \textbf{0.83} & 0.85 & \textbf{0.73s} \\
\hline
Zhang \emph{et al.} \cite{fcn-text} & 0.88 & 0.78 & 0.83 & 2.1s \\
\hline
He \emph{et al.} \cite{he2016text} & \textbf{0.93} & 0.73 & 0.82 & -- \\
\hline
Tian \emph{et al.} \cite{textflow} & 0.85 & 0.76 & 0.80 & 1.4s \\
\hline
\end{tabular}
\end{table}
\begin{figure}
\label{Fig.icdar13_result}
\centering
\subfigure[] {
\label{Fig.sub.icdar13_result_1}
\includegraphics[width=2.5cm, height=3cm]{figures/c2-1-eps-converted-to.pdf}}
\subfigure[] {
\label{Fig.sub.icdar13_result_3}
\includegraphics[width=2.5cm, height=3cm]{figures/c2-3-eps-converted-to.pdf}}
\subfigure[] {
\label{Fig.sub.icdar13_result_4}
\includegraphics[width=2.5cm, height=3cm]{figures/c2-4-eps-converted-to.pdf}}
\subfigure[] {
\label{Fig.sub.icdar13_result_5}
\includegraphics[width=4cm, height=3cm]{figures/c22-1-eps-converted-to.pdf}}
\subfigure[] {
\label{Fig.sub.icdar13_result_7}
\includegraphics[width=4cm, height=3cm]{figures/c22-3-eps-converted-to.pdf}}
\caption{Detection examples of our model on ICDAR2013. (a)-(c) word level detection for cluttered scenes. (d)-(e) Some failure cases for single character text and losing characters at either end. False and miss detected texts are enclosed by red lines.}
\end{figure}
\subsection{Rationality of High Performance}
\label{Sec.4.4}
The proposed method is intrinsically able to detect texts of arbitrary orientation, and able to partition words automatically.
The tremendous improvements in both precision and recall for incidental text is mainly attributed to three aspects.
First, direct regression based detection structure avoids to generate proper proposals for irregular shaped multi-oriented texts and thus is more straightforward and effective for multi-oriented scene text detection.
Second, the restriction of positive text size guarantees the robustness of feature representation learned by deep convolutional neural networks. Features for small texts could fade a lot after the first down-sampling operations, and large texts would lose much context information causing the CNN could only see some simple strokes of the large texts. Texts within a proper scale range could contain both text textures and enough semantic context making the CNN learn more robust scene text features.
Moreover, the classification task which is able to distinguish text and non-text regions providing a solid foundation for regression task.
Third, the end-to-end optimization mechanism to localize text is much more robust than rule based methods.
Previous methods treating line grouping and word partition as post processing are prone to lose much useful information and rely on thresholds chosen, but integrating localization into the network for end-to-end training could well solve the mentioned issues above.
\subsection{Comparison to Other Scene Text Detection Systems}
\label{Sec.4.5}
Here we list and compare with some recent high performance scene text detection methods for better understanding on the superiority of our method. The listed methods are arranged by the time they are proposed.
\noindent \textbf{TextFlow.} TextFlow \cite{textflow} is designed for horizontal scene text detection by extracting character candidates firstly and then group characters into text lines. Its main contribution is to reduce the traditional multi-module system into fewer steps. Due to the more integrated pipeline, it could reach competitive performance for horizontal text detection.
We take benefits of its intuition and design a simpler process to detect text words/lines directly without extracting character candidates or line grouping.
\noindent \textbf{SymmetryText.} SymmetryText \cite{symmetry-text} might be the first work that treats scene text detection as object detection. It proposes symmetric feature and uses it to generate text line proposals directly. However, the symmetric feature is not robust for cluttered scenes or adaptive to multi-oriented text. In our work, we skip the text line proposal generation step and adopt the deep convolutional feature which is more robust and representative.
\noindent \textbf{FCNText.} FCNText \cite{fcn-text} adopts the FCN \cite{fcn} for object segmentation to segment the text region by a coarse-to-fine process. The employment of deep convolutional features ensures accurate localization of text regions. To output the bounding box for each text word/line, FCNText resorts to some heuristic rules to combine characters into groups. In our work, we abandon the character-to-line procedure to get a more straightforward system and less parameters for tuning.
\noindent \textbf{FCRN.} FCRN \cite{yolo-text} is modified from YOLO for scene text detection. Both FCRN and YOLO perform bounding box regression much like direct regression, however, they actually adopt a compromise strategy between direct and indirect regression for they use multiple non-predefined candidate boxes for direct regression, and hopes candidate boxes behave like anchors in \cite{faster-rcnn} after well optimized.
Another important difference between FCRN and our method is that both FCRN and YOLO regard the centroid region as positive, while we regard regions around the text center line as positive. Our definition of positive/text region seems more proper since text features are alike along the text center line.
\noindent \textbf{CTPN.} CTPN \cite{ctpn} can be deemed as an upgraded character-to-line scene text detection pipeline. It first adopts the RPN in Faster-RCNN to detect text slices rather than characters within the text regions and then group these slices into text bounding boxes. The text slices could be more easily integrated into an end-to-end training system than characters and more robust to represent part of the text regions. In our work, we follow a different way by detecting the whole texts rather than part of the texts.
\noindent \textbf{TextBoxes \& DeepText.} TextBoxes \cite{textbox} and DeepText \cite{deep-text} are based on SSD and Faster-RCNN respectively. They both take advantages from the high performance object detection systems and treat text word/line as a kind of generic object. Moreover, they both set anchors to have more varieties and can only detect horizontal scene texts. In our work, we perform the regression by a direct way and can tackle with multi-oriented text detection.
\noindent \textbf{DMPN.} DMPN \cite{dmpn} is an indirect regression based method and it also treats text detection as object detection. Unlike TextBoxes or DeepText, it introduces a multi-oriented anchor strategy to find the best matched proposal in parallelogram form to the arbitrary quadrilateral boundaries of multi-oriented texts. However, as \cite{dmpn} itself refers, DMPN relies on the man-made shape of anchors which may not be the optimal design and this fits well with our analysis on the drawbacks of indirect regression. The large margin of performance between DMPN and our method on ICDAR2015 Incidental Text benchmark also verify the significance of our work.
\section{Conclusion}
\label{Sec.5}
In this paper, we first partition existing object detection frameworks into direct and indirect regression based methods, and analyze the pros and cons of both methods for irregular shaped object detection.
Then we propose a novel direct regression based method for multi-oriented scene text detection.
Our detection framework is straightforward and effective with only one-step post processing. Moreover it performs particularly well for incidental text detection.
On the ICDAR2015 Incidental Scene Text benchmark, we have achieved a new state-of-the-art performance and outperformed previous methods by a large margin.
Apart from this, we also analyze the reasons of the high performance and compare our method to other recent scene text detection systems.
Future work will focus on more robust and faster detection structure, as well as more theoretical research on regression task.
{\small
\bibliographystyle{ieee}
| {'timestamp': '2017-03-27T02:03:58', 'yymm': '1703', 'arxiv_id': '1703.08289', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08289'} | arxiv |
\section{Introduction}
\label{sec:introduction}
There has been renewed recent interest in the design of efficient and robust dust-collecting robots~\cite{prassler2000short,fiorini2000cleaning}.
The oppression of constant dust raining over our heads calls out for immediate attention. Furthermore, the increased cost
of legal human labor, and increased penalties for employing illegal immigrants, has made dust-collection all the more critical to automate~\cite{jones2006robots,tribelhorn2007evaluating}.
However, all of the robotic solutions have focussed exclusively on what we define (see \dref{def:active_robot} for a precise mathematical definition) as \emph{active dust-collecting robots}. Informally, these are traditional robotic solutions, where the robot locomotes to collect dust. It is understandable why this seems like a natural choice as humans equipped with vacuum cleaners are, after all, also active dust-collectors.
Unfortunately, active dust collection presents several challenges: (1) \emph{Practical:} they require locomotion, which requires motors and wheels, which are expensive and subject to much wear and tear, (2) \emph{Theoretical:} most active dust-collectors are wheeled robots, which are subject to nonholonomic constraints on motion, demanding complex nonlinear control even for seemingly simple motions like moving sideways~\cite{doh2007practical,choset2001coverage,ulrich1997autonomous}, (3) \emph{Human factors:} several of our users in our user study expressed disgust, skepticism, and sometimes terror, about the prospect of sentient robots wandering around their homes, for example:
\begin{quote}
I don't want a f*cking robot running around all day in my house.
\end{quote}
In this paper, we propose a completely new paradigm for dust collection: \emph{passive dust-collecting robots} (see \dref{def:passive_robot} for a precise mathematical definition). Informally, these are revolutionary new solutions that are able to collect dust \emph{without any locomotion}!
As a consequence, passive dust-collecting robots address all of the above challenges: (1) \emph{Practical:} Because they have no moving parts like wheels or motors, they are both inexpensive and incur no wear and tear, (2) \emph{Theoretical:} because passive dust-collectors can be trivially parallel transported to the identity element of the $\mathbb{SE}(2)$ Lie Group, they require no explicit motion planning (in situations where parallel transport is inefficient, the robot can be physically transported to the identity element), (3) \emph{Human Factors:} as passive dust-collecting robots are identical to other passive elements in our homes and work places (like walls, tables, desks, lamps, carpets), their adoption into our lifespace is seamless.
\begin{table}[t!]
\centering
\begin{tabular}{>{\centering\arraybackslash}m{0.5in}>{\centering\arraybackslash}m{0.5in}>{\centering\arraybackslash}m{0.5in}}
\toprule
& Active & Passive \\
\midrule
Practical & \Sadey[2][red] & \Smiley[2][yellow]\\
Theoretical & \Sadey[2][red] & \Smiley[2][yellow]\\
Human Factors & \Sadey[2][red] & \Smiley[2][yellow]\\
\bottomrule
\end{tabular}
\caption{Passive dust-collection outperforms active dust-collection in all metrics}
\end{table}
In addition, we present and analyze a mathematical model of dust collection. Using our model, we can, for the first time, answer which robot-type is more efficient. This is a critical question to consider in order to inform future cleaning choices.
Our analysis reveals that for a certain choice of constants, a passive dust cleaning robot is more efficient than its active counterpart. Through a user study, we contrast this with user's perceived perception of robot efficiency and what factors influence their choices.
To explore what choices are actually made we leveraged a field study of Carnegie Mellon's Robotics Institute to determine the prevalence of each robot type. This study reveals that passive dust collecting allows for a wider range of morphologies, suggesting that passive dust collecting is a more inclusive characterization. Furthermore, we see that rather than two paradigms there is a continuum of dust collecting robots.
Our work makes the following contributions:
\textbf{Mathematical Formulation.} We present a model of active and passive dust collecting robots followed by an efficiency tradeoff analysis.
\textbf{Preference User Study.} We surveyed college students to determine what kind of robot they preferred and which they perceived to be more efficient.
\textbf{Field Study.} Using data on the robots of the Robotics Institute we investigate the more popular robotic paradigms.
We believe our work takes a first step in launching a new discussion concerning the nature of robotic dust collection, paving the way for future cleanliness.
\section{A Mathematical Model for Dust Collection}
\label{sec:dust_model}
In order to compare and analyze active and passive dust collecting robots we present a mathematical model of their dust collection capabilities. With this model, we dare to ask: which robot is more efficient?
\subsection{Dust Model}
We model dust as a pressureless perfect fluid, which has a positive mass density but vanishing pressure. Under this assumption, we can model the interaction of dust particles by solving the Einstein field equation, whose stress-energy tensor can be written in this simple and elegant form
\begin{equation}
T^{{\mu \nu }}=\rho U^{\mu }U^{\nu }
\end{equation}
where the world lines of the dust particles are the integral curves of the four-velocity $U^{\mu }$,
and the matter density is given by the scalar function $\rho$.
Remarkably, unless subjected to cosmological radiation of a nearby black hole, or a near-relativistic photonic Mach cone, this equation can be solved analytically, resulting in dust falling at a constant rate of $\alpha$.
We model our robots as covering 1 unit$^{2}$ area of space-time. We present our models for passive and active robots before performing comparative analysis.
\subsection{Pasive Robot Model}
\label{sec:passive_model}
We provide the following formalism:
\begin{mydef}
We define a \underline{passive dust collecting robot} as a robot that does not move, collecting the dust that falls upon it.
\label{def:passive_robot}
\end{mydef}
\begin{lemma}
The dust-collecting capability of a passive dust-collecting robot is given by
\begin{equation}
D_{passive} \coloneqq \alpha
\label{eqn:passive}
\end{equation}
\end{lemma}
\subsection{Active Robot Model}
\label{sec:active_model}
We provide the following formalism:
\begin{mydef}
We define an \underline{active dust collecting robot} as a robot that moves around the space, actively collecting dust.
\label{def:active_robot}
\end{mydef}
We model our active robot as driving at speed $\beta$. We assume that our robot can only active collect dust of height $h$.
This assumption is drawn from IRobot's Roomba, which reportly can get stuck on cords and cables.
As a simplifying assumption we will assume that the robot always collects dust of height $h$, implying that there is always at least dust of height $h$ prior to the robot's operation.
\begin{lemma}
The dust-collecting capability of an active dust-collecting robot is given by
\begin{equation}
D_{active} \coloneqq h\beta^{3} + \frac{\alpha}{\beta}
\label{eqn:active}
\end{equation}
\end{lemma}
\begin{proof}
It is obvious that the robot actively collects $h\beta^{3}$ dust.
However this is not the entire story.
As the robot drives, actively collecting dust, it also passively collects the dust that happens to fall on it.
To model this, we consider the robot passing over some fixed line.
Some portion of the robot is occulding this line for $\frac{1}{\beta}$ seconds. Thus the robot passively collects $\frac{\alpha}{\beta}$ dust.
Thus, combining the active and passive components our active robot collects:
\begin{equation*}
D_{active} \coloneqq h\beta^{3} + \frac{\alpha}{\beta}
\label{eqn:active}
\end{equation*}
\end{proof}
\subsection{Model Comparison}
\label{sec:model_comparison}
We next compare for what tradeoffs there are between passive and active dust cleaning robots. We pose this as the question: When are passive dust cleaning robots more efficient then their active counterparts? Hence when is $D_{passive} > D_{active}$?
We are now ready to prove our main theorem.
\begin{theorem}
The dust-collecting capability of a passive robot exceeds the dust-collecting capability of an active robot when
\begin{equation}
\alpha > \frac{h\beta^{4}}{\beta-1}
\end{equation}
\end{theorem}
\begin{proof}
Using \eref{eqn:passive} and \eref{eqn:active} we get:
\begin{align*}
D_{passive} &> D_{active}\\
\alpha &> h\beta^{3} + \frac{\alpha}{\beta}
\end{align*}
With some simple arithmetic this becomes:
\begin{equation*}
\alpha > \frac{h\beta^{4}}{\beta-1}
\end{equation*}
\end{proof}
\figref{fig:model_comparison} shows this function over a variety of $\beta$s and a few choices of $h$. The y-axis can be viewed as a measure of efficiency.
A passive robot's efficiency corresponds to a straight line across the y-axis at its $\alpha$ value.
As the $h$ value increases, the active robot's efficiency increases, which follows from the fact that as it drives, it can collect more dust. While we see an initial drop in efficiency due to a $\beta$ increase, owing to the fact that the active robot collects less dust passively, this effect is then dwarfed by a faster moving robot that can cover more ground.
\begin{figure}[t!]
\centering
\includegraphics[width=.99\columnwidth]{model.pdf}
\caption{Comparing the efficiency of each robot type as a function of $\beta$.}
\label{fig:model_comparison}
\end{figure}
\section{User Study}
\label{sec:user_study}
Having a developed a model of passive and active dust collecting robots we used a user study to evaluate people's opinions on each type of robot\'s efficiency.
This is critical in developing effective robots as we need to explore the possible discrepencies between perceived versus actual robot capability~\cite{cha2015perceived}.
\subsection{Experimental Setup}
\label{sec:experimental_setup}
We created an online form to evaluate users opinions of passive and active dust collecting robots.
Provided users with \dref{def:passive_robot} and \dref{def:active_robot}, we then asked them the following questions:
\begin{myquestion}
Which type of robot do you think collects more dust: an active dust collecting robot or a passive dust collecting robot? Why?
\label{q:collects_more}
\end{myquestion}
\begin{myquestion}
Which robot would you prefer to have?
\label{q:prefer}
\end{myquestion}
For \qref{q:prefer} the options were: Active dust collecting robot, Passive dust collecting robot, Whichever robot is the most efficient at collecting dust. Our goal in asking this was to determine what people value more, the illusion of efficiency or actual efficiency.
\textbf{Participants} We recurited 23 Carnegie Mellon students (14 males, 9 females, aged 21-23) through online sources.
\subsection{Analysis}
\label{sec:study_analysis}
The results of our user study can be seen in \figref{fig:user_results}. While people believe that the active robot collects more dust, people would prefer to have the most efficient robot, regardless of its capabilities.
\begin{figure}[t!]
\centering
\includegraphics[width=.99\columnwidth]{user_study_results.pdf}
\caption{User Study Results}
\label{fig:user_results}
\end{figure}
What is perhaps more telling is the variety of user responses we had to why they believed each robot would collect more dust.
Those who supported passive dust collecting robots listed a variety of reasons, with many people concerns with active dusting robots dispersing and upsetting more dust than the collect.
One user rationalized his choice by the nature of dust saying "I've observed that the stuff that collects the most dust in my place are the items that are static, therefore I would assume that the static robot might collect more dust."
Still other users took a more global view with one user, as mentioned above, claiming that they "don't want a f*cking robot running around all day" and another, acccepting the harsh realities of time remarked "All robots ultimately become a passive dust-collecting robot."
For every supporter of passive robots, there were still more who argued for active robots. Almost every person, in explaining their choice, argued that active robots, due to their mobility, would be able to cover a larger space. This highlights the dichotomy between \textit{efficiency and coverage}.
While our passive dust collecting robot can provide superior efficiency, its lack of locomotion greatly reduces is potential coverage. By constrast, the active robot has the ability to move around, coverage potentially all of the room, given some amount of time.
\section{Field Study}
\label{sec:field_study}
\begin{figure*}[t!]
\centering
\includegraphics[width=0.99\textwidth]{montage.png}
\caption{Throughout the robots that can be seen at Carnegie Mellon's Robotics Institute we see a variety of passive dust collecting robots that range widely in shape, size, initial function and even cost.}
\label{fig:robot_montage}
\end{figure*}
Given the results of our user study in \sref{sec:user_study}, we next probe into how these preferences are reflected in reality.
Carnegie Mellon's Robotics Institute is home is a large variety of robots and using the 2010 robot census we analyzed what kind of dust collecting robot we actually see~\cite{robot_census}.
Of the 261 robots listed on the census\footnote{The original census data was provided directly from its author.} with complete information, we see that none of them are designed to collect dust actively. However, we can assume many of them collect dust passively.
Twenty were listed as having no mobility, making them official passive dust collecting robots.
Even the eighty-six robots that have wheeled mobility are unlikey to be driving most of the time and therefore spend much of their life as passive dust collecting robots.
In fact, broadening out, despite the variety in morphologies and mobilities from wheeled to winged, from manipulation to entertainment to competition, most, if not all, of the robots at the Robotics Institute spend large quantities of their tenure as passive dust collecting robots.
While active dust collecting robots are constrained by their function to have certain properties, passive dust collecting robotics is an all-inclusive, all-accepting genre that allows for nearly any charactertization.
We see a huge variety of robots in \figref{fig:robot_montage}.
They can be old or new, outrageously expensive or dirt cheap, beautifully crafted or hastily thrown together.
Yet, if they do nothing, they all have the ability inside of them to be passive dust collecting robots.
Given the guidelines provided by our model in \sref{sec:dust_model}, these robots have the capacity to be more efficient than their try-hard active collection counterparts.
Based on the results of our study (\sref{sec:user_study}) this makes them more desirable.
From these insights, it is now clear why the CMU Robotics Institute does not have any active dust collecting robots on record.
They have been surpased by their more efficient, more inclusive, more desirable counterparts: passive dust collecting robots.
\section{Discussion}
\label{sec:discussion}
While our analysis presented in \sref{sec:dust_model} outlines two classes of robots, our field study from \sref{sec:field_study} reveals a continuum of dust collecting robots.
Robots that do not active collect dust but are not entirely stationary, such as robots that are simply underused, represent the middle ground of dust collection.
We can even think of air filters as dust collecting robots that actively collect dust but do not do so by moving themselves. This adds a new dimension of what it means for a robot to be active.
This work also aims to highlight the underappreciated advantages of passive dust collecting robots.
Passive robots, unconstrained by a need for explicit dust collecting capabilities, afford a wide range of mophologies.
This allows for incredibly flexibility in designing the possible human-robot interaction schemes, which is critical to a cleaning robot\'s acceptance~\cite{hendriks2011robot, forlizzi2006service}.
While we focused on dust collecting robots are model generalizes to other situations, such as moving in the rain. Specifically, our model can be used to model whether you would get more wet by standing still or running through the rain.
We hope that this work will raise awareness for passive dust collecting robots and raise further discussion on the nature of dust collection.
\section*{Acknowledgments}
This material is based upon work supported by the infinite discretionary money-bag.
We do not thank the members of the Personal Robotics Lab for helpful discussion and advice as this project was kept entirely super secret from them.
\bibliographystyle{plainnat}
| {'timestamp': '2017-03-28T02:05:15', 'yymm': '1703', 'arxiv_id': '1703.08736', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08736'} | arxiv |
\section{Introduction}
\vspace{-0.05in}
The option framework~\citep{sutton1999between} is a simple yet powerful model to introduce temporally-extended actions and hierarchical structures in reinforcement learning (RL)~\citep{sutton1998introduction}. An important feature of this framework is that Markov decision process (MDP) planning and learning algorithms can be easily extended to accommodate options, thus obtaining algorithms such as option value iteration and $Q$-learning~\citep{sutton1999between}, LSTD~\citep{sorg2010linear}, and actor-critic~\citep{bacon2015the-option-critic}. Temporally extended actions are particularly useful in high dimensional problems that naturally decompose into a hierarchy of subtasks. For instance, \citet{DBLP:journals/corr/TesslerGZMM16} recently obtained promising results by combining options and deep learning for lifelong learning in the challenging domain of Minecraft. A large body of the literature has then focused on how to automatically construct options that are beneficial to the learning process within a single task or across similar tasks (see e.g.,~\citep{mcgovern2001automatic,menache2002q-cut,simsek2004using,Castro:2011:ACT:2341664.2341685,conf/ewrl/LevyS11}). An alternative approach is to design an initial set of options and optimize it during the learning process itself (see e.g., interrupting options \citealt{DBLP:conf/icml/MannMM14} and options with exceptions \citealt{Sairamesh:2011:OE:2341664.2341687}). Despite the empirical evidence of the effectiveness of most of these methods, it is well known that options may as well worsen the performance w.r.t.\ learning with primitive actions~\citep{jong2008the-utility}. Moreover, most of the proposed methods are heuristic in nature and the theoretical understanding of the actual impact of options on the learning performance is still fairly limited. Notable exceptions are the recent results of~\citet{mann2014scaling} and~\citet{brunskill2014pac-inspired}. Nonetheless, \citet{mann2014scaling} rather focus on a batch setting and they derive a sample complexity analysis of approximate value iteration with options. Furthermore, the PAC-SMDP analysis of~\citet{brunskill2014pac-inspired} describes the performance in SMDPs but it cannot be immediately translated into a sample complexity of learning with options in MDPs.
In this paper, we consider the case where a fixed set of options is provided and we study their impact on the learning performance w.r.t. learning without options. In particular, we derive the first regret analysis of learning with options. Relying on the fact that using options in an MDP induces a semi-Markov decision process (SMDP), we first introduce a variant of the {\small\textsc{UCRL}}\xspace algorithm~\citep{Jaksch10} for SMDPs and we upper- and lower-bound its regret (sections~\ref{sec:smdp.ucrl} and~\ref{sec:analysis}). While this result is of independent interest for learning in SMDPs, its most interesting aspect is that it can be translated into a regret bound for learning with options in MDPs and it provides a first understanding on the conditions sufficient for a set of options to reduce the regret w.r.t.\ learning with primitive actions (Sect.~\ref{sec:smdp2mdp}). Finally, we provide an illustrative example where the empirical results support the theoretical findings (Sect.~\ref{sec:exp}).
\vspace{-0.05in}
\section{Preliminaries}
\vspace{-0.05in}
\textbf{MDPs and options.} A finite MDP is a tuple $M = \big\{ \mathcal{S}, \mathcal{A}, p, r \big\}$ where $\mathcal{S}$ is a finite set of states, $\mathcal{A}$ is a finite set of actions, $p(s'|s,a)$ is the probability of transitioning from state $s$ to state $s'$ when action $a$ is taken, $r(s,a,s')$ is a distribution over rewards obtained when action $a$ is taken in state $s$ and the next state is $s'$. A stationary deterministic policy $\pi : \mathcal S \rightarrow \mathcal A$ maps states to actions.
A (Markov) option is a tuple $o = \big\lbrace \mathcal{I}_o, \beta_o , \pi_o \big\rbrace$ where $\mathcal{I}_o \subset \mathcal{S} $ is the set of states where the option can be initiated, $\beta_o: \mathcal{S} \rightarrow [0,1] $ is the probability distribution that the option ends in a given state, and $\pi_o : \mathcal{S} \rightarrow \mathcal{A}$ is the policy followed until the option ends. Whenever the set of primitive actions $\mathcal A$ is replaced by a set of options $\O$, the resulting decision process is no longer an MDP but it belongs to the family of semi-Markov decision processes (SMDP).
\begin{proposition}\label{prop:smdp}[\citealt{sutton1999between}]
For any MDP $M$ and a set of options $\O$, the resulting decision process is an SMDP $M_{\O} = \big\{\mathcal{S}_{\O}, \mathcal{O}, p_{\O}, r_{\O}, \tau_{\O} \big\}$, where $\mathcal{S}_{\O} \subseteq \mathcal{S}$ is the set of states where options can start and end,
\begin{align*}
\mathcal S_\O = \Big(\cup_{o\in\O} \mathcal{I}_o\Big) \bigcup \Big(\cup_{o\in\O} \{s: \beta_o(s) > 0\}\Big),
\end{align*}
$\O$ is the set of available actions, $p_{\O}(s,o,s')$ is the probability of transition from $s$ to $s'$ by taking the policy $\pi_o$ associated to option $o$, i.e.,
\begin{align*}
p_{\O}(s,o,s') = \sum_{k=1}^\infty p(s_k = s' | s,\pi_o) \beta_o(s'),
\end{align*}
where $p(s_k = s' | s,\pi_o)$ is the probability of reaching state $s'$ after exactly $k$ steps following policy $\pi_o$, $r_{\O}(s,o,s')$ is the distribution of the cumulative reward obtained by executing option $o$ from state $s$ until interruption at $s'$, and $\tau_{\O}(s,o,s')$ is the distribution of the holding time (i.e., number of primitive steps executed to go from $s$ to $s'$ by following $\pi_o$).
\end{proposition}
Throughout the rest of the paper, we only consider an ``admissible'' set of options $\O$ such that all options terminate in finite time with probability 1 and in all possible terminal states there exists at least one option that can start, i.e., $\cup_{o\in\O} \{s: \beta_o(s) > 0\} \subseteq \cup_{o\in\O} \mathcal{I}_o$. We further assume that the resulting SMDP $M_\O$ is communicating i.e. has a finite diameter (see Def. \ref{def:Diameter}). Finally, we notice that a stationary deterministic policy constructed on a set of options $\O$ may result into a non-stationary policy on the set of actions $\mathcal A$.
\textbf{Learning in SMDPs.} Relying on this mapping, we first study the exploration-exploitation trade-off in a generic SMDP. A thorough discussion on the implications of the analysis of learning in SMDPs for the case of learning with options in MDPs is reported in Sect.~\ref{sec:smdp2mdp}.
For any SMDP $M = \big\{\mathcal{S}, \mathcal{A}, p, r, \tau \big\}$, we denote by $\overline{\tau}(s,a,s')$ (resp. $\overline{r}(s,a,s')$) the expectation of $\tau(s,a,s')$ (resp. $r(s,a,s')$) and by $\overline{\tau}(s,a) = \sum_{s' \in \mathcal{S}} \overline{\tau}(s,a,s')p(s'|s,a)$ (resp. $\overline{r}(s,a) = \sum_{s' \in \mathcal{S}} \overline{r}(s,a,s')p(s'|s,a)$) the expected holding time (resp. cumulative reward) of action $a$ from state $s$. In the next proposition we define the average-reward performance criterion and we recall the properties of the optimal policy in SMDPs.
\begin{proposition}\label{prop:optimal.policy}
Denote $N(t) = \sup \big\{n \in \mathbb{N}, \ \sum_{i=1}^{n}{\tau_i} \leq t \big\}$ the number of decision steps that occurred before time $t$. For any policy $\pi$ and $s\in \mathcal{S}$:
\begin{align}\label{eq:rho}
\begin{split}
\overline{\rho}^\pi(s) \overset{def}{=} \limsup_{t \rightarrow + \infty} \mathbb{E}^\pi \bigg[ \frac{\sum_{i=1}^{N(t)}{r_i}}{t} \bigg| s_0 =s \bigg] \\
\underline{\rho}^\pi(s) \overset{def}{=} \liminf_{t \rightarrow + \infty} \mathbb{E}^\pi \bigg[ \frac{\sum_{i=1}^{N(t)}{r_i}}{t} \bigg| s_0 =s \bigg].
\end{split}
\end{align}
If $M$ is communicating and the expected holding times and reward are finite, there exists a stationary deterministic optimal policy $\pi^*$ such that for all states $s$ and policies $\pi$, $\underline{\rho}^{\pi^*}(s) \geq \overline{\rho}^\pi(s)$ and $\overline{\rho}^{\pi^*}(s) = \underline{\rho}^{\pi^*}(s) = \rho^*$.
\end{proposition}
Finally, we recall the average reward optimality equation for a communicating SMDP
\begin{align}\label{eq:optimality.eq}
u^*(s) = \max_{a \in \mathcal{A}} \Big\lbrace &\overline{r}(s,a) - \rho^* \overline{\tau}(s,a) \\
&+ \sum_{s' \in \mathcal{S}}{p(s'|s, a)}u^*(s') \Big\rbrace, \nonumber
\end{align}
where $u^*$ and $\rho^*$ are the bias (up to a constant) and the gain of the optimal policy $\pi^*$.
We are now ready to consider the learning problem. For any $i \in \mathbb{N}^*$, $a_i$ denotes the action taken by the agent at the $i$-th decision step\footnote{Notice that decision steps are discrete points in time in which an action is started, while the (possibly continuous) holding time is determined by the distribution $\tau$.} and $s_i$ denotes the state reached after $a_i$ is taken, with $s_0$ being the initial state. We denote by $(r_i(s,a,s'))_{i \in \mathbb{N}^*}$ (resp. $(\tau_i(s,a,s'))_{i \in \mathbb{N}^*}$) a sequence of i.i.d.\ realizations from distribution $r(s,a,s')$ (resp. $\tau(s,a,s')$). When the learner explores the SMDP, it observes the sequence $(s_0, \ldots, s_i, a_{i+1}, r_{i+1}(s_{i},a_{i+1},s_{i+1}), \tau_{i+1}(s_{i},a_{i+1},s_{i+1}),\\ \ldots)$.
The performance of a learning algorithm is measured in terms of its cumulative \textit{regret}.
\begin{definition}\label{def:regret}
For any SMDP $M$, any starting state $s \in \mathcal{S}$, and any number of decision steps $n \geq 1$, let $\{\tau_i\}_{i=1}^n$ be the random holding times observed along the trajectory generated by a learning algorithm $\mathfrak{A}$. Then the total regret of $\mathfrak{A}$ is defined as
\begin{equation}\label{eq:regret}
\Delta(M,\mathfrak{A},s,n) = \bigg( \sum_{i=1}^{n}{\tau_i} \bigg) \rho^*(M) - \sum_{i=1}^{n}{r_i}.
\end{equation}
\end{definition}
We first notice that this definition reduces to the standard regret in MDPs for $\tau_i = 1$ (i.e., primitive actions always terminate in one step). The regret measures the difference in cumulative reward obtained by the optimal policy and the learning algorithm. While the performance of the optimal policy is measured by its asymptotic average reward $\rho^*$, the total duration after $n$ decision steps may vary depending on the policy. As a result, when comparing the performance of $\pi^*$ after $n$ decision steps, we multiply it by the length of the trajectory executed by the algorithm $\mathfrak{A}$. More formally, from the definition of $\rho^*$ (Eq.~\ref{eq:rho}) and Prop.~\ref{prop:optimal.policy} we have\footnote{In this expectation, $N(t)$ is a r.v. depending on $\pi^*$.}
\begin{equation*}
\mathbb{E}^{\pi^*} \bigg[ \sum_{i=1}^{N(t)}{r_i} \Big| s_0 =s \bigg] \underset{t \rightarrow + \infty}{\sim} \rho^*t + o(t).
\end{equation*}
By introducing the total duration $N(t)$ of $\mathfrak{A}$ we have
\begin{equation*}
\rho^*t + o(t) = \rho^*\bigg( \sum_{i=1}^{N(t)}{\tau_i} \bigg) + \rho^*\bigg(t-\sum_{i=1}^{N(t)}{\tau_i}\bigg) + o(t).
\end{equation*}
We observe that $\big(t-\sum_{i=1}^{N(t)}{\tau_i}\big) = o(t)$ almost surely since $\big(t-\sum_{i=1}^{N(t)}{\tau_i}\big) \leq \tau_{N(t)+1}$ and $\tau_{N(t)+1}$ is bounded by an almost surely finite (a.s.) random variable since the expected holding time for all state-action pairs is bounded by assumption. So $\tau_{N(t)+1}/t \underset{t \rightarrow + \infty}{\rightarrow} 0$ a.s. and
\begin{equation*}
\mathbb{E}^{\pi^*} \bigg[ \sum_{i=1}^{N(t)}{r_i} \Big| s_0 =s \bigg] \underset{t \rightarrow + \infty}{\sim} \rho^*\bigg( \sum_{i=1}^{N(t)}{\tau_i} \bigg) + o(t),
\end{equation*}
which justifies the definition of the regret.
\vspace{-0.05in}
\section{SMDP-UCRL}\label{sec:smdp.ucrl}
\vspace{-0.05in}
\begin{figure}[t!]
\bookboxx{
\textbf{Input:} Confidence $\delta \in ]0,1[$, $\mathcal{S}$, $\mathcal{A}, b_r, \sigma_r$, $b_\tau, \sigma_\tau, R_{\max}, \tau_{\max}$ and $\tau_{\min}$.
\noindent \textbf{Initialization:} Set $i= 1$, and observe initial state $s_0$.\\
\noindent \textbf{For} episodes $k=1, 2, ...$ \textbf{do}
\ \ \ \textit{\textbf{Initialize episode}} $k$:
\vspace{-0.1in}
\begin{enumerate}[leftmargin=4mm,itemsep=-1mm]
\item Set the start step of episode $k$, $i_k := i$
\item For all $(s,a)$ initialize the counter for episode $k$, $\nu_k (s,a) := 0$ and set counter prior to episode $k$,
\begin{equation*}
N_k (s,a) = \#\{\iota < i_k : s_{\iota} = s, a_{\iota} = a \}
\end{equation*}
\item For $s,s',a$ set the accumulated rewards, duration and transition counts prior to episode $k$,
\begin{align*}
\begin{split}
R_k (s,a) \!=\!\! \sum_{\iota=1}^{i_k-1} r_{\iota} \mathbb{1}_{s_{\iota}=s, a_{\iota}=a}, T_k (s,a) \!=\!\! \sum_{\iota=1}^{i_k-1} \tau_{\iota} \mathbb{1}_{s_{\iota}=s, a_{\iota}=a}
\\
P_k(s,a,s') = \#\{\iota< i_k : s_{\iota} = s, a_{\iota} = a, s_{\iota + 1} = s' \}
\end{split}
\end{align*}
Compute estimates $\hat{p}_k(s' \mid s,a) := \frac{P_k (s,a,s')}{\max \{ 1, N_k (s,a)\}}$ and $\hat{\tau}_k(s,a) := \frac{T_k (s,a)}{N_k (s,a)}$ and $\hat{r}_k(s,a) := \frac{R_k (s,a)}{N_k (s,a)}$
\textit{\textbf{Compute policy}} $\widetilde{\pi}_k$:
\item Let $\mathcal{M}_k$ be the set of all SMDPs with states and actions as in $M$, and with transition probabilities $\widetilde{p}$, rewards $\widetilde{r}$, and holding time $\widetilde{\tau}$ such that for any $(s,a)$
\begin{align*}
\begin{split}
&\arrowvert \widetilde{r} - \hat{r}_k \arrowvert \leq \beta_k^r \ \textrm{ and } \ R_{\max}\tau_{\max} \geq \widetilde{r}(s,a) \geq 0
\\
&\arrowvert \widetilde{\tau} - \hat{\tau}_k \arrowvert \leq \beta_k^{\tau} \ \textrm{ and } \ \tau_{\max} \geq \widetilde{\tau}(s,a) \geq\widetilde{r}(s,a)/R_{\max} , \tau_{\min}
\\
&\Arrowvert \widetilde{p}(\cdot) - \hat{p}_k(\cdot) \Arrowvert_1 \leq \beta_k^p \ \textrm{ and } \ \sum_{s' \in \mathcal{S}}{\widetilde{p}(s' \mid s,a)} = 1
\end{split}
\end{align*}
\item Use \textit{extended value iteration} (EVI) to find a policy $\widetilde{\pi}_k$ and an optimistic SMDP $\widetilde{M}_k \in \mathcal{M}_k$ such that:
\begin{equation*}
\widetilde{\rho}_k := \min_{s} \rho (\widetilde{M}_k, \widetilde{\pi}_k, s) \geq \max_{M' \in \mathcal{M}_k , \pi, s} \rho (M', \pi, s) - \frac{R_{\max}}{\sqrt{i_k}}
\end{equation*}
\vspace{-0.1in}
\textit{\textbf{Execute policy}} $\widetilde{\pi}_k$:
\item \textbf{While} $\nu_k(s_{i}, \widetilde{\pi}_k(s_{i})) < \max \{1, N_k(s_{i},\widetilde{\pi}_k(s_{i})\}$ \textbf{do}
\begin{enumerate}
\item Choose action $a_{i} = \widetilde{\pi}_k(s_{i})$, obtain reward $r_{i}$, and observe next state $s_{i + 1}$
\item Update $\nu_k (s_i,a_i) := \nu_k(s_i,a_i)+1$ and set $i = i+1$
\end{enumerate}
\end{enumerate}
}
\vspace{-0.1in}
\caption{{\small\textsc{UCRL-SMDP}}\xspace}
\label{fig:ucrl.smdp}
\vspace{-0.2in}
\end{figure}
In this section we introduce {\small\textsc{UCRL-SMDP}}\xspace (Fig.~\ref{fig:ucrl.smdp}), a variant of {\small\textsc{UCRL}}\xspace~\citep{Jaksch10}. At each episode $k$, the set of plausible SMDPs $\mathcal{M}_k$ is defined by the current estimates of the SMDP parameters and a set of constraints on the rewards, the holding times and the transition probabilities derived from the confidence intervals. Given $\mathcal M_k$, extended value iteration (EVI) finds an SMDP $\widetilde{M}_k \in \mathcal{M}_k$ that maximizes $\rho^{*}(\widetilde{M}_k)$ and the corresponding optimal policy $\widetilde{\pi}_k^*$ is computed. To solve this problem, we note that it can be equivalently formulated as finding the optimal policy of an extended\footnote{In the MDP literature, the term Bounded Parameter MDPs (BPMDPs) \citep{Tewari2007} is often used for "extended" MDPs built using confidence intervals on rewards and transition probabilities.} SMDP $\widetilde{M}_k^+$ obtained by combining all SMDPs in $\mathcal{M}_k$: $\widetilde{M}_k^+$ has the same state space and an extended continuous action space $\widetilde{\mathcal{A}}_k^+$. Choosing an action $a^+ \in\widetilde{\mathcal{A}}_k^+$ amounts to choosing an action $a \in \mathcal{A}$, a reward $\widetilde{r}_k(s,a)$, a holding time $\widetilde{\tau}_k(s,a)$ and a transition probability $\widetilde{p}_k(\cdotp \mid s,a)$ in the confidence intervals. When $a^{+}$ is executed in $\widetilde{M}_k^+$, the probability, the expected reward and the expected holding time of the transition are respectively $\widetilde{p}_k(\cdotp \mid s,a)$, $\widetilde{r}_k(s,a)$ and $\widetilde{\tau}_k(s,a)$. Finally, $\widetilde{\pi}_k^*$ is executed until the number of samples for a state-action pair is doubled. Since the structure is similar to {\small\textsc{UCRL}}\xspace's, we focus on the elements that need to be rederived for the specific SMDP case: the confidence intervals construction and the extended value iteration algorithm.
\textbf{Confidence intervals.}
Unlike in MDPs, we consider a slightly more general scenario where cumulative rewards and holding times are not bounded but are sub-exponential r.v. (see Lem.~\ref{lem:MDPwithOptions}). As a result, the confidence intervals used at step 4 are defined as follows. For any state action pair $(s,a)$ and for rewards, transition probabilities, and holding times we define
\vspace{-0.1in}
\begin{small}
\begin{align*}
\beta_k^r(s,a) &\!=\!
\begin{cases}
\sigma_r \sqrt{\frac{14 \log \left( 2SA i_k/\delta \right)}{\max\{1, N_k(s,a)\}}}, \ \!\mbox{if } N_k(s,a) \!\geq\! \frac{2 b_r^2}{\sigma_r^2}\log \big( \frac{240SAi_k^7}{\delta}\big)\\
14 b_r \frac{\log \left( 2SA i_k/\delta\right)}{\max\{1, N_k(s,a)\}}, \ \mbox{ otherwise }
\end{cases}\\
\beta_k^p(s,a) &= \sqrt{\frac{14 S \log(2A i_k / \delta)}{\max\{1, N_k(s,a)\}}},\\
\beta_k^{\tau}(s,a)& \!=\!
\begin{cases}
\sigma_\tau \sqrt{\frac{14 \log \left( 2SA i_k/\delta \right)}{\max\{1, N_k(s,a)\}}}, \ \!\mbox{if } N_k(s,a) \!\geq\! \frac{2 b_\tau^2}{\sigma_\tau^2}\log \big( \frac{240SAi_k^7}{\delta}\big)\\
14 b_\tau \frac{ \log \left( 2SA i_k/\delta\right)}{\max\{1, N_k(s,a)\}}, \ \mbox{ otherwise }
\end{cases}
\end{align*}
\end{small}
\vspace{-0.1in}
\noindent where $\sigma_r$, $b_r$, $\sigma_\tau$, $b_r$ are suitable constants characterizing the sub-exponential distributions of rewards and holding times. As a result, the empirical estimates $\hat r_k$, $\hat\tau_k$, and $\hat p_k$ are $\pm \beta_k^r(s,a), \beta_k^\tau(s,a), \beta_k^p(s,a)$ away from the true values.
\textbf{Extended value iteration (EVI).}
We rely on a data-transformation (also called ``uniformization'') that turns an SMDP $M$ into an ``equivalent'' MDP $M_{\text{eq}} = \big\{ \mathcal{S}, \mathcal{A}, p_{\text{eq}}, r_{\text{eq}} \big\}$ with same state and action spaces and such that $\forall s,s' \in \mathcal{S}, \forall a \in \mathcal{A}$:
\begin{align}\label{eq:eq.MDP}
\begin{split}
\overline{r}_{\text{eq}}(s,a) &= \frac{\overline{r}(s,a)}{\overline{\tau}(s,a)}\\
p_{\text{eq}}(s' | s,a) &= \frac{\tau}{\overline{\tau}(s,a)} \big( p(s' | s,a) - \delta_{s,s'} \big) + \delta_{s,s'}
\end{split}
\end{align}
where $\delta_{s,s'} = 0$ if $s \neq s'$ and $\delta_{s,s'} = 1$ otherwise, and $\tau$ is an arbitrary non-negative real such that $\tau < \tau_{\min}$. $M_{\text{eq}}$ enjoys the following equivalence property.
\begin{proposition}[\citep{Federgruen83}, Lemma~2]\label{lem:equivalence.uniformization}
If $(v^*, g^*)$ is an optimal pair of bias and gain in $M_{\text{eq}}$ then $(\tau^{-1}v^*, g^*)$ is a solution to Eq.~\ref{eq:optimality.eq}, i.e., it is an optimal pair of bias/gain for the original SMDP $M$.
\end{proposition}
As a consequence of the equivalence stated in Prop. \ref{lem:equivalence.uniformization}, computing the optimal policy of an SMDP amounts to computing the optimal policy of the MDP obtained after data transformation (see App. \ref{GainSMDPs} for more details). Thus, EVI is obtained by applying a value iteration scheme to an MDP $\widetilde{M}_{k,eq}^+$ equivalent to the extended SMDP $\widetilde{M}_k^+$. We denote the state values of the $j$-th iteration by $u_j(s)$. We also use the vector notation $u_j = (u_j(s))_{s \in \mathcal{S}}$. Similarly, we denote by $\widetilde{p}(\cdot \mid s,a) = (\widetilde{p}(s' \mid s,a))_{s' \in \mathcal{S}}$ the transition probability vector of state-action pair $(s,a)$. The optimistic reward at episode $k$ is fixed through the EVI iterations and it is obtained as $\widetilde{r}_{j+1}(s,a) = \min \big\lbrace \hat{r}_{k}(s,a) + \beta_k^r(s,a); R_{\max}\tau_{\max} \big\rbrace$, i.e., by taking the largest possible value compatible with the confidence intervals. At iteration $j$, the optimistic transition model is obtained as $\widetilde{p}_{j+1}(\cdotp \mid s,a) \in \Argmax_{p(\cdotp) \in \mathcal{P}_k(s,a)} \left\lbrace p^\intercal u_j \right\rbrace$ and $\mathcal{P}_k(s,a)$ is the set of probability distributions included in the confidence interval defined by $\beta_k^p(s,a)$.
This optimization problem can be solved in $O(S)$ operations using the same algorithm as in {\small\textsc{UCRL}}\xspace. Finally, the optimistic holding time depends on $u_j$ and the optimistic transition model $\widetilde{p}_{j+1}$ as
\begin{align*}
\begin{split}
&\widetilde{\tau}_{j+1}(s,a) = \min \Big\lbrace \vphantom{2^1} \tau_{\max}; \max \big\lbrace \tau_{\min}; \hat{\tau}_k(s,a) \\
& \!\!-\! \text{sgn} \big[ \widetilde{r}_{j+1}(s,a) \!+\!\tau \big(\widetilde{p}_{j+1}(\cdot|s,a)^\intercal u_j \!-u_j(s) \big) \big] \beta_k^{\tau}(s,a) \big\rbrace \Big\rbrace,
\end{split}
\end{align*}
The $\min$ and $\max$ insure that $\widetilde{\tau}_{j+1}$ ranges between $\tau_{\min}$ and $\tau_{\max}$. When the term $\widetilde{r}_{j+1}(s,a) + \big(\widetilde{p}_{j+1}(\cdot|s,a)^\intercal u_j \!-u_j(s) \big)$ is positive (resp. negative), $\widetilde{\tau}_{j+1}(s,a)$ is set to the minimum (resp. largest) possible value compatible with its confidence intervals so as to maximize the right-hand side of Eq.~\ref{eq:evi} below. As a result, for any $\tau \in \left]0,\tau_{\min}\right[$, EVI is applied to an MDP equivalent to the extended SMDP $\widetilde{M}_k^+$ generated over iterations as
\begin{align} \label{eq:evi}
u_{j+1}&(s) = \max_{a \in \mathcal{A}} \bigg\lbrace \frac{\widetilde{r}_{j+1}(s,a)}{\widetilde{\tau}_{j+1}(s,a)} \\
&+ \frac{\tau}{\widetilde{\tau}_{j+1}(s,a)} \Big( \vphantom{\frac{1}{2} } \widetilde{p}_{j+1}(\cdotp \mid s,a)^\intercal u_j \vphantom{\frac{1}{2} } - u_j(s) \Big) \bigg\rbrace + u_j(s) \nonumber
\end{align}
with arbitrary $u_0$. Finally, the stopping condition is
\begin{align}\label{eq:stopping}
\max_{s \in \mathcal{S}} \lbrace u_{i+1}(s) \!-\! u_i(s) \rbrace \!-\! \min_{s \in \mathcal{S}} \lbrace u_{i+1}(s) \!-\! u_i(s) \rbrace < \epsilon.
\end{align}
We prove the following.
\begin{lemma}\label{lem:validity.evi}
If the stopping condition holds at iteration $i$ of EVI, then the greedy policy w.r.t. $u_i$ is $\epsilon$-optimal w.r.t.\ extended SMDP $\widetilde{M}_k^+$. The stopping condition is always reached in a finite number of steps.
\end{lemma}
As a result, we can conclude that running EVI at each episode $k$ with an accuracy parameter $\epsilon=R_{\max}/\sqrt{i_k}$ guarantees that $\widetilde{\pi}_k$ is $R_{\max}/\sqrt{i_k}$-optimal w.r.t. $\max_{M' \in \mathcal{M}_k}\rho^{*}(M')$.
\vspace{-0.05in}
\section{Regret Analysis}\label{sec:analysis}
\vspace{-0.05in}
In this section we report upper and lower bounds on the regret of {\small\textsc{UCRL-SMDP}}\xspace. We first extend the notion of diameter to the case of SMDP as follows.
\begin{definition}\label{def:Diameter}
For any SMDP $M$, we define the diameter $D(M)$ by
\begin{equation}\label{eq3}
D(M) = \max_{s,s' \in \mathcal{S}} \bigg\{ \min_{\pi} \Big\{ \mathbb{E}^{\pi} \big[ T(s')|s_0 = s \big] \Big\} \bigg\}
\end{equation}
where $T(s')$ is the first time in which $s'$ is encountered, i.e., $T(s') = \inf \big\{ \sum_{i=1}^{n}{\tau_i} : n \in \mathbb{N}, \ s_n = s'\big\}$.
\end{definition}
Note that the diameter of an SMDP corresponds to an average \textit{actual} duration and not an average number of decision steps. However, if the SMDP is an MDP the two definitions of diameter coincides. Before reporting the main theoretical results about {\small\textsc{UCRL-SMDP}}\xspace, we introduce a set of technical assumptions.
\begin{assumption} \label{asm:BoundedExpectedDurationsRewards}
For all $s \in \mathcal{S}$ and $a \in \mathcal{A}$, we assume that $\tau_{\max} \geq \overline{\tau}(s,a) \geq \tau_{\min} > 0$ and $\max_{s \in \mathcal{S},a \in \mathcal{A}} \left\lbrace \frac{\overline{r}(s,a)}{\overline{\tau}(s,a)} \right\rbrace \leq R_{\max}$ with $\tau_{\min}$, $\tau_{\max}$, and $R_{\max}$ known to the learning algorithm.
Furthermore, we assume that the random variables $(r(s,a,s'))_{s,a,s'}$ and $(\tau(s,a,s'))_{s,a,s'}$ are either \textbf{1)} \textit{sub-Exponential} with constants $(\sigma_r, b_r)$ and $(\sigma_\tau , b_\tau )$, or \textbf{2)} \textit{bounded} in $[0, R_{\max}T_{\max}]$ and $[T_{\min},T_{\max}]$, with $T_{\min}>0$. We also assume that the constants characterizing the distributions are known to the learning agent.
\end{assumption}
We are now ready to introduce our main result.
\begin{theorem}\label{UpperBound}
With probability of at least $1-\delta$, it holds that for any initial state $s \in \mathcal{S}$ and any $n>1$, the regret of {\small\textsc{UCRL-SMDP}}\xspace $\Delta(M,\mathfrak{A},s,n)$ is bounded by:
\begin{align}
O \left( \left( D \sqrt{S}+ \mathcal{C}(M,n,\delta) \right) R_{\max} \sqrt{S A n \log \left( \frac{n}{\delta}\right)}\right),
\end{align}
where $\mathcal{C}(M,n,\delta)$ depends on which case of Asm.~\ref{asm:BoundedExpectedDurationsRewards} is considered~\footnote{We denote $\max\{a,b\} = a \vee b$.}
\begin{align*}
\begin{split}
&\hspace{-0.1in}\text{\textbf{1)} sub-Exponential}\\
& \mathcal{C}(M,n,\delta) = \tau_{\max} + \Big(\frac{\sigma_r \vee b_r}{R_{\max}} + \sigma_\tau \vee b_\tau\Big)\sqrt{\log \left( \frac{n}{\delta}\right)},
\end{split}\\
\begin{split}
&\hspace{-0.1in}\text{\textbf{2)} bounded}\\
&\mathcal{C}(M,n,\delta) = T_{\max} + (T_{\max}-T_{\min}).
\end{split}
\end{align*}
\end{theorem}
\textit{Proof.} The proof (App.~\ref{app:proof.smdp.ucrl}) follows similar steps as in~\citep{Jaksch10}. Apart from adapting the concentration inequalities to sub-exponential r.v. and deriving the guarantees about EVI applied to the equivalent MDP $M_{\text{eq}}$ (Lem.~\ref{lem:validity.evi}), one of the key aspects of the proof is to show that the learning complexity is actually determined by the diameter $D(M)$ in Eq.~\ref{def:Diameter}. As for the analysis of EVI, we rely on the data-transformation and we show that the span of $u_j$ (Eq.~\ref{eq:evi}) can be bounded by the diameter of $M_{\text{eq}}$, which is related to the diameter of the original SMDP as $D(M_{\text{eq}}) = D(M)/\tau$ (Lem.~\ref{SpanVI} in App.~\ref{app:proof.smdp.ucrl}).
\textit{The bound.} The upper bound is a direct generalization of the result derived by~\citet{Jaksch10} for {\small\textsc{UCRL}}\xspace in MDPs. In fact, whenever the SMDP reduces to an MDP (i.e., each action takes exactly one step to execute), then $n=T$ and the regret, the diameter, and the bounds are the same as for {\small\textsc{UCRL}}\xspace. If we consider $R_{\max}=1$ and bounded holding times, the regret scales as $\wt{O}(DS\sqrt{An} + T_{\max}\sqrt{SAn})$. The most interesting aspect of this bound is that the extra cost of having actions with random duration is only partially additive rather than multiplicative (as it happens e.g., with the per-step reward $R_{\max}$). This shows that errors in estimating the holding times do not get amplified by the diameter $D$ and number of states $S$ as much as it happens for errors in reward and dynamics. This is confirmed in the following lower bound.
\begin{theorem}\label{LowerBound}
For any algorithm $\mathfrak{A}$, any integers $S, A \geq 10$, any reals ${T_{\max} \geq 3T_{\min} \geq 3 }$, ${R_{\max}>0}$, $D > \max\lbrace{20 T_{\min}{\log}_A(S), 12 T_{\min} \rbrace}$, and for ${n\geq \max\lbrace D, T_{\max} \rbrace SA}$, there is an SMDP $M$ with at most $S$ states, $A$ actions, and diameter $D$, with holding times in $\left[T_{\min},T_{\max}\right]$ and rewards in $\left[0,\frac{1}{2}R_{\max}T_{\max}\right]$ satisfying $\forall s \in \mathcal{S}$, $\forall a \in \mathcal{A}_s$, $\overline{r}(s,a) \leq R_{\max}\overline{\tau}(s,a)$, such that for any initial state $s \in \mathcal{S}$ the expected regret of $\mathfrak{A}$ after $n$ decision steps is lower-bounded by:
\begin{align*}
\mathbb{E}\left[\Delta(M,\mathfrak{A},s,n)\right] = \Omega \left( \big( \sqrt{D} + \sqrt{T_{\max}} \big) R_{\max}\sqrt{S A n }\right)
\end{align*}
\end{theorem}
\textit{Proof.} Similar to the upper bound, the proof (App.~\ref{app:proof.lower.bound}) is based on~\citep{Jaksch10} but it requires to perturb transition probabilities and rewards at the same time to create a family of SMDPs with different optimal policies that are difficult to discriminate. The contributions of the two perturbations can be made independent. More precisely, the lower bound is obtained by designing SMDPs where learning to distinguish between ``good'' and ``bad'' transition probabilities and learning to distinguish between ``good'' and ``bad'' rewards are two independent problems, leading to two additive terms $\sqrt{D}$ and $\sqrt{T_{\max}}$ in the lower bound.
\textit{The bound.} Similar to {\small\textsc{UCRL}}\xspace, this lower bound reveals a gap of $\sqrt{DS}$ on the first term and $\sqrt{T_{\max}}$. While closing this gap remains a challenging open question, it is a problem beyond the scope of this paper.
In the next section, we discuss how these results can be used to bound the regret of options in MDPs and what are the conditions that make the regret smaller than using {\small\textsc{UCRL}}\xspace on primitive actions.
\vspace{-0.05in}
\section{Regret in MDPs with Options}\label{sec:smdp2mdp}
\vspace{-0.05in}
Let $M$ be an MDP and $\mathcal{O}$ a set of options and let $M_{\O}$ be the corresponding SMDP obtained from Prop.~\ref{prop:smdp}. We index time steps (i.e., time at primitive action level) by $t$ and decision steps (i.e., time at option level) by $i$. We denote by $N(t)$ the total number of decision steps that occurred before time $t$. Given $n$ decision steps, we denote by $T_n = \sum_{i=1}^{n} \tau_i$ the number of time steps elapsed after the execution of the $n$ first options so that $N(T_n) = n$.
Any SMDP-learning algorithm $\mathfrak{A}_{\O}$ applied to $M_{\O}$ can be interpreted as a learning algorithm $\mathfrak{A}$ on $M$ so that at each time step $t$, $\mathfrak{A}$ selects an action of $M$ based on the policy associated to the option started at decision step $N(t)$. We can thus compare the performance of {\small\textsc{UCRL}}\xspace and {\small\textsc{UCRL-SMDP}}\xspace when learning in $M$. We first need to relate the notion of average reward and regret used in the analysis of {\small\textsc{UCRL-SMDP}}\xspace to the original counterparts in MDPs.
\begin{lemma}\label{thm:smdp.mdp.equivalence}
Let $M$ be an MDP, $\mathcal{O}$ a set of options and $M_{\O}$ the corresponding SMDP. Let $\pi_{\O}$ be any stationary policy on $M_{\O}$ and $\pi$ the equivalent policy on $M$ (not necessarily stationary). For any state $s \in \mathcal{S_{\O}}$, any learning algorithm $\mathfrak{A}$, and any number of decision steps $n$ we have $\rho^{\pi_{\O}}(M_{\O},s) = \rho^{\pi}(M,s)$ and
\begin{align*}\Delta(M,\mathfrak{A},T_n) = \Delta(M_{\O},&\mathfrak{A},n) + T_n \left(\rho^*(M) -\rho^*(M_{\O})\right).
\end{align*}
\end{lemma}
The linear regret term is due to the fact that the introduction of options amounts to constraining the space of policies that can be expressed in $M$. As a result, in general we have $\rho^*(M) \geq \rho^*(M_{\O}) = \max_{\pi_{\O}} \rho^{\pi_{\O}}(M_{\O})$, where $\pi_{\O}$ is a stationary deterministic policy on $M_{\O}$. Thm.~\ref{thm:smdp.mdp.equivalence} also guarantees that the optimal policy computed in the SMDP $M_{\O}$ (i.e., the policy maximizing $\rho^{\pi_{\O}}(M_{\O},s)$) is indeed the best in the subset of policies that can be expressed in $M$ by using the set of options $\O$.
In order to use the regret analysis of Thm.~\ref{UpperBound}, we still need to show that Asm.~\ref{asm:BoundedExpectedDurationsRewards} is verified.
\begin{lemma}\label{lem:MDPwithOptions}
An MDP provided with a set of options is an SMDP where the holding times and rewards $\tau(s,o,s')$ and $r(s,o,s')$ are distributed as sub-exponential random variables. Moreover, the holding time of an option is sub-Gaussian if and only if it is almost surely bounded.
\end{lemma}
This result is based on the fact that once an option is executed, we obtain a Markov chain with absorbing states corresponding to the states with non-zero termination probability $\beta_o(s)$ and the holding time is the number of visited states before reaching a terminal state. While in general this corresponds to a sub-exponential distribution, whenever the option has a zero probability to reach the same state twice before terminating (i.e., there is no cycle), then the holding times become bounded. Finally, we notice that no intermediate case between sub-exponential and bounded distributions is admissible (e.g., sub-Gaussian). Since these are the two cases considered in Thm.~\ref{UpperBound}, we can directly apply it and obtain the following corollary.
\begin{corollary}\label{cor:mdp.options.regret}
For any MDP $M=\{\mathcal S,\mathcal A,p,r\}$ with $r(s,a,s') \in [0,R_{\max}]$ and a set of options $\O$, consider the resulting SMDP $M_{\O}=\{\mathcal S_{\O},\mathcal A_{\O},p_{\O},r_{\O},\tau_{\O}\}$. Then with probability of at least $1-\delta$, it holds that for any initial state $s \in \mathcal{S}$ and any $n>1$, the regret of {\small\textsc{UCRL-SMDP}}\xspace in the original MDP is bounded as
\begin{align*}
O \Big( \big( D_{\O} \sqrt{S_{\O}}+ \mathcal{C}(M_{\O},n,\delta) \big) &R_{\max}^{_{\O}} \sqrt{S_{\O} O n \log \left( \frac{n}{\delta}\right)}\Big) \\
&+ T_n \left(\rho^*(M)-\rho^*(M_{\O})\right),
\end{align*}
where $O$ is the number of options.
\end{corollary}
We can also show that the lower bound holds for MDPs with options as well. More precisely, it is possible to create an MDP and a set of options such that the lower bound is slightly smaller than that of Thm.~\ref{LowerBound}.
\begin{corollary}\label{cor:mdp.options.regret.lb}
Under the same assumptions as in Theorem \ref{LowerBound}, there exists an MDP with options such that the regret of any algorithm is lower-bounded as
\begin{align*}
\Omega \left( \left( \sqrt{D_{\O}} + \sqrt{T_{\max} - T_{\min}} \right.\right.&\left.\left. \vphantom{\sqrt{D_{\O}}} \right) R_{\max}^{\O}\sqrt{S_{\O} O n }\right)\\ &+ T_n \left(\rho^*(M)-\rho^*(M_{\O})\right).
\end{align*}
\end{corollary}
\vspace{-0.1in}
This shows that MDPs with options are slightly easier to learn than SMDPs. This is due to the fact that in SMDPs resulting from MDPs with options rewards and holding times are strictly correlated (i.e., $r(s,o,s') \leq R_{\max}\tau(s,o,s')$ a.s.\ and not just in expectation for all $(s,o,s')$).
We are now ready to proceed with the comparison of the bounds on the regret of learning with options and primitive actions. We recall that for {\small\textsc{UCRL}}\xspace $\Delta(M,{\small\textsc{UCRL}}\xspace,s,T_n) = \wt{O}(DSR_{\max}\sqrt{AT_n})$. We first notice that\footnote{The largest per-step reward in the SMDP is defined as $R_{\max}^{\O} \geq \max_{s \in \mathcal{S},a \in \mathcal{A}} \big\lbrace \frac{\overline{r}(s,a)}{\overline{\tau}(s,a)} \big\rbrace$.} $R_{\max}^{\O} \leq R_{\max}$ and since $\mathcal{S}_{\O} \subseteq \mathcal{S}$ we have that $S_{\O} \leq S$. Furthermore, we introduce the following simplifying conditions: \textbf{1)} $\rho^*(M)=\rho^*(M_{\O})$ (i.e., the options do not prevent from learning the optimal policy), \textbf{2)} $O \leq A$ (i.e., the number of options is not larger than the number of primitive actions), \textbf{3)} options have bounded holding time (case 2 in Asm.~\ref{asm:BoundedExpectedDurationsRewards}). While in general comparing upper bounds is potentially loose, we notice that both upper-bounds are derived using similar techniques and thus they would be ``similarly'' loose and they both have almost matching worst-case lower bounds.
Let $\mathcal{R}(M,n,\delta)$ be the ratio between the regret upper bounds of {\small\textsc{UCRL-SMDP}}\xspace using options $\O$ and {\small\textsc{UCRL}}\xspace, then we have (up to numerical constants)
\begin{align*}
\mathcal{R}(M,n) &\leq \frac{\big(D_{\O}\sqrt{S_{\O}} + T_{\max}\big) \sqrt{S_{\O} On \log(n/\delta)}}{ DS\sqrt{AT_n \log(T_n/\delta)}} \\
&\leq \frac{D_{\O}\sqrt{S} + T_{\max}}{D\sqrt{S}} \sqrt{\frac{n}{T_n}},
\end{align*}
where we used $n\leq T_n$ to simplify the logarithmic terms. Since $\liminf\limits_{n \rightarrow +\infty} \frac{T_n}{n} \geq \tau_{\min}$, then the previous expression gives an (asymptotic) sufficient condition for reducing the regret when using options, that is
\begin{align}\label{eq:ratio.condition}
\frac{D_{\O}\sqrt{S} + T_{\max}}{D\sqrt{S\tau_{\min}}} \leq 1.
\end{align}
In order to have a better grasp on the cases covered by this condition, let $D_{\O} = \alpha D$, with $\alpha \geq 1$. This corresponds to the case when navigating through some states becomes more difficult with options than with primitive actions, thus causing an increase in the diameter. If options are such that $T_{\max} \leq D\sqrt{S}$ and $\tau_{\min} > (1+\alpha)^2$, then it is easy to see that the condition in Eq.~\ref{eq:ratio.condition} is satisfied. This shows that even when the introduction of options partially disrupt the structure of the original MDP (i.e., $D_{\O} \geq D$), it is enough to choose options which are long enough (but not too much) to guarantee an improvement in the regret. Notice that while conditions \textbf{1)} and \textbf{2)} are indeed in favor of {\small\textsc{UCRL-SMDP}}\xspace, $S_{\O}$, $O$, and $T_{\max}$ are in general much smaller than $S$, $A$, $D\sqrt{S}$ ($S$ and $D$ are large in most of interesting applications). Furthermore, $\tau_{\min}$ is a very loose upper-bound on $\liminf_{n \rightarrow +\infty} \frac{T_n}{n}$ and in practice the ratio $\frac{T_n}{n}$ can take much larger values if $\tau_{\max}$ is large and many options have a high expected holding time. As a result, the set of MDPs and options on which the regret comparison is in favor of {\small\textsc{UCRL-SMDP}}\xspace is much wider than the one defined in Eq.~\ref{eq:ratio.condition}. Nonetheless, as illustrated in Lem.~\ref{lem:MDPwithOptions}, the case of options with bounded holding times is quite restrictive since it requires the absence of self-loops during the execution of an option. If we reproduce the same comparison in the general case of sub-exponential holding times, then the ratio between the regret upper bounds becomes
\begin{align*}
\mathcal{R}(M,n) &\leq \frac{D_{\O}\sqrt{S} + \mathcal{C}(M,n,\delta)}{D\sqrt{S}} \sqrt{\frac{n}{T_n}},\end{align*}
where $\mathcal{C}(M,n,\delta) = O(\sqrt{\log(n/\delta)})$. As a result, as $n$ increases, the ratio is always greater than 1, thus showing that in this case the regret of {\small\textsc{UCRL-SMDP}}\xspace is asymptotically worse than {\small\textsc{UCRL}}\xspace. Whether this is an artefact of the proof or it is an intrinsic weakness of options, it remains an open question.
\vspace{-0.05in}
\section{Illustrative Experiment}\label{sec:exp}
\vspace{-0.05in}
\begin{figure}[t]
\centerline{
\includegraphics[scale=0.5]{bounded_options.eps}
}
\vspace{-0.1in}
\caption{\small Navigation problem.}\label{fig:navigation}
\vspace{-0.2in}
\end{figure}
\begin{figure*}
\begin{subfigure}{.33\textwidth}
\centering
\includegraphics[width=1.1\textwidth]{ratios.eps}
\caption{}
\label{fig:results.ratio}
\end{subfigure}
\begin{subfigure}{.33\textwidth}
\centering
\includegraphics[width=1.1\textwidth]{regrets2.eps}
\caption{}
\label{fig:results.regret}
\end{subfigure}
\begin{subfigure}{.33\textwidth}
\centering
\includegraphics[width=1.1\textwidth]{duration.eps}
\caption{}
\label{fig:results.duration}
\end{subfigure}
\vspace{-0.1in}
\caption{\textit{(a)} Ratio of the regrets with and without options for different values of $T_{\max}$; \textit{(b)} Regret as a function of $T_{n}$ for a 20x20 grid; \textit{(c)} Evolution of $T_{n}/n$ for a 20x20 grid.}
\label{fig:results}
\vspace{-0.15in}
\end{figure*}
We consider the navigation problem in Fig.~\ref{fig:navigation}.
In any of the $d^2$ states of the grid except the target, the four cardinal actions are available, each of them being successful with probability $1$. If the agent hits a wall then it stays in its current position with probability $1$. When the target state is reached, the state is reset to any other state with uniform probability. The reward of any transition is 0 except when the agent leaves the target in which case it equals $R_{\max}$. The optimal policy simply takes the shortest path from any state to the target state. The diameter of the MDP is the longest shortest path in the grid, that is $D = 2d-2$. Let $m$ be any non-negative integer smaller than $d$ and in every state but the target we define four macro-actions: \textit{LEFT}, \textit{RIGHT}, \textit{UP} and \textit{DOWN} (blue arrows in the figure). When \textit{LEFT} is taken, primitive action \textit{left} is applied up to $m$ times (similar for the other three options). For any state $s'$ which is $k\leq m$ steps on the left of the starting state $s$, we set $\beta_o(s')=1/(m-k+1)$ so that the probability of the option to be interrupted after any $k \leq m$ steps is $1/m$. If the starting state $s$ is $l$ steps close to the left border with $l<m$ then we set $\beta_o(s')=1/(l-k+1)$ for any state $s'$ which is $k\leq l$ steps on the left. As a result, for all options started $m$ steps far from any wall, $T_{\max} = m$ and the expected duration is $\tau := \tau(s,o) = (m+1)/2$, which reduces to $T_{\max} = l$ and $\tau =(l+1)/2$ for an option started \ $l < m$ step from the wall and moving towards it. More precisely, all options have an expected duration of $\tau(s,o) = \tau$ in all but in $m d$ states, which is small compared to the total number of $d^2$ states. The SMDP formed with this set of options preserves the number of state-action pairs $S_{\O} = S = d^2$ and $A'=A=4$ and the optimal average reward $\rho^*(M) = \rho^*(M')$, while it slightly perturbs the diameter $D_{\O} \leq D + m(m+1)$ (see App.~\ref{app:experiments} for further details). Thus, the two problems seem to be as hard to learn. However the (asymptotic) ratio between the regret upper bounds becomes
\begin{align*}
\lim_{n \rightarrow \infty} &\mathcal{R}(M,n) \leq \frac{(2d-2+ m^2 + m)d + m}{(2d-2)d} \left(\lim_{n \rightarrow \infty}{\sqrt{\frac{n}{T_n}}}\right)\\
&\leq \left(1+ 2\frac{m^2}{d}\right)\left(\lim_{n \rightarrow \infty}{\sqrt{\frac{n}{T_n}}}\right),
\end{align*}
where we assume $m, d \geq 2$. While a rigorous analysis of the ratio between the number of option decision steps $n$ and number of primitive actions $T_n$ is difficult, we notice that as $d$ increases w.r.t.\ $m$, the chance of executing options close to a wall decreases, since for any option only $m d$ out of $d^2$ states will lead to a duration smaller than $\tau$ and thus we can conclude that $n/T_n$ tends to $1/\tau = 2/(m+1)$ as $n$ and $d$ grow. As a result, the ratio would reduce to $(1+2m^2/d)\sqrt{2/(m+1)}$ that is smaller than 1 for a wide range of values for $m$ and $d$. Finally, the ratio is (asymptotically in $d$) minimized by $m \approx \sqrt{d}$, which gives $\mathcal{R}(M,n) = O(d^{-1/4})$, thus showing that as $d$ increases there is always an appropriate choice of $m$ for which learning with options becomes significantly better than learning with primitive actions. In Fig.~\ref{fig:results.ratio} we empirically validate this finding by studying the ratio between the actual regrets (and not their upper-bounds) as $d$ and $m$ (i.e., $T_{\max}$) vary, and with a fixed value of $T_n$ that is chosen big enough for every $d$. As expected, for a fixed value of $d$, the ratio $\mathcal{R}$ first decreases as $m$ increases, reaches a minimum and starts increasing to eventually exceed 1. As $d$ increases, the value of the minimum decreases, while the optimal choice of $m$ increases. This behaviour matches the theory, which suggests that the optimal choice for $m$ increases as $O(\sqrt{d})$. In Fig.~\ref{fig:results.regret} we report the cumulative regret and we observe that high values of $T_{\max}$ worsen the learning performances w.r.t. learning without options ($T_{\max} = 1$, plotted in black). Finally, Fig.~\ref{fig:results.duration} shows that, as $n$ tends to infinity, $T_n/n$ tends to converge to $(m+1)/2$ when $m \ll d$, whereas it converges to slightly smaller values when $m$ is close to $d$ because of the truncations operated by walls.
\textbf{Discussion.} Despite its simplicity, the most interesting aspect of this example is that the improvement on the regret is not obtained by trivially reducing the number of state-action pairs, but it is intrinsic in the way options change the dynamics of the exploration process. The two key elements in designing a successful set of options $\O$ is to preserve the average reward of the optimal policy and the diameter. The former is often a weaker condition than the latter. In this example, we achieved both conditions by designing a set $\O$ where the termination conditions allow any option to end after only one step. This preserves the diameter of the original MDP (up to an additive constant), since the agent can still navigate at the level of granularity of primitive actions. Consider a slightly different set of options $\O'$, where each option moves exactly by $m$ steps (no intermediate interruption). The number of steps to the target remains unchanged from any state and thus we can achieve the optimal performance. Nonetheless, having $\pi^*$ in the set of policies that can be represented with $\O'$ does not guarantee that the {\small\textsc{UCRL-SMDP}}\xspace would be as efficient in learning the optimal policy as {\small\textsc{UCRL}}\xspace. In fact, the expected number of steps needed to go from a state $s$ to an adjacent state $s'$ may significantly increase. Despite being only one primitive action apart, there may be no sequence of options that allows to reach $s'$ from $s$ without relying on the random restart triggered by the target state. A careful analysis of this case shows that the diameter is as large as $D_{\O'} = D(1+m^2)$ and there exists no value of $m$ that satisfies Eq.~\ref{eq:ratio.condition} (see App.~\ref{app:experiments}).
\vspace{-0.1in}
\section{Conclusions}\label{sec:conclusions}
\vspace{-0.1in}
We derived upper and lower bounds on the regret of learning in SMDPs and we showed how these results apply to learning with options in MDPs. Comparing the regret bounds of {\small\textsc{UCRL-SMDP}}\xspace with {\small\textsc{UCRL}}\xspace, we provided sufficient conditions on the set of options and the MDP (i.e., similar diameter and average reward) to reduce the regret w.r.t.\ learning with primitive actions. To the best of our knowledge, this is the first attempt of explaining when and how options affect the learning performance. Nonetheless, we believe that this result leaves space for improvements. In fact, Prop.~\ref{prop:smdp} implies that the class of SMDPs is a strict superset of MDPs with options. This suggests that a more effective analysis could be done by leveraging the specific structure of MDPs with options rather than moving to the more general model of SMDPs. This may actually remove the additional $\sqrt{\log(n/\delta)}$ factor appearing because of sub-exponential distributions in the {\small\textsc{UCRL-SMDP}}\xspace regret. An interesting direction of research is to use this theoretical result to provide a more explicit and quantitative objective function for option discovery, in the line of what is done in~\citep{brunskill2014pac-inspired}. Finally, it would be interesting to extend the current analysis to more sophisticated hierarchical approaches to RL such as MAXQ~\citep{dietterich2000hierarchical}.
{\small
\textbf{Acknowledgement} This research is supported in part by a grant from CPER Nord-Pas de Calais/FEDER DATA Advanced data science and technologies 2015-2020, CRIStAL (Centre de Recherche en Informatique et Automatique de Lille), and the French National Research Agency (ANR) under project ExTra-Learn n.ANR-14-CE24-0010-01.
}
\newpage
\begin{small}
| {'timestamp': '2017-04-18T02:08:31', 'yymm': '1703', 'arxiv_id': '1703.08667', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08667'} | arxiv |
\section{Introduction}
Hidden Markov models (HMMs) are widely and successfully used for modeling sequential data across a range of areas, including signal processing \citep{crouse1998wavelet}, genetics and computational biology \citep{marchini2010genotype, yau2013oncosnp}. The HMM assumes that there is an underlying unobserved Markov chain with a finite number of states, which generates a sequence of observations $y_{1:T} := (y_1, \ldots, y_T)$ via a parametric emission distribution. Inference over the latent sequence $x_{1:T}$ and the parameters can be carried out either from a likelihood \citep{rabiner1986introduction} or Bayesian \citep{scott2002bayesian} perspective. In the latter, conditional sampling can be used where the parameters and latent sequences are updated iteratively conditional on the other being fixed. Latent sequences can be sampled using forward-filtering-backward-sampling (FF-BS) \citep{scott2002bayesian}.
The Factorial HMM (FHMM) \citep{ghahramani1997factorial} is an extended version of the standard HMM where instead of a single latent chain, there are $K$ latent chains. That is, given observations $y_{1:T}$, our goal is to infer a $K \times T$ latent matrix $\mathbf{X} = (\mathbf{x}_1, \ldots, \mathbf{x}_T)$ whose columns evolve according to Markov transitions. Here we focus on the case where $\mathbf{X}$ is binary, in which case the element $x_{k, t}$ indicates whether latent feature $k$ contributes to observation $y_t$.
The joint distribution $p(y_{1:T}, \mathbf{X})$ is given by
\begin{align*}
p(y_{1:T}, \mathbf{X}) &= \left( \prod_{t=1}^T p(y_t | \mathbf{x}_t) \right) \left( p(\mathbf{x}_1) \prod_{t=2}^T p(\mathbf{x}_t | \mathbf{x}_{t-1}) \right) .
\end{align*}
The FF-BS is an exact sampling algorithm and in principle, could be applied to FHMMs. However, this becomes infeasible even for a moderate number of latent sequences $K$. This is due to the state space growing exponentially with $K$. As the full FF-BS has complexity $O(2^{2K} T)$, a computationally cheaper approach is needed, however this comes at the expense of sampling efficiency.
One option is to sample each row of $\mathbf{X}$ conditional on the rest, using the FF-BS. Then each of the updates has a state space of size 2 and the FF-BS steps are inexpensive. However, in this conditional scheme most of the sequences are fixed and thus it is difficult for the sampler to explore the space well. A more general version of this would update a small subset of chains jointly at a higher computational cost, which can still get trapped in local modes.
An alternative idea referred to as Hamming Ball sampling has been suggested by \citet{titsias2014hamming, titsias2017hamming}, which adaptively truncates the space via an auxiliary variable scheme. Unlike the conditional Gibbs updates, it does not restrict parts of $\mathbf{X}$ to be fixed during sampling. Even though it can be less prone to get stuck, for a moderate value of $K$ it may still not explore the whole posterior space.
This problem can be alleviated by ensemble MCMC methods which combine ideas from simulated annealing \citep{kirkpatrick1983optimization} and genetic algorithms \citep{holland1992adaptation}.
One such example is parallel tempering \citep{geyercomputing}.
Instead of running a single chain targeting the posterior, one introduces an ensemble of chains and assigns a temperature to each chain so that every chain would be targeting a tempered version of the posterior. Tempered targets are less peaked and therefore higher temperature chains in the ensemble explore the space well and do not get stuck. The key question becomes how to efficiently exchange information between the chains.
In this paper, we propose a novel ensemble MCMC method which provides an auxiliary variable construction to exchange information between chains. This is a general MCMC method, but our main focus is on improving existing poorly mixing samplers for sequence-type data. Specifically we consider the application to Factorial Hidden Markov Models.
We demonstrate the practical utility of our augmented ensemble scheme in a series of numerical experiments, covering a toy sampling problem as well as inference for FHMMs. The latter involves a simulation study as well as a challenging cancer genomics application.
\section{Augmented ensemble MCMC}
Monte Carlo-based Bayesian inference \citep{andrieu2003introduction} for complex high-dimensional posterior distributions is a challenging problem as efficient samplers need to be able to move across irregular landscapes that may contain many local modes \citep{gilks1996strategies, frellsen2016bayesian, betancourt2017conceptual}. Commonly adopted sampling approaches can explore the space very slowly or become confined to regions around local modes.
Ensemble MCMC (also known as population-based MCMC, or evolutionary Monte Carlo) methods \citep{jasra2007population,neal2011mcmc,shestopaloff2014efficient} can alleviate this problem. This is achieved by introducing an ensemble of MCMC chains and then exchanging information between the chains. Next, we review standard ensemble MCMC approaches and proposal mechanisms that are used to exchange information. Then, we introduce our augmented Gibbs sampler.
\subsection{Standard ensemble sampling methods \label{sec:standardEnsemble}}
Suppose our goal is to sample from a density $\pi$. Instead of sampling $\mathbf{x} \sim \pi(\cdot)$, ensemble MCMC introduces an extended product space $(\mathbf{x}_1, \ldots, \mathbf{x}_K)$ with a new target density $\pi^*$ defined as
$
\pi^*(\mathbf{x}_1, \ldots, \mathbf{x}_K) = \prod_{k=1}^K \pi_k (\mathbf{x}_k),
$
where $\pi_{k} = \pi$ for at least one index. Here we focus on parallel tempering, which introduces a temperature ladder $T_1 < \ldots < T_K$ and associates a temperature with each chain. Denoting the inverse temperature $\beta_k = 1/T_k$, we define the tempered targets $\pi_k(\mathbf{x}_k) := \pi(\mathbf{x}_k)^{\beta_k}$. The idea is that high temperature chains can readily explore the space since the density is flattened by the power transformation, whereas the chain containing the true target density with $T_1 = 1.0$ only samples locally and precisely from the target.
Each chain is updated independently, with occasional information exchange between the chains so that more substantial movement in the higher temperature chains can filter down to the slower moving low temperature chains.
One approach to exchanging information is to propose swapping states (``swap'' move) between chains of consecutive temperatures and then performing an accept/reject operation according to the Metropolis-Hastings ratio \citep{geyercomputing, earl2005parallel}. However, a global move like this is unlikely to be accepted in a high-dimensional sampling setting.
More elaborate approaches can create proposals using genetic algorithms \citep{liang2000evolutionary}, by proposing certain moves between chains which again requires accepting/rejecting based on the Metropolis-Hastings framework.
One such proposal scheme is a one-point crossover move, illustrated as follows:
\[
\begin{aligned}
(x_1, \ldots, x_t, x_{t+1}, \ldots, x_T) \\
(y_1, \ldots, y_t, y_{t+1}, \ldots, y_T) \\
\end{aligned}
\implies
\begin{aligned}
(y_1, \ldots, y_t, x_{t+1}, \ldots, x_T) \\
(x_1, \ldots, x_t, y_{t+1}, \ldots, y_T) \\
\end{aligned}
\]
where the crossover point $t$ could for example be chosen uniformly $t \in \{1,\ldots,T\}$. This is most natural for sequential models where there is dependency between consecutive $x_t$ and $x_{t+1}$. For high-dimensional sequences this is more appealing than a swap move due to being more local and thus leading to higher chance of acceptance. One can similarly construct a two-point crossover move.
However, the accept/reject procedure can be inefficient and very sensitive to \emph{both} the choice of the temperature ladder and algorithmic parameter tuning. Our work seeks to address the latter issue by using an auxiliary variable augmentation that produces a Gibbs sampling scheme.
\setlength{\abovedisplayskip}{3pt}
\setlength{\belowdisplayskip}{3pt}
\subsection{Gibbs sampling using auxiliary variables \label{sec:auxRejfree}}
Now, consider the target in the product space $\pi^*$. Suppose that during MCMC we would like to exchange information between a pair of chains $\pi_i(\mathbf{x}_i)$ and $\pi_j(\mathbf{x}_j)$ where $\mathbf{x}_i$ and $\mathbf{x}_j$ are $T$-dimensional vectors that indicate the current states of these chains. Here we describe an auxiliary variable move, which uses the idea of a one-point crossovers and leads to a Gibbs update for a two-point crossover.
We introduce two auxiliary variables $\mathbf{u}$ and $\mathbf{v}$, that live in the same space as $\mathbf{x}_i$ and $\mathbf{x}_j$, drawn from an auxiliary distribution $p(\mathbf{u}, \mathbf{v} | \mathbf{x}_i, \mathbf{x}_j)$. Without loss of generality we assume that this auxiliary distribution is uniform over all possible one-point crossovers between $\mathbf{x}_i$ and $\mathbf{x}_j$.
We also introduce the set $\textsc{cr}(\mathbf{x}, \mathbf{y})$ to denote all $T$ crossovers between the vectors $\mathbf{x}$ and $\mathbf{y}$. The auxiliary distribution $p(\mathbf{u}, \mathbf{v} | \mathbf{x}_i, \mathbf{x}_j)$ is precisely a uniform distribution over all pairs $(\mathbf{u}, \mathbf{v}) \in \textsc{cr}(\mathbf{x}_i, \mathbf{x}_j)$. This distribution is also symmetric, i.e. $p(\mathbf{u}, \mathbf{v} | \mathbf{x}_i, \mathbf{x}_j) = p(\mathbf{x}_i, \mathbf{x}_j | \mathbf{u}, \mathbf{v})$.
Using the auxiliary variables we can exchange information between $\mathbf{x}_i$ and $\mathbf{x}_j$ through the intermediate step of sampling the auxiliary variables $(\mathbf{u},\mathbf{v})$ based on the following two-step Gibbs procedure:
\begin{enumerate}
\item Generate $(\mathbf{u}, \mathbf{v}) \sim p(\mathbf{u}, \mathbf{v} | \mathbf{x}_i, \mathbf{x}_j)$
\item Generate $(\mathbf{x}_i, \mathbf{x}_j) \sim p(\mathbf{x}_i, \mathbf{x}_j | \text{rest})$, where
\begin{align*}
p(\mathbf{x}_i, \mathbf{x}_j | \text{rest}) &= \frac{1}{Z} \pi_i(\mathbf{x}_i) \pi_j(\mathbf{x}_j) p(\mathbf{u}, \mathbf{v} | \mathbf{x}_i, \mathbf{x}_j) \\
&= \frac{1}{Z} \pi_i(\mathbf{x}_i) \pi_j(\mathbf{x}_j) p(\mathbf{x}_i, \mathbf{x}_j | \mathbf{u}, \mathbf{v}) \\
&= \frac{1}{Z} \pi_i(\mathbf{x}_i) \pi_j(\mathbf{x}_j) I((\mathbf{x}_i, \mathbf{x}_j) \in \textsc{cr} (\mathbf{u}, \mathbf{v}))
\end{align*}
\end{enumerate}
where the normalising constant $Z = Z(\mathbf{u}, \mathbf{v})$ is
$Z(\mathbf{u}, \mathbf{v}) = \sum_{(\mathbf{y}_i, \mathbf{y}_j) \in \textsc{cr}(\mathbf{u}, \mathbf{v})} \pi_i(\mathbf{y}_i) \pi_j(\mathbf{y}_j).$
The first step of the above procedure selects a random crossovered pair $(\mathbf{u}, \mathbf{v})$, while the second step
conditions on this selected pair and jointly samples $(\mathbf{x}_i,\mathbf{x}_j)$ from the exact conditional posterior
distribution that takes into account the information coming from the actual chains $\pi_i$ and $\pi_j$.
\begin{figure}[t]
\vskip -0.5em
\begin{center}
\centerline{\includegraphics[width=\columnwidth]{fig/schema_crossover.pdf}}
\caption{Schematic overview of the auxiliary variable crossover move. (a) We start with two sequences $\mathbf{x}_i$ and $\mathbf{x}_j$. (b) Now we construct auxiliary variables $\mathbf{u}, \mathbf{v}$ by applying a uniform one-point crossover to $\mathbf{x}_i, \mathbf{x}_j$. (c) Next, we consider all possible crossovers of $\mathbf{u}, \mathbf{v}$, and according to probabilities $\pi_i(\mathbf{z}_i) \pi_j(\mathbf{z}_j)$, we accept one of these configurations as the new value of $\mathbf{x}_i, \mathbf{x}_j$.}
\label{fig:schema_crossover}
\end{center}
\vskip -0.2in
\end{figure}
Since the above is a Gibbs operation it leads to new state vectors for the chains $\pi_i$ and $\pi_j$ that are always accepted. To prove this explicitly we compute the effective marginal proposal and show that the corresponding Metropolis-Hastings acceptance probability is always one.
Given the current states $(\mathbf{x}_i, \mathbf{x}_j)$, we denote the proposed states by $(\mathbf{z}_i, \mathbf{z}_j)$
and the marginal proposal distribution by $Q(\mathbf{z}_i, \mathbf{z}_j | \mathbf{x}_i, \mathbf{x}_j)$. This proposal, defined by the above
two-step Gibbs procedure, is a mixture:
\begin{align*}
&Q(\mathbf{z}_i, \mathbf{z}_j | \mathbf{x}_i, \mathbf{x}_j) = \\
&= \iint \frac{1}{Z} \pi_i(\mathbf{z}_i) \pi_j(\mathbf{z}_j) p(\mathbf{z}_i, \mathbf{z}_j | \mathbf{u}, \mathbf{v}) p(\mathbf{u}, \mathbf{v} | \mathbf{x}_i, \mathbf{x}_j) d\mathbf{u} d\mathbf{v} \\
&= \pi_i(\mathbf{z}_i) \pi_j(\mathbf{z}_j) \iint \frac{1}{Z} p(\mathbf{z}_i, \mathbf{z}_j | \mathbf{u}, \mathbf{v}) p(\mathbf{x}_i, \mathbf{x}_j | \mathbf{u}, \mathbf{v}) d\mathbf{u} d\mathbf{v} \\
&= \pi_i(\mathbf{z}_i) \pi_j(\mathbf{z}_j) H(\mathbf{z}_i, \mathbf{z}_j | \mathbf{x}_i, \mathbf{x}_j).
\end{align*}
The Metropolis-Hastings acceptance probability under this proposal is
\begin{align*}
\alpha
&= \frac{\pi_i(\mathbf{z}_i) \pi_j(\mathbf{z}_j) Q(\mathbf{x}_i, \mathbf{x}_j | \mathbf{z}_i, \mathbf{z}_j)}{\pi_i(\mathbf{x}_i) \pi_j(\mathbf{x}_j) Q(\mathbf{z}_i, \mathbf{z}_j | \mathbf{x}_i, \mathbf{x}_j)} \\
&= \frac{\pi_i(\mathbf{z}_i) \pi_j(\mathbf{z}_j) \pi_i(\mathbf{x}_i) \pi_j(\mathbf{x}_j) H(\mathbf{x}_i, \mathbf{x}_j | \mathbf{z}_i, \mathbf{z}_j)}{\pi_i(\mathbf{x}_i) \pi_j(\mathbf{x}_j) \pi_i(\mathbf{z}_i) \pi_j(\mathbf{z}_j) H(\mathbf{z}_i, \mathbf{z}_j | \mathbf{x}_i, \mathbf{x}_j)}.
\end{align*}
Since $H(\mathbf{z}_i, \mathbf{z}_j | \mathbf{x}_i, \mathbf{x}_j) = H(\mathbf{x}_i, \mathbf{x}_j | \mathbf{z}_i, \mathbf{z}_j)$ due to symmetry, all terms cancel out and $\alpha = 1$. So our proposal will be always accepted.
To simulate from $Q(\mathbf{z}_i, \mathbf{z}_j | \mathbf{x}_i, \mathbf{x}_j)$ in practice, we can use its mixture representation above, i.e. first generate auxiliary variables $p(\mathbf{u}, \mathbf{v} | \mathbf{x}_i, \mathbf{x}_j)$ and then conditional on those, generate the new value from $p(\mathbf{z}_i, \mathbf{z}_j | \mathbf{u}, \mathbf{v})$. We note that even though both of these steps are implemented as one-point crossovers, the overall proposal can lead to a two-point crossover as illustrated in Figure~\ref{fig:schema_crossover}.
Specifically, to implement this, first we sample $(\mathbf{u}, \mathbf{v})$ uniformly from the set $\textsc{cr}(\mathbf{x}_i, \mathbf{x}_j)$. Now, conditional on the obtained $(\mathbf{u}, \mathbf{v})$, let us denote the crossover of $\mathbf{u}$ and $\mathbf{v}$ at point $t$ by $(\mathbf{z}_i^{(t)}, \mathbf{z}_j^{(t)})$. The second step is to iterate
over $t \in \{1, \ldots, T\}$ and compute quantities $a_t := \pi_i(\mathbf{z}_i^{(t)}) \pi_j(\mathbf{z}_j^{(t)})$. The pair $(\mathbf{z}_i^{(t)}, \mathbf{z}_j^{(t)})$ will be accepted as the new value of $(\mathbf{x}_i, \mathbf{x}_j)$ with probability proportional to $a_t$.
A further extension of the above procedure is obtained by modifying the auxiliary distribution
$p(\mathbf{u}, \mathbf{v} |\mathbf{x}_i, \mathbf{x}_j)$ to become uniform over the union of the
sets $\textsc{cr}(\mathbf{x}_i, \mathbf{x}_j)$ and $\textsc{cr}(\mathbf{x}_j, \mathbf{x}_i)$ since,
due to the deterministic ordering, the crossovers between $\mathbf{x}_i$ with $\mathbf{x}_j$
and the reverse crossovers between $\mathbf{x}_j$ with $\mathbf{x}_i$ are not identical. The auxiliary
distribution $p(\mathbf{u}, \mathbf{v} |\mathbf{x}_i, \mathbf{x}_j)$ still remains symmetric and all above
properties hold unchanged. The only difference is that now we are considering
$2 T$ crossovers and in order to sample from $p(\mathbf{u}, \mathbf{v} |\mathbf{x}_i, \mathbf{x}_j)$
we need first to flip a coin to decide the order of $\mathbf{x}_i$ and $\mathbf{x}_j$.
Complete pseudocode of the whole procedure is given in Supplementary.
The above sampling scheme is general and it can be applied to arbitrary
MCMC inference problems involving both continuous and discrete variables. In the next
section we apply the proposed method to a challenging inference problem in Factorial HMMs (FHMMs).
\section{Application to FHMMs \label{sec:ensembleFHMM}}
Here, we apply the augmented ensemble scheme to FHMMs in order to improve on existing poorly mixing samplers. We achieve this via an ensemble of chains over suitably defined tempered posteriors. For a latent variable model, one can either temper the whole joint distribution or just the emission likelihood. We chose the latter, so the target posterior of interest becomes
$$
\pi_k(\mathbf{X}) := p_k(\mathbf{X} | y_{1:T}) \propto p(\mathbf{X}) p(y_{1:T} | \mathbf{X})^{\beta_k}
$$
where $\mathbf{X}$ is a $K \times T$ binary matrix. As the ensemble crossover scheme\xspace was originally defined on vectors, there are multiple ways to extend this to matrices. One can perform crossovers on either rows or columns of a matrix, potentially considering a subset of those. Here we have decided to focus on a crossover move defined on the \emph{rows} of $\mathbf{X}$, specifically on all $K$ rows of $\mathbf{X}$.
The core computational step of the algorithm is to compute quantities $a_t$ for all crossover points $t$. We show that these can be computed recursively in an efficient way.
Let $\mathbf{U}$ and $\mathbf{V}$ be the current states of the auxiliary matrices for chains $i$ and $j$. Comparing their crossovers at two consecutive points $t-1$ and $t$, denoted by $(\mathbf{Z}^{(i)}_{t-1}, \mathbf{Z}^{(j)}_{t-1})$ and $(\mathbf{Z}^{(i)}_{t}, \mathbf{Z}^{(j)}_{t})$, we note that these can differ just in column $t$:
\begin{align*}
\mathbf{Z}^{(i)}_{t-1} := (\mathbf{v}_1, \ldots, \mathbf{v}_{t-1}, \mathbf{u}_t, \mathbf{u}_{t+1}, \ldots, \mathbf{u}_T), \\
\mathbf{Z}^{(i)}_{t} := (\mathbf{v}_1, \ldots, \mathbf{v}_{t-1}, \mathbf{v}_t, \mathbf{u}_{t+1}, \ldots, \mathbf{u}_T).
\end{align*}
As a result, the values $a_t = \pi_i(\mathbf{Z}_t^{(i)}) \pi_j(\mathbf{Z}_t^{(j)})$ can be computed recursively. Indeed, given the previous value of $\pi_i(\mathbf{Z}_{t-1}^{(i)})$, we can compute $\pi_i(\mathbf{Z}_{t}^{(i)})$ by accounting for the following two cases: first, change in emission likelihood from $p(y_t | \mathbf{u}_t)^{\beta_i}$ to $p(y_t | \mathbf{v}_t)^{\beta_i}$, and second, change in the transitions from $\mathbf{v}_{t-1} \rightarrow \mathbf{u}_t \rightarrow \mathbf{u}_{t+1}$ to $\mathbf{v}_{t-1} \rightarrow \mathbf{v}_t \rightarrow \mathbf{u}_{t+1}$.
By denoting the overall transition probability $p(\mathbf{u}_{t+1} | \mathbf{u}_t)$ for chain $i$ by $A^{(i)}(\mathbf{u}_t, \mathbf{u}_{t+1})$,
we can express $\pi_i(\mathbf{Z}^{(i)}_{t})$ in terms of $\pi_i(\mathbf{Z}^{(i)}_{t-1})$ as follows
$
\pi_i(\mathbf{Z}^{(i)}_{t}) = \pi_i(\mathbf{Z}^{(i)}_{t-1}) \cdot c^{(i)}_t
$
where
\[
c^{(i)}_t := \frac{ A^{(i)}(\mathbf{v}_{t-1}, \mathbf{v}_t) A^{(i)}(\mathbf{v}_{t}, \mathbf{u}_{t+1}) }
{ A^{(i)}(\mathbf{v}_{t-1}, \mathbf{u}_t) A^{(i)}(\mathbf{u}_{t}, \mathbf{u}_{t+1}) } \cdot
\frac{p(y_t | \mathbf{v}_t )^{\beta_i}}{p(y_t | \mathbf{u}_t )^{\beta_i}} .
\]
Now we can compute the quantities $a_t$ recursively as follows
$
a_t = a_{t-1} \cdot c^{(i)}_t \cdot c^{(j)}_t .
$
As the values of $a_t$ can be normalised to sum to one, we can arbitrarily fix the reference value $a_0 \gets 1$. The computation of every correction term $a_t$ is of the complexity $O(K)$, and the overall cost for all $a_t$ values is $O(KT)$, being relatively cheap. As we typically need to perform the crossover moves only occasionally, the ensemble crossover scheme\xspace provides a way to improve the poorly mixing samplers for FHMMs at a small extra computational cost.
\section{Experiments}
First, we demonstrate the proposed sampling method on a multimodal toy inference problem. Then, we focus on Bayesian inference for FHMMs: we compare various samplers in a simulation study and then consider a challenging tumor deconvolution example.
In both experiments, we compare a standard single-chain sampling technique (a Gibbs sampler or the Hamming Ball sampler) with the respective ensemble versions.
For ensemble samplers, we compare our proposed augmentation scheme (``augmented crossover'') with two additional baseline exchange moves: the standard swap move (``swap'') and a uniformly chosen crossover (``random cr'') within the accept-reject Metropolis-Hastings framework. In all experiments, we run an ensemble of two MCMC chains, with temperatures $T_1 = 1.0$ and $T_2 = 5.0$, carrying out an exchange move every 10-th iteration.
\subsection{Toy example \label{sec:toy}}
We consider the following multimodal toy sampling problem, where the target distribution is binary and has multiple separated modes. Specifically, we fix the dimensionality $T=50$ and divide the sequence $\mathbf{x}$ into $B$ contiguous blocks as follows $(\mathbf{x}^{(1)}, \ldots, \mathbf{x}^{(B)})$. In each of the blocks, we define a bimodal distribution, having two peaked modes $\mathbf{x}^{\text{mode}_1} := (1, 1, \ldots, 1)$ and $\mathbf{x}^{\text{mode}_2} := (0, 0, \ldots, 0)$, such that the probability of any binary vector $\mathbf{x}^{(j)}$ in block $j$ is given by
\begin{equation} \label{eq:toy}
p(\mathbf{x}^{(j)}) \propto \alpha_j^{\min(\text{d}(\mathbf{x}^{(j)},\, x^{\text{mode}_1}),\; \text{d}(\mathbf{x}^{(j)},\, \mathbf{x}^{\text{mode}_2}))}
\end{equation}
where $\text{d}(\cdot, \cdot)$ denotes the Hamming distance between two binary vectors and $\alpha_j$ is a block-specific parameter which controls how peaked the modes are. As a result, the further we go from the modes (in terms of Hamming distance), the less likely we are to observe that state. This has been illustrated in Figure~\ref{fig:toy_distr}.
We extend the above to define the joint $p(\mathbf{x})$ factorising over the blocks as follows
\[
p(\mathbf{x}) \propto \prod_{j=1}^B p(\mathbf{x}^{(j)}) = \prod_{j=1}^B \alpha_j^{\min(\text{d}(\mathbf{x}^{(j)},\, \mathbf{x}^{\text{mode}_1}),\; \text{d}(\mathbf{x}^{(j)},\, \mathbf{x}^{\text{mode}_2}))}
\]
Within each block, the probability of a given state depends on its distance to the closest mode.
This construction induces strong within-block dependencies. By varying the number of blocks within a sequence of fixed length, we can interpolate between a strong global correlation and local dependencies with a highly multimodal structure.
The total number of modes for this distribution is $2^B$, as illustrated in Figure~\ref{fig:toy_multimodal}.
\begin{figure}[!t]
\centering
\includegraphics[width=\columnwidth]{fig/toy_distr.png}
\caption{The bimodal within-block probability distribution as defined in eq.~\eqref{eq:toy} for a binary sequence of length 25 shown in (a) and its tempered version in (b).}
\label{fig:toy_distr}
\vspace*{\floatsep}
\includegraphics[width=0.5\columnwidth]{fig/schema_toy.png}
\caption{Multiple modes of the distribution of $(\mathbf{x}^{(1)}, \ldots, \mathbf{x}^{(B)})$, colour coding: dark = 1, light = 0.}
\label{fig:toy_multimodal}
\vspace*{\floatsep}
\includegraphics[width=\columnwidth]{fig_toy/b10.png}
\caption{Heatmaps representing the trace plots of $\mathbf{x}$ for the experiment with $B=10$ blocks, running a single chain Gibbs sampler (first panel), and its ensemble versions with various exchange moves: swap, random crossover, augmented crossover (in four panels). For each MCMC iteration, the elements of $\mathbf{x}$ have been colour coded: dark = 1, light = 0.}
\label{fig:b10}
\vspace*{\floatsep}
\includegraphics[width=\columnwidth]{fig/toy_njumps}
\caption{The cumulative number of jumps between modes ($y$-axis) over MCMC iterations ($x$-axis) for various experiments (block sizes $B \in \{2, 5, 10\}$) on average (coloured lines) together with 25\% and 75\% quantiles (shaded areas) over 10 repeated runs.}
\label{fig:toy_njumps}
\end{figure}
In our experiments, we vary $B \in \{2, 5, 10\}$, resulting in distributions having $2^2, 2^5, 2^{10}$ modes. We generate $\alpha_j \in U(\{0.01, 0.02, \ldots, 0.05\})$. All samplers are initialised from the same value (one of the modes) and run for 10,000 iterations.
The resulting traces of $\mathbf{x}$ have been shown as heatmaps in Figure~\ref{fig:b10} for $B=10$ (see Supplementary Figures for $B=2$ and $B=5$).
As a summary statistic, we have shown the cumulative number of jumps between modes over repeated experiments in Figure~\ref{fig:toy_njumps} .
In all scenarios, the single chain Gibbs sampler expectedly struggles to escape the mode from which it was initialised, with ensemble methods better at moving between modes.
For strong global correlations (corresponding to small $B$ values), the baseline exchange moves ``swap'' and ``random crossover'' are reasonably efficient, though still result in a smaller number of mode jumps than the ``augmented crossover''.
Now when increasing $B$, the dependency structure becomes more local, resulting in a much more multimodal sampling landscape. For $B=10$, the simple ``swap'' and ``random crossover'' moves struggle to accept any proposals at all and the benefit of our augmentation scheme becomes clear. In this highly multimodal setting with $2^{10}$ modes, the total number of modes visited by our ``augmented crossover'' (average 144) is much higher than for the ``swap'' (3) and ``random crossover'' (27) moves.
\subsection{Tumor deconvolution example \label{sec:tumor}}
The following example is motivated by an application in cancer genomics. Certain mutations in the cancer genome result in a loss of DNA integrity leading to copy number alterations due to the duplication or loss of certain DNA regions. Tumor samples consist of heterogeneous cell subpopulations and it is of interest to identify the subpopulations to study their phylogeny and gain insight into the clonal evolution \citep{ha2014titan, gao2016punctuated}. However, as DNA sequencing of bulk tissue samples produces aggregate data over all constituent cell subpopulations, the observed sequencing read counts must be deconvolved to reveal the underlying latent genetic architecture.
The additive Factorial HMM is a natural model to consider where each latent chain corresponds to a putative cell subpopulation. However, it is important that the exploration of the state space of the latent chains allows us to identify the different subpopulation configurations that are compatible with the observed sequencing data since there maybe a number of plausible possibilities. This is illustrated in Figure~\ref{fig:subclonal}. A poorly mixing sampler which is exploring only one of the possible latent explanations could lead to misleading conclusions regarding the subclonal architecture of a tumor. We wanted to examine if the ensemble scheme we propose could provide a more effective means of posterior sampling.
\begin{figure}[!t]
\begin{center}
\includegraphics[width=\columnwidth]{fig_tumor_FHMM/subclonal_schema.pdf}
\caption{Existence of multiple subclonal configurations, both consisting of $K=3$ subpopulations, which are indistinguishable when sequence counts (in top panel) are observed as aggregate over subpopulations. }
\label{fig:subclonal}
\end{center}
\end{figure}
\subsubsection{Simulation study}
Lets consider the emission model
$
y_t | \mathbf{x}_t, \mathbf{w}, h \sim \mathcal{N} \left (h \sum_{k=1}^K w_k x_{k, t}, \; \sigma^2 \right )
$
where $y_t$ denote the observed sequence read counts at a locus $t$ and $h$ is the expected sequencing depth. Each $w_k$ corresponds to the fraction of $k$-th subpopulation ($w_k \ge 0$, $\sum_k w_k = 1$) whose mutation profile is given by the $k$-th row of $\mathbf{X}$. Here $x_{k,t} \in \{0, 1\}$ denotes whether the $k$-th population has a copy number alteration at position $t$ or not.
Note that this is not a complete model of real-world sequencing data but a simplified version to demonstrate the utility of the proposed ensemble MCMC methods. The results presented here should extend to the more complex cases. Further work to construct a sufficiently complex model to capture the variations within real sequencing data, such as single nucleotide polymorphisms, is beyond the scope of this paper and will be developed in future work.
First, we investigated the performance of sampling schemes for FHMMs in the presence of multimodality in a controlled setting. We generated observations from the emission distribution with $K=3$ with weights such that $w_1 + w_2 \approx w_3$. As a result, data generating scenarios $\mathbf{x}_t = (1, 1, 0)$ and $\mathbf{x}_t = (0, 0, 1)$ are both plausible underlying latent explanations.
For data generation, we used a latent $\mathbf{X}$ matrix having a block structure of columns $(1, 1, 0)$ followed by a block of $(0, 0, 0)$, as illustrated in Figure~\ref{fig:generatedX}(a), but using altogether 20 blocks. We fixed $h=15$, $\mathbf{w} = (0.2+\varepsilon, 0.3+\varepsilon, 0.5-2\varepsilon)$ with $\varepsilon = 0.01$ and $\sigma^2=1$. Each of these blocks has two modes, but due to the structured FHMM prior on $\mathbf{X}$, the mode $(0, 0, 1)$ corresponds to a slightly higher log-posterior value. For example, the three examples provided in Figure~\ref{fig:generatedX} are ordered in terms of posterior probability (c) $>$ (b) $>$ (a).
\begin{figure}[!ht]
\begin{center}
\includegraphics[width=\columnwidth]{fig_toy_FHMM/generatedX_small.png}
\vspace{-5mm}
\caption{Small illustration of three possible modes for the $\mathbf{X}$ matrix used in the simulation study. }
\label{fig:generatedX}
\end{center}
\end{figure}
For inference in FHMMs, we considered two single chain samplers for $\mathbf{X}$: one-row updates conditional on the rest (``Gibbs''), and the Hamming Ball sampler (``HB''). We then considered ensemble versions of both of these samplers, as shown in Figure~\ref{fig:toy_FHMM} (left column for ``Gibbs'' and right column for ``HB'').
All chains were initialised from the mode with $x_{3, t} = 0$, i.e. mode (a) in Figure~\ref{fig:generatedX}, and were ran for 10~000 iterations. Exchange moves were carried out every 10th iteration.
\begin{figure*}
\centering
\includegraphics[width=\textwidth]{fig_toy_FHMM/logposteriors.png}
\includegraphics[width=\textwidth]{fig_toy_FHMM/trace_of_X1.png}
\includegraphics[width=\textwidth]{fig_toy_FHMM/autocor.png}
\vspace{-3mm}
\caption{Simulation study comparing sampling techniques for FHMMs: ensemble versions of the Gibbs sampler (left column) and of the Hamming Ball sampler (right column). (a, b) Traces of log-posterior for the single chain sampler (``Gibbs'', ``HB'') and three ensemble versions. (c, d) Heatmaps showing the traces for the first row ($k=1$) of $\mathbf{X}$ (colour coded: dark = 1, light = 0), zoomed in to MCMC iterations 1000 - 2000 ($y$-axis). (e,f) Distribution of the normalised Hamming distance: boxplots in the background, overlaid with individual values) for various lags 1, 10, 50 ($x$-axis).}
\label{fig:toy_FHMM}
\end{figure*}
\begin{figure*}
\centering
\includegraphics[width=\textwidth]{fig_tumor_FHMM/merged_tumor_FHMM.png}
\vspace{-5mm}
\caption{FHMM fitted to real sequencing data, using HB$(r=3)$ single-chain sampler and the corresponding ensemble samplers (``swap'', ``random cr'', ``augmented cr''). (a) Traces of log-posterior ($y$-axis), and (b) traces of $\mathbf{X}$ over MCMC iterations for each $5$ rows of $\mathbf{X}$ (row panels 1 -- 5), with the genomic coordinates ($x$-axis) zoomed in to selected chromosomes.}
\label{fig:real_traces}
\end{figure*}
For ``Gibbs'', the single chain sampler and the ``swap'' ensemble have not moved from the initialisation, the ``random cr'' ensemble scheme shows some improvement, but the ``augmented cr'' has quickly moved towards values of $\mathbf{X}$ with higher posterior probability (see Figure~\ref{fig:toy_FHMM}(a)). It also exhibits much better mixing, as seen from the traces of the first row of $\mathbf{X}$, i.e. traces of $x_{1, 1:T}$ shown in Figure~\ref{fig:toy_FHMM}(c). We note that $x_{1, t} = 0$ values correspond to the more probable mode.
As a single chain sampler, ``HB'' quickly achieves higher log-posterior values than ``Gibbs''. Therefore, for ``HB'' the gain from ``swap'' and ``random cr'' ensemble techniques is relatively smaller, but still the ``augmented cr'' has quickly moved towards higher log-posterior values.
To quantify mixing on binary state spaces, we have calculated the Hamming distance between $\mathbf{X}^{(t)}$ and $\mathbf{X}^{(t + \text{lag})}$ for various lag values $\{1, 10, 50\}$, normalised by $\text{dim}(\mathbf{X})$. Panels (e, f) show the distribution of these summary statistics, confirming that the augmented crossover scheme reduces notably the dependence between consecutive samples of $\mathbf{X}$.
\begin{table}[!t]
\captionof{table}{Computation times in seconds for the simulation study (two chains, 10~000 iterations).
}
\centering
\begin{tabular}{rrrr}
\hline
HB & swap & random cr & augmented cr \\
130 & 132 & 133 & 135 \\
\hline
Gibbs & swap & random cr & augmented cr \\
213 & 216 & 214 & 218 \\
\hline
\end{tabular}
\label{tab:comptimes}
\vspace{-1em}
\end{table}
We have shown above that the complexity of augmented crossover scheme is linear $O(KT)$, which is also the case for the ``swap'' and ``random cr'' moves. To explore the respective costs in practice, we measured the total computation time for our Rcpp implementation. To establish the baseline cost of running a two-chain ensemble without any exchange moves in a sequential implementation, we indicate this baseline time in the first column (``Gibbs'' and ``HB'') of Table~\ref{tab:comptimes}. We note that this could be halved by a parallel implementation. The extra cost for all exchange moves are relatively small. Even though the extra time for the ``swap'' and ``random cr'' schemes is just slightly smaller than for ``augmented cr'', this is a small price to pay for an improvement in mixing, especially compared to the high baseline cost of running an FHMM sampler.
\subsubsection{Tumor data analysis}
Next we consider whole-genome tumor sequencing data for bladder cancer \citep{cazier2014whole}.
To illustrate the utility of our sampling approach, we used data from one patient (patient ID: 451) and took a thinned sample of 10,877 loci. We placed a vague Gaussian prior on the expected sequencing depth, $h \sim \mathcal{N}(\mu_h, \sigma^2_h)$ with $\mu_h = 180, \sigma_h = 30$, and integrated out $h$, resulting in the marginal likelihood
\begin{align*}
y_t | \mathbf{x}_t, \mathbf{w} \sim \mathcal{N} \left (\mu_h \sum_{k=1}^K w_k x_{k, t}, \; \sigma^2 + \sigma^2_h \left( \sum_{k=1}^K w_k x_{k, t} \right)^2 \right ) .
\end{align*}
Here each row of $\mathbf{X}$ corresponds to a single chromosome and the binary state indicates whether a copy of that DNA region exists or not. We fixed $K=6$, where one of the latent sequences is always fixed to 1, representing a baseline, unaltered chromosome.
We used a Hamming Ball Sampler with radius $r = 3$ as a single chain sampler, and its tempered ensemble versions ``swap'', ``random cr'', and ``augmented cr''.
Since it is the sampling efficiency of the latent chains $\mathbf{X}$ in the FHMM rather than associated parameters that is the direct target of our sampler, we fixed $\mathbf{w}$ value to $(0.075, 0.125, 0.15, 0.175, 0.2, 0.275)$ in these experiments. As a result, all samplers would be exploring the same conditional posterior, and we are able to directly compare the subclonal configurations identified by various sampling algorithms. Otherwise, joint updating of the weights $\mathbf{w}$ (though entirely feasible) would lead to label swapping effects and the possibility of samplers exploring entirely different regimes that then make direct comparisons across sampling methods more challenging.
Figure \ref{fig:real_traces} shows the log-posterior traces and the traces of $\mathbf{X}$ for selected chromosomes, when using ensembles of the HB$(r=3)$ sampler. After a burn-in period of 10~000 iterations, the ``augmented cr'' ensemble has identified a probable configuration of $\mathbf{X}$ and it continues to explore parts of the state space which have higher posterior probability than those identified by other samplers.
The augmented sampler is much better at capturing the uncertainty in underlying latent configurations (see Figure~\ref{fig:real_traces}(b)). For example, the third row corresponds to a subpopulation which has an extra copy of chromosome~21, but there is uncertainty whether it co-occurs with a whole extra copy of chromosome~22. Examining chromosome~17, the single-chain HB sampler and the ``random cr'' ensemble have identified a more fragmented latent configuration, whereas ``swap'' and ``augmented cr'' have combined these fragments into an alternative, more probable explanation. In biological terms, this is important since the more fragmented configuration would suggest a highly genomically unstable cancer genome related to a loss of genome integrity checkpoint mechanisms, whilst the alternative suggests a more moderate degree of instability.
\section{Conclusion}
We introduce an ensemble MCMC method to improve poorly mixing samplers for FHMMs. This is achieved by combining parallel tempering and a novel exchange move between pairs of chains achieved through an auxiliary variable augmentation. The former introduces a chain which explores the space freely and does not get stuck, whereas the latter provides an efficient procedure to exchange information between a tempered chain and our target. The proposed method is a general purpose ensemble MCMC approach, but its most natural application case are sequential models. Specifically, we see this most useful for a broad class of models assuming Markov structure, where the augmented crossover move can be carried out at a cheap extra computational cost. A natural extension of this work is to integrate our ensemble technique into a sampling scheme for targeting latent variables $\mathbf{X}$ \textit{and} parameters $\theta$ in a joint model $\pi(\mathbf{X}, \theta)$. More exploration could also be carried out to explore optimal strategies for selecting or adapting the temperature ladder. However, our analyses suggest that for any given temperature ladder, the suggested augmented crossovers outperform non-augmented, classic approaches.
\section*{Acknowledgements}
KM is supported by a UK Engineering and Physical Sciences Research Council Doctoral Studentship. CY is supported by a UK Medical Research Council Research Grant (Ref: MR/P02646X/1) and by The Alan Turing Institute under the EPSRC grant EP/N510129/1’.
| {'timestamp': '2019-02-28T02:02:28', 'yymm': '1703', 'arxiv_id': '1703.08520', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08520'} | arxiv |
\subsection{Evaluation}
\newcommand{400}{400}
\newcommand{250}{250}
\newcommand{37}{37}
We evaluated \textsc{BuildDiff}{} in two ways: first, we used extensive JUnit testing to check whether our approach can detect each single build change type. Second, we performed a manual evaluation with 400{} build-changing commits that were randomly selected from the build files of the 30{} open source Java projects.
\subsubsection{JUnit Tests}
For each build change type, we first constructed a \texttt{pom.xml} pair that contains exactly one instance of a particular change type and the corresponding JUnit test case.
In addition, we selected subsequent versions of actual \texttt{pom.xml} files from open source Java projects that contain multiple changes and created JUnit tests for those as well. These pairs have been selected by an expert with more than 7 years of \textsc{Maven}{} experience to cover changes that are often performed in practice. In total, we developed 250{} JUnit tests showing that \textsc{BuildDiff}{} is capable of correctly extracting and classifying each single build change in isolation, as well as co-occurring build changes.
\subsubsection{Manual Investigation}
To show that \textsc{BuildDiff}{} is also working on real world projects and that it can extract build changes as they are understood by software developers, we invited two PhD students to evaluate 400{} build-changing commits. Both students are studying software engineering and have more than 4 years of experience with \textsc{Maven}{}. They received the same set of 400{} \texttt{pom.xml} pairs containing 745 build changes. Prior to the experiment, we briefly explained our taxonomy of build changes to them. In the experiment, we asked each student to label the changes in the \texttt{pom.xml} pairs according to our change taxonomy and compared the output among the participants and with the output of \textsc{BuildDiff}{}.
\textbf{Data Selection.}
\tabref{tab:projectData} shows the list of open source Java projects from which we randomly selected
400{} commits that contained changes to a \texttt{pom.xml} build file.
We calculated the sample size based on a population size of 66,984 commits that contain build changes (\tabref{tab:projectData}, sum of column \#BCC), with a margin of error of 5\% and a confidence level of 95\%. The minimum sample size is 382 commits\footnote{\url{https://www.checkmarket.com/sample-size-calculator/}} and we finally decided to randomly select 400{} commits to exceed the minimum sample size.
The total amount of build changes in the data set is 641,056. By randomly selecting the commits for the evaluation, we missed to evaluate 37{} of the 95{} change types (or 44\%). However, the analysis of these missing change types in our subject systems showed that these changes only represent 0.9\% of the total build changes (5,760 out of 641,056). Hence, we can safely assume that our sample set sufficiently covers the majority of build changes in our data set.
\textbf{Evaluation.} For each of the 400{} commits, we provided the study participants with the original and modified version of the build file. We asked each participant to go through all of the selected commits and assign each change to the corresponding change type from our taxonomy. We then compared the changes that were assigned by the participants with the list of build changes extracted by \textsc{BuildDiff}{}.
With the results from each participant, we calculated \textit{precision} and \textit{recall} to measure the performance of our approach. Following the approach of Fluri \emph{et al.}\xspace \cite{Fluri2007ChangeDistilling} used for evaluating ChangeDistiller, we calculated precision and recall as:
\[\textrm{precision} = \frac{\textrm{\#relevant changes found}}{\textrm{\#changes found}}\]
\[\textrm{recall} = \frac{\textrm{\#relevant changes found}}{\textrm{\#changes expected}}\]
\textit{Precision} measures how many of the changes that were extracted by our approach were also detected by a study participant. \textit{Recall} measures how many of the changes that a study participant has found have also been found by our approach. Similar to the evaluation of Dintzner \emph{et al.}\xspace \cite{Dintzner2013Extracting}, we are able to evaluate the correctness and the completeness of our approach with these performance measures.
The results of the evaluation show a high precision and recall of 0.9513 and 0.9796, respectively for Participant 1. For Participant 2, the results show a precision of 0.9601 and a recall of 0.9844. Averaging the values of both participants, we obtain a mean precision of 0.9557 and a mean recall of 0.9820.
The detailed results of the evaluation are provided in the supplementary material.\textsuperscript{\ref{fn:repPackage}}
We also evaluated the errors per build change type according to our taxonomy. We used the classification of the two manual evaluations to calculate precision and recall per change type.
We found that 36 out of the 58 change types could be detected among the randomly selected evaluation commits with precision and recall of 1. This group contains changes, such as DEPENDENCY\_VERSION\_UPDATE and GENERAL\_PROPERTY\_INSERT. 9 change types showed a precision and recall between 0.80 and 1. The other 13 change types that were contained in the evaluation scored lower than 0.80, \emph{e.g.},\xspace PLUGIN\_UPDATE. We found that especially PLUGIN\_UPDATE is a change type that is difficult to detect properly by our approach, because it is tightly coupled with PLUGIN\_CONFIGURATION\_UPDATE.
Besides the quantitative evaluation, we performed a qualitative evaluation to find out in which scenarios \textsc{BuildDiff}{} shows a good performance and in which it does not. We present an example where \textsc{BuildDiff}{} did not achieve a proper change extraction compared to a human evaluation. We refer the interested reader to the supplementary material\textsuperscript{\ref{fn:repPackage}} to find more types of wrong classification.
The example is taken from the flink project\footnote{\url{http://goo.gl/rWPFDy}} where a dependency definition was changed. \lstref{lst:example1old} shows the dependency in the old version and \lstref{lst:example1new} shows the updated version of the dependency. \textsc{BuildDiff}{} extracted two changes, DEPENDENCY\_DELETE and DEPENDENCY\_INSERT. In fact, this is an update of the same dependency where the \texttt{groupId} and the \texttt{artifactId} changed simultaneously. Hence, the correct classification would be a DEPENDENCY\_UPDATE. Our approach could not detect this change correctly because we use a distance measure to match the nodes of two build files. In this case, the measure indicated that the two dependency definitions are not close enough to be considered the same dependency and consequently, \textsc{BuildDiff}{} extracted the two changes wrongly.
\begin{lstlisting}[frame=single,caption=Example of an incorrect Classification - Old Version ,label=lst:example1old]
<dependency>
<groupId>com.(*@\textcolor{red}{typesafe.akka}@*)</groupId>
<artifactId>akka-testkit_${scala.binary.version}</artifactId>
<scope>test</scope>
</dependency>
\end{lstlisting}
\begin{lstlisting}[frame=single,caption=Example of an incorrect Classification - New Version ,label=lst:example1new]
<dependency>
<groupId>com.(*@\textcolor{red}{data-artisans}@*)</groupId>
<artifactId>(*@\textcolor{red}{fl}@*)akka-testkit_${scala.binary.version}</artifactId>
<scope>test</scope>
</dependency>
\end{lstlisting}
In conclusion, we observe that:\\
\noindent\fbox{\begin{minipage}{0.97\columnwidth}
\textsc{BuildDiff}{} is capable of extracting changes from \textsc{Maven}{} build files with an average precision of 0.96 and an average recall of 0.98. DEPENDENCY\_\-VERSION\_\-UPDATE and GENERAL\_\-PROPERTY\_\-INSERT are among the change types that achieve the best performance, whereas PLUGIN\_UPDATE is among the change types with the highest rate of error.
\end{minipage}}\\
\section{Extracting Build Changes with \textsc{BuildDiff}{}}
\label{sec:buildDiff}
In this section, we describe our approach to extract build changes from build files. Currently, we focus on the extraction of \textsc{Maven}{} build files. \textsc{Maven}{} build files are named \texttt{pom.xml} following the naming convention of \textsc{Maven}{}. First, we define a taxonomy of build changes and provide our rationale for the defined changes. Second, we describe \textsc{BuildDiff}{}, our approach to extract build changes of two consecutive \textsc{Maven}{} build file revisions.
\subsection{Taxonomy}
\label{ss:taxonomy}
\newcommand{95}{95}
\textsc{Maven}{} build files are specified using a special type of XML. Hence, we can easily read, parse, and transform their content into a tree that corresponds to the \textsc{Maven}{} schema\footnote{\url{http://maven.apache.org/xsd/maven-4.0.0.xsd}} that defines the various XML elements and attributes used for configuring a \textsc{Maven}{} build.
Having the content of a \textsc{Maven}{} build file represented as a tree, we then can use tree differencing algorithms, such as ChangeDistiller \cite{Fluri2007ChangeDistilling} or GumTree \cite{Falleri2014GumTree}, to extract differences between two build files. We use the modified version of the GumTree implementation of Dotzler \emph{et al.}\xspace \cite{Dotzler2016moveoptimizeddiff} to extract edit operations that transform one tree into the other. In the remainder of the paper, we refer to this implementation as GumTree. We describe the extraction procedure in more detail in \secref{ss:approach}.
Similar to ChangeDistiller, we defined the change types of our taxonomy based on the edit operations extracted by the tree differencing algorithm whereas the structure of the tree and its different elements correspond to the \textsc{Maven}{} schema. For defining the taxonomy, we started with the top level elements of the \textsc{Maven}{} schema and moved down the schema until we reached the bottom-most child elements. For each element (\emph{i.e.},\xspace XML tag), we defined change types for inserting (*\_INSERT), deleting (*\_DELETE), and updating (*\_UPDATE) that element. For some particular tags, such as \texttt{artifactId} and \texttt{groupId}, we only created the *\_UPDATE change type because they are mandatory for the definition of particular tags, such as \texttt{dependency}, and we assume that they are inserted and deleted with their parent tag. This is further described in detail in \secref{ss:approach}. The resulting taxonomy currently comprises 95{} that we validated with two expert developers using \textsc{Maven}{}.
We also grouped the change types into categories. We retrieved the categories and the respective change type assignments by performing card sorting \cite{nielsen1995card}. First, we gave the list of change types to the two developers who validated the changes types separately and asked them to group the change types. Second, we asked the developers to assign names to the created groups. In a third step, we asked both developers to discuss their categories and assignments to arrive at a common categorization. If the developers assigned a change to different categories they discussed with one another to arrive at a consensus.
\begin{table}[!t]
\renewcommand{\arraystretch}{1.0}
\caption{Excerpt of our Taxonomy of Build Changes}
\label{tab:changesAndCategories}
\centering
\resizebox{\columnwidth}{!}{%
\begin{tabular}{|l|l|l|}
\hline
Category & Change Types (Excerpt) \\\hlin
\multirow{3}{*}{Dependency Changes} & DEPENDENCY\_INSERT \\% & \\
& DEPENDENCY\_VERSION\_UPDATE \\%& x \\
& MANAGED\_DEPENDENCY\_DELETE \\\hlin
\multirow{3}{*}{Build Changes}& PLUGIN\_INSERT \\%& y \\
& PLUGIN\_CONFIGURATION\_UPDATE \\%& x \\
& TEST\_RESOURCE\_DELETE \\\hlin
\multirow{2}{*}{Team Changes}& DEVELOPER\_INSERT \\%& y \\
& CONTRIBUTOR\_DELETE \\\hlin
\multirow{3}{*}{Repository Changes} & PLUGIN\_REPOSITORY\_INSERT \\% & y \\
& DIST\_SNAPSHOT\_REPOSITORY\_UPDATE\\% & x \\
& REPOSITORY\_DELETE \\\hlin
\multirow{3}{*}{General Changes}& MODULE\_INSERT \\%& y \\
& PARENT\_VERSION\_UPDATE \\%& x \\
& GENERAL\_PROPERTY\_DELETE \\\hlin
\end{tabular}%
}
\end{table}
The two developers developed the following 5 categories: (1) \texttt{Dependency Changes} contain all changes that are related to dependencies of the project, (2) \texttt{Build Changes} cover the changes that directly affect or modify the build process, (3) \texttt{Team Changes} comprise all modifications to the list of team members, (4) \texttt{Repository Changes} hold changes that are performed to the distribution and repository locations, and (5) \texttt{General Changes} contain changes that are made to the general items of a \textsc{Maven}{} project.
\tabref{tab:changesAndCategories} shows an excerpt of the taxonomy with examples of change types for each category. The full taxonomy can be found online in the supplementary material.\textsuperscript{\ref{fn:repPackage}}
In the following, we provide two examples of frequently occurring build changes. The first example depicted in \lstref{lst:depVersionUpdate1} (old version of the build file) and \lstref{lst:depVersionUpdate2} (new version of the build file) shows a change of the version of a dependency to the \texttt{spring-core} library from \texttt{4.2.5.RELEASE} to \texttt{4.2.6.RELEASE}. This change is extracted and classified by \textsc{BuildDiff}{} as DEPENDENCY\_VERSION\_UPDATE.
\vspace{0.5cm}
\begin{lstlisting}[frame=single,caption={Dependency Version Update - Old Version} ,label=lst:depVersionUpdate1]
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>(*@\textcolor{red}{4.2.5.RELEASE}@*)</version>
</dependency>
\end{lstlisting}
\begin{lstlisting}[frame=single,caption=Dependency Version Update - New Version ,label=lst:depVersionUpdate2]
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>(*@\textcolor{red}{4.2.6.RELEASE}@*)</version>
</dependency>
\end{lstlisting}
\vspace{0.5cm}
The second example depicted in \lstref{lst:plugInsert1} (old version of the build file) and \lstref{lst:plugInsert2} (new version of the build file) shows the insertion of the \texttt{maven-jar-plugin} plugin. This change is extracted and classified by \textsc{BuildDiff}{} as PLUGIN\_INSERT.
\vspace{0.5cm}
\begin{lstlisting}[frame=single,caption=Plugin Insertion - Old Version ,label=lst:plugInsert1]
<build>
<plugins>
</plugins>
</build>
\end{lstlisting}
\vspace{0.5cm}
\begin{lstlisting}[frame=single,caption=Plugin Insertion - New Version ,label=lst:plugInsert2]
<build>
<plugins>
(*@\textcolor{red}{<\textbf{plugin}>}@*)
(*@\textcolor{red}{<\textbf{groupId}>org.apache.maven.plugins</\textbf{groupId}>}@*)
(*@\textcolor{red}{<\textbf{artifactId}>maven-jar-plugin</\textbf{artifactId}>}@*)
(*@\textcolor{red}{<\textbf{version}>2.6</\textbf{version}>}@*)
(*@\textcolor{red}{</\textbf{plugin}>}@*)
</plugins>
</build>
\end{lstlisting}
\vspace{-0.1cm}
\subsection{Approach}
\label{ss:approach}
This section presents our \textsc{BuildDiff}{} approach to extract 95{} types of changes from \textsc{Maven}{} build files.
Our approach is mainly motivated and inspired by the work of Gall \emph{et al.}\xspace \cite{Gall2009ChangeAnalysis} and Fluri \emph{et al.}\xspace \cite{Fluri2007ChangeDistilling}, who showed that detailed information on source code changes can aid in understanding the evolution of software projects, and the work of Macho \emph{et al.}\xspace \cite{Macho2016Predicting}, who showed that this information can be used for computing models to predict when build configurations should be updated.
Concerning changes in build configuration files, in particular \textsc{Maven}{} build files, the finest level of analysis that has been performed was on line level. D\'{e}sarmeaux \emph{et al.}\xspace \cite{desarmeaux2016mavenLifecyclePhases} mapped lines of a \textsc{Maven}{} \texttt{pom.xml} to the respective build lifecycle phase. To the best of our knowledge, we are the first to present an approach to extract changes in \textsc{Maven}{} build files on the level of \textsc{Maven}{} configuration elements, that we refer to as fine-grained build changes.
\textsc{BuildDiff}{} first reads two versions of a \textsc{Maven}{} build file (\emph{i.e.},\xspace \texttt{pom.xml}) and represents each version as a tree. Then, it uses the GumTree \cite{Falleri2014GumTree} implementation of Dotzler \emph{et al.}\xspace \cite{Dotzler2016moveoptimizeddiff} to extract the differences between the two trees in terms of edit operations to transform one tree into the other. The list of edit operations is then mapped to the 95{} change types that are defined in our taxonomy. In the following, we present each step in detail:
\textbf{Preprocess Build Files.}
The first step of \textsc{BuildDiff}{} preprocesses the two versions of a \textsc{Maven}{} build file.
\textsc{Maven}{} build files are descriptive, meaning that the order of the elements in the file can be changed without changing its semantics. We observed that GumTree can match elements of the same level more accurately if they are sorted. Hence, \textsc{BuildDiff}{} first sorts the elements on the same level according to their content.\footnote{Strings are sorted alphabetically and numbers in ascending order} For example, the tag \texttt{<module>MySubmodule</module>} appears before \texttt{<module>TheModule</module>}.
Furthermore, \textsc{BuildDiff}{} removes comments and attributes. Attributes, such as \texttt{combine.children} and \texttt{combine.self} for plugin configuration inheritance, affect the build configuration at execution time. We only analyze the build configuration from a static point of view and hence, we remove attributes
\textbf{Extract Edit Operations.}
Next, \textsc{BuildDiff}{} parses the two preprocessed versions of a \textsc{Maven}{} build file into two trees and passes them to the GumTree differencing algorithm.
GumTree provides a TreeGenerator for XML files. Unfortunately, this implementation does not handle values of tags in XML documents. Therefore, we implemented our own TreeGenerator that transforms XML files into GumTree trees. We use the prominent Java XML library \textit{jdom} to read the XML file, and methods provided by GumTree to create the tree.
GumTree then uses a \texttt{Matcher} instance to find mappings between two trees. \textsc{BuildDiff}{} extends the GumTree's default matcher by adding a mechanism to ensure that only tags with the same name will be matched, and by modifying the similarity calculation of two nodes. Tags that have a child tag named \texttt{id} are matched if the Levenshtein similarity of the \texttt{id} value exceeds a threshold $t$. The matcher chooses the node with the highest similarity exceeding the threshold. Tags that have the \textsc{Maven}{} triplet (\texttt{groupId}, \texttt{artifactId}, \texttt{version}) as child nodes are matched by applying the Levenshtein distance for \texttt{groupId} and \texttt{artifactId}. Two nodes are matched if the Levenshtein similarity exceeds a threshold $t$. The matcher chooses the node with the highest similarity exceeding the threshold. Experiments with different $t$ values suggest that $t=0.65$ yields the best performance.
Given the matcher, GumTree outputs a list of tree edit operations comprising added, deleted, updated, and moved elements in the tree that transform the source tree (previous version of the \textsc{Maven}{} build file) into the target tree (subsequent version of the \textsc{Maven}{} build file).
\textbf{Sort Edit Operations.}
\textsc{BuildDiff}{} considers a particular order to process the changes in \textsc{Maven}{} files.
We process the operations of the edit script in a top down order according to their level in the build file (parent nodes first). \textsc{BuildDiff}{} applies this order to prevent the extraction of additional changes that result from the insertion and deletion of composite \textsc{Maven}{} tags that also insert or delete their children at the same time. For instance, when a new dependency is inserted, \textsc{BuildDiff}{} only records a DEPENDENCY\_INSERT, skipping the insertion of the child tags of that dependency (\emph{e.g.},\xspace \texttt{groupId}, \texttt{artifactId}, and \texttt{version}).
\textbf{Map Build Changes.}
In this step, \textsc{BuildDiff}{} maps the tree edit operations that are generated by GumTree to the 95{} change types of our taxonomy.
We consider insertions, deletions, and updates. We do not consider moves, since \textsc{Maven}{} build files are descriptive, meaning that the order of the elements in the file can be changed without changing its semantics.
To map edit operations to change types, \textsc{BuildDiff}{} iterates over the sorted edit operations mapping each edit operation to at most one change type. Changes to child elements are handled by first checking whether the change is part of an insertion, deletion, or update of its parent. In that case, the change to the child element is not mapped, since it is already part of the parent change. For instance, the insertion of a dependency is mapped only to the change DEPENDENCY\_INSERT while the insertions of its child elements \texttt{groupId}, \texttt{artifactId}, and \texttt{version} are skipped.
As a result, \textsc{BuildDiff}{} outputs a list of build changes that have been performed between two versions of a \textsc{Maven}{} file.
\section{Build Change Frequency (RQ1)}
\label{sec:changeFrequency}
Our first experiment investigates the frequency of build changes. We aim to gain knowledge of which change types are frequently performed in projects and how often they are performed. This information can help to understand the evolution of build files similar to the study of Gall \emph{et al.}\xspace \cite{Gall2009ChangeAnalysis}. With this experiment, we aim to answer RQ1: \textit{Which build change types occur the most frequently?}
\textbf{Approach.} First, we checked the projects for their number of build changes. The projects \texttt{h2o-2} (last commit: Nov 4, 2014), \texttt{guava} (last commit: Jan 1, 2017, only 11 build changing commits in 2016), and \texttt{closure-compiler} (last commit: Nov 15, 2016, only 4 build changing commits in 2016) contain less than 1000 build changes each. Hence, we excluded them from the experiment because we assume that they do not use \textsc{Maven}{} actively and only keep the \textsc{Maven}{} configuration in the source code management system for legacy reasons.
Second, starting with the change data stored in the ChangeDB, we iterated over the remaining 27 projects and counted the occurring changes. We counted the number of each change type per project and aggregated the numbers also per change category. As depicted in \tabref{tab:projectData}, the selected projects differ in their size, and hence, contain a different amount of total build changes (column BC). Given this variance in the number of build changes, we normalized the change counts to allow a fair comparison between the studied projects. We divided each aggregated change count by the number of total build changes in the project. For example, project \texttt{spring-roo} contains a total amount of 9,534 build changes and 222 instances of the change type MODULE\_INSERT. We calculated the relative occurrence of this change type with $222 / 9534 = 2.33\%$ and used this relative value instead of the absolute value for our experiment.
We then analyzed this data in two ways. First, we analyzed the relative occurrence of each build change type, and second, we analyzed the number of build changes per change type category.
\textbf{Results.}
The most frequently occurring change type is PARENT\_\-VERSION\_\-UPDATE with a relative frequency of 0.41 on average, meaning that on average 41\% of the build changes are of this type. The second most occurring change type is PROJECT\_\-VERSION\_\-UPDATE having an average relative frequency of 0.08. We observe a large drop (0.33) in the relative frequency of those two types of changes underlining that PARENT\_\-VERSION\_\-UPDATE is the most frequently occurring change type by far. These two change types are followed by DEPENDENCY\_\-INSERT (0.06) and GENERAL\_\-PROPERTY\_\-UPDATE (0.03).
We see that the top 10 most frequent change types consist of four change types that modify dependencies, and two change types concerning version changes, plugin changes and changes to properties, respectively. This indicates that the dependency management system, which is a core part of the build system, is changed frequently. We also observe that the configurations of plugins are frequently changed which indicates the importance of this part of the build configuration. Furthermore, we observe that the top 10 change types account for 73\% of all changes. \figref{fig:changeFrequencies} shows boxplots of the top 10 most frequent change types.
\begin{figure}[!ht]
\centering
\includegraphics[width=\columnwidth]{changeFrequencies_final.pdf}
\caption{Boxplots of the relative build change frequency for the top 10 most frequent change types (sorted by median).}
\label{fig:changeFrequencies}
\end{figure}
The next step of the analysis deals with the frequencies of build changes per change category that we have defined in \secref{ss:taxonomy}. \figref{fig:catFrequencies} shows the relative frequencies of the build changes per build category. We observe that the \texttt{General Changes} category accounts for 0.64 (64\%) of all changes on average. We argue that this ratio is as expected because changes to the properties, parent changes, and changes to the project metadata, such as project version, are aggregated in this category.
Furthermore, we can see that \texttt{Dependency Changes} are the second most frequent change category (0.24). This is in line with the observations of the single change types. As mentioned above, the dependency management system is a core part of the build system and is frequently updated. The third most frequently occurring category contains the changes to the \texttt{Build Changes} category (0.11). Lastly, changes to the \texttt{Repository Changes} and to the \texttt{Team Changes} are rare (0.008 and 0.004, respectively).
\begin{figure}[!tbh]
\centering
\includegraphics[width=\columnwidth]{catFrequenciesSmall.pdf}
\caption{Boxplots of the relative frequency of build changes per change type category.}
\label{fig:catFrequencies}
\end{figure}
With these results, we can answer research question RQ1:\\
\noindent\fbox{\begin{minipage}{0.97\columnwidth}
Among the top 10 most frequently occurring change types, we find version changes and dependency changes frequently. The most frequent change type is PARENT\_VERSION\_UPDATE followed by PROJECT\_\-VERSION\_\-UPDATE, and DEPENDENCY\_\-INSERT. The most frequently occurring change category is \texttt{General Changes} directly followed by \texttt{Dependency Changes}, and \texttt{Build Changes}.
\end{minipage}}\\
\section{Conclusions}
\label{sec:conclusions}
Build systems are an essential part in the engineering process of modern software systems.
In this paper we introduced \textsc{BuildDiff}{}, an approach for extracting fine-grained build changes from \textsc{Maven}{} build files. In a manual evaluation, we showed
that \textsc{BuildDiff}{} is capable of extracting build changes with an average precision and recall of 0.96 and 0.98, respectively.
With the build changes extracted from 30{} open source Java projects we performed two empirical studies to investigate the frequency and time of build changes. The results of the two studies showed:
\begin{itemize}
\item (RQ1) The most frequent change type is PARENT\_\-VER\-SION\_\-UP\-DATE followed by PROJECT\_\-VERSION\_\-UPDATE, and DEPENDENCY\_\-INSERT. The most frequent change category is \texttt{General Changes} directly followed by \texttt{Dep\-end\-ency Changes}, and \texttt{Build Chan\-ges}. The top 10 change types account for 73\% of all changes.
\item (RQ2) Build changes are not equally distributed over the projects' timeline. We observed that especially near releases build changes occur more frequently.
\end{itemize}
Our results benefit research on build configurations and developers using \textsc{Maven}{} as their build system.
\textbf{Future Work.}
We plan to extend \textsc{BuildDiff}{} to support other build systems, such as Gradle,\footnote{\url{https://gradle.org}} and compare them with \textsc{Maven}{}.
Furthermore, we will investigate build changes to find frequent change patterns among commits and work items that affect the build result. Finally, we plan to perform a more detailed analysis of the co-evolution between build changes and source code changes.
\section{Introduction}
Large software projects use build tools, such as \textsc{Maven}, \textsc{Gradle}, or \textsc{Ant}, to automate the assembling and testing process of their software products. The configuration of such build systems can often be complex \cite{McIntosh2012Evolution}, which also complicates their maintenance. Seo \emph{et al.}\xspace \cite{seo2014programmers} showed that up to 37\% of builds at Google fail, stating neglected build maintenance as the most frequent cause. The development team is then blocked and obliged to fix the build first. Kerzazi \emph{et al.}\xspace \cite{kerzazi2014automated} found a similar ratio of up to 18\% of build breakage and estimated the total costs for the breakages in their study to be more than 336 man-hours.
As a software system evolves, changes are applied to the source code. Developer teams also need to maintain the build and hence, subsequent changes need to be applied to the build configuration. Adams \emph{et al.}\xspace \cite{Adams2008Evolution} and McIntosh \emph{et al.}\xspace~\cite{McIntosh2012Evolution} found evidence of a co-evolutionary relationship between source and build code. Hence, omitting changes to the build configuration that are needed to remain synchronized with the source code, can lead to build breakage. To that end, it is important to know when build changes should be applied. McIntosh \emph{et al.}\xspace \cite{McIntosh2014Mining} and Macho \emph{et al.}\xspace \cite{Macho2016Predicting} studied this problem and found that their models can predict whether a source code change should have an accompanying build change. However, both studies lack detailed information about the type of build change that is needed.
In this study, we investigate changes to the build configuration in detail. We are interested in which types of changes are typically made to the build configuration and when they are performed. Prior studies \cite{McIntosh2014Mining} consider the build configuration to be changed if the build file changes but do not investigate the detailed type of the change. We claim that a more detailed view on build configuration changes can improve studies of the build system and its configuration. Thus, we introduce \textit{\textsc{BuildDiff}}, an approach to extract build changes from \textsc{Maven}{} build files. Our approach is inspired by ChangeDistiller \cite{Fluri2007ChangeDistilling,Gall2009ChangeAnalysis}, which extracts source code changes from Java source files. To the best of our knowledge, we are the first to investigate build changes in this granularity. We also propose a taxonomy of build changes consisting of 95 build change types and 5 categories that our approach can extract. We evaluate \textsc{BuildDiff}{} in a manual investigation of 400 randomly selected build changing commits and find that it yields an average precision and recall of 0.96 and 0.98, respectively.
Armed with an approach to extract build changes from \textsc{Maven}{} build files, we extract build changes from 30{} open source Java projects from different vendors, of different sizes, and with different purposes. We study the extracted data in two ways. First, we study the frequency of build changes. We explore which change types are the most frequent ones and which change types are rarely applied. We analyze the frequencies also in terms of change categories. Second, we study the time at which build changes have been recorded and investigate whether build changes are equally distributed over a project or if there are periods in the projects where they occur more frequently.
With the two studies, we address the following two research questions:
\begin{itemize}[leftmargin=1.12cm]
\item[\textbf{(RQ1)}] \textbf{Which build change types occur the most frequently?} \\
The most frequent build change type is PARENT\_VERSION\_UPDATE followed by PROJECT\_\-VERSION\_\-UPDATE, and DEPENDENCY\_\-INSERT. The most frequent build change category is \texttt{General Changes}, directly followed by \texttt{Dependency Changes}, and \texttt{Build Changes}. Changes to version properties and to dependencies can be found frequently among the top 10 most frequent change types. The top 10 change types account for 73\% of all of the changes.
\item[\textbf{(RQ2)}] \textbf{When are build changes recorded?} \\ Build changes are not equally distributed over the projects' timeline. There are particular phases that contain significantly more build changes than others. We observe that especially around releases, the frequency of build changes is high.
\end{itemize}
This work makes the following contributions:
(1) an approach and a corresponding prototype implementation to extract fine-grained build changes from \textsc{Maven}{} build files, (2) a dataset containing historical build changes of 30{} open source Java projects, (3) an evaluation of the performance of this tool, (4) two empirical studies of the frequency and time of build changes, and (5) a replication package that contains supplementary material.\footnote{\label{fn:repPackage}\url{https://figshare.com/articles/BuildDiff_Supplementary_Material/4786084}
The remainder of the paper is organized as follows: \secref{sec:rw} situates the paper with respect to the related work. \secref{sec:buildDiff} presents our \textsc{BuildDiff}{} approach. \secref{sec:dataPreparation} describes the data that we used for this study and evaluates the performance of \textsc{BuildDiff}{}, and discusses its strengths and weaknesses. \secref{sec:changeFrequency} presents the first study on the frequency of build changes and \secref{sec:whenAndWhy} shows the second study on when build changes occur. \secref{sec:discussion} discusses the implications of our results and threats to validity. \secref{sec:conclusions} concludes the paper.
\section{Conclusion}
\bibliographystyle{IEEEtran}
\section{Evaluating \textsc{BuildDiff}{}}
\label{sec:dataPreparation}
In this section, we describe the evaluation of \textsc{BuildDiff}{}. First, we describe how we selected the projects and how we extracted the data that we used for the evaluation of \textsc{BuildDiff}{} and the experiments. Second, we present the evaluation of our prototype implementation of the \textsc{BuildDiff}{} approach in terms of precision and recall. Finally, we discuss examples of correctly and incorrectly extracted changes.
\subsection{Data Preparation}
The projects that we selected for our experiments stem from two origins. First, we selected the list of projects that Macho \emph{et al.}\xspace used in their prior study \cite{Macho2016Predicting} because they cover a wide range of different vendors, project sizes, and purposes. Second, we extended this list with popular projects from GitHub to improve the variety of the selected projects. We retrieved a list of Java projects ordered by their star rating\footnote{as of January 2017} and removed projects that do not use \textsc{Maven}{} as build system and projects with less than 3500 commits in the repository or rated with less than 1000 stars. We calculated a ranking metric by adding the number of commits and the star rating to evenly balance the user rating and the number of commits of a project. Then, the list of projects was sorted according to the ranking value in a descending order. From this list, we selected the top 20 projects and added them to our list of projects. \tabref{tab:projectData} shows the full list of selected projects and several descriptive statistics of commits and build changes.
\begin{table*}[ht!]
\renewcommand{\arraystretch}{1.0}
\caption{List of Java projects used for evaluating \textsc{BuildDiff}{} and for studying the evolution of build files plus descriptive statistics of BCC (Commits with Build Change), BCCR (ratio of BCC), NBCC (Commits without Build Change), NBCR (ratio of NBCC), BC (Build Changes), and \#R (Number of extracted Releases)}
\label{tab:projectData}
\centering
\resizebox{\textwidth}{!}{%
\begin{tabular}{|l|l||r|r||r|r|r|r|r||r|r|r|r|r||r|}
\hline
Vendor & Name & Rank & Stars & \#Commits & \#BCC & BCCR & \#NBCC & NBCR & BC & \#R \\
\hline
\hline
neo4j & neo4j & 49,663 & 3,344 & 46,319 & 9,684 & 0.21 & 36,635 & 0.79 & 78,551 & 170 \\
hazelcast & hazelcast & 24,995 & 1,850 & 23,145 & 1,306 & 0.06 & 21,839 & 0.94 & 7,914 & 126 \\
SonarSource & sonarqube & 23,989 & 1,431 & 22,558 & 1,746 & 0.08 & 20,812 & 0.92 & 18,332 & 109 \\
Alluxio & alluxio & 23,545 & 2,787 & 20,758 & 1,694 & 0.08 & 19,064 & 0.92 & 12,973 & 25 \\
languagetool-org & languagetool & 21,949 & 1,021 & 20,928 & 285 & 0.01 & 20,643 & 0.99 & 5,027 & 17 \\
netty & netty & 21,443 & 8,637 & 12,806 & 1,395 & 0.11 & 11,411 & 0.89 & 7,791 & 160 \\
orientechnologies & orientdb & 20,458 & 2,769 & 17,689 & 1,326 & 0.07 & 16,363 & 0.93 & 8,866 & 94 \\
spring-projects & spring-boot & 20,356 & 9,312 & 11,044 & 2,922 & 0.26 & 8,122 & 0.74 & 29,699 & 68 \\
h2oai & h2o-2 & 19,071 & 2,116 & 16,955 & 74 & 0.00 & 16,881 & 1.00 & 194 & 324 \\
google & guava & 18,643 & 13,676 & 4,967 & 221 & 0.04 & 4,746 & 0.96 & 850 & 64 \\
deeplearning4j & deeplearning4j & 16,891 & 5,044 & 11,847 & 1,097 & 0.09 & 10,750 & 0.91 & 7,454 & 42 \\
stanfordnlp & CoreNLP & 16,688 & 2,685 & 14,003 & 847 & 0.06 & 13,156 & 0.94 & 3,365 & 0 \\
eclipse & jetty & 16,357 & 1,148 & 15,209 & 2,965 & 0.19 & 12,244 & 0.81 & 82,153 & 272 \\
Graylog2 & graylog2-server & 15,822 & 2,600 & 13,222 & 1,465 & 0.11 & 11,757 & 0.89 & 5,464 & 141 \\
prestodb & presto & 15,052 & 5,455 & 9,597 & 1,069 & 0.11 & 8,528 & 0.89 & 10,832 & 178 \\
apache & storm & 14,055 & 3,791 & 10,264 & 1,244 & 0.12 & 9,020 & 0.88 & 9,945 & 25 \\
apache & flink & 13,466 & 1,869 & 11,597 & 1,343 & 0.12 & 10,254 & 0.88 & 11,022 & 25 \\
druid-io & druid & 12,427 & 4,215 & 8,212 & 1,947 & 0.24 & 6,265 & 0.76 & 20,329 & 391 \\
naver & pinpoint & 11,976 & 2,864 & 9,112 & 1,012 & 0.11 & 8,100 & 0.89 & 5,950 & 11 \\
google & closure-compiler & 11,899 & 2,948 & 8,951 & 60 & 0.01 & 8,891 & 0.99 & 168 & 75 \\
apache & activemq & - & - & 11,135 & 1,754 & 0.16 & 9,381 & 0.84 & 12,988 & 51 \\
apache & camel & - & - & 35,649 & 8,003 & 0.22 & 27,646 & 0.78 & 110,150 & 107 \\
apache & hadoop & - & - & 48,582 & 2,395 & 0.05 & 46,187 & 0.95 & 25,057 & 240 \\
apache & hbase & - & - & 29,097 & 2,161 & 0.07 & 26,936 & 0.93 & 10,059 & 538 \\
apache & karaf & - & - & 15,953 & 5,853 & 0.37 & 10,100 & 0.63 & 54,655 & 60 \\
apache & wicket & - & - & 31,456 & 1,527 & 0.05 & 29,929 & 0.95 & 13,322 & 243 \\
hibernate & hibernate-search & - & - & 5,976 & 1,177 & 0.20 & 4,799 & 0.80 & 6,251 & 105 \\
jenkinsci & jenkins & - & - & 26,286 & 4,551 & 0.17 & 21,735 & 0.83 & 28,138 & 483 \\
spring-projects & spring-roo & - & - & 6,440 & 675 & 0.10 & 5,765 & 0.90 & 10,173 & 35 \\
wildfly & wildfly & - & - & 23,370 & 5,186 & 0.22 & 18,184 & 0.78 & 43,384 & 74 \\ \hline
& Sum & - & - & 543,127 & 66,984 & - & 476,143 & - & 641,056 & 4,253 \\
& Average & - & - & 18,104 & 2,233 & 0.12 & 15,871 & 0.88 & 21,369 & 141.77 \\
\hline
\end{tabular}%
}
\end{table*}
For each project, we extracted the build changes as follows: First, we cloned the repository and iterated over each commit, including commits on branches. Second, we checked for modifications in \textsc{Maven}{} build files (\texttt{pom.xml}) indicated by Git. For each of the modified build files, we determined its preceding version and provided both versions to \textsc{BuildDiff}{} to extract \textsc{Maven}{} build changes. The extracted changes were stored in a database called the ChangeDB. Due to its size, we provide the database for other researchers on request. If a commit was a merging commit (\emph{e.g.},\xspace pull requests that were merged into the master branch), we did not extract the changes of this commit because we already extracted these changes in the respective commits of the branch.
\section{Related Work}
\label{sec:rw}
\textbf{Build Maintenance.}
Related work on build maintenance includes the co-evolution of build systems with other artifacts of the development process. For instance, Adams \emph{et al.}\xspace introduced MAKAO \cite{Adams2007DesignRecovery}, a framework for re(verse)-engineering build systems, and studied the co-evolution of the Linux build system \cite{Adams2008Evolution} using MAKAO. They found that the build system itself evolves and its complexity grows over time. Furthermore, they identified maintenance as the main factor for evolution.
McIntosh \emph{et al.}\xspace investigated the evolution of the ANT build system \cite{McIntosh2010Evolution} from a static and a dynamic perspective. They defined a metric for measuring the complexity of build systems and found that the complexity of ANT build files evolves over time, too. In follow-up work, McIntosh \emph{et al.}\xspace investigated Java build systems and their co-evolution with production and test code \cite{McIntosh2012Evolution}. The results of a large-scale study showed a relationship between build technology and maintenance effort~\cite{McIntosh2014LargeScale}. In addition to these studies, Hardt and Munson developed Formiga, a tool to refactor ANT build scripts~\cite{Hardt2015EmpiricalFormiga}~\cite{Hardt2013FormigaAntMaintenance}.
Concerning the co-evolution of build configurations with other software artifacts, existing studies investigated models to predict build co-changes based on various metrics. For instance, McIntosh \emph{et al.}\xspace \cite{McIntosh2014Mining} used code change characteristics to predict build co-changes within a software project. Xia \emph{et al.}\xspace \cite{Xia2015CrossProject} extended this study by building a model for predicting build co-changes across software projects. Macho \emph{et al.}\xspace~\cite{Macho2016Predicting} showed that they can improve both studies by using fine-grained source code changes. Furthermore, Xia \emph{et al.}\xspace \cite{Xia2014BuildSystem} investigated missing dependencies in build files using link prediction. They showed that their algorithm outperforms state-of-the-art link prediction algorithms for this problem.
\textbf{Change Extraction.}
Many previous studies used changes that were extracted from different versions of source files to investigate various aspects of the evolution of software systems. Miller \emph{et al.}\xspace \cite{miller1985file} and Myers \emph{et al.}\xspace \cite{myers1986ano} performed their studies on the level of text simply by counting the number of added or deleted lines of text. One advantage of these approaches is that they do not need a parser or a grammar to output the differences between the different versions of source files. However, one important shortcoming is that these approaches have difficulty mapping the changed lines of text to actual changes in source files, such as the change of the return type of a method or the addition of an else branch.
Modern approaches overcome this issue by performing the differencing on the level of Abstract Syntax Trees (ASTs). For instance, Hashimoto and Mori \cite{hashimoto2008diff} developed Diff/TS, which is working on the raw AST created from parsing two versions of a source file. The most prominent approach in this area is ChangeDistiller of Fluri \emph{et al.}\xspace \cite{Fluri2007ChangeDistilling}. Their approach extracts differences from two consecutive versions of a Java file and maps the differences to 48 change types \cite{Fluri2006Classifying}. Falleri \emph{et al.}\xspace \cite{Falleri2014GumTree} improved the differencing algorithm by applying a combined method for matching equal subtrees and showed that their approach outperforms ChangeDistiller.
Concerning build changes, D\'esarmeaux \emph{et al.}\xspace \cite{desarmeaux2016mavenLifecyclePhases} mapped line-level changes to \textsc{Maven}~lifecycle phases and investigated the maintenance effort of each phase. They found out that the compile phase accounts for most of the maintenance.
In summary, we find that several approaches exist to study build maintenance, build systems, and their configuration. However, these studies are primarily based on coarse-grained metrics. Previous work showed that for programming languages, such as Java, the usage of a finer granularity of changes can help to improve prediction models \cite{Giger2011ComparingBugPrediction,Giger2012CodeChangePrediction,Giger:2012:MBP:2372251.2372285,Romano2011Predicting} or support the understanding of (co-)evolution \cite{Fluri2009coevolution}. To that extent, it is important to also investigate build changes on a fine-grained level. To the best of our knowledge, we are the first to present an approach to extract detailed changes from \textsc{Maven}{} build files.
\section{Discussion}
\label{sec:discussion}
In this section, we first discuss a number of implications of our results on recent and ongoing research of build systems and their configuration. Next, we discuss implications for developers who use \textsc{Maven}{} as build system. Finally, we discuss the threats to the validity of our results.
\subsection{Implications of the Results}
\textbf{On Research.}
First, compared to the state-of-the-art our fine-grained build changes enable a more detailed analysis of the co-evolution of source code and build files. Second, studies on effort estimation, such as that from Sarro \emph{et al.}\xspace \cite{sarro2016multi}, can be refined by taking into account our 95{} types of build changes. Third, refactoring approaches, such as MAKAO \cite{Adams2007DesignRecovery} and Formiga \cite{Hardt2015EmpiricalFormiga} can be applied to \textsc{Maven}{} build files and enriched with our detailed change information to improve the refactoring process of \textsc{Maven}{} build files. Fourth, studies of build complexity \cite{McIntosh2012Evolution} can also benefit from our detailed analysis of build changes by including dynamical information, such as our detailed build change information, to the calculation of the metrics. Finally, our build changes can be used to improve the models to predict bug-prone build files \cite{Giger2011ComparingBugPrediction} or suggest potentially missing changes to build configurations \cite{Macho2016Predicting} that might lead to a build breakage.
\textbf{On Development.}
We observed that build changes occur more frequently near releases. This observation can help developers to avoid build breakage by increasing the awareness that each change to the build configuration can possible break the build. Furthermore, project managers can use this finding to consider the peak of build changes near releases in their planning of releases and work load. We also give insight into the type of build changes that are frequently made. This can be used by developers, for instance, to identify and refactor plugins that often change their configuration.
\subsection{Threats to Validity}
\label{sec:threats}
Regarding the validity of our results, we identified the following threats to construct, internal, and external validity.
\textbf{Construct Validity.}
One threat is that our taxonomy may not cover all possible change types or change categories that could be theoretically made to a build file. We mitigated this threat in two ways. First, we compared the taxonomy with the XML schema of \textsc{Maven}{} build files to cover all important changes. Second, we asked two experienced \textsc{Maven}{} users to verify the taxonomy and create the categories, including a discussion if necessary.
Furthermore, we retrieved the release data of the 30 open source Java projects from GitHub as the only resource. To that extent, we could miss possible releases if they are not covered by the GitHub data. However, we mitigated this threat by manually checking if the data is compliant with the data provided by the source code management system.
\textbf{Internal Validity.}
A threat to internal validity concerns whether \textsc{BuildDiff}{} can extract the changes to a build configuration file accurately. We mitigated this threat by covering all changes of the taxonomy with JUnit tests and a manual evaluation comparing against the opinions of two experienced \textsc{Maven}{} users.
Concerning the evaluation of \textsc{BuildDiff}{}, a threat is that the randomly selected commits do not include all change types. We mitigated this threat by calculating the proportion of actually missed changes due to the selection. We observed that we only miss 0.9\% of the changes and hence, we can safely assume that the majority of the changes will be covered by \textsc{BuildDiff}{}.
\textbf{External Validity.}
The main threat to external validity stems from the selection of projects that we used in our study. We mitigated this threat by selecting 30 open source Java projects of different vendors, sizes, and purposes. However, additional experiments with projects using other build systems and from industrial settings are needed to further generalize our results. Another threat to external validity is that our taxonomy is tailored for \textsc{Maven}{} build configurations. While we designed the taxonomy to be usable for other build tools as well, the taxonomy may not generalize to all other build systems.
\section{When are the changes recorded (RQ2)}
\label{sec:whenAndWhy}
In this section, we investigate when the build changes occur. We suppose that build changes are not equally distributed over the project, but have phases in which they occur significantly more frequently than in other phases. Hence, we used the build change data that we extracted using \textsc{BuildDiff}{} to check whether our hypothesis holds and answer RQ2: \textit{When are build changes recorded?}
\textbf{Approach.}
We started with the aggregated change data that we created in \secref{sec:changeFrequency}. This data contains for each commit of a project the number of changes per change type that have been performed in the commit. For this research question, we added the date on which the commit was performed and summed up all build changes to a single value per day, \emph{i.e.},\xspace one row of our dataset contains the ID of the commit, the number of build changes that were performed in that commit, and the date of the commit. Based on this information, we investigated the data in two ways, as a single day value and with a sliding window approach.
The first investigation treats each day as a single data point, and hence, adds the number of build changes of commits that were made on the same day. For example, if exactly two commits were made on $23^{th}$ June 2016 with 10 and 15 build changes, respectively, we created a single data point with 25 build changes. The second investigation uses this data and applies a sliding window approach, similar to the approach of Maarek \emph{et al.}\xspace \cite{maarek1991slidingwindow}. We summed the number of build changes of $k$ days to increase the context of the build changes.
As our hypothesis for this research question states, we suppose that build changes are not equally distributed over the project, but occur more frequently in some time periods of the project.
We further suppose that one special period in the project that shows a significantly higher amount of build changes, is the time around releases. Thus, we extracted the release data of each of the studied projects provided by the GitHub API. In particular, we extracted the commit ID of the release, the day of the release, and its name. Column \#R of \tabref{tab:projectData} shows the number of releases per project that we could extract. We can see that for the project \texttt{CoreNLP}, we could not retrieve release data. Hence, we also excluded this project and performed the experiment with the remaining 26 projects.
To substantiate our claim, we will show that days that are close to a release contain statistically significantly more build changes than days that are not close to a release. We consider a single day as well as a sliding window approach. To that extent, we consider a day to be close to a release if it is in between $k$ days before the release. For the analysis on a daily basis, we consider $k=1$ and for the sliding window approach, we consider $k\in\{5,7,9\}$ days. We choose different values for $k$ to investigate the influence of the size of the window on the results. We did not try with larger window sizes because we argue that changes that happen more than 9 days before a release should not be considered close to a release. This argumentation is in line with the release data that we used because the average number of days between two consecutive releases is 14 days. Hence, selecting larger $k$ values would possibly cover more than one release. We performed the study with all of the $k$ values and the results were similar. Thus, we only present results for $k=7$ in the paper. The results for $k\in\{5,9\}$ can be found in the supplementary material.\textsuperscript{\ref{fn:repPackage}}
Next, we checked if the distributions are significantly different with a Mann-Whitney-Wilcoxon test ($\alpha<0.01$) and calculated the effect size $d$ using Cliff's Delta \cite{cliff1993dominance}. We used Mann-Whitney-Wilcoxon and Cliff's Delta since the number of build changes is non-normal distributed. The effect size is considered negligible for $d < 0.147$, small for $0.147 \leq d < 0.33$, medium for $0.33 \leq d < 0.47$, and large for $d \geq 0.47$ \cite{Grissom2005EffectSize}.
\textbf{Results.}
\figref{fig:numberOfBuildChangesSliding} shows the distribution of build changes across the project \texttt{spring-roo}. We refer the reader to the supplementary material\textsuperscript{\ref{fn:repPackage}} for the figures of all of the studied projects. The black line depicts the number of build changes according to the sliding window approach ($k=7$). Each vertical red line indicates a release. We can see that most of the peaks of the black line (number of build changes) appear near a vertical red line (release). This suggests that our hypothesis is correct.
\begin{figure*}[!t]
\centering
\includegraphics[width=\textwidth]{spring-roo-day-sliding-7.pdf}
\caption{Number of build changes over time in \texttt{spring-roo} using a sliding window ($k=7$). Releases are depicted as vertical red lines.}
\label{fig:numberOfBuildChangesSliding}
\end{figure*}
\begin{figure}[!t]
\centering
\includegraphics[width=\columnwidth]{spring-roo-distBox-combined-small.pdf}
\caption{Boxplots showing the distributions of the counts of near release and non-near release build changes of \texttt{spring-roo} as computed with the single day approach and sliding window approach using $k=7$.}
\label{fig:buildChangeDistribution}
\end{figure}
Furthermore, looking at the distribution of the number of build changes in days near releases and comparing it with the distribution of build changes in days that are far from releases, we can see that the distributions appear to be different. \figref{fig:buildChangeDistribution} shows the boxplots for both approaches and both distributions. The left two boxplots represent the single day approach whereas the right two boxplots represent the sliding window approach using $k=7$. In each of the two plots, the respective boxplot on the left depicts the distribution of build changes on days near a release whereas the respective boxplot on the right depicts the distribution of build changes on days that are not near a release.
\tabref{tab:testAndEffectSize} presents the p-value (p) of the Mann-Whitney-Wilcoxon test and Cliff's Delta $d$ for each project and approach in detail. The p-values show that the frequency of build changes near and not near a release differ significantly (all $p < 0.01$). Furthermore, the effect size can be considered large in all projects except \texttt{hadoop} (small) and \texttt{wicket} (medium). The \texttt{jenkins} project achieves a large effect size with the single day approach but only shows a small effect size with the sliding window approach. The \texttt{presto} project also shows a large effect size with the single day approach but only a medium effect size with the sliding window approach. We find that these lower effect sizes are caused by the release information. \texttt{hadoop} and \texttt{wicket} show a dense release plan in the beginning of the data and this can influence the sliding window approach. Similarly, the changes of the \texttt{jenkins} and \texttt{presto} projects are performed on the release day and hence, the inclusion of additional days, as done by the sliding window approach, lowers the effect size.
\begin{table}[]
\renewcommand{\arraystretch}{1.0}
\caption{Results of the Mann-Whitney-Wilcoxon test (p: p-value) and Cliffs Delta $d$ of the distributions of the number of build changes near and non-near releases using the single day approach and sliding window approach with $k=7$.}
\label{tab:testAndEffectSize}
\centering
\begin{tabular}{|l|rr|rr|}
\hline
\multirow{2}{*}{Project} & \multicolumn{2}{c|}{Single Day} & \multicolumn{2}{c|}{Sliding ($k=7$)} \\\cline{2-5}
& p & d & p & d \\
\hline
activemq & 2.73E-35 & 0.75 & 3.31E-15 & 0.64 \\
alluxio & 3.17E-15 & 0.79 & 7.93E-06 & 0.52 \\
camel & 3.03E-57 & 0.89 & 1.20E-29 & 0.64 \\
deeplearning4j & 1.33E-34 & 0.96 & 2.00E-17 & 0.77 \\
druid & 8.57E-225 & 0.97 & 2.42E-92 & 0.68 \\
flink & 8.78E-21 & 0.89 & 3.59E-10 & 0.73 \\
graylog2-server & 2.47E-117 & 0.84 & 3.21E-21 & 0.47 \\
hadoop & 1.43E-26 & 0.30 & 1.21E-16 & 0.30 \\
hazelcast & 1.53E-58 & 0.61 & 1.86E-25 & 0.54 \\
hbase & 1.49E-194 & 0.63 & 2.38E-102 & 0.57 \\
hibernate-search & 1.14E-177 & 0.98 & 3.53E-42 & 0.76 \\
jenkins & 5.28E-235 & 0.86 & 5.10E-08 & 0.15 \\
jetty & 2.17E-200 & 0.96 & 8.73E-72 & 0.66 \\
karaf & 1.79E-48 & 0.98 & 1.34E-26 & 0.80 \\
languagetool & 2.26E-99 & 0.94 & 3.27E-24 & 0.94 \\
neo4j & 2.07E-68 & 0.70 & 1.23E-34 & 0.55 \\
netty & 1.55E-203 & 0.94 & 2.05E-50 & 0.69 \\
orientdb & 8.71E-93 & 0.94 & 2.68E-28 & 0.66 \\
pinpoint & 1.94E-14 & 0.95 & 6.59E-07 & 0.86 \\
presto & 1.27E-145 & 0.98 & 2.07E-23 & 0.46 \\
sonarqube & 8.37E-85 & 0.93 & 1.46E-25 & 0.59 \\
spring-boot & 2.81E-50 & 0.97 & 3.45E-26 & 0.76 \\
spring-roo & 8.27E-42 & 0.78 & 8.57E-17 & 0.77 \\
storm & 9.55E-15 & 0.70 & 4.20E-06 & 0.53 \\
wicket & 1.19E-59 & 0.37 & 3.94E-29 & 0.41 \\
wildfly & 2.61E-45 & 0.93 & 9.97E-26 & 0.71 \\
\hline
\end{tabular}%
\end{table}
With these results, we can answer research question RQ2 as follows:\\
\noindent\fbox{\begin{minipage}{0.97\columnwidth}
Build changes are not equally distributed over the projects' timeline. There are particular phases which show significantly higher build change frequencies than others. Especially around releases, a high build change frequency is observed.
\end{minipage}}\\ | {'timestamp': '2017-03-27T02:09:45', 'yymm': '1703', 'arxiv_id': '1703.08527', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08527'} | arxiv |
\section{Introduction}
In many applications, datasets used for linear supervised learning contain a large number of continuous features, with a large number of samples.
An example is web-marketing, where features are obtained from bag-of-words scaled using tf-idf~\cite{russell2013mining}, recorded during the visit of users on websites.
A well-known trick~\cite{WuCog2012,LiuHussTanDas2002} in this setting is to replace each raw continuous feature by a set of binary features that one-hot encodes the interval containing it, among a list of intervals partitioning the raw feature range.
This improves the linear decision function with respect to the raw continuous features space, and can therefore improve prediction.
However, this trick is prone to over-fitting, since it increases significantly the number of features.
\paragraph{A new penalization.}
To overcome this problem, we introduce a new penalization called \emph{binarsity}, that penalizes the model weights learned from such grouped one-hot encodings (one group for each raw continuous feature).
Since the binary features within these groups are naturally ordered, the binarsity penalization combines a group total-variation penalization, with an extra linear constraint in each group to avoid collinearity between the one-hot encodings.
This penalization forces the weights of the model to be as constant (with respect to the order induced by the original feature) as possible within a group, by selecting a minimal number of relevant cut-points.
Moreover, if the model weights are all equal within a group, then the full block of weights is zero, because of the extra linear constraint.
This allows to perform raw feature selection.
\paragraph{High-dimensional linear supervised learning.}
To address the high-dimensionality of features, sparse linear inference is now an ubiquitous technique for dimension reduction and variable selection, see for instance~\cite{BuhVan-11} and \cite{ESL} among many others.
The principle is to induce sparsity (large number of zeros) in the model weights, assuming that only a few features are actually helpful for the label prediction.
The most popular way to induce sparsity in model weights is to add
a $\ell_1$-penalization (Lasso) term to the
goodness-of-fit~\cite{Tib-96}.
This typically leads to sparse parametrization of models, with a level of sparsity that depends on the strength of the penalization.
Statistical properties of $\ell_1$-penalization have been extensively investigated, see for instance~\cite{KniFu-00,zhaoconsistency2006, bunea2007oracle,BicRitTsy-09} for linear and generalized linear models and~\cite{donoho12001,Donoho02optimallysparse,candes2008a,candes2008b} for compressed sensing, among others.
However, the Lasso ignores ordering of features.
In~\cite{TibRosZhuKni-05}, a structured sparse penalization is proposed, known as fused Lasso, which provides superior performance in recovering the true model in such applications where features are ordered in some meaningful way.
It introduces a mixed penalization using a linear combination of the $\ell_1$-norm and the total-variation penalization, thus enforcing sparsity in both the weights and their successive differences.
Fused Lasso has achieved great success in some applications such as comparative genomic hybridization~\cite{rapaport2008}, image denoising~\cite{FriHasHofTib-07}, and prostate cancer analysis~\cite{TibRosZhuKni-05}.
\paragraph{Features discretization and cuts.}
For supervised learning, it is often useful to encode the input features in a new space to let the model focus on the relevant areas~\cite{WuCog2012}.
One of the basic encoding technique is \emph{feature discretization} or \emph{feature quantization}~\cite{LiuHussTanDas2002} that partitions the range of a continuous feature into intervals and relates these intervals with meaningful labels.
Recent overviews of discretization techniques can be found in~\cite{LiuHussTanDas2002} or~\cite{GarLueSaeLopHer2013}.
Obtaining the optimal discretization is a NP-hard problem~\cite{ChlNgu1998}, and an approximation can be easily obtained using a greedy approach, as proposed in decision trees: CART~\cite{BreFriOlsSto-84} and C4.5~\cite{Qui-93}, among others, that sequentially select pairs of features and cuts that minimize some purity measure (intra-variance, Gini index, information gain are the main examples).
These approaches build decision functions that are therefore very simple, by looking only at a single feature at a time, and a single cut at a time.
Ensemble methods (boosting~\cite{lugosi2004bayes}, random forests~\cite{breiman2001random}) improve this by combining such decisions trees, at the expense of models that are harder to interpret.
\paragraph{Main contribution.}
This paper considers the setting of linear supervised learning. The main contribution of this paper is the idea to use a total-variation penalization, with an extra linear constraint, on the weights of a generalized linear model trained on a binarization of the raw continuous features, leading to a procedure that selects multiple cut-points per feature, looking at all features simultaneously.
Our approach therefore increases the capacity of the considered generalized linear model: several weights are used for the binarized features instead of a single one for the raw feature.
This leads to a more flexible decision function compared to the linear one: when looking at the decision function as a function of a single raw feature, it is now piecewise constant instead of linear, as illustrated in Figure~\ref{figure-DecisionFunc} below.
\paragraph{Organization of the paper.}
The proposed methodology is described in Section~\ref{section:methodology}.
Section~\ref{sec:theoretical_results} establishes an oracle inequality for generalized linear models and provides a convergence rate for our procedure in the particular case of a sparse additive model.
Section~\ref{section:btv-experiments} highlights the results of the method on various datasets and compares its performances to well known classification algorithms.
Finally, we discuss the obtained results in
Section~\ref{section:discussion}.
\paragraph*{Notations.}
Throughout the paper, for every $q > 0,$ we denote by $\norm{v}_q$ the usual $\ell_q$-quasi norm of a vector $v \in {\mathbb{R}}^m,$ namely
$\norm{v}_q =(\sum_{k=1}^m|v_k|^q)^{1/q}$, and $\norm{v}_\infty = \max_{k=1, \ldots, m}|v_k|$. We also denote $\norm{v}_0 = |\{k : v_k \neq 0\}|$, where $|A|$ stands for the cardinality of a finite set $A$.
For $u, v \in {\mathbb{R}}^m$, we denote by $u \odot v$ the Hadamard product $u\odot v =(u_1v_1, \ldots, u_mv_m)^\top.$
For any $u \in {\mathbb{R}}^m$ and any $L \subset \{1, \ldots, m\},$ we denote $u_L$ as the vector in ${\mathbb{R}}^m$ satisfying $(u_L)_k = u_k$ for $k \in L$ and $(u_L)_k = 0$ for $ k \in L^\complement = \{1, \ldots, m\}\backslash L$.
We write, for short, $\mathbf{1}$ (resp. $\mathbf{0}$) for the vector of ${\mathbb{R}}^m$ having all coordinates equal to one (resp. zero).
Finally, we denote by $\sgn(x)$ the set of sub-differentials of the function $x \mapsto |x|$, namely $\sgn(x) = \{ 1\}$ if $x > 0$, $\sgn(x) = \{ -1 \}$ if $x < 0$ and $\sgn(0) = [-1, 1]$.
\section{The proposed method}
\label{section:methodology}
Consider a supervised training dataset $(x_i, y_i)_{i=1, \ldots, n}$ containing features
$x_i = [x_{i,1} \cdots x_{i,p}]^\top \in {\mathbb{R}}^p$ and labels
$y_i \in \cY \subset {\mathbb{R}}$, that are independent and identically distributed samples of $(X, Y)$ with unknown distribution $\P$.
Let us denote $\bX = [x_{i,j}]_{1 \leq i \leq n; 1 \leq j \leq p}$ the $n \times p$ features matrix vertically stacking the $n$ samples of $p$ raw features. Let $\bX_{\bullet, j}$ be the $j$-th feature column of~$\bX$.
\paragraph{Binarization.}
The binarized matrix $\XB$ is a matrix with an extended number $d > p$ of columns, where the $j$-th column $\bX_{\bullet, j}$ is replaced by $d_j \geq 2$ columns $\XB_{\bullet, j, 1}, \ldots, \XB_{\bullet, j, d_j}$ containing only zeros and ones. Its $i$-th row is written
\begin{equation*}
x_i^B = [x^B_{i,1,1} \cdots x^B_{i,1,d_1} x^B_{i,2,1} \cdots x^B_{i,2,d_2} \cdots x^B_{i,p,1}
\cdots x^B_{i,p, d_p}]^\top \in {\mathbb{R}}^d,
\end{equation*}
where $d = \sum_{j=1}^p d_j$.
In order to simplify the presentation of our results, we assume in the paper that all raw
features $\bX_{\bullet, j}$ are continuous, so that they are transformed using the following one-hot encoding.
For each raw feature $j$, we consider a partition of intervals $I_{j,1}, \ldots, I_{j, d_j}$ of
$\text{range}(\bX_{\bullet, j})$, namely satisfying $\cup_{k=1}^{d_j}I_{j,k} = \text{range}(\bX_{\bullet, j})$ and $I_{j,k} \cap I_{j,k'} = \varnothing$ for $k \neq k'$ and define
\begin{equation*}
x^B_{i, j, k} =
\begin{cases}
1 &\text{ if } x_{i,j} \in I_{j, k}, \\
0 & \text{ otherwise}
\end{cases}
\end{equation*}
for $i=1, \ldots, n$, $j=1, \ldots, p$ and $k=1, \ldots, d_j$.
An example is interquantiles intervals, namely
$I_{j, 1} = \big[ q_j(0), q_j(\frac {1}{d_j})\big]$ and
$I_{j, k} = \big(q_j(\frac {k-1}{d_j}) , q_j(\frac {k}{d_j}) \big]$ for $k=2, \ldots, d_j$, where $q_j(\alpha)$ denotes a quantile of order $\alpha \in [0, 1]$ for $\bX_{\bullet, j}$.
In practice, if there are ties in the estimated quantiles for a given feature, we simply choose the set of ordered unique values to construct the intervals.
This principle of binarization is a well-known trick~\cite{GarLueSaeLopHer2013}, that allows to improve over the linear decision function with respect to the raw feature space: it uses a larger number of model weights, for each
interval of values for the feature considered in the binarization.
If training data contains also unordered qualitative features, one-hot encoding with $\ell_1$-penalization can be used for instance.
\paragraph{Goodness-of-fit.}
Given a loss function $\ell : \cY \times {\mathbb{R}} \rightarrow {\mathbb{R}}$, we consider the goodness-of-fit term
\begin{equation}
\label{eq:gof}
R_n(\theta) = \frac 1n \sum_{i=1}^n \ell(y_i, m_\theta(x_i)),
\end{equation}
where $m_\theta(x_i) = \theta^\top x_i^B$ and $\theta \in {\mathbb{R}}^d$ where we recall that
$d = \sum_{j=1}^p d_j$. We then have $\theta = [\theta_{1, \bullet}^\top \cdots
\theta_{p,\bullet}^\top]^\top$, with $\theta_{j,\bullet}$ corresponding to the group of coefficients weighting the binarized raw $j$-th feature.
We focus on generalized linear models~\cite{green1994}, where the conditional distribution $Y | X = x$ is assumed to be from a one-parameter exponential family distribution with a density of the form
\begin{equation}
\label{distribut-glm}
y | x \mapsto f^0(y | x) = \exp\Big(\frac{ym^0(x) - b(m^0(x))}{\phi} + c(y,\phi)\Big),
\end{equation}
with respect to a reference measure which is either the Lebesgue measure (e.g. in the Gaussian case) or the counting measure (e.g. in the logistic or Poisson cases), leading to a loss function of the form
\begin{equation*}
\ell\big(y_1, y_2) = - y_1 y_2 + b(y_2).
\end{equation*}
The density described in~\eqref{distribut-glm} encompasses several distributions, see Table~\ref{table:glm}.
The functions $b(\cdot)$ and $c(\cdot)$ are known, while the natural parameter function $m^0(\cdot)$ is unknown.
The dispersion parameter $\phi$ is assumed to be known in what follows.
It is also assumed that $b(\cdot)$ is three times continuously differentiable.
It is standard to notice that
\begin{equation*}
\E[Y|X=x] = \int yf^0(y | x) dy = b'(m^0(x)),
\end{equation*}
where $b'$ stands for the derivative of $b$.
This formula explains how $b'$ links the conditional expectation to the unknown $m^0$.
The results given in Section~\ref{sec:theoretical_results} rely on the following Assumption.
\begin{assumption}
\label{ass:glm}
Assume that $b$ is three times continuously differentiable, that there is $C_b > 0$ such that $|b'''(z)| \leq C_b |b''(z)|$ for any $z \in {\mathbb{R}}$ and that there
exist constants $C_n > 0$ and $0 < L_n \leq U_n$ such that $C_n = \max_{i=1, \ldots, n}|m^0(x_i)| < \infty$ and $L_n \leq \max_{i=1, \ldots, n} b''\big(m^0(x_i)\big) \leq U_n.$
\end{assumption}
This assumption is satisfied for most standard generalized linear models.
In Table~\ref{table:glm}, we list some standard examples that fit in this framework, see also~\cite{vandegeer2008} and~\cite{rigollet2012}.
\begin{table}[htb]
\centering
\begin{tabular}{ccccccccc}
\toprule
Model & $\phi$ & $b(z)$ & $b'(z)$ & $b''(z)$ & $b'''(z)$ & $C_b$ & $L_n$ & $U_n$\\
\midrule
Normal & $\sigma^2$ & $\frac{z^2}{2}$ & $z$ & $1$ & $0$ & $0$ & $1$ & $1$ \\
Logistic & $1$ & $\log(1 + e^z)$&$\frac{e^z}{1+e^z}$ & $\frac{e^z}{(1+e^z)^2}$ &$\frac{1 - e^z}{1+e^z} b''(z)$ & 2 & $\frac{e^{C_n}}{(1 + e^{C_n})^2}$ & $\frac{1}{4}$\\
Poisson & $1$ & $e^z$ & $e^z$ & $e^z$ & $b''(z)$ & 1 & $e^{-C_n}$ & $e^{C_n}$\\
\bottomrule
\end{tabular}
\caption[table]{\small Examples of standard distributions that fit in the considered setting of generalized linear models, with the corresponding constants in Assumption~\ref{ass:glm}.}
\label{table:glm}
\end{table}
\paragraph{Binarsity.}
Several problems occur when using the binarization trick described above:
\begin{enumerate}
\item[(P1)] The one-hot-encodings satisfy $\sum_{k=1}^{d_j} \XB_{i, j, k} = 1$ for $j=1, \ldots, p$, meaning that the columns of each block sum to $\mathbf{1}$, making $\XB$ not of full rank by construction.
\item[(P2)] Choosing the number of intervals $d_j$ for binarization of each raw feature $j$ is not an easy task, as too many might lead to overfitting: the number of model-weights increases with each $d_j$, leading to a over-parametrized model.
\item[(P3)] Some of the raw features $\bX_{\bullet, j} $ might not be relevant for the prediction task, so we want to select raw features from their one-hot encodings, namely induce block-sparsity in $\theta$.
\end{enumerate}
A usual way to deal with (P1) is to impose a linear constraint~\cite{agresti2015foundations} in each block.
In order to do so, let us introduce first $n_{j, k} = | \{ i : x_{i, j} \in I_{j, k} \} |$ and
the vector $n_j = [n_{j, 1} \cdots n_{j, d_j}] \in {\mathbb{N}}^{d_j}$.
In our penalization term, we impose the linear constraint
\begin{equation}
\label{eq:linear_constraint}
n_j^\top \theta_{j, \bul} = \sum_{k=1}^{d_j} n_{j, k} \theta_{j,k} = 0
\end{equation}
for all $j=1, \ldots, p$.
Note that if the $I_{j, k}$ are taken as interquantiles intervals, then for each~$j$, we have that $n_{j, k}$ for $k=1, \ldots, d_j$ are equal and the constraint~\eqref{eq:linear_constraint} becomes
the standard constraint $\sum_{k=1}^{d_j} \theta_{j,k} = 0$.
The trick to tackle (P2) is to remark that within each block, binary features are ordered.
We use a within block total-variation penalization
\begin{equation*}
\sum_{j=1}^p \norm{\theta_{j, \bullet}}_{\TV,\hat w_{j,\bullet}}
\end{equation*}
where
\begin{equation}
\label{eq:tv_no_linear_constraint}
\norm{\theta_{j,\bullet}}_{\TV,\hat w_{j,\bullet}} = \sum_{k=2}^{d_j} \hat w_{j,k} |\theta_{j, k} -
\theta_{j, k-1}|,
\end{equation}
with weights $\hat w_{j, k} > 0$ to be defined later, to keep the number of different values taken by $\theta_{j, \bullet}$ to a minimal level.
Finally, dealing with (P3) is actually a by-product of dealing with (P1) and (P2).
Indeed, if the raw feature $j$ is not-relevant, then $\theta_{j, \bullet}$ should have all entries constant because of the penalization~\eqref{eq:tv_no_linear_constraint}, and in this case all entries are zero, because of~\eqref{eq:linear_constraint}.
We therefore introduce the following penalization, called \emph{binarsity}
\begin{equation}
\label{eq:binarsity}
\bina(\theta) = \sum_{j=1}^p \Big( \sum_{k=2}^{d_j} \hat w_{j,k}|
\theta_{j, k} -\theta_{j, {k-1}}| + \delta_j(\theta_{j, \bullet}) \Big)
\end{equation}
where the weights $\hat w_{j, k} > 0$ are defined in Section~\ref{sec:theoretical_results} below, and where
\begin{equation}
\label{eq:def_delta_j}
\delta_j(u) =
\begin{cases}
0 \quad &\text{ if } \quad n_j^\top u = 0, \\
\infty &\text{ otherwise}.
\end{cases}
\end{equation}
We consider the goodness-of-fit~\eqref{eq:gof} penalized by~\eqref{eq:binarsity}, namely
\begin{equation}
\label{model:general_0}
\hat \theta \in \argmin_{\theta \in {\mathbb{R}}^d } \big\{R_n(\theta) +
\bina(\theta) \big\}.
\end{equation}
An important fact is that this optimization problem is numerically cheap, as explained in the next paragraph.
Figure~\ref{figure-binarization-features-agg} illustrates the effect of the binarsity penalization with a varying strength on an example.
\begin{figure}[htb!]
\centering
\begin{subfigure}{}
\includegraphics[width=\columnwidth]{./beta0.pdf}
\end{subfigure}
\vspace{-.5cm}
\begin{subfigure}{}
\includegraphics[width=\columnwidth]{./beta1.pdf}
\end{subfigure}
\vspace{-.4cm}
\begin{subfigure}{}
\includegraphics[width=\columnwidth]{./beta2.pdf}
\end{subfigure}
\vspace{-.4cm}
\begin{subfigure}{}
\includegraphics[width=\columnwidth]{./beta3.pdf}
\end{subfigure}
\caption{\small Illustration of the binarsity penalization on the ``Churn'' dataset (see Section~\ref{section:btv-experiments} for details) using logistic regression. Figure~(a) shows the model weights learned by the Lasso method on the continuous raw features. Figure~(b) shows the unpenalized weights on the binarized features, where the dotted green lines mark the limits between blocks corresponding to each raw features. Figures~(c) and (d) show the weights with medium and strong binarsity penalization respectively. We observe in (c) that some significant cut-points start to be detected, while in (d) some raw features are completely removed from the model, the same features as those removed in (a).}
\label{figure-binarization-features-agg}
\end{figure}
In Figure~\ref{figure-DecisionFunc}, we illustrate on a toy example, when $p=2$, the decision boundaries obtained for logistic regression (LR) on raw features, LR on binarized features and LR on binarized features with the binarsity penalization.
\begin{figure*}[htb!]
\centering
\includegraphics[width=0.9\textwidth]{./illustration.pdf}
\caption{\small Illustration of binarsity on 3 simulated toy datasets for binary classification with two classes (blue and red points). We set $n=1000$, $p=2$ and $d_1=d_2=100$.
In each row, we display the simulated dataset, followed by the decision boundaries for a logistic regression classifier trained on initial raw features, then on binarized features without regularization, and finally on binarized features with binarsity.
The corresponding testing AUC score is given on the lower right corner of each figure.
Our approach allows to keep an almost linear decision boundary in the first row, while a good decision boundaries are learned on the two other examples, which correspond to non-linearly separable datasets, without apparent overfitting.}
\label{figure-DecisionFunc}
\end{figure*}
\paragraph{Proximal operator of binarsity.}
The proximal operator and proximal algorithms are important tools for non-smooth convex optimization, with important applications in the field of supervised learning with structured sparsity \cite{bach2012optimization}.
The proximal operator of a proper lower semi-continuous~\cite{BauCom-11} convex function $g : {\mathbb{R}}^d \rightarrow {\mathbb{R}}$ is defined by
\begin{equation*}
\prox_g(v) \in \argmin_{u \in {\mathbb{R}}^d} \Big\{\frac 12
\norm{v- u}_2^2 + g(u) \Big\}.
\end{equation*}
Proximal operators can be interpreted as generalized projections.
Namely, if $g$ is the indicator of a convex set $C \subset {\mathbb{R}}^d$ given by
\begin{equation*}
g(u) = \delta_C(u) =
\begin{cases}
0 &\text{ if } u \in C, \\
\infty &\text{ otherwise, }
\end{cases}
\end{equation*}
then $\prox_g$ is the projection operator onto $C$.
It turns out that the proximal operator of binarsity can be computed very efficiently, using an algorithm~\cite{Cond-13} that we modify in order to include weights $\hat w_{j, k}$.
It applies in each group the proximal operator of the total-variation since binarsity penalization is block separable, followed by a simple projection onto $\text{span}(n_j)^\perp$ the orthogonal
of~$\text{span}(n_j)$, see Algorithm~\ref{algorithm-primal-computation} below.
We refer to Algorithm~\ref{algorithm-weighted-TV-agg} in Section~\ref{appendix:proximal-operator-wTV} for the weighted total-variation proximal operator.
\begin{proposition}
\label{proposition:prox-btv-primal}
Algorithm~\ref{algorithm-primal-computation} computes the proximal operator of $\bina(\theta)$ given by~\eqref{eq:binarsity}.
\LinesNotNumbered
\begin{algorithm}[htp!]
\SetNlSty{textbf}{}{.}
\DontPrintSemicolon
\caption{Proximal operator of $\bina(\theta)$, see~\eqref{eq:binarsity}}
\label{algorithm-primal-computation}
\KwIn{vector $\theta \in {\mathbb{R}}^d$ and weights $\hat w_{j, k}$ and $n_{j, k}$ for $j=1, \ldots, p$
and $k=1, \ldots, d_j$}
\KwOut{vector $\eta = \prox_{\bina}(\theta)$}
\For{$j=1$ {\bfseries to} $p$}{
$\beta_{j,\bullet} \gets \prox_{\norm{\theta_{j,\bullet}}_{\TV,\hat w_{j,\bullet}}}(\theta_{j, \bullet})$ (TV-weighted prox in block $j$, see~\eqref{eq:tv_no_linear_constraint}) \\
$\eta_{j,\bullet} \gets \beta_{j,\bullet} -
\frac{n_j^\top \beta_{j,\bullet}}{\norm{n_j}_2^2} n_j$ (projection onto $\text{span}(n_j)^\perp$)
}
\textbf{Return:} {$\eta$}
\end{algorithm}
\end{proposition}
A proof of Proposition~\ref{proposition:prox-btv-primal} is given in Section~\ref{appendix:proof-of-proposition:prox-btv-primal}.
Algorithm~\ref{algorithm-primal-computation} leads to a very fast numerical routine, see Section~\ref{section:btv-experiments}.
The next section provides a theoretical analysis of our algorithm with an oracle inequality for the prediction error, together with a convergence rate in the particular case of a sparse additive model.
\section{Theoretical guarantees}
\label{sec:theoretical_results}
We now investigate the statistical properties of~\eqref{model:general} where the weights in the binarsity penalization have the form
\begin{equation*}
\hat w_{j,k} = O \Big(\sqrt{\frac{\log d}{n} \ \hat \pi_{j,k}} \Big), \quad
\text{ with }
\quad \hat \pi_{j,k} = \frac{\big|\big\{ i=1, \ldots, n: x_{i,j} \in \cup_{k'=k}^{d_j} I_{j, k'}
\big\}\big|}{n}
\end{equation*}
for all $k \in \{2, \ldots, d_j\}$, see Theorem~\ref{thm:oracle} for a precise definition of $\hat w_{j, k}$.
Note that $\hat \pi_{j,k}$ corresponds to the proportion of ones in the sub-matrix obtained by deleting the first $k$ columns in the $j$-th binarized block matrix $\XB_{\bullet,j}.$
In particular, we have $\hat \pi_{j,k} > 0$ for all $j, k$.
We consider the risk measure defined by
\begin{equation*}\label{eqn:risk}
R(m_{\theta}) =\frac{1}{n} \sum_{i=1}^n \big\{- b'(m^0(x_i)) m_{\theta}(x_i) + b(m_{\theta}(x_i))\big\},
\end{equation*}
which is standard with generalized linear models~\cite{vandegeer2008}.
\subsection{A general oracle inequality}
We aim at evaluating how ``close'' to the minimal possible expected risk our estimated function $m_{\hat{\theta}}$ with $\hat \theta$ given by~\eqref{model:general} is.
To measure this closeness, we establish a non-asymptotic oracle inequality with a fast rate of convergence considering the excess risk of
$m_{\hat\theta}$, namely $R(m_{\hat\theta}) - R(m^0)$.
To derive this inequality, we consider for technical reasons the following problem instead
of~\eqref{model:general_0}:
\begin{equation}
\label{model:general}
\hat \theta \in \argmin_{\theta \in B_d(\rho)} \big\{R_n(\theta) +
\bina(\theta) \big\},
\end{equation}
where
\begin{equation*}
B_d(\rho) = \Big \{\theta \in {\mathbb{R}}^d: \sum_{j=1}^p\norm{\theta_{j , \bullet}}_\infty \leq \rho \Big\}.
\end{equation*}
This constraint is standard in literature for the proof of oracle inequalities for sparse generalized linear models, see for instance~\cite{vandegeer2008}, and is discussed in details below.
We also impose a restricted eigenvalue assumption on $\XB.$
For all $\theta \in {\mathbb{R}}^d,$ let $J(\theta)= [J_1 (\theta),\ldots, J_p (\theta)]$ be the
concatenation of the support sets relative to the total-variation penalization, that is
\begin{equation*}
J_j(\theta)= \{k = 2, \ldots, d_j \; : \; \theta_{j,k} \neq \theta_{j,k-1} \}.
\end{equation*}
Similarly, we denote $J^\complement(\theta)= \big[J_1^\complement(\theta),\ldots,J_p^\complement(\theta)\big]$ the complementary of $J(\theta).$
The restricted eigenvalue condition is defined as follow.
\begin{assumption}
\label{assumption:RE-XB}
Let $K =[K_1, \ldots, K_p]$ be a concatenation of index sets such that
\begin{equation}
\label{eq:max_K_Jstar}
\sum_{j=1}^p |K_j| \leq J^\star,
\end{equation}
where $J^\star$ is a positive integer.
Define
\begin{equation*}
\normalfont
\kappa (K) \in \inf\limits_{\substack{u \in \mathscr{C}_{\TV,\hat w}(K)}\backslash\{\mathbf{0}\}}\Bigg\{\frac{\norm{\XB u}_2}{\sqrt{n} \norm{u_K}_2} \Bigg\}
\end{equation*}
with
\begin{equation}
\normalfont
\mathscr{C}_{ \TV, \hat w}(K) \stackrel{}{=} \bigg\{u \in {\mathbb{R}}^d: \sum_{j=1}^p\norm{(u_{j, \bullet})_{{K_j}^\complement}}_{ \TV, \hat w_{j,\bullet}}
\leq 2\sum_{j=1}^p \norm{(u_{j, \bullet})_{K_j}}_{ \TV, \hat w_{j,\bullet}} \bigg\}.
\label{C-AGG}
\end{equation}
We assume that the following condition holds
\begin{equation}
\label{eq:kappa-RE-XB}
\normalfont \kappa (K) > 0
\end{equation}
for any $K$ satisfying~\eqref{eq:max_K_Jstar}.
\end{assumption}
The set $\mathscr{C}_{\TV, \hat w}(K)$ is a cone composed by all vectors with a support ``close'' to $K$.
Theorem~\ref{thm:oracle} gives a risk bound for the estimator $m_{\hat\theta}$.
\begin{theorem}
\label{thm:oracle}
Let Assumptions~\ref{ass:glm} and~\ref{assumption:RE-XB} be satisfied. Fix $A >0$ and choose
\begin{equation}
\label{choice-of-weights-sq-slow-GLM}
\hat w_{j,k} = \sqrt{\frac{2U_n\phi(A +\log d)}{n}\,\hat \pi_{j,k}}.
\end{equation}
Then, with probability at least $1 -2e^{-A}$, any $\hat \theta$ given by~\eqref{model:general} satisfies
\begin{align*}
\label{fast-oracle-thm}
R(m_{\hat \theta}) - R(m^0) \leq \inf_{\theta} \Big\{ & 3 (R(m_{\theta}) - R(m^0)) \\
& \quad + \frac{2560 (C_b(C_n + \rho) + 2)}{L_n \kappa^2(J(\theta))} \; |J(\theta)| \;
\max_{j=1, \ldots, p} \norm{(\hat w_{j,\bullet})_{J_j(\theta)}}_\infty^2 \Big\},
\end{align*}
where the infimum is over the set of vectors $\theta \in B_d(\rho)$ such that $n_j^\top
\theta_{j, \bullet} = 0$ for all $j=1, \ldots, p$ and such that $|J(\theta)| \leq J^*$.
\end{theorem}
The proof of Theorem~\ref{thm:oracle} is given in Section~\ref{proof-fast-oracle-ineq-bina} below.
Note that the ``variance'' term or ``complexity'' term in the oracle inequality satisfies
\begin{equation}
\label{complex-term-thm1}
|J(\theta)| \max_{j=1, \ldots, p}\norm{(\hat w_{j,\bullet})_{J_j(\theta)}}_\infty^2
\leq 2 U_n\phi \frac{|J(\theta)|(A + \log d)}{n}.
\end{equation}
The value $|J(\theta)|$ characterizes the sparsity of the vector $\theta$, given by
\begin{equation*}
|J(\theta)| = \sum_{j=1}^p |J_j(\theta)| =
\sum_{j=1}^p | \{k = 1, \ldots, d_j : \theta_{j,k} \neq \theta_{j,k-1} \}|.
\end{equation*}
It counts the number of non-equal consecutive values of $\theta$.
If $\theta$ is block-sparse, namely whenever $|\mathcal{J}(\theta)| \ll p$ where $\mathcal{J}(\theta) = \{ j = 1, \ldots, p : \theta_{j, \bul} \neq 0_{d_j} \}$ (meaning that few raw features are useful for prediction), then
$|J(\theta)| \leq |\mathcal{J}(\theta)| \max_{j \in \mathcal{J}(\theta)} |J_j(\theta)|$, which means that $|J(\theta)|$ is controlled by the block sparsity $|\mathcal{J}(\theta)|$.
The oracle inequality from Theorem~\ref{thm:oracle} is stated uniformly for vectors $\theta \in B_d(\rho)$ satisfying $n_j^\top \theta_{j, \bullet} = 0$ for all $j=1, \ldots, p$ and $|J(\theta)| \leq J^*$.
Writing this oracle inequality under the assumption $|J(\theta)| \leq J^*$ meets the standard way of stating sparse oracle inequalities, see e.g.~\cite{BuhVan-11}.
Note that $J^*$ is introduced in Assumption~\ref{assumption:RE-XB} and corresponds to a maximal sparsity for which the matrix $\bX^B$ satisfies the restricted eigenvalue assumption.
Also, the oracle inequality stated in Theorem~\ref{thm:oracle} stands for vectors such that $n_j^\top \theta_{j, \bullet} = 0$, which is natural since the binarsity penalization imposes these extra linear constraints.
The assumption that $\theta \in B_d(\rho)$ is a technical one, that allows to establish a connection, via the notion of self-concordance, see~\cite{bach2010selfconcordance}, between the empirical squared $\ell_2$-norm and the empirical Kullback divergence (see Lemma~\ref{lemma-connection-L2-KL} in Section~\ref{proof-fast-oracle-ineq-bina}).
It corresponds to a technical constraint which is commonly used in literature for the proof of oracle inequalities for sparse generalized linear models, see for instance~\cite{vandegeer2008}, a recent contribution for the particular case of Poisson regression being~\cite{ivanoff2016adaptive}.
Also, note that
\begin{equation}
\label{lemma:control_inner_ball}
\max_{i=1,\ldots,n} | \inr{x_i^B, \theta} | \leq \sum_{j=1}^p
\norm{\theta_{j , \bullet}}_\infty \leq |\mathcal{J}(\theta)|
\times \norm{\theta}_\infty,
\end{equation}
where $\norm{\theta}_\infty = \max_{j=1, \ldots, p} \norm{\theta_{j, \bul}}_\infty$.
The first inequality in~\eqref{lemma:control_inner_ball} comes from the fact that the entries of $\XB$ are in $\{0, 1\}$, and it entails that $ \max_{i=1,\ldots,n} | \inr{x_i^B, \theta} | \leq \rho$ whenever $\theta \in B_d(\rho)$.
The second inequality in~\eqref{lemma:control_inner_ball} entails that $\rho$ can be upper bounded by $|\mathcal{J}(\theta)| \times \norm{\theta}_\infty$, and therefore the constraint $\theta \in B_d(\rho)$ becomes only a box constraint on $\theta$, which depends on the dimensionality of the features through $|\mathcal{J}(\theta)|$ only.
The fact that the procedure depends on $\rho$, and that the oracle inequality stated in Theorem~\ref{thm:oracle} depends linearly on $\rho$ is commonly found in literature about sparse generalized linear models, see~\cite{vandegeer2008,bach2010selfconcordance,ivanoff2016adaptive}.
However, the constraint $B_d(\rho)$ is a technicality which is not used in the numerical experiments provided in Section~\ref{section:btv-experiments} below.
In the next Section, we exhibit a consequence of Theorem~\ref{thm:oracle}, whenever one considers the Gaussian case (least-squares loss) and where $m^0$ has a sparse additive structure defined below.
This structure allows to control the bias term from Theorem~\ref{thm:oracle} and to exhibit a convergence rate.
\subsection{Sparse linear additive regression}
\label{sub:sparse_linear_additive_regression}
Theorem~\ref{thm:oracle} allows to study a particular case, namely an additive model, see e.g.~\cite{hastie1990generalized,horowitz2006optimal} and in particular a sparse additive linear model, which is of particular interest in high-dimensional statistics, see~\cite{meier2009high,ravikumar2009sparse,BuhVan-11}.
We prove in Theorem~\ref{thm:additive} below that our procedure matches the convergence rates previously known from literature.
In this setting, we work under the following assumptions.
\begin{assumption}
\label{ass:additive-model}
We assume to simplify that $x_i \in [0, 1]^d$ for all $i=1, \ldots, n$.
We consider the Gaussian setting with the least-squares loss,
namely $\ell(y, y') = \frac 12 (y - y')^2$, $b(y) = \frac 12 y^2$ and $\phi = \sigma^2$ (noise variance) in Equation~\eqref{distribut-glm}, with $L_n = U_n = 1$, $C_b = 0$ in
Assumption~\ref{ass:glm}.
Moreover, we assume that $m^0$ has the following sparse additive structure
\begin{equation*}
m^0(x) = \sum_{j \in \mathcal{J}_*} m_j^0(x_j)
\end{equation*}
for $x = [x_1 \cdots x_p] \in {\mathbb{R}}^p$, where $m_j^0 : {\mathbb{R}} \rightarrow {\mathbb{R}}$ are $L$-Lipschitz functions, namely satisfying $|m_j^0(z) - m_j^0(z')| \leq L |z - z'|$ for any $z, z' \in {\mathbb{R}}$, and where $\mathcal{J}_* \subset \{ 1, \ldots, p \}$ is a set of active features (sparsity means that $|\mathcal{J}_*| \ll p$).
Also, we assume the following identifiability condition
\begin{equation*}
\sum_{i=1}^n m_j^0(x_{i, j}) = 0
\end{equation*}
for all $j=1, \ldots, p$.
\end{assumption}
Assumption~\ref{ass:additive-model} contains identifiability and smoothness requirements that are standard when studying additive models, see e.g.~\cite{meier2009high}.
We restrict the functions $m_j^0$ to be Lipschitz and not smoother, since our procedure produces a piecewise constant decision function with respect to each $j$, that can approximate optimally only Lipschitz functions.
For more regular functions, our procedure would lead to suboptimal rates, see also the discussion below the statement of Theorem~\ref{thm:additive}.
\begin{theorem}
\label{thm:additive}
Consider procedure~\eqref{model:general_0} with $d_j = D$, where $D$ is the integer part of $n^{1/3}$, and $I_{j, 1} = [0, \frac{1}{D}]$, $I_{j, k} = (\frac{k-1}{D}, \frac{k}{D}]$ for all $k=2, \ldots, D$ and $j=1, \ldots, p$, and keep the weights $\hat w_{j, k}$ the same as in Theorem~\ref{thm:oracle}.
Introduce also $\theta_{j, k}^* = \sum_{i=1}^n m_j^0(x_{i, j}) \ind{I_k}(x_{i, j}) / \sum_{i=1}^n \ind{I_k}(x_{i, j})$ for $j \in \mathcal{J}_*$ and $\theta_{j, \bul}^* = \boldsymbol 0_D$ for $j \notin \mathcal{J}_*$.
Then, under Assumption~\ref{assumption:RE-XB} with $J^* = J(\theta^*)$ and Assumption~\ref{ass:additive-model}, we have
\begin{equation*}
\norm{m_{\hat \theta} - m^0}_n^2 \leq \Big(3 L^2 |\mathcal{J}_*| + \frac{5120 M_n \sigma^2
(A + \log(p n^{1/3} M_n)}{\kappa^2(J(\theta^*))} \Big) \frac{|\mathcal{J}_*|}{n^{2/3}},
\end{equation*}
where $M_n = \max_{j=1, \ldots, p} \max_{i=1, \ldots, n} |m_j^0(x_{i, j})|.$
\end{theorem}
The proof of Theorem~\ref{thm:additive} is given in Section~\ref{sub:proof_of_theorem_thm:additive} below.
It is an easy consequence of Theorem~\ref{thm:oracle} under the sparse additive model assumption.
It uses Assumption~\ref{assumption:RE-XB} with $J^* = J(\theta^*)$, since $\theta_{j, \bul}^*$ is the minimizer of the bias for each $j \in \mathcal{J}_*$, see the proof of Theorem~\ref{thm:additive} for details.
The rate of convergence is, up to constants and logarithmic terms, of order $|\mathcal{J}_*|^2 n^{-2/3}.$
Recalling that we work under a Lipschitz assumption, namely H\"older smoothness of order $1$, the scaling of this rate w.r.t. to $n$ is $n^{-2 r / (2 r + 1)}$ with $r=1$, which matches the one-dimensional minimax rate.
This rate matches the one obtained in~\cite{BuhVan-11}, see Chapter~8 p.~272, where the rate $|\mathcal{J}_*|^2 n^{-2r / (2r + 1)} = |\mathcal{J}_*|^2 n^{-4 / 5}$ is derived under a $C^2$ smoothness assumption, namely $r = 2$.
Hence, Theorem~\ref{thm:additive} shows that, in the particular case of a sparse additive model, our procedure matches in terms of convergence rate the state of the art.
Further improvements could consider more general smoothness (beyond Lipschitz) and adaptation with respect to the regularity, at the cost of a more complicated procedure which is beyond the scope of this paper.
\section{Numerical experiments}
\label{section:btv-experiments}
In this section, we first illustrate the fact that the binarsity penalization is roughly only two times slower than basic $\ell_1$-penalization, see the timings in Figure~\ref{fig:computing-times-simu}. We then compare binarsity to a large number of baselines, see Table~\ref{table:baselines}, using 9 classical binary classification datasets obtained from the UCI Machine Learning Repository~\cite{Lichman:2013}, see Table~\ref{table:datasets}.
\begin{figure}[htp!]
\centering
\includegraphics[width=.75\columnwidth]{./computing_times_simu.pdf}\hfill
\caption{\small Average computing time in second (with the black lines representing $\pm$ the standard deviation) obtained on 100 simulated datasets for training a logistic model with binarsity VS Lasso penalization, both trained on $\XB$ with $d_j=10$ for all $j \in 1, \ldots, p$. Features are Gaussian with a Toeplitz covariance matrix with correlation $0.5$ and $n=10000$. Note that the computing time ratio between the two methods stays roughly constant and equal to $2$.}
\label{fig:computing-times-simu}
\end{figure}
\begin{table}[htp!]
\centering
\small
\begin{tabular}{cccc}
\toprule
Name & Description & Reference \\
\midrule
Lasso & Logistic regression (LR) with $\ell_1$ penalization & \cite{tibshirani1996regression}\\
Group L1 & LR with group $\ell_1$ penalization & \cite{meier2008group} \\
Group TV & LR with group total-variation penalization & \\
SVM & Support vector machine with radial basis kernel & \cite{scholkopf2002learning} \\
GAM & Generalized additive model & \cite{hastie1990generalized} \\
RF & Random forest classifier & \cite{breiman2001random} \\
GB & Gradient boosting & \cite{friedman2002stochastic} \\
\bottomrule
\end{tabular}
\caption{\small Baselines considered in our experiments. Note that Group L1 and Group TV are considered on binarized features.}
\label{table:baselines}
\end{table}
\begin{table}[htb!]
\centering
\small
\begin{tabular}{cccc}
\toprule
Dataset & \#Samples & \#Features & Reference \\
\midrule
Ionosphere & 351 & 34 & \cite{sigillito1989classification}\\
Churn & 3333 & 21 & \cite{Lichman:2013} \\
Default of credit card & 30000 & 24 & \cite{yeh2009comparisons} \\
Adult & 32561 & 14 & \cite{kohavi1996scaling} \\
Bank marketing & 45211 & 17 & \cite{moro2014data} \\
Covertype & 550088 & 10 & \cite{blackard1999comparative} \\
SUSY & 5000000 & 18 & \cite{baldi2014searching} \\
HEPMASS & 10500000 & 28 & \cite{baldi2016parameterized} \\
HIGGS & 11000000 & 24 & \cite{baldi2014searching} \\
\bottomrule
\end{tabular}
\caption{\small Basic informations about the 9 considered datasets.}
\label{table:datasets}
\end{table}
For each method, we randomly split all datasets into a training and a test set (30\% for testing), and all hyper-parameters are tuned on the training set using $V$-fold cross-validation with
$V = 10$.
For support vector machine with radial basis kernel (SVM), random forests (RF) and gradient boosting (GB), we use the reference implementations from the \texttt{scikit-learn} library~\cite{scikit-learn}, and we use the \texttt{LogisticGAM} procedure from the~\texttt{pygam} library\footnote{\url{https://github.com/dswah/pyGAM}} for the GAM baseline.
The binarsity penalization is proposed in the~\texttt{tick} library~\cite{2017arXiv170703003B}, we provide sample code for its use in Figure~\ref{fig:code}.
Logistic regression with no penalization or ridge penalization gave similar or lower scores for all considered datasets, and are therefore not reported in our experiments.
\begin{figure}[htp!]
\centering
\includegraphics[width=0.8\textwidth]{./code.png}
\caption{\small Sample python code for the use of binarsity with logistic regression in the \texttt{tick} library, with the use of the \texttt{FeaturesBinarizer} transformer for features binarization.}
\label{fig:code}
\end{figure}
The binarsity penalization does not require a careful tuning of $d_j$ (number of bins for the one-hot encoding of raw feature $j$).
Indeed, past a large enough value, increasing $d_j$ even further barely changes the results since the cut-points selected by the penalization do not change anymore.
This is illustrated in Figure~\ref{fig:discretization-impact}, where we observe that past $50$ bins, increasing $d_j$ even further does not affect the performance, and only leads to an increase of the training time.
In all our experiments, we therefore fix $d_j=50$ for $j = 1, \ldots, p$.
\begin{figure*}[htp!]
\centering
\includegraphics[width=\textwidth]{./discretization_impact.pdf}
\caption{\small Impact of the number of bins used in each block ($d_j$) on the classification performance (measured by AUC) and on the training time using the ``Adult'' and ``Default of credit card'' datasets. All $d_j$ are equal for $j = 1, \ldots, p$, and we consider in all cases the best hyper-parameters selected after cross validation. We observe that past $d_j=50$ bins, performance is roughly constant, while training time strongly increases.}
\label{fig:discretization-impact}
\end{figure*}
The results of all our experiments are reported in Figures~\ref{fig:roc-curves} and~\ref{fig:computing-time-comparison}.
In Figure~\ref{fig:roc-curves} we compare the performance of binarsity with the baselines on all 9 datasets, using ROC curves and the Area Under the Curve (AUC), while we report computing (training) timings in Figure~\ref{fig:computing-time-comparison}.
We observe that binarsity consistently outperforms Lasso, as well as Group L1: this highlights the importance of the TV norm within each group.
The AUC of Group TV is always slightly below the one of binarsity, and more importantly it involves a much larger training time: convergence is slower for Group TV, since it does not use the linear constraint of binarsity, leading to a ill-conditioned problem (sum of binary features equals 1 in each block).
Finally, binarsity outperforms also GAM and its performance is comparable in all considered examples to RF and GB, with computational timings that are orders of magnitude faster, see Figure~\ref{fig:computing-time-comparison}.
All these experiments illustrate that binarsity achieves an extremely competitive compromise between computational time and performance, compared to all considered baselines.
\begin{figure*}[!htp]
\centering
\includegraphics[width=.32\textwidth]{./roc_ionosphere.pdf}\hfill
\includegraphics[width=.32\textwidth]{./roc_churn.pdf}\hfill
\includegraphics[width=.32\textwidth]{./roc_default_cb.pdf}
\includegraphics[width=.32\textwidth]{./roc_adult.pdf}\hfill
\includegraphics[width=.32\textwidth]{./roc_bank.pdf}\hfill
\includegraphics[width=.32\textwidth]{./roc_covertype.pdf}
\includegraphics[width=.32\textwidth]{./roc_susy.pdf}\hfill
\includegraphics[width=.32\textwidth]{./roc_hepmass.pdf}\hfill
\includegraphics[width=.32\textwidth]{./roc_higgs.pdf}
\caption{\small Performance comparison using ROC curves and AUC scores (given between parenthesis) computed on test sets. The 4 last datasets contain too many examples for SVM (RBF kernel). Binarsity consistently does a better job than Lasso, Group L1, Group TV and GAM. Its performance is comparable to SVM, RF and GB but with computational timings that are orders of magnitude faster, see Figure~\ref{fig:computing-time-comparison}.}
\label{fig:roc-curves}
\end{figure*}
\section{Conclusion}
\label{section:discussion}
In this paper, we introduced the binarsity penalization for one-hot encodings of continuous features.
We illustrated the good statistical properties of binarsity for generalized linear models by proving non-asymptotic oracle inequalities.
We conducted extensive comparisons of binarsity with state-of-the-art algorithms for binary classification on several standard datasets.
Experimental results illustrate that binarsity significantly outperforms Lasso, Group L1 and Group TV penalizations and also generalized additive models, while being competitive with random forests and boosting.
Moreover, it can be trained orders of magnitude faster than boosting and other ensemble methods.
Even more importantly, it provides interpretability.
Indeed, in addition to the raw feature selection ability of binarsity, the method pinpoints significant cut-points for all continuous feature.
This leads to a much more precise and deeper understanding of the model than the one provided by Lasso on raw features.
These results illustrate the fact that binarsity achieves an extremely competitive compromise between computational time and performance, compared to all considered baselines.
\begin{figure*}
\centering
\includegraphics[width=\textwidth]{./times.pdf}
\caption{\small Computing time comparisons (in seconds) between the methods on the considered datasets. Note that the time values are $\log$-scaled. These timings concern the learning task for each model with the best hyper parameters selected, after the cross validation procedure. The 4 last datasets contain too many examples for the SVM with RBF kernel to be trained in a reasonable time. Roughly, binarsity is between 2 and 5 times slower than $\ell_1$ penalization on the considered datasets, but is more than 100 times faster than random forests or gradient boosting algorithms on large datasets, such as HIGGS.}
\label{fig:computing-time-comparison}
\end{figure*}
\section{Proofs}
In this Section we gather the proofs of all the theoretical results proposed in the paper.
Throughout this Section, we denote by $\partial(\phi)$ the subdifferential mapping of a convex function $\phi.$
\subsection{Proof of Proposition~\ref{proposition:prox-btv-primal}}
\label{appendix:proof-of-proposition:prox-btv-primal}
Recall that the indicator function $\delta_j$ is given by~\eqref{eq:def_delta_j}.
For any fixed $j=1, \ldots, p,$ we prove that $\prox_{\norm{\cdot}_{\TV,\hat w_{j,\bullet}} + \delta_j}$ is the composition of $\prox_{\norm{\cdot}_{\TV,\hat w_{j,\bullet}}}$ and $\prox_{\delta_j},$ namely
\begin{equation*}
\prox_{\norm{\cdot}_{\TV,\hat w_{j,\bullet}} + \delta_j}(\theta_{j,\bullet}) = \prox_{\delta_j}\big(\prox_{\norm{\cdot}_{\TV,\hat w_{j,\bullet}}}(\theta_{j,\bullet})\big)
\end{equation*}
for all $\theta_{j,\bullet} \in {\mathbb{R}}^{d_j}$.
Using Theorem~1 in~\cite{Yu-13}, it is sufficient to show that for all $\theta_{j,\bullet} \in {\mathbb{R}}^{d_j},$ we have
\begin{equation}
\label{sub-diff-inclusion}
\partial \big(\norm{\theta_{j,\bullet}}_{\TV,\hat w_{j,\bullet}}\big) \subseteq \partial \big(\norm{\prox_{\delta_j}(\theta_{j,\bullet})}_{\TV, \hat w_{j,\bullet}}\big).
\end{equation}
We have $\prox_{\delta_j} (\theta_{j,\bullet}) = \Pi_{\text{span}\{n_j\}^\perp}(\theta_{j,\bullet}),$ where $\Pi_{\text{span}\{n_j\}^\perp}(\cdot)$ stands for the projection onto the orthogonal of $\text{span}\{n_j\}$.
This projection simply writes
\begin{equation*}
\Pi_{\text{span}\{n_j\}^\perp}(\theta_{j,\bullet}) = \theta_{j, \bul} -
\frac{n_j^\top \theta_{j, \bullet}}{\norm{n_j}_2^2} n_j
\end{equation*}
Now, let us define the $d_j \times d_j$ matrix $D_j$ by
\begin{equation}
\label{eq:D_j-matrix-definition}
{{D}_{j}}=
\begin{bmatrix}
1 & 0 & & 0 \\
-1 & 1 & \\
& \ddots& \ddots \\
0 & & -1& 1
\end{bmatrix} \in {\mathbb{R}}^{d_j}\times {\mathbb{R}}^{d_j}.
\end{equation}
We then remark that for all $\theta_{j,\bullet} \in {\mathbb{R}}^{d_j}$,
\begin{equation}
\label{eq:weighted-TV-hadamard-expr}
\norm{\theta_{j,\bullet}}_{\TV, \hat w_{j,\bullet}}
= \sum_{k=2}^{d_j} \hat w_{j,k} |\theta_{j,k} - \theta_{j, k-1}|
= \norm{\hat w_{j,\bullet} \odot D_j \theta_{j,\bullet}}_{1}.
\end{equation}
Using subdifferential calculus (see details in the proof of Proposition~\ref{proposition: KKT-conditions} below), one has
\begin{equation*}
\partial \big(\norm{\theta_{j,\bullet}}_{\TV, \hat w_{j,\bullet}}\big) = \partial \big(\norm{\hat w_{j,\bullet}\odot{{D_{j}}}\theta_{j,\bullet}}_{1}\big) = {{D_{j}}}^\top \hat w_{j,\bullet}\odot \sgn({{D_j}}\theta_{j,\bullet}).
\end{equation*}
Then, the linear constraint $n_j^\top \theta_{j, \bul} = 0$ entails
\begin{equation*}
{{D_j}}^\top \hat w_{j,\bullet}\odot \sgn({{D_j}} \theta_{j,\bullet}) = {{D_j}}^\top
\hat w_{j,\bullet}\odot \sgn \Big( {{D_j}} \big( \theta_{j,\bullet} -
\frac{n_j^\top \theta_{j, \bullet}}{\norm{n_j}_2^2} n_j \big) \Big),
\end{equation*}
which leads to~\eqref{sub-diff-inclusion} and concludes the proof of the Proposition. $\hfill \square$
\subsection{Proximal operator of the weighted TV penalization}
\label{appendix:proximal-operator-wTV}
We recall in Algorithm~\ref{algorithm-weighted-TV-agg} an algorithm provided in~\cite{alaya2014} for the computation of the proximal operator of the weighted total-variation penalization
\begin{equation}
\label{primal-prox-wTV}
\beta =\prox_{\norm{\cdot}_{\TV,\hat w}}(\theta) \in \argmin_{\theta\in {\mathbb{R}}^m} \Big\{ \frac{1}{2} \norm{\beta
- \theta}_2^2 + \norm{\theta}_{\TV, \hat w} \Big\}.
\end{equation}
A quick explanation of this algorithm is as follows.
The algorithm runs forwardly through the input vector $(\theta_1, \ldots, \theta_m).$
Using Karush-Kuhn-Tucker (KKT) optimality conditions~\cite{BoyVan-04}, we have that at a location $k,$
the weight $\beta_k$ stays constant whenever $|u_k| < \hat w_{k+1}$,
where $u_k$ is a solution to a dual problem associated to the primal problem~\eqref{primal-prox-wTV}.
If not possible, it goes back to the last location where a jump can be introduced in $\beta$, validates the current segment until this location, starts a new segment, and continues.
\LinesNotNumbered
\begin{algorithm}[htbp]
\SetNlSty{textbf}{}{.}
\DontPrintSemicolon
\caption{\small Proximal operator of weighted TV penalization}
\label{algorithm-weighted-TV-agg}
\KwIn{vector $\theta=\big(\theta_1, \ldots, \theta_m\big) ^\top\in {\mathbb{R}}^m$ and weights $\hat w = (\hat w_1,\ldots, \hat w_m) \in {\mathbb{R}}^{m}_{+}.$}
\KwOut{vector $\beta = \prox_{\norm{\cdot}_{\TV,\hat w}}(\theta)$}
\nl\textbf{Set} {$k=k_0=k_-=k_+ \gets 1$\\$\qquad \beta_{\min} \gets \theta_1- \hat w_2\ ;\ \beta_{\max} \gets \theta_1+ \hat w_2$\\$\qquad u_{\min}\gets \hat w_2\ ;\ u_{\max} \gets -\hat w_2$}\\
\nl \label{step2}{\If{$k=m$}
{ $\beta_m \gets \beta_{\min}+ u_{\min}$}}
\nl \label{step3} \If (\tcc*[f]{negative jump}){$\theta_{k+1} + u_{\min} < \beta_{\min} - \hat w_{k+2}$}
{$\beta_{k_0}= \cdots =\beta_{k_-} \gets \beta_{\min}$\\
$k=k_0=k_-=k_+\gets k_- + 1$\\
$ \beta_{\min} \gets \theta_{k} - \hat w_{k +1}+ \hat w_{k }\ ;\ \beta_{\max} \gets \theta_{k} + \hat w_{k +1}+ \hat w_{k}$\\
$u_{\min} \gets \hat w_{k +1}\ ;\ u_{\max} \gets -\hat w_{k+1}$
}
\nl \ElseIf (\tcc*[f]{positive jump}){$\theta_{k+1} + u_{\max} > \beta_{\max}+ \hat w_{k+2}$}
{$\beta_{k_0}= \ldots =\beta_{k_+} \gets \beta_{\max}$\\
$k=k_0=k_-=k_+\gets k_+ + 1$\\
$\beta_{\min} \gets \theta_{k} - \hat w_{k+1} - \hat w_{k }\ ;\ \beta_{\max}\gets \theta_{k} +\hat w_{k+1}- \hat w_{k}$\\
$ u_{\min} \gets \hat w_{k+1}\ ;\ u_{\max} \gets -\hat w_{k+1}$
}
\nl \Else (\tcc*[f]{no jump}){ \textbf{set }$k \gets k+1$\\
$\qquad u_{\min} \gets \theta_{k} + \hat w_{k+1} - \beta_{\min}$\\
$\qquad u_{\max} \gets \theta_{k} - \hat w_{k+1} - \beta_{\max}$
\If{$u_{\min} \geq \hat w_{k+1}$}{ $\beta_{\min}\gets \beta_{\min}+ \frac{u_{\min} - \hat w_{k+1}}{k-k_0+1}$\\
$u_{\min} \gets \hat w_{k+1}$\\
$k_- \gets k$}
\If{$u_{\max} \leq -\hat w_{k+1}$}{$\beta_{\max}\gets \beta_{\max}+ \frac{u_{\max} + \hat w_{k+1}}{k-k_0+1}$\\
$u_{\max} \gets -\hat w_{k+1}$\\
$k_+ \gets k$}
}
\nl \If{$ k< m$ } { go to \textbf{\ref{step3}.}}
\nl \If{$u_{\min} < 0$ } {$\beta_{k_0}= \cdots =\beta_{k_-} \gets \beta_{\min}$\\
$k=k_0=k_- \gets k_-+1$\\
$\beta_{\min}\gets \theta_k - \hat w_{k+1}+ \hat w_{k}$\\
$u_{\min}\gets \hat w_{k+1}\ ;\ u_{\max} \gets \theta_k+ \hat w_{k} - v_{\max}$
\\go to \textbf{\ref{step2}.}}
\nl \ElseIf{$u_{\max} > 0$ } { $ \beta_{k_0}= \cdots =\beta_{k_+}\gets \beta_{\max}$\\
$k=k_0=k_+ \gets k_++1$\\
$\beta_{\max} \gets \theta_k +\hat w_{k+1} - \hat w_{k}$\\
$u_{\max}\gets - \hat w_{k+1}\ ;\ u_{\min}\gets \theta_k- \hat w_{k} - u_{\min}$ \\
go to \textbf{\ref{step2}.}}
\nl \Else{$\beta_{k_0}= \cdots =\beta_m\gets \beta_{\min} + \frac{u_{\min}}{k-k_0+1}$}
\end{algorithm}
\subsection{Proof of Theorem~\ref{thm:oracle}}
\label{proof-fast-oracle-ineq-bina}
The proof relies on several technical properties that are described below.
From now on, we consider $\by = [y_1 \cdots y_n]^\top$, $\bX = [x_1 \cdots x_n]^\top$, $m^0(\bX) = [m^0(x_1) \cdots m^0(x_n)]^\top,$ and recalling that $m_\theta(x_i) = \theta^\top x^B_i)$ we introduce $m_\theta(\bX) = [m_\theta(x_1) \cdots m_\theta(x_n) ]^\top$ and $b'(m_\theta(\bX)) = [b'(m_\theta(x_1)) \cdots b'(m_\theta(x_n)) ]^\top.$
Let us now define the Kullback-Leibler divergence between the true probability density funtion $f^0$ defined in~\eqref{distribut-glm} and a candidate $f_\theta$ within the generalized linear model $f_\theta(y|x) = \exp\big(ym_\theta(x) - b(m_\theta(x))$ as follows
\begin{align*}
\mathrm{KL}_n(f^0, f_\theta) &= \frac{1}{n} \sum_{i=1}^n \E_{\P_{\mathbf y|X}}\Big[\log\frac{f^0(y_i|x_i)}{f_{\theta}(y_i | x_i)}\Big]\\
&:= \mathrm{KL}_n(m^0(\bX), m_\theta (\bX)),
\end{align*}
where $\P_{\mathbf y|X}$ is the joint distribution of $\by$ given $\bX$.
We then have the following Lemma.
\begin{lemma}
\label{lemma-excess-risk-KL}
The excess risk satisfies
\begin{equation*}
R(m_{\theta}) - R(m^0) = \phi \mathrm{KL}_n(m^0(\bX), m_\theta (\bX)),
\end{equation*}
where we recall that $\phi$ is the dispertion parameter of the generalized linear model, see~\eqref{distribut-glm}.
\end{lemma}
\medskip
\noindent
\textbf{Proof.}
If follows from the following simple computation
\begin{align*}
&\mathrm{KL}_n(m^0(\bX), m_\theta (\bX))\\
&\qquad= \phi^{-1} \frac 1n \sum_{i=1}^n \E_{\P_{\mathbf y|X}} \Big[\big( -y_i m_{\theta}(x_i) +b(m_{\theta}(x_i))\big) - \big(-y_i m^0(x_i) +b(m^0(x_i))\big) \Big]\\
&\qquad = \phi^{-1} \big(R(m_{\theta}) - R(m^0)\big)
\end{align*}
which proves the Lemma. $\hfill \square$
\subsection{Optimality conditions}
As explained in the following Proposition, a solution to problem~\eqref{model:general} can be characterized using the Karush-Kuhn-Tucker (KKT) optimality conditions~\cite{BoyVan-04}.
\begin{proposition}
\label{proposition: KKT-conditions}
A vector $\hat \theta = [{\hat\theta}_{1,\bullet}^\top \cdots {\hat\theta}_{p,\bullet}^\top]^\top \in {\mathbb{R}}^d$ is
an optimum of the objective function~\eqref{model:general} if and only if there are subgradients
$\hat h = [\hat h _{j, \bullet}]_{j=1, \ldots, p} \in \partial \norm{\hat \theta}_{ \TV, \hat w}$ and
$\hat g = [\hat g _{j, \bullet}]_{j=1, \ldots, p} \in
\partial [\delta_j(\hat \theta_{j,\bullet})]_{j=1, \ldots, p}$ such that
\begin{equation*}
\nabla R_n(\hat \theta_{j,\bullet})+{\hat h}_{j,\bullet} + {\hat g}_{j,\bullet} = \mathbf{0},
\end{equation*}
where
\begin{equation}
\label{subdifferential-of-TVw}
\left\{
\begin{array}{ll}
{\hat h}_{j,\bullet} = D_{{j}}^\top \big(\hat w_{j,\bullet}\odot\sgn(D_{{j}}{\hat\theta}_{j,\bullet})\big) & \mbox{if } j \in J(\hat \theta),\\
{\hat h}_{j,\bullet} \in D_{{j}}^\top \big( \hat w_{j,\bullet}\odot {[-1,+1]}^{d_j}\big) & \mbox{if } j \in J^\complement(\hat \theta),
\end{array}
\right.
\end{equation}
and where we recall that $J(\hat \theta)$ is the support set of $\hat \theta$.
The subgradient $\hat g_{j, \bullet}$ belongs to
\begin{equation*}
\partial\big(\delta_j(\hat \theta_{j,\bullet})\big) = \big\{\mu_{j, \bullet}\in {\mathbb{R}}^{d_j}: \mu_{j, \bullet}^\top
\theta_{j, \bullet} \leq \mu_{j, \bullet}^\top \hat \theta_{j,\bullet} \; \text{ for all } \;
\theta_{j, \bullet} \; \text{ such that } \; n_j^\top \theta_{j,\bullet} = 0 \big\}.
\end{equation*}
For the generalized linear model, we have
\begin{equation}
\label{KKT-logistic}
\normalfont
\frac 1n \big( \XB_{\bullet,j}\big)^\top\big(b'(m_{\hat\theta}(\bX))- \by\big) + {\hat h}_{j,\bullet} + \hat g_{j,\bullet} + \hat f_{j,\bullet}= \mathbf{0},
\end{equation}
where $\hat f = [{\hat f }_{j,\bullet}]_{j=1, \ldots, p}$ belongs to the normal cone of the ball $B_d(\rho).$
\end{proposition}
\medskip
\noindent
\textbf{Proof.}
The function $\theta \mapsto R_n(\theta)$ is differentiable, so the subdifferential of $R_n(\cdot) + \bina(\cdot)$ at a point $\theta = (\theta_{j,\bullet})_{j=1, \ldots, p} \in {\mathbb{R}}^d$ is given by
\begin{equation*}
\partial (R_n(\theta) + \bina(\theta)) = \nabla R_n(\theta) + \partial(\bina(\theta)),
\end{equation*}
where
$\nabla R_n(\theta) = \Big[\frac{\partial R_n(\theta)}{\partial \theta_{1,\bullet}} \cdots
\frac{\partial R_n(\theta)}{\partial \theta_{p,\bullet}}\Big]^\top$
and
\begin{equation*}
\partial \bina(\theta) =
\Big[ \partial \norm{\theta_{1,\bullet}}_{ \TV, \hat w_{1,\bullet}} + \partial \delta_j(\theta_{1,\bullet})
\; \cdots \; \partial \norm{\theta_{p,\bullet}}_{ \TV, \hat w_{p,\bullet}} + \partial \delta_j(\theta_{p,\bullet}) \Big]^\top.
\end{equation*}
We have $\norm{\theta_{j,\bullet}}_{ \TV, \hat w_{j,\bullet}} = \norm{ \hat w_{j,\bullet} \odot D_j\theta_{j,\bullet}}_1$ for all $j =1, \ldots,p$. Then, by applying some properties of the subdifferential calculus, we get
\begin{equation}
\label{subdifferential-btv}
\partial \norm{\theta_{j,\bullet}}_{ \TV, \hat w_{j,\bullet}}
= \begin{cases}
D_j^\top \sgn(\hat w_{j,\bullet} \odot D_j\theta_{j,\bullet}) & \text{ if } D_j\theta \neq \mathbf{0}, \\
D_j^\top\big(\hat w_{j,\bullet}\odot v_j) & \text{ otherwise},
\end{cases}
\end{equation}
where $v_j \in [-1,+1]^{d_j}$ for all $j=1, \ldots, p$.
For generalized linear models, we rewrite
\begin{equation}
\label{glm-model-in-proof}
\hat \theta \in \argmin_{\theta \in {\mathbb{R}}^d } \big\{R_n(\theta) + \bina(\theta) + \delta_{B_d(\rho)}(\theta)\big\},
\end{equation}
where $\delta_{B_d(\rho)}$ is the indicator function of $B_d(\rho)$.
Now, $\hat \theta = [{\hat\theta}_{1,\bullet}^\top \cdots {\hat\theta}_{p,\bullet}^\top]^\top$ is an optimum of~\eqref{glm-model-in-proof} if and only if $\mathbf{0} \in \nabla R_n(m_{\hat \theta})
+ \partial \norm{\hat \theta}_{\TV, \hat w} + \partial \delta_{B_d(\rho)}(\hat \theta_{})$.
Recall that the subdifferential of $\delta_{B_d(\rho)}(\cdot)$ is the normal cone of $B_d(\rho)$, namely
\begin{equation}
\label{normal-cone}
\partial \delta_{B_d(\rho)}(\hat \theta) = \big\{\eta \in {\mathbb{R}}^d :
\eta^\top \theta \leq \eta^\top \hat \theta \text{ for all } \theta \in B_d(\rho) \}.
\end{equation}
One has
\begin{equation}
\label{nabla-logistic}
\frac{\partial R_n(\theta)}{\partial \theta_{j,\bullet}}
= \frac{1}{n} (\XB_{\bullet,j})^\top(b'(m_{\hat\theta}(\bX)) - \by),
\end{equation}
so that together with~\eqref{nabla-logistic} and~\eqref{normal-cone} we obtain~\eqref{KKT-logistic}, which concludes the proof of Proposition~\ref{proposition: KKT-conditions}. $\hfill \square$
\subsection{Compatibility conditions}
\label{sub:compatibility_conditions}
Let us define the block diagonal matrix ${{\bf{D}}} = \diag({D}_{{1}}, \ldots, {D}_{{p}})$ with $D_j$
defined in~\eqref{eq:D_j-matrix-definition}.
We denote its inverse ${{T}_{j}}$ which is defined by the $d_j \times d_j$ lower triangular matrix
with entries $({{T}_{j}})_{r,s} = 0$ if $r < s$ and $({{T}_{j}})_{r,s} = 1$ otherwise.
We set $ {{\bf{T}}} =\diag({T}_{{1}}, \ldots, {T}_{{p}})$, so that one has ${\bf{D}} ^{-1} = {\bf{T}}$.
In order to prove Theorem~\ref{thm:oracle}, we need the following results which give a compatibility property~\cite{vandegeer2008,vandegeer2013,DalHeiLeb14} for the matrix ${\bf{T}}$, see
Lemma~\ref{lemma-compatibility-Tw} below and for the matrix $\XB{\bf{T}}$, see Lemma~\ref{lemma:CC-XBTw} below.
For any concatenation of subsets $ K=[K_1, \ldots, K_p],$ we set
\begin{equation}
\label{defn:concatenation}
K_j = \{\tau_j^1, \ldots, \tau_j^{b_j}\} \subset \{1, \ldots, d_j\}
\end{equation}
for all $j=1, \ldots, p$ with the convention that $\tau_j^0 = 0$ and $\tau_j^{{b_j} +1} = d_j +1$.
\begin{lemma}
\label{lemma-compatibility-Tw}
Let $ \gamma\in {\mathbb{R}}^d_+$ be given and $K = [K_1, \ldots, K_p]$ with $K_j$ given by~\eqref{defn:concatenation} for all $j=1, \ldots, p$.
Then, for every $u \in {\mathbb{R}}^d \backslash \{\mathbf{0}\}$, we have
\begin{equation*}
\frac{\norm{{\bf{T}} u}_2}{|\norm{u_K\odot \gamma_K}_1 - \norm{u_{K^\complement} \odot \gamma_{K^\complement}}_1|} \geq \kappa_{{\bf{T}},\gamma}(K),
\end{equation*}
where
\begin{equation*}
\kappa_{{\bf{T}},\gamma}(K) = \bigg\{ 32 \sum_{j=1}^p\sum_{k=1}^{d_j} | \gamma_{j,k+1} -\gamma_{j,k}|^2+ 2|K_j|\norm{\gamma_{j,\bullet}}_\infty^2\Delta_{\min, K_j}^{-1}\bigg\}^{-1/2},
\end{equation*}
and $\Delta_{\min, K_j} = \min_{r=1, \ldots b^j}| \tau_j^{{r_j}} - \tau_j^{{r_j} -1 }|.$
\end{lemma}
\medskip
\noindent
\textbf{Proof.}
Using Proposition~3 in~\cite{DalHeiLeb14}, we have
\begin{equation*}
\begin{split}
&\norm{u_K\odot \gamma_K}_1 - \norm{u_{K^\complement} \odot \gamma_{K^\complement}}_1\\
&\qquad \qquad = \sum_{j=1}^p\norm{u_{K_j}\odot \gamma_{K_j}}_1 - \norm{u_{{K_j}^\complement} \odot \gamma_{{K_j}^\complement}}_1 \\
&\qquad \qquad \leq \sum_{j=1}^p 4\norm{T_{{j}} u_{j,\bullet}}_2 \bigg\{2\sum_{k=1}^{d_j} | \gamma_{j,k+1} -\gamma_{j,k}|^2
+ 2(b_j +1) \norm{\gamma_{j,\bullet}}_\infty^2\Delta_{\min, K_j}^{-1}\bigg\}^{1/2}.
\end{split}
\end{equation*}
Using H\"older's inequality for the right hand side of the last inequality gives
\begin{equation*}
\begin{split}
&\norm{u_K\odot \gamma_K}_1 - \norm{u_{K^\complement} \odot \gamma_{K^\complement}}_1\\
&\qquad \qquad \leq \norm{{\bf{T}} u}_2 \bigg\{ 32\sum_{j=1}^p \sum_{k=1}^{d_j} | \gamma_{j,k+1} -\gamma_{j,k} |^2 + 2|K_j| \norm{\gamma_{j,\bullet}}_\infty^2\Delta_{\min, K_j}^{-1}\bigg\}^{1/2},
\end{split}
\end{equation*}
which completes the proof of the Lemma. $\hfill \square$
\medskip
Combining Assumption~\ref{assumption:RE-XB} and Lemma~\ref{lemma-compatibility-Tw} allows to establish a compatibility condition satisfied by $\XB {\bf{T}}$.
\begin{lemma}
\label{lemma:CC-XBTw}
Let $\gamma \in {\mathbb{R}}^d_+$ be given and $K = [K_1, \ldots, K_p]$ with $K_j$ given by~\eqref{defn:concatenation} for $j=1, \ldots, p$.
Then, if Assumption~\ref{assumption:RE-XB} holds, one has
\begin{equation}
\label{ineq:compatibility-XT}
\inf\limits_{\substack{u \in \mathscr{C}_{1,\hat w}(K)\backslash\{\mathbf{0}\}}}\Big\{\frac{\norm{\XB {\bf{T}} u}_2}{\sqrt{n} \;|\; \norm{u_K\odot \gamma_K}_1 - \norm{u_{K^\complement} \odot \gamma_{K^\complement}}_1 |} \Big\}\geq \kappa_{{\bf{T}},\gamma}(K)\kappa(K),
\end{equation}
where
\begin{equation}
\label{C-1}
\mathscr{C}_{1, \hat w}(K) \stackrel{}{=} \Big\{u \in {\mathbb{R}}^d: \sum_{j=1}^p \norm{(u_{j, \bullet})_{{K_j}^\complement}}_{1,\hat w_{j,\bullet}} \leq 2\sum_{j=1}^p \norm{(u_{j, \bullet})_{K_j}}_{1,\hat w_{j,\bullet}}\Big\}.
\end{equation}
\end{lemma}
\noindent
\textbf{Proof.}
Lemma~\ref{lemma-compatibility-Tw} gives
\begin{equation*}
\frac{\norm{\XB {\bf{T}}u}_2}{\sqrt{n} |\norm{u_K\odot \gamma_K}_1 - \norm{u_{K^\complement} \odot \gamma_{K^\complement}}_1|} \geq \kappa_{{\bf{T}},\gamma}(K)\frac{\norm{\XB {\bf{T}}u}_2}{\sqrt{n} \norm{{\bf{T}}u}_2}.
\end{equation*}
Now, we note that if $u \in \mathscr{C}_{1, \hat w}(K)$, then ${\bf{T}} u \in \mathscr{C}_{ \TV, \hat w}(K).$ Hence, Assumption~\ref{assumption:RE-XB} entails
\begin{equation*}
\frac{\norm{\XB {\bf{T}} u}_2}{\sqrt{n} |\norm{u_K\odot \gamma_K}_1 - \norm{u_{K^\complement} \odot \gamma_{K^\complement}}_1|} \geq \kappa_{{\bf{T}},\gamma}(K) \kappa(K),
\end{equation*}
which concludes the proof of the Lemma. $\hfill \square$
\subsection{Connection between the empirical Kullback-Leibler divergence and the empirical squared norm}
\label{subsection-connection-betwen-KL-sqnorm}
The next Lemma is from~\cite{bach2010selfconcordance} (see Lemma~1 herein).
\begin{lemma}
\label{lemma:self-concordance}
Let $\varphi:{\mathbb{R}} \rightarrow {\mathbb{R}}$ be a three times differentiable convex function such that for all $t\in{\mathbb{R}},$ $|\varphi'''(t)| \leq M |\varphi''(t)|$ for some $M \geq 0.$ Then, for all $t \geq 0$, one has
\begin{equation*}
\frac{\varphi''(0)}{M^2}\psi(-Mt) \leq \varphi(t) - \varphi(0) - \varphi'(0)t \leq \frac{\varphi''(0)}{M^2}\psi(Mt),
\end{equation*}
with $\psi(u) = e^u - u - 1$.
\end{lemma}
This Lemma entails the following in our setting.
\begin{lemma}
\label{lemma-connection-L2-KL}
Under Assumption~\ref{ass:glm}, one has
\begin{align*}
\frac{L_n \psi(-2(C_n + \rho))}{4 \phi (C_n + \rho)^2} \frac{1}{n}\norm{m^0(\bX) - m_\theta(\bX)}_2^2
&\leq \mathrm{KL}_n(m^0(\bX), m_\theta(\bX)), \\
\frac{U_n \psi(2(C_n + \rho))}{4 \phi (C_n + \rho)^2} \frac{1}{n}\norm{m^0(\bX) - m_\theta(\bX)}_2^2
&\geq \mathrm{KL}_n(m^0(\bX), m_\theta(\bX)),
\end{align*}
for all $\theta \in B_d(\rho)$.
\end{lemma}
\noindent
\textbf{Proof.}
Let us consider the function $G_n:{\mathbb{R}} \rightarrow {\mathbb{R}}$ defined by $G_n(t)= R_n(m^0 + t m_\eta)$, with $m_\eta$ to be defined later, which writes
\begin{equation*}
G_n(t) = \frac 1n \sum_{i=1}^n b(m^0(x_i) + tm_\eta(x_i)) - \frac 1n\sum_{i=1}^n y_i (m^0(x_i) + tm_\eta(x_i)).
\end{equation*}
We have
\begin{equation*}
\begin{split}
&G'_n(t)= \frac{1}{n} \sum_{i=1}^n m_\eta(x_i) b'(m^0(x_i) + tm_\eta(x_i)) - \frac{1}{n} \sum_{i=1}^n y_i m_\eta(x_i),\\
&G''_n(t) = \frac{1}{n} \sum_{i=1}^n m^2_\eta(x_i) b''(m^0(x_i) + tm_\eta(x_i)),\\
\text{and} \quad &G'''_n(t) = \frac{1}{n} \sum_{i=1}^n m^3_\eta(x_i) b'''(m^0(x_i) + tm_\eta(x_i)).
\end{split}
\end{equation*}
Using Assumption~\ref{ass:glm}, we have $|G'''_n(t)| \leq C_b \norm{m_\eta}_{\infty}|G''_n(t)|$ where $\norm{m_\eta}_{\infty} := \max\limits_{i=1, \ldots, n}|m_\eta(x_i)|$.
Lemma~\ref{lemma:self-concordance} with $M = C_b \norm{m_\eta}_{\infty}$ gives
\begin{equation*}
G''_n(0)\frac{ \psi(- C_b \norm{m_\eta}_{\infty}t)}{C_b^2\norm{m_\eta}_{\infty}^2}\leq G_n(t) - G_n(0)
- tG'_n(0) \leq G''_n(0) \frac{ \psi(C_b\norm{m_\eta}_{\infty}t)}{C_b^2 \norm{m_\eta}_{\infty}^2}
\end{equation*}
for all $t\geq 0$ and $t=1$ leads to
\begin{equation*}
G''_n(0)\frac{ \psi(-C_b \norm{m_\eta}_{\infty})}{C_b^2 \norm{m_\eta}_{\infty}^2}
\leq R_n(m^0 + m_\eta) - R_n(m^0) - G'_n(0) \leq
G''_n(0) \frac{ \psi(C_b \norm{m_\eta}_{\infty})}{C_b^2 \norm{m_\eta}_{\infty}^2}.%
\end{equation*}
An easy computation gives
\begin{align*}
- G'_n(0) = \frac{1}{n} \sum_{i=1}^n m_\eta(x_i) \big(y_i - b'(m^0(x_i)) \big)
\; \text{ and } \; G''_n(0) = \frac{1}{n} \sum_{i=1}^n m^2_\eta(x_i)b''(m_{\eta }(x_i)),
\end{align*}
and since obviously $\E_{\P_{\mathbf y|X}}[G_n'(0)] = 0$, we obtain
\begin{align*}
&G''_n(0)\frac{ \psi(-C_b \norm{m_\eta}_{\infty})}{C_b^2 \norm{m_\eta}_{\infty}^2}
\leq R(m^0 + m_\eta) - R(m^0)
\leq G''_n(0)\frac{ \psi(C_b \norm{m_\eta}_{\infty})}{C_b^2 \norm{m_\eta}_{\infty}^2}.
\end{align*}
Now, choosing $m_{\eta} = m_\theta - m^0$ and combining Assumption~\ref{ass:glm}
with Equation~\eqref{lemma:control_inner_ball} gives
\begin{equation*}
C_b \norm{m_\eta}_{\infty} \leq C_b \max_{i=1, \ldots, n} (|\inr{x_i^B, \theta}| + |m^0(x_i)| ) \leq C_b (\rho + C_n).
\end{equation*}
Hence, since $x \mapsto \psi(x) / x^2$ is an increasing function on ${\mathbb{R}}^+$, we end up with
\begin{align*}
G''_n(0)\frac{ \psi(-C_b (C_n + \rho))}{C_b^2 (C_n + \rho)^2}
&\leq R(m_{\theta}) - R(m_{0}) = \phi \mathrm{KL}_n(m^0(\bX), m_{\theta}(\bX)),\\
G''_n(0)\frac{ \psi(C_b (C_n + \rho))}{C_b^2 (C_n + \rho)^2}
&\geq R(m_{\theta}) - R(m_{0})= \phi \mathrm{KL}_n(m^0(\bX), m_{\theta}(\bX)),
\end{align*}
and since $G''_n(0) = n^{-1} \sum_{i=1}^n (m_\theta(x_i) - m^0(x_i) )^2 b''(m^0(x_i))$,
we obtain
\begin{align*}
\frac{L_n \psi(-C_b (C_n + \rho))}{C_n^2 \phi (C_n + \rho)^2} \frac{1}{n} \norm{m^0(\bX) - m_\theta(\bX)}_2^2
&\leq \mathrm{KL}_n(m^0(\bX), m_{\theta}(\bX)), \\
\frac{U_n\psi(C_b (C_n + \rho))}{C_b^2 \phi (C_n + \rho)^2} \frac{1}{n} \norm{m^0(\bX) - m_\theta(\bX)}_2^2
&\geq \mathrm{KL}_n(m^0(\bX), m_{\theta}(\bX)),
\end{align*}
which concludes the proof of the Lemma. $\hfill \square$
\subsection{Proof of Theorem~\ref{thm:oracle}}
\label{appendix:proof-theorem-oracle-logistic-V2}
Let us recall that
\begin{equation*}
R_n(m_\theta) = \frac{1}{n} \sum_{i=1}^n b(m_\theta(x_i))- \frac{1}{n} \sum_{i=1}^n y_i m_{\theta}(x_i)
\end{equation*}
for all $\theta \in {\mathbb{R}}^d$ and that
\begin{equation}
\label{proof-def-estimator-logistic}
\hat \theta \in \argmin_{\theta \in B_d(\rho)} \big\{R_n(\theta) + \bina(\theta)\big\}.
\end{equation}
Proposition~\ref{proposition: KKT-conditions} above entails that there is
$\hat h = [\hat h _{j, \bullet}]_{j=1, \ldots, p} \in \partial \norm{\hat \theta}_{\TV, \hat w}$,
$\hat g = [\hat g _{j, \bullet}]_{j=1, \cdots, p} \in [\partial \delta_j(\hat \theta_{j,\bullet})]_{j=1, \ldots, p}$ and
$\hat f = [\hat f_{j,\bullet}]_{j=1, \ldots, p} \in \partial \delta_{B_d(\rho)}(\hat \theta)$ such that
\begin{equation*}
\Big\langle \frac{1}{n} (\XB)^\top (b'(m_{\hat\theta}(\bX)) - \by) + \hat h + \hat g + \hat f,
\hat \theta - \theta \Big\rangle = 0
\end{equation*}
for all $\theta \in {\mathbb{R}}^d$.
This can be rewritten as
\begin{align*}
&\frac 1n \inr{b'(m_{\hat\theta}(\bX))- b'(m^0(\bX)),m_{\hat \theta}(\bX) - m_\theta(\bX)}\\
&\qquad \qquad - \frac 1n \inr{\by - b'(m^0(\bX)),m_{\hat \theta}(\bX) - m_\theta(\bX)} +
\inr{\hat h + \hat g + \hat f, \hat \theta - \theta} = 0.
\end{align*}
For any $\theta \in B_d(\rho)$ such that $n_j^\top \theta_{j, \bul} = 0$ for all $j$ and
$h \in \partial \norm{\theta}_{ \TV, \hat w}$, the monotony of the subdifferential mapping implies
$\inr{\hat h, \theta - \hat \theta} \leq \inr{h, \theta - \hat \theta},$
$\inr{\hat g, \theta - \hat \theta} \leq 0,$ and $\inr{\hat f, \theta - \hat \theta} \leq 0$, so that
\begin{equation}
\label{ineq:subdiff-monocity-logistic}
\begin{split}
\frac 1n \inr{b'(m_{\hat\theta}(\bX)) &- b'(m^0(\bX)),m_{\hat \theta}(\bX) - m_\theta(\bX)} \\
&\leq \frac 1n \inr{\by - b'(m^0(\bX)),m_{\hat \theta}(\bX) - m_\theta(\bX)} - \inr{h,\hat \theta - \theta}.
\end{split}{}
\end{equation}
Now, consider the function $H_n:{\mathbb{R}} \rightarrow {\mathbb{R}}$ defined by
\begin{equation*}
H_n(t) = \frac 1n \sum_{i=1}^n b(m_{\hat \theta + t\eta}(x_i)) - \frac{1}{n}
\sum_{i=1}^nb'(m^0(x_i))m_{\hat \theta + t\eta}(x_i),
\end{equation*}
where $\eta$ will be defined later.
We use again the same arguments as in the proof of Lemma~\ref{lemma-connection-L2-KL}.
We differentiate $H_n$ three times with respect $t$, so that
\begin{equation*}
\begin{split}
&H'_n(t)= \frac{1}{n} \sum_{i=1}^n m_{\eta}(x_i) b'(m_{\hat \theta + t\eta}(x_i))-\frac{1}{n} \sum_{i=1}^n b'(m^0(x_i))m_{\eta}(x_i),\\
&H''_n(t) = \frac{1}{n} \sum_{i=1}^n m^2_{\eta}(x_i) b''(m_{\hat \theta + t\eta}(x_i)),\\
\text{and} \quad &H'''_n(t) = \frac{1}{n} \sum_{i=1}^n m^3_{\eta}(x_i) b'''(m_{\hat \theta + t\eta}(x_i)),
\end{split}
\end{equation*}
and in the way as in the proof of Lemma~\ref{lemma-connection-L2-KL}, we have $|H'''_n(t)| \leq C_b (C_n + \rho)
|H''_n(t)|$, and Lemma~\ref{lemma:self-concordance} entails
\begin{equation*}
H''_n(0)\frac{ \psi(-C_b t (C_n + \rho))}{C_b^2 (C_n + \rho)^2}\leq H_n(t) - H_n(0) - tH'_n(0) \leq H''_n(0)
\frac{ \psi(C_b t (C_n + \rho))}{C_b^2 (C_n + \rho)^2},
\end{equation*}
for all $t \geq 0$. Taking $t=1$ and $\eta = \theta - \hat \theta$ implies
\begin{align*}
&H_n(1)= \frac 1n \sum_{i=1}^n b(m_{\theta}(x_i)) - \frac{1}{n} \sum_{i=1}^nb'(m^0(x_i))m_{\theta}(x_i) = R(m_{\theta}),\\
\text{and} \quad & H_n(0) = \frac 1n \sum_{i=1}^n b(m_{\hat \theta}(x_i)) - \frac{1}{n} \sum_{i=1}^nb'(m^0(x_i))m_{\hat\theta}(x_i) = R(m_{\hat \theta}).
\end{align*}
Moreover, we have
\begin{align*}
H'_n(0) &= \frac{1}{n} \sum_{i=1}^n \inr{x_i^B, \theta - \hat \theta} b'(m_{\hat \theta}(x_i))-\frac{1}{n} \sum_{i=1}^n b'(m^0(x_i))\inr{x_i^B, \hat \theta - \theta}\\
&= \frac 1n\inr{b'(m_{\hat \theta}(\bX)) - b'(m^0(\bX)),\XB(\theta - \hat \theta)},\\
\text{and} \quad H''_n(0) &= \frac{1}{n} \sum_{i=1}^n \inr{x_i^B, \hat \theta - \theta}^2 b''(m_{\hat \theta }(x_i)).
\end{align*}
Then, we deduce that
\begin{equation*}
\begin{split}
H''_n(0)\frac{ \psi(-C_b (C_n + \rho))}{C_b^2 (C_n + \rho)^2}
& \leq R(m_\theta) - R(m_{\hat \theta}) - \frac 1n\inr{b'(m_{\hat \theta}(\bX)) - b'(m^0(\bX)),\XB(\theta - \hat \theta)} \\
&=\phi \mathrm{KL}_n(m^0(\bX), m_{\theta}(\bX)) - \phi \mathrm{KL}_n(m^0(\bX), m_{\hat \theta}(\bX))\\
&\qquad + \frac 1n\inr{b'(m_{\hat \theta}(\bX)) - b'(m^0(\bX)),m_{\hat \theta}(\bX) - m_\theta(\bX)}.
\end{split}
\end{equation*}
Then, with Equation~\eqref{ineq:subdiff-monocity-logistic}, one has
\begin{equation}
\label{least-squares-in-proof}
\begin{split}
& \phi \mathrm{KL}_n(m^0(\bX), m_{\hat \theta}(\bX))+ H''_n(0)\frac{ \psi(-C_b (C_n + \rho))}{C_b^2 (C_n + \rho)^2}\\
&\qquad \leq \phi \mathrm{KL}_n(m^0(\bX), m_{\theta}(\bX))+ \frac 1n \inr{\by - b'(m^0(\bX)),m_{\hat \theta}(\bX) - m_\theta(\bX)} - \inr{h, \hat \theta - \theta}.
\end{split}
\end{equation}
As $H''_n(0) \geq 0$, it implies that
\begin{align}
\label{ineq:begining-oracle}
\phi \mathrm{KL}_n(m^0(\bX), m_{\hat \theta}(\bX)) &\leq \phi \mathrm{KL}_n(m^0(\bX), m_{\theta}(\bX))\nonumber\\
& \qquad+ \frac{1}{n}\inr{\by - b'(m^0(\bX)), m_{\hat \theta}(\bX) - m_\theta(\bX) } - \inr{h,\hat \theta - \theta}.
\end{align}
If $\frac{1}{n}\inr{\by - b'(m^0(\bX)), \XB(\hat\theta - \theta)} - \inr{h, \hat \theta - \theta} < 0,$ it follows that
\begin{equation*}
\mathrm{KL}_n(m^0(\bX), m_{\hat \theta}(\bX))\leq \mathrm{KL}_n(m^0(\bX), m_{\theta}(\bX)),
\end{equation*}
then Theorem~\ref{thm:oracle} holds. From now on, let us assume that
\begin{equation}
\label{inequality-majoration-of-noise-2}
\frac{1}{n}\inr{\by - b'(m^0(\bX)), m_{\hat \theta}(\bX) - m_\theta(\bX)} - \inr{h, \hat \theta - \theta} \geq 0.
\end{equation}
We first derive a bound on $\frac {1}{n} \inr{\by - b'(m^0(\bX)), m_{\hat \theta}(\bX) - m_\theta(\bX)}.$
Recall that ${\bf{D}} ^{-1} = {\bf{T}}$ (see beginning of Section~\ref{sub:compatibility_conditions}).
We focus on finding out a bound for $\frac {1}{n} \inr{ (\XB{\bf{T}})^\top(\by - b'(m^0(\bX))), {\bf{D}}(\hat \theta - \theta)}.$
On the one hand, one has
\begin{align*}
\frac{1}{n} \inr{(\XB)^\top (\by &- b'(m^0(\bX))), \hat \theta - \theta} \\
&= \frac{1}{n} \inr{(\XB {\bf{T}})^\top (\by - b'(m^0(\bX))), {\bf{D}}(\hat \theta - \theta)} \\
&\leq \small{\frac{1}{n} \sum_{j=1}^p \sum_{k=1}^{d_j}
|((\XB_{\bullet,j} {T}_{j})_{\bullet, k})^\top (\by - b'(m^0(\bX))) | \; |(D_{j}({\hat \theta}_{j,\bullet} - \theta_{j,\bullet}))_k |}
\end{align*}
where $(\XB_{\bullet,j} {T}_{j})_{\bullet,k} = [ (\XB_{\bullet,j} {T}_{j})_{1,k} \cdots (\XB_{\bullet,j} {T}_{j})_{n,k}]^\top \in {\mathbb{R}}^n$ is the $k$-th column of the matrix $\XB_{\bullet,j} {T}_{j}.$
Let us consider the event
\begin{equation*}
\mathcal{E}_n = \bigcap_{j=1}^p \bigcap_{k =2}^{d_j}\mathcal{E}_{n,j,k}, \textrm{ where }
\mathcal{E}_{n,j,k} = \Big\{ \frac {1}{n} | (\XB_{\bullet,j}T_j)_{\bullet,k}^\top (\by - b'(m^0(\bX))) |
\leq \hat w_{j,k} \Big\},
\end{equation*}
so that, on $\mathcal{E}_n$, we have
\begin{align}
\label{ineq1-proof-thm2}
\frac{1}{n} \inr{(\XB)^\top (\by - b'(m^0(\bX)), \hat \theta - \theta}
&\leq \sum_{j=1}^p \sum_{k=1}^{d_j} \hat w_{j,k} |(D_{j}({\hat \theta}_{j,\bullet} - \theta_{j,\bullet}))_k| \nonumber \\
& \leq \sum_{j=1}^p \norm{ \hat w_{j,\bullet} \odot D_{j}({\hat \theta}_{j,\bullet} - \theta_{j,\bullet})}_1.
\end{align}
On the other hand, from the definition of the subgradient $[h_{j, \bullet}]_{j=1, \ldots, p} \in \partial \norm{\theta}_{\TV, \hat w}$ (see Equation~\eqref{subdifferential-of-TVw}), one can choose $h$ such that
\begin{equation*}
h_{j, k} = (D_{j}^\top (\hat w_{j,\bullet}\odot\sgn(D_{{j}}{\theta}_{j,\bullet})))_k
\end{equation*}
for all $k \in J_j(\theta)$ and
\begin{equation*}
h_{j, k} = (D_{j}^\top (\hat w_{j,\bullet}\odot\sgn ( D_{j}\hat \theta_{j, \bullet} ) )_k = (D_{j}^\top (\hat w_{j,\bullet}\odot\sgn ( D_{j}(\hat \theta_{j, \bullet} - \theta_{j,\bullet}) ) )_k
\end{equation*}
for all $k \in J_j^\complement(\theta)$.
Using a triangle inequality and the fact that $\sgn(x)^\top x= \norm{x}_1$, we obtain
\begin{align}
\label{ineq2-proof-thm1}
-\inr{h, \hat \theta - \theta}
&\leq \sum_{j=1}^p \norm{ (\hat w_{j,\bullet})_{J_j(\theta)} \odot D_{{j}}(\hat \theta_{j, \bullet} -\theta_{j, \bullet})_{J_j(\theta)}}_1 \nonumber\\
& \quad - \sum_{j=1}^p \norm{ (\hat w_{j,\bullet})_{J^\complement_j(\theta)} \odot D_{{j}}(\hat \theta_{j, \bullet} -\theta_{j, \bullet})_{J^\complement_j(\theta)}}_1 \nonumber\\
&\leq \sum_{j=1}^p \norm{(\hat \theta_{j, \bullet} -\theta_{j, \bullet})_{J_j(\theta)}}_{\TV, \hat w_{j,\bullet}} - \sum_{j=1}^p \norm{ (\hat \theta_{j, \bullet} -\theta_{j, \bullet})_{J^\complement_j(\theta)}}_{\TV, \hat w_{j,\bullet}}.
\end{align}
Combining inequalities~\eqref{ineq1-proof-thm2} and~\eqref{ineq2-proof-thm1}, we get
\begin{equation*}
\sum_{j=1}^p \norm{ (\hat \theta_{j, \bullet} -\theta_{j, \bullet})_{J^\complement_j(\theta)}}_{ \TV, \hat w_{j,\bullet}} \leq 2\sum_{j=1}^p \norm{(\hat \theta_{j, \bullet} -\theta_{j, \bullet})_{ J_j(\theta)}}_{ \TV, \hat w_{j,\bullet}}
\end{equation*}
on $\mathcal{E}_n$.
Hence
\begin{equation*}
\sum_{j=1}^p \norm{(\hat w_{j,\bullet})_{J^\complement_j(\theta)} \odot D_{{j}}(\hat \theta_{j, \bullet} -\theta_{j, \bullet})_{J^\complement_j(\theta)}}_1 \leq 2\sum_{j=1}^p \norm{(\hat w_{j,\bullet})_{ J_j(\theta)} \odot D_{{j}}(\hat \theta_{j, \bullet} -\theta_{j, \bullet})_{J_j(\theta)}}_1.
\end{equation*}
This means that
\begin{equation}
\label{Delta-hat-theta-in-Cone-square}
\hat \theta - \theta \in \mathscr{C}_{\TV, \hat w}(J(\theta)) \textrm{ and } {\bf{D}}(\hat \theta - \theta) \in \mathscr{C}_{1,\hat w}(J(\theta)),
\end{equation}
see~\eqref{C-AGG} and~\eqref{C-1}.
Now, going back to~\eqref{ineq:begining-oracle} and taking into account~\eqref{Delta-hat-theta-in-Cone-square}, the compatibility of $\XB {\bf{T}}$ given in Equation~\eqref{ineq:compatibility-XT} provides the following on the event $\mathcal{E}_n$:
\begin{equation*}
\begin{split}
\phi \mathrm{KL}_n(m^0(\bX), m_{\hat \theta}(\bX))
&\leq \phi \mathrm{KL}_n(m^0(\bX), m_\theta(\bX)) \\
&\quad + 2\sum_{j=1}^p \norm{ (\hat w_{j,\bullet})_{J_j(\theta)} \odot D_{j}(\hat \theta_{j, \bullet} -\theta_{j, \bullet})_{J_j(\theta)}}_1.
\end{split}
\end{equation*}
Then
\begin{equation}
\label{for-case-least-squares}
\begin{split}
\mathrm{KL}_n(m^0(\bX), m_{\hat \theta}(\bX))&\leq \mathrm{KL}_n(m^0(\bX), m_\theta(\bX)) + \frac{\norm{m_{\hat \theta}(\bX) - m_\theta(\bX) }_2}{ \sqrt{n}\, \phi\, \kappa_{\bf{T},\hat \gamma}(J(\theta)) \kappa(J(\theta))},
\end{split}
\end{equation}
where $\hat \gamma = (\hat \gamma_{1,\bullet}^\top, \ldots, \hat \gamma_{p,\bullet}^\top)^\top$ is such that
\begin{equation*}
\hat \gamma_{j,k} =
\left\{
\begin{array}{ll}
2\hat {w}_{j,k} & \mbox{if } k \in J_j(\theta),\\
0 & \mbox{if } k \in J_j^\complement(\theta),
\end{array}
\right.
\end{equation*}
for all $j=1, \ldots, p$ and
\begin{equation*}
\kappa_{{\bf{T}}, \hat \gamma}( J(\theta)) =\bigg\{ 32 \sum_{j=1}^p\sum_{k=1}^{d_j} |\hat \gamma_{j,k+1} - \hat \gamma_{j,k}|^2 + 2|J_j(\theta)| \norm{\hat \gamma_{j,\bullet}}_\infty^2\Delta_{\min, J_j(\theta)}^{-1}\bigg\}^{-1/2}.
\end{equation*}
Now, we find an upper bound for
\begin{equation*}
\frac{1}{ \kappa^2_{{\bf{T}},\hat\gamma}(J(\theta))}
= 32\sum_{j=1}^p\sum_{k=1}^{d_j} |\hat \gamma_{j,k+1} - \hat \gamma_{j,k}|^2 + 2|J_j(\theta)| \norm{\hat \gamma_{j,\bullet}}_\infty^2\Delta_{\min, J_j(\theta)}^{-1}.
\end{equation*}
Note that $\norm{\hat \gamma_{j,\bullet}}_\infty \leq 2\norm{\hat w_{j,\bullet}}_\infty$.
Let us write $J_j(\theta) =\big\{k_j^1, \ldots, k_j^{|J_j(\theta)|}\big\}$ and set $B_r =[\![k_j^{r-1}, k_j^{r}[\![ \; = \{k_j^{r-1}, k_j^{r-1} + 1, \ldots, k_j^{r} -1\}$ for $r = 1, \ldots, |J_j(\theta)|+1$ with the convention that $k_j^0=0$ and $k_j^{|J_j(\theta)|+1} = d_j+1$. Then
\begin{equation*}
\begin{split}
\sum_{k=1}^{d_j} |\hat \gamma_{j,k+1} -\hat \gamma_{j,k}|^2 &= \sum_{r=1}^{|J_j(\theta)|+1} \sum_{k \in B_r} |\hat\gamma_{j,k+1} -\hat\gamma_{j,k}|^2\\
& =\sum_{r=1}^{|J_j(\theta)|+1} |\hat \gamma_{j,k_j^{r -1}+1} - \hat\gamma_{j,k_j^{r -1}}|^2 + |\hat \gamma_{j,k_j^{r}} - \hat \gamma_{j,k_j^{r }-1}|^2 \\
& =\sum_{r=1}^{|J_j(\theta)|+1} \hat \gamma_{j,k_j^{r -1}}^2 + \hat \gamma_{j,k_j^{r}}^2 \\
& = \sum_{r=1}^{|J_j(\theta)|} 2\ \hat \gamma_{j,k_j^{r}}^2\\
& \leq 8\ |J_j(\theta)|\ \norm{(\hat w_{j,\bullet})_{J_j(\theta)}}_\infty^2.
\end{split}
\end{equation*}
Therefore
\begin{equation}
\label{eq:upper_bound_kappa_2_T}
\begin{split}
\frac{1}{\kappa^2_{{\bf{T}},\hat \gamma}(J(\theta))}
&\leq 512 \sum_{j=1}^p \Big( |J_j(\theta)|\ \norm{(\hat w_{j,\bullet})_{J_j(\theta)}}_\infty^2 + |J_j(\theta)|\ \norm{(\hat w_{j,\bullet})_{J_j(\theta)}}_\infty^2\Delta_{\min, J_j(\theta)}^{-1} \Big) \\
& \leq 512 \sum_{j=1}^p \Big( 1 + \frac{1}{\Delta_{\min, J_j(\theta)}} \Big) |J_j(\theta)| \norm{(\hat w_{j,\bullet})_{J_j(\theta)}}_\infty^2\\
& \leq 512 |J(\theta)| \max_{j=1, \ldots, p}\norm{(\hat w_{j,\bullet})_{J_j(\theta)}}_\infty^2.
\end{split}
\end{equation}
Now, we use the connection between the empirical norm and Kullback-Leibler divergence.
Indeed, using Lemma~\ref{lemma-connection-L2-KL}, we get
\begin{align*}
&\frac{\norm{ m_{\hat \theta}(\bX) - m_\theta(\bX) }_2}{ \sqrt{n}\phi \kappa_{{\bf{T}},\hat\gamma}( J(\theta)) \kappa(J(\theta))} \\
&\quad \quad \leq
\frac{1}{\sqrt{\phi} \kappa_{{\bf{T}},\hat\gamma}(J(\theta)) \kappa(J(\theta))}\Big(\frac{1}{\sqrt{n}}
\norm{ m_{\hat \theta}(\bX)- m^0(\bX)}_2 + \frac{1}{\sqrt{n}}\norm{ m^0(\bX) - m_{\theta}(\bX)}_2\Big) \\
&\quad \quad \leq \frac{2}{\sqrt{\phi}\kappa_{{\bf{T}},\hat\gamma}(J(\theta))
\kappa(J(\theta)) \sqrt{C_n(\rho, L_n)} } \Big(\mathrm{KL}_n(m^0(\bX), m_{\hat \theta}(\bX))^{1/2} \\
&\qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad
+ \mathrm{KL}_n(m^0(\bX), m_{\theta}(\bX))^{1/2} \Big),
\end{align*}
where we defined $C_n(\rho, L_n) = \frac{L_n \psi(-C_b (C_n + \rho))}{C_b^2 \phi (C_n + \rho)^2}$, so that combined with
Equation~\eqref{for-case-least-squares}, we obtain
\begin{align*}
\mathrm{KL}_n(m^0(\bX), m_{\hat \theta}(\bX)) &\leq \mathrm{KL}_n(m^0(\bX), m_\theta(\bX)) \\
& \quad + \frac{2}{\sqrt{\phi}\kappa_{{\bf{T}},\hat\gamma}(J(\theta)) \kappa(J(\theta)) \sqrt{C_n(\rho, L_n)}}
\big(\mathrm{KL}_n(m^0(\bX), m_{\hat \theta}(\bX))^{1/2} \\
& \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \quad
+ \mathrm{KL}_n(m^0(\bX), m_{\theta}(\bX))^{1/2} \big).
\end{align*}
This inequality entails the following upper bound
\begin{equation*}
\mathrm{KL}_n(m^0(\bX), m_{\hat \theta}(\bX)) \leq 3 \mathrm{KL}_n(m^0(\bX), m_\theta(\bX))
+ \frac{5}{\phi \kappa^2_{{\bf{T}},\hat\gamma}(J(\theta)) \kappa^2(J(\theta)) C_n(\rho, L_n)},
\end{equation*}
since whenever we have $x \leq c + b \sqrt x$ for some $x, b, c > 0$, then $x \leq 2c + b^2$.
Introducing $g(x) = x^2 / \psi(-x) = x^2 / (e^{-x} + 1 - x)$, we note that
\begin{equation*}
\frac{1}{C_n(\rho, L_n)} = \frac{\phi}{L_n} g(C_b (C_n + \rho)) \leq \frac{\phi}{L_n}
(C_b(C_n + \rho) + 2),
\end{equation*}
since $g(x) \leq x + 2$ for any $x > 0$.
Finally, by using also~\eqref{eq:upper_bound_kappa_2_T}, we end up with
\begin{equation*}
\mathrm{KL}_n(m^0(\bX), m_{\hat \theta}(\bX)) \leq 3 \mathrm{KL}_n(m^0(\bX), m_\theta(\bX))
+ \frac{2560 (C_b(C_n + \rho) + 2)}{L_n \kappa^2(J(\theta))} \; |J(\theta)| \;
\norm{(\hat w_{j,\bullet})_{J_j(\theta)}}_\infty^2,
\end{equation*}
which is the statement provided in Theorem~\ref{thm:oracle}.
The only thing remaining is to control the probability of the event $\mathcal{E}_n^\complement$.
This is given by the following:
\begin{equation*}
\begin{split}
\P[\mathcal{E}_n^\complement] &\leq \sum_{j=1}^p \sum_{k=2}^{d_j}
\P \Big[\frac{1}{n} | (\XB_{\bullet,j} T_{j})_{\bullet,k}^\top (\by - b'(m^0(\bX)))| \geq \hat w_{j,k} \Big] \\
&\leq \sum_{j=1}^p \sum_{k=2}^{d_j} \P \Big[\sum_{i=1}^n |(\XB_{\bullet,j} T_{j})_{i,k}(y_i - b'(m^0(x_i))) | \geq { n\hat w_{j,k}} \Big].
\end{split}
\end{equation*}
Let $\xi_{i,j,k} = (\XB_{\bullet,j} {T}_{j})_{i,k}$ and $Z_{i}= y_i - b'(m^0(x_i)).$
Note that conditionally on $x_i$, the random variables $(Z_{i})$
are independent.
It can be easily shown (see Theorem 5.10 in~\cite{lehmann1998}) that the moment generating function of $Z$ (copy of $Z_i$) is given by
\begin{equation}
\label{moment-gener-func}
\E[\exp(tZ)] = \exp(\phi^{-1}\{b(m^0(x) + t) - tb'(m^0(x) - b(m^0(x)))\}).
\end{equation}
Applying Lemma 6.1 in~\cite{rigollet2012}, using~\eqref{moment-gener-func} and Assumption~\ref{ass:glm}, we can derive the following Chernoff-type bounds
\begin{equation}
\label{cal-proba-Ecomp}
\P\Big[ \sum_{i=1}^n |\xi_{i,j,k}Z_{i}| \geq n\hat w_{j,k}\Big]
\leq 2\exp\Big(- \frac{n^2\hat w^2_{j,k} }{2U_n\phi\norm{\xi_{\bullet,j,k}}_2^2}\Big),
\end{equation}
where $\xi_{\bullet,j,k} = [\xi_{1,j,k} \cdots \xi_{n,j,k} ]^\top \in {\mathbb{R}}^n.$
We have
\begin{equation*}
\bX^B_{\bullet,j} {T}_{j} =
\begin{bmatrix}
1 & \sum_{k=2}^{d_j} x_{1,j,k}^B & \sum_{k=3}^{d_j} x_{1,j,k}^B & \cdots&
\sum_{k=d_{j-1}}^{d_j} x_{1,j,k}^B & x_{1,j,d_j}^B \\
\vdots & \vdots & \vdots& & \vdots &\vdots \\
1 &\sum_{k=2}^{d_j} x_{n,j,k}^B & \sum_{k=3}^{d_j} x_{n,j,k}^B & \cdots&
\sum_{k=d_{j-1}}^{d_j} x_{n,j,k}^B & x_{n,j,d_j}^B
\end{bmatrix},
\end{equation*}
therefore
\begin{equation}
\label{eq:empirical-norm-XT}
\norm{\xi_{\bullet,j,k}}_2^2 = \sum_{i=1}^n(\bX^B_{\bullet,j} {T}_{j})^2_{\bullet, k} = \# \Big(\Big\{ i : x_{i,j} \in \bigcup_{r=k}^{d_j} I_{j,r} \Big\} \Big) = n\hat \pi_{j,k}.
\end{equation}
So, using the weights $\hat w_{j,k}$ given by~\eqref{choice-of-weights-sq-slow-GLM} together with~\eqref{cal-proba-Ecomp} and~\eqref{eq:empirical-norm-XT}, we obtain that the probability of $\mathcal{E}_{n}^\complement$ is smaller than $2e^{-A}.$
This concludes the proof of the first part of Theorem~\ref{thm:oracle}.
$\hfill \square$
\subsection{Proof of Theorem~\ref{thm:additive}}
\label{sub:proof_of_theorem_thm:additive}
First, let us note that in the least squares setting, we have $R(m_{\theta}) - R(m^0) = \norm{m_{\theta} - m^0}_n^2$ for any $\theta \in {\mathbb{R}}^d$ where $\norm{g}_n^2 =
\frac 1n \sum_{i=1}^n g(x_i)^2$, and that $b(y) = \frac 12 y^2$, $\phi = \sigma^2$ (noise variance) in Equation~\eqref{distribut-glm}, and $L_n = U_n = 1$, $C_b = 0$.
Theorem~\ref{thm:oracle} provides
\begin{equation*}
\norm{m_{\hat \theta} - m^0}_n^2 \leq 3 \norm{m_{\theta} - m_{\theta^0}}_n^2
+ \frac{5120 \sigma^2}{\kappa^2(J(\theta))} \frac{|J(\theta)|(A + \log d)}{n}
\end{equation*}
for any $\theta \in {\mathbb{R}}^d$ such that $n_j^\top \theta_{j \bul} = 0$ and $J(\theta) \leq J_*$.
Since $d_j = D$ for all $j=1, \ldots, p$, we have $d = D p$ and
\begin{equation}
\label{eq:sparsity-comparison}
| J(\theta) | = \sum_{j=1}^p | \{ k = 2, \ldots, D : \theta_{j, k} \neq \theta_{j, k-1 } \} | \leq (D - 1) |\mathcal{J}(\theta)| \norm{\theta}_\infty \leq D p \norm{\theta}_\infty
\end{equation}
for any $\theta \in {\mathbb{R}}^d$, where we recall that $\mathcal{J}(\theta) = \{ j=1, \ldots, p : \theta_{j, \bul} \neq \boldsymbol 0_{D} \}$.
Also, recall that $I_{j, 1} = I_1 = [0, \frac{1}{D}]$ and $I_{j, k} = I_k = (\frac{k-1}{D}, \frac{k}{D}]$ for $k=2, \ldots, D$
and $j = 1, \ldots, p$.
Also, we consider $\theta = \theta^*$, where $\theta_{j, \bul}^*$ is defined, for any $j \in \mathcal{J}_*$, as the minimizer of
\begin{equation*}
\sum_{i=1}^n \Big( \sum_{k=1}^{D} (\theta_{j, k} - m_j^0(x_{i, j}) )
\ind{I_{k}}(x_{i, j}) \Big)^2
\end{equation*}
over the set of vectors $\theta_{j, \bul} \in {\mathbb{R}}^{D}$ satisfying $n_j^\top \theta_{j, \bul} = 0$, and we put
$\theta_{j, \bul}^* = \boldsymbol 0_D$ for $j \notin \mathcal{J}_*$.
It is easy to see that the solution is given by
\begin{equation*}
\theta_{j, k}^* = \frac{\sum_{i=1}^n m_j^0(x_{i, j}) \ind{I_{k}}(x_{i, j})}{n_{j, k}},
\end{equation*}
where we recall that $n_{j, k} = \sum_{i=1}^n \ind{I_{k}}(x_{i, j})$.
Note in particular that the identifiability assumption $\sum_{i=1}^n m_j^0(x_{i, j}) = 0$ entails that $n_j^\top \theta_{j, \bul}^* = 0$.
In order to control the bias term, an easy computation gives that, whenever $x_{i, j} \in I_{k}$
\begin{equation*}
|\theta_{j, k}^* - m_j^0(x_{i, j})| \leq
\frac{\sum_{i'=1}^n | m_j^0(x_{i', j}) - m_j^0(x_{i, j}) |
\ind{I_{k}}(x_{i', j})}{n_{j, k}} \leq L |I_{k}| = \frac{L}{D},
\end{equation*}
where we used the fact that $m_j^0$ is $L$-Lipschitz, so that
\begin{align*}
\norm{m_{\theta^*} - m^0}_n^2 &= \frac 1n \sum_{i=1}^n
(m_{\theta^*}(x_{i, j}) - m^0(x_{i, j}))^2 \\
&= \frac 1n \sum_{i=1}^n \Big( \sum_{j \in \mathcal{J}_*}
\sum_{k=1}^{D} (\theta_{j, k}^* - m^0(x_{i, j})) \ind{I_{k}} \Big)^2 \\
&\leq \frac{|\mathcal{J}_*|}{n} \sum_{i=1}^n \Big( \sum_{j \in \mathcal{J}_*}
\sum_{k=1}^{D} (\theta_{j, k}^* - m^0(x_{i, j})) \ind{I_{k}} \Big)^2 \\
&\leq \frac{|\mathcal{J}_*|}{n} \sum_{i=1}^n \sum_{j \in \mathcal{J}_*}
\sum_{k=1}^{D} (\theta_{j, k}^* - m^0(x_{i, j}))^2 \ind{I_{k}}(x_{i, j}) \\
&\leq |\mathcal{J}_*| \sum_{j \in \mathcal{J}_*}
\sum_{k=1}^{D} L^2 |I_{k}|^2 \ind{I_{k}}(x_{i, j})
\leq \frac{L^2 |\mathcal{J}_*|^2}{D^2}.
\end{align*}
Note that $|\theta_{j, k}^*| \leq \norm{m_j^0}_{n, \infty}$ where $\norm{m_j^0}_{n, \infty} = \max_{i=1, \ldots, n} |m_j^0(x_{i, j})|$. This entails that
$\norm{\theta^*}_\infty \leq \max_{j=1, \ldots, p} \norm{m_j^0}_{n, \infty} = M_n$.
So, using also~\eqref{eq:sparsity-comparison}, we end up with
\begin{align*}
\norm{m_{\hat \theta} - m^0}_n^2 &\leq \frac{3 L^2 |\mathcal{J}_*|^2}{D^2}
+ \frac{5120 \sigma^2}{\kappa^2(J(\theta^*))} \frac{D \mathcal{J}_* M_n (A
+ \log (D p M_n))}{n},
\end{align*}
which concludes the proof Theorem~\ref{thm:additive} using $D = n^{1/3}$. $\hfill \square$
| {'timestamp': '2019-01-10T02:14:45', 'yymm': '1703', 'arxiv_id': '1703.08619', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08619'} | arxiv |
\section{Introduction}
In the last decade,
large parallel networks became widely available
for industrial and academic users. An important prerequisite
for their efficient usage is to balance their work efficiently.
Load balancing is known to have applications
to
scheduling~\cite{Surana06},
routing~\cite{Cyb89},
numerical computation such as solving partial differential equations~\cite{Zhanga09,Williams91,SubramanianScherson94},
and finite element computations~\cite{FEM}.
In the standard abstract formulation of load balancing, processors are represented
by nodes of a graph, while links are represented by edges.
The objective is to balance the load by allowing nodes to exchange loads with their neighbors via the incident edges. In this work we will study a decentralized and iterative load balancing protocol where a processor knows only its current load and that of the neighboring processors and based on this, decides how much load should be sent (or received).
{\bf Load Balancing Models.}
A widely used approach is diffusion, e.g., the first-order-diffusion scheme \cite{Cyb89,MGS98}, where the amount of load sent along each edge in each round is proportional to the load difference between the incident nodes. In this work, we consider the alternative, the so-called matching model, where in each round only the edges of the matching are used to average the load locally. In comparison to diffusion, the matching model reduces the communication in the network and moreover tends to behave in a more ``monotone'' fashion than diffusion, since it avoids concurrent load exchanges which may increase the maximum load or decrease the minimum load in certain cases.
We measure the smoothness of the load distribution by the so-called {\em discrepancy} which is the difference between the maximum and minimum load among all nodes. In view of more complex scenarios where jobs are eventually removed or new jobs are generated, the discrepancy seems to be a more appropriate measure than the {\em makespan}, which only considers the maximum load.
Many studies in load balancing assume that load is arbitrarily divisible. In this so-called {\em continuous case}, load balancing corresponds to a Markov chain on the graph and one can resort to a wide range of established techniques to analyze the convergence speed \cite{Boillat90,GLM99,MGS98}. In particular, the {\em spectral gap} captures the time to reach a small discrepancy fairly accurately, e.g., see \cite{SJ89,RSW98} for the diffusion and see \cite{BGPS06,MG96} for the matching model.
However, in many applications a processor's load may consist of tasks which are not further divisible, which is why the continuous case has been also referred to as ``idealized case''~\cite{RSW98}. A natural way to model indivisible tasks is the {\em unit-size token model} where one assumes a smallest load entity, the unit-size token, and load is always represented by a multiple of this smallest entity. In the following, we will refer to the unit-size token model as the {\em discrete case}.
Initiated by the work of \cite{RSW98}, there has been a number of studies on load balancing in the discrete case. Unlike \cite{RSW98}, \cite{SS12} analyzed a randomized rounding based strategy, meaning that an excess token will be distributed uniformly at random among the two communicating nodes. The authors of \cite{SS12} proved that with this strategy the time to reach constant discrepancy in the discrete case is essentially the same as the corresponding time in the continuous case. Their results hold both for the {\em random matching model}, where in each round a new random matching is generated by a simple distributed protocol, and the {\em balancing circuit model} (a.k.a. dimension exchange), where a fixed sequence of matching is applied periodically. In this work, we will focus on the {\em balancing circuit model}, which is particularly well suited for highly structured graphs such as cycles, tori or hypercubes.
\textbf{Worst-Case vs. Average-Case Inputs.}
Previous work has almost always adopted the usual worst-case framework for deriving bounds on the load discrepancy \cite{RSW98}. That means that any upper bound on the discrepancy holds for an arbitrary input, i.e., an arbitrary initial load vector. While it is of course very natural and desirable to have such general bounds, the downside is that for graphs with poor expansion like cycles or 2D-tori, the convergence is rather slow, i.e., quadratic or linear in the number of nodes $n$.
This serves as a motivation to explore an average-case input. Specifically, we assume that the number of load items at each node is sampled independently from a fixed distribution. Our main results demonstrate that the convergence of the load vector is considerably quicker (measured by the load discrepancy), especially on networks with slow convergence in the worst-case such as cycles and 2D-tori.
We point out that many related problems including scheduling on parallel machines or load balancing in a dynamic setting (meaning that jobs are continuously added and processed) have been studied under random inputs, e.g.,~\cite{AKU05,GI99,ACS16}. To the best of our knowledge, only very few works have studied this question in iterative load balancing. One exception is \cite{S99}, which investigated the performance of continuous load balancing on tori in the diffusion model. In contrast to this work, however, only upper bounds are given and they hold for the multiplicative ratio between maximum and minimum load, rather than the discrepancy.
Our main results in this paper hold for all distributions satisfying the following definition, which is satisfied by the uniform, binomial, Poisson and geometric distribution (see Section~\ref{sec:def}).
\newpage
\begin{defi}\label{def:expcon}
We say that a distribution $D$ over $\mathbb{N} \cup \{0\}$ is exponentially concentrated if there is a constant $ \kappa >0$ so that for any $X \sim D$, $\delta > 0$,
\begin{align*}
\Pro{ | X - \mu | \geq \delta \cdot \sigma} \leq \exp\left( -\kappa \delta \right),
\end{align*}
where $\mu$ and $\sigma^2$ are the expectation and variance of $D$. In the following, we refer to \textbf{average-case} when the initial number of load items on each vertex is drawn independently from a fixed exponentially concentrated distribution.
\end{defi}
\textbf{Our Results.}
Our first contribution is a general formula that allows us to express the load difference between an arbitrary pair of nodes in round $t$.
Here the round matrix $\mathbf{M}$ is the product of the matching matrices that are applied periodically (cf.~Section \ref{sec:def}).
\begin{restatable}{thm}{mainone}\label{thm:main1}
Consider the balancing circuit model with an arbitrary round matrix $\mathbf{M}$ in the average case. Then for any pair of nodes $u,v$ and round $t$, it holds for any $\delta > 0$ that
\begin{equation*}
\Pro{\left| x_u^{(t)} - x_{v}^{(t)} \right| \geq \delta \cdot \sqrt{128} \kappa \cdot \sigma \cdot \log n \cdot
\left\| \mathbf{M}^t_{.,u} - \mathbf{M}^t_{.,v} \right\|_2 + \sqrt{48 \log n}} \leq 2 \cdot e^{-\delta^2} + 2 n^{-2}.
\end{equation*}
Further, for any pair of vertices $u,v$ and any round $t$ satisfying $t=\omega(1)$,
\label{thm:lowerboundforcycles}
\begin{equation*}
\Pro{\left| x_u^{(t)} - x_{v}^{(t)} \right| \geq \sigma/(2 \sqrt{2\log_2 \sigma}) \cdot \left\| \mathbf{M}^t_{.,u} - \mathbf{M}^t_{.,v} \right\|_2 - \sqrt{48 \log n} } \geq \frac{1}{16}.
\end{equation*}
\end{restatable}
The proof of the upper bound Theorem~\ref{thm:main1} is the easier direction, and it relies on a previous result relating continuous and discrete load balancing from \cite{SS12}. The lower bound is technically more challenging and applies a generalized version of the central limit theorem.
Together, the upper and lower bound in the above result establish that the load deviation between any two nodes $u$ and $v$ is essentially captured by $ \left\| \mathbf{M}^t_{.,u} - \mathbf{M}^t_{.,v} \right\|_2$. However, in some instances it might be desirable to have a more tangible estimate at the expense of generality. A first step towards this goal is to observe that $ \left\| \mathbf{M}^t_{.,u} - \mathbf{M}^t_{.,v} \right\|_2^2
\leq 4 \cdot \max_{k \in V} \| \mathbf{M}^t_{.,k} - \mathbf{\frac{1}{n}} \|_2^2$ (see~Lemma~\ref{lem:twonodestoavg}). Hence we are left with the problem of understanding the $t$-step probablity vector $\mathbf{M}^t_{.,k}$.
For reversible Markov chains, the last expression has been analyzed in several works, e.g., a result from~\cite[Lemma~3.6]{Lyons05} implies that for random walks on graphs, $\P_{u,v}^t=O(\deg(v)/\sqrt{t})$ (cf.~\cite{Lyons05}). However, the Markov chain associated to $\mathbf{M}$ is not reversible in general. For irreversible Markov chains, \cite{levin2009markov} use the so-called evolving set process to derive a similar bound. Specifically, they proved in \cite[Theorem~17.17]{levin2009markov} that if $\P$ denotes the transition matrix of a lazy random walk (i.e., a random walk with loop probability at least $1/2$) on a graph with maximal degree $\Delta$, then for any vertex $x \in V$: \[
\left| \P^t_{x,x} - \pi_x \right| \leq \frac{\sqrt{2} \Delta^{5/2}}{\sqrt{t}},
\]
where $\pi$ is the stationary distribution of $\P$.
Such estimates have been used in various applications besides load balancing, including distributed random walks and spanning tree enumeration \cite{ANPT13,Lyons05}. Here we generalize this result to Markov chains with an arbitrary loop probability and to arbitrary $t$-step transition probabilities:
\begin{restatable}{thm}{markov}\label{thm:markov}
Let $\mathbf{P}$ be the transition matrix of an irreducible Markov chain and $\pi$ its stationary distribution. Then we have for all states $x, y$ and step $t$,
\begin{equation*}
\left|\mathbf{P}^t_{x,y} - \pi_y \right| \leq \frac{\pi_{\max}^{3/2}}{\pi_{\min}^{3/2}}\cdot \frac{2}{\beta^{1/2}\alpha} \sqrt{\frac{1-\beta+\alpha}{\alpha t}},
\end{equation*}
where $\alpha := \min\limits_{u \neq v} \P_{u,v} > 0$ and $\beta := \min\limits_{u} \P_{u,u} > 0$.
\end{restatable}
Applying this bound to a round matrix $\mathbf{M}$ that is formed of $d=O(1)$ matchings, we obtain
$
\left| \mathbf{M}^t_{u,v} - 1/n \right| = O(t^{-1/2}).
$
It should be noted that \cite[Lemma 2.5]{SS12} proved a weaker version where the upper bound is only $O(t^{-1/8})$ instead of $O(t^{-1/2})$. As we will prove in Lemma~\ref{lem:intuition}, the bound $O(t^{-1/2})$ is asymptotically tight if we consider the balancing circuit model on cycles.
Combining the bound in Theorem~\ref{thm:markov} with the upper bound in Theorem~\ref{thm:main1} yields:
\begin{restatable}{thm}{maintwo}\label{thm:maintwo}
Consider the balancing circuit model with an arbitrary round matrix $\mathbf{M}$ consisting of $d=O(1)$ matchings in the average case. Then the discrepancy after $t$ rounds is $O(t^{-1/4} \cdot \sigma \cdot (\log n)^{3/2} + \sqrt{\log n})$ with probability $1 - O(n^{-1})$.
\end{restatable}
Since the initial discrepancy in the average case is $O(\sigma \cdot \log n)$ (see Lemma~\ref{lem:distribution}), Theorem~\ref{thm:maintwo} implies that in the average case, there is a signficant decrease (roughly of order $t^{-1/4}$) in the discrepancy, regardless of the underlying topology.
For round matrices $\mathbf{M}$ with small second largest eigenvalue, the next result provides a significant improvement:
\begin{restatable}{thm}{mainthree}
\label{thm:main3}
Consider the balancing circuit model with an arbitrary round matrix $\mathbf{M}$ consisting of $d$ matchings in the average case. Then the discrepancy after $t$ rounds is $O(\lambda(\mathbf{M})^{t/4} \cdot \sigma \cdot (\log n)^{3/2}+\sqrt{\log n})$ with probability $1 - O(n^{-1})$.
\end{restatable}
Hence for graphs where $\lambda$ is bounded away from $1$, we even obtain an exponential convergence.
\begin{wrapfigure}{r}{4cm}
\begin{center}
\begin{tabular}{|c|c|}
\hline
Graph & $\operatorname{disc}(x^{(t)}) $ \\
\hline
Cycle & $t^{-1/4} \cdot \sigma$ \\
$r$-dim. Torus & $t^{-r/4} \cdot \sigma $ \\
Expander & $\lambda^{t/4} \cdot \sigma$ \\
Hypercube & $2^{-t/2} \cdot \sigma$ \\
\hline
\end{tabular}\label{fig:summary}
\caption{Discrepancy bounds (without logarithmic factors) for different topologies.}
\end{center}
\end{wrapfigure}
In Section~\ref{sec:application}, we derive bounds on the discrepancy for cycles, $r$-dim. Torus, expanders and hypercubes. A summary of these results can be found in Figure~1.
Finally, we discuss our results and contrast them to the convergence of the discrepancy in the worst-case in Section \ref{sec:discussion}. On a high level, these results demonstrate that on all the considered topologies, we have much faster convergence in the average-case than in the worst-case. However, if we are only interested in the time to achieve a very small, say, constant or poly-logarithmic discrepancy, then we reveal an interesting dichotomy: we have a quicker convergence than in the worst-case if and only if the standard deviation $\sigma$ is smaller than some threshold, which depends on the actual toplogy. We observe the same phenomena in our experiments, which are also discussed in Section~\ref{sec:experiments}.
\section{Notation and Background}\label{sec:def}
We assume that $G = (V,E)$ is an undirected, connected graph with $n$ nodes labelled in $[0,n-1]$. Unless stated otherwise, all logarithms are to the base $e$. The notations $\Pro{\mathcal{E}}$ and $\Ex{X}$ denote the probability of an event $\mathcal{E}$ and the expectation of a random variable $X$, respectively. For any $n$-dimensional vector $x$, $\operatorname{disc}(x)=\max_i x_i - \min_i x_i$ denotes the {\em discrepancy}.
\textbf{Matching Model.}
In the {\em matching model} (sometimes also called {\em dimension exchange model}), every two matched nodes in round $t$ balance their load as evenly as possible. This can be expressed by a symmetric $n$ by $n$ matching matrix $\mathbf{M}^{(t)}$, where with slight abuse of notation we use the same symbol for the matching and the corresponding matching matrix. Formally, matrix $\mathbf{M}^{(t)}$ is defined
by $\mathbf{M}_{u,u}^{(t)}:=1/2$, $\mathbf{M}_{v,v}^{(t)}:=1/2$ and $\mathbf{M}_{u,v}^{(t)}=\mathbf{M}_{v,u}^{(t)}:=1/2$ if $\{u,v\} \in \mathbf{M}^{(t)} \subseteq E$,
and $\mathbf{M}^{(t)}_{u,u}=1$, $\mathbf{M}^{(t)}_{u,v}=0~(u\neq v)$ if $u$ is not matched.
\textbf{Balancing Circuit.} In the {\em balancing circuit model}, a specific sequence of matchings is applied periodically.
More precisely, let $\mathbf{M}^{(1)},\dots,\mathbf{M}^{(d)}$ be a sequence of $d$ matching matrices, also called {\em period} \footnote{Note that $d$ may be different from the maximal degree (or degree) of the underlying graph.}.
Then in step $t \geq 1$, we apply the matching matrix
$\mathbf{M}^{(t)} := \mathbf{M}^{(((t-1) \mod d)+1)}$.
We define the {\em round matrix} by $\mathbf{M}:= \prod_{s=1}^{d} \mathbf{M}^{(s)}$. If $\mathbf{M}$ is symmetric, we define $\lambda(\mathbf{M})$ to be its second largest eigenvalue (in absolute value). Following~\cite{RSW98}, if $\mathbf{M}$ is not symmetric (which is usually the case), we define $\lambda(\mathbf{M})$ as the second largest eigenvalue of the symmetric matrix $\mathbf{M} \cdot \mathbf{M}^{T}$, where $\mathbf{M}^{T}$ is the transpose of $\mathbf{M}$. We always assume that $\lambda(\mathbf{M}) < 1$, which is guaranteed to hold if the matrix $\mathbf{M}$ is irreducible. Notice that since $\mathbf{M}$ is doubly stochastic, all powers of $\mathbf{M}$ are doubly stochastic as well. A natural choice for the $d$ matching matrices is given by an edge coloring of $G$. There are various efficient distributed edge coloring algorithms, e.g.~\cite{PS92,PS97}.
\textbf{Balancing Circuit on Specific Toplogies.}
For {\em hypercubes}, the canonical choice is dimension exchange consisting of $d=\log_2 n$ matching matching matrices $\mathbf{M}^{(i)}$ by $\mathbf{M}_{u,v}^{(i)}=1/2$ if and only if the bit representation of $u$ and $v$ differ only in bit $i$. Then the round matrix $\mathbf{M}$ is defined by $\prod_{i=1}^{\log_2 n} \mathbf{M}^{(i)}$. For {\em cycles}, we will consider the natural ``Odd-Even''-scheme meaning that for $\mathbf{M}^{(1)}$, the matching consists of all edges $\{j,(j+1) \pmod n \}$ for any odd $j$, while for $\mathbf{M}^{(2)}$, the matching consists of all edges $\{j,(j+1) \pmod n \}$ for any even $j$. More generally, for $r$-dimensional tori with vertex set $[0,n^{1/r}-1]^r$, we will have $2\cdot r$ matchings in total, meaning that for every dimension $1 \leq i \leq r$ we have two matchings along dimension $i$, similar to the definition of matchings for the cycle.
\textbf{The Continuous Case.}
In the continuous case, load is arbitrarily divisible. Let $\xi^{(0)} \in \mathbb{R}^n$ be the initial load represented as a row vector, and in every round two matched nodes average their load perfectly. We consider the load vector $\xi^{(t)}$ after $t$ rounds in the balancing circuit model (that means, after the executions of $t \cdot d$ matchings in total). This process corresponds to a linear system and $\xi^{(t)},$ $t\in \mathbb{N}$, can be expressed as
$\xi^{(t)} = \xi^{(t-1)} \,\mathbf{M}$,
which results in $\xi^{(t)} = \xi^{(0)} \, \mathbf{M}^{t}$.
\textbf{The Discrete Case.}
Let us now turn to the discrete case with indivisible, unit-size tokens. Let $x^{(0)} \in \mathbb{Z}^n$ be the initial load vector with average load $\overline{x}:=\sum_{w \in V} x_w^{(0)}/n$,
and $x^{(t)}$ be the load vector at the end of round $t$. In case the sum of tokens of the two paired nodes is odd, we employ the so-called {\em random orientation} (or {\em randomized rounding})~\cite{RSW98,SS12}. More precisely, if there are two nodes $u$ and $v$ with load $a$ and $b$ being paired by matching $\mathbf{M}^{(t)}$, then node $u$
gets either $\big\lceil \frac{a+b}{2} \big\rceil$ or $\big\lfloor \frac{a+b}{2} \big\rfloor $
tokens, with probability $1/2$ each. The remaining tokens are assigned to node $v$.
\textbf{The Average-Case Setting.}
We consider a setting where each entry of the initial load vector $x^{(0)}$ is chosen from an exponentially concentrated probability distribution $D$ with expectation $\mu$ and variance $\sigma^2$ (see Definition~\ref{def:expcon}).
It is not difficult to verify that many natural distributions satisfy the condition of exponentially concentrated (see the appendix for more details).
\begin{restatable}{lem}{distributions}\label{lem:distributions}
The uniform distribution, binomial distribution, geometric distribution and Poisson distribution are all exponentially concentrated.
\end{restatable}
\begin{proof}
Note that the uniform distribution $\mathsf{Uni}[0,k]$ is trivially exponentially concentrated, since $\sigma=\Theta(k)$. However, also distributions with unbounded range may be exponentially concentrated, with one example being the geometric distribution $\mathsf{Geo}(p)$. To verify this, first note that we have $\mu=1/p$ and $\sigma=\sqrt{(1-p)/p^2}$ (and so $\mu=\Theta(\sigma)$) and thus $\Pro{ \mu - X \geq \delta \cdot \sigma} \leq \exp\left( - \kappa \delta \right)$ holds trivially for a sufficiently small constant $\kappa > 0$. Secondly, for the upper tail, by Markov's inequality, $\Pro{ X \geq 2 \cdot \Ex{X} } \leq 1/2$, and by the memoryless property of the geometric distribution, for any $j \geq 1$, $\Pro{X \geq j \cdot 2 \cdot \Ex{X} } \leq 2^{-j}$.
For the binomial distribution $\mathsf{Bin}[m,p]$ with expectation $\mu=m \cdot p$ and standard deviation $\sigma=\sqrt{m \cdot p \cdot (1-p)}$, we will assume w.l.o.g. that $p \leq 1/2$, so that $\sigma = \Theta( \sqrt{mp})$. Then by \cite[Theorem~2.3]{McD98}, we have for $X \sim \mathsf{Bin}[m,p]$, $\Pro{X - \mu \geq \epsilon \cdot \mu } \leq \exp\left(- \frac{\epsilon^2 \mu}{2+2\epsilon/3} \right)$. Choosing $\epsilon = \delta \cdot \sigma/\mu$ yields
$\Pro{X - \mu \geq \delta \cdot \sigma } \leq \exp\left(- \frac{\delta^2 \cdot \sigma^2 / \mu}{2+2 \sigma/\mu} \right)$, as needed. For the lower tails, we use $\Pro{ \mu - X \geq \epsilon \cdot \mu} \leq e^{-1/2 \epsilon^2 \mu}$ and obtain a similar result as before (see again \cite[Theorem~2.3]{McD98}).
For the Poisson Distribution $\mathsf{Poi}[\mu]$, we can verify in an analogous way that it is exponentially distributed by using the following two Chernoff bounds for Poisson random variables (\ref{lem:chernoffpoisson}).
\end{proof}
The definition of exponentially concentrated implies the following concentration result:
\begin{lem}\label{lem:distribution}
Let $D$ be an exponentially concentrated distribution and let $X \sim D$. Then,
\[
\Pro{ X \in [\mu - 8/\kappa \cdot \sigma \log n, \mu + 8/\kappa \cdot \sigma \log n] } \geq 1 -n^{-2}.
\]
In particular, the initial discrepancy satisfies $\operatorname{disc}(x^{(0)})=O( \sigma \cdot \log n)$ with probability at least $1-n^{-1}$.
\end{lem}
The advantage of Lemma~\ref{lem:distribution} is that we can use a simple conditioning trick to work with distributions that have a finite range and are therefore easier to analyze with concentration tools like Hoeffding's inequality (Theorem~\ref{thm:hoeffding}). That is in the analysis we simply work with a bounded-range distribution $\widetilde{D}$, which is the distribution $D$ under the condition that only values in the interval $[\mu - 8/c \cdot \sigma \log(n), \mu + 8/c \cdot \sigma \log(n)]$ occur.
\section{Proof of the General Bound (Theorem~\ref{thm:main1})}
\mainone*
\subsection{Proof of Theorem~\ref{thm:main1} (Upper Bound)}
We will use the following result from \cite{SS12} that bounds the deviation between the continuous and discrete load, assuming that we have $\xi^{(0)}=x^{(0)}$.
\begin{thm}[{\cite[Theorem 3.6($i$)]{SS12}}] \label{thm:errorbound}
Consider the balancing circuit model with an arbitrary round matrix $\mathbf{M}$. Then for any round $t \geq 1$ it holds that
\begin{equation*}
\Pro{\max_{w \in V} \left| x_w^{(t)} - \xi_w^{(t)} \right| \leq \sqrt{12 \cdot \log n} } \geq 1 - n^{-2}.
\end{equation*}
\end{thm}
\begin{proof}[Proof of Theorem~\ref{thm:main1} (Upper Bound)]
Recall that the initial vector $\xi^{(0)}=x^{(0)}$ consists of $n$ i.i.d.~random variables. As explained at the end of Section~\ref{sec:def}, we condition on the event \[ \mathcal{E} := \bigcap_{w \in V} \left\{ \left| \xi_w^{(0)} - \mu \right| \leq 8/\kappa \cdot \sigma \cdot \log n \right\}. \]
By Lemma~\ref{lem:distribution}, $\Pro{ \mathcal{E} } \geq 1- n^{-2}$. In the remainder of the proof, all random variables are conditional on $\mathcal{E}$, but for simplicity we will not explicitly express this conditioning.
Since $\xi_u^{(t)} = \sum_{w \in V} \xi_w^{(0)}\mathbf{M}^t_{w,k}$, the load $\xi_u^{(t)}$ is just a weighted sum of i.i.d.~random variables and we obtain
\begin{align*}
\xi_u^{(t)} - \xi_{v}^{(t)} &= \sum_{w \in V}\xi_w^{(0)} \cdot \left(\mathbf{M}^t_{w,u} - \mathbf{M}^t_{w,v}\right), \label{eq:deviation}
\end{align*}
which is in fact still a sum of $n$ i.i.d.~random variables. The expectation is
\begin{align*}
\Ex{\xi_u^{(t)} - \xi_{v}^{(t)}} &= \Ex {\sum_{w\in V} \xi_w^{(0)} \cdot \left(\mathbf{M}^t_{w,u} - \mathbf{M}^t_{w,v} \right) } = \sum_{w \in V} \left(\mathbf{M}^t_{w,u} - \mathbf{M}^t_{w,v} \right) \Ex{\xi_w^{(0)} } = 0,
\end{align*}
where the last equality holds since $\mathbf{M}$ is doubly stochastic.
Now applying Hoeffding's inequality (Theorem~\ref{thm:hoeffding}) and recalling that conditional on $\mathcal{E}$, the range of each $\xi_w^{(t)}$ is $16/ \kappa \cdot \sigma \cdot \log n$, we obtain that
\begin{equation*}
\begin{aligned}
\Pro{\left| \xi_u^{(t)} - \xi_{v}^{(t)} \right| \geq \delta}
&\leq 2 \cdot \exp \left(\frac{-2\delta^2}{256/\kappa^2 \cdot \sigma^2 \cdot \log^2 n \cdot
\left\| \mathbf{M}^t_{.,u} - \mathbf{M}^t_{.,v} \right\|_2^2 } \right).\\
\end{aligned}
\end{equation*}
Applying Theorem~\ref{thm:errorbound} yields
\begin{align*}
\Pro{\left| x_u^{(t)} - x_{v}^{(t)} \right| \geq \delta + \sqrt{48 \cdot \log n}} \leq 2 \cdot \exp \left(\frac{-2\delta^2}{256/\kappa^2 \cdot \sigma^2 \cdot \log^2 n \cdot
\left\| \mathbf{M}^t_{.,u} - \mathbf{M}^t_{.,v} \right\|_2^2 } \right) + n^{-2}.
\end{align*}
The statement of the theorem follows by scaling $\delta$ and recalling that $\Pro{ \mathcal{E}} \geq 1 -n^{-2}$.
\end{proof}
\subsection{Proof of Theorem~\ref{thm:main1} (Lower Bound)}
The proof of the lower bound will use the following quantitative version of a central limit type theorem for independent but non-identical random variables.
\begin{thm}
[Berry-Esseen Theorem \cite{berry1941accuracy,esseen1942liapounoff} for non-identical r.v.]\label{thm:be} Let $X_1,X_2,...,X_n$ be independently distributed with $\Ex{X_i} = 0$,
$\Ex{X_i^2} = \mathrm{Var}{X_i} = \sigma_i^2$, and $\Ex{|X_i|^3} = \rho_i < \infty$. If $F_n(x)$
is the
distribution of $\frac{X_1 + ... + X_n}{\sqrt{\sigma_1^2 + \sigma_2^2 + ... + \sigma_n^2}}$ and $\Phi(x)$
is the standard normal distribution, then
\begin{equation*}
\begin{aligned}
|F_n(x) - \Phi(x)| & \leq C_0 \psi_0,\\
\end{aligned}
\end{equation*}
where
$
\psi_0 = \left( \sum_{i=1}^{n} \sigma_i^2 \right)^{-3/2} \cdot \sum_{i=1}^{n}\rho_i
$
and $C_0>0$ is a constant.
\label{thm:berryesseenfornonidentical}
\end{thm}
With this concentration tool at hand, we are able to prove the lower bound in Theorem~\ref{thm:main1}. Unfortunately, it appears quite difficult to apply Theorem~\ref{thm:be} directly to equation~(\ref{eq:deviation}), since we need a good bound on the error term $\psi_0$. To this end, we will first partition the vertex set $V$ into buckets with equal contribution to $\xi_u^{(t)} - \xi_v^{(t)}$. Then we will apply Theorem~\label{thm:berryesseenfornonidentical} to the bucket with the largest variance, for which we can show that $\psi_0=o(1)$, thanks to the precondition that $t=\omega(1)$ and the bound in Theorem~\ref{thm:markov}.
\begin{proof}[Proof of Theorem \ref{thm:main1} (Lower Bound)]
As in the derivation of the upper bound, we first consider $\xi_{u}^{(t)} - \xi_{v}^{(t)}$:
\begin{equation*}
dev := \xi_u^{(t)} - \xi_{v}^{(t)} = \sum_{w \in V} \xi_w^{(0)} \cdot \left( \mathbf{M}^t_{w,u} - \mathbf{M}^t_{w,v} \right).
\end{equation*}
Again we are dealing with a weighted sum of i.i.d.~random variables with expectation $\mu$ and variance $\sigma^2$. As mentioned earlier, we have
$\Ex{dev} = \sum_{w \in V} \Ex{ \xi_w^{0}} \cdot
\left( \mathbf{M}^t_{w,u} - \mathbf{M}^t_{w,v} \right) = 0$ since $\mathbf{M}$ is a doubly stochastic matrix. Of course, we could apply Theorem~\ref{thm:be} directly to $dev$, but it appears difficult to control the error term $\psi_0$. Therefore we will first partition the above sum into buckets where the weights of the random variables are roughly the same.
More precisely, we will partition $V$ into $2\log_2 \sigma - 1$ buckets, where for each $i$ we have $V_i := \left\{ w \in V \colon | \mathbf{M}^t_{w,u} - \mathbf{M}^t_{w,v}| \in (2^{-i},2^{-i+1}] \right\}$ for $1 \leq i \leq 2 \log_2 \sigma - 1$, and $V_{2\log_2 \sigma - 1} := \left\{ w\in V \colon \left| \mathbf{M}^t_{w,u} - \mathbf{M}^t_{w,v} \right| \leq \frac{1}{\sigma^2} \right\}$.
Further, let us consider the variance of $dev$:
\[
\sigma^2 = \sum_{w \in V} \left( \mathbf{M}^t_{w,k} - \mathbf{M}^t_{w,k'} \right)^2.
\]
Then by the pigeonhole principle there exists an index $1 \leq i \leq 2 \log_2 \sigma -1$ such that
\[
\sum_{v \in V_i} \left( \mathbf{M}^t_{w,u} - \mathbf{M}^t_{w,v} \right)^2 \geq \frac{1}{2 \log_2 \sigma} \cdot \sigma^2.
\]
Firstly, if that index $i$ is equal to $2 \log_2 \sigma $, then
\[
\left\| \mathbf{M}_{.,u}^t - \mathbf{M}_{.,v}^t \right\|_2^2 = O(\sigma^{-1}),
\]
and the lower bounds holds trivially. Therefore, we will assume in the remainder of the proof that $i < 2 \log_2 \sigma - 1$. We now decompose $dev$ into $dev=S+S^c$, where
\[
S := \sum_{w \in V_i} \xi_w^{(0)} \cdot \left( \mathbf{M}^t_{w,u} - \mathbf{M}^t_{w,v} \right)
\]
and
\[
S^c := \sum_{w \not\in V_i} \xi_w^{(0)} \cdot \left( \mathbf{M}^t_{w,u} - \mathbf{M}^t_{w,v} \right).
\]
Let us first analyze $S$. We will now apply Theorem~\ref{thm:be} to $S$. In preparation for this, let us first upper bound $\psi_0$. Using the definition of exponentially concentrated, it follows that for any constant $k$, the first $k$ moments are all bounded from above by $O(\sigma^k)$.
Hence,
\begin{align*}
\psi_0 &= \frac{ \sum_{w \in V_i} \Ex{ \left|\xi_w^{(0)} \cdot \left( \mathbf{M}^t_{w,u} - \mathbf{M}^t_{w,v} \right)\right| ^3} }{ \left( \sum_{w \in V_i} \Ex{ \xi_w^{(0)} \cdot \left( \mathbf{M}^t_{w,u} - \mathbf{M}^t_{w,v} \right) ^2} \right)^{3/2} } \leq \frac{ O(\sigma^3) \cdot \sum_{w \in V_i} \left| \mathbf{M}^t_{w,u} - \mathbf{M}^t_{w,v} \right| ^3} { \sigma^3 \cdot \left( \sum_{w \in V_i} \left( \mathbf{M}^t_{w,u} - \mathbf{M}^t_{w,v} \right) ^2 \right)^{3/2}}.
\end{align*}
Recalling that for any $w \in V_i$, $\left| \mathbf{M}^t_{w,u} - \mathbf{M}^t_{w,v} \right| \in (2^{-i},2^{-i+1}] $, we can simplify the above expression as follows:
\begin{align*}
\psi_0 &= O \left( \frac{ |V_i| \cdot 2^{-3i} }{ |V_i|^{3/2} \cdot 2^{-3i} } \right) = O( |V_i|^{-1/2}).
\end{align*}
However, since we have $t=\omega(1)$, by Theorem~\ref{thm:markov}, $| \mathbf{M}^t_{x,y} - \frac{1}{n} | = O(t^{-1/2})$ and therefore it must be that $|V_i|=\omega(1)$, and we conclude that $\psi_0 = o(1)$.
Before applying Theorem~\ref{thm:be}, we scale the original distribution to $\xi_w^{'(0)} = \xi_w^{(0)} - \mu$. Since $\mathrm{Var}(aX) = a^2 \mathrm{Var}(X)$, we have
\begin{equation*}
\begin{aligned}
F_n(x) & = \Pro{ \frac{\sum_{w \in V_i} \xi_w^{'(0)} \cdot \left( \mathbf{M}^t_{w,u} - \mathbf{M}^t_{w,v} \right) }{\sigma \sqrt{\sum_{w \in V_i} \left( \mathbf{M}^t_{w,u} - \mathbf{M}^t_{w,v} \right)^2}} \leq x } \\
& = \Pro{ \frac{\sum_{w \in V_i} \xi_w^{(0)} \cdot \left( \mathbf{M}^t_{w,u} - \mathbf{M}^t_{w,v} \right) - \sum_{w \in V_i} \mu \cdot \left( \mathbf{M}^t_{w,u} - \mathbf{M}^t_{w,v} \right) }{\sigma \sqrt{\sum_{w \in V_i}\left( \mathbf{M}^t_{w,u} - \mathbf{M}^t_{w,v} \right)^2}}
\leq x } \\
& = \Pro{ \frac{S - \Ex{S}}{\sigma \sqrt{\sum_{w \in V_i}\left(\mathbf{M}^t_{w,u} - \mathbf{M}^t_{w,v} \right)^2}}
\leq x } \\
& = \Pro{ S - \Ex{S}
\leq x\sigma \sqrt{\sum_{w \in V_i}\left(\mathbf{M}^t_{w,u} - \mathbf{M}^t_{w,v} \right)^2} }.
\end{aligned}
\end{equation*}
As derived earlier $\psi_0 = o(1)$, and therefore
\begin{align*}
\Pro{ S - \Ex{S} \geq x \sigma \sqrt{\sum_{w \in V_i}\left( \mathbf{M}^t_{w,u} - \mathbf{M}^t_{w,v} \right)^2} } & \geq \Phi(-x) - C_0\psi_0 \\
& \geq \frac{1}{\sqrt{\pi} (x + \sqrt{x^2 + 2})e^{x^2}} - o(1),
\end{align*}
where last inequality uses \cite[Formula~ 7.1.13]{abramowitz1966handbook}:
\begin{equation*}
\frac{1}{x + \sqrt{x^2 + 2}} <
e^{x^2}\int_x^\infty e^{-t^2}dt \leqslant
\frac{1}{x + \sqrt{x^2 + 4/\pi}} \ (x>0).
\end{equation*}
Therefore, by substitution, we get
\begin{equation*}\label{fm:normesti}
\frac{1}{\sqrt{\pi}(x+\sqrt{x^2+2})e^{x^2}} <
\Phi^c(x) \leqslant
\frac{1}{\sqrt{\pi}(x+\sqrt{x^2+4/\pi})e^{x^2}}.
\end{equation*}
Hence with $x=1$,
\begin{align*}
\Pro{ S - \Ex{S} \geq \sigma \sqrt{\sum_{w \in V_i}\left( \mathbf{M}^t_{w,u} - \mathbf{M}^t_{w,v} \right)^2} } &\geq \frac{1}{16}.
\end{align*}
Similarly, we can derive that
\begin{align*}
\Pro{ \Ex{S} - S \geq \sigma \sqrt{\sum_{w \in V_i}\left( \mathbf{M}^t_{w,u} - \mathbf{M}^t_{w,v} \right)^2} } &\geq \frac{1}{16}.
\end{align*}
Hence, independent of what the value $S^c$ is, there is still a probability of at least $1/16$ so that $|S+S^c| \geq \sigma/2 \cdot \sqrt{1/(2 \log_2 \sigma)} \cdot \sqrt{\sum_{w \in V}\left( \mathbf{M}^t_{w,u} - \mathbf{M}^t_{w,v} \right)^2}$.
\end{proof}
\section{Proof of the Universal Bounds (Theorem~\ref{thm:maintwo}, Theorem~\ref{thm:main3})}\label{sec:universalbounds}
In the previous section we proved that the deviation between the loads of two nodes $u$ and $v$ is essentially captured by $\left\| \mathbf{M}^t_{.,u} - \mathbf{M}^t_{.,v} \right\|_2$. However, in some cases it might be hard to compute or estimate this quantity for arbitrary vertices $u$ and $v$. Therefore we will first prove the following universal upper bound on the discrepancy that works for arbitrary graphs and pair of nodes, as stated on page~\pageref{thm:maintwo}.
\maintwo*
\subsection{Proof of Theorem~\ref{thm:maintwo}}
The proof of Theorem~\ref{thm:maintwo} is fairly involved and we first sketch the high level ideas.
We first show that $\left\| \mathbf{M}^t_{.,u} - \mathbf{M}^t_{.,v} \right\|_2^2$ can be upper bounded in terms of the $\ell_2$-distance to the stationary distribution.
\begin{restatable}{lem}{twonodestoavg}
\label{lem:twonodestoavg}
Consider the balancing circuit model with an arbitrary round matrix $\mathbf{M}$. Then for all $u,v \in V$, we have
$
\| \mathbf{M}^t_{.,u} - \mathbf{M}^t_{.,v} \|_2^2 \leq 4 \cdot \max_{k \in V} \| \mathbf{M}^t_{.,k} - \mathbf{\frac{1}{n}} \|_2^2.
$
Further, for any $u \in V$ we have
$
\max_{v \in V} \| \mathbf{M}^t_{.,u} - \mathbf{M}^t_{.,v} \|_2^2 \geq \| \mathbf{M}^t_{.,u} - \mathbf{\frac{1}{n}} \|_2^2
$.
\end{restatable}
\begin{proof}
\begin{equation*}
\begin{aligned}
\sum_{w \in V}\left( \mathbf{M}^t_{w,u} - \mathbf{M}^t_{w,v} \right)^2 & \leq 2 \cdot \left( \sum_{w \in V} \left( \mathbf{M}^t_{w,u} - \frac{1}{n} \right)^2 + \left( \mathbf{M}^t_{w,v} - \frac{1}{n} \right)^2 \right) \\
& \leq 4 \cdot \max_{k \in V} \sum_{w \in V}\left( \mathbf{M}^t_{w,k} - \frac{1}{n} \right)^2,
\end{aligned}
\end{equation*}
and the first statement follows.
We now prove the second statement:
\begin{equation*}
\forall u \colon \max_{v \in V} \sqrt{\sum_{w \in V} \left(\mathbf{M}_{w,u}^t - \mathbf{M}_{w,v}^t \right)^2} \geq \sqrt{\sum_{w \in V} \left(\mathbf{M}_{w,u}^t - \frac{1}{n} \right)^2}.
\end{equation*}
We first look at the difference between these two terms squared. That is, for any vertex $v \in V$ we have
\begin{align}
\lefteqn{ \sum_{w \in V} \left(\mathbf{M}_{w,u}^t - \mathbf{M}_{w,v}^t \right)^2 - \sum_{w \in V} \left(\mathbf{M}_{w,u}^t - \frac{1}{n} \right)^2} \notag \\
& = -2 \sum_{w \in V} \left(\mathbf{M}_{w,u}^t - \frac{1}{n}\right)\left(\mathbf{M}_{w,v}^t - \frac{1}{n}\right) + \sum_{w \in V} \left(\mathbf{M}_{w,v}^t - \frac{1}{n}\right)^2 \notag \\
& = -2 \sum_{w \in V} \mathbf{M}_{w,u}^t \cdot \mathbf{M}_{w,v}^t + \frac{4}{n} - \frac{2}{n} + \sum_{w \in V} \left(\mathbf{M}_{w,v}^t\right)^2 + \frac{1}{n} \notag \\
& = -2 \sum_{w \in V} \mathbf{M}_{w,u}^t \cdot \mathbf{M}_{w,v}^t + \sum_{w \in V} \left(\mathbf{M}_{w,v}^t\right)^2 + \frac{1}{n} \label{eq:labelone}
\end{align}
Now let $Z$ be a uniform random variable over the set $V \backslash \{u\}$. Then it follows that
\begin{equation*}
\begin{aligned}
\Esub{Z \sim V \setminus \{u\}}{\sum_{w \in V} \mathbf{M}_{w,u}^t \cdot \mathbf{M}_{w,Z}^t } &
= \sum_{z \in V, z \neq u} \frac{1}{n-1} \cdot \sum_{w \in V} \mathbf{M}_{w,u}^t \cdot \mathbf{M}_{w,z}^t \\
& = \frac{1}{n-1} \sum_{w \in V} \mathbf{M}_{w,u}^t \cdot \sum_{z \in V, z \neq u}\mathbf{M}_{w,z}^t \\
& = \frac{1}{n-1} \sum_{w \in V} \mathbf{M}_{w,u}^t \cdot \left( 1 - \mathbf{M}_{w,u}^t \right) \\
& = \frac{1}{n-1} \left( 1 - \sum_{w \in V} \left(\mathbf{M}_{w,u}^t\right)^2 \right).
\end{aligned}
\end{equation*}
Further, by linearity of expectations
\begin{align*}
\lefteqn{ \Esub{Z \sim V \setminus \{u\}}{-2 \sum_{w \in V} \mathbf{M}_{w,u}^t \cdot \mathbf{M}_{w,Z}^t + \sum_{w \in V} \left( \mathbf{M}_{w,Z}^t \right)^2 + \frac{1}{n} }} \\ &= \frac{-2}{n-1} \left( 1 - \sum_{w \in V} \left(\mathbf{M}_{w,u}^t\right)^2 \right) + \sum_{z \in V, y \neq u} \sum_{w \in V} \frac{1}{n-1} \left( \mathbf{M}_{w,z}^t \right)^2 + \frac{1}{n}.
\end{align*}
By definition of expectation, this implies that there exists a vertex $v \in V, v \neq u$ such that
\begin{align}
\lefteqn{-2 \sum_{w \in V} \mathbf{M}_{w,u}^t \cdot \mathbf{M}_{w,v}^t + \sum_{w \in V} \left( \mathbf{M}_{w,v}^t \right)^2 + \frac{1}{n} } \notag \\ &\geq \frac{-2}{n-1} \left( 1 - \sum_{w \in V} \left(\mathbf{M}_{w,u}^t\right)^2 \right) + \sum_{z \in V, z \neq u} \sum_{w \in V} \frac{1}{n-1} \left( \mathbf{M}_{w,z}^t \right)^2 + \frac{1}{n}. \label{eq:labeltwo}
\end{align}
Combining (\ref{eq:labelone}) and (\ref{eq:labeltwo}),
\begin{align*}
\lefteqn{ \sum_{w \in V} \left(\mathbf{M}_{w,u}^t - \mathbf{M}_{w,v}^t \right)^2 - \sum_{w \in V} \left(\mathbf{M}_{w,v}^t - \frac{1}{n} \right)^2 } \\ & \geq \frac{-2}{n - 1} \cdot \left( 1- \sum_{w \in V} \left(\mathbf{M}_{w,u}^t \right)^2 \right) + \sum_{w \in V} \sum_{z \in V, z \neq u} \frac{1}{n-1} \cdot \left( \mathbf{M}_{w,z}^t \right)^2+ \frac{1}{n} \\
& = -\frac{1}{n-1} - \frac{1}{n \cdot (n-1)} + \frac{2}{n-1}\sum_{w \in V} \left( \mathbf{M}_{w,u}^t \right)^2 + \frac{1}{n - 1} \cdot \sum_{w \in V} \sum_{z \in V, z \neq u} \left(\mathbf{M}_{w,z}^t \right)^2\\
&= -\frac{1}{n-1} - \frac{1}{n \cdot (n-1)} + \frac{1}{n-1}\sum_{w \in V} \left(\mathbf{M}_{w,u}^t\right)^2 + \frac{1}{n-1} \cdot \sum_{w \in V} \sum_{z \in V} \left(\mathbf{M}_{w,z}^t \right)^2\\
& \geq -\frac{1}{n-1} - \frac{1}{n \cdot (n-1)} + \frac{1}{n \cdot (n-1)} + \frac{1}{n-1} \\
& \geq 0,
\end{align*}
where the second last inequality holds since $\mathbf{M}$ is doubly stochastic.
\end{proof}
The next step and main ingredient of the proof of Theorem~\ref{thm:maintwo} is to establish that $\| \mathbf{M}^t_{.,k} - \mathbf{\frac{1}{n}} \|_{\infty} = O(1/\sqrt{t})$. This result will be a direct application of a general bound on the $t$-step probabilities of an arbitrary, possibly non-reversible Markov chain, as given in Theorem~\ref{thm:markov} from page \pageref{thm:markov}:
\markov*
In this subsection we prove Theorem~\ref{thm:maintwo}, assuming the correctness of Theorem~\ref{thm:markov} whose proof is deferred to Section~\ref{sec:markovproof}.
\begin{proof}[Proof of Theorem~\ref{thm:maintwo}]
By Theorem \ref{thm:main1} and Lemma \ref{lem:twonodestoavg}, we obtain
\begin{align*}
\Pro{\left| x_u^{(t)} - x_{v}^{(t)} \right| \geq \delta \cdot 16\sqrt{2} \kappa \cdot \sigma \cdot \log n \cdot
\max_{k \in V} \left\| \mathbf{M}^t_{.,k} - \mathbf{\frac{1}{n}} \right\|_2 + \sqrt{48 \log n}} \leq 2 \cdot e^{- \delta^2} + 2n^{-2}.
\end{align*}
Hence we can find a $\delta=\sqrt{3\log n}$ so that the latter probability gets smaller than $3 n^{-2}$. Further, by applying Theorem \ref{thm:markov} with $\alpha = \beta = 2^{-d}$ to $\P=\mathbf{M}$ we conclude that
$
\| \mathbf{M}^t_{.,k} - \mathbf{\frac{1}{n}} \|_{\infty} = O(t^{-1/2}),
$
since $d=O(1)$. Using the fact $\|.\|_2^2 \leq \|.\|_{\infty} \cdot \|.\|_1$,
$
\| \mathbf{M}^t_{.,k} - \mathbf{\frac{1}{n}} \|_{2}^2 = O(t^{-1/2}),
$
and by the union bound, $\operatorname{disc}(x^{(t)}) = O(t^{-1/4} \cdot \sigma \cdot (\log n)^{3/2} + \sqrt{\log n})$ with probability at least $1-3 n^{-1}$.
\end{proof}
\subsection{Proof of Theorem~\ref{thm:markov}}\label{sec:markovproof}
This section is devoted to the proof of Theorem~\ref{thm:markov}. Our proof is based on the evolving-set process, which is a Markov chain based on any given irreducible, not necessarily reversible Markov chain on $\Omega$. For the definition of the evolving set process, we closely follow the exposition in \cite[Chapter 17]{levin2009markov}.
Let $\P$ denote the transition matrix of an irreducible Markov chain and $\pi$ its stationary distribution. $\P^t$ is the $t$-step transition probability matrix. The \emph{edge measure} $Q$ is defined by $Q_{x,y} := \pi_x \P_{x,y}$ and $Q(A, B) = \sum_{x \in A, y \in B} Q_{x,y}$.
\begin{defi}\label{def:evolset}
Given a transition matrix $\P$, the \textbf{evolving-set process} is a Markov chain on subsets of $\Omega$ defined as follows. Suppose the current state is $S \subset \Omega$. Let $U$ be a random variable which is uniform on $[0,1]$. The next state of the chain is the set
\begin{equation*}
\tilde{S} = \left\{ y \in \Omega : \frac{Q(S,y)}{\pi_y} \geq U \right\}.
\end{equation*}
\end{defi}
This chain is \emph{not irreducible} because
$\varnothing$ and $\Omega$ are absorbing states.
It follows that
\begin{equation*}
\Pro{y \in S_{t+1} \,|\, S_t} = \frac{Q(S_t, y)}{\pi_y}
\end{equation*}
since the probability that $y \in S_{t+1}$ is equal to the probability of the event that the chosen value of $U$ is less than $\frac{Q(S_t, y)}{\pi_y}$.
\begin{proposition}[{\cite[Proposition 17.19]{levin2009markov}}]\label{prop:bound}
Let $(M_t)$ be a non-negative martingale with respect to $(Y_t)$, and define
$
T_h := \min\{t \geq 0: M_t = 0 \ or \ M_t \geq h\}
$
Assume that for any $h \geq 0$
\begin{enumerate}[(i)]\itemsep0pt
\item For $t < T_h$, $\mathrm{Var}(M_{t+1} \,|\, Y_0, \ldots , Y_t) \geq \sigma^2$, and
\item $M_{T_h} \leq Dh$.
\end{enumerate}
Let $T := T_1$. If $M_0$ is a constant, then
$
\Pro{T > t} \leq \frac{2M_0}{\sigma}\sqrt{\frac{D}{t}}.
$
\end{proposition}
We now generalize \cite[Lemma~17.14]{levin2009markov} to cover arbitrarily small loop probabilities.
\begin{lem}\label{lem:generalisedexpi}
Let $(U_t)$ be a sequence of independent random variables, each uniform on $[0,1]$, such that $S_{t+1}$ is generated from $S_t$ using $U_{t+1}$. Then with $\beta := \min\limits_{u} \P_{u,u} > 0$,
\begin{equation*}
\begin{aligned}
\Ex{\pi(S_{t+1}) \,|\, U_{t+1} \leq \beta, S_t = S} & \geq \pi(S) + Q(S, S^c)
, \\
\Ex{\pi(S_{t+1}) \,|\, U_{t+1} > \beta, S_t = S} & \leq \pi(S) - \frac{\beta Q(S,S^c)}{1 - \beta}.
\end{aligned}
\end{equation*}
\end{lem}
We list a few auxiliary results from \cite{levin2009markov} about the evolving set process that will be used to prove the result.
\begin{lem}[{\cite[Lemma 17.12]{levin2009markov}}]\label{lem:ptoevolp}
If $(S_t)_{t \geq 0}$ is the evolving-set process associated to the transition matrix $\P$, then for any time $t$ and $x,y \in \Omega$
\begin{equation*}
\P^t_{x,y} = \frac{\pi_y}{\pi_x}\Psub{\{x\}}{y \in S_t}.
\end{equation*}
\end{lem}
Recall that $(S_t)$ is the evolving-set process based on the Markov chain whose transition matrix is $\P$. $\Psub{\{x\}}{y \in S_t}$ means the probability of the event $y \in S_t$ with the initial state of the evolving set being $\{ x \}$.
\begin{lem}[{\cite[Lemma 17.13]{levin2009markov}}]\label{lem:pistmartingale}
The sequence $\{\pi(S_t)\}$ is a martingale.
\end{lem}
\begin{thm}[{\cite[Corollary 17.7]{levin2009markov}}]\label{lem:ost}
Let $(M_t)$ be a martingale and $\tau$ a stopping time. If $\Pro{\tau < \infty}$ and $|M_{t \land \tau}| \leq K$ for all $t$ and some constant $K$ where $t \land \tau := \min\{t, \tau \}$, then $\Ex{M_{\tau}} = \Ex{M_0}$.
\end{thm}
\begin{proof}[Proof of Lemma \ref{lem:generalisedexpi}]
Given $U_{t+1} \leq \beta$, the distribution of $U_{t+1}$ is uniform on $[0, \beta]$.
\textbf{Case 1: }For $y \notin S$, we know that for $y$ satisfying $\frac{Q(S,y)}{\pi_y} \in [0, \beta]$
\begin{equation*}
\Pro{\frac{Q(S,y)}{\pi_y} \geq U_{t+1} \,\Big|\, U_{t+1} \leq \beta, S_t = S} = \frac{Q(S,y)}{\beta\pi_y}
\end{equation*}
and for $y$ satisfying $\frac{Q(S,y)}{\pi_y} \in (\beta,1]$,
\begin{equation*}
\Pro{\frac{Q(S,y)}{\pi_y} \geq U_{t+1} \,\Big|\, U_{t+1} \leq \beta, S_t = S} = 1.
\end{equation*}
We know that
\begin{equation*}
\frac{Q(S,y)}{\pi_y} = \frac{\sum_{x \in S}\pi_x\P_{x,y}}{\pi_y} \leq \frac{\sum_{x \in \Omega}\pi_x\P_{x,y}}{\pi_y} = 1.
\end{equation*}
Since $y \in S_{t+1}$ if and only if $U_{t+1} \leq Q(S_t,y)/\pi_x$, we therefore can combine the above results by using an inequality and conclude that
\begin{equation*}
\Pro{y \in S_{t+1} \,|\, U_{t+1} \leq \beta, S_t = S } \geq \frac{Q(S,y)}{\pi_y} \text{ for $y \notin S$}
\end{equation*}
because $\beta \leq 1$ and $Q(S,y)/\pi_y \leq 1$.
\textbf{Case 2:} For $y \in S$, we have $Q(S,y)/\pi_y \geq Q(y,y)/\pi_y \geq \beta$, it follows that when $U_{t+1} \leq \beta$
\begin{equation*}
\Pro{y \in S_{t+1} \,|\, U_{t+1} \leq \beta, S_t = S } = 1
\text{ for $y \in S$}.
\end{equation*}
We have
\begin{equation*}
\begin{aligned}
& \Ex{\pi(S_{t+1}) \,|\, U_{t+1} \leq \beta, S_t = S} \\
& = \Ex{\sum_{y \in \Omega} \mathbbm{1}_{\{y \in S_{t+1}\} } \pi_y \,\Big|\, U_{t+1} \leq \beta, S_t = S } \\
& = \sum_{y \in S}\pi_y\Pro{y \in S_{t+1} \,|\, U_{t+1} \leq \beta, S_t = S} + \sum_{y \notin S}\pi_y\Pro{y \in S_{t+1} \,|\, U_{t+1} \leq \beta, S_t = S}.
\end{aligned}
\end{equation*}
Based on previous results, we can see that
\begin{equation*}
\Ex{\pi(S_{t+1}) \,|\, U_{t+1} \leq \beta, S_t = S} \geq \pi(S) + Q(S, S^c).
\end{equation*}
By Lemma \ref{lem:pistmartingale} and the formulas above,
\begin{equation*}
\begin{aligned}
\pi(S) & = \Ex{\pi(S_{t+1}) \,|\, S_t = S} \\
& = \beta \cdot \Ex{\pi(S_{t+1}) \,|\, U_{t+1} \leq \beta, S_t = S} + (1 - \beta) \cdot\Ex{\pi(S_{t+1}) \,|\, U_{t+1} > \beta, S_t = S}.
\end{aligned}
\end{equation*}
Rearranging shows that
\begin{equation*}
\Ex{\pi(S_{t+1}) \,|\, U_{t+1} > \beta, S_t = S} \leq \pi(S) - \frac{\beta Q(S,S^c)}{1 - \beta}.
\end{equation*}
\end{proof}
The derivation of the next lemma closely follows the analysis in~\cite[Chapter 17]{levin2009markov}. For the sake of completeness, a proof can be found in the appendix.
\begin{restatable}{lem}{partone}\label{lem:partone}
For any two states $x,y$,
$
\left| \P^t_{x,y} - \pi_y \right| \leq \frac{\pi_y}{\pi_x} \cdot \Psub{\{x\}}{\tau > t}.
$
\end{restatable}
\begin{proof}
First of all, let the hitting time
\begin{equation*}
\tau = \min\{t \geq 0 : S_t \in \{ \varnothing, \Omega\} \}.
\end{equation*}
We have $S_{\tau} \in \{\varnothing, \Omega\}$ and $\pi(S_{\tau}) = \mathbbm{1}_{ \{S_{\tau} = \Omega \}}$.
We consider an evolving set process with $S_0 = \{x\}$. By Theorem \ref{thm:ost} and Lemma \ref{lem:pistmartingale},
\begin{equation}\label{equ:pixequalspx}
\begin{aligned}
\pi_x & = \Esub{\{x\}}{\pi(S_0)} = \Esub{\{x\}}{\pi(S_{\tau})} = \Esub{\{x\}}{\mathbbm{1}_{ \{S_{\tau} = \Omega \}}} = \Psub{\{x\}}{S_{\tau} = \Omega} = \Psub{\{x\}}{x \in S_{\tau}} \\
\end{aligned}
\end{equation}
For the last equality, it is true because we know that $S_{\tau}$ can only be $\varnothing$ or $\Omega$. Hence, the probability that $x$ is an element in $S_\tau$ is equal to the probability that $S_\tau$ is $\Omega$. Note that here the second $x$ in the last line can be any other element in $\Omega$. For example, we also know that
\begin{equation}\label{equ:Stau}
\forall y \in \Omega, \Psub{\{x\}}{S_\tau = \Omega} = \Psub{\{x\}}{y \in S_\tau}.
\end{equation}
For our bound, we know that by Lemma \ref{lem:ptoevolp} and (\ref{equ:pixequalspx}),
\begin{equation*}
\begin{aligned}
\left| \P^t(x,y) - \pi_y\right| & = \frac{\pi_y}{\pi_x}\left|\Psub{\{x\}}{y \in S_t} - \pi_x \right| = \frac{\pi_y}{\pi_x}\left|\Psub{\{x\}}{y \in S_t} - \Psub{\{x\}}{S_\tau = \Omega} \right|.
\end{aligned}
\end{equation*}
By (\ref{equ:Stau}),
\begin{equation*}
\begin{aligned}
\Psub{\{x\}}{y \in S_t} & = \Psub{\{x\}}{y\in S_t, \tau > t} + \Psub{\{x\}}{y\in S_t, \tau \leq t} \\
& = \Psub{\{x\}}{y\in S_t, \tau > t} + \Psub{\{x\}}{S_\tau = \Omega, \tau \leq t}.
\end{aligned}
\end{equation*}
By simple substitution we obtain
\begin{equation*}
\begin{aligned}
\left| \P^t_{x,y} - \pi_y \right| & = \frac{\pi_y}{\pi_x}\left|\Psub{\{x\}}{y\in S_t, \tau > t} + \Psub{\{x\}}{S_\tau = \Omega, \tau \leq t} - \Psub{\{x\}}{S_\tau = \Omega} \right|\\
& = \frac{\pi_y}{\pi_x}\left|\Psub{\{x\}}{y\in S_t, \tau > t} - \Psub{\{x\}}{S_\tau = \Omega, \tau > t} \right| \\
& \leq \frac{\pi_y}{\pi_x} \Psub{\{x\}}{\tau > t}.
\end{aligned}
\end{equation*}
The last line is true because we remove all possible intersections.
\end{proof}
Now we want to use Proposition \ref{prop:bound} to bound $\Psub{\{x\}}{\tau > t}$. To apply it, we substitute the following parameters: $M_0$ is chosen to be $\pi(\{x\})$, $Y_t$ is $S_t$, and $T = T_1 := \min\{t \geq 0: \pi(S_t) = 0 \ or\ \pi(S_t) \geq 1 \}$. Hence in our case, $\tau$ is the same as $T$ (or $T_1$) in the proposition. The following two lemmas elaborate on the two preconditions (i) and (ii) of Proposition~\ref{prop:bound}.
\begin{restatable}{lem}{parttwo}\label{lem:parttwo}
For any time $t$ and $S_0=\{x\}$,
$
\mathrm{Var}_{S_t}(\pi(S_{t+1})) \geq \beta\pi_{\min}^2\alpha^2.
$
\end{restatable}
\begin{proof}
Conditioning always reduces variance and $S_t \neq \varnothing $ or $ \Omega$, we have
\begin{equation*}
\mathrm{Var}_{S_t}\big(\pi(S_{t+1})\big) \geq \mathrm{Var}_{S_t}\Big(\Ex{\pi(S_{t+1}) \,|\, \mathbbm{1}_{\{U_{t+1} \leq \beta \}}}\Big).
\end{equation*}
For $S_t = S$,
\begin{equation*}
\Esub{S_t}{\pi(S_{t+1}) \,|\, \mathbbm{1}_{\{U_{t+1} \leq \beta \}}} =
\begin{cases}
\Ex{\pi(S_{t+1}) \,|\, U_{t+1} \leq \beta, S_t = S} , & \text{w.p. } \beta, \\
\Ex{\pi(S_{t+1}) \,|\, U_{t+1} > \beta, S_t = S}, & \text{w.p. } 1 - \beta
\end{cases}
\end{equation*}
and by Lemma \ref{lem:generalisedexpi}, we know that
\begin{equation*}
\Esub{S_t}{\pi(S_{t+1}) \,|\, \mathbbm{1}_{\{U_{t+1} \leq \beta \}}}
\begin{cases}
\geq \pi(S) + Q(S, S^c) , & \text{w.p. } \beta, \\
\leq \pi(S) - \frac{\beta Q(S,S^c)}{1 - \beta} , & \text{w.p. } 1 - \beta.
\end{cases}
\end{equation*}
For simplicity, we let $\Esub{S_t}{\pi(S_{t+1}) \,|\, \mathbbm{1}_{\{U_t \leq \beta \}}}$ be $X$, $\Ex{\pi(S_{t+1}) \,|\, U_{t+1} \leq \beta, S_t = S}$ be $x_1$ and $\Ex{\pi(S_{t+1} \,|\, U_{t+1} > \beta, S_t = S)}$ be $x_2$. Then we have
\begin{equation*}
\begin{aligned}
\mathrm{Var}_{S_t}& \Big(\Ex{\pi(S_{t+1}) \,|\, \mathbbm{1}_{\{U_t \leq \beta \}}}\Big) = \Ex{X^2} - \Ex{X}^2 \\
& = \beta x_1^2 + (1 - \beta)x_2^2 - (\beta x_1 + (1-\beta)x_2)^2 = (\beta - \beta^2)(x_1 - x_2)^2
\end{aligned}
\end{equation*}
In order to derive a lower bounds on this variance, based on Lemma \ref{lem:generalisedexpi} we let $x_1 = \pi(S) + Q(S,S^c)$ and $x_2 = \pi(S) - (\beta/1 - \beta)Q(S,S^c)$. With this we obtain
\begin{equation*}
\begin{aligned}
\mathrm{Var}_{S_t} & \Big(\Ex{\pi(S_{t+1}) \,|\, \mathbbm{1}_{\{U_t \leq \beta \}}}\Big) \geq \frac{\beta}{1 - \beta}Q^2(S,S^c).
\end{aligned}
\end{equation*}
Therefore, provided $S_t \notin \{\varnothing, \Omega \}$, we have
\begin{equation*}
\mathrm{Var}_{S_t}\Big( \pi(S_{t+1}) \Big) \geq \frac{\beta}{1 - \beta}Q^2(S, S^c) \geq \frac{\beta \pi_{\min}^2 \alpha^2}{(1 - \beta)}.
\end{equation*}
The last inequality follows from the fact that if $S \notin \{\varnothing, \Omega \}$ then there exist $u \in S, v \notin S$ with $\P_{u,v} > 0$, whence
\begin{equation*}
Q(S, S^c) = \sum_{\substack{s \in S \\ w \in S^c}}\pi_s \P_{s,w} \geq \pi_u \P_{u,v} \geq \pi_{\min}\alpha.
\end{equation*}
Since $1 - \beta < 1$, we finally obtain
\begin{equation*}
\mathrm{Var}_{S_t}(\pi(S_{t+1})) \geq \beta\pi_{\min}^2\alpha^2.
\end{equation*}
\end{proof}
Finally, we derive an upper bound on the amount by which $S_t$ can increase in one iteration.
\begin{restatable}{lem}{partthree}\label{lem:partthree}
For any time $t$ and $S_0=\{x\}$,
$
\pi(S_{t+1}) \leq \left(\frac{1-\beta}{\alpha} + 1\right)\frac{\pi_{\max}}{\pi_{\min}} \cdot \pi(S_{t}).
$
\end{restatable}
\begin{proof}
Since
\begin{equation*}
S_{t+1} = \left\{ y \in \Omega: \frac{\sum_{x \in S_t} \pi_x \P_{x,y}}{\pi_y} \geq U \right\}.
\end{equation*}
If $U$ decreases to $0$, then every $y \in S_{t+1}$ is at least connected to an $x \in S_t$. In other words, $\P_{x,y} > 0$ for $x \in S_t$ and $y \in S_{t+1}$. Hence $|S_{t+1}| \leq (\frac{1 - \beta}{\alpha} + 1)|S_t|$.
We also know that
\begin{equation*}
\begin{aligned}
\pi(S_{t+1}) \leq |S_{t+1}| \cdot \pi_{\max} \leq \left(\frac{1 - \beta}{\alpha} + 1 \right) \cdot |S_t| \cdot \pi_{\max} \leq \left(\frac{1 - \beta}{\alpha} + 1 \right) \cdot \pi(S_t) \cdot \frac{\pi_{\max}}{\pi_{\min}}
\end{aligned}
\end{equation*}
\end{proof}
The proof of Theorem~\ref{thm:markov}
follows then by combining Proposition~\ref{prop:bound}, Lemma \ref{lem:generalisedexpi}, Lemma \ref{lem:partone}, Lemma \ref{lem:parttwo} and Lemma \ref{lem:partthree}.
\begin{proof}[Proof of Theorem~\ref{thm:markov}]
With the help of the previous three lemmas, we can apply Proposition \ref{prop:bound} with $M_0 = \pi_x$, $\sigma \geq \beta^{1/2} \pi_x \alpha$ and $D = \left(\frac{1-\beta}{\alpha}\right) \frac{\pi_{\max}}{\pi_{\min}}$ to obtain
\begin{equation*}
\begin{aligned}
|\P^t_{x,y} - \pi_y| & \leq \frac{\pi_y}{\pi_x}\Psub{\{x\}}{\tau > t}\\
& \leq \frac{\pi_y}{\pi_x} \frac{2\pi_x}{\sigma}\sqrt{\frac{D}{t}} \\
& = \frac{2\pi_y}{\beta^{1/2} \pi_{\min} \alpha}\sqrt{\frac{(\frac{1-\beta}{\alpha} + 1)\frac{\pi_{\max}}{\pi_{\min}}}{t}}\\
& \leq \frac{\pi_{\max}^{3/2}}{\pi_{\min}^{3/2}}\cdot \frac{2}{\beta^{1/2}\alpha} \sqrt{\frac{1-\beta+\alpha}{\alpha t}} \\
\end{aligned}
\end{equation*}
\end{proof}
\subsection{Proof of Theorem~\ref{thm:main3}}
We now prove the following discrepancy bound that depends on the $\lambda(\mathbf{M})$, as defined in Section \ref{sec:def}.
\begin{proof}
By \cite[Lemma 2.4]{SS12}, for any pair of vertices $u,v \in V$,
$
\left| \mathbf{M}^t_{u,v} - \frac{1}{n} \right| \leq \lambda(\mathbf{M})^{t/2}.
$
Hence by Lemma~\ref{lem:twonodestoavg} $\left\| \mathbf{M}^t_{.,u} - \mathbf{M}^t_{.,v} \right\|_2 = O(\lambda(\mathbf{M})^{t/4})$, and the bound on the discrepancy follows from Theorem~\ref{thm:main1} and the union bound over all vertices.
\end{proof}
\section{Applications to Different Graph Topologies}\label{sec:application}
\textbf{Cycles.} Recall that for the cycle, $V=\{0,\ldots,n-1\}$ is the set of vertices, and the distance between two vertices is $\operatorname{dist}(x,y) = \min\{y-x, x+n-y \}$ for any pair of vertices $x < y $.
The upper bound on the discrepancy follows directly from Theorem~\ref{thm:maintwo}, and it only remains to prove the lower bound. To this end, we will apply the lower bound in Theorem~\ref{thm:main1} and need to derive a lower bound on
$ \| \mathbf{M}_{.,u}^t - \mathbf{ \frac{1}{n}} \|_2^2$. Intuitively, if we had a simple random walk, we could immediately infer that this quantity is $\Omega( 1/\sqrt{t})$, since after $t$ steps, the random walk is with probability $\approx 1/\sqrt{t}$ at any vertex with distance at most $O(\sqrt{t})$. To prove that this also holds for the load balancing process, we first derive a concentration inequality that upper bounds the probability for the random walk to reach a distant state:
\begin{restatable}{lem}{upper}\label{lem:upper}
Consider the standard balancing circuit model on the cycle with round matrix $\mathbf{M}$. Then for any $u \in V$ and $\delta \in (0,n/2-1)$, we have
\begin{equation*}
\begin{aligned}
\sum_{v \in V \colon \operatorname{dist}(u,v) \geq \delta} \mathbf{M}^t_{u,v} \leq 2 \cdot \exp\left( - \frac{(\delta-2)^2}{8t} \right).
\end{aligned}
\end{equation*}
\end{restatable}
\begin{proof}
The proof of the lemma above makes uses of the following variant of Azuma's concentration inequality for martingales, which can be for instance found in McDiarmid's survey on concentration inequalities.
\begin{lem}[{\cite[Theorem 3.13 \& Inequality 41]{McD98}}]\label{lem:mcdiarmid}
Let $Z_1,Z_2,\ldots,Z_n$ be a martingale difference sequence with $a_k \leq Z_k \leq b_k$ for each $k$, for suitable constants $a_k, b_k$. Then for any $\delta \geq 0$,
\begin{equation*}
\begin{aligned}
\Pro{ \max_{1 \leq j \leq n} \left| \sum_{i=1}^j Z_i \right| > \delta } &\leq 2 \cdot \exp\left(- \frac{2 \delta^2}{\sum_{k=1}^n (b_k-a_k)^2} \right).
\end{aligned}
\end{equation*}
\end{lem}
Note that the balancing circuit on the cycle corresponds to the following random walk $(X_1,X_2,\ldots,X_{t})$ on the vertex set $V= \{-n/2+1,\ldots,0,\ldots,n/2-1\}$, where for any time-step $t \in \mathbb{N}$, $X_t$ denotes the position of the random walk after step $t$. First, we consider the transition for any odd $s$: If $X_s$ is odd, then with probability $1/2$, $X_{s+1} = X_{s}+1$ and otherwise $X_{s+1}=X_s$. If $X_s$ is even, then with probability $1/2$, $X_{s+1}=X_s-1$ and otherwise $X_{s+1}=X_s$ (additions and subtractions are under the implicit assumptions that $-n/2+1 \equiv n/2-1$ and $n/2 \equiv -n/2+1$). The case for even $s$ is analogous.
We will couple the random walk $(X_t)_{t \geq 0}$ with another random walk $(Y_t)_{t \geq 0}$ on the integers $\mathbb{N}$, where again $Y_t$ denotes the position of the walk after step $t$. The transition probabilities are exactly the same as for the walk $(X_t)_{t \geq 0}$, the only difference is that we don't use the equivalences $-n/2+1 \equiv n/2-1$ and $n/2 \equiv -n/2+1$. It is clear that we can couple the transitions of the two walks so that they evolve identically as long as the walks do not reach any of the two boundary points $-n/2+1$ or $n/2-1$.
Let us first analyze $\Ex{Y_t}$ for an odd time step. As described above, the distribution of $Y_t-Y_{t-1}$ depends on whether $Y_{t-1}$ is even or not. However, notice regardless of where the random walk is at step $t-2$, the random walk will be at an odd or even vertex at step $t-1$ with probability $1/2$ each. Hence for any starting position $y$,
\begin{align*}
\lefteqn{ \Ex{ Y_{t} - Y_{t-1} \, \mid \, Y_{0} = y } } \\
&= \Pro{ Y_{t-1} \mbox{~even} } \cdot \left( \frac{1}{2} \cdot 1 + \frac{1}{2} \cdot 0 \right) + \Pro{ Y_{t-1} \mbox{~odd} } \cdot \left( \frac{1}{2} \cdot (-1) + \frac{1}{2} \cdot 0 \right) = 0,
\end{align*}
and further,
\begin{align*}
| Y_{1} - Y_{0} | \leq 1.
\end{align*}
Combining the last two inequalities shows that for any start vertex $y$,
\begin{align*}
\left| \Ex{ Y_{t} \, \mid \, Y_0 = y } - y \right| \leq 1.
\end{align*}
With the same arguments as before we conclude that for any fixed start vertex $Y_0=y_0$,
\begin{align*}
\max_{a,b \in V} \left| \Ex{ Y_{t} - Y_{t-1} \, \mid \, Y_1=a }
- \Ex{ Y_{t} - Y_{t-1} \, \mid \, Y_1=b } \right| \leq 2,
\end{align*}
because the expected differences of $Y_{t} - Y_{t-1}$ are all zero whenever $t \geq 3$.
Let us now consider the martingale $W_i = \Ex{ Y_t \, \mid \, Y_0,Y_1,\ldots,Y_i }$,
and let $Z_i := W_{i} - W_{i-1}$ be the corresponding martingale difference sequence. As shown before, $|W_{i}-W_{i-1} | \leq 2$. Hence by Lemma~\ref{lem:mcdiarmid},
\begin{align*}
\Pro{ \max_{1 \leq j \leq t} \left| \sum_{i=1}^j Z_i \right| \geq \delta } &\leq 2 \cdot \exp\left( -\frac{ \delta^2 }{ 8 \cdot t } \right)
\end{align*}
If for every $1 \leq j \leq t$, $ \sum_{i=1}^j W_i < \delta$ holds, then this implies both random walks $(X_t)_{t \geq 0}$ and $(Y_t)_{t \geq 0}$ behave identically since none of them ever reaches any of the two boundary points $-n/2+1$ or $n/2-1$. In particular we conclude that for the original walk $(X_t)_{t \geq 0}$,
\begin{align*}
\sum_{v \in V: \operatorname{dist}(u,v) \geq \delta} \mathbf{M}^t_{u,v} &=
\Pro{ \left| \sum_{i=1}^t X_i \right| \geq \delta } \\ &\leq
\Pro{ \max_{1 \leq j \leq t} \left| \sum_{i=1}^j X_t \right| \geq \delta } \\ &=
\Pro{ \max_{1 \leq j \leq t} \left| \sum_{i=1}^j Y_t \right| \geq \delta }
\\ &\leq
\Pro{ \max_{1 \leq j \leq t} \left| \sum_{i=1}^j Z_t \right| \geq \delta -2 }
\leq 2 \cdot \exp\left( -\frac{ (\delta-2)^2 }{ 8 \cdot t } \right),
\end{align*}
where the second-to-last inequality is due to the fact that $\Ex{ \left| \sum_{i=1}^j Y_t \right| } \leq 2$.
\end{proof}
With the help Lemma~\ref{lem:upper}, we can indeed verify our intuition:
\begin{restatable}{lem}{intuition}\label{lem:intuition}
Consider the standard balancing circuit model on the cycle with round matrix $\mathbf{M}$. Then for any vertex $u \in V$,
$ \| \mathbf{M}_{.,u}^t - \mathbf{ \frac{1}{n}} \|_2^2 = \Omega(1/\sqrt{t})$.
\end{restatable}
\begin{proof}
Define $S_{\delta} := \{ w \in V: \operatorname{dist}(w, u) \leq \delta \}$, so that $| S_\delta | = 2\delta$. With $\delta = 20\sqrt{t}$ and $t \geq 10$
\begin{align*}
\sum_{w \in S_{\delta}}\mathbf{M}^t_{w,u} & = 1 - \sum_{w \notin S_\delta} \mathbf{M}^t_{w,u} \geq 1 - 2\cdot \exp\left( -\frac{(\delta - 2)^2}{8t}\right) \geq \frac{1}{2}.
\end{align*}
By Cauchy-Schwarz inequality,
\begin{equation*}
\begin{aligned}
\| \mathbf{M}_{w,\cdot}^t \|_2^2 &\geq \sum_{w \in S_{\delta}} \left(\mathbf{M}^t_{w,u} \right)^2 & \geq \frac{1}{2\delta} \left( \sum_{w \in S{_\delta}}\mathbf{M}^t_{w,u} \right)^2 \geq \frac{1}{2\delta}\left(\frac{1}{2}\right)^2 = \Omega(t^{-1/2}).
\end{aligned}
\end{equation*}
\end{proof}
Lemma~\ref{lem:intuition} also proves that the factor $\sqrt{1/t}$ in the upper bound in Theorem~\ref{thm:markov} is best possible.
The lower bound on the discrepancy now follows by combining Lemma~\ref{lem:intuition} with Theorem~\ref{thm:main1} and Lemma~\ref{lem:twonodestoavg} stating that for any vertex $u \in V$, there exists another vertex $v \in V$ such that $ \| \mathbf{M}_{.,u}^t - \mathbf{M}_{.,v}^t \|_2^2 \geq \| \mathbf{M}_{.,u}^t - \mathbf{ \frac{1}{n}} \|_2^2 =\Omega(1/\sqrt{t})$.
\bigskip
\noindent \textbf{Tori.}
In this section we consider $r$-dimensional tori, where $r \geq 1$ is any constant.
For the upper bound, note that the computation of $\mathbf{M}^t_{.,.}$ can be decomposed to independent computations in the $r$ dimensions, and each dimension has the same distribution as the cycle on $n^{1/r}$ vertices. Specifically, if we denote by $\widetilde{\mathbf{M}}$ the round matrix of the standard balancing circuit scheme on the cycle with $n^{1/r}$ vertices and $\mathbf{M}$ is the round matrix of the $r$-dimensional torus with $n$ vertices, then for any pair of vertices $x=(x_1,\ldots,x_r), v=(y_1,\ldots,y_r)$ on the torus we have
$
\mathbf{M}_{x,y}^t = \prod_{i=1}^r \widetilde{\mathbf{M}}_{x_i,y_i}^t.
$
From Theorem~\ref{thm:markov}, $| \widetilde{\mathbf{M}}_{x_i,y_i}^t - \frac{1}{n^{1/r}} | = O(t^{-1/2})$, and therefore, since $r$ is constant,
\begin{align*}
\mathbf{M}_{x,y}^t &\leq \prod_{i=1}^r \left( \frac{1}{n^{1/r}} + O(t^{-1/2}) \right)
= O( t^{-r/2} + n^{-1}),
\end{align*}
and thus $\left\| \mathbf{M}_{x,y}^t - \mathbf{\frac{1}{n}} \right\|_2^2 = O(t^{-r/2})$ for any pair of vertices $x,y$. Hence by Lemma~\ref{lem:twonodestoavg}, $ \left \| \mathbf{M}_{.,u}^t - \mathbf{M}_{.,v}^t \right \|_{2}^2 = O( t^{-r/2})$. Plugging this bound into Theorem~\ref{thm:main1} yields that the load difference between any pair of the nodes $u$ and $v$ at round $t$ is at most
$ O( t^{-r/4} \cdot \sigma \cdot \log^{3/2} n + \sqrt{\log n})$ with probability at least $1-2 n^{-2}$. The bound on the discrepancy now simply follows by the union bound.
We now turn to the lower bound on the discrepancy. With the same derivation as in Lemma~\ref{lem:intuition} we obtain the following result:
\begin{restatable}{lem}{intuitiontwo}\label{lem:intuitiontwo}
Consider the standard balancing circuit model on the $r$-dimensional torus with round matrix $\mathbf{M}$. Then for any vertex $u \in V$,
$ \| \mathbf{M}_{.,u}^t - \mathbf{ \frac{1}{n}} \|_2^2 = \Omega(t^{-r/2})$.
\end{restatable}
As before, the lower bound on the torus now follows by combining Lemma~\ref{lem:intuitiontwo} with the general lower bound given in Theorem~\ref{thm:main1}.
\bigskip
\noindent\textbf{Expanders.}
The upper bound $O(\lambda(\mathbf{M})^{t/4} \cdot \sigma \cdot (\log n)^{3/2} + \sqrt{\log n})$ for expanders follows immediately from Theorem~\ref{thm:main3}.
For the lower bound, since the round matrix consists of $d$ matchings, it is easy to verify that whenever $\mathbf{M}_{u,v}^{t} > 0$, we have $\mathbf{M}_{u,v}^t \geq 2^{-d \cdot t}$. Consequently, for any vertex $u \in V$, $\left\| \mathbf{M}_{.,u}^t - \mathbf{\frac{1}{n}} \right\|_2^2
=\Omega( 2^{-d \cdot t})$. Plugging this into Theorem~\ref{thm:main1} yields a lower bound on the discrepancy which is $\Omega( 2^{-d \cdot t/2} \cdot \sigma / \sqrt{\log \sigma})$.
\bigskip
\noindent \textbf{Hypercubes.}
For the hypercube, there is a worst-case bound of $\log_2 \log_2 n + O(1)$ \cite[Theorem 5.1 $\&$ 5.3]{mavronicolas2010impact} for any input after $\log_2 n$ iterations of the dimension-exchange, i.e., after one execution of the round matrix. Hence, we will only analyze the discrepancy after $s$ matchings, where $1 \leq s < \log_2 n$.
The derivation of the lower bound is almost analogous to the one for expanders, since for any pair of vertices $u,v$, $\prod_{i=s}^t \mathbf{M}_{u,v}^{(s)} \in \{0,2^{-t}\}$ (recall that $\mathbf{M}_{.,.}^{(s)}$ is the matching applied in the $s$-step of the dimension exchange). The only difference is that we are counting matchings individually and not full periods. By applying the same analysis as in Theorem~\ref{thm:main3}, but with the stronger inequality $| \prod_{s=1}^t \mathbf{M}_{u,v}^{(s)} - \frac{1}{n} | \leq 2^{-t}$, and we obtain that the upper bound of the discrepancy is $O(2^{-t/2} \cdot \sigma \cdot (\log n)^{3/2} + \sqrt{\log n})$. Applying Theorem~\ref{thm:main1}, we obtain the lower bound $\Omega( 2^{-t/2} \cdot \sigma / \sqrt{\log \sigma} )$.
\section{Discussion and Empirical Results}\label{sec:discussion}
\subsection{Average-Case versus Worst-Case}
We will now compare our average-case to a worst-case scenario on cycles, 2D-tori and hypercubes. For the sake of concreteness, we always assume that the input is drawn from the uniform distribution $\mathsf{Uni}[0,2K]$, where $K$ will be specified later. Note that the total number of tokens is $\approx n \cdot K$, and the initial discrepancy will be $\Theta(K)$. Our choice for the worst-case load vector will have the same number of tokens and initial discrepancy, however, the exact definition of the vector as well as the choice of the parameter $K$ will depend on the underlying topology.
\textbf{Cycles.}
As one representative of a worst-case setting, fix an arbitrary node $u \in V$ and let all nodes with distance at most $n/4$ initially have a load of $2K$ while all other nodes have load $0$. This gives rise to a load vector with $n \cdot K$ tokens and initial discrepancy $2K$.
\textbf{2D-Tori.} Again, we fix an arbitrary node $u \in V$ and assign a load of $2K$ to the $n/2$-nearest neighbors of $u$ and load $0$ to the other nodes. Again, this defines a load vector with $n \cdot K$ tokens and initial discrepancy $2K$.
The next result provides a lower bound on the discrepancy for cycles and 2D-tori in the aforementioned worst-case setting. It essentially shows that for worst-case inputs, $\Omega(n^2)$ rounds and $\Omega(n)$ rounds are necessary for the cycle, 2D-tori, respectively, in order to reduce the discrepancy by more than a constant factor. This stands in sharp contrast to Theorem~\ref{thm:maintwo}, proving a decay of the discrepancy by $\approx t^{-1/4}$, starting from the first round.
\begin{restatable}{proposition}{worstcase} \label{pro:worstcase}
For the aforementioned worst-case setting on the cycle, it holds for any round $t > 0$ that
$
\operatorname{disc}(x^{(t)}) \geq \frac{1}{8} \cdot K \cdot \left(1 - \exp \left( - \frac{n^2}{2048 t} \right) \right) - \sqrt{48 \log n},
$
with probability at least $1-n^{-1}$.
Further, for 2D-tori, it holds for any round $t > 0$ that
$
\operatorname{disc}(x^{(t)}) \geq \frac{1}{8} \cdot K \cdot \left(1 - \exp \left( - \frac{n}{2048 t} \right) \right) - \sqrt{48 \log n},
$
with probability at least $1-n^{-1}$.
\end{restatable}
\begin{proof}
We first consider the case of a cycle.
Let $S_1$ be the subset of nodes that have a non-zero initial load; so $|S_1|=n/2$. Clearly, there is a subset of nodes $S_2 \subseteq V$ with $|S_2| = n/8$ so that for each node $u \in S_2$, only nodes $v$ with $\operatorname{dist}(u,v) \geq n/16$ can have $x_v^{(0)} > 0$.
We will now derive a lower bound on the discrepancy in this worst-case setting by upper bounding the load of vertices in the subset $S_2$. To lower bound the discrepancy at round $t$, recall that by Lemma~\ref{lem:upper} we have that
\begin{align*}
\sum_{v \in V \colon \operatorname{dist}(u,v) \geq \delta} \mathbf{M}^{t}_{u,v} \leq 2 \cdot \exp \left( - \frac{(\delta-2)^2}{8t} \right).
\end{align*}
Let us now choose $\delta=n/16$, and we thus conclude that
\begin{align*}
\sum_{u \in S_1} \sum_{v \in S_2} \mathbf{M}^{t}_{u,v} &\leq
\sum_{u \in S_1} \sum_{v \in V \colon \operatorname{dist}(u,v) \geq \delta} \mathbf{M}^{t}_{u,v} \leq 2 \cdot |S_1| \cdot \exp \left( - \frac{n^2}{2048 t} \right).
\end{align*}
This implies for the total load of vertices in $S_2$ at time $t$:
\begin{align*}
\sum_{v \in S_2} \xi_v^{(t)} &= \sum_{v \in S_2} \sum_{u \in S_1} \xi_u^{(0)} \cdot \mathbf{M}_{u,v}^{(t)} \\
&= 2 K \sum_{u \in S_1} \sum_{v \in S_2} \mathbf{M}^{(t)}_{u,v} \\
&\leq K \cdot n \cdot \exp \left( - \frac{n^2}{2048 t} \right),
\end{align*}
where $K$ is the average load.
Recalling that $|S_2|=n/8$, by the pigeonhole principle there exists a node $v \in S_2$ such that
\begin{align*}
\xi_v^{(t)} &\geq \frac{1}{|S_2|} \cdot K \cdot n \cdot \exp \left( - \frac{n^2}{2048 t} \right) \geq \frac{1}{8} \cdot K \cdot \exp \left( - \frac{n^2}{2048 t} \right).
\end{align*}
%
%
%
This immediately implies the following lower bound on the discrepancy:
\begin{align*}
\operatorname{disc}(\xi^{(t)}) &\geq \bar{\xi} - \xi_v^{(t)} \geq \bar{\xi} \cdot \left(1 - \exp \left( - \frac{n^2}{2048 t} \right) \right),
\end{align*}
where $\bar{\xi} = K$ is the average load.
The corresponding lower bound on $\operatorname{disc}(x^{(t)})$ follows by Theorem~\ref{thm:errorbound} and the union bound.
The proof for the 2-dimensional torus is almost identical. Again, let $S_1$ be the set of nodes that have a non-zero load. Clearly, there is a subset $S_2 \subseteq V$ with $|S_2|=n/8$ so that for each node $u \in S_2$, only nodes $v$ with $\operatorname{dist}(u,v) \geq \sqrt{n}/16$ can have $x_v^{(0)} > 0$.
Let us now view $\mathbf{M}$ as the transition matrix of a Markov chain. Then $\mathbf{M}^{t}$ is obtained by running two independent Markov chains (one for each dimension), where each of the two Markov chains corresponds to the round matrix of the cycle. We can still apply Lemma~\ref{lem:upper} as before, even though here the size of each cycle is $\sqrt{n}$, to obtain that
\begin{align*}
\sum_{v \in V \colon \operatorname{dist}(u,v) \geq \delta} \mathbf{M}^{t}_{u,v} \leq 2 \cdot \exp \left( - \frac{(\delta-2)^2}{8t} \right).
\end{align*}
Here we choose $\delta=\sqrt{n}/16$, and the remaining part of the proof is exactly the same as before.
\end{proof}
\textbf{Hypercube.} Regarding the hypercube, we will consider only $\log_2 n$ rounds, since the discrepancy is $\log \log_2 n +O(1)$ after $\log_2 n$ rounds and $O(1)$ after $2 \log_2 n$ rounds \cite{mavronicolas2010impact}. A natural corresponding worst-case distribution is to have load $2 K$ on all nodes whose $\log_2 n$-th bit is equal to one and load $0$ otherwise. This way, the discrepancy is only reduced in the final round $\log_2 n$.
\subsection{Experimental Setup}
For each of the three graphs cycles, 2D-tori and hypercube, we consider two comparative experiments with an average-case load vector and a worst-case initial load vector each. The plots and tables on the next two pages display the results, where for each case we took the average discrepancy over 10 independent runs.
The first experiment considers a ``lightly loaded case'', where the theoretical results suggest that a small (i.e., constant or logarithmic) discrepancy is reached well before the expected ``worst-case load balancing times'', which are $\approx n^2$ for cycles and $\approx n$ for 2D-tori. The second experiments considers a ``heavily loaded case'', where the theoretical results suggest that a small discrepancy is not reached faster than in the worst-case.
Specifically, for cycles and 2D-tori, we choose for the lightly loaded case $K=\sqrt{n}$ and for the heavily loaded case $K=n^2$. The experiments confirm the theoretical results in the sense that for both choices of $K$, we have a much quicker convergence of the discrepancy than in the corresponding worst cases. However, the experiments also demonstrate that only in the lightly loaded case we reach a small discrepancy quickly, whereas in the heavily loaded case there is no big difference between worst-case and average-case if it comes to the time to reach a small discrepancy.
On the hypercube, since we are interested in the case where $1 \leq t \leq \log_2 n$, our bounds on the discrepancy indicates that we should choose $K$ smaller than in the case of cycles and 2D-tori. That is why we choose $K=n^{1/4}$ in the lightly loaded case and $K=n$ in the heavily loaded case (As a side remark, we note that due to the symmetry of the hypercube, any initial load vector sampled from $\mathsf{Uni}[0,\beta \cdot (n-1)]$ is equivalent to an initial load vector sampled from $\mathsf{Uni}[0, n-1]$.) With these adjustments of $K$ in both cases, the experimental results of the hypercube are inline with the ones for the cycle and 2D-tori.
The details of the experiments containing plots and tables with the sampled discrepancies can be found on the following two pages (Section~\ref{sec:experiments}).
\newpage
| {'timestamp': '2017-03-28T02:04:22', 'yymm': '1703', 'arxiv_id': '1703.08702', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08702'} | arxiv |
\section{Introduction}
A covering array $CA(n,k,g)$ is a $k\times n$ array on $\mathbb{Z}_g$ with the property that any two rows are qualitatively independent. The number $n$ of columns
in such array is called its size. The smallest possible size of a covering array is denoted
\begin{equation*}
CAN(k,g)=\min_{n\in \mathbb{N}}\{n~:~ \mbox{there exists a } CA(n,k,g)\}
\end{equation*}
Covering arrays are generalisations of both orthogonal arrays and Sperner systems. Bounds and constructions of covering arrays have been derived from algebra, design theory, graph theory, set systems
and intersecting codes \cite{chatea, kleitman, sloane, stevens1}. Covering arrays have industrial applications in many disparate applications in which factors or components interact, for example, software and circuit testing, switching networks, drug screening and data compression \cite{korner,ser,Cohen}. In \cite{karen}, the definition of a covering array has been extended to include a graph structure.
\begin{definition}\rm (Covering arrays on graph). A covering array on a graph $G$ with alphabet size $g$ and $k=|V(G)|$ is a $k\times n$ array on $\mathbb{Z}_g$.
Each row in the array corresponds to a vertex in the graph $G$. The array has the property that any two rows which correspond to adjacent vertices in $G$ are qualitatively independent.
\end{definition}
\noindent A covering array on a graph $G$ will be denoted by $CA(n,G,g)$. The smallest possible covering array on a graph $G$ will be denoted
\begin{equation*}
CAN(G,g)=\min_{n\in \mathbb{N}}\{n~:~ \mbox{there exists a } CA(n,G,g)\}
\end{equation*}
Given a graph $G$ and a positive integer $g$, a covering array on $G$ with minimum size is called {\it optimal}. Seroussi and Bshouly proved that determining the existence of an optimal binary
covering array on a graph is an NP-complete problem \cite{ser}. We start with a review of some definitions and results from product graphs in Section \ref{productgraph}. In Section \ref{bound},
we show that for all graphs $G_1$ and $G_2$,
$$\max_{i=1,2}\{CAN(G_i,g)\}\leq CAN(G_1\Box G_2,g)\leq CAN( \max_{i=1,2}\{\chi(G_i)\},g).$$ We look for graphs $G_1$ and $G_2$ where the lower bound on $CAN(G_1\Box G_2)$ is
achieved. In Section \ref{Cayley}, we give families of Cayley graphs that achieves this lower bound on covering array number on graph product. In Section \ref{Approx}, we present a polynomial time
approximation algorithm with approximation ratio $\log(\frac{V}{2^{k-1}})$ for constructing covering array on
graph $G=(V,E)$ having more than one prime factor with respect to the Cartesian product.
\section{Preliminaries} \label{productgraph}
In this section, we give several definitions from product graphs that we use in this article.
A graph product is a binary operation on the set of all finite graphs. However among all possible associative graph products
the most extensively studied in literature are the Cartesian product, the direct product,
the strong product and the lexicographic product.
\begin{definition}\rm
The Cartesian product of graphs $G$ and $H$, denoted by $G\Box H$, is the graph with
\begin{center}
$V(G\Box H) = \{(g, h) \lvert g\in V(G) \mbox{ and } h \in V(H)\}$,
\\ $E(G\Box H) = \{ (g, h)(g', h') \lvert g = g', hh' \in E(H), \mbox{ or } gg' \in E(G), h=h' \}$.
\end{center}
The graphs $G$ and $H$ are called the {\it factors} of the product $G \Box H$.
\end{definition}
\noindent In general, given graphs $G_1,G_2,...,G_k$, then $G_1 \Box G_2 \Box \cdots \Box G_k$, is the graph with vertex set
$V(G_1) \times V(G_2) \times \cdots \times V(G_k) $, and two vertices $(x_1,x_2,\ldots, x_k)$ and
$(y_1, y_2,\ldots,y_k)$ are adjacent if and only if $x_iy_i \in E(G_i)$ for exactly one index $1\leq i\leq k$ and $x_j = y_j$ for each index $j \not= i$.\\
\begin{definition}\rm
The direct product of graphs $G_1,G_2,...,G_k$, denoted by $G_1\times G_2\times \cdots \times G_k$, is the graph with vertex
set $V(G_1) \times V(G_2) \times \cdots \times V(G_k) $, and for which vertices $(x_1,x_2,...,x_k)$ and $(y_1,y_2,...,y_k)$ are
adjacent precisely if $x_iy_i \in E(G_i)$ for each index $i$.
\end{definition}
\begin{definition}\rm
The strong product of graphs $G_1,G_2,...,G_k$, denoted by $G_1\boxtimes G_2\boxtimes \cdots \boxtimes G_k$, is the graph with vertex set
$V(G_1) \times V(G_2) \times \cdots \times V(G_k) $, and distinct vertices $(x_1,x_2,\ldots,x_k)$ and $(y_1,y_2,\ldots,y_k)$ are adjacent if and only if
either $x_iy_i\in E(G_i)$ or $x_i=y_i$ for each $1\leq i\leq k$. We note that in general $E(\boxtimes_{i=1}^k {G_i}) \neq E(\Box_{i=1}^k G_i) \cup E(\times_{i=1}^k G_i)$, unless $k=2$.
\end{definition}
\begin{definition}\rm
The lexicographic product of graphs $G_1,G_2,...,G_k$, denoted by $G_1\circ G_2\circ \cdots \circ G_k$, is the graph with
vertex set $V(G_1) \times V(G_2) \times \cdots \times V(G_k) $, and two vertices $(x_1,x_2,...,x_k)$ and $(y_1,y_2,...,y_k)$ are
adjacent if and only if for some index $j\in \{1,2,...,k\}$ we have $x_jy_j \in E(G_j)$ and $x_i =y_i$ for each index $1\leq i < j$.
\end{definition}
Let $G$ and $H$ be graphs with vertex sets $V(G)$ and $V(H)$, respectively. A {\it homomorphism} from $G$ to $H$ is a map
$\varphi~:~V(G)\rightarrow V(H)$ that preserves adjacency: if $uv$ is an edge in $G$, then $\varphi(u)\varphi(v)$ is an edge in $H$.
We say $G\rightarrow H$ if there is a homomorphism from $G$ to $H$, and $G \equiv H$ if $G\rightarrow H$ and $H\rightarrow G$.
A {\it weak homomorphism} from $G$ to $H$ is a map $\varphi~:~V(G)\rightarrow V(H)$ such that if $uv$ is an edge in $G$, then either
$\varphi(u)\varphi(v)$ is an edge in $H$, or $\varphi(u)=\varphi(v)$. Clearly every homomorphism is automatically a weak homomorphism.
Let $\ast$ represent either the Cartesian, the direct or the strong product of graphs, and consider a product $G_1\ast G_2\ast \ldots\ast G_k$.
For any index $i$, $1\leq i\leq k$, a {\it projection map} is defined as:
$$p_i~:~G_1\ast G_2\ast \ldots\ast G_k \rightarrow G_i ~\mbox{where} ~p_i(x_1,x_2,\ldots,x_k)=x_i.$$ By the definition of the Cartesian, the direct, and the strong product of
graphs, each $p_i$ is a weak homomorphism. In the case of direct product, as $(x_1,x_2,\ldots,x_k)(y_1,y_2,\ldots,y_k)$ is an an edge of $G_1\times G_2 \times,\ldots,\times G_k$
if and only if $x_iy_i\in E(G_i)$ for each $1\leq i\leq k$., each projection $p_i$ is actually a homomorphism. In the case of lexicographic product, the first projection map that is projection on first component is a weak homomorphism, where as in general the projections to the other
components are not weak homomorphisms. \\
A graph is {\it prime} with respect to a given graph product if it is nontrivial and cannot be represented as the product of two nontrivial
graphs. For the Cartesian product,
it means that a nontrivial graph $G$ is prime if $G=G_1\Box G_2$ implies that either $G_1$ or $G_2$ is $K_1$. Similar observation is
true for other three products. The uniqueness of the prime factor decomposition of connected graphs with respect to the
Cartesian product was first shown by Subidussi $(1960)$, and independently by Vizing $(1963)$. Prime factorization is not unique
for the Cartesian product in the class of possibly disconnected simple graphs \cite{HBGP}. It is known that any connected graph factors
uniquely into prime graphs with respect to the Cartesian product.
\begin{theorem}(Sabidussi-Vizing)
Every connected graph has a unique representation as a product of prime graphs, up to isomorphism and the order of the factors. The number of prime factors is
at most $\log_2 {V}$.
\end{theorem}
\noindent For any connected graph $G=(V,E)$, the prime factors of $G$ with respect to the Cartesian product can be computed in $O(E \log V) $ times and $O(E)$ space. See Chapter 23, \cite{HBGP}.
\section{Graph products and covering arrays}\label{bound}
Let $\ast$ represent either the Cartesian, the direct, the strong, or the lexicographic product operation.
Given covering arrays $CA(n_1,G_1,g)$ and $CA(n_2,G_2,g)$, one can construct covering array on $G_1 \ast G_2$ as follows: the row corresponds
to the vertex $(a,b)$ is obtained by horizontally concatenating the row corresponds to the vertex $a$ in $CA(n_1,G_1,g)$ with the row
corresponds to the vertex $b$ in $CA(n_2,G_2,g)$. Hence an obvious upper bound for the covering array number is given by
\begin{center}
$CAN(G_1 \ast G_2, g) \leq CAN(G_1, g) + CAN(G_2, g) $
\end{center}
We now propose some improvements of this bound. A column of a covering array is {\it constant} if, for some symbol $v$, every entry in the
column is $v$. In a {\it standardized } $CA(n,G,g)$ the first column is constant. Because symbols within each row can be permuted independently,
if a $CA(n,G,g)$ exists, then a standardized $CA(n,G,g)$ exists.
\begin{theorem}
Let $G=G_1\boxtimes G_2\boxtimes \cdots \boxtimes G_k$, $k\geq 2$ and $g$ be a positive integer.
Suppose for each $1\leq i\leq k$ there exists a $CA(n_i,G_i,g)$, then there exists a
$CA(n,G,g)$ where $n=\underset{i=1}{\overset{k}\sum} n_i -k$. Hence,
$CAN(G,g)\leq \underset{i=1}{\overset{k}\sum} CAN(G_i,g)-k$.
\end{theorem}
\begin{proof} Without loss of generality, we assume that for each $1\leq i\leq g$, the first column of $CA(n_i,G_i,g)$
is a constant column on symbol $i$ and for each $g+1\leq i\leq k$, the first column of $CA(n_i,G_i,g)$ is a constant
column on symbol 1.
Let $C_i$ be the array
obtained from $CA(n_i,G_i,g)$ by removing the first column. Form an array $A$ with
$\underset{i=1}{\overset{k}\prod} |V(G_i)|$ rows and
$\underset{i=1}{\overset{k}\sum} n_i -k$ columns, indexing rows as $(v_1,v_2,...,v_k)$, where $v_i\in V(G_i)$.
Row $(v_1,v_2,...,v_k)$ is
obtained by horizontally concatenating the rows correspond to the vertex $v_i$ of $C_i$, for $1\leq i\leq k$.
Consider two distinct rows $(u_1,u_2,\ldots,u_k)$ and $(v_1,v_2,\ldots,v_k)$ of $A$ which correspond to adjacent vertices in $G$.
Two distinct vertices $(u_1,u_2,\ldots,u_k)$ and $(v_1,v_2,\ldots,v_k)$ are adjacent if and only if
either $u_iv_i\in E(G_i)$ or $u_i=v_i$ for each $1\leq i\leq k$. Since the vertices are distinct, $u_iv_i\in E(G_i)$ for at least one index $i$.
When $u_i=v_i$, all pairs of the form $(a,a)$ are covered. When $u_iv_i\in E(G_i)$ all remaining pairs are covered because two different rows of $C_i$ correspond to adjacent vertices in $G_i$ are selected.
\end{proof}
\noindent Using the definition of strong product of graphs we have following result as a corollary.
\begin{corollary}
Let $G=G_1\ast G_2\ast \cdots \ast G_k$, $k\geq 2$ and $g$ be a positive integer, where $\ast\in\{\Box,\times\}$. Then,
$CAN(G,g)\leq \underset{i=1}{\overset{k}\sum} CAN(G_i,g)-k$.
\end{corollary}
\noindent The lemma given below will be used in Theorem \ref{product}.
\begin{lemma}\label{karenlemma} (Meagher and Stevens \cite{karen})
Let $G$ and $H$ be graphs. If $G\rightarrow H$ then $CAN(G,g)\leq CAN(H,g)$.
\end{lemma}
\begin{theorem}\label{product}
Let $G=G_1\times G_2\times \cdots \times G_k$, $k\geq 2$ and $g$ be a positive integer.
Suppose for each $1\leq i\leq k$ there exists a $CA(n_i,G_i,g)$. Then there exists a
$CA(n,G,g)$ where $n=\min\limits_{i} n_i$. Hence, $CAN(G,g)\leq \underset{i}{\overset{}\min}$ $ CAN(G_i,g)$.
\end{theorem}
\begin{proof}
Without loss of generality assume that $n_1 = \min\limits_{i} {n_i} $. It is known that $G_1\times G_2\times \cdots \times G_k\rightarrow G_1$. Using Lemma \ref{karenlemma}, we have $CAN(G,g)\leq CAN(G_1,g)$.
\end{proof}
\begin{theorem}
Let $G=G_1\circ G_2\circ \cdots \circ G_k$, $k\geq 2$ and $g$ be a positive integer.
Suppose for each $1\leq i\leq k$ there exists a $CA(n_i,G_i,g)$. Then there exists a
$CA(n,G,g)$ where $n=\underset{i=1}{\overset{k}\sum} n_i -k+1$. Hence,
$CAN(G,g)\leq \underset{i=1}{\overset{k}\sum} CAN(G_i,g)-k+1$.
\end{theorem}
\begin{proof} We assume that for each $1\leq i\leq k$, the first column of $CA(n_i,G_i,g)$
is a constant column on symbol $1$.
Let $C_1= CA(n_1,G_1,g)$. For each $2\leq i\leq k$ remove the first column of $CA(n_i,G_i,g)$ to form $C_i$ with $n_i-1$ columns. Without loss of generality assume first column of each $CA(n_i,G_i,g)$ is constant
vector on symbol 1 while for each $2\leq i\leq k$, $C_i$ is the array obtained from $CA(n_i,G_i,g)$ by removing the first
column. Form an array $A$ with $\underset{i=1}{\overset{k}\prod} |V(G_i)|$ rows and $\underset{i=1}{\overset{k}\sum} n_i -k+1$ columns, indexing
rows as $(v_1,v_2,..,v_k)$, $v_i\in V(G_i)$. Row $(v_1,v_2,\ldots,v_k)$ is obtained by horizontally
concatenating the rows correspond to the vertex $v_i$ of $C_i$, for $1\leq i\leq k$. If two vertices
$(v_1,v_2,...,v_k)$ and $(u_1,u_2,...,u_k)$ are adjacent in $G$ then either $v_1u_1\in E(G_1)$ or $v_ju_j\in E(G_j)$ for
some $j\geq 2$ and $v_i=u_i$ for each $i< j$. In first case rows from $C_1$ covers each ordered pair of symbols while in second case
rows from $C_j$ covers each ordered pair of symbol probably except $(1,1)$. But this pair appears in each $C_i$ for $i<j$. Hence $A$
is a covering array on $G$.
\end{proof}
\begin{definition} \rm A {\it proper colouring} on a graph is an assignment of colours to each vertex such that adjacent vertices receive a different colour. The chromatic number of a graph $G$, $\chi(G)$,
is defined to be the size of the smallest set of colours such that a proper colouring exists with that set.
\end{definition}
\begin{definition}\rm
A {\it maximum clique} in a graph $G$ is a maximum set of pairwise adjacent vertices. The maximum clique number of a graph $G$, $\omega(G)$, is defined to be the size of a maximum clique.
\end{definition}
\noindent Since there are homomorphisms $K_{\omega(G)}\rightarrow G\rightarrow K_{\chi(G)}$, we can
find bound on the size of a covering array on a graph from the graph's chromatic number and clique number. For all graphs $G$,
$$CAN(K_{\omega(G)},g)\leq CAN(G,g)\leq CAN(K_{\chi(G)},g).$$
\noindent We have the following results on proper colouring of product graphs \cite{chromatic}
$$\chi(G_1 \Box G_2) = \max \{ \chi(G_1), \chi(G_2)\}.$$
For other graph products there are no explicit formulae for chromatic number but following bounds are mentioned in \cite{HBGP}.
$$\chi(G_1 \times G_2) \leq \min \{ \chi(G_1), \chi(G_2)\}$$
$$\chi(G_1 \boxtimes G_2) \leq \chi(G_1 \circ G_2) \leq \chi(G_1) \chi(G_2).$$
A proper colouring of $G_1 \ast G_2$ with $\chi(G_1 \ast G_2)$ colours is equivalent to a homomorphism from
$G_1 \ast G_2$ to $K_{\chi(G_1 \ast G_2)}$ for any $\ast \in\{\Box, \times, \boxtimes, \circ \}$.
Hence $$CAN(G_1 \Box G_2, g) \leq CAN(K_{\max\{ \chi(G_1), \chi(G_2)\}},g)$$
$$CAN(G_1 \times G_2, g) \leq CAN(K_{\min\{ \chi(G_1), \chi(G_2)\}},g) $$
$$CAN(G_1 \boxtimes G_2, g) \leq CAN(K_{\chi(G_1)\chi(G_2)},g) $$
$$CAN(G_1 \circ G_2, g) \leq CAN(K_{\chi(G_1)\chi(G_2)},g) .$$
\noindent Note that $G_1\rightarrow G_1 \ast G_2$ and $G_2\rightarrow G_1 \ast G_2$ for $\ast \in\{\Box,\boxtimes,\circ\}$
which gives
$$max\{CAN(G_1, g), CAN(G_2, g)\}\leq CAN(G_1 \ast G_2, g).$$
We now describe colouring construction of covering array on graph $G$. If $G$ is a $k$-colourable graph then build a covering array $CA(n, k, g)$ and without loss of generality associate
row $i$ of $CA(n, k, g)$ with colour $i$ for $1\leq i\leq k$. In order to construct $CA(n,G,g)$, we assign row $i$ of $CA(n, k, g)$ to all the vertices having colour $i$ in $G$.
\begin{definition}\rm An orthogonal array $OA(k,g)$ is a $k\times g^2$ array with entries from $\mathbb{Z}_g$ having the properties that
in every two rows, each ordered pair of symbols from $\mathbb{Z}_g$ occurs exactly once.
\end{definition}
\begin{theorem}\label{OA} \cite{Colbourn} If $g$ is prime or power of prime, then one can construct $OA(g+1,g)$.
\end{theorem}
The set of rows in an orthogonal array $OA(k,g)$ is a set of $k$ pairwise qualitatively independent vectors from
$\mathbb{Z}_g^{g^2}$. For $g=2$, by Theorem \ref{OA}, there are three qualitatively independent vectors from
$\mathbb{Z}_2^{4}$. Here we give some examples where the lower bound
on $CAN(G_1\Box G_2,g)$ is achieved, that is, $CAN(G_1\Box G_2,g)=max\{CAN(G_1,g), CAN(G_2,g)\}. $
\begin{example} \rm If $G_1$ and $G_2$ are bicolorable graphs, then $\chi(G_1 \Box G_2)=2$. Let $x_1$ and $x_2$ be two qualitatively independent vectors
in $\mathbb{Z}_g^{g^2}$. Assign vector $x_i$ to all the vertices of $G_1 \Box G_2$ having colour $i$ for $i=1,2$ to get a covering array with $CAN(G_1 \Box G_2, g) = g^2.$
\end{example}
\begin{example}\rm If $G_1$ and $G_2$ are complete graphs, then $CAN(G_1 \Box G_2, g) = max\{CAN(G_1, g), CAN(G_2, g)\}. $
\end{example}
\begin{example} \rm If $G_1$ is bicolorable and $G_2$ is a complete graph on $k\geq 3$ vertices, then
$CAN(G_1 \Box G_2, g) = CAN(G_2, g)$. In general, if $\chi(G_1) \leq \chi(G_2)$ and $G_2$ is a complete graph, then
$CAN(G_1 \Box G_2, g) = CAN(G_2, g)$.
\end{example}
\begin{example} \rm If $P_m$ is a path of length $m$ and $C_n$ is an odd cycle of length $n$, then $\chi(P_m \Box C_n)=3$. Using Theorem \ref{OA}, we
get a set of three qualitatively independent vectors in $\mathbb{Z}_g^{g^2}$ for $g\geq 2$. Then the colouring construction of covering arrays gives us a covering
array on $P_m\Box C_n$ with $CAN(P_m\Box C_n, g) = g^2$.
\end{example}
\begin{lemma}\cite{HBGP} Let $G_1$ and $G_2$ be graphs and $Q$ be a clique of $G_1\boxtimes G_2$. Then
$Q= p_1(Q)\boxtimes p_2(Q)$, where $p_1(Q)$ and $p_2(Q)$ are cliques of $G_1$ and $G_2$, respectively.
\end{lemma}
Hence a maximum size clique of $G_1\boxtimes G_2$ is product of maximum size cliques from $G_1$ and $G_2$. That is,
$\omega(G_1\boxtimes G_2)= \omega(G_1)\omega(G_2)$. Using the graph homomorphism, this results into another lower bound on
$CAN(G_1\boxtimes G_2,g)$ as $CAN(K_{\omega(G_1)\omega(G_2)},g)\leq CAN(G_1\boxtimes G_2,g)$. Following are some examples
where this lower bound can be achieved.
\begin{example} \rm If $G_1$ and $G_2$ are nontrivial bipartite graphs then
$\omega(G_1 \boxtimes G_2)= \chi(G_1\boxtimes G_2)$ which is 4. Hence $CAN(G_1\boxtimes G_2,g)= CAN(K_4,g)$, which is of optimal
size.
\end{example}
\begin{example}\rm If $G_1$ and $G_2$ are complete graphs, then $G_1\boxtimes G_2$ is again a complete graph. Hence
$CAN(G_1\boxtimes G_2,g)= CAN(K_{\omega(G_1\boxtimes G_2)},g)$.
\end{example}
\begin{example}\rm If $G_1$ is a bipartite graph and $G_2$ is a complete graph on $k\geq 2$ vertices, then
$\omega(G_1\boxtimes G_2)= \chi(G_1\boxtimes G_2)= 2k$. Hence $CAN(G_1\boxtimes G_2,g)= CAN(K_{2k},g)$.
\end{example}
\begin{example}\rm If $P_m$ is a path of length $m$ and $C_n$ is an odd cycle of length $n$, then
$\omega(P_m\boxtimes C_n)=4$ and $\chi(P_m \boxtimes C_n)=5$. Here we have $CAN(K_4,g)\leq CAN(G,g)\leq CAN(K_5,g)$. For $g\geq 4$, using Theorem \ref{OA}, we
get a set of five qualitatively independent vectors in $\mathbb{Z}_g^{g^2}$. Then the colouring construction of
covering arrays gives us a covering array on $P_m\boxtimes C_n$ with $CAN(P_m\boxtimes C_n, g) = g^2$.
\end{example}
\section{Optimal size covering arrays over the Cartesian product of graphs } \label{Cayley}
\begin{definition} \rm Two graphs $G_1=(V,E)$ and $G_2=(V^{\prime},E^{\prime})$ are said to be isomorphic if there is a bijection mapping $\varphi$ from the vertex set $V$ to the vertex set $V^{\prime}$ such that $(u,v)\in E$ if and only if $(\varphi(u),\varphi(v))\in E^{\prime}$. The mapping $\varphi$ is called an isomorphism. An automorphism of a graph is an isomorphism from the graph to itself.
\end{definition}
\noindent The set of all automorphisms of a graph $G$ forms a group, denoted $Aut(G)$, the automorphism group of $G$.
\begin{theorem}\label{A}
Let $G_1$ be a graph having the property that $Aut(G_1)$ contains a fixed point free automorphism which maps every vertex to its neighbour.
Then for any bicolourable graph $G_2$, $$CAN(G_1 \square G_2,g)=CAN(G_1,g).$$
\end{theorem}
\begin{proof} Consider the set $\Gamma=\{\phi \in Aut(G_1)~|~ \phi(u)\in N(u)-\{u\} \mbox{ for all } u\in V(G_1)\}$ where $N(u)$ denotes the set of neighbours of $u$.
From the assumption, $\Gamma$ is not empty.
Consider a 2-colouring of $G_2$ with colours $0$ and $1$. Let $W_0=\{(u,v)\in V(G_1\square G_2) ~|~\mbox{colour}(v)=0\}$ and $W_1=\{(u,v)\in V(G_1\square G_2) ~|~\mbox{colour}(v)=1\}$. Note that $W_0 $ and $W_1$ partition $V(G_1\square G_2)$ in two two parts.
Let the rows of covering array $CA(G_1,g)$ be indexed by $u_1,u_2,\ldots,u_k$.
Form an array $C$ with $|V(G_1 \Box G_2)|$ rows and $CAN(G_1,g)$
columns, indexing rows as $(u,v)$ for $1\leq u\leq |V(G_1)|$, $1\leq v \leq |V(G_2)|$. If $(u,v)\in W_0$, row $(u,v)$ is row $u$ of $CA(G_1,g)$; otherwise if
$(u,v)\in W_1$, row $(u,v)$ is row $\phi(u)$ of $CA(G_1,g)$. We verify that $C$ is a $CA(G_1\Box G_2, g)$. Consider two adjacent vertices $(u_1,v_1)$ and $(u_2,v_2)$
of $C$. \\ (i) Let $(u_1,v_1)$ and $(u_2,v_2)$ belong to $W_i$, then $(u_1,v_1)\sim(u_2,v_2)$ if and only if $u_1 \sim u_2$ and $v_1=v_2$.
When $(u_1,v_1)$ and $(u_2,v_2)$ belong to $W_0$, rows $(u_1,v_1)$ and $(u_2,v_2)$ are rows $u_1$ and $u_2$ of $CA(G_1,g)$ respectively.
As $u_1\sim u_2$, rows $u_1$ and $u_2$ are
qualitatively independent in $CA(G_1,g)$. When $(u_1,v_1)$ and $(u_2,v_2)$ belong to $W_1$, rows $(u_1,v_1)$ and $(u_2,v_2)$ are rows $\phi(u_1)$ and $\phi(u_2)$ of $CA(G_1,g)$ respectively. As $\phi(u_1)\sim \phi(u_2)$, rows $\phi(u_1)$ and $\phi(u_2)$ are
qualitatively independent in $CA(G_1,g)$. Therefore, rows $(u_1,v_1)$ and $(u_2,v_2)$ are
qualitatively independent in $C$.\\
(ii) Let $(u_1,v_1)\in W_0$ and $(u_2,v_2)\in W_1$. In this case, $ (u_1,v_1) \sim (u_2,v_2)$ if and only if $u_1=u_2$ and $v_1\sim v_2$. Let $u_1=u_2=u$. Rows $(u,v_1)$ and $(u,v_2)$ are rows $u$ and $\phi(u)$ of $CA(G_1,g)$.
As $\phi $ is a fixed point free automorphism that maps every vertex to its neighbour, $u$ and $\phi(u)$ are adjacent in $G_1$. Therefore, the rows indexed by $u$ and $\phi(u)$ are qualitatively independent
in $CA(G_1,g)$; therefore, rows $(u_1,v_1)$ and $(u_2,v_2)$ are
qualitatively independent in $C$.\\
\end{proof}
\begin{definition}\rm
Let $H$ be a finite group and $S$ be a subset of $H\smallsetminus \{id\}$ such that $S = -S$ (i.e., $S$ is closed under inverse). The Cayley graph of $H$ generated by $S$, denoted
$Cay(H,S)$, is the undirected graph $G=(V,E)$ where $V=H$ and $E=\{(x,sx)~|~x\in H, s\in S\}$. The Cayley graph is connected if and only if $S$ generates $H$.
\end{definition}
\noindent Through out this article by $S = -S$ we mean, $S$ is closed under inverse for a given group operation
\begin{definition}\rm
A circulant graph $G(n,S)$ is a Cayley graph on $\mathbb{Z}_n$. That is, it is a graph whose vertices are labelled $\{0,1,\ldots,n-1\}$, with two vertices labelled $i$ and
$j$ adjacent iff $i-j ~(\mbox{mod}~n)\in S$, where $S\subset \mathbb{Z}_n$ with $S=-S$ and $0\notin S$.
\end{definition}
\begin{corollary}
Let $G_1(n,S)$ be a circulant graph and $G_2$ be a bicolorable graph, then $CAN(G_1(n,S) \Box G_2, g) = CAN(G_1(n,S), g)$.
\end{corollary}
\begin{proof} Let $i$ and $j$ be any two adjacent vertices in $G_1(n,S)$. We define a mapping $\phi$ from $\mathbb{Z}_n$ as follows:
\begin{center}
$\phi(k) = k+j-i ~(\mbox{mod}~ n)$
\end{center}
It is easy to verify that $\phi$ is an automorphism
and it sends every vertex to its neighbour. Hence $\phi \in \Gamma$ and the result
follows.
\end{proof}
For a group $H$ and $S \subseteq H$, we denote conjugation of $S$ by elements of itself as
\begin{center}
$S^S = \{ ss's^{-1} | s, s'\in S\}$
\end{center}
\begin{corollary}
Let $H$ be a finite group and $S \subseteq H\smallsetminus \{id\}$ is a generating set for $H$ such that $S = -S$ and
$S^S = S$. Then for
$G_1 = Cay(H, S)$ and any bicolorable graph $G_2$,
\begin{center}
$CAN(G_1 \Box G_2, g) = CAN(G_1, g)$
\end{center}
\end{corollary}
\begin{proof}
We will show that there exists a $\phi \in Aut(G_1)$ such that $\phi$ is stabilizer free.
Define $\phi : H \rightarrow H$ as $\phi(h) = sh$ for some $s\in S$.
It it easy to check that $\phi$ is bijective and being $s \neq id$ it is stabilizer free. Now to prove it is a
graph homomorphism we need to show it is an adjacency preserving map. It is sufficient to prove that $(h, s'h)\in E(G_1)$
implies $(sh, ss'h) \in E(G_1)$. As $ss'h = ss's^{-1}sh$ and $ss's^{-1} \in S$, we have $(sh, ss'h)\in E(G_1)$.
Hence $\phi \in \Gamma $ and Theorem \ref{A} implies the result.
\end{proof}
\begin{example}\rm
For any abelian group $H$ and $S$ be a generating set such that $S = -S$ and $id \notin S$, we always get $S^S = S$.
\end{example}
\begin{example}\rm
For $H = Q_8 = \{\pm1, \pm i, \pm j, \pm k\}$ and $S = \{\pm i, \pm j\}$, we have $S^S = S$ and $S = -S$.
\end{example}
\begin{example}\rm
For $H= D_8 = \langle a, b | a^2 = 1 = b^4, aba = b^3\rangle$ and $S= \{ab, ba\}$, we have $S^S = S$ and $S = -S$.
\end{example}
\begin{example}\rm
For $H = S_n$ and $S =$ set of all even cycles, we have $S^S = S$ and $S = -S$
\end{example}
\begin{theorem}
Let $H$ be a finite group and $S$ be a generating set for $H$ such that
\begin{enumerate}
\item $S = -S$ and $id \notin S$
\item $S^S = S$
\item there exist $s_1$ and $s_2$ in $S$ such that $s_1 \neq s_2$ and $s_1s_2 \in S$
\end{enumerate}
then for $G_1= Cay(H, S)$ and any three colourable graph $G_2$
\begin{center}
$CAN(G_1 \Box G_2, g) = CAN(G_1,g)$
\end{center}
\end{theorem}
\begin{proof} Define three distinct automorphisms of $G_1$, $\sigma_{i} : H\rightarrow H$, for $i=0,1,2$, as $\sigma_0(u)=u$, $\sigma_1(u)=s_1u$, $\sigma_2(u)=s_2^{-1}u$.
Consider a three colouring of $G_2$ using the colours $0, 1$ and $2$. Let $W_i=\{(u,v)\in V(G_1\square G_2) ~|~\mbox{colour}(v)=i\}$ for $i=0,1,2$.
Note that $W_0 $, $W_1$, and $W_2$ partition $V(G_1\square G_2)$ into three parts.
Let the rows of covering array $CA(G_1,g)$ be indexed by $u_1,u_2,\ldots,u_k$. Using $CA(G_1,g)$, form an array $C$ with $|V(G_1 \Box G_2)|$ rows and $CAN(G_1,g)$
columns, indexing rows as $(u,v)$ for $1\leq u\leq |V(G_1)|$, $1\leq v \leq |V(G_2)|$. If $(u,v)\in W_i$, row $(u,v)$ is row $\sigma_i(u)$ of $CA(G_1,g)$. Consider two adjacent vertices $(u_1,v_1)$ and $(u_2,v_2)$ of $C$. \\
(i) Let $(u_1,v_1)$ and $(u_2,v_2)$ belong to $W_i$. In this case, $(u_1,v_1)\sim(u_2,v_2)$ if and only if $u_1 \sim u_2$ and $v_1=v_2$.
When $(u_1,v_1)$ and $(u_2,v_2)$ belong to $W_0$, rows $(u_1,v_1)$ and $(u_2,v_2)$ are rows $u_1$ and $u_2$ of $CA(G_1,g)$.
As $u_1 \sim u_2$ in $G_1$, the rows $u_1$ and $u_2$ are qualitatively independent in $CA(G_1,g)$. Let $(u_1,v_1)$ and $(u_2,v_2)$ belong to $W_1$ (res. $W_2$). Similarly, as $s_1u_1\sim s_1u_2$ (res. $s_2^{-1}u_1 \sim s_2^{-1}u_1$)
the rows indexed by
$s_1u_1$ and $s_1u_2$ (res. $s_2^{-1}u_1$ and $s_2^{-1}u_2$) are qualitatively independent in $CA(G_1,g)$.
Hence the rows
$(u_1,v_1)$ and $(u_2,v_2)$ are qualitatively independent in $C$.\\
(ii) Let $(u_1,v_1)\in W_i$ and $(u_2,v_2)\in W_j$ for $0\leq i\neq j\leq 2$. In this case, $(u_1,v_1)\sim(u_2,v_2)$ if and only if $u_1 = u_2$ and $v_1\sim v_2$.
Let $u_1=u_2=u$.\\
Let $(u,v_1)\in W_0$ and $(u,v_2)\in W_1$, then rows $(u,v_1)$ and $(u,v_2)$ are rows $u$ and $s_1u$ of $CA(G_1,g)$ respectively. Then as $u\sim s_1u$ the rows indexed by $(u,v_1)\in W_0$ and $(u,v_2)\in W_1$ are qualitatively independent in $C$. \\
Let $(u,v_1)\in W_0$ and $(u,v_2)\in W_2$. Then, as $u\sim s_2^{-1}u$, the rows indexed by $(u,v_1)\in W_0$ and $(u,v_2)\in W_2$ are qualitatively independent in $C$. \\
Let $(u,v_1)\in W_1$ and $(u,v_2)\in W_2$. Then, as $s_1u\sim s_2^{-1}u$, the rows indexed by $(u,v_1)\in W_1$ and $(u,v_2)\in W_2$ are qualitatively independent in $C$.
\end{proof}
\begin{theorem}
Let $H$ be a finite group and $S$ is a generating set for $H$ such that
\begin{enumerate}
\item $S = -S$ and $id \notin S$
\item $S^S = S$
\item $\exists s_1$ and $s_2$ in $S$ such that $s_1 \neq s_2$ and $s_1s_2, s_1s_2^{-1}\in S$
\end{enumerate}
then for $G_1 = Cay(H, S)$ and any four colourable graph $G_2$
\begin{center}
$CAN(G_1 \Box G_2, g) = CAN(G_1, g)$
\end{center}
\end{theorem}
\begin{proof}
Define four distinct automorphisms of $G_1$, $\sigma_i:H\rightarrow H$, $ i=0,1,2,3$ as $\sigma_0(u)=u$, $\sigma_1(u)=s_1u$, $\sigma_2(u)=s_2u$ and
$\sigma_3(u)=s_1s_2 u$. Consider a four colouring of $G_2$ using the colours $0, 1, 2$ and $3$. Let $W_i=\{(u,v)\in V(G_1\square G_2) ~|~\mbox{colour}(v)=i\}$ for $i=0,1,2,3$.
Let the rows of covering array $CA(G_1,g)$ be indexed by $u_1,u_2,\ldots,u_k$. Form an array $C$ with $|V(G_1 \Box G_2)|$ rows and $CAN(G_1,g)$
columns, indexing rows as $(u,v)$ for $1\leq u\leq |V(G_1)|$, $1\leq v \leq |V(G_2)|$. If $(u,v)\in W_i$, row $(u,v)$ is row $\sigma_i(u)$ of $CA(G_1,g)$. Consider two adjacent vertices $(u_1,v_1)$ and $(u_2,v_2)$ of $C$. \\
(i) Let $(u_1,v_1)$ and $(u_2,v_2)$ belong to $W_i$. It is easy to verify that $(u_1,v_1)$ and $(u_2,v_2)$ are qualitatively independent.\\
(ii) Let $(u_1,v_1)\in W_i$ and $(u_2,v_2)\in W_j$ for $0 \leq i\neq j\leq 3$. In this case, $(u_1,v_1)\sim(u_2,v_2)$ if and only if $u_1 = u_2$ and $v_1\sim v_2$.
Let $u_1=u_2=u$.\\
Let $(u,v_1)\in W_0$ and $(u,v_2)\in W_i$ for $i=1,2,3$, then row $(u,v_1)$ and $(u,v_2)$ are
rows $u$ and $\sigma_i(u)$ of $CA(G_1,g)$ respectively.
Then as $u\sim \sigma_i(u)$ the rows $(u,v_1)$ and $(u,v_2)$ are qualitatively independent. \\
\noindent Let $(u,v_1)\in W_1$ and $(u,v_2)\in W_2$. Then rows $(u,v_1)$ and $(u,v_2)$ are rows $s_1u$ and $s_2u$ of $CA(G_1,g)$. As $s_1u = s_1s_2^{-1}s_2u$ and $s_1s_2^{-1}\in S$, we get $s_1u\sim s_2u$. Hence the rows $(u,v_1)\in W_1$ and $(u,v_2)\in W_2$ are qualitatively independent. Similarly, as $s_1u=s_1 s_2^{-1}s_1^{-1}s_1s_2u$ and $s_1 s_2^{-1}s_1^{-1}\in S$ being $S^S=S$, we have
$s_1u\sim s_1s_2u$. Hence the rows $(u,v_1)\in W_1$ and $(u,v_2)\in W_3$ are qualitatively independent. \\
Let $(u,v_1)\in W_2$ and $(u,v_2)\in W_3$. As $s_2u=s_1^{-1}s_1s_2u$ and $s_1^{-1}\in S$, we get $s_2u\sim s_1s_2u$.
Hence the rows $(u,v_1)\in W_2$ and $(u,v_2)\in W_3$ are qualitatively independent.
\end{proof}
\begin{example}
$G = Q_8$ and $S= \{\pm i, \pm j, \pm k\}$. Here $s_1=i$ and $s_2=j$.
\end{example}
\begin{example}
$G = Q_8$ and $S= \{-1,\pm i, \pm j\}$. Here $s_1=-1$ and $s_2=i$.
\end{example}
\begin{figure}
\begin{center}
\begin{tikzpicture}
\small{
\matrix[matrix of math nodes, anchor=south west,
nodes={circle, draw, minimum size = 0.4cm},
column sep = {0.5cm},
row sep={0.35cm}]
{
& |(0)| & & |(2)| & & \\
& & & & & |(3)| \\
|(4)| & & & & & & |(-4)| \\
& &|(5)| & & |(6)| & & & & |(00)| & & |(02)| & & \\
& & &|(7)| & & & & & & & & & |(03)| \\
& & & & & & & |(04)| & & & & & & |(-04)| \\
& & |(1)| & & |(i)| & & & & &|(05)| & & |(06)| & \\
& & & & & & |(j)| & & & &|(07)| & & \\
&|(-k)| & & & & & & |(k)| \\
& & &|(-j)| & & |(-1)| & &\\
& & & &|(-i)| & & &\\
};}
\begin{scope}[style=thick]
\foreach \from/\to/\weight/\where
in { 4/2/1/above, 4/3/1/above, 4/-4/1/right, 4/7/1/above, 4/5/1/right,
0/5/1/above, 0/7/1/above, 0/6/1/above, 0/3/1/above, 0/2/1/above,
2/7/1/above, 2/6/1/right, 2/-4/1/above,
3/5/1/right, 3/6/1/below, 3/-4/1/right, -4/7/1/above, -4/5/1/above,
6/7/1/below, 6/5/1/below,
-k/i/1/above, -k/j/1/above, -k/k/1/right, -k/-i/1/above, -k/-j/1/right,
1/-j/1/above, 1/-i/1/above, 1/-1/1/above, 1/j/1/above, 1/i/1/above,
i/-i/1/above, i/-1/1/right, i/k/1/above,
j/-j/1/right, j/-1/1/below, j/k/1/right, k/-i/1/above, k/-j/1/above,
-1/-i/1/below, -1/-j/1/below,
04/02/1/above, 04/03/1/above, 04/-04/1/right, 04/07/1/above, 04/05/1/right,
00/05/1/above, 00/07/1/above, 00/06/1/above, 00/03/1/above, 00/02/1/above,
02/07/1/above, 02/06/1/right, 02/-04/1/above,
03/05/1/right, 03/06/1/below, 03/-04/1/right, -04/07/1/above, -04/05/1/above,
06/07/1/below, 06/05/1/below}
\draw (\from) to [->] (\to);
\end{scope}
\begin{scope}[style=thin]
\foreach \from/\to/\weight/\where
in { 4/-k/1/above, 0/1/1/above, 2/i/1/right, 3/j/1/above, -4/k/1/right,
6/-1/1/above, 5/-j/1/above, 7/-i/1/above}
\draw[gray] (\from) to [->] (\to);
\end{scope}
\begin{scope}[style=thin]
\foreach \from/\to/\weight/\where
in { 04/-k/1/above, 00/1/1/above, 02/i/1/right, 03/j/1/above, -04/k/1/right,
06/-1/1/above, 05/-j/1/above, 07/-i/1/above}
\draw[red] (\from) to [->] (\to);
\end{scope}
\begin{scope}[style=thin]
\foreach \from/\to/\weight/\where
in{ 4/04/1/above, 0/00/1/above, 2/02/1/right, 3/03/1/above, -4/-04/1/right,
6/06/1/above, 5/05/1/above, 7/07/1/above}
\draw[blue] (\from) to [->] (\to);
\end{scope}
\end{tikzpicture}
\caption{$Cay(Q_8, \{-1,\pm i, \pm j\})\Box K_3$}
\end{center}
\end{figure}
\section{Approximation algorithm for covering array on graph}\label{Approx}
In this section, we present an approximation algorithm for construction of covering array on a given graph $G=(V,E)$ with
$k>1$ prime factors with respect to the Cartesian product.
In 1988, G. Seroussi and N H. Bshouty proved that the decision problem whether there exists a binary
covering array of strength $t\geq 2$ and size $2^t$ on a given $t$-uniform hypergraph is NP-complete \cite{VS}.
Also, construction of
an optimal size covering array on a graph is at least as hard as finding its optimal size.
\noindent We give an approximation algorithm for the Cartesian product with approximation ratio $O(\log_s |V|)$, where $s$ can be obtained from the
number of symbols corresponding to each vertex. The following result by Bush is used in our approximation algorithm.
\begin{theorem}\rm{\cite{GT}}\label{B} Let $g$ be a positive integer. If $g$ is written in standard form: $$g=p_1^{n_1}p_2^{n_2}\ldots p_l^{n_l}$$ where $p_1,p_2,\ldots,p_l$ are distinct primes, and if
$$r=\mbox{min}(p_1^{n_1},p_2^{n_2},\ldots, p_l^{n_l}),$$ then one can construct $OA(s,g)$ where
$s =1+ \max{(2,r)}$.
\end{theorem}
We are given a wighted connected graph $G=(V,E)$ with each vertex having the same weight $g$.
In our approximation algorithm, we use a technique from \cite{HBGP} for prime factorization of $G$ with respect to the Cartesian product.
This can be done in $O(E \log V$) time. For details see \cite{HBGP}. After obtaining prime factors of $G$, we construct
strength two covering array $C_1$ on maximum size prime factor. Then
using rows of $C_1$, we produce a covering array on $G$.\\
\noindent\textbf{APPROX $CA(G,g)$:}
\\\textbf{Input:} A weighted connected graph $G=(V,E)$ with $k>1$ prime factors with respect to the Cartesian product. Each vertex has weight $g$; $g=p_1^{n_1}p_2^{n_2}\ldots p_l^{n_l}$ where
$p_1$, $p_2, \ldots, p_l$ are primes.
\\\textbf{Output:} $CA(ug^2,G,g)$.
\\\textbf{Step 1:} Compute $s = 1 + \mbox{max}\{2,r\}$ where $r=\mbox{min}(p_1^{n_1},p_2^{n_2},\ldots, p_l^{n_l})$.
\\\textbf{Step 2:} Factorize $G$ into prime factors with respect to the Cartesian product;
say $G = \Box_{i=1} ^{k} G_i$ where $G_i= (V_i,E_i)$ is a prime factor.
\\\textbf{Step 3:} Suppose $V_1\geq V_2\geq \ldots\geq V_k$. For prime factor $G_1=(V_1, E_1)$ \textbf{do}
\begin{enumerate}
\item Find the smallest positive integer $u$ such that $s^u\geq V_1$. That is, $u=\lceil \mbox{log}_s V_1\rceil$.
\item Let $OA(s,g)$ be an orthogonal array and denote its $i$th row by $R_i$ for $i=1,2,\ldots,s$. Total $s^u$ many row vectors $(R_{i_1}, R_{i_2},\ldots R_{i_u})$, each of length $ug^2$, are formed by horizontally concatenating $u$ rows
$R_{i_1}$, $ R_{i_2}$, $\ldots,$ $ R_{i_u}$ where $1\leq i_1, \ldots, i_u\leq s$.
\item Form an $V_1 \times ug^2$ array $C_1$ by choosing any $V_1$ rows out of $s^u$ concatenated row vectors.
Each row in the array corresponds to a vertex in the graph $G_1$. \end{enumerate}
\textbf{Step 4:}
From $C_1$ we can construct an $V\times ug^2$ array $C$. Index the rows of $C$ by $(u_1,u_2,\ldots,u_k)$, $u_i\in V(G_i)$.
Set the row $(u_1,u_2,\ldots,u_k)$ to be identical to the row corresponding to $u_1+u_2+\ldots+u_k ~ \mbox{mod } V_1$ in $C_1$. Return $C$.
\vspace{1cm}\begin{theorem}
Algorithm APPROX $CA(G,g)$ is a polynomial-time $\rho(V)$ approximation algorithm for covering array on graph problem, where
$$\rho(V) \leq \lceil \log_s \frac{V}{2^{k-1}} \rceil.$$
\end{theorem}
\begin{proof}
\textbf{Correctness:} The verification that $C$ is a $CA(ug^2,G,g)$ is straightforward. First, we show that $C_1$ is a covering array of strength two with $ |V_1|$ parameters.
Pick any two distinct rows of $C_1$ and consider the sub matrix induced by these two rows. In the sub matrix, there must be a column $(R_i, R_j)^T$ where $i \neq j$.
Hence each ordered pair of values appears at least once.
Now to show that $C$ is a covering array on $G$, it is sufficient to show that the rows in $C$ for any pair of adjacent vertices $u=(u_1,u_2,\ldots,u_k)$ and $v=(v_1,v_2,\ldots,v_k)$ in $G$ will be qualitatively
independent. We know $u$ and $v$ are adjacent if and only if $(a_i,b_i)\in E(G_i)$ for exactly one index $1\leq i\leq k$ and
$a_j=b_j$ for $j\neq i$.
Hence $ u_1+u_2+ \ldots+u_k \neq v_1+v_2+\ldots+v_k ~ \mbox{mod } V_1$ and in Step 6,
two distinct rows from $C_1$ are assigned to the vertices $u$ and $v$.\\
\textbf{Complexity :} The average order of $l$ in Step 1 is $\ln\ln g$ \cite{Riesel}. Thus, the time to find $s$ in Step 1 is $O(\ln \ln g)$.
The time to factorize graph $G=(V,E)$ in Step 2 is $O(E \log V)$. In Step 3(1), the smallest positive integer $u$ can be found in
$O(\mbox{log}_s V_1)$ time. In Step 3(2), forming one row vector requires $\mbox{log}_sV_1$ assignments; hence, forming $V_1$ row vectors require $O(V_1\mbox{log}V_1)$ time.
Thus the total running time of APPROX $CA(G,g)$ is $O(E \log V+\ln \ln g)$. Observing that, in practice, $\ln \ln g \leq E \log V$, we can restate the running time of
APPROX $CA(G,g)$ as $O(E \log V)$. \\
\textbf{Approximation ratio:} We show that APPROX $CA(G,g)$ returns a covering array that is at most $\rho(V)$ times the size of an optimal covering array on $G$.
We know the smallest $n$ for which a $CA(n,G,g)$ exists is $g^2$, that is, $CAN(G,g)\geq g^2$. The algorithm returns a covering array on $G$ of size $ug^2$ where
$$u=\lceil \log_s V_1\rceil.$$ As $G$ has $k$ prime factors, the maximum number of vertices in a factor can be $\frac{V}{2^{k-1}}$, that is, $V_1\leq \frac{V}{2^{k-1}}$.
Hence $$u= \lceil \log_s V_1\rceil \leq \lceil \log_s \frac{V}{2^{k-1}}\rceil.$$ By relating to the size of the covering array returned to the optimal size, we obtain our approximation ratio
$$\rho(V)\leq \lceil \log_s \frac{V}{2^{k-1}}\rceil.$$ \end{proof}
\section{Conclusions} One motivation for introducing a graph structure was to optimise covering arrays for their use in testing software and networks based on internal structure. Our primary
concern in this paper is with constructions that make optimal covering arrays on large graphs from smaller ones. Large graphs are obtained by considering either the Cartesian, the direct, the strong, or the Lexicographic product of small graphs. Using graph homomorphisms, we have
$$\max_{i=1,2}\{CAN(G_i,g)\}\leq CAN(G_1\Box G_2,g)\leq CAN( \max_{i=1,2}\{\chi(G_i)\},g).$$ We gave several classes of Cayley graphs where the lower bound on covering array number $CAN(G_1\Box G_2)$ is achieved. It is an interesting problem to find out other classes of graphs for which lower bound on covering array number of product graph can be achieved. We gave an approximation algorithm
for construction of covering array on a graph $G$ having more than one factor with respect to the Cartesian product. Clearly, another area to explore is to consider in details the other graph products, that is, the direct, the strong, and the Lexicographic product.
| {'timestamp': '2015-12-23T02:03:33', 'yymm': '1512', 'arxiv_id': '1512.06966', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06966'} | arxiv |
\subsection{Measuring Technical Domain Expertise}
\mypar{Measuring Technical Domain Expertise}
We now describe the collected data, and try to answer our first research question: \textbf{RQ1:}\textsl{How to define user expertise?}\
In total, we have 29 participants in our study. From the demographic perspective our dataset can be characterized by participants age and education level. In terms of education level we have the following population of participants: High school 8\%, Bachelor 12\%, Master 56\%, PhD 24\%. In terms of age we have the following population of participants: 18-23 years is 16\%, 24-29 years is 36\%, 30-35 years is 28\%, 36-42 years is 16\%, 43-48 years is 4\%.
\begin{figure}[!t]
\centerline{\includegraphics[width=1.0\linewidth]{pictures/plot_hist_java_javascript.pdf}}
\vspace{-10pt}
\caption{A histogram of expertise score of participants calculated for Java (top) and JavaScript (bottom).}
\label{fig:hist_skill_score}
\end{figure}
Figure~\ref{fig:hist_skill_score} shows the distribution of expertise in Java (top half) and JavaScript (bottom half).
The expertise scores are calculated based on ten questions from the pre-survey (described in \S\ref{sec:study_desc}).
As we can see, the majority of the participants in the study have high levels of expertise in either Java or JavaScript.
\if 0
distribution of self-reported expertise level in Java and JavaScript is presented in Figure~\ref{fig:test_exp}. In contrast, the
\begin{figure*}[!t]
\centering
\framebox[0.46\linewidth][t]{\parbox[t][0.46\linewidth][c]{0.4\linewidth}{\includegraphics[width=0.22\textwidth]{pictures/plot_url-reported_java_skills_with_labels.pdf}}}
~~~
\framebox[0.46\linewidth][t]{\parbox[t][0.46\linewidth][c]{0.4\linewidth}{\includegraphics[width=0.22\textwidth]{pictures/plot_url-reported_javascript_skills_with_labels.pdf}}}
\vspace{-10pt}
\caption{Self-reported scores for Java expertise (left) and JavaScript expertise (right).}
\label{fig:test_exp}
\end{figure*}
\fi
\begin{figure}[!t]
\centerline{\includegraphics[width=1.0\linewidth]{pictures/plot_java_score-javascript_score.pdf}}
\vspace{-10pt}
\caption{A scatter plot of the calculated skill score for both topics: Java and JavaScript.}
\label{fig:skill_score}
\end{figure}
Figure~\ref{fig:skill_score} shows the relation between the participants' expertise scores in Java and JavaScript.
The relation between the skills in Java and JavaScript is weak (Pearson correlation of 0.44, $p < 0.05$) signaling that only a small fraction of participants has high levels of expertise in both.
\begin{figure*}[!t]
\centerline{
\includegraphics[width=0.45\linewidth]{pictures/plot_java_score-reported.pdf}
~
\includegraphics[width=0.45\linewidth]{pictures/plot_javascript_score-reported.pdf}
}
\vspace{-10pt}
\caption{Expertise test results over self-reported scores for Java expertise (left) and JavaScript expertise (right).}
\label{fig:test_exp}
\end{figure*}
Figure~\ref{fig:test_exp} shows the expertise test scores over the self-reported expertise levels.
We see a clear relation between the self reported expertise levels and the test scores, the correlation is 0.60 for Java (Pearson, $p < 0.01$) and 0.75 for JavaScript ($p < 0.001$). This result gives confidence in the tests to quantify the technical domain expertise of the participants.
\smallskip
Our main finding is that the expertise test is effective and correlates well with the self-reported expertise. This implies the usefulness of the test, but also validates the self-reported expertise score as a reliable indicator of user expertise.
\mypar{Impact on Search Behavior}
We now investigate our second research question: \textbf{RQ1:}\textsl{How to define experts topics?}\
\begin{figure*}[!t]
\centering
\includegraphics[width=0.65\linewidth]{pictures/plot_url-dist-3way.pdf}
\vspace{-10pt}
\caption{Position bias with respect to the users' expertise.}
\label{fig:pos_bias}
\end{figure*}
We calculate the distribution of positions over all submitted users answers for both topics (a position of URL that study participants submit as a source of the correct answer to the proposed question). This event can be mapped to the SAT click in web search behavior.
Figure~\ref{fig:pos_bias} presents the distribution of selected answers with regard to the calculated users' expertise score: over all participants (top), over those with relatively low levels of expertise ($<$ 0.6, middle), and over those with a relatively high levels of expertise ($>$ 0.8, bottom). We performed a goodness of fit test against a uniform distribution which fails convincingly ($\chi^2$ goodness of fit test, $p < 0.001$ for all three cases).
Recall that the SERPs were randomized, hence relevant results are uniformly distributed across the ten positions. We can clearly see that the whole population is biased to the position of the result on the SERP, showcasing that results are scanned from top to bottom.
We see an even stronger position bias for those with lower test scores, while for those with a higher test score, the position bias is less pronounced. The technical experts more frequently pick a lower ranked results -- although even the experts clearly prefer top ranked results.
The position bias as shown in Figure~\ref{fig:pos_bias} does not show a monotonically declining pattern, as some positions such as 6 and 9 are more popular than others. Closer inspection reveals that this is due to the popularity particular Q\&A sites, in particular \url{http://stackoverflow.com/}, that attract attention. As we are working with a single randomized SERP for each question\:---\:allowing us to compare position across participants\:---\:the distribution of popular Q\&A sites is not exactly uniform over the sample. So in addition to the position bias, we see a domain bias.
We can see an evidence of the snippet bias in participants behavior as they are selecting `correct' result URLs without clicking on them. Indeed, for these cases we can see that answers are provided in snippets.
\smallskip
Our main finding is that the click distribution shows evidence of the position bias of all participants. However, for the experts the position bias is less pronounced and they tend to check the lower positioned results.
\mypar{Impact on Search Outcome}
We now examine our third research question: \textbf{RQ1:}\textsl{How expert behaviour can be characterised? (expectations: they should be less biased to the position)}\
In order to collect the ground truth for correctness of the provided answers, we pooled results from the higher scoring experts and had the answers and URLs judged by an expert editorial judge.
As it turned out, on average 5 out of 10 results supported answering the task, varying between 2 and 8 per question.
\begin{figure*}[!t]
\centerline{
\includegraphics[width=0.45\linewidth]{pictures/plot_correct2_java_score.pdf}
~
\includegraphics[width=0.45\linewidth]{pictures/plot_correct2_javascript_score.pdf}}
\vspace{-10pt}
\caption{A distribution of right answers of participants with different expertise levels in Java (left) and JavaScript (right).}
\label{fig:answers}
\end{figure*}
Figure~\ref{fig:answers} shows the distribution of correct answers over expertise levels for Java (left) and for JavaScript (right). We see a clear relation for both Java and Java script: higher expertise levels lead to higher fractions of correct answers. The relation is highly significant (Pearson $\chi^2$, $p<0.0001$) for both Java and JavaScript.
There is an interesting deviation for those scoring very low on Java, yet producing many correct answers. A plausible explanation it that these participants have sufficient passive understanding, hence can recognize answers pages on the information on the web pages, but cannot actively produce this in the test. This is supported by their relatively high fractions of ``I don't know" answers on the Java expertise test.
\smallskip
Our main finding is that the participants with general programming expertise are able to find out the correct answers on SERP but they tend to select higher positioned pages in SERP. Clearly, the experts manage to detect better answers as they dig them from the bottom of SERP.
\section{Introduction}
\label{sec:intro}
Users exhibit remarkably different search behavior, due to various differences including domain expertise that can greatly influence their ability to carry out successful searches. The broad motivation of our work is to investigate how we can make non-experts search like experts. Users' domain expertise is not the same as search expertise~\citep{White_wsdm_2009}. It concerns knowledge of the topic of the information need and it does not regard knowledge of the search process. So far the differences in search behavior between experts and non-experts have been examined from the perspective of: \textbf{(1)} a query construction process; \textbf{(2)} search strategies; \textbf{(3)} and search outcomes.
In early work, \citet{marc:info93} found that general experts in computer science, business/economics, and law, searched more content driven, and used more technical query terms.
Using massive logs, \citet{White_wsdm_2009} observed differences in source selection (hostnames, TLDs), engagement (click-through rates), and vocabulary usage, for users with general expertise in medicine, finance, law, and computer science.
In a user study, \citet{cole:know11} show that task and domain knowledge are beneficial to link selection in medical literature search.
In related work, \citet{zhan:pred11} shows that we can predict the medical domain expertise level based on the variables in a user study.
In this paper, we focus on high levels of technical domain expertise, specifically experts proficient in two programming languages: Java and JavaScript, and are interested in the distinction with general programming expertise. This is different from earlier work comparing general experts against non-experts, as we focus on comparing degrees of technical domain expertise amongst experts, trying to find out if high levels of proficiency make a difference.
We study interactions with the Search Engine Result Page (SERP) by users with advanced technical domain expertise.
The scenario of users' interactions with a SERP is simple: a user runs a query $Q$ and the search engine retrieves the results ranked based on a relevance score~\citep{Craswell_2008}.
We want to understand if technical domain experts are able to find {`better'} answers to their queries by exploring the SERP. The study is motivated by our own frustration when using web search engines and Q\&A sites for technical how to questions, where the top ranked answers often are not the best results.
Evaluation of relevance ranking has traditionally relied on explicit human judgments or editorial labels. However, human judgments are expensive and difficult to derive from a broad audience. Moreover, it is difficult to simulate realistic information needs. User clicks are known as a good approximation towards obtaining \emph{implicit user feedback}~\citep{Agichtein_sigir_2006_1}.
This relies on the basic assumption that users click on relevant results. Therefore, leveraging click-through data has become a popular approach for evaluating and optimizing information retrieval systems~\citep{Brandt_2011}.
However, it is well known that user behavior on the SERP is biased. Different types of biases are discovered including:
\textbf{(1)} a \emph{position bias}~\citep{Joachims_2002, Joachims_2005}, users have a tendency to click on the first positions;
\textbf{(2)} a \emph{snippet bias}~\citep{Yue_2010}, snippets influence user decisions;
\textbf{(3)} a \emph{domain bias}~\citep{Ieong_2012}, that shows that users are already familiar with Internet and they are influenced by the domain of the URL;
\textbf{(4)} a \emph{beliefs bias}~\citep{White_2013}, users beliefs affect their search behaviour and their decision making.
Taking into consideration these biases suggests that not all clicks are equally useful for optimizing a ranking function. For one thing only successful clicks (satisfied or SAT clicks) should be taken into consideration.
Our expectation is that users with a high level of proficiency are less affected by these biases.
\citet{ageev_sigir_2011} proposed flexible and general informational search success model for in-depth analysis of search success which was tested based on game-like infrastructure for crowdsourcing search behaviour studies, specifically targeted towards capturing and evaluating successful search strategies on informational tasks with known intent.
\if 0
In this work, we suppose that an ultimate goal of search is to serve not just relevant results to users but also to provide \emph{`verified results'} (to save time users will spend to find out if provided answers are correct). We also suppose that nowadays SEs form beliefs of user and should take a responsibility to deliver \emph{`correct results'}.
In order to approach this goal we need to collect clicks from experts with some DE and to score them higher for a ranker for queries from this domain. Then non-experts users would get \emph{`verified results'} on the top of SERP.
First, we need to define a scope of information needs where we can re-use experts opinions. Specifically, we are interested in the questions where an objective (`correct') answer can be selected. E.g. we are not aiming to figure out an answer for the question `what is the best movie of 2015?' because it is subjective.
Second, it is important to understand if experts behaviour differs and if their page selection on SERP has \emph{a higher quality}. In this work, we select two programming languages as technical DE: $D_1$ = Java and $D_2$ = JavaScript.
\fi
The main research question studied in this paper is: How does technical domain expertise influence search behavior?\
We are particularly interested in what level of expertise is needed to make a difference: can we only trust the interactions of technical domain experts that essentially know the answers, or is a general familiarity with the domain sufficient?
We conduct an user study with explicit tests to derive user expertise level, to determine the impact of technical domain expertise. This is an important step toward fully automatic detection of expertise levels based on interaction behavior.
We have three concrete research questions:
\begin{description} \itemsep 0pt
\item \textbf{RQ1:}\textsl{How to define user expertise?}\
\item \textbf{RQ1:}\textsl{How to define experts topics?}\
\item \textbf{RQ1:}\textsl{How expert behaviour can be characterised? (expectations: they should be less biased to the position)}\
\end{description}
In order to answer our research questions, we organize a user study where we are trying to imitate a realistic scenario of search tasks in a technical domain. Study participants are all having some programming background but different levels of knowledge of
two programming languages: Java and JavaScript.
A typical use case is that experts use search engines to re-find an answer which is common practise especially in the programming domain. For domain experts it is easy to verify if a page contains the required answer. Participants with only general domain expertise typically are proficient in one programming language, say Java, but search for information in a unfamiliar programming language, say JavaScript.
Their fragmented understanding of the new language makes it much harder for them to recognize if a page contains the needed answers.
We imitate this scenario in our user study.
This paper is structured as follows:
\S\ref{sec:study_desc} details the setup of our user study, while
\S\ref{sec:res} discusses the results,
and we conclude in \S\ref{sec:conc}.
\vspace{-1.5ex}
\section{User Study Design}
\label{sec:study_desc}
\input{study_desc}
\vspace{-1.5ex}
\section{Results}
\label{sec:res}
\input{results}
\vspace{-1.5ex}
\section{Conclusions and Discussion}
\label{sec:conc}
The main aim of this paper was to investigate how technical domain expertise influences search behavior, focusing on high levels of proficiency in programming languages versus general programming expertise.
We studied three concrete research questions.
First, we investigated: \textbf{RQ1:}\textsl{How to define user expertise?}\
Our main finding was that the expertise test is effective and correlates well with the self-reported expertise.
Second, we looked at: \textbf{RQ1:}\textsl{How to define experts topics?}\
Our main finding was that the distribution of SAT clicks exhibited an evidence all participants were biased the URL position on SERP. However, the technical domain expert's biases was less pronounced and they tended to check the SERP's bottom.
Third, we examined: \textbf{RQ1:}\textsl{How expert behaviour can be characterised? (expectations: they should be less biased to the position)}\
Our main finding was that having a general programming expertise helped to derive the good answers on the SERP, but the experts with high proficiency managed to detect better answers as they dug them from the bottom of the SERP.
Our general conclusion is that participants with technical domain expertise behaved differently, and were more effective, than those with general expertise in the area. The differences are clear, but mostly a matter of degree, suggesting that there is value in both types of interactions. This suggests that properly weighting clicks relative to the expertise\:---\:and essentially use the expert behavior to get clicks of higher quality that hold the potential to improve the search result ranking.
We are currently working on the prediction of technical domain expertise levels based on behavioral data.
Our results are on technical domain expertise, where levels of proficiency can be crisply defined, and we focused on searches related to their work task using web search engines and Q\&A sites for technical how to questions. We expect our results to generalize to other specialized areas, typical of domain-specific search. In light of the earlier literature on domain expertise, these results suggest that we need to go beyond the separation of those with and without domain expertise or familiarity\:---\:the classic distinction between experts and novices\:---\:but that there is value in distinguishing high levels of domain expertise\:---\:the distinction between general expertise in the area, and those `who know the answer.'
\subsection*{Acknowledgments}
The questionnaires, collected data, and the code for running the study, are available from \url{http://www.win.tue.nl/~mpechen/projects/capa/#Datasets}.
This research has been partly supported by STW and it is the part of the CAPA\footnote{www.win.tue.nl/$\sim$mpechen/projects/capa/} project.
\vspace{-1.5ex}
\renewcommand{\bibsection}{\section*{References}}
\bibliographystyle{abbrvnat}
\renewcommand{\bibfont}{\small}
\setlength{\bibhang}{1em}
\setlength{\bibsep}{0 pt}
| {'timestamp': '2015-12-23T02:06:48', 'yymm': '1512', 'arxiv_id': '1512.07051', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.07051'} | arxiv |
\section{Introduction}
Supervised machine learning is a classic topic, in which a learning rule is tasked with producing a classifier
that mimics the classifications that would be assigned by an expert for a given task. To achieve this, the
learner is given access to a collection of examples (assumed to be i.i.d.) labeled with the correct classifications.
One of the major theoretical questions of interest in learning theory is: How many examples are necessary and sufficient
for a given learning rule to achieve low classification error rate? This quantity is known as the \emph{sample complexity},
and varies depending on how small the desired classification error rate is, the type of classifier we are attempting
to learn, and various other factors. Equivalently, the question is: How small of an error rate can we guarantee
a given learning rule will achieve, for a given number of labeled training examples?
A particularly simple setting for supervised learning is the \emph{realizable case}, in which it is assumed that,
within a given set $\mathbb{C}$ of classifiers, there resides some classifier that is \emph{always} correct.
The optimal sample complexity of learning in the realizable case has recently been completely resolved,
up to constant factors, in a sibling paper to the present article \citep*{hanneke:16a}. However, there remains the
important task of identifying interesting general families of algorithms achieving this optimal sample complexity.
For instance, the best known general upper bounds for the general family of \emph{empirical risk minimization} algorithms
differ from the optimal sample complexity by a logarithmic factor, and it is known that there exist spaces $\mathbb{C}$
for which this is unavoidable \citep*{auer:07}. This same logarithmic factor gap appears in the analysis of several other learning methods as well.
The present article focuses on this logarithmic factor, arguing that for certain types of learning rules, it can be entirely removed in some cases,
and for others it can be somewhat refined. The technique leading to these results is rooted in an idea introduced in the author's
doctoral dissertation \citep*{hanneke:thesis}. By further exploring this technique, we also obtain new
results for the related problem of \emph{active learning}. We also derive interesting new results for learning
with classification noise, where again the focus is on a logarithmic factor gap between upper and lower bounds.
\subsection{Basic Notation}
Before further discussing the results, we first introduce some essential notation.
Let $\mathcal X$ be any nonempty set, called the \emph{instance space},
equipped with a $\sigma$-algebra defining the measurable sets;
for simplicity, we will suppose the sets in $\{\{x\} : x \in \mathcal X\}$ are all measurable.
Let $\mathcal Y = \{-1,+1\}$ be the label space.
A \emph{classifier} is any measurable function $h : \mathcal X \to \mathcal Y$.
Following \citet*{vapnik:71}, define the VC dimension of a set $\mathcal{A}$ of subsets of $\mathcal X$, denoted ${\rm vc}(\mathcal{A})$, as
the maximum cardinality $|S|$ over subsets $S \subseteq \mathcal X$ such that $\{ S \cap A : A \in \mathcal{A} \} = 2^{S}$ (the power set of $S$);
if no such maximum cardinality exists, define ${\rm vc}(\mathcal{A}) = \infty$.
For any set $\H$ of classifiers,
denote by ${\rm vc}(\H) = {\rm vc}( \{ \{x : h(x)=+1\} : h \in \H \} )$ the VC dimension of $\H$.
Throughout, we fix a set $\mathbb{C}$ of classifiers, known as the \emph{concept space},
and abbreviate $\dim = {\rm vc}(\mathbb{C})$. To focus on nontrivial cases,
throughout we suppose $|\mathbb{C}| \geq 3$, which implies $\dim \geq 1$. We will also generally
suppose $\dim < \infty$ (though some of the results would still
hold without this restriction).
For any $L_{m} = \{(x_{1},y_{1}),\ldots,(x_{m},y_{m})\} \in (\mathcal X \times \mathcal Y)^{m}$,
and any classifier $h$, define ${\rm er}_{L_{m}}(h) = \frac{1}{m} \sum_{(x,y) \in L_{m}} \mathbbold{1}[ h(x) \neq y ]$.
For completeness, also define ${\rm er}_{\{\}}(h) = 0$.
Also, for any set $\H$ of classifiers, denote $\H[L_{m}] = \{ h \in \H : \forall (x,y) \in L_{m}, h(x) = y \}$,
referred to as the set of classifiers in $\H$ \emph{consistent} with $L_{m}$; for completeness, also define $\H[\{\}] = \H$.
Fix an arbitrary probability measure $\mathcal{P}$ on $\mathcal X$ (called the \emph{data distribution}),
and a classifier $f^{\star} \in \mathbb{C}$ (called the \emph{target function}).
For any classifier $h$, denote ${\rm er}(h) = \mathcal{P}(x : h(x) \neq f^{\star}(x))$, the \emph{error rate} of $h$.
Let $X_{1},X_{2},\ldots$ be independent $\mathcal{P}$-distributed random variables.
We generally denote $\L_{m} = \{ (X_{1},f^{\star}(X_{1})),\ldots,(X_{m},f^{\star}(X_{m}))\}$,
and $V_{m} = \mathbb{C}[\L_{m}]$ (called the \emph{version space}). The general setting
in which we are interested in producing a classifier $\hat{h}$ with small ${\rm er}(\hat{h})$,
given access to the data $\L_{m}$, is a special case of supervised learning known as the \emph{realizable case}
(in contrast to settings where the observed labeling
might not be realizable by any classifier in $\mathbb{C}$, due to label noise or model misspecification,
as discussed in Section~\ref{sec:noise}).
We adopt a few convenient notational conventions.
For any $m \in \mathbb{N}$, denote $[m] = \{1,\ldots,m\}$; also denote $[0] = \{\}$.
We adopt a shorthand notation for sequences, so that for a sequence $x_{1},\ldots,x_{m}$,
we denote $x_{[m]} = (x_{1},\ldots,x_{m})$.
For any $\mathbb{R}$-valued functions $f,g$, we write $f(z) \lesssim g(z)$ or $g(z) \gtrsim f(z)$
if there exists a finite numerical constant $c > 0$ such that $f(z) \leq c g(z)$ for all $z$.
For any $x,y \in \mathbb{R}$, denote $x \lor y = \max\{x,y\}$ and $x \land y = \min\{x,y\}$.
For $x \geq 0$, denote ${\rm Log}(x) = \ln(x \lor e)$ and ${\rm Log}_{2}(x) = \log_{2}(x \lor 2)$.
We also adopt the conventions that for $x > 0$, $x / 0 = \infty$,
and $0 {\rm Log}(x/0) = 0 {\rm Log}(\infty) = 0 \cdot \infty = 0$.
It will also be convenient to use the notation $\mathcal{Z}^{0} = \{()\}$ for a set $\mathcal{Z}$, where $()$ is the empty sequence.
Throughout, we also make the usual implicit assumption that all
quantities required to be measurable in the proofs and lemmas from the literature
are indeed measurable. See, for instance, \citet*{van-der-Vaart:96,van-der-Vaart:11}, for discussions
of conditions on $\mathbb{C}$ that typically suffice for this.
\subsection{Background and Summary of the Main Results}
This work concerns the study of the error rates achieved by various \emph{learning rules}: that is,
mappings from the data set $\L_{m}$ to a classifier $\hat{h}_{m}$; for simplicity, we sometimes refer
to $\hat{h}_{m}$ itself as a learning rule, leaving dependence on $\L_{m}$ implicit.
There has been a substantial amount of work on bounding the error rates of various learning rules
in the realizable case. Perhaps the most basic and natural type of learning rule in this setting is
the family of \emph{consistent} learning rules: that is, those that choose $\hat{h}_{m} \in V_{m}$.
There is a general upper bound for all consistent learning rules $\hat{h}_{m}$, due to \citet*{vapnik:74,blumer:89},
stating that with probability at least $1-\delta$,
\begin{equation}
\label{eqn:pac-upper-bound}
{\rm er}\left(\hat{h}_{m}\right) \lesssim \frac{1}{m} \left( \dim {\rm Log}\left(\frac{m}{\dim}\right) + {\rm Log}\left(\frac{1}{\delta}\right) \right).
\end{equation}
This is complemented by a general lower bound of \citet*{ehrenfeucht:89}, which states that for any learning rule (consistent or otherwise),
there exists a choice of $\mathcal{P}$ and $f^{\star} \in \mathbb{C}$ such that, with probability greater than $\delta$,
\begin{equation}
\label{eqn:pac-lower-bound}
{\rm er}\left(\hat{h}_{m}\right) \gtrsim \frac{1}{m} \left( \dim + {\rm Log}\left(\frac{1}{\delta}\right) \right).
\end{equation}
Resolving the logarithmic factor gap between \eqref{eqn:pac-lower-bound} and \eqref{eqn:pac-upper-bound}
has been a challenging subject of study for decades now, with many interesting contributions resolving special
cases and proposing sometimes-better upper bounds \citep*[e.g.,][]{haussler:94,gine:06,auer:07,long:03}.
It is known that the lower bound is sometimes \emph{not} achieved by certain consistent learning rules \citep*{auer:07}.
The question of whether the lower bound \eqref{eqn:pac-lower-bound} can
always be achieved by \emph{some} algorithm remained open for a number of years \citep*{ehrenfeucht:89,warmuth:04},
but has recently been resolved in a sibling paper to the present article \citep*{hanneke:16a}.
That work proposes a learning rule $\hat{h}_{m}$ based on a majority vote of classifiers consistent with
carefully-constructed subsamples of the data, and proves that with probability at least $1-\delta$,
\begin{equation*}
{\rm er}\left(\hat{h}_{m}\right) \lesssim \frac{1}{m} \left( \dim + {\rm Log}\left(\frac{1}{\delta}\right) \right).
\end{equation*}
However, several avenues for investigation remain open, including identifying interesting general families of learning rules
able to achieve this optimal bound under general conditions on $\mathbb{C}$. In particular, it remains an open problem
to determine necessary and sufficient conditions on $\mathbb{C}$ for the entire family of consistent learning rules
to achieve the above optimal error bound.
The work of \citet*{gine:06} includes a bound that refines the logarithmic factor in \eqref{eqn:pac-upper-bound} in certain scenarios.
Specifically, it states that, for any consistent learning rule $\hat{h}_{m}$, with probability at least $1-\delta$,
\begin{equation}
\label{eqn:gk-dc-intro}
{\rm er}\left(\hat{h}_{m}\right) \lesssim \frac{1}{m} \left( \dim {\rm Log}\left(\theta\left(\frac{\dim}{m}\right)\right) + {\rm Log}\left(\frac{1}{\delta}\right) \right),
\end{equation}
where $\theta(\cdot)$ is the \emph{disagreement coefficient} (defined below in Section~\ref{sec:cal}).
The doctoral dissertation of \citet*{hanneke:thesis} contains a simple and direct proof of this bound,
based on an argument which splits the data set in two parts, and considers the second part as containing
a subsequence sampled from the conditional distribution given the region of disagreement of the version
space induced by the first part of the data.
Many of the results in the present work are based on variations of this argument,
including a variety of interesting new bounds on the error rates achieved by certain families of learning rules.
As one of the cornerstones of this work, we find that a variant of this argument for consistent learning rules
with \emph{monotonic} error regions
leads to an upper bound that \emph{matches} the lower bound
\eqref{eqn:pac-lower-bound} up to constant factors.
For such monotonic consistent learning rules to exist, we
would need a very special kind of concept space. However, they do exist in some important cases.
In particular, in the special case of learning \emph{intersection-closed} concept spaces,
the \emph{Closure} algorithm \citep*{natarajan:87,auer:04,auer:07} can be shown to satisfy this monotonicity property.
Thus, this result immediately implies that, with probability at least $1-\delta$, the Closure algorithm
achieves
\begin{equation*}
{\rm er}(\hat{h}_{m}) \lesssim \frac{1}{m}\left( \dim + {\rm Log}\left( \frac{1}{\delta} \right) \right),
\end{equation*}
which was an open problem of \citet*{auer:04,auer:07};
this fact was recently
also obtained by \citet*{darnstadt:15},
via a related direct argument.
We also discuss a variant of this result for monotone learning rules expressible as \emph{compression schemes},
where we remove a logarithmic factor present in a result of \citet*{littlestone:86} and \citet*{floyd:95}, so that for $\hat{h}_{m}$
based on a compression scheme of size $n$, which has monotonic error regions (and is permutation-invariant), with probability at least
$1-\delta$,
\begin{equation*}
{\rm er}(\hat{h}_{m}) \lesssim \frac{1}{m}\left( n + {\rm Log}\left( \frac{1}{\delta} \right) \right).
\end{equation*}
This argument also has implications for \emph{active learning}.
In many active learning algorithms, the \emph{region of disagreement} of the version space induced by $m$ samples,
${\rm DIS}(V_{m}) = \{ x \in \mathcal X : \exists h,g \in V_{m} \text{ s.t. } h(x) \neq g(x) \}$,
plays an important role. In particular, the label complexity of the CAL active learning algorithm \citep*{cohn:94} is
largely determined by the rate at which $\mathcal{P}({\rm DIS}(V_{m}))$ decreases, so that any bound on this quantity
can be directly converted into a bound on the label complexity of CAL \citep*{hanneke:11a,hanneke:thesis,hanneke:fntml,el-yaniv:12}.
\citet*{hanneke:15a} have argued that the region ${\rm DIS}(V_{m})$ can be described
as a compression scheme, where the size of the compression scheme, denoted $\hat{n}_{m}$, is known as the \emph{version space compression set size}
(Definition~\ref{def:td-hat} below). By further observing that ${\rm DIS}(V_{m})$ is monotonic in $m$,
applying our general argument yields the fact that, with probability at least $1-\delta$, letting $\hat{n}_{1:m} = \max_{t \in [m]} \hat{n}_{t}$,
\begin{equation}
\label{eqn:PDIS-intro}
\mathcal{P}({\rm DIS}(V_{m})) \lesssim \frac{1}{m} \left( \hat{n}_{1:m} + {\rm Log}\left(\frac{1}{\delta}\right) \right),
\end{equation}
which is typically an improvement over the best previously-known general bound by a logarithmic factor.
In studying the distribution-free minimax label complexity of active learning,
\citet*{hanneke:15b} found that a simple combinatorial quantity $\mathfrak{s}$, which they term the \emph{star number},
is of fundamental importance. Specifically (see also Definition~\ref{def:star}), $\mathfrak{s}$ is the largest number $s$ of distinct points $x_{1},\ldots,x_{s} \in \mathcal X$
such that $\exists h_{0},h_{1},\ldots,h_{s} \in \mathbb{C}$ with $\forall i \in [s]$, ${\rm DIS}(\{h_{0},h_{i}\}) \cap \{x_{1},\ldots,x_{s}\} = \{x_{i}\}$,
or else $\mathfrak{s} = \infty$ if no such largest $s$ exists.
Interestingly, the work of \citet*{hanneke:15b} also establishes that the largest possible value of $\hat{n}_{m}$ (over $m$ and the data set) is exactly $\mathfrak{s}$.
Thus, \eqref{eqn:PDIS-intro} also implies a \emph{data-independent} and \emph{distribution-free} bound: with probability at least $1-\delta$,
\begin{equation*}
\mathcal{P}({\rm DIS}(V_{m})) \lesssim \frac{1}{m} \left( \mathfrak{s} + {\rm Log}\left(\frac{1}{\delta}\right) \right).
\end{equation*}
Now one interesting observation at this point is that the direct proof of \eqref{eqn:gk-dc-intro} from \citet*{hanneke:thesis}
involves a step in which $\mathcal{P}({\rm DIS}(V_{m}))$ is relaxed to a bound in terms of $\theta(\dim/m)$. If we instead use
\eqref{eqn:PDIS-intro} in this step, we arrive at a new bound on the error rates of \emph{all} consistent learning rules $\hat{h}_{m}$:
with probability at least $1-\delta$,
\begin{equation}
\label{eqn:erm-intro}
{\rm er}(\hat{h}_{m}) \lesssim \frac{1}{m}\left( \dim {\rm Log}\left( \frac{\hat{n}_{1:m}}{\dim} \right) + {\rm Log}\left(\frac{1}{\delta}\right) \right).
\end{equation}
Since \citet*{hanneke:15b} have shown that the maximum possible value of $\theta(\dim/m)$ (over $m$, $\mathcal{P}$, and $f^{\star}$)
is also exactly the star number $\mathfrak{s}$, while $\hat{n}_{1:m} / \dim$ has as its maximum possible value $\mathfrak{s}/\dim$, we see that the bound in
\eqref{eqn:erm-intro} sometimes reflects an improvement over \eqref{eqn:gk-dc-intro}.
It further implies a new data-independent and distribution-free bound for any consistent learning rule $\hat{h}_{m}$: with probability at least $1-\delta$,
\begin{equation*}
{\rm er}(\hat{h}_{m}) \lesssim \frac{1}{m}\left( \dim {\rm Log}\left( \frac{\min\{\mathfrak{s}, m\}}{\dim} \right) + {\rm Log}\left(\frac{1}{\delta}\right) \right).
\end{equation*}
Interestingly, we are able to complement this with a \emph{lower bound} in Section~\ref{sec:lower-bounds}.
Though not quite matching the above in terms of its joint dependence on $\dim$ and $\mathfrak{s}$ (and necessarily so),
this lower bound does provide the interesting observation that $\mathfrak{s} < \infty$ is \emph{necessary and sufficient} for
there to exist a distribution-free bound on the error rates of all consistent learning rules,
converging at a rate $\Theta(1/m)$, and otherwise (when $\mathfrak{s}=\infty$) the best such bound is $\Theta({\rm Log}(m)/m)$.
Continuing with the investigation of general consistent learning rules, we also find a variant of the argument of \citet*{hanneke:thesis}
that refines \eqref{eqn:gk-dc-intro} in a different way: namely, replacing $\theta(\cdot)$ with a quantity based on
considering a well-chosen \emph{subregion} of the region of disagreement, as studied by \citet*{balcan:07,zhang:14}.
Specifically, in the context of active learning, \citet*{zhang:14} have proposed a general quantity $\varphi_{c}(\cdot)$ (Definition~\ref{def:zc} below),
which is never larger than $\theta(\cdot)$, and is sometimes significantly smaller. By adapting our general argument
to replace ${\rm DIS}(V_{m})$ with this well-chosen subregion, we derive a bound for all consistent learning rules $\hat{h}_{m}$:
with probability at least $1-\delta$,
\begin{equation*}
{\rm er}(\hat{h}_{m}) \lesssim \frac{1}{m}\left( \dim {\rm Log}\left( \varphi_{c}\left( \frac{\dim}{m} \right) \right) + {\rm Log}\left(\frac{1}{\delta}\right) \right).
\end{equation*}
In particular, as a special case of this general result, we recover the theorem of \citet*{balcan:13} that all consistent learning rules have optimal
sample complexity (up to constants) for the problem of learning homogeneous linear separators under isotropic log-concave distributions,
as $\varphi_{c}(\dim/m)$ is bounded by a finite numerical constant in this case.
In Section~\ref{sec:noise}, we also extend this result to the problem of learning with \emph{classification noise},
where there is also a logarithmic factor gap between the known general-case upper and lower bounds.
In this context, we derive a new general upper bound under the Bernstein class condition (a generalization of Tsybakov's noise condition),
expressed in terms of a quantity related to $\varphi_{c}(\cdot)$, which applies to a particular learning rule.
This sometimes reflects an improvement over the best previous general upper bounds \citep*{massart:06,gine:06,hanneke:12b},
and again recovers a result of \citet*{balcan:13} for homogeneous linear separators under isotropic log-concave distributions,
as a special case.
For many of these results, we also state bounds on the \emph{expected} error rate: $\mathbb{E}\left[ {\rm er}(\hat{h}_{m}) \right]$.
In this case, the optimal distribution-free bound is known to be within a constant factor of $\dim/m$ \citep*{haussler:94,li:01},
and this rate is achieved by the one-inclusion graph prediction algorithm of \citet*{haussler:94}, as well as the majority voting method of \citet*{hanneke:16a}.
However, there remain interesting questions about whether other algorithms achieve this optimal performance, or require an extra logarithmic factor.
Again we find that \emph{monotone} consistent learning rules indeed achieve this optimal $\dim/m$ rate (up to constant factors),
while a distribution-free bound on $\mathbb{E}\left[ {\rm er}(\hat{h}_{m}) \right]$ with $\Theta(1/m)$ dependence on $m$
is achieved by all consistent learning rules if and only if $\mathfrak{s} < \infty$, and otherwise the best such bound has
$\Theta({\rm Log}(m)/m)$ dependence on $m$.
As a final interesting result, in the context of learning with classification noise, under the \emph{bounded} noise assumption \citep*{massart:06},
we find that the condition $\mathfrak{s} < \infty$ is actually \emph{necessary and sufficient} for the \emph{minimax optimal} excess error rate to
decrease at a rate $\Theta(1/m)$, and otherwise (if $\mathfrak{s}=\infty$) it decreases at a rate $\Theta({\rm Log}(m)/m)$.
This result generalizes several special-case analyses from the literature \citep*{massart:06,raginsky:11}.
Note that the ``necessity'' part of this statement is significantly stronger
than the above result for consistent learning rules in the realizable case,
since this result applies to the best error guarantee achievable by \emph{any} learning rule.
\section{Bounds for Consistent Monotone Learning}
\label{sec:abstract-bounds}
In order to state our results for monotonic learning rules in an abstract form, we introduce the following notation.
Let $\mathcal{Z}$ denote any space, equipped with a $\sigma$-algebra
defining the measurable subsets.
For any collection $\mathcal{A}$ of measurable subsets of $\mathcal{Z}$,
a \emph{consistent monotone rule} is any
sequence of functions $\psi_{t} : \mathcal{Z}^{t} \to \mathcal{A}$, $t \in \mathbb{N}$,
such that $\forall z_{1},z_{2},\ldots \in \mathcal{Z}$, $\forall t \in \mathbb{N}$,
$\psi_{t}(z_{1},\ldots,z_{t}) \cap \{z_{1},\ldots,z_{t}\} = \emptyset$,
and $\forall t \in \mathbb{N}$, $\psi_{t+1}(z_{1},\ldots,z_{t+1}) \subseteq \psi_{t}(z_{1},\ldots,z_{t})$.
We begin with the following very simple result, the proof of which
will also serve to introduce, in its simplest form, the core technique
underlying many of the results presented in later sections below.
\begin{theorem}
\label{thm:monotone-erm}
Let $\mathcal{A}$ be a collection of measurable subsets of $\mathcal{Z}$,
and let $\psi_{t} : \mathcal{Z}^{t} \to \mathcal{A}$ (for $t \in \mathbb{N}$) be any consistent monotone rule.
Fix any $m \in \mathbb{N}$, any $\delta \in (0,1)$,
and any probability measure $P$ on $\mathcal{Z}$.
Letting $Z_{1},\ldots,Z_{m}$ be independent $P$-distributed
random variables, and denoting $A_{m} = \psi_{m}(Z_{1},\ldots,Z_{m})$,
with probability at least $1-\delta$,
\begin{equation}
\label{eqn:monotone-erm-eps-conf}
P(A_{m}) \leq \frac{4}{m} \left( 17 {\rm vc}(\mathcal{A}) + 4 \ln\left(\frac{4}{\delta}\right) \right).
\end{equation}
Furthermore,
\begin{equation}
\label{eqn:monotone-erm-expectation}
\mathbb{E}[P(A_{m})] \leq \frac{68 ({\rm vc}(\mathcal{A})+1)}{m}.
\end{equation}
\end{theorem}
The overall structure of this proof is based on an argument of \citet*{hanneke:thesis}.
The most-significant novel element here is the use of monotonicity to further refine a logarithmic factor.
The proof relies on the following classic result. Results of this type are originally due to \citet*{vapnik:74};
the version stated here features slightly better constant factors, due to \citet*{blumer:89}.
\begin{lemma}
\label{lem:classic-erm}
For any collection $\mathcal{A}$ of measurable subsets of $\mathcal{Z}$,
any $\delta \in (0,1)$, any $m \in \mathbb{N}$, and any probability measure $P$ on $\mathcal{Z}$,
letting $Z_{1},\ldots,Z_{m}$ be independent $P$-distributed random variables,
with probability at least $1-\delta$, every $A \in \mathcal{A}$ with
$A \cap \{Z_{1},\ldots,Z_{m}\} = \emptyset$ satisfies
\begin{equation*}
P(A) \leq \frac{2}{m} \left( {\rm vc}(\mathcal{A}) {\rm Log}_{2}\left(\frac{2 e m}{{\rm vc}(\mathcal{A})}\right) + {\rm Log}_{2}\left(\frac{2}{\delta}\right) \right).
\end{equation*}
\end{lemma}
We are now ready for the proof of Theorem~\ref{thm:monotone-erm}.
\begin{proof}[of Theorem~\ref{thm:monotone-erm}]
Fix any probability measure $P$, let $Z_{1},Z_{2},\ldots$ be independent $P$-distributed random variables,
and for each $m \in \mathbb{N}$ denote $A_{m} = \psi_{m}(Z_{1},\ldots,Z_{m})$.
We begin with the inequality in \eqref{eqn:monotone-erm-eps-conf}.
The proof proceeds by induction on $m$.
If $m \leq 200$, then since $\log_{2}(400 e) < 34$ and $\log_{2}\left(\frac{2}{\delta}\right) < 8 \ln\left(\frac{4}{\delta}\right)$,
and since the definition of a consistent monotone rule implies $A_{m} \cap \{Z_{1},\ldots,Z_{m}\} = \emptyset$,
the stated bound follows immediately from Lemma~\ref{lem:classic-erm} for any $\delta \in (0,1)$.
Now, as an inductive hypothesis, fix any integer $m \geq 201$ such that,
$\forall m^{\prime} \in [m-1]$, $\forall \delta \in (0,1)$,
with probability at least $1-\delta$,
\begin{equation*}
P(A_{m^{\prime}}) \leq \frac{4}{m^{\prime}} \left( 17 {\rm vc}(\mathcal{A}) + 4 \ln\left(\frac{4}{\delta}\right) \right).
\end{equation*}
Now fix any $\delta \in (0,1)$
and define
\begin{equation*}
N = \left| \left\{ Z_{\lfloor m/2 \rfloor + 1},\ldots,Z_{m} \right\} \cap A_{\lfloor m/2 \rfloor} \right|,
\end{equation*}
and enumerate the elements of $\{ Z_{\lfloor m/2 \rfloor + 1},\ldots,Z_{m} \} \cap A_{\lfloor m/2 \rfloor}$
as $\hat{Z}_{1},\ldots,\hat{Z}_{N}$ (retaining their original order).
Note that $N = \sum_{t=\lfloor m/2 \rfloor + 1}^{m} \mathbbold{1}_{A_{\lfloor m/2 \rfloor}}(Z_{t})$
is conditionally ${\rm Binomial}(\lceil m/2 \rceil, P(A_{\lfloor m/2 \rfloor}))$-distributed
given $Z_{1},\ldots,Z_{\lfloor m/2 \rfloor}$.
In particular, with probability one, if $P(A_{\lfloor m/2 \rfloor}) = 0$, then $N = 0$.
Otherwise, if $P(A_{\lfloor m/2 \rfloor}) > 0$, then note that
$\hat{Z}_{1},\ldots,\hat{Z}_{N}$ are conditionally independent and $P(\cdot | A_{\lfloor m/2 \rfloor})$-distributed
given $Z_{1},\ldots,Z_{\lfloor m/2 \rfloor}$ and $N$.
Thus, since $A_{m} \cap \{\hat{Z}_{1},\ldots,\hat{Z}_{N}\} \subseteq A_{m} \cap \{Z_{1},\ldots,Z_{m}\} = \emptyset$,
applying Lemma~\ref{lem:classic-erm} (under the conditional distribution given $N$ and $Z_{1},\ldots,Z_{\lfloor m/2 \rfloor}$), combined with the
law of total probability, we have that on an event $E_{1}$ of probability at least $1-\delta/2$, if $N > 0$, then
\begin{equation*}
P(A_{m} | A_{\lfloor m/2 \rfloor}) \leq \frac{2}{N} \left( {\rm vc}(\mathcal{A}) {\rm Log}_{2}\left(\frac{2 e N}{{\rm vc}(\mathcal{A})}\right) + \log_{2}\left(\frac{4}{\delta}\right) \right).
\end{equation*}
Additionally, again since $N$ is conditionally ${\rm Binomial}(\lceil m/2 \rceil, P(A_{\lfloor m/2 \rfloor}))$-distributed
given $Z_{1},\ldots,Z_{\lfloor m/2 \rfloor}$,
applying a Chernoff bound (under the conditional distribution given $Z_{1},\ldots,Z_{\lfloor m/2 \rfloor}$),
combined with the law of total probability, we obtain that on an event $E_{2}$ of probability at least $1 - \delta/4$,
if $P(A_{\lfloor m/2 \rfloor}) \geq \frac{16}{m} \ln\left(\frac{4}{\delta}\right)$,
then
\begin{equation*}
N \geq P(A_{\lfloor m/2 \rfloor}) \lceil m/2 \rceil / 2
\geq P(A_{\lfloor m/2 \rfloor}) m / 4.
\end{equation*}
In particular, if $P(A_{\lfloor m/2 \rfloor}) \geq \frac{16}{m} \ln\left(\frac{4}{\delta}\right)$,
then $P(A_{\lfloor m/2 \rfloor}) m / 4 > 0$, so that if this occurs with $E_{2}$, then we have $N > 0$.
Noting that ${\rm Log}_{2}(x) \leq {\rm Log}(x)/\ln(2)$, then by monotonicity of $x \mapsto {\rm Log}(x)/x$ for $x > 0$,
we have that on $E_{1} \cap E_{2}$, if $P(A_{\lfloor m/2 \rfloor}) \geq \frac{16}{m} \ln\left(\frac{4}{\delta}\right)$,
then
\begin{equation*}
P(A_{m} | A_{\lfloor m/2 \rfloor}) \leq \frac{8}{P(A_{\lfloor m/2 \rfloor}) m \ln(2)} \left( {\rm vc}(\mathcal{A}) {\rm Log}\left(\frac{e P(A_{\lfloor m/2 \rfloor}) m}{2 {\rm vc}(\mathcal{A})}\right) + \ln\left(\frac{4}{\delta}\right) \right).
\end{equation*}
The monotonicity property of $\psi_{t}$ implies $A_{m} \subseteq A_{\lfloor m/2 \rfloor}$.
Together with monotonicity of probability measures, this implies $P(A_{m}) \leq P(A_{\lfloor m/2 \rfloor})$.
It also implies that, if $P(A_{\lfloor m/2 \rfloor}) > 0$, then $P(A_{m}) = P(A_{m} | A_{\lfloor m/2 \rfloor}) P(A_{\lfloor m/2 \rfloor})$.
Thus, on $E_{1} \cap E_{2}$, if
$P(A_{m}) \geq \frac{16}{m} \ln\left(\frac{4}{\delta}\right)$,
then
\begin{equation*}
P(A_{m}) \leq \frac{8}{m \ln(2)} \left( {\rm vc}(\mathcal{A}) {\rm Log}\left(\frac{e P(A_{\lfloor m/2 \rfloor}) m}{2 {\rm vc}(\mathcal{A})}\right) + \ln\left(\frac{4}{\delta}\right) \right).
\end{equation*}
The inductive hypothesis implies that, on an event $E_{3}$ of probability at least $1 - \delta/4$,
\begin{equation*}
P(A_{\lfloor m/2 \rfloor})
\leq \frac{4}{\lfloor m/2 \rfloor} \left( 17 {\rm vc}(\mathcal{A}) + 4 \ln\left(\frac{16}{\delta}\right) \right).
\end{equation*}
Since $m \geq 201$, we have $\lfloor m/2 \rfloor \geq (m-2)/2 \geq (199/402)m$, so that the above implies
\begin{equation*}
P(A_{\lfloor m/2 \rfloor})
\leq \frac{4 \cdot 402}{199 m} \left( 17 {\rm vc}(\mathcal{A}) + 4 \ln\left(\frac{16}{\delta}\right) \right).
\end{equation*}
Thus, on $E_{1} \cap E_{2} \cap E_{3}$, if $P(A_{m}) \geq \frac{16}{m} \ln\left(\frac{4}{\delta}\right)$, then
\begin{equation*}
P(A_{m}) \leq \frac{8}{m \ln(2)} \left( {\rm vc}(\mathcal{A}) {\rm Log}\left(\frac{ 2 \cdot 402 e}{199} \left( 17 + \frac{4}{{\rm vc}(\mathcal{A})} \ln\left(\frac{16}{\delta}\right) \right) \right) + \ln\left(\frac{4}{\delta}\right) \right).
\end{equation*}
Lemma~\ref{lem:log-factors-abstract} in Appendix~\ref{app:technical-lemmas} allows us to simplify the logarithmic term here,
revealing that the right hand side is at most
\begin{align*}
& \frac{8}{m \ln(2)} \left( {\rm vc}(\mathcal{A}) {\rm Log}\left(\frac{2 \cdot 402 e}{199} \left( 17 + 4\ln(4) + \frac{4}{\ln(4/e)} \right) \right) + \left(1 + \ln\left(\frac{4}{e}\right)\right)\ln\left(\frac{4}{\delta}\right) \right)
\\ & \leq \frac{4}{m} \left( 17 {\rm vc}(\mathcal{A}) + 4 \ln\left(\frac{4}{\delta}\right) \right).
\end{align*}
Since $\frac{16}{m} \ln\left(\frac{4}{\delta}\right) \leq \frac{4}{m} \left( 17 {\rm vc}(\mathcal{A}) + 4 \ln\left(\frac{4}{\delta}\right) \right)$,
we have that, on $E_{1} \cap E_{2} \cap E_{3}$, regardless of whether or not $P(A_{m}) \geq \frac{16}{m} \ln\left(\frac{4}{\delta}\right)$, we have
\begin{equation*}
P(A_{m}) \leq \frac{4}{m} \left( 17 {\rm vc}(\mathcal{A}) + 4 \ln\left(\frac{4}{\delta}\right) \right).
\end{equation*}
Noting that, by the union bound, the event $E_{1} \cap E_{2} \cap E_{3}$ has probability at least $1-\delta$,
this extends the inductive hypothesis to $m^{\prime} = m$. By the principle of induction, this completes the proof of the
first claim in Theorem~\ref{thm:monotone-erm}.
For the bound on the expectation in \eqref{eqn:monotone-erm-expectation},
we note that, letting $\varepsilon_{m} \!=\! \frac{4}{m} \!\left( 17 {\rm vc}(\mathcal{A}) + 4 \ln(4) \right)$,
by setting the bound in \eqref{eqn:monotone-erm-eps-conf} equal to a value $\varepsilon$ and solving for $\delta$,
the value of which is in $(0,1)$ for any $\varepsilon > \varepsilon_{m}$,
the result just established can be restated as:
$\forall \varepsilon > \varepsilon_{m}$,
\begin{equation*}
\P\left( P(A_{m}) > \varepsilon \right) \leq 4 \exp\left\{ (17/4) {\rm vc}(\mathcal{A}) - \varepsilon m / 16 \right\}.
\end{equation*}
Furthermore, for any $\varepsilon \leq \varepsilon_{m}$, we of course
still have $\P\left( P(A_{m}) > \varepsilon \right) \leq 1$.
Therefore, we have that
\begin{align*}
\mathbb{E}\left[ P(A_{m}) \right]
& = \int_{0}^{\infty} \P\left( P(A_{m}) > \varepsilon \right) {\rm d}\varepsilon
\leq \varepsilon_{m} + \int_{\varepsilon_{m}}^{\infty} 4 \exp\left\{ (17/4) {\rm vc}(\mathcal{A}) - \varepsilon m / 16 \right\} {\rm d}\varepsilon
\\ & = \varepsilon_{m} + \frac{4 \cdot 16}{m} \exp\left\{ (17/4) {\rm vc}(\mathcal{A}) - \varepsilon_{m} m / 16 \right\}
= \frac{4}{m} \left( 17 {\rm vc}(\mathcal{A}) + 4\ln(4) \right) + \frac{16}{m}
\\ & = \frac{4}{m} \left( 17 {\rm vc}(\mathcal{A}) + 4\ln(4e) \right)
\leq \frac{68 {\rm vc}(\mathcal{A})+39}{m}
\leq \frac{68 ({\rm vc}(\mathcal{A})+1)}{m}.
\end{align*}
\end{proof}
We can also state a variant of Theorem~\ref{thm:monotone-erm} applicable to \emph{sample compression schemes},
which will in fact be more useful for our purposes below. To state this result,
we first introduce the following additional terminology.
For any $t \in \mathbb{N}$, we say that a function $\psi : \mathcal{Z}^{t} \to \mathcal{A}$ is
\emph{permutation-invariant} if every $z_{1},\ldots,z_{t} \in \mathcal{Z}$ and every
bijection $\kappa : [t] \to [t]$ satisfy $\psi(z_{\kappa(1)},\ldots,z_{\kappa(t)}) = \psi(z_{1},\ldots,z_{t})$.
For
any $n \in \mathbb{N} \cup \{0\}$, a
\emph{consistent monotone sample compression rule of size $n$} is a
consistent monotone rule $\psi_{t}$ with the additional properties that,
$\forall t \in \mathbb{N}$, $\psi_{t}$ is permutation-invariant,
and $\forall z_{1},\ldots,z_{t} \in \mathcal{Z}$, $\exists \emp{\cs}_{t}(z_{[t]}) \in [\min\{n,t\}] \cup \{0\}$
such that
\begin{equation*}
\psi_{t}(z_{1},\ldots,z_{t}) = \phi_{t,\emp{\cs}_{t}(z_{[t]})}( z_{i_{t,1}(z_{[t]})},\ldots,z_{i_{t,\emp{\cs}_{t}(z_{[t]})}(z_{[t]})} ),
\end{equation*}
where $\phi_{t,k} : \mathcal{Z}^{k} \to \mathcal{A}$ is a permutation-invariant function for each $k \in [\min\{n,t\}] \cup \{0\}$,
and $i_{t,1},\ldots,i_{t,n}$ are functions $\mathcal{Z}^{t} \to [t]$
such that $\forall z_{1},\ldots,z_{t} \in \mathcal{Z}$,
$i_{t,1}(z_{[t]}),\ldots,i_{t,\emp{\cs}_{t}(z_{[t]})}(z_{[t]})$ are all distinct.
In words, the element of $\mathcal{A}$ mapped to by $\psi_{t}(z_{1},\ldots,z_{t})$
depends only on the unordered (multi)set $\{z_{1},\ldots,z_{t}\}$,
and can be specified by an unordered subset of $\{z_{1},\ldots,z_{t}\}$
of size at most $n$.
Following the terminology from the literature on sample compression schemes,
we refer to the collection of functions $\{ (\emp{\cs}_{t},i_{t,1},\ldots,i_{t,\emp{\cs}_{t}}) : t \in \mathbb{N} \}$
as the \emph{compression function} of $\psi_{t}$, and to the collection of permutation-invariant functions $\{\phi_{t,k} : t \in \mathbb{N}, k \in [\min\{n,t\}] \cup \{0\}\}$
as the \emph{reconstruction function} of $\psi_{t}$.
This kind of $\psi_{t}$ is a type of sample compression scheme \citep*[see][]{littlestone:86,floyd:95},
though certainly not all permutation-invariant compression schemes yield consistent monotone rules.
Below, we find that consistent monotone sample compression rules of a quantifiable size
arise naturally in the analysis of certain learning algorithms
(namely, the Closure algorithm and the CAL active learning algorithm).
With the above terminology in hand, we can now state our second abstract result.
\begin{theorem}
\label{thm:monotone-compression}
Fix any $n \in \mathbb{N} \cup \{0\}$,
let $\mathcal{A}$ be a collection of measurable subsets of $\mathcal{Z}$,
and let $\psi_{t} : \mathcal{Z}^{t} \to \mathcal{A}$ (for $t \in \mathbb{N}$) be any consistent monotone sample compression rule of size $n$.
Fix any $m \in \mathbb{N}$, $\delta \in (0,1)$,
and any probability measure $P$ on $\mathcal{Z}$.
Letting $Z_{1},\ldots,Z_{m}$ be independent $P$-distributed
random variables, and denoting $A_{m} = \psi_{m}(Z_{1},\ldots,Z_{m})$,
with probability at least $1-\delta$,
\begin{equation}
\label{eqn:monotone-compression-eps-conf}
P(A_{m}) \leq \frac{1}{m}\left( 21 n + 16 \ln\left(\frac{3}{\delta}\right) \right).
\end{equation}
Furthermore,
\begin{equation}
\label{eqn:monotone-compression-expectation}
\mathbb{E}[P(A_{m})] \leq \frac{21 n + 34}{m}.
\end{equation}
\end{theorem}
The proof of Theorem~\ref{thm:monotone-compression} relies on the following
classic result due to \citet*{littlestone:86,floyd:95}
(see also \citealp*{herbrich:02,hanneke:15a}, for a clear and direct proof).
\begin{lemma}
\label{lem:classic-compression}
Fix any collection $\mathcal{A}$ of measurable subsets of $\mathcal{Z}$,
any $m \in \mathbb{N}$ and $n \in \mathbb{N} \cup \{0\}$ with $n < m$,
and any permutation-invariant functions $\phi_{k} : \mathcal{Z}^{k} \to \mathcal{A}$, $k \in [n] \cup \{0\}$.
For any probability measure $P$ on $\mathcal{Z}$,
letting $Z_{1},\ldots,Z_{m}$ be independent $P$-distributed random variables,
for any $\delta \in (0,1)$, with probability at least $1-\delta$,
every $k \in [n] \cup \{0\}$, and every distinct $i_{1},\ldots,i_{k} \in [m]$ with
$\phi_{k}(Z_{i_{1}},\ldots,Z_{i_{k}}) \cap \{Z_{1},\ldots,Z_{m}\} = \emptyset$ satisfy
\begin{equation*}
P\left( \phi_{k}(Z_{i_{1}},\ldots,Z_{i_{k}}) \right) \leq \frac{1}{m-n} \left( n {\rm Log}\left(\frac{e m}{n}\right) + {\rm Log}\left(\frac{1}{\delta}\right) \right).
\end{equation*}
\end{lemma}
With this lemma in hand, we are ready for the proof of Theorem~\ref{thm:monotone-compression}.
\begin{proof}[of Theorem~\ref{thm:monotone-compression}]
The proof follows analogously to that of Theorem~\ref{thm:monotone-erm},
but with several additional complications due to the form of
Lemma~\ref{lem:classic-compression} being somewhat different
from that of Lemma~\ref{lem:classic-erm}.
Let $\{ (\emp{\cs}_{t},i_{t,1},\ldots,i_{t,\emp{\cs}_{t}}) : t \in \mathbb{N} \}$ and $\{\phi_{t,k} : t \in \mathbb{N}, k \in [\min\{n,t\}] \cup \{0\} \}$
be the compression function and reconstruction function of $\psi_{t}$, respectively.
For convenience, also denote $\psi_{0}() = \mathcal{Z}$, and note that this extends the monotonicity
property of $\psi_{t}$ to $t \in \mathbb{N} \cup \{0\}$.
Fix any probability measure $P$,
let $Z_{1},Z_{2},\ldots$ be independent $P$-distributed random variables,
and for each $m \in \mathbb{N}$ denote $A_{m} = \psi_{m}(Z_{1},\ldots,Z_{m})$.
We begin with the inequality in \eqref{eqn:monotone-compression-eps-conf}.
The special case of $n = 0$ is directly implied by Lemma~\ref{lem:classic-compression},
so for the remainder of the proof of \eqref{eqn:monotone-compression-eps-conf}, we suppose $n \geq 1$.
The proof proceeds by induction on $m$.
Since $P(A) \leq 1$ for all $A \in \mathcal{A}$,
and since $21 + 16 \ln(3) > 38$,
the stated bound is trivially satisfied for all $\delta \in (0,1)$ if $m \leq \max\{38,21n\}$.
Now, as an inductive hypothesis, fix any integer $m > \max\{38,21n\}$ such that,
$\forall m^{\prime} \in [m-1]$, $\forall \delta \in (0,1)$,
with probability at least $1-\delta$,
\begin{equation*}
P(A_{m^{\prime}}) \leq \frac{1}{m^{\prime}} \left( 21 n + 16 \ln\left(\frac{3}{\delta}\right) \right).
\end{equation*}
Fix any $\delta \in (0,1)$
and define
\begin{equation*}
N = \left| \left\{ Z_{\lfloor m/2 \rfloor + 1},\ldots,Z_{m} \right\} \cap A_{\lfloor m/2 \rfloor} \right|,
\end{equation*}
and enumerate the elements of $\{ Z_{\lfloor m/2 \rfloor + 1},\ldots,Z_{m} \} \cap A_{\lfloor m/2 \rfloor}$
as $\hat{Z}_{1},\ldots,\hat{Z}_{N}$.
Also enumerate the elements of $\{Z_{\lfloor m/2 \rfloor + 1},\ldots,Z_{m}\} \setminus A_{\lfloor m/2 \rfloor}$
as $\hat{Z}_{1}^{\prime},\ldots,\hat{Z}_{\lceil m/2 \rceil - N}^{\prime}$.
Now note that, by the monotonicity property of $\psi_{t}$, we have $A_{m} \subseteq A_{\lfloor m/2 \rfloor}$.
Furthermore, by permutation-invariance of $\psi_{t}$,
we have that
\begin{equation*}
A_{m} = \psi_{m}\left(\hat{Z}_{1},\ldots,\hat{Z}_{N}, Z_{1},\ldots,Z_{\lfloor m/2 \rfloor}, \hat{Z}_{1}^{\prime},\ldots,\hat{Z}_{\lceil m/2 \rceil - N}^{\prime} \right).
\end{equation*}
Combined with the monotonicity property of $\psi_{t}$, this implies that
$A_{m} \subseteq \psi_{N}\left( \hat{Z}_{1},\ldots,\hat{Z}_{N} \right)$.
Altogether, we have that
\begin{equation}
\label{eqn:monotone-compression-conditional-subset}
A_{m} \subseteq A_{\lfloor m/2 \rfloor} \cap \psi_{N}\left( \hat{Z}_{1},\ldots,\hat{Z}_{N} \right).
\end{equation}
Note that $N = \sum_{t=\lfloor m/2 \rfloor + 1}^{m} \mathbbold{1}_{A_{\lfloor m/2 \rfloor}}(Z_{t})$
is conditionally ${\rm Binomial}(\lceil m/2 \rceil, P(A_{\lfloor m/2 \rfloor}))$-distributed
given $Z_{1},\ldots,Z_{\lfloor m/2 \rfloor}$.
In particular, with probability one, if $P(A_{\lfloor m/2 \rfloor}) = 0$, then $N = 0 \leq n$.
Otherwise, if $P(A_{\lfloor m/2 \rfloor}) > 0$, then note that
$\hat{Z}_{1},\ldots,\hat{Z}_{N}$ are conditionally independent and $P(\cdot | A_{\lfloor m/2 \rfloor})$-distributed
given $N$ and $Z_{1},\ldots,Z_{\lfloor m/2 \rfloor}$.
Since $\psi_{t}$ is a consistent monotone rule, we have that
$\psi_{N}( \hat{Z}_{1}, \ldots, \hat{Z}_{N} ) \cap \{ \hat{Z}_{1},\ldots,\hat{Z}_{N} \} = \emptyset$.
We also have, by definition of $\psi_{N}$, that
$\psi_{N}( \hat{Z}_{1}, \ldots, \hat{Z}_{N} ) = \phi_{N,\emp{\cs}_{N}(\hat{Z}_{[N]})}\left( \hat{Z}_{i_{N,1}(\hat{Z}_{[N]})}, \ldots, \hat{Z}_{i_{N,\emp{\cs}_{N}(\hat{Z}_{[N]})}(\hat{Z}_{[N]})} \right)$.
Thus, applying Lemma~\ref{lem:classic-compression} (under the conditional distribution given $N$ and $Z_{1},\ldots,Z_{\lfloor m/2 \rfloor}$),
combined with the law of total probability, we have that on an event $E_{1}$ of probability at least $1-\delta/3$,
if $N > n$, then
\begin{equation*}
P\left( \psi_{N}\left( \hat{Z}_{1}, \ldots, \hat{Z}_{N} \right) \middle| A_{\lfloor m/2 \rfloor} \right)
\leq \frac{1}{N-n} \left( n \ln\left( \frac{e N}{n} \right) + \ln\left(\frac{3}{\delta}\right) \right).
\end{equation*}
Combined with \eqref{eqn:monotone-compression-conditional-subset} and monotonicity of
measures, this implies
that on $E_{1}$, if $N > n$, then
\begin{align*}
P(A_{m}) \leq P\!\left( A_{\lfloor m/2 \rfloor} \!\cap\! \psi_{N}\!\left( \hat{Z}_{1}, \ldots, \hat{Z}_{N} \right) \right)
& = P(A_{\lfloor m/2 \rfloor}) P\!\left( A_{\lfloor m/2 \rfloor} \!\cap\! \psi_{N}\!\left( \hat{Z}_{1}, \ldots, \hat{Z}_{N} \right) \middle| A_{\lfloor m/2 \rfloor} \right)
\\ & \leq P(A_{\lfloor m/2 \rfloor}) \frac{1}{N-n} \left( n \ln\left( \frac{e N}{n} \right) + \ln\left(\frac{3}{\delta}\right) \right).
\end{align*}
Additionally, again since $N$ is conditionally ${\rm Binomial}(\lceil m/2 \rceil, P(A_{\lfloor m/2 \rfloor}))$-distributed
given $Z_{1},\ldots,Z_{\lfloor m/2 \rfloor}$,
applying a Chernoff bound (under the conditional distribution given $Z_{1},\ldots,Z_{\lfloor m/2 \rfloor}$),
combined with the law of total probability, we obtain that on an event $E_{2}$ of probability at least $1 - \delta/3$,
if $P(A_{\lfloor m/2 \rfloor}) \geq \frac{16}{m} \ln\left(\frac{3}{\delta}\right) \geq \frac{8}{\lceil m/2 \rceil} \ln\left(\frac{3}{\delta}\right)$, then
\begin{equation*}
N \geq P(A_{\lfloor m/2 \rfloor}) \lceil m/2 \rceil / 2 \geq P(A_{\lfloor m/2 \rfloor}) m / 4.
\end{equation*}
Also note that if $P(A_{m}) \geq \frac{1}{m} \left( 21 n + 16 \ln\left(\frac{3}{\delta}\right) \right)$,
then \eqref{eqn:monotone-compression-conditional-subset} and monotonicity of probability measures
imply $P(A_{\lfloor m/2 \rfloor}) \geq \frac{1}{m} \left( 21 n + 16 \ln\left(\frac{3}{\delta}\right) \right)$ as well.
In particular, if this occurs with $E_{2}$, then we have $N \geq P(A_{\lfloor m/2 \rfloor}) m / 4 > 5 n$.
Thus, by monotonicity of $x \mapsto {\rm Log}(x)/x$ for $x > 0$, we have that on $E_{1} \cap E_{2}$,
if $P(A_{m}) \geq \frac{1}{m} \left( 21 n + 16 \ln\left(\frac{3}{\delta}\right) \right)$,
then
\begin{align*}
P(A_{m}) & < P(A_{\lfloor m/2 \rfloor}) \frac{1}{N - (N/5)} \left( n {\rm Log}\left(\frac{e N}{n}\right) + \ln\left(\frac{3}{\delta}\right) \right)
\\ & \leq \frac{5}{m} \left( n {\rm Log}\left(\frac{e P(A_{\lfloor m/2 \rfloor}) m}{4 n}\right) + \ln\left(\frac{3}{\delta}\right) \right).
\end{align*}
The inductive hypothesis implies that, on an event $E_{3}$ of probability at least $1 - \delta/3$,
\begin{equation*}
P(A_{\lfloor m/2 \rfloor})
\leq \frac{1}{\lfloor m/2 \rfloor} \left( 21 n + 16 \ln\left(\frac{9}{\delta}\right) \right).
\end{equation*}
Since $m \geq 39$, we have $\lfloor m/2 \rfloor \geq (m-2)/2 \geq (37/78)m$, so that the above implies
\begin{equation*}
P(A_{\lfloor m/2 \rfloor}) \leq \frac{78}{37 m} \left( 21 n + 16 \ln\left(\frac{9}{\delta}\right) \right).
\end{equation*}
Thus, on $E_{1} \cap E_{2} \cap E_{3}$, if $P(A_{m}) \geq \frac{1}{m} \left( 21 n + 16 \ln\left(\frac{3}{\delta}\right) \right)$,
then
\begin{align*}
P(A_{m}) & < \frac{5}{m} \left( n {\rm Log}\left( \frac{78 e}{4 \cdot 37} \left( 21 + \frac{16}{n} \ln\left(\frac{9}{\delta}\right) \right) \right) + \ln\left(\frac{3}{\delta}\right) \right)
\\ & \leq \frac{5}{m} \left( n {\rm Log}\left( \frac{78 \cdot 20}{37 \cdot 11} \left( \frac{21 \cdot 11 e}{16 \cdot 5} + \frac{11 e}{5} \ln(3) + \frac{11 e}{5 n} \ln\left(\frac{3}{\delta}\right) \right) \right) + \ln\left(\frac{3}{\delta}\right) \right).
\end{align*}
By Lemma~\ref{lem:log-factors-abstract} in Appendix~\ref{app:technical-lemmas},
this last expression is at most
\begin{equation*}
\frac{5}{m} \left( n {\rm Log}\left( \frac{78 \cdot 20}{37 \cdot 11} \left( \frac{21 \cdot 11 e}{16 \cdot 5} + \frac{11 e}{5} \ln(3) + e \right) \right) + \frac{16}{5} \ln\left(\frac{3}{\delta}\right) \right)
< \frac{1}{m} \left( 21 n + 16 \ln\left(\frac{3}{\delta}\right) \right),
\end{equation*}
contradicting the condition $P(A_{m}) \geq \frac{1}{m} \left( 21 n + 16 \ln\left(\frac{3}{\delta}\right) \right)$.
Therefore,
on $E_{1} \cap E_{2} \cap E_{3}$,
\begin{equation*}
P(A_{m}) < \frac{1}{m} \left( 21 n + 16 \ln\left(\frac{3}{\delta}\right) \right).
\end{equation*}
Noting that, by the union bound, the event $E_{1} \cap E_{2} \cap E_{3}$ has probability at least $1-\delta$,
this extends the inductive hypothesis to $m^{\prime} = m$. By the principle of induction, this completes the proof of the
first claim in Theorem~\ref{thm:monotone-compression}.
For the bound on the expectation in \eqref{eqn:monotone-compression-expectation},
we note that (as in the proof of Theorem~\ref{thm:monotone-erm}),
letting $\varepsilon_{m} = \frac{1}{m} \left( 21 n + 16 \ln(3) \right)$,
the result just established can be restated as:
$\forall \varepsilon > \varepsilon_{m}$,
\begin{equation*}
\P\left( P(A_{m}) > \varepsilon \right) \leq 3 \exp\left\{ (21/16) n - \varepsilon m / 16 \right\}.
\end{equation*}
Specifically, this is obtained by setting the bound in \eqref{eqn:monotone-compression-eps-conf}
equal to $\varepsilon$ and solving for $\delta$,
the value of which is in $(0,1)$ for any $\varepsilon > \varepsilon_{m}$.
Furthermore, for any $\varepsilon \leq \varepsilon_{m}$, we of course
still have $\P\left( P(A_{m}) > \varepsilon \right) \leq 1$.
Therefore, we have that
\begin{align*}
\mathbb{E}\left[ P(A_{m}) \right]
& = \int_{0}^{\infty} \P\left( P(A_{m}) > \varepsilon \right) {\rm d}\varepsilon
\leq \varepsilon_{m} + \int_{\varepsilon_{m}}^{\infty} 3 \exp\left\{ (21/16) n - \varepsilon m / 16 \right\} {\rm d}\varepsilon
\\ & = \varepsilon_{m} + \frac{3 \cdot 16}{m} \exp\left\{ (21/16) n - \varepsilon_{m} m / 16 \right\}
= \frac{1}{m} \left(21 n + 16 \ln(3)\right) + \frac{16}{m}
\\ & = \frac{1}{m} \left( 21 n + 16 \ln(3e) \right)
\leq \frac{21 n + 34}{m}.
\end{align*}
{\vskip -6.5mm}
\end{proof}
\section{Application to the Closure Algorithm for Intersection-Closed Classes}
\label{sec:int-closed}
One family of concept spaces studied in the learning theory literature,
due to their interesting special properties, is the \emph{intersection-closed} classes \citep*{natarajan:87,helmbold:90,haussler:94,kuhlmann:99,auer:07}.
Specifically, the class $\mathbb{C}$ is called \emph{intersection-closed} if
the collection of sets $\{ \{x : h(x) = +1\} : h \in \mathbb{C} \}$ is closed under intersections:
that is, for every $h,g \in \mathbb{C}$, the classifier $x \mapsto 2 \mathbbold{1}[ h(x) = g(x) = +1 ] - 1$ is also contained in $\mathbb{C}$.
For instance, the class of conjunctions on $\{0,1\}^{p}$, the class of axis-aligned rectangles on $\mathbb{R}^{p}$,
and the class $\{ h : | \{ x : h(x) = +1 \} | \leq \dim \}$ of classifiers labeling at most $\dim$ points positive,
are all intersection-closed.
In the context of learning in the realizable case, there is a general learning strategy, called the \emph{Closure} algorithm,
designed for learning with intersection-closed concept spaces, which has been a subject of frequent study.
Specifically, for any $m \in \mathbb{N} \cup \{0\}$, given any data set $L_{m} = \{(x_{1},y_{1}),\ldots,(x_{m},y_{m})\} \in (\mathcal X \times \mathcal Y)^{m}$ with $\mathbb{C}[L_{m}] \neq \emptyset$,
the Closure algorithm $\mathbb{A}(L_{m})$ for $\mathbb{C}$ produces the classifier
$\hat{h}_{m} : \mathcal X \to \mathcal Y$ with $\{ x : \hat{h}_{m}(x) = +1 \} = \bigcap_{h \in \mathbb{C}[L_{m}]} \{ x : h(x) = +1 \}$:
that is, $\hat{h}_{m}(x) = +1$ if and only if every $h \in \mathbb{C}$ consistent with $L_{m}$ (i.e., ${\rm er}_{L_{m}}(h) = 0$) has $h(x) = +1$.\footnote{For
simplicity, we suppose $\mathbb{C}$ is such that this set $\bigcap_{h \in \mathbb{C}[L_{m}]} \{ x : h(x) = +1 \}$ is measurable for every $L_{m}$, which is the
case for essentially all intersection-closed concept spaces of practical interest.}
Defining $\bar{\mathbb{C}}$ as the set of all classifiers $h : \mathcal X \to \mathcal Y$ for which there exists a nonempty ${\cal{G}} \subseteq \mathbb{C}$ with $\{x : h(x) = +1\} = \bigcap_{g \in {\cal{G}}} \{x : g(x) = +1\}$,
\citet*{auer:07} have argued that $\bar{\mathbb{C}}$ is an intersection-closed concept space containing $\mathbb{C}$, with ${\rm vc}(\bar{\mathbb{C}}) = {\rm vc}(\mathbb{C})$.
Thus, for $\hat{h}_{m} = \mathbb{A}(\L_{m})$ (where $\mathbb{A}$ is the Closure algorithm),
since $\hat{h}_{m} \in \bar{\mathbb{C}}[\L_{m}]$, Lemma~\ref{lem:classic-erm} immediately
implies that, for any $m \in \mathbb{N}$,
with probability at least $1-\delta$, ${\rm er}\left( \hat{h}_{m}\right) \lesssim \frac{1}{m} \left( \dim {\rm Log}(\frac{m}{\dim}) + {\rm Log}(\frac{1}{\delta}) \right)$.
However, by a more-specialized analysis, \citet*{auer:04,auer:07} were able to
show that, for intersection-closed classes $\mathbb{C}$, the Closure algorithm in fact
achieves ${\rm er}\left( \hat{h}_{m} \right) \lesssim \frac{1}{m} \left( \dim {\rm Log}(\dim) + {\rm Log}(\frac{1}{\delta}) \right)$
with probability at least $1-\delta$, which is an improvement for large $m$.
They also argued that, for a special subfamily of intersection-closed classes (namely, those with \emph{homogeneous spans}),
this bound can be further refined to $\frac{1}{m} \left( \dim + {\rm Log}(\frac{1}{\delta}) \right)$,
which matches (up to constant factors) the lower bound \eqref{eqn:pac-lower-bound}.
However, they left open the question of whether this refinement is achievable for
general intersection-closed concept spaces (by Closure, or any other algorithm).
In the following result, we prove that the Closure algorithm indeed always achieves
the optimal bound (up to constant factors) for intersection-closed concept spaces,
as a simple consequence of either Theorem~\ref{thm:monotone-erm} or Theorem~\ref{thm:monotone-compression}.
This fact was very recently
also obtained by \citet*{darnstadt:15} via a related direct approach;
however, we note that the constant factors obtained here
are significantly smaller (by roughly a factor of $15.5$, for large $\dim$).
\begin{theorem}
\label{thm:int-closed}
If $\mathbb{C}$ is intersection-closed and $\mathbb{A}$ is the Closure algorithm,
then for any $m \in \mathbb{N}$ and $\delta \in (0,1)$, letting $\hat{h}_{m} = \mathbb{A}( \{ (X_{1},f^{\star}(X_{1})),\ldots,(X_{m},f^{\star}(X_{m})) \} )$,
with probability at least $1-\delta$,
\begin{equation*}
{\rm er}\left( \hat{h}_{m} \right) \leq \frac{1}{m} \left( 21 \dim + 16 \ln\left(\frac{3}{\delta}\right) \right).
\end{equation*}
Furthermore,
\begin{equation*}
\mathbb{E}\left[ {\rm er}\left( \hat{h}_{m} \right) \right] \leq \frac{21 \dim + 34}{m}.
\end{equation*}
\end{theorem}
\begin{proof}
For each $t \in \mathbb{N} \cup \{0\}$ and $x_{1},\ldots,x_{t} \in \mathcal X$,
define $\psi_{t}(x_{1},\ldots,x_{t}) = \{ x \in \mathcal X : \hat{h}_{x_{[t]}}(x) \neq f^{\star}(x) \}$,
where $\hat{h}_{x_{[t]}} = \mathbb{A}( \{(x_{1},f^{\star}(x_{1})),\ldots,(x_{t},f^{\star}(x_{t}))\} )$.
Fix any $x_{1},x_{2},\ldots \in \mathcal X$, let $L_{t} = \{ (x_{1},f^{\star}(x_{1})),\ldots,(x_{t},f^{\star}(x_{t})) \}$ for each $t \in \mathbb{N}$,
and note that for any $t \in \mathbb{N}$, the classifier $\hat{h}_{x_{[t]}}$ produced by $\mathbb{A}(L_{t})$ is consistent with $L_{t}$,
which implies $\psi_{t}(x_{1},\ldots,x_{t}) \cap \{x_{1},\ldots,x_{t}\} = \emptyset$.
Furthermore, since $f^{\star} \in \mathbb{C}[ L_{t} ]$,
we have that $\{ x : \hat{h}_{x_{[t]}}(x) = +1 \} \subseteq \{ x : f^{\star}(x) = +1 \}$,
which together with the definition of $\hat{h}_{x_{[t]}}$ implies
\begin{align}
\psi_{t}(x_{1},\ldots,x_{t}) & = \{ x \in \mathcal X : \hat{h}_{x_{[t]}}(x) = -1, f^{\star}(x) = +1 \} \notag
\\ & = \bigcup_{h \in \mathbb{C}[L_{t}]} \{ x \in \mathcal X : h(x) = -1, f^{\star}(x) = +1 \} \label{eqn:closure-error-region}
\end{align}
for every $t \in \mathbb{N}$.
Furthermore, for any $t \in \mathbb{N}$,
$\mathbb{C}[ L_{t+1} ] \subseteq \mathbb{C}[ L_{t} ]$.
Together with monotonicity of the union, these two observations imply
\begin{align*}
\psi_{t+1}(x_{1},\ldots,x_{t+1})
& = \bigcup_{h \in \mathbb{C}[L_{t+1}]} \{ x \in \mathcal X : h(x) = -1, f^{\star}(x) = +1 \}
\\ & \subseteq \bigcup_{h \in \mathbb{C}[L_{t}]} \{ x \in \mathcal X : h(x) = -1, f^{\star}(x) = +1 \}
= \psi_{t}(x_{1},\ldots,x_{t}).
\end{align*}
Thus, $\psi_{t}$ defines a consistent monotone rule.
Also, since $\mathbb{A}$ always produces a function in $\bar{\mathbb{C}}$,
we have $\psi_{t}(x_{1},\ldots,x_{t}) \in \{ \{ x \in \mathcal X : h(x) \neq f^{\star}(x) \} : h \in \bar{\mathbb{C}} \}$ for every $t \in \mathbb{N}$,
and it is straightforward to show that the VC dimension of this collection of sets is exactly ${\rm vc}(\bar{\mathbb{C}})$ \citep*[see][Lemma 4.12]{vidyasagar:03},
which \citet*{auer:07} have argued equals $\dim$.
From this, we can already infer a bound $\frac{4}{m}\left( 17 \dim + 4 \ln\left(\frac{4}{\delta}\right) \right)$ via Theorem~\ref{thm:monotone-erm}.
However, we can refine the constant factors in this bound by noting that $\psi_{t}$ can also be represented as a
consistent monotone sample compression rule of size $\dim$, and invoking Theorem~\ref{thm:monotone-compression}.
The rest of this proof focuses on establishing this fact.
Fix any $t \in \mathbb{N}$.
It is well known in the literature \citep*[see e.g.,][Theorem 1]{auer:07} that
there exist $k \in [\dim] \cup \{0\}$ and distinct $i_{1},\ldots,i_{k} \in [t]$
such that $f^{\star}(x_{i_{j}}) = +1$ for all $j \in [k]$,
and letting $L_{i_{[k]}} = \{(x_{i_{1}},+1),\ldots,(x_{i_{k}},+1)\}$,
we have $\bigcap_{h \in \mathbb{C}[ L_{i_{[k]}} ]} \{x : h(x) = +1\} = \bigcap_{h \in \mathbb{C}[L_{t}]} \{x : h(x) = +1\}$;
in particular, letting $\hat{h}_{x_{i_{[k]}}} = \mathbb{A}(L_{i_{[k]}})$,
this implies $\hat{h}_{x_{i_{[k]}}} = \hat{h}_{x_{[t]}}$.
This further implies $\psi_{t}(x_{1},\ldots,x_{t}) = \psi_{k}(x_{i_{1}},\ldots,x_{i_{k}})$,
so that defining the compression function $(\emp{\cs}_{t}(x_{[t]}),i_{t,1}(x_{[t]}),\ldots,i_{t,\emp{\cs}_{t}(x_{[t]})}(x_{[t]})) = (k,i_{1},\ldots,i_{k})$
for $k$ and $i_{1},\ldots,i_{k}$ as above, for each $x_{1},\ldots,x_{t} \in \mathcal X$,
and defining the reconstruction function $\phi_{t,k^{\prime}}(x_{1}^{\prime},\ldots,x_{k^{\prime}}^{\prime}) = \psi_{k^{\prime}}(x_{1}^{\prime},\ldots,x_{k^{\prime}}^{\prime})$
for each $t \in \mathbb{N}$, $k^{\prime} \in [\dim] \cup \{0\}$, and $x_{1}^{\prime},\ldots,x_{k^{\prime}}^{\prime} \in \mathcal X$,
we have that
$\psi_{t}(x_{1},\ldots,x_{t})$ $= \phi_{t,\emp{\cs}_{t}(x_{[t]})}( x_{i_{t,1}(x_{[t]})}, \ldots, x_{i_{t,\emp{\cs}_{t}(x_{[t]})}(x_{[t]})} )$
for all $t \in \mathbb{N}$ and $x_{1},\ldots,x_{t} \in \mathcal X$.
Furthermore, since $(x_{1},\ldots,x_{t}) \mapsto \mathbb{C}[\{(x_{1},f^{\star}(x_{1})),\ldots,(x_{t},f^{\star}(x_{t}))\}]$ is invariant to permutations of its arguments,
it follows from \eqref{eqn:closure-error-region} that $\psi_{t}$ is permutation-invariant for every $t \in \mathbb{N}$;
this also means that, for the choice of $\phi_{t,k^{\prime}}$ above, the function $\phi_{t,k^{\prime}}$ is also permutation-invariant.
Altogether, we have that $\psi_{t}$ is a consistent monotone sample compression rule of size $\dim$.
Thus, since ${\rm er}\left( \hat{h}_{m} \right) = \mathcal{P}( \psi_{m}(X_{1},\ldots,X_{m}) )$ for $m \in \mathbb{N}$,
the stated result follows directly from Theorem~\ref{thm:monotone-compression}
(with $\mathcal{Z} = \mathcal X$, $P = \mathcal{P}$, and $\psi_{t}$ defined as above).
\end{proof}
\section{Application to the CAL Active Learning Algorithm}
\label{sec:cal}
As another interesting application of Theorem~\ref{thm:monotone-compression},
we derive an improved bound on the label complexity of a well-studied active learning
algorithm, usually referred to as CAL after its authors \citet*{cohn:94}.
Formally, in the active learning protocol, the learning algorithm $\mathbb{A}$ is given access
to the \emph{unlabeled} data sequence $X_{1},X_{2},\ldots$ (or some sufficiently-large
finite initial segment thereof), and then sequentially requests to observe the labels:
that is, it selects an index $t_{1}$ and requests to observe the label $f^{\star}(X_{t_{1}})$,
at which time it is permitted access to $f^{\star}(X_{t_{1}})$;
it may then select another index $t_{2}$ and request to observe the label $f^{\star}(X_{t_{2}})$,
is then permitted access to $f^{\star}(X_{t_{2}})$, and so on.
This continues until at most some given number $n$ of labels have been requested (called the \emph{label budget}),
at which point the algorithm should halt and return a classifier $\hat{h}$;
we denote this as $\hat{h} = \mathbb{A}(n)$ (leaving the dependence on the unlabeled data implicit, for simplicity).
We are then interested in characterizing a sufficient size for the budget $n$ so that,
with probability at least $1-\delta$, ${\rm er}(\hat{h}) \leq \varepsilon$; this size is known as
the \emph{label complexity} of $\mathbb{A}$.
The CAL active learning algorithm is based on a very elegant and natural principle:
never request a label that can be deduced from information already obtained.
CAL is defined solely by this principle, employing no additional criteria in its choice of queries.
Specifically, the algorithm proceeds by considering randomly-sampled data points one at a time,
and to each it applies the above principle, skipping over the labels that can be deduced,
and requesting the labels that cannot be. In favorable scenarios, as the number of
label requests grows, the frequency of encountering a sample whose label
cannot be deduced should diminish. The key to bounding the label complexity of
CAL is to characterize the rate at which this frequency shrinks.
To further pursue this discussion with rigor, let us define the \emph{region of disagreement}
for any set $\H$ of classifiers:
\begin{equation*}
{\rm DIS}(\H) = \{x \in \mathcal X : \exists h,g \in \H \text{ s.t. } h(x) \neq g(x)\}.
\end{equation*}
Then the CAL active learning algorithm is formally defined as follows.
\begin{bigboxit}
Algorithm: \textbf{{\rm CAL}}($n$)
\\ 0. $m \gets 0$, $t \gets 0$, $V_{0} \gets \mathbb{C}$
\\ 1. While $t < n$ and $m < 2^{n}$
\\ 2. \quad $m \gets m+1$
\\ 3. \quad If $X_{m} \in {\rm DIS}(V_{m-1})$
\\ 4. \qquad Request label $Y_m = f^{\star}(X_{m})$; let $V_{m} \gets V_{m-1}[\{(X_{m},Y_{m})\}]$, $t \gets t+1$
\\ 5. \quad Else $V_{m} \gets V_{m-1}$
\\ 6. Return any $\hat{h} \in V_{m}$
\end{bigboxit}
This algorithm has several attractive properties.
One is that, since it only removes classifiers from $V_{m}$ upon disagreement with $f^{\star}$,
it maintains the invariant that $f^{\star} \in V_{m}$.
Another property is that, since it maintains $f^{\star} \in V_{m}$,
and it only refrains from requesting a label if every classifier in $V_{m}$ agrees on the label
(and hence agrees with $f^{\star}$, so that requesting the label would not affect $V_{m}$ anyway),
it maintains the invariant that $V_{m} = \mathbb{C}[\L_{m}]$, where $\L_{m} = \{(X_{1},f^{\star}(X_{1})),\ldots,(X_{m},f^{\star}(X_{m}))\}$.
This algorithm has been studied a great deal in the literature \citep*{cohn:94,hanneke:thesis,hanneke:11a,hanneke:12a,hanneke:fntml,el-yaniv:12,hanneke:15a},
and has inspired an entire genre of active learning algorithms referred to as \emph{disagreement-based} (or sometimes as \emph{mellow}),
including several methods possessing desirable properties such as robustness to classification noise
\citep*[e.g.,][]{balcan:06,balcan:09,dasgupta:07,koltchinskii:10,hanneke:12b,hanneke:fntml}.
There is a substantial literature studying the label complexity of CAL and other disagreement-based
active learning algorithms; the interested reader is referred to the recent survey article of \citet*{hanneke:fntml} for a thorough discussion of this literature.
Much of that literature discusses characterizations of the label complexity in terms of a quantity
known as the \emph{disagreement coefficient} \citep*{hanneke:07b,hanneke:thesis}. However,
\citet*{hanneke:15a} have recently discovered that a quantity known as the
\emph{version space compression set size} (a.k.a. \emph{empirical teaching dimension})
can sometimes provide a smaller bound on the label complexity of CAL.
Specifically, the following quantity was introduced in the works of \citet*{el-yaniv:10,hanneke:07a}.
\begin{definition}
\label{def:td-hat}
For any $m \in \mathbb{N}$ and $\L \in (\mathcal X \times \mathcal Y)^{m}$,
the \emph{version space compression set} $\hat{C}_{\L}$ is a
smallest subset of $\L$ satisfying $\mathbb{C}[\hat{C}_{\L}] = \mathbb{C}[\L]$.
We then define $\hat{n}(\L) = |\hat{C}_{\L}|$, the
\emph{version space compression set size}.
In the special case $\L = \L_{m}$,
we abbreviate $\hat{n}_{m} = \hat{n}(\L_{m})$.
Also define $\hat{n}_{1:m} = \max_{t \in [m]} \hat{n}_{t}$,
and for any $\delta \in (0,1)$, define
$\tilde{n}_{m}(\delta) = \min\{ b \in [m] \cup \{0\} : \P(\hat{n}_{m} \leq b) \geq 1-\delta \}$ and
$\tilde{n}_{1:m}(\delta) = \min\{ b \in [m] \cup \{0\} : \P(\hat{n}_{1:m} \leq b) \geq 1-\delta \}$.
\end{definition}
The recent work of \citet*{hanneke:15a} studies this quantity for several concept spaces and distributions,
and also identifies general relations between $\hat{n}_{m}$ and the more-commonly studied
disagreement coefficient $\theta$ of \citep*{hanneke:07b,hanneke:thesis}. Specifically,
for any $r > 0$, define ${\rm B}(f^{\star},r) = \{h \in \mathbb{C} : \mathcal{P}(x : h(x) \neq f^{\star}(x)) \leq r\}$.
Then the disagreement coefficient is defined, for any $r_{0} \geq 0$, as
\begin{equation*}
\theta(r_{0}) = \sup_{r > r_{0}} \frac{\mathcal{P}({\rm DIS}({\rm B}(f^{\star},r)))}{r} \lor 1.
\end{equation*}
Both $\tilde{n}_{1:m}(\delta)$ and $\theta(r_{0})$ are complexity measures dependent on $f^{\star}$ and $\mathcal{P}$.
\citet*{hanneke:15a} relate them by showing that
\begin{equation}
\label{eqn:dc-td-lb}
\theta(1/m) \lesssim \tilde{n}_{1:m}(1/20) \lor 1,
\end{equation}
and for general $\delta \in (0,1)$,\footnote{The original claim from \citet*{hanneke:15a} involved a maximum of
minimal $(1-\delta)$-confidence bounds on $\hat{n}_{t}$ over $t \in [m]$, but the same proof can be used to establish this slightly stronger claim.}
\begin{equation}
\label{eqn:td-dc-ub}
\tilde{n}_{1:m}(\delta) \lesssim \theta(\dim/m) \left( \dim {\rm Log}(\theta(\dim/m)) + {\rm Log}\left(\frac{{\rm Log}(m)}{\delta}\right) \right) {\rm Log}(m).
\end{equation}
\citet*{hanneke:15a} prove that, for ${\rm CAL}(n)$ to
produce $\hat{h}$ with ${\rm er}(\hat{h}) \leq \varepsilon$ with probability at least $1-\delta$,
it suffices to take a budget $n$ of size proportional to
\begin{equation}
\label{eqn:original-cal}
\left( \max_{m \in [M(\varepsilon,\delta/2)]} \tilde{n}_{m}(\delta_{m}) {\rm Log}\left( \frac{m}{\tilde{n}_{m}(\delta_{m})} \right) + {\rm Log}\left(\frac{{\rm Log}(M(\varepsilon,\delta/2))}{\delta}\right) \right) {\rm Log}(M(\varepsilon,\delta/2)),
\end{equation}
where the values $\delta_{m} \in (0,1]$ are such that $\sum_{i=0}^{\lfloor \log_{2}(M(\varepsilon,\delta/2)) \rfloor} \delta_{2^{i}} \leq \delta/4$,
and $M(\varepsilon,\delta/2)$ is the smallest $m \in \mathbb{N}$ for which
$\P\left( \sup_{h \in \mathbb{C}[\L_{m}]} {\rm er}(h) \leq \varepsilon \right) \geq 1-\delta/2$;
the quantity $M(\varepsilon,\delta)$ is discussed at length below in Section~\ref{sec:erm}.
They also argue that this is essentially a \emph{tight} characterization of the label complexity of CAL,
up to logarithmic factors.
The key to obtaining this result is establishing an upper bound on $\mathcal{P}({\rm DIS}(V_{m}))$
as a function of $m$, where (as in CAL) $V_{m} = \mathbb{C}[\L_{m}]$.
One basic observation indicating that $\mathcal{P}({\rm DIS}(V_{m}))$ can be related to the version space compression set size is that,
by exchangeability of the $X_{i}$ random variables,
\begin{align*}
\mathbb{E}\left[ \mathcal{P}({\rm DIS}(V_{m})) \right]
& = \mathbb{E}\left[ \mathbbold{1}\left[ X_{m+1} \in {\rm DIS}( \mathbb{C}[ \L_{m} ] ) \right] \right]
\\ & = \frac{1}{m+1} \sum_{i=1}^{m+1} \mathbb{E}\left[ \mathbbold{1}\left[ X_{i} \in {\rm DIS}( \mathbb{C}[ \L_{m+1} \setminus \{(X_{i},f^{\star}(X_{i}))\} ] ) \right] \right]
\\ & \leq \frac{1}{m+1} \sum_{i=1}^{m+1} \mathbb{E}\left[ \mathbbold{1}\left[ (X_{i},f^{\star}(X_{i})) \in \hat{C}_{\L_{m+1}} \right] \right]
= \frac{\mathbb{E}\left[ \hat{n}_{m+1} \right]}{m+1},
\end{align*}
where the inequality is due to the observation that any $X_{i} \in {\rm DIS}( \mathbb{C}[ \L_{m+1} \setminus \{(X_{i},f^{\star}(X_{i}))\} ] )$
is necessarily in the version space compression set $\hat{C}_{\L_{m+1}}$, and the last equality is by linearity of the expectation.
However, obtaining the bound \eqref{eqn:original-cal} required a more-involved argument from
\citet*{hanneke:15a}, to establish a high-confidence bound on $\mathcal{P}({\rm DIS}(V_{m}))$, rather than a bound
on its expectation.
Specifically, by combining a perspective introduced by
\citet*{el-yaniv:10,el-yaniv:12}, with the observation that ${\rm DIS}(V_{m})$ may be
represented as a sample compression scheme of size $\hat{n}_{m}$, and invoking
Lemma~\ref{lem:classic-compression}, \citet*{hanneke:15a} prove that,
with probability at least $1-\delta$,
\begin{equation}
\label{eqn:whey-PDIS}
\mathcal{P}({\rm DIS}(V_{m})) \lesssim \frac{1}{m} \left( \hat{n}_{m} {\rm Log}\left( \frac{m}{\hat{n}_{m}} \right) + {\rm Log}\left(\frac{1}{\delta}\right) \right).
\end{equation}
In the present work, we are able to entirely eliminate the factor ${\rm Log}\left(\frac{m}{\hat{n}_{m}}\right)$ from the first term,
simply by observing that the region ${\rm DIS}(V_{m})$ is \emph{monotonic} in $m$. Specifically,
by combining this monotonicity observation with the description of ${\rm DIS}(V_{m})$
as a compression scheme from \citet*{hanneke:15a}, the refined bound follows from arguments similar to the proof of
Theorem~\ref{thm:monotone-compression}.
Formally, we have the following result.
\begin{theorem}
\label{thm:PDIS}
For any $m \in \mathbb{N}$ and $\delta \in (0,1)$, with probability at least $1-\delta$,
\begin{equation*}
\mathcal{P}({\rm DIS}(V_{m})) \leq \frac{16}{m} \left( 2 \hat{n}_{1:m} + \ln\left(\frac{3}{\delta}\right) \right).
\end{equation*}
\end{theorem}
We should note that, while Theorem~\ref{thm:PDIS} indeed eliminates a logarithmic factor
compared to \eqref{eqn:whey-PDIS}, this refinement is also accompanied by an increase
in the complexity measure, replacing $\hat{n}_{m}$ with $\hat{n}_{1:m}$.
This arises from our proof, since (as in the proof of Theorem~\ref{thm:monotone-compression})
the argument relies on $\hat{n}_{1:m}$ being a sample compression set size, not just for the full
sample, but also for any prefix of the sample.
The effect of this increase is largely benign in this context, since the bound \eqref{eqn:original-cal}
on the label complexity of CAL, derived from \eqref{eqn:whey-PDIS}, involves maximization over the sample size anyway.
Although Theorem~\ref{thm:PDIS} follows from the same principles as Theorem~\ref{thm:monotone-compression}
(i.e., ${\rm DIS}(V_{t})$ being a consistent monotone rule expressible as a sample compression scheme),
it does not quite follow as an immediate consequence of Theorem~\ref{thm:monotone-compression},
due fact that the size $\hat{n}_{1:m}$ of the sequence of sample compression schemes
can vary based on the specific samples (including their \emph{order}).
For this reason, we provide a specialized proof of this result in Appendix~\ref{app:cal},
which follows an argument nearly-identical to that of Theorem~\ref{thm:monotone-compression},
with only a few minor changes to account for this variability of $\hat{n}_{1:m}$ using special properties of the sets ${\rm DIS}(V_{t})$.
Based on this result, and following precisely the same arguments as \citet*{hanneke:15a},\footnote{%
The only small twist is that we replace $\max_{m \leq M(\varepsilon,\delta/2)} \tilde{n}_{m}(\delta_{m})$ from \eqref{eqn:original-cal} with $\tilde{n}_{1:M(\varepsilon,\delta/2)}(\delta/4)$.
As the purpose of these $\tilde{n}_{m}(\delta_{m})$ values in the original proof is to provide bounds on their respective $\hat{n}_{m}$ values (which in our context, are $\hat{n}_{1:m}$ values),
holding simultaneously for all $m = 2^{i} \in [M(\varepsilon,\delta/2)]$ with probability at least $1-\delta/4$,
the value $\tilde{n}_{1:M(\varepsilon,\delta/2)}(\delta/4)$ can clearly be used instead.
If desired, by a union bound we can of course bound
$\tilde{n}_{1:M(\varepsilon,\delta/2)}(\delta/4) \leq \max_{m \in [M(\varepsilon,\delta/2)]} \tilde{n}_{m}(\delta_{m})$,
for any sequence $\delta_{m}$ in $(0,1]$ with $\sum_{m \in [M(\varepsilon,\delta/2)]} \delta_{m} \leq \delta/4$.}
we arrive at the following bound on the label complexity of CAL.
For brevity, we omit the proof, referring the interested reader to the original exposition of \citet*{hanneke:15a} for the details.
\begin{theorem}
\label{thm:CAL-label-complexity}
There is a universal constant $c \in (0,\infty)$ such that,
for any $\varepsilon,\delta \in (0,1)$,
for any $n \in \mathbb{N}$ with
\begin{equation*}
n \geq c \left( \tilde{n}_{1:M(\varepsilon,\delta/2)}(\delta/4) + {\rm Log}\left(\frac{{\rm Log}(M(\varepsilon,\delta/2))}{\delta}\right) \right) {\rm Log}(M(\varepsilon,\delta/2)),
\end{equation*}
with probability at least $1-\delta$, the classifier $\hat{h}_{n} = {\rm CAL}(n)$ has ${\rm er}(\hat{h}_{n}) \leq \varepsilon$.
\end{theorem}
It is also possible to state a distribution-free variant of Theorem~\ref{thm:PDIS}.
Specifically, consider the following definition, from \citet*{hanneke:15b}.
\begin{definition}
\label{def:star}
The \emph{star number} $\mathfrak{s}$ is the largest integer $s$ such that
there exist distinct points $x_{1},\ldots,x_{s} \in \mathcal X$ and classifiers $h_{0},h_{1},\ldots,h_{s} \in \mathbb{C}$
with the property that $\forall i \in [s]$, ${\rm DIS}(\{h_{0},h_{i}\}) \cap \{x_{1},\ldots,x_{s}\} = \{x_{i}\}$;
if no such largest integer exists, define $\mathfrak{s} = \infty$.
\end{definition}
The star number is a natural combinatorial complexity measure, corresponding to the largest
possible degree in the data-induced one-inclusion graph. \citet*{hanneke:15b} provide several
examples of concept spaces exhibiting a variety of values for the star number (though it
should be noted that many commonly-used concept spaces have $\mathfrak{s} = \infty$: e.g., linear separators).
As a basic relation, one can easily show that $\mathfrak{s} \geq \dim$.
\citet*{hanneke:15b} also relate the star number to many other complexity measures
arising in the learning theory literature, including $\hat{n}_{m}$.
Specifically, they prove that, for every $m \in \mathbb{N}$ and $\L \in (\mathcal X \times \mathcal Y)^{m}$ with $\mathbb{C}[\L] \neq \emptyset$,
$\hat{n}(\L) \leq \mathfrak{s}$, with equality in the worst case (over $m$ and $\L$). Based on this fact, Theorem~\ref{thm:monotone-compression}
implies the following result.
\begin{theorem}
\label{thm:PDIS-star}
For any $m \in \mathbb{N}$ and $\delta \in (0,1)$, with probability at least $1-\delta$,
\begin{equation*}
\mathcal{P}({\rm DIS}(V_{m})) \leq \frac{1}{m} \left( 21 \mathfrak{s} + 16 \ln\left(\frac{3}{\delta}\right) \right).
\end{equation*}
\end{theorem}
\begin{proof}
For every $t \in \mathbb{N}$ and $x_{1},\ldots,x_{t} \in \mathcal X$, define $\psi_{t}(x_{1},\ldots,x_{t}) = {\rm DIS}(\mathbb{C}[\L_{x_{[t]}}])$,
where $\L_{x_{[t]}} = \{(x_{1},f^{\star}(x_{1})),\ldots,(x_{t},f^{\star}(x_{t}))\}$;
$\psi_{t}$ is clearly permutation-invariant, and satisfies $\psi_{t}(x_{1},\ldots,x_{t}) \cap \{x_{1},\ldots,x_{t}\} = \emptyset$
(since every $h \in \mathbb{C}[\L_{x_{[t]}}]$ agrees with $f^{\star}$ on $\{x_{1},\ldots,x_{t}\}$).
Furthermore, monotonicity of $\L \mapsto \mathbb{C}[\L]$ and $\H \mapsto {\rm DIS}(\H)$ imply
that any $t \in \mathbb{N}$ and $x_{1},\ldots,x_{t+1} \in \mathcal X$ satisfy $\psi_{t+1}(x_{1},\ldots,x_{t+1}) \subseteq \psi_{t}(x_{1},\ldots,x_{t})$,
so that $\psi_{t}$ is a consistent monotone rule.
Also define $\phi_{t,k}(x_{1},\ldots,x_{k}) = \psi_{k}(x_{1},\ldots,x_{k})$ for any $k \in [t]$ and $x_{1},\ldots,x_{k} \in \mathcal X$,
and $\phi_{t,0}() = {\rm DIS}(\mathbb{C})$. Since $\psi_{k}$ is permutation-invariant for every $k \in [t]$, so is $\phi_{t,k}$.
For any $x_{1},\ldots,x_{t} \in \mathcal X$, from Definition~\ref{def:td-hat},
there exist distinct $i_{t,1}(x_{[t]}),\ldots,i_{t,\hat{n}(\L_{x_{[t]}})}(x_{[t]}) \in [t]$ such that
$\hat{C}_{\L_{x_{[t]}}} = \{ (x_{i_{t,j}(x_{[t]})},f^{\star}(x_{i_{t,j}(x_{[t]})})) : j \in \{1,\ldots,\hat{n}(\L_{x_{[t]}})\} \}$,
and since $\mathbb{C}[\hat{C}_{\L_{x_{[t]}}}] = \mathbb{C}[\L_{x_{[t]}}]$, it follows that
$\phi_{t,\hat{n}(\L_{x_{[t]}})}(x_{i_{t,1}(x_{[t]})},\ldots,x_{i_{t,\hat{n}(\L_{x_{[t]}})}(x_{[t]})}) = \psi_{t}(x_{1},\ldots,x_{t})$.
Thus, since $\hat{n}(\L_{x_{[t]}}) \leq \mathfrak{s}$ for all $t \in \mathbb{N}$ \citep*{hanneke:15b},
$\psi_{t}$ is a consistent monotone sample compression rule of size $\mathfrak{s}$.
The result immediately follows by applying Theorem~\ref{thm:monotone-compression} with $\mathcal{Z} = \mathcal X$, $P = \mathcal{P}$, and $\psi_{t}$ as above.
\end{proof}
As a final implication for CAL, we can also plug the inequality $\hat{n}(\L) \leq \mathfrak{s}$ into the bound
from Theorem~\ref{thm:CAL-label-complexity} to reveal that CAL achieves a label complexity
upper-bounded by a value proportional to
$\mathfrak{s} {\rm Log}(M(\varepsilon,\delta/2)) + {\rm Log}\left(\frac{{\rm Log}(M(\varepsilon,\delta/2))}{\delta}\right) {\rm Log}(M(\varepsilon,\delta/2))$.
\noindent\textbf{Remark:} In addition to the above applications to active learning,
it is worth noting that, combined with the work of \citet*{el-yaniv:10}, the above results
also have implications for the setting of \emph{selective classification}: that is, the setting
in which, for each $t \in \mathbb{N}$, given access to $(X_{1},f^{\star}(X_{1})),\ldots,(X_{t-1},f^{\star}(X_{t-1}))$ and $X_{t}$,
a learning algorithm is required either to make a prediction $\hat{Y}_{t}$ for $f^{\star}(X_{t})$,
or to ``abstain'' from prediction; after each round $t$, the algorithm is permitted access
to the value $f^{\star}(X_{t})$. Then the error rate is the probability the prediction $\hat{Y}_{t}$ is incorrect (conditioned on $X_{[t-1]}$),
given that the algorithm chooses to predict,
and the \emph{coverage} is the probability the algorithm chooses to make a prediction at time $t$ (conditioned on $X_{[t-1]}$).
\citet*{el-yaniv:10} explore an extreme variant, called \emph{perfect selective classification},
in which the algorithm is required to only make predictions that will be correct with \emph{certainty}
(i.e., for any data sequence $x_{1},x_{2},\ldots$, the algorithm will never misclassify a point it chooses
to predict for). \citet*{el-yaniv:10} find that a selective classification algorithm based on
principles analogous to the CAL active learning algorithm obtains the optimal coverage among
all perfect selective classification algorithms; the essential strategy is to predict only if
$X_{t} \notin {\rm DIS}(V_{t-1})$, taking $\hat{Y}_{t}$ as the label agreed-upon by every $h \in V_{t-1}$.
In particular, this implies that the optimal coverage rate in perfect selective classification,
on round $t$, is $1-\mathcal{P}({\rm DIS}(V_{t-1}))$. Thus, combined with
Theorem~\ref{thm:PDIS} or Theorem~\ref{thm:PDIS-star}, we can immediately obtain bounds
on the optimal coverage rate for perfect selective classification as well;
in particular, this typically refines the bound of \citet*{el-yaniv:10} (and a later refinement by \citealp*{hanneke:15a})
by at least a logarithmic factor (though again, it is not a ``pure'' improvement, as Theorem~\ref{thm:PDIS} uses $\hat{n}_{1:m}$ in place of $\hat{n}_{m}$).
\section{Application to General Consistent PAC Learners}
\label{sec:erm}
In general, a \emph{consistent learning algorithm} $\mathbb{A}$ is a learning algorithm such that,
for any $m \in \mathbb{N}$ and $L \in (\mathcal X \times \mathcal Y)^{m}$ with $\mathbb{C}[L] \neq \emptyset$,
$\mathbb{A}(L)$ produces a classifier $\hat{h}$ consistent with $L$ (i.e., $\hat{h} \in \mathbb{C}[L]$).
In the context of learning in the realizable case, this is equivalent to $\mathbb{A}$ being an instance of
the well-studied method of \emph{empirical risk minimization}.
The study of general consistent learning algorithms focuses on the quantity $\sup_{h \in V_{m}} {\rm er}(h)$,
where $V_{m} = \mathbb{C}[\L_{m}]$, as above. It is clear that the error rate achieved by any consistent
learning algorithm, given $\L_{m}$ as input,
is at most $\sup_{h \in V_{m}} {\rm er}(h)$. Furthermore, it is not hard to see that, for any given
$\mathcal{P}$ and $f^{\star} \in \mathbb{C}$, there exist consistent learning rules obtaining error rates
arbitrarily close to $\sup_{h \in V_{m}} {\rm er}(h)$, so that obtaining guarantees on the error rate
that hold \emph{generally} for all consistent learning algorithms requires us to bound this value.
Based on Lemma~\ref{lem:classic-erm} (taking $\mathcal{A} = \{ \{x : h(x) \neq f^{\star}(x)\} : h \in \mathbb{C} \}$),
one immediately obtains a classic result (due to \citealp*{vapnik:74,blumer:89}),
that with probability at least $1-\delta$,
\begin{equation*}
\sup_{h \in V_{m}} {\rm er}(h) \lesssim \frac{1}{m} \left( \dim {\rm Log}\left(\frac{m}{\dim}\right) + {\rm Log}\left(\frac{1}{\delta}\right) \right).
\end{equation*}
This has been refined by \citet*{gine:06},\footnote{See also \citet*{hanneke:thesis}, for a simple direct proof of this result.} who argue that, with probability at least $1-\delta$,
\begin{equation}
\label{eqn:gk-dc}
\sup_{h \in V_{m}} {\rm er}(h) \lesssim \frac{1}{m} \left( \dim {\rm Log}\left( \theta\left( \frac{\dim}{m} \right) \right) + {\rm Log}\left(\frac{1}{\delta}\right) \right).
\end{equation}
In the present work, by combining an argument of \citet*{hanneke:thesis}
with Theorem~\ref{thm:PDIS} above, we are able to obtain a new result,
which replaces $\theta\left( \frac{\dim}{m} \right)$ in \eqref{eqn:gk-dc}
with $\frac{\hat{n}_{1:m}}{\dim}$. Specifically, we have the following result.
\begin{theorem}
\label{thm:vc-erm}
For any $\delta \in (0,1)$ and $m \in \mathbb{N}$, with probability at least $1-\delta$,
\begin{equation*}
\sup_{h \in V_{m}} {\rm er}(h) \leq \frac{8}{m} \left( \dim \ln\left( \frac{49 e \hat{n}_{1:m}}{\dim} + 37 \right) + 8 \ln\left(\frac{6}{\delta}\right) \right).
\end{equation*}
\end{theorem}
The proof of Theorem~\ref{thm:vc-erm} follows a similar strategy to
the inductive step from the proofs of Theorems~\ref{thm:monotone-erm}, \ref{thm:monotone-compression}, and \ref{thm:PDIS}.
The details are included in Appendix~\ref{app:erm}.
Additionally, since \citet*{hanneke:15b} prove that $\max_{t \in [m]} \max_{L \in (\mathcal X \times \mathcal Y)^{t}} \hat{n}(L) = \min\{ \mathfrak{s}, m \}$,
where $\mathfrak{s}$ is the star number, the following new
distribution-free bound immediately follows.\footnote{The bound on the expectation follows by integrating the exponential bound on
$\P(\sup_{h \in V_{m}} {\rm er}(h) > \varepsilon)$ implied by the first statement in the corollary, as was done, for instance, in the proofs of Theorems~\ref{thm:monotone-erm} and \ref{thm:monotone-compression}.
We also note that, by using Theorem~\ref{thm:PDIS-star} in place of Theorem~\ref{thm:PDIS} in the proof of Theorem~\ref{thm:vc-erm},
one can obtain mildly better numerical constants in the logarithmic term in this corollary.}
\begin{corollary}
\label{cor:erm-star}
For any $m \in \mathbb{N}$ and $\delta \in (0,1)$, with probability at least $1-\delta$,
\begin{equation*}
\sup_{h \in V_{m}} {\rm er}(h) \lesssim \frac{1}{m} \left( \dim {\rm Log}\left( \frac{\min\{\mathfrak{s},m\}}{\dim} \right) + {\rm Log}\left(\frac{1}{\delta}\right) \right).
\end{equation*}
Furthermore,
\begin{equation*}
\mathbb{E}\left[ \sup_{h \in V_{m}} {\rm er}(h) \right] \lesssim \frac{\dim}{m} {\rm Log}\left( \frac{\min\{\mathfrak{s},m\}}{\dim} \right).
\end{equation*}
\end{corollary}
Let us compare this result to \eqref{eqn:gk-dc}.
Since \citet*{hanneke:15b} prove that
\begin{equation*}
\max_{\mathcal{P}} \max_{f^{\star} \in \mathbb{C}} \theta(r_{0}) = \min\left\{ \mathfrak{s}, \frac{1}{r_{0}} \right\},
\end{equation*}
and also (as mentioned) that $\max_{t \in [m]} \max_{L \in (\mathcal X \times \mathcal Y)^{t}} \hat{n}(L) = \min\{ \mathfrak{s}, m \}$,
we see that, at least in some scenarios (i.e., for some choices of $\mathcal{P}$ and $f^{\star}$),
the new bound in Theorem~\ref{thm:vc-erm} represents an improvement over \eqref{eqn:gk-dc}.
In particular, the best \emph{distribution-free} bound obtainable from \eqref{eqn:gk-dc} is proportional to
\begin{equation}
\label{eqn:gk-dist-free}
\frac{1}{m} \left( \dim {\rm Log}\left(\frac{\min\{ \dim\mathfrak{s}, m \}}{\dim}\right) + {\rm Log}\left(\frac{1}{\delta}\right) \right),
\end{equation}
which is somewhat larger than the bound stated in Corollary~\ref{cor:erm-star} (which has $\mathfrak{s}$ in place of $\dim\mathfrak{s}$).
Also, recalling that \citet*{hanneke:15a} established that $\theta(1/m) \lesssim \tilde{n}_{1:m}(\delta) \lesssim \dim \theta(\dim/m) {\rm polylog}(m,1/\delta)$,
we should expect that the bound in Theorem~\ref{thm:vc-erm} is typically not much larger than \eqref{eqn:gk-dc} (and indeed will be smaller in many interesting cases).
\subsection{Necessary and Sufficient Conditions for $\boldsymbol{1/m}$ Rates for All Consistent Learners}
\label{sec:lower-bounds}
Corollary~\ref{cor:erm-star} provides a sufficient condition for every consistent learning algorithm
to achieve error rate with $O(1/m)$ asymptotic dependence on $m$: namely, $\mathfrak{s} < \infty$.
Interestingly, we can show that this condition is in fact also \emph{necessary} for every
consistent learner to have a distribution-free bound on the error rate with $O(1/m)$ dependence on $m$.
To be clear, in this context, we only consider $m$ as the asymptotic variable:
that is, $m \to \infty$ while $\delta$ and $\mathbb{C}$ (including $\dim$ and $\mathfrak{s}$) are held fixed.
This result is proven via the following theorem, establishing a worst-case lower bound on $\sup_{h \in V_{m}} {\rm er}(h)$.
\begin{theorem}
\label{thm:erm-lb}
For any $m \in \mathbb{N}$ and $\delta \in (0,1/100)$,
there exists a choice of $\mathcal{P}$ and $f^{\star} \in \mathbb{C}$ such that,
with probability greater than $\delta$,
\begin{equation*}
\sup_{h \in V_{m}} {\rm er}(h) \gtrsim \frac{\dim + {\rm Log}( \min\{\mathfrak{s},m\} ) + {\rm Log}\left(\frac{1}{\delta}\right)}{m} \land 1.
\end{equation*}
Furthermore,
\begin{equation*}
\mathbb{E}\left[ \sup_{h \in V_{m}} {\rm er}(h) \right] \gtrsim \frac{\dim + {\rm Log}( \min\{\mathfrak{s},m\} )}{m} \land 1.
\end{equation*}
\end{theorem}
\begin{proof}
Since any $a,b,c \in \mathbb{R}$ have $a+b+c \leq 3\max\{a,b,c\}$ and $a+b \leq 2\max\{a,b\}$,
it suffices to establish $\frac{\dim}{m} \land 1$, $\frac{{\rm Log}\left(\frac{1}{\delta}\right)}{m} \land 1$, and $\frac{{\rm Log}( \min\{\mathfrak{s},m\} )}{m}$
as lower bounds separately for the first bound, and $\frac{\dim}{m} \land 1$ and $\frac{{\rm Log}(\min\{\mathfrak{s},m\})}{m}$ as lower bounds separately for the second bound.
Lower bounds proportional to $\frac{\dim}{m} \land 1$ (in both bounds) and $\frac{{\rm Log}\left(\frac{1}{\delta}\right)}{m} \land 1$ (in the first bound)
are known in the literature \citep*{blumer:89,ehrenfeucht:89,haussler:94}, and in fact hold as lower bounds on the error rate guarantees achievable by \emph{any} learning algorithm.
For the remaining term, note that this term (with appropriately small constant factors) follows immediately from the others if $\mathfrak{s} \leq 56$, so suppose $\mathfrak{s} \geq 57$.
Fix any $\varepsilon \in (0,1/48)$, let $M_{\varepsilon} = \left\lfloor \frac{1+\varepsilon}{\varepsilon} \right\rfloor$,
and let $x_{1},\ldots,x_{\min\{\mathfrak{s},M_{\varepsilon}\}} \in \mathcal X$ and $h_{0},h_{1},\ldots,h_{\min\{\mathfrak{s},M_{\varepsilon}\}} \in \mathbb{C}$ be as in Definition~\ref{def:star}.
Choose the probability measure $\mathcal{P}$ such that $\mathcal{P}(\{x_{i}\}) = \varepsilon$ for every $i \in \{2,\ldots,\min\{\mathfrak{s},M_{\varepsilon}\}\}$,
and $\mathcal{P}(\{x_{1}\}) = 1 - (\min\{\mathfrak{s},M_{\varepsilon}\}-1)\varepsilon \geq 0$. Choose the target function $f^{\star} = h_{0}$.
Then note that, for any $m \in \mathbb{N}$, if $\exists i \in \{2,\ldots,\min\{\mathfrak{s},M_{\varepsilon}\}\}$ with $x_{i} \notin \{X_{1},\ldots,X_{m}\}$,
then $h_{i} \in V_{m}$, so that $\sup_{h \in V_{m}} {\rm er}(h) \geq {\rm er}(h_{i}) = \varepsilon$.
Characterizing the probability that $\{x_{2},\ldots,x_{\min\{\mathfrak{s},M_{\varepsilon}\}}\} \subseteq \{X_{1},\ldots,X_{m}\}$
can be approached as an instance of the so-called \emph{coupon collector's problem}.
Specifically, let
\begin{equation*}
\hat{M} = \min\left\{ m \in \mathbb{N} : \{x_{2},\ldots,x_{\min\{\mathfrak{s},M_{\varepsilon}\}}\} \subseteq \{X_{1},\ldots,X_{m}\} \right\}.
\end{equation*}
Note that $\hat{M}$ may be represented as a sum $\sum_{k=1}^{\min\{\mathfrak{s},M_{\varepsilon}\}-1} G_{k}$ of independent geometric random variables $G_{k} \sim {\rm Geometric}(\varepsilon (\min\{\mathfrak{s},M_{\varepsilon}\}-k))$,
where $G_{k}$ corresponds to the waiting time between encountering the $(k-1)^{{\rm th}}$ and $k^{{\rm th}}$ distinct elements of $\{x_{2},\ldots,x_{\min\{\mathfrak{s},M_{\varepsilon}\}}\}$ in the $X_{t}$ sequence.
A simple calculation reveals that $\mathbb{E}[ \hat{M} ] = \frac{1}{\varepsilon} H_{\min\{\mathfrak{s},M_{\varepsilon}\}-1}$,
where $H_{t}$ is the $t^{{\rm th}}$ harmonic number; in particular, $H_{t} \geq \ln(t)$.
Another simple calculation with this sum of independent geometric random variables reveals
${\rm Var}(\hat{M}) < \frac{\pi^{2}}{6 \varepsilon^{2}}$.
Thus, Chebyshev's inequality implies that, with probability greater than $1/2$,
$\hat{M} \geq \frac{1}{\varepsilon} \ln( \min\{\mathfrak{s},M_{\varepsilon}\}-1 ) - \frac{\pi}{\sqrt{3} \varepsilon}$.
Since $\ln(\min\{\mathfrak{s},M_{\varepsilon}\}-1) \geq \ln(48) > 2 \frac{\pi}{\sqrt{3}}$, the right hand side
of this inequality is at least
$\frac{1}{2\varepsilon} \ln( \min\{\mathfrak{s},M_{\varepsilon}\}-1 )
= \frac{1}{2\varepsilon} \ln\left( \min\left\{ \mathfrak{s}-1, \left\lfloor \frac{1}{\varepsilon} \right\rfloor \right\} \right)$.
Altogether, we have that for any $m < \frac{1}{2\varepsilon} \ln\left( \min\left\{ \mathfrak{s}-1, \left\lfloor \frac{1}{\varepsilon} \right\rfloor \right\} \right)$,
with probability greater than $1/2$, $\sup_{h \in V_{m}} {\rm er}(h) \geq \varepsilon$.
By Markov's inequality, this further implies that, for any such $m$, $\mathbb{E}\left[ \sup_{h \in V_{m}} {\rm er}(h) \right] > \varepsilon/2$.
For any $m \leq 47$,
the $\frac{{\rm Log}(\min\{\mathfrak{s},m\})}{m}$ term in both lower bounds (with appropriately small constant factors)
follows from the lower bound proportional to $\frac{\dim}{m} \land 1$,
so suppose $m \geq 48$.
In particular, for any $c \in (4,\ln(56))$,
letting $\varepsilon = \frac{\ln( \min\{ \mathfrak{s}-1, m \} )}{c m}$,
one can easily verify that $0 < \varepsilon < 1/48$, and $m < \frac{1}{2\varepsilon} \ln\left( \min\left\{ \mathfrak{s}-1, \left\lfloor \frac{1}{\varepsilon} \right\rfloor \right\} \right)$.
Therefore, with probability greater than $1/2 > \delta$,
\begin{equation*}
\sup_{h \in V_{m}} {\rm er}(h) \geq \frac{\ln( \min\{ \mathfrak{s}-1, m \} )}{c m},
\end{equation*}
and furthermore,
\begin{equation*}
\mathbb{E}\left[ \sup_{h \in V_{m}} {\rm er}(h) \right] > \frac{\ln( \min\{ \mathfrak{s}-1, m \} )}{2 c m}.
\end{equation*}
The result follows by noting $\ln( \min\{ \mathfrak{s}-1, m \} ) \geq \ln( \min\{ \mathfrak{s},m \} / 2 ) \geq \ln( \min\{\mathfrak{s},m\} ) / 2$ for $\mathfrak{s},m \geq 4$.
\end{proof}
Comparing Theorem~\ref{thm:erm-lb} with Corollary~\ref{cor:erm-star},
we see that the asymptotic dependences on $m$ are identical,
though they differ in their joint dependences on $\dim$ and $m$.
The precise dependence on both $\dim$ and $m$ from Corollary~\ref{cor:erm-star} can
be included in the lower bound of Theorem~\ref{thm:erm-lb} for certain
types of concept spaces $\mathbb{C}$, but not all; the interested reader is referred
to the recent article of \citet*{hanneke:15b} for discussions relevant to this
type of gap, and constructions of concept spaces which (one can easily verify)
span this gap: that is, for some spaces $\mathbb{C}$ the lower bound is tight, while for other spaces $\mathbb{C}$ the upper bound is tight, up to numerical constant factors.
An immediate corollary of Theorem~\ref{thm:erm-lb} and Corollary~\ref{cor:erm-star} is that
$\mathfrak{s} < \infty$ is \emph{necessary and sufficient} for arbitrary consistent learners
to achieve $O(1/m)$ rates.
Formally, for any $\delta \in (0,1)$, let $R_{m}(\delta)$ denote the smallest value
such that, for all $\mathcal{P}$ and all $f^{\star} \in \mathbb{C}$, with probability at least $1-\delta$,
$\sup_{h \in V_{m}} {\rm er}(h) \leq R_{m}(\delta)$.
Also let $\bar{R}_{m}$ denote the supremum value of $\mathbb{E}\left[ \sup_{h \in V_{m}} {\rm er}(h) \right]$
over all $\mathcal{P}$ and all $f^{\star} \in \mathbb{C}$.
We have the following corollary (which applies to any $\mathbb{C}$ with $0 < \dim < \infty$).
\begin{corollary}
\label{cor:erm-nec-suf}
$\bar{R}_{m} = \Theta\left( \frac{1}{m} \right)$
if and only if $\mathfrak{s} < \infty$, and otherwise $\bar{R}_{m} = \Theta\left( \frac{{\rm Log}(m)}{m} \right)$.
Likewise, $\forall \delta \in (0,1/100)$,
$R_{m}(\delta) = \Theta\left( \frac{1}{m} \right)$
if and only if $\mathfrak{s} < \infty$, and otherwise $R_{m}(\delta) = \Theta\left( \frac{{\rm Log}(m)}{m} \right)$.
\end{corollary}
\subsection{Using Subregions Smaller than the Region of Disagreement}
\label{sec:subregions}
In recent work, \citet*{zhang:14} have proposed a general active learning strategy,
which revises the CAL strategy so that the algorithm only requests a label if the
corresponding $X_{m}$ is in a well-chosen \emph{subregion} of ${\rm DIS}(V_{m-1})$.
This general idea was first explored in the more-specific context of learning
linear separators under a uniform distribution by \citet*{balcan:07} (see also \citealp*{dasgupta:05b}, for related arguments).
Furthermore, following up on \citet*{balcan:07}, the work of \citet*{balcan:13}
has also used this subregion idea to argue that any consistent learning algorithm
achieves the optimal sample complexity (up to constants) for the problem of
learning linear separators under isotropic log-concave distributions. In this section,
we combine the abstract perspective of \citet*{zhang:14} with our general bounding
technique, to generalize the result of \citet*{balcan:13} by expressing a bound holding
for arbitrary concept spaces $\mathbb{C}$, distributions $\mathcal{P}$, and target functions $f^{\star} \in \mathbb{C}$.
First, we need to introduce the following complexity measure $\varphi_{c}(r_{0})$ based on the work of \citet*{zhang:14}.
As was true of $\theta(r_{0})$ above, this complexity measure $\varphi_{c}(r_{0})$ generally depends on both $\mathcal{P}$ and $f^{\star}$.
\begin{definition}
\label{def:zc}
For any nonempty set $\H$ of classifiers, and any $\eta \geq 0$,
letting $X \sim \mathcal{P}$, define
\begin{multline*}
\Phi(\H,\eta) = \min\left\{ \mathbb{E}[\gamma(X)] : \sup_{h \in \H} \mathbb{E}\left[ \mathbbold{1}[h(X)=+1]\zeta(X) + \mathbbold{1}[h(X)=-1]\xi(X) \right] \leq \eta, \right.
\\ \left. \phantom{\sup_{h \in \H}} \text{ where } \forall x \in \mathcal X, \gamma(x) + \zeta(x) + \xi(x) = 1 \text{ and } \gamma(x),\zeta(x),\xi(x) \in [0,1] \right\}.
\end{multline*}
Then, for any $r_{0} \in [0,1)$ and $c > 1$, define
\begin{equation*}
\varphi_{c}(r_{0}) = \sup_{r_{0} < r \leq 1} \frac{\Phi({\rm B}(f^{\star},r),r/c)}{r} \lor 1.
\end{equation*}
\end{definition}
One can easily observe that, for the optimal choices of $\gamma$, $\zeta$, and $\xi$ in the definition of $\Phi$,
we have $\gamma(x) = 0$ for (almost every) $x \notin {\rm DIS}(\H)$.
In the special case that $\gamma$ is binary-valued,
the aforementioned well-chosen ``subregion'' of ${\rm DIS}(\H)$ corresponds to the set $\{x : \gamma(x) = 1\}$.
In general, the definition also allows for $\gamma(x)$ values in between $0$ and $1$,
in which case $\gamma$ essentially re-weights the conditional distribution $\mathcal{P}(\cdot|{\rm DIS}(\H))$.\footnote{Allowing
these more-general values of $\gamma(x)$ typically does not affect the qualitative behavior of the minimal $\mathbb{E}[\gamma(X)]$ value;
for instance, we argue in Lemma~\ref{lem:zc-binary} of Appendix~\ref{app:noise} that the minimal $\mathbb{E}[\gamma(X)]$ value
achievable under the additional constraint that $\gamma(x) \in \{0,1\}$ is at most $2 \Phi(\H,\eta/2)$. Thus,
we do not lose much by thinking of $\Phi(\H,\eta)$ as describing the measure of a subregion of ${\rm DIS}(\H)$.}
As an example where this quantity is informative, \citet*{zhang:14} argue that, for $\mathbb{C}$ the class of homogeneous linear separators in $\mathbb{R}^{k}$ ($k \in \mathbb{N}$)
and $\mathcal{P}$ any isotropic log-concave distribution, $\varphi_{c}(r_{0}) \lesssim {\rm Log}(c)$ (which follows readily from arguments of \citealp*{balcan:13}).
Furthermore, they observe that $\varphi_{c}(r_{0}) \leq \theta(r_{0})$ for any $c \in (1,\infty]$.
\citet*{zhang:14} propose the above quantities for the purpose of
proving a bound on the label complexity of a certain active learning algorithm,
inspired both by the work of \citet*{balcan:07} on active learning with linear separators,
and by the connection between selective classification and active learning exposed by \citet*{el-yaniv:12}.
However, since the idea of using well-chosen subregions of ${\rm DIS}(V_{m})$ in the analysis of consistent learning algorithms
lead \citet*{balcan:13} to derive improved sample complexity bounds for these methods in the case of
linear separators under isotropic log-concave distributions, and since the corresponding improvements
for active learning are reflected in the general results of \citet*{zhang:14}, it is natural to ask whether
the sample complexity improvements of \citet*{balcan:13} for that special scenario can also be extended
to the general case by incorporating the complexity measure $\varphi_{c}(r_{0})$.
Here we provide such an extension. Specifically, following the same basic strategy
from Theorem~\ref{thm:PDIS}, with a few adjustments inspired by \citet*{zhang:14} to allow us
to consider only a \emph{subregion} of ${\rm DIS}(V_{m})$ in the argument (or more generally, a reweighting
of the conditional distribution $\mathcal{P}(\cdot | {\rm DIS}(V_{m}))$), we arrive at the following result. The proof
is included in Appendix~\ref{app:subregions}.
\begin{theorem}
\label{thm:vc-erm-subregion}
For any $\delta \in (0,1)$ and $m \in \mathbb{N}$, for $c = 16$, with probability at least $1-\delta$,
\begin{equation*}
\sup_{h \in V_{m}} {\rm er}(h) \leq \frac{21}{m} \left( \dim \ln\left( 83 \varphi_{c}\left(\frac{\dim}{m}\right) \right) + 3 \ln\left(\frac{4}{\delta}\right) \right).
\end{equation*}
\end{theorem}
In particular, in the special case of $\mathbb{C}$ the space of homogeneous linear separators on $\mathbb{R}^{k}$,
and $\mathcal{P}$ an isotropic log-concave distribution, Theorem~\ref{thm:vc-erm-subregion} recovers
the bound of \citet*{balcan:13} proportional to $\frac{1}{m}(k + {\rm Log}(\frac{1}{\delta}))$ as a special case.
Furthermore, one can easily construct scenarios (concept spaces $\mathbb{C}$, distributions $\mathcal{P}$, and target functions $f^{\star} \in \mathbb{C}$)
where $\varphi_{c}\left(\frac{\dim}{m}\right)$ is bounded while $\frac{\hat{n}_{1:m}}{\dim} = \frac{m}{\dim}$ almost surely
(e.g., $\mathbb{C} = \{ x \mapsto 2 \mathbbold{1}_{\{t\}}(x) - 1 : t \in \mathbb{R} \}$ the class of impulse functions on $\mathbb{R}$, and $\mathcal{P}$ uniform on $(0,1)$), so that Theorem~\ref{thm:vc-erm-subregion}
sometimes reflects a significant improvement over Theorem~\ref{thm:vc-erm}.
One can easily show that we always have $\varphi_{c}(r_{0}) \leq \left(1-\frac{1}{c}\right) \theta(r_{0})$,
so that Theorem~\ref{thm:vc-erm-subregion} is never worse than the bound \eqref{eqn:gk-dc} of \citet{gine:06}.
However, we argue in Appendix~\ref{sec:sup-zc} that $\forall c \geq 2$, $\forall r_{0} \in [0,1)$,
\begin{equation}
\label{eqn:sup-zc}
\left( 1 - \frac{1}{c} \right) \min\left\{ \mathfrak{s}, \frac{1}{r_{0}} - \frac{1}{c-1} \right\} \leq \sup_{\mathcal{P}} \sup_{f^{\star} \in \mathbb{C}} \varphi_{c}(r_{0}) \leq \left(1 - \frac{1}{c}\right) \min\left\{ \mathfrak{s}, \frac{1}{r_{0}} \right\}.
\end{equation}
Thus, at least in some cases, the bound in Theorem~\ref{thm:vc-erm} is smaller than that in Theorem~\ref{thm:vc-erm-subregion}
(as the former leads to Corollary~\ref{cor:erm-star} in the worst case, while the latter leads to \eqref{eqn:gk-dist-free} in the worst case).
In fact, if we let $\varphi_{c}^{{\scriptscriptstyle{01}}}(r_{0})$ be defined identically to $\varphi_{c}(r_{0})$, except that $\gamma$ is restricted to be $\{0,1\}$-valued
in Definition~\ref{def:zc}, then the same argument from Appendix~\ref{sec:sup-zc} reveals that, for any $c \geq 4$,
\begin{equation*}
\sup_{\mathcal{P}}\sup_{f^{\star} \in \mathbb{C}} \varphi_{c}^{{\scriptscriptstyle{01}}}(r_{0}) = \min\left\{ \mathfrak{s}, \frac{1}{r_{0}} \right\}.
\end{equation*}
\paragraph{Relation to the Doubling Dimension:}
To further put Theorem~\ref{thm:vc-erm-subregion} in context, we also note that it is possible to relate
$\varphi_{c}(r_{0})$ to the \emph{doubling dimension}. Specifically, the doubling dimension (also known as the local metric entropy)
of $\mathbb{C}$ at $f^{\star}$ under $\mathcal{P}$, denoted $D(r_{0})$, is defined as
\begin{equation*}
D(r_{0}) = \max_{r \geq r_{0}} \log_{2}\left( {\cal{N}}\!\left( r/2, {\rm B}(f^{\star},r), \mathcal{P}\right) \right),
\end{equation*}
for $r_{0} > 0$,
where ${\cal{N}}(r/2, {\rm B}(f^{\star},r), \mathcal{P})$ is
the smallest $n \in \mathbb{N}$ such that there exist classifiers $h_{1},\ldots,h_{n}$
for which $\sup_{h \in {\rm B}(f^{\star},r)} \min_{1 \leq i \leq n} \mathcal{P}( x : h(x) \neq h_{i}(x) ) \leq r/2$,
known as the $(r/2)$-covering number for ${\rm B}(f^{\star},r)$ under the $L_{1}(\mathcal{P})$ pseudo-metric.
The notion of doubling dimension has been explored in a variety of contexts in the literature \citep*[e.g.,][]{lecam:73,yang:99b,gupta:03,long:09}.
We always have $D(r_{0}) \lesssim \dim {\rm Log}(1/r_{0})$ \citep*{haussler:95}, though it can often be smaller than this,
and in many interesting contexts, it can even be bounded by an $r_{0}$-invariant value \citep*{long:09}.
\citet*{long:09} construct a particular $\mathcal{P}$-dependent learning rule $\mathbb{A}$ such that,
for any $\varepsilon,\delta \in (0,1)$, and any
\begin{equation}
\label{eqn:doubling-good-bound}
m \gtrsim \frac{1}{\varepsilon} \left( D(\varepsilon/c) + {\rm Log}\left(\frac{1}{\delta}\right) \right),
\end{equation}
where $c > 0$ is a specific constant,
with probability at least $1-\delta$, the classifier $\hat{h}_{m} = \mathbb{A}(\L_{m})$ satisfies ${\rm er}(\hat{h}_{m}) \leq \varepsilon$.
They also establish a weaker bound holding for all consistent learning rules:
for any $\varepsilon > 0$,
denoting $\varepsilon_{0} = \varepsilon \exp\left\{-\sqrt{\ln(1/\varepsilon)}\right\}$,
for any
\begin{equation}
\label{eqn:doubling-loose-bound}
m \gtrsim \frac{1}{\varepsilon} \left( \max\{ \dim, D(\varepsilon_{0}) \} \sqrt{{\rm Log}\left(\frac{1}{\varepsilon}\right)} + {\rm Log}\left(\frac{1}{\delta}\right) \right),
\end{equation}
with probability at least $1-\delta$, $\sup_{h \in V_{m}} {\rm er}(h) \leq \varepsilon$.
\citet*{hanneke:15b} have proven that we always have
$D(r_{0}) \lesssim \dim {\rm Log}( \theta(r_{0}) )$,
which immediately implies that \eqref{eqn:doubling-good-bound}
is never larger than the bound \eqref{eqn:gk-dc} for consistent learning rules (aside from constant factors),
though \eqref{eqn:gk-dc} may often offer improvements over the weaker bound \eqref{eqn:doubling-loose-bound}.
Here we note that a related argument can be used to prove the following
bound: for any $r_{0} > 0$ and $c \geq 8$,
\begin{equation}
\label{eqn:doubling-zc-bound}
D(r_{0}) \leq 2 \dim \log_{2}( 96 \varphi_{c}(r_{0}) ).
\end{equation}
In particular, this implies that the bound \eqref{eqn:doubling-good-bound}
is never larger than the bound in Theorem~\ref{thm:vc-erm-subregion}
for consistent learning rules (aside from constant factors),
though again Theorem~\ref{thm:vc-erm-subregion} may often offer improvements
over the weaker bound \eqref{eqn:doubling-loose-bound}.
We also note that, combined with the above mentioned result of \citet*{zhang:14}
that $\varphi_{c}(r_{0}) \lesssim {\rm Log}(c)$
for $\mathbb{C}$ the class of homogeneous linear separators in $\mathbb{R}^{k}$ and $\mathcal{P}$ any isotropic log-concave distribution,
\eqref{eqn:doubling-zc-bound} immediately implies a bound $D(r_{0}) \lesssim k$ for the doubling dimension
in this scenario (recalling that $\dim = k$ for this class, from \citealp*{cover:65}), which appears to be new to the literature.
The proof of \eqref{eqn:doubling-zc-bound} is included in Appendix~\ref{app:doubling-zc-bound}.
\section{Learning with Noise}
\label{sec:noise}
The previous sections demonstrate how variations on the basic technique of \citet*{hanneke:thesis}
lead to refined analyses of certain learning methods, in the \emph{realizable case}, where $\exists f^{\star} \in \mathbb{C}$ with ${\rm er}(f^{\star}) = 0$.
We can also apply this general technique in the more-general setting of learning with \emph{classification noise}.
Specifically, in this setting, there is a \emph{joint} distribution $\mathcal{P}_{XY}$ on $\mathcal X \times \mathcal Y$,
and the error rate of a classifier $h$ is then defined as ${\rm er}(h) = \P( h(X) \neq Y )$ for $(X,Y) \sim \mathcal{P}_{XY}$.
As above, we denote by $\mathcal{P}$ the marginal distribution $\mathcal{P}_{XY}(\cdot \times \mathcal Y)$ on $\mathcal X$.
We then let $(X_{1},Y_{1}),(X_{2},Y_{2}),\ldots$ denote a sequence of independent $\mathcal{P}_{XY}$-distributed random samples,
and denoting $\L_{m} = \{(X_{1},Y_{1}),\ldots,(X_{m},Y_{m})\}$,
we are interested in obtaining bounds on ${\rm er}(\hat{h}_{m}) - \inf_{f \in \mathbb{C}} {\rm er}(f)$ (the \emph{excess error rate}),
where $\hat{h}_{m} = \mathbb{A}(\L_{m})$ for some learning rule $\mathbb{A}$.
This notation is consistent with the above, which represents the special case
in which $\P( Y = f^{\star}(X) | X ) = 1$ almost surely (i.e., the \emph{realizable case}).
While there are various noise models commonly studied in the literature,
for our present discussion, we are primarily interested in two such models.
\begin{itemize}
\item[$\bullet$] For $\beta \in (0,1/2)$, $\mathcal{P}_{XY}$ satisfies the $\beta$-\emph{bounded noise} condition
if $\exists h^{\star} \in \mathbb{C}$ such that $\P( Y \neq h^{\star}(X) | X ) \leq \beta$ almost surely, where $(X,Y) \sim \mathcal{P}_{XY}$.
\item[$\bullet$] For $a \in [1,\infty)$ and $\alpha \in [0,1]$, $\mathcal{P}_{XY}$ satisfies
the $(a,\alpha)$-\emph{Bernstein class} condition if, for $h^{\star} = \mathop{\rm argmin}_{h \in \mathbb{C}} {\rm er}(h)$,\footnote{For simplicity, we suppose
the minimum error rate is achieved in $\mathbb{C}$. One can easily generalize the condition to the more-general case
where the minimum is not necessarily achieved \citep*[see e.g.,][]{koltchinskii:06},
and the results below continue to hold with only minor technical adjustments to the proofs.}
we have $\forall h \in \mathbb{C}$, $\mathcal{P}(x : h(x) \neq h^{\star}(x)) \leq a \left( {\rm er}(h) - {\rm er}(h^{\star}) \right)^{\alpha}$.
\end{itemize}
Note that $\beta$-bounded noise distributions also satisfy the Bernstein class condition,
with $\alpha = 1$ and $a = \frac{1}{1-2\beta}$.
These two conditions have been studied extensively in both the passive and active learning literatures
\citep*[e.g.,][]{mammen:99,tsybakov:04,bartlett:06,massart:06,koltchinskii:06,bartlett:06b,gine:06,hanneke:thesis,hanneke:11a,hanneke:12a,hanneke:fntml,el-yaniv:11,ailon:14,zhang:14,hanneke:15b}.
In particular, for passive learning, much of this literature focuses on the analysis of \emph{empirical risk minimization}.
Specifically, for any $m \in \mathbb{N}$ and $L \in (\mathcal X \times \mathcal Y)^{m}$,
define ${\rm ERM}(\mathbb{C},L) = \{ h \in \mathbb{C} : {\rm er}_{L}(h) = \min_{g \in \mathbb{C}} {\rm er}_{L}(g) \}$, the set of \emph{empirical risk minimizers}.
\citet*{massart:06} established that, for any $\mathcal{P}_{XY}$ satisfying the $(a,\alpha)$-Bernstein class condition,
for any $\delta \in (0,1)$, with probability at least $1-\delta$,
\begin{equation}
\label{eqn:mn-bernstein}
\sup_{h \in {\rm ERM}(\mathbb{C},\L_{m})} {\rm er}(h) - \inf_{h \in \mathbb{C}} {\rm er}(h) \lesssim \left( \frac{a \left( \dim {\rm Log}\left( \frac{1}{a} \left(\frac{m}{a\dim}\right)^{\frac{\alpha}{2-\alpha}} \right) + {\rm Log}\left(\frac{1}{\delta}\right) \right)}{m}\right)^{\frac{1}{2-\alpha}}.
\end{equation}
In the case of $\beta$-bounded noise, \citet*{gine:06} showed that the logarithmic factor ${\rm Log}\left( \frac{m (1-2\beta)^{2}}{\dim} \right)$
implied by \eqref{eqn:mn-bernstein} can be replaced by ${\rm Log}\left( \theta\left( \frac{\dim}{m (1-2\beta)^{2}} \right) \right)$,
where the disagreement coefficient $\theta(r_{0})$ is defined as above, except with $h^{\star}$ in place of $f^{\star}$ in the definition.
Furthermore, applying their arguments to the general case of the $(a,\alpha)$-Bernstein class condition
(see \citealp*{hanneke:12b}, for an explicit derivation), one arrives at the fact that, with probability at least $1-\delta$,
\begin{equation}
\label{eqn:gk-bernstein}
\sup_{h \in {\rm ERM}(\mathbb{C},\L_{m})} {\rm er}(h) - \inf_{h \in \mathbb{C}} {\rm er}(h) \lesssim \left( \frac{a \left( \dim {\rm Log}\left( \theta\left(a \left(\frac{a\dim}{m}\right)^{\frac{\alpha}{2-\alpha}} \right) \right) + {\rm Log}\left(\frac{1}{\delta}\right) \right)}{m}\right)^{\frac{1}{2-\alpha}}.
\end{equation}
Since \citet*{hanneke:15b} have argued that $\theta(r_{0}) \leq \min\left\{ \mathfrak{s}, \frac{1}{r_{0}} \right\}$ (with equality in the worst case),
\eqref{eqn:gk-bernstein} further implies that, with probability at least $1-\delta$,
\begin{equation}
\label{eqn:star-bernstein}
\sup_{h \in {\rm ERM}(\mathbb{C},\L_{m})} {\rm er}(h) - \inf_{h \in \mathbb{C}} {\rm er}(h) \lesssim \left( \frac{a \left( \dim {\rm Log}\left( \min\left\{ \mathfrak{s}, \frac{1}{a} \left(\frac{m}{a\dim}\right)^{\frac{\alpha}{2-\alpha}} \right\} \right) + {\rm Log}\left(\frac{1}{\delta}\right) \right)}{m}\right)^{\frac{1}{2-\alpha}}.
\end{equation}
Via the same integration argument used in Corollary~\ref{cor:erm-star}, this further implies
\begin{equation}
\label{eqn:star-bernstein-expectation}
\mathbb{E}\left[ \sup_{h \in {\rm ERM}(\mathbb{C},\L_{m})} {\rm er}(h) \right] - \inf_{h \in \mathbb{C}} {\rm er}(h) \lesssim \left( \frac{a \dim {\rm Log}\left( \min\left\{ \mathfrak{s}, \frac{1}{a} \left(\frac{m}{a\dim}\right)^{\frac{\alpha}{2-\alpha}} \right\} \right)}{m}\right)^{\frac{1}{2-\alpha}}.
\end{equation}
It is worth noting that the bound \eqref{eqn:star-bernstein} does not quite recover the bound of Corollary~\ref{cor:erm-star}
in the realizable case (corresponding to $a = \alpha = 1$). Specifically, it contains a logarithmic factor
${\rm Log}\left(\frac{\min\{\mathfrak{s}\dim,m\}}{\dim}\right)$, rather than ${\rm Log}\left(\frac{\min\{\mathfrak{s},m\}}{\dim}\right)$.
I conjecture that this logarithmic factor in \eqref{eqn:star-bernstein} can generally be improved
so that, for any $a$ and $\alpha$, it is bounded by a numerical constant whenever $\mathfrak{s} \lesssim \dim$.
This problem is intimately connected to a conjecture in active learning, proposed by \citet*{hanneke:15b},
concerning the joint dependence on $\mathfrak{s}$ and $\dim$ in the minimax label complexity of active learning under
the Bernstein class condition.
\subsection{Necessary and Sufficient Conditions for $\boldsymbol{1/m}$ Minimax Rates under Bounded Noise}
\label{sec:nec-suf-noise}
In the case of bounded noise (where $a = \frac{1}{1-2\beta}$ and $\alpha = 1$), \citet*{massart:06} have shown that for some concept spaces $\mathbb{C}$,
the factor ${\rm Log}\left( \frac{m (1-2\beta)^{2}}{\dim} \right)$ is present even in a \emph{lower} bound on the minimax excess error rate,
so that it cannot generally be removed.
\citet*{raginsky:11} further discuss a range of lower bounds on the minimax excess error rate for various spaces $\mathbb{C}$ they construct,
where the appropriate factor ranges between ${\rm Log}\left( \frac{m (1-2\beta)^{2}}{\dim} \right)$ at the highest,
to a constant factor at the lowest.
The bound in \eqref{eqn:star-bernstein} provides a \emph{sufficient} condition for all empirical risk minimization algorithms
to achieve excess error rate with $O(1/m)$ asymptotic dependence on $m$ under $\beta$-bounded noise: namely $\mathfrak{s} < \infty$.
Recall that this condition was both sufficient \emph{and necessary} for $O(1/m)$ error rates to be achievable
by every algorithm of this type for all distributions in the realizable case (Corollary~\ref{cor:erm-nec-suf}). It is therefore natural to wonder whether this
remains the case for bounded noise as well. In this section, we find this is indeed the case.
In fact, following a generalization of the technique of \citet*{raginsky:11} explored by \citet*{hanneke:15b} for active learning,
we are here able to provide a general lower bound on the \emph{minimax} excess error rate of passive learning, expressed in terms of $\mathfrak{s}$.
This immediately implies a corollary that $\mathfrak{s} < \infty$ is both \emph{necessary} and \emph{sufficient} for the \emph{minimax optimal} bound on the excess error
rate to have dependence on $m$ of $\Theta(1/m)$ under bounded noise, and otherwise the minimax optimal bound is $\Theta({\rm Log}(m)/m)$.
Note that this is a stronger type of result than that given by Corollary~\ref{cor:erm-nec-suf}, as the lower bounds here apply to \emph{all} learning rules.
Formally, we have the following theorem. The proof is included in Appendix~\ref{app:bounded-lower-proof}.
\begin{theorem}
\label{thm:bounded-lower-bound}
For any $\beta \in (0,1/2)$, $m \in \mathbb{N}$, and $\delta \in (0,1/24]$,
for any (passive) learning rule $\mathbb{A}$, there exists a choice of $\mathcal{P}_{XY}$ satisfying the $\beta$-bounded noise condition
such that, denoting $\hat{h}_{m} = \mathbb{A}(\L_{m})$, with probability greater than $\delta$,
\begin{equation*}
{\rm er}(\hat{h}_{m}) - \inf_{h \in \mathbb{C}} {\rm er}(h) \gtrsim \frac{\dim + \beta {\rm Log}\left( \min\left\{ \mathfrak{s}, (1-2\beta)^{2} m \right\} \right) + {\rm Log}\left(\frac{1}{\delta}\right)}{(1-2\beta) m} \land (1-2\beta).
\end{equation*}
Furthermore,
\begin{equation*}
\mathbb{E}\left[ {\rm er}(\hat{h}_{m}) \right] - \inf_{h \in \mathbb{C}} {\rm er}(h) \gtrsim \frac{\dim + \beta {\rm Log}\left( \min\left\{ \mathfrak{s}, (1-2\beta)^{2} m \right\} \right)}{(1-2\beta) m} \land (1-2\beta).
\end{equation*}
\end{theorem}
As was the case in Theorem~\ref{thm:erm-lb}, the joint dependence on $\dim$ and $m$ in this lower bound
does not match that in \eqref{eqn:star-bernstein} in the case $\mathfrak{s}=\infty$. One can show that the dependence
in this lower bound can be made to nearly match that in \eqref{eqn:star-bernstein} for certain specially-constructed
spaces $\mathbb{C}$ under bounded noise \citep*{massart:06,raginsky:11,hanneke:15b} (the only gap being that $\mathfrak{s}$ is replaced by $\mathfrak{s}/\dim$ in \eqref{eqn:star-bernstein} to obtain the lower bound);
however, there also exist spaces $\mathbb{C}$ where these lower bounds
are nearly tight (for $\beta$ bounded away from $0$), so that they cannot be improved in the general case (see \citealp*{hanneke:15b},
for construction of spaces $\mathbb{C}$ with arbitrary $\dim$ and $\mathfrak{s}$, for which one can show this is the case).
As mentioned above, an immediate corollary of Theorem~\ref{thm:bounded-lower-bound}, in combination with \eqref{eqn:star-bernstein},
is that $\mathfrak{s} < \infty$ is necessary and sufficient for the minimax excess error rate to have $O(1/m)$ dependence on $m$
for bounded noise. Formally, for $m \in \mathbb{N}$, $\beta \in [0,1/2)$, and $\delta \in (0,1)$, let $R_{m}(\delta,\beta)$ denote the
smallest value such that there exists a learning rule $\mathbb{A}$ for which, for all $\mathcal{P}_{XY}$ satisfying the $\beta$-bounded noise condition,
with probability at least $1-\delta$, ${\rm er}(\mathbb{A}(\L_{m})) - \inf_{h \in \mathbb{C}} {\rm er}(h) \leq R_{m}(\delta,\beta)$.
Also let $\bar{R}_{m}(\beta)$ denote the smallest value such that there exists a learning rule $\mathbb{A}$ for which,
for all $\mathcal{P}_{XY}$ satisfying the $\beta$-bounded noise condition, $\mathbb{E}[{\rm er}(\mathbb{A}(\L_{m}))] - \inf_{h \in \mathbb{C}} {\rm er}(h) \leq \bar{R}_{m}(\beta)$.
We have the following corollary (which applies to any $\mathbb{C}$ with $0 < \dim < \infty$).
\begin{corollary}
\label{cor:bounded-nec-suf}
Fix any $\beta \in (0,1/2)$.
$\bar{R}_{m}(\beta) = \Theta\left(\frac{1}{m}\right)$ if and only if $\mathfrak{s} < \infty$, and otherwise $\bar{R}_{m}(\beta) = \Theta\left(\frac{{\rm Log}(m)}{m}\right)$.
Likewise, $\forall \delta \in (0,1/24]$, $R_{m}(\delta,\beta) = \Theta\left(\frac{1}{m}\right)$ if and only if $\mathfrak{s} < \infty$, and otherwise $R_{m}(\delta,\beta) = \Theta\left(\frac{{\rm Log}(m)}{m}\right)$.
\end{corollary}
Again, note that this is a stronger type of result than Corollary~\ref{cor:erm-nec-suf} above,
which only found $\mathfrak{s} < \infty$ as necessary and sufficient for a \emph{particular family}
of learning rules to obtain $O(1/m)$ rates. In contrast, this result applies even to the
\emph{minimax optimal} learning rule.
We conclude this section by noting that the technique leading to Theorem~\ref{thm:bounded-lower-bound}
appears not to straightforwardly extend to the general $(a,\alpha)$-Bernstein class condition.
Indeed, though one can certainly exhibit specific spaces $\mathbb{C}$ for which the minimax excess risk has
$\Theta\left( \left(\frac{{\rm Log}(m)}{m}\right)^{\frac{1}{2-\alpha}} \right)$ dependence on $m$ (e.g., impulse functions on $\mathbb{R}$;
see \citealp*{hanneke:15b}, for related discussions),
it appears a much more challenging problem to construct general
lower bounds describing the range of possible dependences on $m$.
Thus, the more general question of establishing necessary and sufficient conditions
for $O\left(1/m^{\frac{1}{2-\alpha}}\right)$ excess error rates under the $(a,\alpha)$-Bernstein class condition
remains open.
\subsection{Using Subregions to Achieve Improved Excess Error Bounds}
\label{sec:noisy-zc}
In general, note that plugging into \eqref{eqn:gk-bernstein} the parameters $a = \alpha = 1$ admitted by the realizable case, \eqref{eqn:gk-bernstein} recovers the bound \eqref{eqn:gk-dc}.
Recalling that we were able to refine the bound \eqref{eqn:gk-dc} via techniques from the subregion-based analysis of \citet*{zhang:14},
yielding Theorem~\ref{thm:vc-erm-subregion} above, it is natural to consider whether we might be able to refine \eqref{eqn:gk-bernstein} in a similar way.
We find that this is indeed the case, though we establish this refinement for a different learning rule (described in Appendix~\ref{app:zcnoise-proof}).
Letting $c=128$, for any $r_{0} \in [0,1)$, $a \geq 1$ and $\alpha \in (0,1]$,
define
\begin{equation*}
\hat{\zc}_{a,\alpha}(r_{0}) = \sup_{h \in \mathbb{C}} \sup_{r > r_{0}} \frac{\Phi\left({\rm B}(h, r), (r/a)^{1/\alpha}/c \right) }{r} \lor 1.
\end{equation*}
For completeness, also define $\hat{\zc}_{a,\alpha}(r_{0}) = 1$ for any $r_{0} \geq 1$, $a \geq 1$, and $\alpha \in [0,1]$.
We have the following theorem.
\begin{theorem}
\label{thm:zc-noise}
For any $a \geq 1$ and $\alpha \in (0,1]$, for any probability measure $\mathcal{P}$ over $\mathcal X$,
for any $\delta \in (0,1)$, there exists a learning rule $\mathbb{A}$ such that,
for any $\mathcal{P}_{XY}$ satisfying the $(a,\alpha)$-Bernstein class condition
with marginal distribution $\mathcal{P}$ over $\mathcal X$, for any $m \in \mathbb{N}$,
letting $\hat{h}_{m} = \mathbb{A}(\L_{m})$, with probability at least $1-\delta$,
\begin{equation*}
{\rm er}(\hat{h}_{m}) - \inf_{h \in \mathbb{C}} {\rm er}(h) \lesssim \left( \frac{a \left( \dim {\rm Log}\left( \hat{\zc}_{a,\alpha}\left(a \left( \frac{a \dim}{m} \right)^{\frac{\alpha}{2-\alpha}}\right) \right) + {\rm Log}\left(\frac{1}{\delta}\right) \right)}{m} \right)^{\frac{1}{2-\alpha}}.
\end{equation*}
\end{theorem}
The proof is included in Appendix~\ref{app:zcnoise-proof}.
We should emphasize that the bound in Theorem~\ref{thm:zc-noise} is established
for a particular learning method (described in Appendix~\ref{app:zcnoise-proof}), \emph{not} for
empirical risk minimization. Thus, whether or not this bound can be established for
the general family of empirical risk minimization rules remains an open question.
We should also note that $\hat{\zc}_{a,\alpha}(r_{0})$ involves a supremum over $h \in \mathbb{C}$
only so that we may allow the algorithm to explicitly depend on $\hat{\zc}_{a,\alpha}(r_{0})$
(noting that, as stated, Theorem~\ref{thm:zc-noise} allows $\mathcal{P}$-dependence in the algorithm).
It is conceivable that this dependence on $\hat{\zc}_{a,\alpha}(r_{0})$ in $\mathbb{A}$ can be removed,
for instance via a stratification and model selection technique \citep*[see e.g.,][]{koltchinskii:06},
in which case this supremum over $h$ would be replaced by fixing $h = h^{\star}$.
We conclude this section with some basic observations about the bound in Theorem~\ref{thm:zc-noise}.
First, in the special case of $\mathbb{C}$ the class of homogeneous linear separators on $\mathbb{R}^{k}$ and $\mathcal{P}$
any isotropic log-concave distribution,
Theorem~\ref{thm:zc-noise} recovers a bound of \citet*{balcan:13} (established for a closely related method),
since a result of \citet*{zhang:14} implies
$\hat{\zc}_{a,\alpha}(a \varepsilon^{\alpha}) \lesssim {\rm Log}\left( a \varepsilon^{\alpha-1} \right)$
in that case.
Additionally, we note that a result similar to \eqref{eqn:star-bernstein} also generally holds for the method $\mathbb{A}$ from Theorem~\ref{thm:zc-noise}, since \eqref{eqn:sup-zc} implies we always have
\begin{equation*}
\frac{\Phi({\rm B}(h,a \varepsilon^{\alpha}), \varepsilon/c)}{a \varepsilon^{\alpha}} \leq \left( 1 - \frac{1}{ c a } \varepsilon^{1-\alpha} \right) \min\left\{ \mathfrak{s}, \frac{1}{a \varepsilon^{\alpha}} \right\}.
\end{equation*}
| {'timestamp': '2016-09-13T02:02:20', 'yymm': '1512', 'arxiv_id': '1512.07146', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.07146'} | arxiv |
\section{Introduction}
In nature, one of the primary means of communication among biological entities, ranging from organelles to organisms, is molecular communication (MC), where molecules are the carriers of information. MC is also an attractive option for the design of intelligent man-made communication systems at nano and micro scale. Sophisticated man-made MC systems are expected to have various biomedical, environmental, and industrial applications \cite{NakanoB}.
Similar to any other communication system, the design of basic functionalities such as modulation, detection, and estimation requires accurate models for the transmitter, channel, and receiver. However, the modeling of these components in MC systems is vastly different from the modeling of traditional communication systems as the size of the nodes of MC systems is on the order of tens of nanometer to tens of micrometer \cite{NakanoB}.
Furthermore, in MC systems, the communication environment (or channel) and the impairments occurring in the channel are completely different from those in traditional communication systems. For example, in a typical MC setup, the transmitter and the receiver are embedded in a \emph{fluid} environment, where the transmitter employs a certain type of molecule to communicate with the receiver.
Additionally, the information-carrying molecules may be affected by different environmental effects such as \emph{flow} and/or \emph{chemical reactions}, which may prevent them from reaching the receiver \cite{NakanoB}.
The molecules that succeed in reaching the receiver may react with the receptors on the surface of the receiver and activate them. These activated receptors can be interpreted as the received signal. This is a common reception mechanism in natural biological cells. In particular, cells measure the presence of information-carrying molecules via receptors on their surface \cite{AlbertsBook}. These measurements are inevitably corrupted by noise that arises from the stochastic arrival of the molecules by diffusion and from the stochastic binding of the molecules to the receptors. Once an information-carrying molecule binds to a receptor, i.e., \emph{activates the receptor}, this receptor transduces the received noisy message into a cell response via a set of signaling pathways, see \cite[Chapter 16]{AlbertsBook}. Thus, having a meaningful model for the reception process that captures the effects of the main phenomena occurring in the channel and at the receiver is of particular importance and is the focus of this paper.
The modeling of the \emph{reception mechanism} at the receiver has been studied in the existing MC literature; see \cite{PierobonJ1, PierobonJ2, MahfuzJ1, PierobonJ3, ShahMohammadianProc1, YilmazL1, ChunJ1}. Most of these works assume that the receiver is transparent and the received signal is approximated by the local concentration of the information-carrying molecules inside the receiver, see \cite{PierobonJ1, PierobonJ2, MahfuzJ1}. However, this approach neglects the impact of the chemical reactions at the receiver surface required for sensing the concentration of molecules in its vicinity. In a first attempt to consider the effect of chemical reactions at the receiver, the authors in \cite{PierobonJ3} and \cite{ShahMohammadianProc1} modelled the reception mechanism at the receiver using the theory of ligand-receptor binding kinetics, where molecules (ligands) released by a transmitter can reversibly react with receptors at the receiver surface and produce output molecules whose concentration is then referred to as the output signal in \cite{PierobonJ3}, \cite{ShahMohammadianProc1}. Analytical expressions that relate the output signal to the concentration of molecules at the receiver were derived. However, in \cite{PierobonJ3} and \cite{ShahMohammadianProc1}, the authors assumed the diffusion of molecules to be independent from the reaction mechanisms at the receiver, i.e., the equations describing the output signal were derived for a given concentration at the receiver. This assumption may not be justified as the reaction-diffusion equation is highly \emph{coupled} and cannot be separated. The authors in \cite{YilmazL1} approximated the reception mechanism by modeling the receiver as a fully-absorbing sphere, where molecules released by the transmitter are absorbed by the receiver as soon as they hit its surface, and derived an analytical time domain expression for the number of absorbed molecules. However, it may not be realistic to assume that every collision of a molecule with the receiver surface triggers a reaction. In the recent work \cite{ChunJ1}, the reception mechanism was approximated by a first-order reversible reaction inside the receiver, and a reaction-diffusion master equation (RDME) model was used to solve the corresponding coupled reaction-diffusion equation. An analytical expression for the expected number of output molecules was derived in the Laplace domain. However, no time-domain solution was provided.
In this paper, we model the reception mechanism at the receiver surface as a second-order reversible reaction, where an information molecule released by the transmitter can \emph{reversibly} react with receptor protein molecules covering the surface of the receiver and activate a receptor protein molecule, which can later be used for detection. Furthermore, unlike \cite{PierobonJ1, PierobonJ2, MahfuzJ1, PierobonJ3, ShahMohammadianProc1, YilmazL1, ChunJ1}, we also take into account that in a realistic environment, molecules released by the transmitter may degrade in the channel via a first-order degradation reaction. We derive a novel closed-form time domain expression for the expected number of activated receptor protein molecules in response to the impulsive release of molecules at the transmitter. We verify the accuracy of the derived analytical expression via stochastic simulation of the environment using a Brownian motion particle-based approach.
The rest of this paper is organized as follows. In Section \ref{Sec.SysMod}, we introduce the system model. In Section \ref{Sec.CIR}, we derive a closed-form analytical expression for the expected number of activated receptor protein molecules which we refer to as the received signal. In Section \ref{Sec. Simulations}, we briefly describe the framework used for the adopted particle-based simulator and present simulation and analytical results. Finally, some conclusions are drawn in Section \ref{Sec.Con}.
\section{system model}
\label{Sec.SysMod}
In this section, we introduce the system model considered in this paper.
\begin{figure}[!t]
\centering
\includegraphics[scale = 1.7]{System_Model_Modified.pdf}\vspace*{-2 mm}
\caption{Schematic diagram of the considered system model, where receiver and transmitter are shown as a gray sphere in the center of the coordinate system and a black dot, respectively. The surface of the receiver is uniformly covered with type $B$ molecules, shown in blue color. Two sample trajectories of an $A$ information molecule (denoted by red dots) that result in a degraded molecule (circle with a ``-'' inside) and an activated receptor molecule $C$ (circle with a ``+'' inside ) are shown as black and green arrows, respectively.}\vspace*{-5 mm}
\label{Fig.SystemModel}
\end{figure}
We consider an unbounded three-dimensional fluid environment with constant temperature and viscosity. We assume that the transmitter is a point source placed at position $\vec{r}_0 = (x_0,\ y_0,\ z_0)$ and the receiver is spherical in shape with a fixed radius $a$ and placed at the center of the coordinate system, see Fig. \ref{Fig.SystemModel}.
We assume that the transmitter uses one specific type of molecule, denoted by $A$, for sending information to the receiver. Hence, we refer to the information molecules as $A$ molecules. Furthermore, we assume that the transmitter instantaneously releases a fixed number of $A$ molecules, $N_A$, at time $t_0 = 0$ into the environment.
After their release, the information molecules diffuse in the environment into all directions with constant diffusion coefficient $D_A$. Thereby, we assume that the diffusion processes of different information molecules are independent of each other. We furthermore assume that the $A$ molecules can be degraded throughout the environment via a reaction mechanism of the form
\begin{equation}
\label{Eq.DegReaction}
A \xrightarrow{\kd} \emptyset,
\end{equation}
where $\kd$ is the degradation reaction constant in $\text{s}^{-1}$, and $\emptyset$ is a species of molecules which is not recognized by the receiver. Eq. (\ref{Eq.DegReaction}) models a first-order reaction but can also be used to approximate higher order reactions, see e.g. \cite{Steven_Andrews, NoelJ1, ChouJ1}.
Some of the $A$ molecules released by the transmitter may reach the receiver surface, which we assume to be uniformly covered by receptor protein molecules of type $B$. An $A$ molecule can \emph{reversibly} react with a $B$ molecule to form an activated receptor (also referred to as ligand-receptor complex molecule), denoted by $C$, via a reaction mechanism of the form
\begin{equation}
\label{Eq.RevReaction}
A + B \mathrel{\mathop{\rightleftarrows}^{\kf}_{k_b}} C,
\end{equation}
where $\kf$ and $k_b$ are the microscopic forward reaction constant in $\text{molecule}^{3}\cdot \text{s}^{-1}$ and the microscopic backward reaction constant in $\text{s}^{-1}$, respectively. In nature, different cell-surface receptors produce different responses inside the cell via different signaling pathways once they are activated \cite[Chapter 16]{AlbertsBook}. However, in this work, we do not focus on a specific signaling pathway. Instead, we consider the formation of the $C$ ligand-receptor complex molecules as the \emph{received signal} at the receiver, which could be used for detection of information sent by the transmitter. Furthermore, in order to make our analysis analytically tractable, we adopt the following assumptions in \eqref{Eq.RevReaction}:
\begin{itemize}
\item We do not model an individual receptor but assume that the \emph{whole} surface of the receiver is covered with sufficiently many receptor protein molecules $B$.
\item We neglect the effect of receptor saturation, which means that multiple $A$ molecules can react at the same position on the surface of the receiver to form multiple $C$ molecules.
\end{itemize}
With these two assumptions the formations of different $C$ molecules on the surface of the receiver become independent of each other.
\section{expected received signal}
\label{Sec.CIR}
In this section, we first formulate the problem that has to be solved to find the expected received signal at the receiver for the considered MC system. Subsequently, we derive a closed-form expression for the probability of finding an $A$ molecule, which can undergo reactions (\ref{Eq.DegReaction}) and (\ref{Eq.RevReaction}), at the position defined by vector $\vec{r}$ at time $t$, given that it was released at position $\vec{r}_0$ at time $t_0$. Finally, using this result, we derive a closed-form expression for the channel impulse response.
\subsection{Problem Formulation}
We define the \emph{expected} received signal at the receiver at time $t$, $\overline{N}_C(t)$, as the time-varying number of $C$ molecules expected on the surface of the receiver at time $t$ when the transmitter released at time $t_0$ an impulse of $N_A$ $A$ molecules into the environment. This signal is a function of time, due to the random walks of the molecules. In this subsection, we formulate the problem that has to be solved to find $\overline{N}_C(t)$. Considering the assumption of independent movement of individual molecules, we have $\overline{N}_C(t) = N_A \pacv{t}$, where $\pacv{t}$ is the probability that a given $A$ molecule, released at $\vec{r}_0$ and time $t_0=0$, causes the formation of an activated receptor molecule $C$ on the surface the receiver at time $t$. We refer to this probability also as the \emph{channel impulse response} of the system.
Furthermore, the probability that a given $A$ molecule released at $\vec{r}_0$ at time $t_0=0$ is at position $\vec{r}$ at time $t$, given that this molecule may undergo either of the two reaction introduced in (\ref{Eq.DegReaction}) and (\ref{Eq.RevReaction}) during time $t$, is denoted by $\pav{\vec{r}}{t}$. Assuming for the moment $\pav{\vec{r}}{t}$ is known, we can evaluate the incoming probability flux\footnote{We note that the probability flux refers to the flux of the position probability of a \emph{single} $A$ molecule, whereas the conventional diffusive molecular flux (used in Fick's first law of diffusion) refers to the flux of the average number of $A$ molecules. For further details, we refer the interested reader to \cite[Chapter 3]{GillespieBook}.}, $-J(\vec{r},t | \vec{r}_0)$, at the surface of the receiver by applying Einstein's theory of diffusion as \cite[Eq. (3.34)]{GillespieBook}
\begin{equation}
\label{Eq. ProbFlux}
-J(\vec{r},t | \vec{r}_0)\big|_{\vec{r} \in \Omega} = D_A \nabla \pav{\vec{r}}{t}\big|_{\vec{r} \in \Omega},
\end{equation}
where $\nabla$ is the gradient operator in spherical coordinates and $\Omega$ is the surface of the receiver. Now, given $-J(\vec{r},t | \vec{r}_0)$, $-J(\vec{r},t | \vec{r}_0) \dif \Omega \dif t$ is the probability that a given $A$ molecule reacts with the infinitesimally small surface element $\dif \Omega$ of the receiver during infinitesimally small time $\dif t$. Integrating this function over time and the surface of the receiver yields a relationship between $\pacv{t}$ and $\pav{\vec{r}}{t}$, which can be written as \cite[Eq. (3.35)]{GillespieBook}
\begin{equation}
\label{Eq. Relationship}
\pacv{t} = - \int_{0}^{t} \oiint_{\Omega} J(\vec{r},t^\prime | \vec{r}_0)\cdot \dif \Omega \dif t^\prime ,
\end{equation}
Thus, for evaluation of $\pacv{t}$, we first need to find $\pav{\vec{r}}{t}$.
Clearly, the evaluation of (\ref{Eq. Relationship}), and subsequently (\ref{Eq. ProbFlux}), requires knowledge of $J(\vec{r},t | \vec{r}_0)$ only on the surface of the receiver, i.e., on $\Omega$. However, since we assume that the surface of the receiver is uniformly covered by type $B$ molecules, $J(\vec{r},t | \vec{r}_0)$ and $\pav{\vec{r}}{t}$ are only functions of the magnitude of $\vec{r}$, denoted by $r$, and not of $\vec{r}$ itself. This can also be intuitively understood from Fig. \ref{Fig.SystemModel}. To this end, let us assume that the point source transmitter is mounted on top of a virtual sphere with radius $r_0$, where $r_0$ is the magnitude of $\vec{r}_0$. Because of symmetry, we expect that releasing a given molecule $A$ from any arbitrary point on the surface of the virtual sphere leads to the same probability of reaction on the surface of the receiver, i.e., the same $\pacv{t}$ results. However, this is only possible if $J(\vec{r},t | \vec{r}_0)$ in (\ref{Eq. Relationship}) is independent of azimuthal angle $\theta$ and polar angle $\phi$ and only depends on $r$. In the remainder of this paper, we substitute $\vec{r}$ with its magnitude $r$ in (\ref{Eq. ProbFlux}) and (\ref{Eq. Relationship}) without loss of generality. As a result, (\ref{Eq. ProbFlux}) and (\ref{Eq. Relationship}) can be combined as
\begin{equation}
\label{Eq. RelationshipReduced}
\pac{t} = \int_{0}^{t} 4\pi a^2 D_A \frac{\partial \pa{r}{t^\prime}}{\partial r} \bigg |_{r = a} \dif t^\prime.
\end{equation}
\newcounter{tempequationcounter}
\begin{figure*}[!t]
\normalsize
\setcounter{tempequationcounter}{\value{equation}}
\begin{IEEEeqnarray}{rCl}
\setcounter{equation}{16}
\label{Eq. Green's function}
\pa{r}{t} & = & \exp(-k_d t) \Biggl[ \frac{1}{8 \pi r r_0 \sqrt{\pi D_A t} }
\left( \exp\left(\frac{-\left( r - r_0 \right)^2}{4 D_A t}\right)
+ \exp\left( \frac{-\left( r + r_0 - 2a \right)^2}{4D_A t} \right) \right) - \frac{1}{4 \pi r r_0 \sqrt{D_A}} \nonumber \\
&& \times \> \left( \eta_1 \text{W} \left( \frac{r + r_0 - 2a}{\sqrt{4 D_A t}}, \alpha \sqrt{t} \right)
+ \eta_2 \text{W} \left( \frac{r + r_0 - 2a}{\sqrt{4 D_A t}}, \beta \sqrt{t} \right)
+ \eta_3 \text{W} \left( \frac{r + r_0 - 2a}{\sqrt{4 D_A t}}, \gamma \sqrt{t} \right) \right) \Biggr].
\end{IEEEeqnarray}
\setcounter{equation}{\value{tempequationcounter}}
\hrulefill
\vspace*{4pt}
\vspace*{-6 mm}
\end{figure*}
In the following, we are interested in formulating the problem of finding $\pa{r}{t}$ for the system model specified in Section \ref{Sec.SysMod}. In order to do so, we start with the general form of the reaction-diffusion equation for the degradation reaction in (\ref{Eq.DegReaction}), which can be written as \cite{GrinrodB1}
\begin{equation}
\label{Eq. Reaction-Diffusion}
\frac{\partial \pa{r}{t}}{\partial t} = D_A \nabla^{2} \pa{r}{t} - k_d \pa{r}{t},
\end{equation}
where $\nabla^{2}$ is the Laplace operator in spherical coordinates. As discussed above, releasing a given $A$ molecule from any point on the surface of a sphere with radius $r_0$ including the point defined by $\vec{r}_0$, i.e., the actual position of the transmitter, results in the same channel impulse response, $\pac{t}$. Thus, a point source defined by $\vec{r}_0$ and a source uniformly distributed on the sphere with radius $r_0$ are equivalent in this context. As a result, releasing a given $A$ molecule at $\vec{r}_0$ at time $t_0 = 0$ can be modelled with the following initial condition
\begin{equation}
\label{Eq. InitialCondition}
\pa{r}{t \to 0} = \frac{1}{4\pi r_{0}^{2}} \delta(r - r_0),
\end{equation}
where constant $1/(4\pi r_{0}^{2})$ is a normalization factor and $\delta(\cdot)$ is the Dirac delta function. The boundary conditions of the system model for the assumed unbounded environment and the reaction mechanism in (\ref{Eq.RevReaction}) on the surface of the receiver can be written as \cite[Eqs. (3), (4)]{H.KimJ1}
\begin{equation}
\label{Eq. BounCon1}
\lim_{r \to \infty} \pa{r}{t} = 0,
\end{equation}
and
\begin{IEEEeqnarray}{rCl}
\label{Eq. BounCon2}
4\pi a^2 D_A \frac{\partial \pa{r}{t}}{\partial r} \bigg |_{r = a} & \hspace*{-1 mm} = & k_f \pa{a}{t}
- k_b [1 - S(t|r_0)], \nonumber \\*
\end{IEEEeqnarray}
respectively, where $S(t|r_0)$ is the probability that a given $A$ molecule, released at distance $r_0$ at time $t_0$, has neither reacted on the boundary of the receiver nor degraded in the channel by time $t$. $S(t|r_0)$ can be obtained as follows:
\begin{IEEEeqnarray}{c}
\label{Eq. SurvivingProb}
S(t|r_0) = 1 - \int_{0}^{t} 4\pi a^2 D_A \frac{\partial \pa{r}{t^\prime}}{\partial r} \bigg |_{r = a} \dif t^\prime .
\end{IEEEeqnarray}
The solution of reaction-diffusion equation (\ref{Eq. Reaction-Diffusion}) with initial and boundary conditions (\ref{Eq. InitialCondition})-(\ref{Eq. BounCon2}) is the Green's function\footnote{The solution of an inhomogeneous partial differential equation with initial condition in a form of Dirac delta function is referred to as the Green's function \cite{Ivar}.} of our system model.
To summarize, obtaining the expected received signal $\overline{N}_C(t)$ requires knowledge of the impulse response $\pac{t}$ which, in turn, can be found via the Green's function based on (\ref{Eq. RelationshipReduced}).
\subsection{Green's Function}
In this subsection, we derive a closed-form analytical expression for the Green's function of the system. To this end, we adopt the methodology introduced in \cite{SchultenL1}. In particular, we decompose $\pa{r}{t}$ as
\begin{IEEEeqnarray}{c}
\label{Eq. Partition}
\pa{r}{t} = U(r,t|r_0) + V(r,t | r_0),
\end{IEEEeqnarray}
where function $U(r,t|r_0)$ is chosen such that it satisfies both the reaction-diffusion equation (\ref{Eq. Reaction-Diffusion}) and initial condition (\ref{Eq. InitialCondition}). On the other hand, function $V(r,t | r_0)$ is chosen such that it satisfies (\ref{Eq. Reaction-Diffusion}), but at the same time satisfies jointly with function $U(r,t | r_0)$ the boundary conditions (\ref{Eq. BounCon1}) and (\ref{Eq. BounCon2}). With this approach, we can decompose the original problem into two sub-problems as follows. In the first sub-problem, we solve the reaction-diffusion equation
\begin{IEEEeqnarray}{c}
\label{Eq. Reaction-DiffusionU}
\frac{\partial U(r,t | r_0)}{\partial t} = D_A \nabla^{2} U(r,t | r_0) - k_d U(r,t | r_0),
\end{IEEEeqnarray}
with initial condition
\begin{IEEEeqnarray}{c}
\label{Eq. InitialConditionU}
U(r,t \to 0 | r_0) = \frac{1}{4\pi r_{0}^{2}} \delta(r - r_0).
\end{IEEEeqnarray}
In the second sub-problem, we solve the reaction-diffusion equation
\begin{IEEEeqnarray}{c}
\label{Eq. Reaction-DiffusionV}
\frac{\partial V(r,t | r_0)}{\partial t} = D_A \nabla^{2} V(r,t | r_0) - k_d V(r,t | r_0),
\end{IEEEeqnarray}
with the initial condition
\begin{IEEEeqnarray}{c}
\label{Eq. ConditionV}
V(r,t \to 0 | r_0) = 0.
\end{IEEEeqnarray}
Finally, the solutions of both sub-problems are combined, cf. (\ref{Eq. Partition}), such that they jointly satisfy boundary conditions (\ref{Eq. BounCon1}) and (\ref{Eq. BounCon2}). The final solution for the Green's function is given in the following theorem.
\newtheorem{theorem}{Theorem}
\begin{theorem}[Green's function]
The probability of finding a given $A$ molecule at distance $r \geq r_0$ from the center of the receiver at time $t$, given that it was released at distance $r_0$ at time $t_0 = 0$ and may be degraded via first-order degradation reaction (\ref{Eq.DegReaction}) and/or react with the receptor molecules at the receiver surface via the second-order reversible reaction (\ref{Eq.RevReaction}) during time $t$ is given by \eqref{Eq. Green's function} at the top of this page,\addtocounter{equation}{1}
where function $\text{W}(n,m)$ is defined as
\begin{IEEEeqnarray}{c}
\label{Eq. FunctionW}
\text{W}(n,m) = \exp\left( 2nm + m^2 \right) \erfc\left( n + m \right),
\end{IEEEeqnarray}
$\erfc(\cdot)$ is the complementary error function, and constants $\eta_1$, $\eta_2$, and $\eta_3$ are given by
\begin{IEEEeqnarray}{rCl}
\label{Eq. eta1}
\eta_1 & = & \frac{\alpha(\gamma + \alpha)(\alpha + \beta)}{(\gamma - \alpha)(\alpha - \beta)}, \\
\label{Eq. eta2}
\eta_2 & = & \frac{\beta(\gamma + \beta)(\alpha + \beta)}{(\beta - \gamma)(\alpha - \beta)}, \\
\label{Eq. eta3}
\eta_3 & = & \frac{\gamma(\gamma + \beta)(\alpha + \gamma)}{(\beta - \gamma)(\gamma - \alpha)},
\end{IEEEeqnarray}
respectively. Here, $\alpha$, $\beta$, and $\gamma$ are the solutions of the following system of equations
\begin{equation}
\left\{ \,
\begin{IEEEeqnarraybox}[][c]{l?s}
\IEEEstrut
\alpha + \beta + \gamma = \left( 1 + \frac{k_f}{k_D} \right) \frac{\sqrt{D_A}}{a}, \\
\alpha \gamma + \beta \gamma + \alpha \beta = k_b - k_d, \\
\alpha \beta \gamma = k_b \frac{\sqrt{D_A}}{a} - k_d \left( 1 + \frac{k_f}{k_D} \right) \frac{\sqrt{D_A}}{a},
\IEEEstrut
\end{IEEEeqnarraybox}
\right.
\label{Eq. AlphaBetaGamma}
\end{equation}
and $k_D = 4 \pi a D_A$.
\end{theorem}
\begin{IEEEproof}
Please refer to the Appendix.
\end{IEEEproof}
\textit{Remark 1:} $\alpha$, $\beta$, and $\gamma$ may be complex numbers. As a result, complex exponential and complementary error function have to be used for evaluation of $\text{W}(\cdot, \cdot)$. However, the sum of the three $\text{W}(\cdot, \cdot)$ terms on the right hand side of (\ref{Eq. Green's function}) is always a real number.
\subsection{Channel Impulse Response}
Given the Green's function derived in the previous section, we can calculate the channel impulse response via (\ref{Eq. RelationshipReduced}). This leads to
\begin{IEEEeqnarray}{rCl}
\label{Eq. Channel_Impulse_Response}
\pac{t} & = & \frac{k_f e^{-k_dt}}{4\pi r_0 a \sqrt{D_A}} \left\lbrace \frac{\alpha \text{W}\left( \frac{r_0 - a}{\sqrt{ 4 D_A t}}, \alpha \sqrt{t} \right)}{(\gamma - \alpha)(\alpha - \beta)} \right. \nonumber \\
&& \hspace*{-2 mm} \left. +\> \frac{\beta \text{W}\left( \frac{r_0 - a}{\sqrt{4 D_A t}}, \beta \sqrt{t} \right)}{(\beta - \gamma)(\alpha - \beta)}
+ \hspace*{-1 mm} \frac{\gamma \text{W}\left( \frac{r_0 - a}{\sqrt{4 D_A t}}, \gamma \sqrt{t} \right)}{(\beta - \gamma)(\gamma - \alpha)} \right\rbrace. \nonumber \\*
\end{IEEEeqnarray}
Finally, the number of $C$ molecules expected on the surface of the receiver after impulsive release of $N_A$ $A$ molecules at the transmitter can be obtained as
\begin{IEEEeqnarray}{c}
\label{Eq. ExpectedReceSignal}
\overline{N}_C(t) = N_A \pac{t}.
\end{IEEEeqnarray}
\section{simulation framework and results}
\label{Sec. Simulations}
In this section, we first briefly describe our simulation framework. Then, we present simulation and analytical results for evaluation of the accuracy of the derived closed-form expression for the channel impulse response.
\subsection{Simulation Framework}
We employ a Brownian motion particle-based simulation, where the precise locations of all individual molecules are
tracked throughout the simulation environment. In the adopted simulation algorithm, time is advanced in discrete steps of $\Delta t$ seconds. In order to jointly simulate the reactions, i.e., Eqs. (\ref{Eq.DegReaction}) and (\ref{Eq.RevReaction}), and the diffusion of the molecules, we combine in our simulator the algorithm proposed for the simulation of a first-order reaction in \cite{Steven_Andrews} with the algorithm for simulation of a second-order reversible reaction introduced in \cite{WoldeJ1}. In particular, in each step of the simulation, we perform the following operations:
$1$) Any $A$ molecule undergoes a random walk, where the new position of the molecule in each Cartesian coordinate is obtained by sampling a Gaussian random variable with mean $0$ and variance $\sqrt{2D_A\Delta t}$.
$2$) A uniformly distributed random number $l_1 \in [0,1]$ is generated for each $A$ molecule. Then, a given $A$ molecule degrades if its $l_1 \leq \text{Pr} \left(\text{Reaction} \, k_d \right)$, where $\text{Pr} \left(\text{Reaction} \, k_d \right)$ is the degradation probability of a given $A$ molecule in $\Delta t$ seconds, and is given by \cite[Eq. (13)]{Steven_Andrews}
\begin{IEEEeqnarray}{c}
\label{Eq. ProbUniMolReac}
\text{Pr} \left(\text{Reaction} \, k_d \right) = 1 - \exp(-k_d \Delta t).
\end{IEEEeqnarray}
$3$) If the final position of an $A$ molecule at the end of a simulation step leads to an overlap with the receiver, a uniformly distributed random number $l_2 \in [0,1]$ is generated. Then, this displacement is accepted as an occurrence of the forward reaction if $l_2 \leq \text{Pr} \left( \text{Reaction} \, k_f \right)$. $\text{Pr} \left( \text{Reaction} \, k_f \right)$ is the probability of the forward reaction and given as \cite[Eq. (22)]{WoldeJ1}
\begin{IEEEeqnarray}{c}
\label{Eq. ProbBiMolReacForwardAcc}
\text{Pr} \left( \text{Reaction} \, k_f \right) = \frac{k_f \Delta t}{4\pi \rho},
\end{IEEEeqnarray}
where $\rho$ is a normalization factor that can be evaluated as
\begin{IEEEeqnarray}{c}
\label{Eq. ForwardReacNormFac}
\rho = \int_{a}^{\infty} \Pr \left( \text{Ovr} | \vec{r}, \Delta t \right) r^2 \dif r.
\end{IEEEeqnarray}
Here, $\Pr \left( \text{Ovr} | \vec{r}, \Delta t \right)$ is the probability that a given $A$ molecule at position $\vec{r}$ \emph{overlaps} with the receiver in $\Delta t$ seconds, and can be written as \cite[Eq. (B3)]{WoldeJ1}
\begin{IEEEeqnarray}{rCl}
\label{Eq. ProbOverlap}
\Pr \left( \text{Ovr} | \vec{r}, \Delta t \right) & = & \frac{a}{2r \sqrt{\pi}} \left[ \exp\left(\frac{-(r+a)^2}{\sigma^2}\right) \right. \nonumber \\
&& \hspace*{-27 mm} \left. -\> \exp\left( \frac{-(r-a)^2}{\sigma^2} \right) \right] \hspace*{-0.75 mm} + \hspace*{-0.75 mm} \frac{1}{2} \left[ \mathrm{erf}\,\left( \frac{r+a}{\sigma} \right)
+ \mathrm{erf}\,\left( \frac{a-r}{\sigma} \right) \right], \nonumber \\*
\end{IEEEeqnarray}
where $\sigma^2 = 4 D_A \Delta t$ and $\mathrm{erf}\, (\cdot)$ denotes the error function. By occurrence of the forward reaction, the overlapped $A$ molecule is removed and a new $C$ molecule is placed on the surface of the receiver at the position where the receiver surface intersects with a straight line describing the displacement of the $A$ molecule, i.e., the line between the positions of the molecule at the beginning and at the end of the simulation step. If $l_2 > \text{Pr} \left( \text{Reaction} \, k_f \right)$, then the overlapping $A$ molecule is returned to its previous position, i.e, the position it had at the beginning of the simulation step.
$4$) For each $C$ molecule, a uniformly distributed random number $l_3 \in [0,1]$ is generated. Then, the backward reaction in (\ref{Eq.RevReaction}) occurs if $l_3 \leq \text{Pr} \left(\text{Reaction} \, k_b \right)$, where $\text{Pr} \left(\text{Reaction} \, k_b \right)$ is the probability that a given $C$ molecule on the surface of the receiver reverts back and produces an $A$ molecule outside the receiver. $\text{Pr} \left(\text{Reaction} \, k_b \right)$ can be evaluated via (\ref{Eq. ProbUniMolReac}) after substituting $k_d$ with $k_b$. The radial position of the new $A$ molecule is sampled from the normalized distribution $\Pr \left( \text{Ovr} | \vec{r}, \Delta t \right)r^2 / \rho $ and its angular coordinates, i.e., $\theta$ and $\phi$, are uniformly distributed, see \cite{WoldeJ1}.
\subsection{Simulation Results}
In this subsection, we present simulation and analytical results for evaluation of the accuracy of the derived closed-form expression for the channel impulse response.
In order to focus on the impact of the two \emph{chemical} reaction mechanisms introduced in Section \ref{Sec.SysMod}, i.e., the first order degradation reaction \eqref{Eq.DegReaction} and the second-order reversible reaction \eqref{Eq.RevReaction} on the surface of the receiver, on the characteristic of the received signal at the receiver, we keep the \emph{physical} parameters of the environment and the receiver constant throughout this subsection. In particular, we assume that $a = 0.5 \, \mu$m and $r_0 = 1 \, \mu$m. Furthermore, we assume that the diffusion coefficient of the information molecules is $D_A = 5 \times 10^{-9} \, \frac{\text{m}^2}{\text{s}}$ and $N_A = 5000$. The only parameters that we vary are $k_d$, $k_f$, and $k_b$.
For all figures, the number of $C$ molecules expected on the surface of the receiver, i.e., $\overline{N}_C(t)$, was evaluated via \eqref{Eq. ExpectedReceSignal}. The simulation results were averaged over $5 \times 10^{4}$ independent releases of $N_A$ $A$ molecules at the transmitter and a simulation step size of $\Delta t = 0.5 \times 10^{-7}$s was chosen. We also note that the values of $k_f$, $k_b$, and $k_d$ were chosen such that the impact of changing any of these parameters can be observed over the time scale that is simulated.
\begin{figure}[!t]
\centering
\hspace*{-0.5 cm}
\includegraphics[scale = 0.34]{SIM1_Final.pdf}\vspace*{-4 mm}
\caption{$\overline{N}_C(t)$ as a function of time $t$, when $k_d =0$.}\vspace*{-5 mm}
\label{Fig.ForwardBackward}
\end{figure}
In Fig. \ref{Fig.ForwardBackward}, the number of $C$ molecules expected on the surface of the receiver, $\overline{N}_C(t)$, is shown as a function of time $t$ for system parameters $k_d = 0$ $\text{s}^{-1}$, $k_f = 3.14 \times 10^{-14}$ $\text{molecule}^{3}\cdot \text{s}^{-1}$, and $k_b = \{0, 2, 4, 10, 20, 40 \} \times 10^3$ $\text{s}^{-1}$. Fig. \ref{Fig.ForwardBackward} shows that when $k_b =0$, $\overline{N}_C(t)$ increases with increasing $t$ over the time scale that is simulated. This is because when $k_b = 0$, the $C$ molecules produced on the surface of the receiver cannot reverse back via the backward reaction in \eqref{Eq.RevReaction} and, as a result, stay on the surface of the receiver. However, when $k_b > 0$, for any $C$ molecule, there is a non-zero probability that it may reverse back and produce an $A$ molecule in the vicinity of the receiver surface. This new $A$ molecule may associate again with a $B$ molecules on the boundary of the receiver to produce a new $C$ molecule, or it may diffuse away from the receiver and not contribute to the production of a $C$ molecule. This is the reason why, when $k_b > 0$, $\overline{N}_C(t)$ eventually decreases with increasing $t$. We can also see that degradation occurs sooner and at a faster rate for larger $k_b$. This is because increasing $k_b$ increases the rate at which new $A$ molecules (produced by the backward reaction in \eqref{Eq.RevReaction}) escape from the vicinity of the receiver. Furthermore, we note the excellent match between simulation and analytical results.
\begin{figure}[!t]
\centering
\hspace*{-0.5 cm}
\includegraphics[scale = 0.32]{SIM2_final.pdf}\vspace*{-4 mm}
\caption{$\overline{N}_C(t)$ as a function of time $t$.}\vspace*{-5 mm}
\label{Fig.ForwardBackwardDeg}
\end{figure}
In Fig. \ref{Fig.ForwardBackwardDeg}, $\overline{N}_C(t)$ is evaluated as a function of time $t$ for system parameters $k_f = 3.14 \times 10^{-14}$ $\text{molecule}^{3}\cdot \text{s}^{-1}$, $k_b = 2 \times 10^5$ $\text{s}^{-1}$, and $k_d = \{0, 2, 10, 20, 40 \} \times 10^3$ $\text{s}^{-1}$. In this figure, we keep the chemical parameters of the reversible reaction mechanism at the receiver constant to focus on the impact of the degradation reaction in the channel. As expected, $\overline{N}_C(t)$ decreases for increasing $k_d$. This is because larger values of $k_d$ increase the probability that a given $A$ molecule degrades in the channel and cannot produce a $C$ molecule at the receiver. As a result, fewer $A$ molecules contribute to the association reaction.
\section{conclusions}
In this paper, we considered a diffusive molecular communication channel between a pair of transmitter and receiver nano-machines. We modelled the reception at the receiver as a second-order reaction mechanism, where information molecules released by the transmitter into a fluid environment could reversibly react with the receptor protein molecules covering the surface of the receiver. We furthermore assumed that the information molecules can degrade in the channel via a first-order degradation reaction. We derived a closed-form time domain expression for the channel impulse response of the system and verified its accuracy via particle-based simulations. An excellent match between analytical and simulation results was observed.
\label{Sec.Con}
| {'timestamp': '2015-12-22T02:24:53', 'yymm': '1512', 'arxiv_id': '1512.06726', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06726'} | arxiv |
\part{}
\input{Sources/0-title-authors}
\maketitle
\input{Sources/0-abstract}
\input{Sources/1-introduction}
\input{Sources/2-definitions}
\input{Sources/4-complexity-table-icdt}
\input{Sources/3-def-stability}
\input{Sources/Notation-table}
\input{Sources/5-undecidable-dapbs-short-icdt}
\input{Sources/6-positive-cyclic-closed-icdt}
\input{Sources/7-SMS-short-icdt}
\input{Sources/8-acyclic-closed-icdt}
\input{Sources/9-positive-icdt}
\input{Sources/10-rowo-icdt}
\input{Sources/11-related-work-short}
\input{Sources/12-discussion-short}
\subparagraph*{Acknowledgements}
This work was partially supported by the research projects
MAGIC, funded by the province of Bozen-Bolzano,
and
CANDy and PARCIS, funded by the Free University
of Bozen-Bolzano.
\newpage
\subsubsection*{Observations:}}
\newcommand{\vocabulary}[1]{\subsubsection*{Vocabulary and Symbols:}}
\newcommand{\rules}[1]{\subsubsection*{Rules:}}
\newcommand{\problem}[1]{\subsubsection*{Problem:}}
\newcommand{\relations}[1]{\subsubsection*{Relations:}}
\newcommand{\programname}[1]{\subsubsection*{Program Name:}}
\newcommand{Q_{\textit{halt}}}{Q_{\textit{halt}}}
\newcommand{Q_{\textit{halt,s}}}{Q_{\textit{halt,s}}}
\newcommand{D_{T,s}}{D_{T,s}}
\newcommand{D_{T}}{D_{T}}
\newcommand{D_{s}}{D_{s}}
\newcommand{\mathcal{C}} \newcommand{\D}{\mathcal{D}_{T,s}}{\mathcal{C}} \newcommand{\D}{\mathcal{D}_{T,s}}
\makeatletter
\newsavebox\myboxA
\newsavebox\myboxB
\newlength\mylenA
\newcommand*\xoverline[2][0.75]{%
\sbox{\myboxA}{$\m@th#2$}%
\setbox\myboxB\nul
\ht\myboxB=\ht\myboxA%
\dp\myboxB=\dp\myboxA%
\wd\myboxB=#1\wd\mybox
\sbox\myboxB{$\m@th\overline{\copy\myboxB}$
\setlength\mylenA{\the\wd\myboxA
\addtolength\mylenA{-\the\wd\myboxB}%
\ifdim\wd\myboxB<\wd\myboxA%
\rlap{\hskip 0.5\mylenA\usebox\myboxB}{\usebox\myboxA}%
\else
\hskip -0.5\mylenA\rlap{\usebox\myboxA}{\hskip 0.5\mylenA\usebox\myboxB}%
\fi}
\makeatother
\newcommand{\textit{Dig}}{\textit{Dig}}
\newcommand{\Pi^\textit{succ}}{\Pi^\textit{succ}}
\newcommand{\comment}[1]{{\color{blue} [#1]}}
\newcommand{\medskip \noindent -}{\medskip \noindent -}
\newcommand{\bar \epsilon}{\bar \epsilon}
\newcommand{\xoverline{T}}{\xoverline{T}}
\newcommand{\tpT}[1]{\xoverline{T_#1}}
\newcommand{\bar h}{\bar h}
\newcommand{\bar k}{\bar k}
\newcommand{\xoverline{K}}{\xoverline{K}}
\newcommand{\tpK}[1]{\xoverline{K_#1}}
\newcommand{\xoverline{W}}{\xoverline{W}}
\newcommand{\tpW}[1]{\xoverline{W_#1}}
\newcommand{\bar w}{\bar w}
\newcommand{\xoverline{U}}{\xoverline{U}}
\newcommand{\tpU}[1]{\xoverline{U_#1}}
\newcommand{\xoverline{S}}{\xoverline{S}}
\newcommand{\tpS}[1]{\xoverline{S_#1}}
\newcommand{\xoverline{X}}{\xoverline{X}}
\newcommand{\tpX}[1]{\xoverline{X_#1}}
\newcommand{\xoverline{Y}}{\xoverline{Y}}
\newcommand{\tpY}[1]{\xoverline{Y_#1}}
\newcommand{\bar t}{\bar t}
\newcommand{\bar p}{\bar p}
\newcommand{\bar \omega}{\bar \omega}
\newcommand{\bar b}{\bar b}
\newcommand{\textit{In}}{\textit{In}}
\newcommand{\tuple}[1]{\bar{#1}}
\newcommand{\tuple{u}}{\tuple{u}}
\newcommand{\Sigma_\B}{\Sigma_\B}
\newcommand{\textit{Place}}{\textit{Place}}
\newcommand{\textit{State}}{\textit{State}}
\newcommand{\textit{Completed}}{\textit{Completed}}
\newcommand{\textit{Succ}}{\textit{Succ}}
\newcommand{\textit{Path}}{\textit{Path}}
\newcommand{\textit{Reach}}{\textit{Reach}}
\newcommand{\textit{Part}}{\textit{Part}}
\newcommand{\textit{Step}}{\textit{Step}}
\newcommand{\textit{Transition}}{\textit{Transition}}
\newcommand{\textit{Traversal}}{\textit{Traversal}}
\newcommand{\textit{Trans}}{\textit{Trans}}
\newcommand{\textit{NotTrans}}{\textit{NotTrans}}
\newcommand{\textit{Moved}}{\textit{Moved}}
\newcommand{\textit{NotMoved}}{\textit{NotMoved}}
\newcommand{\textit{Select}}{\textit{Select}}
\newcommand{\textit{NonSelect}}{\textit{NonSelect}}
\newcommand{\textit{Pair}}{\textit{Pair}}
\newcommand{\textit{First}}{\textit{First}}
\newcommand{\textit{Last}}{\textit{Last}}
\newcommand{\textit{Const}}{\textit{Const}}
\newcommand{\textit{Num}}{\textit{Num}}
\newcommand{\textit{Value}}{\textit{Value}}
\newcommand{\textit{Digit}}{\textit{Digit}}
\newcommand{\mathit{SCC}}{\mathit{SCC}}
\newcommand{\tTM}{t^{\textit{TM}}}
\newcommand{t^{\textit{idx}}}{t^{\textit{idx}}}
\newcommand{t^{\textit{vs}}}{t^{\textit{vs}}}
\newcommand{t^{\textit{gs}}}{t^{\textit{gs}}}
\newcommand{\sqcup}{\sqcup}
\newcommand{\textit{halt}\xspace}{\textit{halt}\xspace}
\newcommand{\textit{runTM}}{\textit{runTM}}
\newcommand{\textit{Cell}}{\textit{Cell}}
\newcommand{\textit{Head}}{\textit{Head}}
\newcommand{\textit{Version}}{\textit{Version}}
\newcommand{\textit{VersionUsed}}{\textit{VersionUsed}}
\newcommand{\textit{Index}}{\textit{Index}}
\newcommand{\textit{NextVersion}}{\textit{NextVersion}}
\newcommand{\textit{NextIndex}}{\textit{NextIndex}}
\newcommand{\textit{NextVersionUsed}}{\textit{NextVersionUsed}}
\newcommand{\textit{CurrentVersion}}{\textit{CurrentVersion}}
\newcommand{\textit{LockTM}}{\textit{LockTM}}
\newcommand{\textit{LockVersion}}{\textit{LockVersion}}
\newcommand{\textit{LockIndex}}{\textit{LockIndex}}
\newcommand{\textit{Final}}{\textit{Final}}
\newcommand{\textit{PredVersion}}{\textit{PredVersion}}
\newcommand{\textit{PredIndex}}{\textit{PredIndex}}
\newcommand{\textit{CurrentGuess}}{\textit{CurrentGuess}}
\newcommand{\textit{Guessed}}{\textit{Guessed}}
\newcommand{\textit{LockGuess}}{\textit{LockGuess}}
\newcommand{\textit{LastVersion}}{\textit{LastVersion}}
\newcommand{\textit{LastIndex}}{\textit{LastIndex}}
\newcommand{\InGuess}{\textit{Moved}}
\newcommand{\NonInGuess}{\textit{NotMoved}}
\newcommand{\TGuess}{\textit{Trans}}
\newcommand{\NonTGuess}{\textit{NotTrans}}
\newcommand{\Done}{\textit{Completed}}
\newcommand{\textit{left}}{\textit{left}}
\newcommand{\textit{right}}{\textit{right}}
\newcommand{\B_{\textit{TM}}}{\B_{\textit{TM}}}
\newcommand{H_r}{H_r}
\newcommand{B^+_r}{B^+_r}
\newcommand{B^-_r}{B^-_r}
\newcommand{\textit{gnd}}{\textit{gnd}}
\newcommand{\models_{\textit{brave}}}{\models_{\textit{brave}}}
\newcommand{Q_{\textit{test}}}{Q_{\textit{test}}}
\newcommand\myeq{\mathrel{\overset{\makebox[0pt]{\mbox{\normalfont\tiny\sffamily def}}}{=}}}
\newcommand{\textit{Done}}{\textit{Done}}
\newcommand{\textit{Current}_R}{\textit{Current}_R}
\newcommand{\textit{fail}_{\textit{MM}}}{\textit{fail}_{\textit{MM}}}
\newcommand{\textit{fail}_i}{\textit{fail}_i}
\newcommand{\textit{StudyPlan}}{\textit{StudyPlan}}
\newcommand{\text{\emph{Timestamp}}}{\textit{Deadline}}
\newcommand{\text{\emph{initial}}}{\textit{Conditional}}
\newcommand{\textit{Pre-enrolled}}{\textit{Pre-enrolled}}
\newcommand{\textit{Registered}}{\textit{Registered}}
\newcommand{\textit{course}}{\textit{course}}
\newcommand{\textit{program}}{\textit{program}}
\newcommand{\tttttttt}[1]{\textcolor{red}{\bf !}\marginpar{\raggedright\footnotesize\textcolor{red}{#1}}}
\newcommand{1$^\text{st}$}{1$^\text{st}$}
\newcommand{2$^\text{nd}$}{2$^\text{nd}$}
\newcommand{3$^\text{rd}$}{3$^\text{rd}$}
\newcommand{\nth}[1]{#1$^\text{th}$}
\newenvironment{myitemize}{\itemize\addtolength{\itemsep}{-10pt}}{\enditemize}
\newenvironment{myenum}{\enumerate\setlength{\itemsep}{0pt}}{\endenumerate}
\newcommand{\rra}[1]
{\renewcommand{\arraystretch}{#1}}
\newcommand{\stability}[4]
{\textsf{Stable}(#1,#2,#3\,;#4)}
\newcommand{\tx}{{\bar x}}
\newcommand{\ty}{{\bar y}}
\newcommand{\tterm}{{\bar t}}
\newcommand{\ts}{{\bar s}}
\newcommand{\tz}{{\bar z}}
\newcommand{\ta}{\bar a}
\newcommand{\bar d}{\bar d}
\newcommand{\tc}{\bar c}
\newcommand{\consts}[1]{K_{#1}}
\newcommand{\tup{\P,\mathcal{C}} \newcommand{\D}{\mathcal{D}}}{\tup{\P,\mathcal{C}} \newcommand{\D}{\mathcal{D}}}
\newcommand{\sig}{\textit{sig}}
\newcommand{\abstrbc}{\sigma^b_C}
\newcommand{\abstrfun}[2]{\alpha_{#1}^{#2}}
\newcommand{\instable}{\textit{Instable}}
\newcommand{\PiPQfresh}{\Pi_{\P,Q}^{\textsl{fr}}}
\newcommand{\PiPQclosed}{\Pi_{\P,Q}^{\textsl{cl}}}
\newcommand{\PiPIpocl}{\Pi_{\P,\mathcal{I}} \newcommand{\J}{\mathcal{J}}^{\textsl{po,cl}}}
\newcommand{\PiPQopen}{\Pi_{\P,Q}^{\textsl{op}}}
\newcommand{\PiBopen}{\Pi_{\B}^{\textsl{op}}}
\newcommand{\tPiPQfresh}{{\tilde \Pi}_{\P,Q}^{\textsl{fr}} }
\newcommand{{\tilde \Pi}_{\P,Q}^{\textsl{cl}} }{{\tilde \Pi}_{\P,Q}^{\textsl{cl}} }
\newcommand{\Pi_Q^\textsl{fr,test}}{\Pi_Q^\textsl{fr,test}}
\newcommand{\Pi_Q^\textsl{cl,test}}{\Pi_Q^\textsl{cl,test}}
\newcommand{\Pi_{\B,Q}^\textsl{cl}}{\Pi_{\B,Q}^\textsl{cl}}
\newcommand{\Pi_{\B}^\textsl{cl}}{\Pi_{\B}^\textsl{cl}}
\newcommand{\PiPfresh}{\Pi_{\P}^\textsl{fr}}
\newcommand{\Pi_Q^\textsl{test}}{\Pi_Q^\textsl{test}}
\newcommand{\PiPQposfr}{\Pi_{\P,Q}^{\textsl{po,fr}}}
\newcommand{\PiPposfr}{\Pi_{\P}^{\textsl{po,fr}}}
\newcommand{\PiPQposacycfr}{\Pi_{\P,Q}^{\textsl{po,ac,fr}}}
\newcommand{\PiPacyccl}{\Pi_{\P}^{\textsl{ac,cl}}}
\newcommand{\Pi_{\P,\mathcal{I}} \newcommand{\J}{\mathcal{J}}^{\textsl{ac,cl}}}{\Pi_{\P,\mathcal{I}} \newcommand{\J}{\mathcal{J}}^{\textsl{ac,cl}}}
\newcommand{\PiPIQacyccl}{\Pi_{\P,\mathcal{I}} \newcommand{\J}{\mathcal{J}}^{\textsl{ac,cl}}}
\newcommand{\PiPIQposcl}{\Pi_{\P,\mathcal{I}} \newcommand{\J}{\mathcal{J},Q}^{\textsl{pos,cl}}}
\newcommand{\Picl}{\Pi_{\P}^{\textsl{cl}}}
\newcommand{\PiPQposacyccl}{\Pi_{\P,Q}^{\textsl{po,ac,cl}}}
\newcommand{\PiPQposcl}{\Pi_{\P,Q}^{\textsl{po,cl}}}
\newcommand{\PiPQcl}{\Pi_{\P,Q}^{\textsl{cl}}}
\newcommand{\PiPQpos}{\Pi_{\P,Q}^{\textsl{po}}}
\newcommand{\PiPQposfrtest}{\Pi_{Q}^{\textsl{po,fr,test}}}
\newcommand{\PiPQposacycfrtest}{\Pi_{Q}^{\textsl{po,ac,fr,test}}}
\newcommand{\PiPQposacyccltest}{\Pi_{Q}^{\textsl{po,ac,cl,test}}}
\newcommand{\PiPQposcltest}{\Pi_{Q}^{\textsl{po,cl,test}}}
\newcommand{\PiPQcltest}{\Pi_{Q}^{\textsl{cl,test}}}
\newcommand{\PiPQpostest}{\Pi_{Q}^{\textsl{po,test}}}
\newcommand{\PiPIQtest}{\Pi_{\P,\mathcal{I}} \newcommand{\J}{\mathcal{J},Q}^{\textsl{test}}}
\newcommand{\Pi_{\P,Q}^{{\textsl{test,ro}}}}{\Pi_{\P,Q}^{{\textsl{test,ro}}}}
\newcommand{\PiPQtest}{\Pi_{\P,Q}^{\textsl{test}}}
\newcommand{\PiPQrowoposacycfr}{\Pi_{\P,Q}^{\textsl{ro,po,ac,fr}}}
\newcommand{\PiPQrowoposfr}{\Pi_{\P,Q}^{\textsl{ro,po,fr}}}
\newcommand{\PiPQrowoacycfr}{\Pi_{\P,Q}^{\textsl{ro,ac,fr}}}
\newcommand{\PiPQrowofr}{\Pi_{\P,Q}^{\textsl{ro,fr}}}
\newcommand{\PiProwofr}{\Pi_{\P}^{\textsl{ro,fr}}}
\newcommand{\PiPQrowocl}{\Pi_{\P,Q}^{\textsl{ro,cl}}}
\newcommand{\PiProwocl}{\Pi_{\P}^{\textsl{ro,cl}}}
\newcommand{\PiPQrowo}{\Pi_{\P,Q}^{\textsl{ro}}}
\newcommand{\PiProwo}{\Pi_{\P}^{\textsl{ro}}}
\newcommand{\Pi_{\P,Q}^{{\textsl{test,ro,op}}}}{\Pi_{\P,Q}^{{\textsl{test,ro,op}}}}
\newcommand{\rl}{\textit{rl}}
\newcommand{\textit{Exec}}{\textit{Exec}}
\newcommand{\blank}
{{\rule{0.5em}{0.5pt}\hspace{0.05em}}\xspace}
\newcommand{\blankk}
{\raisebox{0.8ex}{-}\kern-0.4em b}
\newcommand{\blanksp}
{\text{\Large \textvisiblespace}}
\theoremstyle{plain}
\newtheorem{proposition}[theorem]{Proposition}
\newcommand{\idea}[1]{\textsl{(Idea) #1}}
\newcommand{\draft}[1]{\textsl{(Draft) #1}}
\newcommand{\threecol}{\textit{3col}}
\newcommand{\Pthreecol}{\P_{\threecol}}
\newcommand{\QTEST}{Q_{\textit{test}}}
\newcommand{\elisa}[1]{{\color{blue} #1}}
\newcommand{\ecomment}[1]{{\color{blue} \emph{[Elisa: #1]}}}
\newcommand{\ognjen}[1]{{\color{Gray}
\textsl{[Ognjen: #1]}}}
\newcommand{N}{N}
\newcommand{L}{L}
\newcommand{R_S}{R_S}
\newcommand{\LE}[1]{E_{\text{\emph{#1}}}}
\newcommand{\LW}[1]{W_{\text{\emph{#1}}}}
\newcommand{\tlbl}[1]{\text{\emph{#1}}}
\newcommand{\emph{(i)~}}{\emph{(i)~}}
\newcommand{\emph{(ii)~}}{\emph{(ii)~}}
\newcommand{\emph{(iii)~}}{\emph{(iii)~}}
\newcommand{\emph{(iv)~}}{\emph{(iv)~}}
\newcommand{\emph{(v)~}}{\emph{(v)~}}
\newcommand{\emph{(vi)~}}{\emph{(vi)~}}
\newcommand{\emph{(vii)~}}{\emph{(vii)~}}
\newcommand{\emph{(a) }}{\emph{(a) }}
\newcommand{\emph{(b) }}{\emph{(b) }}
\newcommand{\emph{(c) }}{\emph{(c) }}
\newcommand{\emph{(d) }}{\emph{(d) }}
\newcommand{mscCS}{mscCS}
\newcommand{mscEco}{mscEco}
\newcommand{compLogic}{compLogic}
\newcommand{emSE}{emSE}
\newcommand{econ}{econ}
\newcommand{clCurr}{clCurr}
\newcommand{seCurr}{seCurr}
\newcommand{\text{\emph{intl}}}{\text{\emph{intl}}}
\newcommand{\nth{30} Sep}{\nth{30} Sep}
\newcommand{$31^{st}$ Oct}{$31^{st}$ Oct}
\newcommand{$2^{nd}$ Oct}{$2^{nd}$ Oct}
\newcommand{\text{\emph{finalize}}}{\text{\emph{finalize}}}
\newcommand{\text{\emph{confirm}}}{\text{\emph{confirm}}}
\newcommand{\text{\emph{reg}}}{\text{\emph{reg}}}
\newcommand{\text{\emph{start}}}{\text{\emph{start}}}
\newcommand{\text{\emph{pre}}}{\text{\emph{pre}}}
\newcommand{T_C}{T_C}
\newcommand{\lblint}[1]{\mathcal{T}_{\text{#1}}}
\newcommand{mscART}{mscART}
\newcommand{emART}{emART}
\newcommand{\mathcal{T}}{\mathcal{T}}
\newcommand{\act}[1]{(`#1')}
\newcommand{\qact}[1]{`#1'}
\newcommand{\uptau_\P}{\uptau_\P}
\newcommand{\textit{head}}{\textit{head}}
\newcommand{\textit{body}}{\textit{body}}
\newcommand{\textit{body}^+}{\textit{body}^+}
\newcommand{\textit{body}^-}{\textit{body}^-}
\newcommand{\mathbb Q}{\mathbb Q}
\newcommand{\textit{SM}}{\textit{SM}}
\newcommand{\e}[1]{\emph{#1}}
\newcommand{\red}[1]{\textcolor{red}{#1}}
\newcommand{\yellow}[1]{\textcolor{yellow}{#1}}
\newcommand{\blue}[1]{\textcolor{blue}{#1}}
\newcommand{\todoAppendix}{\textcolor{RubineRed}{[TODO Appendix]}}
\newcommand{{\cal{D}}}{{\cal{D}}}
\newcommand{\id}[1]{\hat #1}
\newcommand{\av}[1]{\check #1}
\newcommand{et al.}{et al.}
\newcommand{\models}{\models}
\newcommand{\ensuremath{\L_{\rm{RQ}}}}{\ensuremath{\L_{\rm{RQ}}}}
\newcommand{\ensuremath{\L_{\rm{CQ}}}}{\ensuremath{\L_{\rm{CQ}}}}
\newcommand{\ensuremath{\L_{\rm{LRQ}}}}{\ensuremath{\L_{\rm{LRQ}}}}
\newcommand{\ensuremath{\L_{\rm{LCQ}}}}{\ensuremath{\L_{\rm{LCQ}}}}
\renewcommand{\L}{{\cal L}}
\newcommand{\compl}[1]{\textit{Compl}($#1$)}
\newcommand{table completeness\xspace}{table completeness\xspace}
\newcommand{Table completeness\xspace}{Table completeness\xspace}
\newcommand{TC\xspace}{TC\xspace}
\newcommand{\mbox{\textrm{TC-QC}}}{\mbox{\textrm{TC-QC}}}
\newcommand{\ensuremath{\mathsf{TC\text{-}TC}}}{\ensuremath{\mathsf{TC\text{-}TC}}}
\newcommand{\ensuremath{\mathsf{QC\text{-}QC}}}{\ensuremath{\mathsf{QC\text{-}QC}}}
\newcommand{\ensuremath{\mathsf{Cont}}}{\ensuremath{\mathsf{Cont}}}
\newcommand{\ensuremath{\mathsf{ContU}}}{\ensuremath{\mathsf{ContU}}}
\newcommand{\emptyset}{\emptyset}
\newcommand{\incls}{\supseteq}
\newcommand{\colon}{\colon}
\newcommand{\angles}[1]{\langle#1\rangle}
\newcommand{\dd}[2]{#1_1,\ldots,#1_{#2}}
\newcommand{\quotes}[1]{\lq\lq#1\rq\rq}
\newcommand{\WLOG}{wlog\xspace}
\newcommand{\ensuremath{{\sf sum}}}{\ensuremath{{\sf sum}}}
\newcommand{\ensuremath{{\sf count}}}{\ensuremath{{\sf count}}}
\newcommand{\ensuremath{{\sf max}}}{\ensuremath{{\sf max}}}
\newcommand{\ensuremath{{\sf min}}}{\ensuremath{{\sf min}}}
\newcommand\core[1]{\mathring{#1}}
\newcommand{\,{:}{-}\,}{\leftarrow}
\newcommand{\cup}{\cup}
\newcommand{\mathit{dom}}{\mathit{dom}}
\newcommand{\lit}[1]{L_{#1}}
\newcommand{\cpred}[1]{V_{#1}}
\newcommand{G}{G}
\newcommand{\hat{D}}{\hat{D}}
\newcommand{C}{C}
\newcommand{\cplstmt}[2]{#1 {\, \dot{\subseteq} \, } #2}
\newcommand{\Compl}[1]{\mathit{Compl}{(}#1{)}}
\newcommand{\qcompl}[1]{\mathit{Compl}{(}#1{)}}
\newcommand{{\cal C}}{{\cal C}}
\newcommand{\hat C}{\hat C}
\newcommand{\check}{\check}
\renewcommand{\implies}{\rightarrow}
\newcommand{\vee}{\vee}
\newcommand{\findom}[3]{\mathit{Dom}(#1,#2,#3)}
\newcommand{\textit{true}}{\textit{true}}
\newcommand{\textit{false}}{\textit{false}}
\newcommand{\determines}{\rightarrow \! \! \! \! \! \rightarrow}
\newcommand{\dotequiv}{\ \dot{\equiv} \ }
\newcommand{W.l.o.g.\ }{W.l.o.g.\ }
\newcommand{i.\ e.\ ,}{i.\ e.\ ,}
\newcommand{\Pi^P_2}{\Pi^P_2}
\newcommand{\Sigma^P_2}{\Sigma^P_2}
\newcommand{\queryset}{{\cal Q}}
\newcommand{\schemaconstraintset}{{\cal F}}
\newcommand{\scset}{\schemaconstraintset}
\newcommand{\queryset}{\queryset}
\newcommand{\upsilon}{\upsilon}
\newcommand{{\cal V}}{{\cal V}}
\newcommand{\tpl}[1]{\bar{#1}}
\newcommand{\tplsub}[2]{{\bar{#1}}_{#2}}
\newcommand{\query}[2]{#1 \,{:}{-}\, #2}
\newcommand{\aufz}[2]{#1_1,\ldots,#1_{#2}}
\newcommand{\Onlyif}{\lq\lq$\Rightarrow$\rq\rq\ \ }
\newcommand{\eat}[1]{}
\newcommand{\modelsms}{\models \! \! ^{\mathit{M \! \! S}}}
\newcommand{\mbox{ ``$\bowtie$"}} % a join in quotes used for describing the query corresponding to local completeness statements\include{include/macros-common-DC}{\mbox{ ``$\bowtie$"}}
\newcommand{(\textit{i})\xspace}{(\textit{i})\xspace}
\newcommand{(\textit{ii})\xspace}{(\textit{ii})\xspace}
\newcommand{(\textit{iii})\xspace}{(\textit{iii})\xspace}
\newcommand{(\textit{iv})\xspace}{(\textit{iv})\xspace}
\newcommand{(\textit{v})\xspace}{(\textit{v})\xspace}
\newcommand{(\textit{vi})\xspace}{(\textit{vi})\xspace}
\newcommand{(\textit{vii})\xspace}{(\textit{vii})\xspace}
\newcommand{(\textit{viii})\xspace}{(\textit{viii})\xspace}
\newcommand{\mathcal{A}} \newcommand{\B}{\mathcal{B}}{\mathcal{A}} \newcommand{\B}{\mathcal{B}}
\newcommand{\mathcal{C}} \newcommand{\D}{\mathcal{D}}{\mathcal{C}} \newcommand{\D}{\mathcal{D}}
\newcommand{\mathcal{E}} \newcommand{\F}{\mathcal{F}}{\mathcal{E}} \newcommand{\F}{\mathcal{F}}
\newcommand{\mathcal{G}} \renewcommand{\H}{\mathcal{H}}{\mathcal{G}} \renewcommand{\H}{\mathcal{H}}
\newcommand{\mathcal{I}} \newcommand{\J}{\mathcal{J}}{\mathcal{I}} \newcommand{\J}{\mathcal{J}}
\newcommand{\mathcal{K}} \renewcommand{\L}{\mathcal{L}}{\mathcal{K}} \renewcommand{\L}{\mathcal{L}}
\newcommand{\mathcal{M}} \newcommand{\N}{\mathcal{N}}{\mathcal{M}} \newcommand{\N}{\mathcal{N}}
\renewcommand{\O}{\mathcal{O}} \renewcommand{\P}{\mathcal{P}}
\newcommand{\mathcal{Q}} \newcommand{\R}{\mathcal{R}}{\mathcal{Q}} \newcommand{\R}{\mathcal{R}}
\renewcommand{\S}{\mathcal{S}} \newcommand{\mathcal{T}}{\mathcal{T}}
\newcommand{\mathcal{U}} \newcommand{\V}{\mathcal{V}}{\mathcal{U}} \newcommand{\V}{\mathcal{V}}
\newcommand{\mathcal{W}} \newcommand{\X}{\mathcal{X}}{\mathcal{W}} \newcommand{\X}{\mathcal{X}}
\newcommand{\mathcal{Y}} \newcommand{\Z}{\mathcal{Z}}{\mathcal{Y}} \newcommand{\Z}{\mathcal{Z}}
\newcommand{\ol}[1]{\overline{#1}}
\newcommand{\defterm}[1]{\mbox{\underline{\it\smash{#1}\vphantom{\lower.1ex\hbox
{x}}}}}
\newcommand{\rightarrow}{\rightarrow}
\newcommand{\Rightarrow}{\Rightarrow}
\newcommand{\leftarrow}{\leftarrow}
\newcommand{\Leftarrow}{\Leftarrow}
\newcommand{\leftrightarrow}{\leftrightarrow}
\newcommand{\Leftrightarrow}{\Leftrightarrow}
\newcommand{\longrightarrow}{\longrightarrow}
\newcommand{\Longrightarrow}{\Longrightarrow}
\newcommand{\longleftarrow}{\longleftarrow}
\newcommand{\Longleftarrow}{\Longleftarrow}
\newcommand{\longleftrightarrow}{\longleftrightarrow}
\newcommand{\Longleftrightarrow}{\Longleftrightarrow}
\newcommand{\uparrow}{\uparrow}
\newcommand{\Uparrow}{\Uparrow}
\newcommand{\downarrow}{\downarrow}
\newcommand{\Downarrow}{\Downarrow}
\newcommand{\updownarrow}{\updownarrow}
\newcommand{\Updownarrow}{\Updownarrow}
\newcommand{\subseteq}{\subseteq}
\newcommand{\rightarrow}{\rightarrow}
\newcommand{\per}{\mbox{\bf .}}
\newcommand{\set}[1]{\{#1\}}
\newcommand{\Set}[1]{\left\{#1\right\}}
\newcommand{\bigset}[1]{\Bigl\{#1\Bigr\}}
\newcommand{\Big|}{\Big|}
\newcommand{\tup}[1]{\langle #1\rangle}
\newcommand{\Tup}[1]{\left\langle #1\right\rangle}
\newcommand{\setone}[2][1]{\set{#1\cld #2}}
\newcommand{\textsc{Undec.}}{\textsc{Undec.}}
\newcommand{\textsc{Und.}}{\textsc{Und.}}
\newcommand{\mathcal{AL}}{\mathcal{AL}}
\newcommand{\Map}[2]{#1\,\leadsto\,#2}
\newcommand{\textsc{AC}\ensuremath{^0}\xspace}{\textsc{AC}\ensuremath{^0}\xspace}
\newcommand{\textsc{DP}}{\textsc{DP}}
\newcommand{\textsc{co-DP}}{\textsc{co-DP}}
\newcommand{\textsc{LogSpace}\xspace}{\textsc{LogSpace}\xspace}
\newcommand{\textsc{NLogSpace}\xspace}{\textsc{NLogSpace}\xspace}
\newcommand{\textsc{PTime}\xspace}{\textsc{PTime}\xspace}
\newcommand{\textsc{PSpace}\xspace}{\textsc{PSpace}\xspace}
\newcommand{\textsc{ExpSpace}\xspace}{\textsc{ExpSpace}\xspace}
\newcommand{\textsc{ExpTime}\xspace}{\textsc{ExpTime}\xspace}
\newcommand{\textsc{NExpTime}\xspace}{\textsc{NExpTime}\xspace}
\newcommand{\textsc{co-NExpTime}\xspace}{\textsc{co-NExpTime}\xspace}
\newcommand{\textsc{NExpTime}^\textsc{NP}\xspace}{\textsc{NExpTime}^\textsc{NP}\xspace}
\newcommand{\textsc{co-NExpTime}^\textsc{NP}\xspace}{\textsc{co-NExpTime}^\textsc{NP}\xspace}
\newcommand{\textsc{NP}\xspace}{\textsc{NP}\xspace}
\newcommand{\textsc{co-NP}\xspace}{\textsc{co-NP}\xspace}
\newcommand{\Pi^\textsc{P}_2\xspace}{\Pi^\textsc{P}_2\xspace}
\newcommand{\Pi^\textsc{P}_3\xspace}{\Pi^\textsc{P}_3\xspace}
\newcommand{\SigmaPTWO}
{\Sigma^\textsc{P}_2\xspace}
\newcommand{\mathcal{ALN}}{\mathcal{ALN}}
\newcommand{\mathcal{ALE}}{\mathcal{ALE}}
\newcommand{\mathcal{ALU}}{\mathcal{ALU}}
\newcommand{\mathcal{FLE}}{\mathcal{FLE}}
\newcommand{\mathcal{EL}}{\mathcal{EL}}
\newcommand{\mathcal{SHIQ}}{\mathcal{SHIQ}}
\newcommand{\rightarrow}{\rightarrow}
\newcommand{w.r.t.~}{w.r.t.~}
\newcommand{\card}[1]{|{#1}|}
\newcommand{\ \ \textsc{contains}\ \ }{\ \ \textsc{contains}\ \ }
\newcommand{\textsc{select}\xspace}{\textsc{select}\xspace}
\newcommand{\textsc{foreign key}\xspace}{\textsc{foreign key}\xspace}
\newcommand{\textsc{references}\xspace}{\textsc{references}\xspace}
\newcommand{\textsc{from}\xspace}{\textsc{from}\xspace}
\newcommand{\textsc{where}\xspace}{\textsc{where}\xspace}
\newcommand{\textsc{exists}\xspace}{\textsc{exists}\xspace}
\newcommand{\ \ \textsc{as}\xspace \ \ }{\ \ \textsc{as}\xspace \ \ }
\newcommand{\ \textsc{and}\xspace \ }{\ \textsc{and}\xspace \ }
\newcommand{\textsc{or}\xspace}{\textsc{or}\xspace}
\newcommand{\textit{count\/}}{\textit{count\/}}
\newcommand{\text{Magik}}{\text{Magik}}
\newcommand{\textit{Compl\/}}{\textit{Compl\/}}
\newcommand{\textit{Chase}}{\textit{Chase}}
\newcommand{\constantmath}[1]{\mathit{#1}}
\newcommand{\ex}[1]{\mathit{#1}}
\newcommand{\constantsubscript}[1]{\textit{'}\mathit{#1}\!\textit{'}}
\newcommand{\constant}[1]{\textit{'#1\!'}\,}
\newcommand{\textit{pupil\/}}{\textit{pupil\/}}
\newcommand{\textit{name\/}}{\textit{name\/}}
\newcommand{\textit{code\/}}{\textit{code\/}}
\newcommand{\textit{level\/}}{\textit{level\/}}
\newcommand{\textit{class\/}}{\textit{class\/}}
\newcommand{\textit{dept\/}}{\textit{dept\/}}
\newcommand{\textit{langAtt\/}}{\textit{langAtt\/}}
\newcommand{\textit{foreignLang\/}}{\textit{foreignLang\/}}
\newcommand{\constantmath{john}}{\constantmath{john}}
\newcommand{\constantmath{mary}}{\constantmath{mary}}
\newcommand{\constantmath{steve}}{\constantmath{steve}}
\newcommand{\humanities}{\constantmath{humanities}}
\newcommand{\french}{\constantmath{french}}
\newcommand{\spanish}{\constantmath{spanish}}
\theoremstyle{definition}
\newtheorem{examplecontinued}{Example}
\renewcommand{\theexamplecontinued}{\theexample}
\newcommand{{\textit{end\/}}}{{\textit{end\/}}}
\newcommand{{\textit{start\/}}}{{\textit{start\/}}}
\newcommand{{\textit{acad\_check\/}}}{{\textit{acad\_check\/}}}
\newcommand{\bpos}{+}
\newcommand{\bcl}{{\textit{\/cl}}}
\newcommand{\bemy}{{{\textit{\/emp}}}}
\newcommand{\bone}{{1}}
\newcommand{\bcore}{{\textit{\/core}}}
\newcommand{\pos}{^\bpos}
\newcommand{\cl}{_\bcl}
\newcommand{\emy}{_{\bemy}}
\newcommand{\one}{_\bone}
\newcommand{\poscl}{^\bpos_{\bcl}}
\newcommand{\posemy}{^\bpos_{\bemy}}
\newcommand{\posone}{^\bpos_{\bone}}
\newcommand{\clemy}{_{\bcl,\bemy}}
\newcommand{\clone}{_{\bcl,\bone}}
\newcommand{\emyone}{_{\bemy,\bone}}
\newcommand{\posclemy}{^\bpos_{\bcl,\bemy}}
\newcommand{\posemyone}{^\bpos_{\bemy,\bone}}
\newcommand{\clemyone}{_{\bcl,\bemy,\bone}}
\newcommand{\posclone}{^\bpos_{\bcl,\bone}}
\newcommand{\posclemyone}{^\bpos_{\bcl,\bemy,\bone}}
\newcommand{\cor}{^{\bcore}}
\newcommand{\corpos}{^{\bcore,\bpos}}
\newcommand{\corcl}{^{\bcore}_{\bcl}}
\newcommand{\coremy}{^{\bcore}_{\bemy}}
\newcommand{\corone}{^{\bcore}_{\bone}}
\newcommand{\corposcl}{^{\bcore,\bpos}_{\bcl}}
\newcommand{\corposemy}{^{\bcore,\bpos}_{\bemy}}
\newcommand{\corposone}{^{\bcore,\bpos}_{\bone}}
\newcommand{\corclemy}{^{\bcore}_{\bcl,\bemy}}
\newcommand{\corclone}{^{\bcore}_{\bcl,\bone}}
\newcommand{\coremyone}{^{\bcore}_{\bemy,\bone}}
\newcommand{\corposclemy}{^{\bcore,\bpos}_{\bcl,\bemy}}
\newcommand{\corposemyone}{^{\bcore,\bpos}_{\bemy,\bone}}
\newcommand{\corclemyone}{^{\bcore},_{\bcl,\bemy,\bone}}
\newcommand{\corposclemyone}{^{\bcore,\bpos}_{\bcl,\bemy,\bone}}
\newcommand{\DABP}
{MDBP\xspace}
\newcommand{\DABPDISJ}
{\text{DABP}_{\textit{\/core}}\xspace}
\newcommand{\DABPCHRON}
{\text{DABP}_{\textit{\/chron}}\xspace}
\newcommand{\DABPRECUR}
{\text{DABP}_{\textit{\/recur}}\xspace}
\newcommand{\DABPCORE}
{\text{DABP}_{\textit{\/rowo}}\xspace}
\newcommand{\DABPCOREC}
{\text{DABP}^\textit{\,c}_{\textit{\/core}}\xspace}
\newcommand{\DABPRECURC}
{\text{DABP}^\textit{\; c}_{\textit{\/core}}\xspace}
\newcommand{\DABPNOT}{\text{DABP}_{\textit{neg}}\xspace}
\newcommand{\DATALOG}{\text{Datalog}\xspace}
\newcommand{\DATALOGNEG}
{\text{Datalog}^{\neg}\xspace}
\newcommand{\cfbox}[2]{%
\colorlet{currentcolor}{.}%
{\color{#1}%
\fbox{\color{currentcolor}#2}}%
}
\newcommand{\redbox}[1]{%
\colorlet{currentcolor}{.}%
{\color{red}%
\fbox{\color{currentcolor}\red{#1}}}%
}
\newcommand{\const}{\xspace\textit{const\/}\xspace}
\newcommand{\arity}{\xspace\textit{arity\/}\xspace}
\newcommand{\ground}{\xspace\textit{ground}\xspace}
\newcommand{\mathit{Var}}{\xspace\textit{var}\xspace}
\newcommand{\dummy}{\xspace\textit{dummy}\xspace}
\newcommand{\Qref}{\xspace\textit{Q}_\textit{ref}\xspace}
\newcommand{\UCQneq}{\xspace\text{UCQ}^{\neq}\xspace}
\newcommand{\xspace\text{CQ}^{\neq}\xspace}{\xspace\text{CQ}^{\neq}\xspace}
\newcommand{\lpnot}{\textit{not } \xspace}
\newcommand{\RO}{\mathit{In}}
\newcommand{\pragraphbold}[1]
{\paragraph{\textbf{#1.}}}
\section{Introduction}
Data quality focuses on understanding how much data
is fit for its intended use.
This problem has been investigated in database theory,
considering aspects such as consistency, currency, and completeness%
~\cite{Wenfei-Consistency-VLDB-07, Fan:Et:Al-Currency-TODS,Razniewski-Completeness-VLDB-11}.
A question that these approaches
consider only marginally is
where data originates and how it evolves.
{Although} in general a database may evolve in arbitrary ways,
often data are generated according to some
business process, implemented in an information system
that accesses the DB.
We believe that analyzing how business processes generate
data allows one to gather additional information on their fitness
for use.
In this work, we focus on a particular aspect of data quality, that is
the problem whether a business process that reads from and writes into
a database can affect the answer of a query or whether the answer will
not change as a result of the process. We refer to this problem as
query stability.
For example, consider a student registration process at a university.
The university maintains a relation $\textit{Active}\, (\textit{course})$ with
all active courses
and a table $\textit{Registered}\,(\textit{student},\textit{course})$
that records which students have been registered for which course.
Suppose we have a process model that does not allow processes to write
into $\textit{Active}$ and
which states that before a student
is registered for a course,
there must be a check that the course is active.
Consider the query $Q_{\textit{agro}}$ that asks for all students registered
for the MSc in Agronomics (\textit{mscAgro}).
If \textit{mscAgro} does not occur in $\textit{Active}$, then no student can be registered
and the query is stable.
Consider next the query $Q_{\textit{courses}}$ that asks for all courses
for which some student is registered.
If for each active course there is at least one student registered,
then again the query is stable,
otherwise, it is not stable because some student could register for
a so far empty active course.
In general, query results can be affected by the activities of processes in several ways.
Processes may store data from outside in the database,
e.g., the application details submitted by students are stored in the database.
Processes may not proceed because data does not satisfy a required condition,
e.g., an applicant cannot register because his degree is not among the recognized degrees.
Processes may copy data from one part of a database to another one,
e.g., students who passed all exams are automatically registered for the next year.
Processes may interact with each other in that one process writes data that is
read by another one,
e.g., the grades of entry exams stored by the student office
are used by academic admission committees.
Finally, some activities depend on deadlines
so that data cannot change before or after a deadline.
\paragraph*{Approach}
Assessing query stability by leveraging on processes
gives rise to several research questions.
(1) What is a good model to represent processes,
data and the interplay among the two?
(2) How can one reason on query stability in such a model and how feasible is that?
(3) What characteristics of the model may complicate reasoning?
(1) \textbf{Monotonic Data-Aware Business Process Model.}
Business processes are often specified
in standardized languages, such as BPMN \cite{bpmn}, and
organizations rely on engines that can run those processes
(e.g., Bonita \cite{bonita}, Bizagi \cite{bizartifact}).
However, in these systems how the data is manipulated by the
process is implicit in the code.
Current theory
approaches either focus on \emph{process} modeling,
representing the data in a limited way
(like in Petri Nets~\cite{jensen-colouredPN-2009}),
or adopt a \emph{data} perspective,
leaving the representation of the process flow
implicit~\cite{artifact-formal-analysis,Calvanese-DCDS-PODS-2013,Deutsch-WebData-PODS-2004}.
We introduce a formalism called Monotonic Data-aware Business Processes (\DABP{s}).
In \DABP{s} the process is represented as a graph.
The interactions with an underlying database are expressed by annotating
the graph with information on which data is read from the database and which
is written into it.
In {\DABP{s} it is possible that several process instances execute the process.
New information {(fresh data)} can be brought into the process by starting
a fresh process instance}
(Section~\ref{sec:dabp}).
\DABP{s} are
monotonic in that data can only be inserted, but not deleted or updated.
(2) \textbf{Datalog Encodings.}
Existing approaches
aim at the verification of general (e.g.\ temporal) properties,
for which reasoning is typically
intractable~\cite{Calvanese-DCDS-PODS-2013,ltl:verification:hull:vianu-icdt2009-decidable,Deutsch-WebData-PODS-2004}.
In contrast, we study a specific property, namely
stability of conjunctive queries (Section~\ref{sec:query-stability-problem}),
over processes that only insert data.
This allows us to map the problem to the one of query answering in Datalog.
The encoding generates all maximal representative extensions of the database that can be produced
in the process executions
and checks if any new query answer is produced.
We prove that our approach is optimal w.r.t.~worst case complexity
in the size of the data, query, process model and in the size of the entire input.
(3) \textbf{\DABP Variants.}
When modeling processes and data, checking properties often
becomes highly complex or undecidable.
While other approaches in database theory aim at exploring
the frontiers of decidability by restricting the possibility to introduce fresh data,
we adopt a more bottom-up approach and focus on a simpler problem
that can be approached by established database techniques.
To understand the sources of complexity of our reasoning problem,
we identify \emph{five restrictions} of \DABP{s}:
\emph{(i)~} negation is (is not) allowed in process conditions;
\emph{(ii)~} the process can (cannot) start with pending instances;
\emph{(iii)~} a process can (cannot) have cycles;
\emph{(iv)~} a process can (cannot) read from relations that it can write;
\emph{(v)~} new instances can (cannot) start at any moment.
Combinations of these restrictions define different variants
of \DABP{s}, for which we investigate the stability problem
(Sections~\ref{sec:query-stability-problem}--\ref{sec:rowo}).
Related work and conclusions end the paper
(Sections~\ref{ses:related:work},~\ref{sec:discussion:conlcusion}).
A technical report, with complete encodings and proofs
can be found in \cite{DABPS-KRDB:Report}.
A preliminary version of this paper was presented at the AMW workshop~\cite{AMW}.
\section{Read-Only-Write-Only {\DABP}s}
\label{sec:rowo}
In general \DABP{s}, processes can perform recursive inferences by writing into relations from which they have read.
It turns out that if relations are divided into read-only and write-only, the complexity of stability reasoning drops significantly.
The main simplifications in this case are that
\begin{inparaenum}[\itshape (i)]
\item one traversal per instance and transition suffices, since no additional fact can be produced by a second traversal;
\item instead of analyzing entire executions,
it is enough to record which paths an individual process instance can take
and which facts it produces, since instances cannot influence each other.
\end{inparaenum}
As a consequence, the encoding program can be non-recursive and it is
independent of the instances in the process configuration.
A complication arises, however, since the maximal extensions
of the original database $\D$ by the \DABP $\B$
are not explicitly represented by this approach.
They consist of unions of maximal extensions by each instance
and are encoded into the test query, which is part of the program.
\begin{theorem} \label{theorem:rowo}
For every rowo \DABP $\B=\tup{\P,\mathcal{I}} \newcommand{\J}{\mathcal{J},\D}$ and query $Q$
one can construct a nonrecursive Datalog program $\PiPQrowo$, based on $\P$ and $Q$,
and a database instance $\D_\mathcal{I}} \newcommand{\J}{\mathcal{J}$, based on $\D$ and $\mathcal{I}} \newcommand{\J}{\mathcal{J}$,
such that:
$Q$ is instable in $\B$ \ iff\ \ $\PiPQrowo \cup \D_\mathcal{I}} \newcommand{\J}{\mathcal{J} \models \instable$.
\end{theorem}
From the theorem it follows that data and instance complexities are in $\textsc{AC}\ensuremath{^0}\xspace$, except for instance complexity in fresh variants, for
which it is constant.
\paragraph*{Process, Query and Combined Complexity}
Since CQ evaluation can be encoded into an execution condition,
this gives us $\textsc{co-NP}\xspace$-hardness of stability in process complexity.
We also show that it is in $\textsc{co-NP}\xspace$.
First we note that due to the absence of recursion, one can check in $\textsc{NP}\xspace$ whether a set of
atoms is produced by a process instance.
\begin{proposition}
\label{prop-rowo:generability:complexity}
Let $\B$ be a singleton rowo \DABP.
One can decide in $\textsc{NP}\xspace$, whether for given facts $A_1,\ldots,A_m$,
there is an execution in $\B$ that produces $A_1,\ldots,A_m$.
\end{proposition}
Next, suppose that
$\mathcal{I}} \newcommand{\J}{\mathcal{J}$, $\D$ and $Q(\tpl v)\leftarrow B_1,\ldots,B_m$ are a fixed
instance part, database and query.
Given a process model $\P$,
we want to check that $Q$ is instable in $\B_\P=\tup{\P,\mathcal{I}} \newcommand{\J}{\mathcal{J},\D}$.
Making use of the abstraction principle for fresh constants,
we can guess in polynomial time
an instantiation $B'_1,\ldots,B'_n$ of the body of $Q$ that
returns an answer not in $Q(\D)$.
Then we verify that $B'_1,\ldots,B'_n$ are produced by $\B_\P$.
Such a verification is possible in $\textsc{NP}\xspace$ according to
Proposition~\ref{prop-rowo:generability:complexity}.
We guess a partition of the set of facts $B'_1,\ldots,B'_n$,
guess one instance, possibly fresh, for each component set of the partition,
and verify that the component set is produced by the instance.
Since all verification steps were in $\textsc{NP}\xspace$, the whole check is in $\textsc{NP}\xspace$.
Query complexity is $\Pi^\textsc{P}_2\xspace$-complete for the same reasons as in the general variant,
and one can show that this is also the upper-bound for the combined complexity.
\endinput
We make several observations on why rowo encodings become simpler:
\emph{(i)~}
since the written facts cannot be read,
an instance cannot affect its own execution or executions of the other instances
by the facts it generates,
and thus one can analyze produced facts
by observing each instance independently;
\emph{(ii)~}
cycles do not affect complexity since no additional fact can be produced
if an instance traverses a transition more than once;
\emph{(iii)~}
negation in the rules is always unstratified since it is on the read-only
part of the database;
\emph{(iv)~}
if $n$ is the size of the query, then
the process has to insert at most $n$ new facts to create a new query answer,
and to generate those facts it needs at most $n$ process instances.
\paragraph*{Complexity}
Instances and data are encoded as facts of a non-recursive Datalog program,
hence instance and data complexity is in $\textsc{AC}\ensuremath{^0}\xspace$.
It also means that the stability problem can be reduced to the problem of evaluating a FOL query that encodes process model over a database that stores the process instances and the database instance.
Since, FOL queries correspond to SQL queries (without aggregates),
this opens the possibility for an efficient reasoning on stability using
established RDBMS technologies.
The process complexity is even lower than program complexity
for non-recursive Datalog programs.
The process complexity of checking instability is
$\textsc{NP}\xspace$-complete which is as complex as evaluating CQs.
This holds already for the simplest variant of rowo.
Intuitively, the upper-bound follows from
the observation \emph{(iv)~} above.
In fact, one can construct a single CQ instead of Datalog rules,
but the construction is very technical.
The query complexity is $\Pi^\textsc{P}_2\xspace$-complete for the same reasons as in the general variant, and this gives the upper-bound for the combined complexity.
\newpage
\endinput
We first show encodings for fresh open cases and
then for closed arbitrary.
As in the general case,
the encodings for open arbitrary cases can be obtained
combined the corresponding fresh open and closed arbitrary cases.
To check stability of a rowo \DABP,
we construct a non-recursive Datalog program.
However, the process complexity is even smaller.
It is a complex as evaluating CQ.
In principle, one can rewrite process as a single CQ (or as a union of CQs)
but such approach is very technical, and as such we think
it is not of practical interest.
On the the other hand,
the process complexity is even simpler than non-recursive Datalog rules.
In fact, in rowo data and instance complexities in are ACz
which means that checking stability can be done
by evaluating a Boolean First-Order (FO) query over a
database that contains process instances and database facts.
Since FO queries corresponds to SQL queries, one can in principle,
implement stability checking as query answering over SQL engine
where SQL query encodes process model.
intro what we are going to show
- say that we think that main characteristics is low data and instance complexity
- there results can be obtained already by adopting encoding from
general case to a non-recursive Datalog programs
- from there we obtain complexities for data and instance
- secondly, process complexity is even weaker than non-recursive Datalog programs, that is as hard as evaluating CQs
- In principle, it would be possible to define such a query however it is very technical and thus not of practical interesting
So in the following we first present encoding
then we discuss process complexity
-------------
some general principles before adopting encoding from general
- (a) to produce maximal database it is enough to traverse each transition at most once
- (b) negation is always unstratified since it is on the read only part of the database
- (c) in case of arbitrary instances cannot communicate it is always one can instead of analyzing all possible transitions for all together analyze one at the time
------------
very short intuition how we are going to show open cases
for open cases:
- combination of bounded cases and open cases for
- every rule becomes ...
very short intuition how we are going to show closed cases
for closed cases:
- we adopt acyclic case
again for the same reasons even in the presence of cyclic
------------
process complexity
upper bounds
approach
- say that for singleton can be decided in NP time
- now since they execute independently closed cases
- in open case we have abstraction principle
then we observe that it is enough to consider only instances that takes
constans from K
- then we introduce each possible instance that takes constants from K
(which is polynomially many in size of process)
- then we need to produce at most as many atoms are in the query
- then we introduce for each instantiation |Q| many copies at start
- the rest is the same as in the cyclic case, by checking what each
instance can produce and then combining produced atoms in order
to find new answer
2 theorems
- one for singleton processes
- one final that conclude how complex it is
hardness
- give intuition by saying that already evaluating CQ over a fixed database is NP-hard, thus checking stability also ...
------------
comment on query complexity
------------
final theorem [summary]
\endinput
\paragraph*{Encoding into non-recursive Datalog}
- To check stability ...
- The techniques
-
Based on these observations
- In particular, for fresh instances we adapt encoding for positive case, and but of bounded derivation
\section{Related Work}
\label{ses:related:work}
Traditional approaches for business process modeling focus on the set of activities to be performed and the flow of their execution.
These approaches are known as \emph{activity-centric}.
A different perspective, mainly investigated in the context of databases, consists in identifying the set of data (entities) to be represented and describes processes in terms of their possible evolutions.
These approaches are known as \emph{data-centric}.
In the context of activity-centric processes, Petri Nets (PNs) have been used for the representation, validation and verification of formal properties, such as absence of deadlock, boundedness and reachability
\cite{Aalst-Verification-97, Aalst-Patterns-03}.
In PNs and their variants, a token carries a limited amount of information, which can be represented by associating to the token a set of variables, like in colored PNs
\cite{jensen-colouredPN-2009}.
No database is considered in PNs.
Among data-centric approaches,
\emph{Transducers}~\cite{Abiteboul-Transducers-PODS-98,Spielmann}
were among the first formalisms ascribing a central role to the
data and how they are manipulated.
These have been extended
to \emph{data driven web systems}~\cite{Deutsch-WebData-PODS-2004}
to model
the interaction of a user with a web site,
which are then extended in
\cite{ltl:verification:hull:vianu-icdt2009-decidable}.
These frameworks
express
insertion and deletion rules using FO formulas.
The authors verify properties
expressed as FO variants of LTL, CTL and CTL* temporal formulas.
The verification of these formulas results to be
undecidable in the general case.
Decidability is obtained under certain restrictions
on the input, yielding to
\textsc{ExpSpace}\xspace complexity for checking LTL formulas
and \textsc{co-NExpTime}\xspace and \textsc{ExpSpace}\xspace for
CTL and CTL* resp., in the propositional case.
Data-Centric Dynamic Systems (DCDSs)
\cite{Calvanese-DCDS-PODS-2013}
describe processes in terms of guarded FO rules that evolve the database.
The authors study the verification of temporal properties
expressed in variants of $\mu$-calculus (that subsumes CTL*-FO).
They identify several undecidable classes
and isolate decidable variants
by
assuming a bound on the size of the database at each step or
a bound on the number of constants at each run.
In these cases verification is
\textsc{ExpTime}\xspace-complete in data complexity.
Overall, both frameworks are more general than \DABP{s}, since deletions and updates of facts are also allowed.
This is done by rebuilding the database after each execution step.
Further, our stability problem can be encoded as FO-CTL formula.
However,
our decidability results for positive \DABP{s}
are not captured by the decidable fragments of those approaches.
In addition, the authors of the work above investigate the borders of decidability, while we focus on a simpler problem and study the sources of complexity.
Concerning the process representation,
both approaches adopt a rule-based specification.
This makes the control flow more difficult to grasp,
in contrast to activity-centric approaches where
the control flow has an explicit representation.
\emph{Artifact-centric} approaches
\cite{Hull-Artifact-Centric-Survey}
use artifacts to model business relevant entities.
In
\cite{artifact-formal-analysis,
artifct-static-analysis,
gerede-su-icsoc2007}
the authors investigate the verification of properties
of artifact-based processes
such as reachability, temporal constraints, and
the existence of dead-end paths.
However, none of these approaches explicitly models an underlying database.
Also,
the authors focus on finding suitable restrictions
to achieve decidability, without a fine-grained complexity analysis as in our case.
Approaches in \cite{Milo-Provenance} and \cite{MILO-BP-QL},
investigate the challenge of combining processes and data, however,
focusing on the problem of data provenance and of querying the process structure.
In~\cite{Elkan-QueryUpdate-PODS-90,LevySagiv-updates-1993-VLDB} the authors
study the problem of determining whether a query over views is independent
from a set of updates over the database.
The authors do not consider a database instance nor a process.
Decidability in rowo \DABP{s} can be seen as a
special case of those.
In summary,
our approach to process modeling is closer to the activity-centric one
but we model manipulation of data like in the data-centric
approaches.
Also, having process instances and \DABP{s} restrictions
gives finer granularity
compared to data-centric approaches.
\section{Discussion and Conclusion}
\label{sec:discussion:conlcusion}
\paragraph*{Discussion}
An interesting question is how complex stability becomes
if \DABP{s} are not monotonic, i.e.,
if updates or deletions are allowed.
In particular, for positive \DABP{s} we can show the following.
In acyclic positive closed \DABP{s} updates and deletions
can be modeled using negation in the rules,
thus stability stays $\textsc{PSpace}\xspace$-complete.
For the cyclic positive closed variant, allowing updates or deletions is more powerful
than allowing negation, and stability
jumps to $\textsc{ExpSpace}\xspace$-completeness.
For positive \DABP{s} with updates or deletions
stability is undecidable.
In case the initial database is not known,
our techniques can be still applied since an arbitrary database can be produced by fresh instances starting from an empty database.
\paragraph*{Contributions}
Reasoning about data and processes can be relevant in decision support
to understand how processes affect query answers.
(1) To model processes that manipulate data we adopt an explicit representation of the control flow as in standard BP languages (e.g., BPMN).
We specify how data is manipulated as annotations on top of the control flow.
(2) Our reasoning on stability can be offered as a reasoning service on top of the query answering that reports on the reliability of an answer.
Ideally, reasoning on stability should not bring a significant overhead on query answering in practical scenarios.
Existing work on processes and data~\cite{Calvanese-DCDS-PODS-2013}
shows that verification of general temporal properties is typically
intractable already measured in the size of the data.
(3) In order to identify tractable cases and sources of complexity we investigated different variants of our problem, by considering negation in conditions, cyclic executions, read access to written data, presence of pending process instances, and the possibility to start fresh process instances.
(4) Our aim is to deploy reasoning on stability to existing query answering platforms such as SQL and ASP~\cite{DLV-Leone-2006}.
For this reason we established different encodings into suitable variants of Datalog, that are needed to capture the different characteristics of the problem. For each of them we showed that our encoding is optimal.
In contrast to existing approaches, which rely on model checking to verify properties, in our work we rely on established database query languages.
\paragraph*{Open Questions}
In our present framework we cannot yet
model process instances with activities that are running in parallel.
Currently, we are able to deal with it only in case instances do not interact (like in rowo).
Also, we do not know yet how to reason about expressive queries, such as conjunctive queries with negated atoms,
and first-order queries.
From an application point of view,
stability of aggregate queries and aggregates in the process rules are relevant.
A further question is how to quantify instability,
that is, in case a query is not stable, how to compute the minimal and maximal number of possible new answers.
\section{Monotonic Data-Aware Business Processes}
\label{sec:dabp}
\emph{Monotonic Data-aware Business Processes} (\DABP{s}) are the formalism by
which we represent business processes and the way they manipulate data.
We rely on this formalism to perform reasoning on query stability.
\paragraph*{Notation}
We adopt standard notation from databases.
In particular, we assume an infinite set of relation symbols,
an infinite set of constants $\mathit{dom}$ as the \emph{domain of values},
and the positive rationals ${\mathbb Q}^+$ as the \emph{domain of timestamps}.
A schema is a finite set of relation symbols.
A \emph{database instance} is a finite set of ground atoms, called \emph{facts},
over a schema and the \emph{domain} $\mathit{dom}_{\RationalsPos} = \mathit{dom} \cup {\mathbb Q}^+$.
We use upper-case letters for variables,
lower-case for constants,
and overline for tuples, e.g., $\tc$.
An \DABP is a pair $\B=\tup{\P,\mathcal{C}} \newcommand{\D}{\mathcal{D}}$,
consisting of a \emph{process model} $\P$ and a \emph{configuration} $\mathcal{C}} \newcommand{\D}{\mathcal{D}$.
The process model defines how and under which conditions actions change data
stored in the configuration.
The configuration is dynamic,
consisting of \emph{(i)~} a database,
and \emph{(ii)~} the process instances.
\paragraph*{Process Model}
The process model is a pair $\P=\tup{N,L}$,
comprising a directed multigraph~$N$, the \emph{process net},
and a \emph{labeling function} $L$, defined on the edges of $N$.
The net $N = \tup{P,T}$ consists of a set of vertices $P$, the \emph{places},
and a multiset of edges $T$, the \emph{transitions}.
A process instance traverses the net, starting from the distinguished place ${\textit{start\/}}$.
The transitions emanating from a place represent
alternative developments of an instance.
A process instance has input data associated with it,
which are represented by a fact $\textit{In}(\tc,\tau)$,
where $\textit{In}$ is distinguished relation symbol,
$\tc$ is a tuple of constants from $\mathit{dom}_{\RationalsPos}$,
and $\tau \in {\mathbb Q}^+$ is a time stamp
that records when the process instance was started.
We denote with $\Sigma_{\B,\textit{In}}$ and $\Sigma_{\B}$ the schemas of $\B$
with and without $\textit{In}$, respectively.
The {labeling function\/} $L$ assigns to every transition $t\in T$
a pair $L(t)=(E_t,W_t)$.
Here, $E_t$, the \emph{execution condition,}
is a Boolean query over $\Sigma_{\B,\textit{In}}$ and
$W_t$, the \emph{writing rule,} is a rule
$R(\tuple{u}) \leftarrow B_t(\tuple{u})$
whose head is a relation of $\Sigma_{\B}$
and whose body is a $\Sigma_{\B,\textit{In}}$-query that has the same arity as the head relation.
Evaluating $W_t$ over a $\Sigma_{\B,\textit{In}}$-instance $\D$ results in
the set of facts
$W_t(\D) = \set{R(\tpl c) \mid \tpl c \in B_t(\D)}$.
Intuitively,
$E_t$ specifies in which state of the database
which process instance can perform the transition $t$, and
$W_t$ specifies which new information is (or can be)
written into the database when performing $t$.
In this paper we assume that $E_t$ and $B_t$ are conjunctive queries,
possibly with negated atoms and inequality atoms with \quotes{$<$}
and \quotes{$\leq$} involving timestamps.
We assume inequalities to consist of one constant and one variable,
like $X < \mbox{1$^\text{st}$\ Sep}$.
We introduce these restricted inequalities so that we can model deadlines,
without introducing an additional source of complexity for reasoning.
\paragraph*{Configuration}
This component models the dynamics of an \DABP.
Formally, a configuration is a triple $\tup{\mathcal{I}} \newcommand{\J}{\mathcal{J}, \D,\tau}$, consisting of
a part $\mathcal{I}} \newcommand{\J}{\mathcal{J}$ that captures the process instances,
a database instance $\D$ over $\Sigma_{\B}$, and
a timestamp $\tau$, the current time.
The instance part, again, is a triple $\mathcal{I}} \newcommand{\J}{\mathcal{J} = \tup{ O, M_{\textit{In}}, M_P }$,
where $O =\set{o_1, ... , o_k}$ is a set of objects, called \emph{process instances},
and $M_{\textit{In}}$, $M_P$ are mappings,
associating each $o\in O$ with
a fact $M_\textit{In}(o) = \textit{In}(\tc,\tau)$, its input record, and
a place $M_P(o) \in P$, its current, respectively.
The input record is created when the instance starts and cannot be changed later on.
While the data of the input record may be different from the constants in the database,
they can be copied into the database by writing rules.
A process instance can see the entire database, but only its own input record.
For convenience, we also use the notation
$\B = \tup{ \P, \mathcal{I}} \newcommand{\J}{\mathcal{J}, \D, \tau}$,
$\B = \tup{ \P, \mathcal{I}} \newcommand{\J}{\mathcal{J}, \D }$ (when $\tau$ is not relevant), or
$\B = \tup{ \P, \D }$ (for a process that is initially without running instances).
\paragraph*{Execution of an \DABP}
Let $\B=\tup{\P,\mathcal{C}} \newcommand{\D}{\mathcal{D}}$ be an \DABP,
with current configuration $\mathcal{C}} \newcommand{\D}{\mathcal{D}=\tup{\mathcal{I}} \newcommand{\J}{\mathcal{J},\D,\tau}$.
There are two kinds of \emph{atomic execution} steps of an \DABP:
\emph{(i)~} the \emph{traversal} of a transition
by an instance
and
\emph{(ii)~} the \emph{start} of a new instance.
\smallskip
\noindent
\textbf{\emph{(i)~} Traversal} of a transition.
Consider an instance $o\in O$
with record $M_\textit{In}(o)=\textit{In}(\bar c,\tau')$,
currently at place $M_P(o)=q$.
Let $t$ be a transition from $q$ to $p$, with execution condition $E_t$.
Then
$t$ is \emph{enabled for $o$,} i.e., $o$ can \emph{traverse} $t$,
if $E_t$ evaluates to $\textit{true}$ over the database
$\D \cup \set{\textit{In}(\tc, \tau')}$.
Let $W_t \colon R(\tpl u) \leftarrow B_t(\tpl u) $
be the writing rule of $t$.
Then the effect of $o$ traversing $t$ is the transition from
$\mathcal{C}} \newcommand{\D}{\mathcal{D}=\tup{\mathcal{I}} \newcommand{\J}{\mathcal{J},\D, \tau}$ to a new configuration $\mathcal{C}} \newcommand{\D}{\mathcal{D}'=\tup{\mathcal{I}} \newcommand{\J}{\mathcal{J}',\D',\tau}$,
such that
\emph{(i)~} the set of instances $O$ and the current time $\tau$ are the same;
\emph{(ii)~} the new database instance is {$\D'= \D \cup W_t(\D \cup \set{\textit{In}(\bar c,\tau')})$}, and
\emph{(iii)~} $\mathcal{I}} \newcommand{\J}{\mathcal{J} = \langle O, M_\textit{In}, M_P \rangle$ is updated to
$\mathcal{I}} \newcommand{\J}{\mathcal{J}' = \langle O, M_\textit{In}, M'_P \rangle$ reflecting the
change of place for the instance $o$, that is
$M'_P(o)=p$ and $M'_P(o') = M_P(o')$
for all other instances $o'$.
\smallskip
\noindent
\textbf{\emph{(ii)~} Start} of a new instance.
Let $o'$ be a fresh instance and let $\textit{In}(\bar c',\tau')$ be an $\textit{In}$-fact
with $\tau'\geq\tau$,
the current time of $\mathcal{C}} \newcommand{\D}{\mathcal{D}$.
The result of starting $o'$ with info $\tpl c'$ at time~$\tau'$ is
the configuration
$\mathcal{C}} \newcommand{\D}{\mathcal{D}'=\tup{\mathcal{I}} \newcommand{\J}{\mathcal{J}',\D, \tau'}$ where $\mathcal{I}} \newcommand{\J}{\mathcal{J}'=\langle O', M'_\textit{In}, M'_P \rangle$
such that
\emph{(i)~} the database instance is the same as in $\mathcal{C}} \newcommand{\D}{\mathcal{D}$,
\emph{(ii)~} the set of instances $O'=O\cup\set{o'}$ is augmented by $o'$, and
\emph{(iii)~} the mappings $M'_\textit{In}$ and $M'_P$ are
extensions of $M_\textit{In}$ and $M_P$, resp.,
obtained by defining
$M'_\textit{In}(o')=\textit{In}(\bar c',\tau')$
and $M'_P(o')={\textit{start\/}}$.
\smallskip
An \emph{execution} $\Upsilon$ of $\B=\tup{\P,\mathcal{C}} \newcommand{\D}{\mathcal{D}}$
is a finite sequence of configurations $\mathcal{C}} \newcommand{\D}{\mathcal{D}_1,\ldots,\mathcal{C}} \newcommand{\D}{\mathcal{D}_n$
\emph{(i)~} starting with $\mathcal{C}} \newcommand{\D}{\mathcal{D}$ ($= \mathcal{C}} \newcommand{\D}{\mathcal{D}_1$), where
\emph{(ii)~} each
$\mathcal{C}} \newcommand{\D}{\mathcal{D}_{i+1}$ is obtained from $\mathcal{C}} \newcommand{\D}{\mathcal{D}_{i}$ by an atomic execution step.
We denote $\Upsilon$ also with
$\mathcal{C}} \newcommand{\D}{\mathcal{D}_1 \rightsquigarrow \dots \rightsquigarrow \mathcal{C}} \newcommand{\D}{\mathcal{D}_n$.
We say that the execution
$\Upsilon$
\emph{produces} the facts
$A_1,\ldots,A_n$
if the database of the last configuration $\mathcal{C}} \newcommand{\D}{\mathcal{D}_n$ in
$\Upsilon$ contains $A_1,\ldots,A_n$.
Since at each step a new instance can start, or
an instance can write new data,
\emph{(i)~} there are infinitely many possible executions, and
\emph{(ii)~} the database may grow in an unbounded way over time.
\section{The Query Stability Problem}
\label{sec:query-stability-problem}
In this section, we define the problem of query stability in \DABP{s}
with its variants.
\begin{definition}[Query Stability]
\label{def:query-stability}
Given $\B=\tup{\P,\mathcal{C}} \newcommand{\D}{\mathcal{D}}$ with database instance $\D$,
a query $Q$, and a timestamp $\tau$,
we say that \emph{$Q$ is stable in $\B$ until $\tau$},
if for every execution
$\mathcal{C}} \newcommand{\D}{\mathcal{D} \rightsquigarrow \cdots \rightsquigarrow \mathcal{C}} \newcommand{\D}{\mathcal{D}'$ in $\B$,
where $\mathcal{C}} \newcommand{\D}{\mathcal{D}'$ has database $\D'$ and timestamp $\tau'$
such that $\tau'<\tau$,
it holds that
\[
Q(\D)=Q(\D').
\]
If the query $Q$ is stable until time point $\infty$,
we say it is \emph{globally stable},
or simply, \emph{stable}.
\end{definition}
The interesting question from an application view is:
\emph{Given an \DABP $\B$, a query $Q$, and a timestamp $\tau$,
is $Q$ stable in $\B$ until $\tau$?}
Stability until a time-point $\tau$ can be reduced to global stability.
One can modify a given \DABP by adding a new {\textit{start\/}}\ place and
connecting it to the old {\textit{start\/}}\ place via a transition
that is enabled only for instances with timestamp smaller than $\tau$.
Then a query $Q$ is globally stable in the resulting \DABP iff
in the original \DABP it is stable until $\tau$.
To investigate sources of complexity and provide suitable encodings into
Datalog, we identify five restrictions on \DABP{s}.
\begin{definition}[Restriction on \DABP{s} and \DABP Executions]
Let $\B$ be an \DABP.
\begin{description}
\item[Positive:]
$\B$ is \emph{positive} if execution conditions and writing rules
contain only positive atoms;
\item[Fresh:]
$\B$ is \emph{fresh} if its configuration does not
contain any running instances;
\item[Acyclic:]
$\B$ is \emph{acyclic} if the process net is cycle-free;
\item[Rowo:]
$\B$ is \emph{rowo} (= read-only-write-only)
if the schema $\Sigma$ of $\B$ can be split into two disjoint schemas:
the reading schema $\Sigma_r$ and the writing schema $\Sigma_w$,
such that execution conditions and
queries in the writing rules range over $\Sigma_r$
while the heads range over $\Sigma_w$;
\item[Closed:]
an execution of $\B$ is \emph{closed}
if it contains only transition traversals and no new instances are started.
\end{description}
\end{definition}
\vspace{-1.5ex}
We will develop methods for stability checking in \DABP{s}
for all combinations of those five restrictions.
For convenience, we will say that an \DABP $\B$ is \emph{closed\/} if we consider only
closed executions of $\B$.
A \emph{singleton \DABP} is a closed \DABP
with a single instance in the initial configuration.
\paragraph*{Complexity Measures}
The input for our decision problem are
an \DABP $\B=\tup{\P,\mathcal{I}} \newcommand{\J}{\mathcal{J},\D}$, consisting of
a process model $\P$,
an instance part $\mathcal{I}} \newcommand{\J}{\mathcal{J}$,
a database $\D$ and
a timestamp $\tau$, and
a query $Q$.
The question is:
\textit{Is $Q$ globally stable in $\tup{\P,\mathcal{I}} \newcommand{\J}{\mathcal{J}, \D, \tau}$?}
We refer to process, instance, data, and query complexity if all parameters are fixed,
except the process model, the instance part, the database, or the query, respectively.
\paragraph*{Roadmap}
As a summary of our results,
Table~\ref{table:complexityDABP-overall:new2}
presents the complexity of the possible variants of query stability.
Each section of the sequel will cover one row.
\paragraph*{Datalog Notation}
We assume familiarity with Datalog
concepts such as
\emph{least fix point} and
\emph{stable model} semantics,
and \emph{query answering}
over Datalog programs under both
semantics.
We consider Datalog programs that are
\emph{recursive},
\emph{non-recursive},
\emph{positive},
\emph{semipositive},
\emph{with negation}, or
\emph{with stratified negation}~\cite{Gottlob-Eiter-LP-Journal-2001}.
We write $\Pi \cup \D$ to denote a program
where
$\Pi$ is a set of rules and
$\D$ is a set of facts.
\paragraph*{Summary of notation}
For convenience, we summarize the notation of our model used in the
following sections in Table~\ref{tb:notation-table}.
\section{Undecidable \DABP{s}}
\label{sec:undecidable}
With negation in execution conditions and writing rules,
we can create \DABP{s} that simulate Turing machines (TMs).
Consequently, in the general variant query stability is undecidable.
Due to lack of space we only provide an intuition.
To show undecidability in data complexity,
we define a database schema that allows us to store a TM
and
we construct a process model that simulates the executions of the stored TM.
\DABP{s} cannot update facts in the database.
However, we can augment relations with an additional version argument
and simulate updates by adding new versions of facts.
Exploiting negation in conditions and rules
we can then refer to the last version of a fact.
To simulate the TM execution, the process model
uses fresh constants to model
\emph{(i)}~an unbounded number of updates of the TM configurations (= number of execution steps in the TM), and
\emph{(ii)}~a potentially infinite tape.
The TM halts iff the process produces the predicate $\dummy$.
Undecidability in process complexity follows
from undecidability in data complexity,
since a process can first write the encoding of the TM into
an initially empty database.
Similarly, we obtain undecidability in instance complexity using
instances that write the encoding of the TM at the beginning.
To obtain undecidability in query complexity we
extend the encoding for data complexity such that
the database encodes a universal TM and
an input of the TM is encoded in the query.
\begin{theorem}[Undecidability]
Query stability in \DABP{s} is undecidable
in
data,
process
and query complexity.
It is also undecidable in instance complexity
except for fresh variants
for which it is constant.
Undecidability already holds for acyclic
\DABP{s}.%
\end{theorem}
In our reduction it is the unbounded number of fresh instances
that are causing writing rules to be executed an unbounded number of times,
so that neither cycles nor existing instances are contributing to undecidability.
In the sequel we study \DABP{s} that are
positive, closed, or rowo, and show that in all three variants stability is decidable.
\section{Positive Closed \DABP{s}}
\label{sec-positive:closed}
In cyclic positive \DABP{s}, executions can be arbitrarily long.
Still, in the absence of fresh instances,
it is enough to consider executions of bounded length to check stability.
Consider a positive \DABP $\B = \tup{\P,\mathcal{C}} \newcommand{\D}{\mathcal{D}}$,
possibly with cycles and disallowing fresh instances
to start,
with
$c$ different constants,
$r$ relations,
$k$ running instances,
$m$ transitions
and $a$ as the maximal arity of a relation in $\P$.
We observe:
\begin{inparaenum}[\itshape (i)]
\item
For each relation $R$ in $\P$
there are up to $c^{{}\arity(R)}$ new $R$-facts that $\B$ can produce.
Thus, $\B$ can produce up to $rc^a$ new facts in total.
\item
It is sufficient to consider executions that produce at least one new fact each $mk$ steps.
An execution that produces no new facts in $mk$ steps has at least one instance
that in those $mk$ steps visits the same place twice
without producing a new fact;
those steps can be canceled
without affecting the facts that are produced.
\item
Hence,
it is sufficient to consider
executions of maximal length
$m k r c^a.$
\end{inparaenum}
Among these finitely many executions, it is enough to consider
those
that produce a maximal set of new facts.
Since a process instance may have the choice among several transitions,
there may be several such maximal sets.
We identify a class of executions
in positive closed \DABP{s},
called \emph{greedy executions},
that produce all maximal sets.
\paragraph*{Greedy Executions}
Intuitively, in a greedy execution instances
traverse all cycles in the net in all possible ways
and produce all that can be produced before leaving the cycle.
To formalize this idea we identify two kinds of execution steps:
\emph{safe steps} and
\emph{critical steps}.
A safe step is an execution step of an instance after which,
given the current state of the database,
the instance can return to its original place.
A critical step is an execution step that is not safe.
Based on this, we define \emph{greedy sequences} and \emph{greedy executions}.
A greedy sequence is a sequence of safe steps
that produces the largest number of new facts possible.
A greedy execution is an execution where
greedy sequences and critical steps alternate.
Let $\Upsilon$ be a greedy execution with $i$
alternations of greedy sequences and critical steps.
In the following,
we characterize which are the transitions that instances
traverse in the $i+1$-th greedy sequence and then in the $i+1$-th
critical step.
For a process instance $o$ and the database $D_{\Upsilon}$ produced after
$\Upsilon$ we define the \emph{enabled graph} $N_{\Upsilon,o}$ as the multigraph
whose vertices are the places of $N$ (i.e., the process net of $\B$)
and edges those transitions of $N$ that are enabled for $o$ given database $D_{\Upsilon}$.
Let $\mathit{SCC}(N_{\Upsilon,o})$ denote the set of
strongly connected components (SCCs) of
$N_{\Upsilon,o}$.
Note that two different instances may have different enabled graphs and thus different SCCs.
For a place $p$,
let $N^p_{\Upsilon,o}$ be the SCC in $\mathit{SCC}(N_{\Upsilon,o})$
that contains $p$.
Suppose that $o$ is at place $p$ after $\Upsilon$.
Then in the next greedy sequence,
each instance $o$ traverses the component $N^p_{\Upsilon,o}$ in all possible ways until no new facts can be produced,
meaning that all instances traverse in an arbitrary order.
Conversely, the next critical step is
an execution step where an instance $o$ traverses a transition
that is not part of $N^p_{\Upsilon,o}$, and thus it
leaves the current SCC.
We observe that when performing safe transitions new facts may be written and new transitions may become executable. This can make SCCs of $N_{\Upsilon,o}$ to grow and merge, enabling new safe steps.
With slight abuse of notation we denote such maximally expanded SCCs with $N_{\Upsilon,o}$, and
with $N^p_{\Upsilon,o}$ the maximal component that contains $p$.
\paragraph*{Properties of Greedy Executions}
We identify three main properties of greedy executions.
\begin{itemize
\item
A greedy execution is characterized by its critical steps,
because an instance may have to choose one among several possible critical steps.
In contrast,
how safe steps compose a greedy sequence
is not important for stability
because all greedy sequences
produce the same (maximal) set of facts.
\item
A greedy execution in an \DABP
with $m$ transitions and $k$ instances
can have at most $mk$ critical steps.
The reason is that an execution step can be critical only
the first time it is executed, and
any time after that it will be a safe step.
\item
Each execution can be transformed into a greedy execution
such that
if a query is instable in the original version
then it is instable also in the greedy version.
In fact,
an arbitrary execution
has at most $mk$ critical steps.
One can construct a greedy version starting from those critical steps,
such that the other steps are part of the greedy sequences.
\end{itemize}
\begin{lemma}\label{lemma:reduction:greedy:execution:extended}
For each closed execution $\Upsilon$ in a positive \DABP $\B$
that produces the set of ground atoms $W$,
there exists a greedy execution $\Upsilon'$ in $\B$
that also produces $W$.
\end{lemma}
Therefore,
to check stability it is enough to check stability over greedy executions.
In the following we define Datalog rules that compute facts produced by greedy executions.
\paragraph*{Encoding into Datalog}
Let $\B=\tup{\P,\mathcal{I}} \newcommand{\J}{\mathcal{J},\D}$ be a positive \DABP
with $m$ transitions and $k$ instances.
Since critical steps uniquely characterize a greedy execution,
we use a tuple of size up to $mk$ to encode them.
For example, if in a greedy execution $\Upsilon$ at the first critical step
instance $o_{l_1}$ traverses transition $t_{h_1}$, in the second $o_{l_2}$ traverses $t_{h_2}$, and so on up to step $i$, we encode this with the
tuple
\[\bar \omega = \tup{o_{l_1},t_{h_1},\dots,o_{l_i},t_{h_i}}.\]
Next, we define the relations used in the encoding.
\begin{inparaenum}[\itshape (i)]
\item
For each relation $R$ in $\P$
we introduce relations $R^i$
(for $i$ up to $mk$) to store all
$R$-facts produced by an execution
with $i$ critical steps.
Let $\Upsilon$ be the execution from above
and let $\tup{o_{l_1},t_{h_1},\dots,o_{l_i},t_{h_i}}$ be the tuple representing it.
Then, a fact of relation $R^i$ has the form
$
R^i(o_{l_1},t_{h_1},\dots,o_{l_i},t_{h_i};\ts),
$
and it holds iff
$\Upsilon$ produces the fact $R(\ts)$.
Later on we use $\bar \omega$ to represent the tuple $\langle o_{l_1},t_{h_1},\dots \rangle$.
Facts of $R^i$ are then represented as $R^i(\bar \omega;\ts)$.
For convenience, we use a semicolon ($;$) instead of a comma ($,$) to separate
encodings of different types in the arguments.
\item
To record the positions of instances after each critical step
we introduce relations $\textit{State}^i$
such that $\textit{State}^i(\bar \omega;p_1,\dots,p_k)$ encodes that
after $\Upsilon$ is executed,
instance $o_1$ is at $p_1$,
$o_2$ is at $p_2$,
and so on.
\item
To store the SCCs of the enabled graph we introduce relations $\mathit{SCC}^i$
such that for a process instance $o$ and a place $p$,
the transition $t$ belongs to $N^{p}_{\Upsilon,o}$
iff $\mathit{SCC}^i(\bar \omega;o,p,t)$ is true.
\item
To compute the relations $SCC^i$, we first need to compute which places are reachable by an instance $o$ from place $p$.
For that we introduce auxiliary relations
$
\textit{Reach}^i
$
such that in the enabled graph $N_{\Upsilon,o}$ instance $o$ can reach place $p'$ from $p$ iff $\textit{Reach}^i(\bar \omega;o,p,p')$ is true.
\item
Additionally, we introduce the auxiliary relation
$\textit{In}^0$ that associates instances with their $\textit{In}$-records,
that is $\textit{In}^0(o;\ts)$ is true iff the instance $o$ has input record $\textit{In}(\ts)$.
With slight abuse of notation, we use $\bar \omega$ to denote also the corresponding greedy closed execution $\Upsilon$.%
\end{inparaenum}
In the following we define a Datalog program that computes the predicates introduced above for all possible greedy executions.
The program uses stratified negation.
\paragraph*{Initialization}
For each relation $R$ in $\P$ we introduce the
\emph{initialization rule} $R^0(\xoverline{X}) \leftarrow R(\xoverline{X})$ to store what holds before any critical step is made.
Then we add the fact rule $\textit{State}^0(p_1,\dots,p_k)\leftarrow \textit{true}$
if in the initial configuration
$o_1$ is at place $p_1$, $o_2$ at $p_2$, and so on.
\paragraph*{Greedy Sequence: Traversal Rules}
Next, we introduce rules that compute enabled graphs.
The relation $\textit{Reach}^i$ contains the transitive closure of
the enabled graph $N_{\bar \omega,o}$
for each $o$ and~$\bar \omega$, encoding a greedy execution of length $i$.
First, a transition $t$ from $q$ to be $p$ gives rise to an edge
in the enabled graph $N_{\bar \omega,o}$ if instance $o$ can traverse that
$t$:
\[
\textit{Reach}^i(\xoverline{W};O,q,p) \leftarrow E^i_t(\xoverline{W};O).
\]
Here,
$E^i_t(\xoverline{W};O)$ is a shorthand for the condition obtained from $E_t$ by replacing
$\textit{In}(\ts)$ with $\textit{In}^0(O;\ts)$ and by replacing each atom
$R(\tpl v)$ with $R^i(\xoverline{W};\tpl v)$.
The tuple $\xoverline{W}$ consists of $2i$ many distinct variables
to match every critical execution with $i$ steps. It ensures that only
facts produced by $\xoverline{W}$ are considered.
The transitive closure is computed with the following rule:
\begin{align*}
\textit{Reach}^i(\xoverline{W};O,P_1,P_3) \leftarrow
\textit{Reach}^i(\xoverline{W};O,P_1,P_2), \textit{Reach}^i(\xoverline{W};O,P_2,P_3).
\end{align*}
Based on $\textit{Reach}^i$, $\mathit{SCC}^i$ is computed by including every transition $t$
from $q$ to $p$ that an instance can reach, traverse, and from where it can return to the current place:
\begin{align*}
\mathit{SCC}^i(\xoverline{W};O,P,t) \leftarrow \ \textit{Reach}^i(\xoverline{W};O,P,q), E^i_t(\xoverline{W};O), \textit{Reach}^i(\xoverline{W};O,p,P).
\end{align*}
\paragraph*{Critical Steps: Traversal Rules}
We now want to record how an instance makes a critical step.
An instance $o_j$ can traverse transition $t$ from $q$ to $p$
at the critical step $i+1$
if
\emph{(i)~} $o_j$ is at some place in $N^{q}_{\bar \omega,o_j}$ at step $i$,
\emph{(ii)~} it satisfies the execution condition $E_t$,
\emph{(iii)~} and by traversing $t$ it leaves the current SCC.
The following \emph{traversal rule} captures this:
\begin{align}
& \textit{State}^{i+1}(\xoverline{W}, o_j, t; P_1,\dots,P_{j-1},p,P_{j+1},\dots,P_k) \leftarrow \nonumber \\
& \quad\textit{State}^i(\xoverline{W};P_1,\dots,P_{j-1},P,P_{j+1},\dots,P_k),
\textit{Reach}^i(\xoverline{W};o_j,P,q), \textit{Reach}^i(\xoverline{W};o_j,q,P), \label{eq:criticalstepone} \\
& \quad E^i_t(\xoverline{W};o_j), \neg \mathit{SCC}^i(\xoverline{W};o_j,P,t). \label{eq:criticalsteptwo}
\end{align}
Here, the condition \emph{(i)~} is encoded in
line \eqref{eq:criticalstepone},
and \emph{(ii)~} and \emph{(iii)~} are encoded in line \eqref{eq:criticalsteptwo}.
\paragraph*{Generation Rules}
A fact in $R^{i+1}$ may hold because
\emph{(i)~} it has been produced by the current greedy sequence or by the last critical step, or
\emph{(ii)~} by some of the previous sequences or steps.
Facts produced by previous sequences or steps
are propagated with the \emph{copy rule}:
$R^{i+1}(\xoverline{W},O,T;\xoverline{X}) \leftarrow \textit{State}^{i+1}(\xoverline{W},O,T;\blank),R^{i}(\xoverline{W};\xoverline{X})$,
copying facts $R(\xoverline{X})$ holding after $\xoverline{W}$ to all extensions of $\xoverline{W}$.
Then we compute the facts produced by the next greedy sequence.
For each instance $o_j$,
being at some place $p_j$ after the last critical step in $\bar \omega$,
and for each transition $t$ that is in $N^{p_j}_{\bar \omega,o_j}$,
with writing rule
$R(\tuple{u}) \leftarrow B_t(\tuple{u})$,
we introduce the following \emph{greedy generation rule}:%
\begin{align*}
R^{i}(\xoverline{W};\tuple{u}) \leftarrow \
\textit{State}^{i}(\xoverline{W};\blank,\dots,\blank,P_j,\blank,\dots,\blank),
\mathit{SCC}^i(\xoverline{W}; o_j,P_j,t), B^i_t(\xoverline{W};o_j;\tuple{u}),
\end{align*}
where condition $B^i_t(\xoverline{W};O;\tuple{u})$ is obtained
similarly as
$E^i_t(\xoverline{W};O)$.
In other words, all transitions $t$ that are in $N^{p_j}_{\bar \omega,o_j}$
are fired simultaneously, and this is done for all instances.
The facts produced at the next critical step
by traversing $t$,
which has the writing rule $R(\tuple{u}) \leftarrow B_t(\tuple{u})$,
are generated with the \emph{critical generation rule}:
$ R^{i+1}(\xoverline{W},O,t;\tuple{u}) \leftarrow \textit{State}^{i+1}(\xoverline{W},O,t;\blank),B^i_t(\xoverline{W};O;\tuple{u}).$
Let $\PiPIpocl$ be the program encoding the positive closed
$\B=\tup{\P,\mathcal{I}} \newcommand{\J}{\mathcal{J},\D}$ as described above.
\begin{lemma} \label{lem:encoding:positive:closed:cyclic:extended}
Let $\bar \omega$ be a greedy execution in the positive closed
$\B=\tup{\P,\mathcal{I}} \newcommand{\J}{\mathcal{J},\D}$ of length $i$ and
$R(\ts)$ be a fact.
Then
$R(\ts)$ is produced by $\bar \omega$
\ iff \
$\PiPIpocl \cup \D \models R^i(\bar \omega;\ts)$.
\end{lemma}
\paragraph*{Test Program}
Now we want to test the stability of
$Q(\xoverline{X}) \leftarrow R_1(\tuple{u}_1),\dots,R_n(\tuple{u}_n)$.
We collect all potential $Q$-answers using the relation $Q'$.
A new query answer may be produced by an execution of any size $i$
up to $mk$.
Thus, for each execution of a size $i$ from $0$ to $mk$ we introduce the $Q'$-rule
\begin{equation}
\label{eqn-Q:prime:test:rule}
Q'(\xoverline{X}) \leftarrow R_1^i(\xoverline{W};\tuple{u}_1),\dots,R_n^i(\xoverline{W};\tuple{u}_n).
\end{equation}
Then, if there is a new query answer, the \emph{test rule}
``$
\instable \leftarrow Q'(\xoverline{X}), \neg Q(\xoverline{X})
$''
fires the fact $\instable$.
Let $\PiPIQtest$ be the test program that contains
$Q$, the $Q'$-rules,
and the test rule.
\begin{theorem} \label{col:encoding:closed:acyclic:checking}
$Q$ is instable in the positive closed $\B$
\ iff\
$\PiPIpocl \cup \D \cup \PiPIQtest \models \instable$.
\end{theorem}
\paragraph*{Data and Process Complexity}%
Since $\PiPIpocl \cup \D \cup \PiPIQtest $ is a Datalog program with stratified negation,
for which reasoning is as complex as for positive Datalog,
we obtain as upper bounds $\textsc{ExpTime}\xspace$ for process and combined complexity, and $\textsc{PTime}\xspace$ for data
complexity~\cite{Gottlob-Eiter-LP-Journal-2001}.
We show that these are also lower bounds, even for singleton \DABP{s}.
This reduction can also be adapted for acyclic fresh \DABP{s},
which we study in Section~\ref{sec:DABP-Datalog-power-short}.
\begin{lemma
\label{lem:positive:cyclic:complexity}
Stability is $\textsc{ExpTime}\xspace$-hard in process and
$\textsc{PTime}\xspace$-hard in data complexity for
\begin{enumerate}[label=\alph*)]
\item positive singleton \DABP{s} under closed executions, and
\item positive acyclic fresh \DABP{s}.
\end{enumerate}
\end{lemma}
\begin{proof}[Proof Sketch]
\emph{a)}
We encode query answering over a Datalog program $\Pi \cup \D$ into stability checking.
Let $A$ be a fact.
We construct a positive singleton \DABP $\tup{\P_{\Pi,A}^{\textit{po,cl}},\mathcal{I}} \newcommand{\J}{\mathcal{J}_0,\D}$,
where there is a transition for each rule and
the single process cycles to produce the least fixed point (LFP) of the program.
In addition, the \DABP inserts the fact $\dummy$ if $A$ is in the LFP.
Then test query $Q_{\textit{test}} \leftarrow \dummy$ is stable in $\tup{\P_{\Pi,A}^{\textit{po,cl}},\mathcal{I}} \newcommand{\J}{\mathcal{J}_0,\D}$
iff $\Pi \cup \D \not\models A$.
\emph{b)} Analogous, letting fresh instances play the role of the cycling singleton instance.
\end{proof}
\paragraph*{Instance Complexity}
Instance complexity turns out to be higher than data complexity.
Already for acyclic positive closed \DABP{s} it is $\textsc{co-NP}\xspace$-hard because
\begin{inparaenum}[\itshape (i)]
\item process instances may non-deterministically choose a transition,
which creates exponentially many combinations, even in the acyclic variant; and
\item instances may interact by reading data written by other instances.
\end{inparaenum}
\begin{lemma}\label{lem:instance:complexity:closed:acyclic}
There exist a positive acyclic process model $\P_0$, a database $\D_0$,
and a test query $Q_{\textit{test}}$ with the following property:
for every graph $G$ one can construct an instance part $\mathcal{I}} \newcommand{\J}{\mathcal{J}_G$ such that
$G$ is not 3-colorable
iff
$Q_{\textit{test}}$ is stable in $ \tup{\P_0,\mathcal{I}} \newcommand{\J}{\mathcal{J}_G,\D_0}$ under closed executions.
\end{lemma}
Clearly, Lemma~\ref{lem:instance:complexity:closed:acyclic} implies that
checking stability for closed \DABP{s} is $\textsc{co-NP}\xspace$-hard in instance complexity.
According to Theorem~\ref{theorem:sms} (Section~\ref{subsubsec:normal:cyclic:arbitrary}),
instance complexity is $\textsc{co-NP}\xspace$ for all closed \DABP{s},
which implies $\textsc{co-NP}\xspace$-completeness even for the acyclic variant.
\paragraph*{Query Complexity}
To analyze query complexity we first show how difficult it is to check
whether a query returns the same answer over a database and an extension
of that database.
\begin{lemma}[Answer Difference]
\label{lem-cq:piptwo}
For every two fixed databases $\D \subseteq \D'$,
checking whether a given conjunctive query $Q$ satisfies $Q(\D)=Q(\D')$ is in $\Pi^\textsc{P}_2\xspace$ in the query size.
Conversely, there exist databases $\D_0 \subseteq \D'_0$
such that checking for a conjunctive query $Q$ whether $Q(\D_0)=Q(\D'_0)$
is $\Pi^\textsc{P}_2\xspace$-hard in the query size.
\end{lemma}
\begin{proof}[Proof Idea]
The first claim holds since one can check
$Q(\D) \subsetneqq Q(\D')$
in $\textsc{NP}\xspace$ using an $\textsc{NP}\xspace$~oracle.
We show the second by reducing the \emph{3-coloring extension}
problem for graphs~\cite{Fagin-3ColorExtension}.
\end{proof}
Building upon Lemma~\ref{lem-cq:piptwo},
we can define an \DABP that starting from $\D_0$ produces $\D'_0$.
In fact, for such an \DABP it is enough to consider the simplest variants of rowo.
\begin{proposition
\label{prop-hardness:query:complexity}
Checking stability is $\Pi^\textsc{P}_2\xspace$-hard for
\begin{enumerate}[label=\alph*)]
\item positive fresh acyclic rowo \DABP{s}, and
\item positive closed acyclic rowo singleton \DABP{s}.
\end{enumerate}
\end{proposition}
Given $\B = \tup{\P,\mathcal{I}} \newcommand{\J}{\mathcal{J},\D}$, there are finitely many maximal extensions $\D'$ of $\D$
that can be produced by $\B$.
We can check stability of a query $Q$ by finitely many checks whether $Q(\D) = Q(\D')$.
Since each such check is in $\Pi^\textsc{P}_2\xspace$, according to Lemma~\ref{lem-cq:piptwo},
the entire check is in $\Pi^\textsc{P}_2\xspace$.
Thus, stability is $\Pi^\textsc{P}_2\xspace$-complete in query complexity.
\section{Closed \DABP{s}}
\label{subsubsec:normal:cyclic:arbitrary}
In the presence of negation, inserting new facts may disable transitions.
During an execution, a transition may switch many times between being enabled and disabled,
and greedy executions could have exponentially many critical steps.
An encoding along the ideas of the preceding section would lead to a program of exponential size.
This would give us an upper bound of double exponential time for combined complexity.
Instead, we establish a correspondence between stability and brave query answering for Datalog with (unstratified) negation under
\emph{stable model semantics} (SMS)
\cite{Gottlob-Eiter-LP-Journal-2001}.
Due to lack of space we only state the results.
\begin{theorem} \label{theorem:sms}
For every closed \DABP $\B=\tup{\P,\mathcal{I}} \newcommand{\J}{\mathcal{J},\D}$
and every query $Q$
one can construct
a Datalog program with negation $\Picl$, based on $\P$,
a database $\D_\mathcal{I}} \newcommand{\J}{\mathcal{J}$, based on $\D$ and $\mathcal{I}} \newcommand{\J}{\mathcal{J}$,
and a test program $\Pi_Q^\textsl{test}$, based on $Q$,
such that the following holds: \\[.7ex]
\centerline{%
$Q$ is instable in $\B=\tup{\P,\mathcal{I}} \newcommand{\J}{\mathcal{J},\D}$
\quad iff\quad
$\Picl \cup \D_\mathcal{I}} \newcommand{\J}{\mathcal{J} \cup \Pi_Q^\textsl{test} \models_{\textit{brave}} \instable$.}
\end{theorem}
\begin{proof}[Proof Idea]
For the same reason as in the positive variant,
it is sufficient to consider executions of maximal length
$mkrc^a$.
Program $\Picl$ contains two parts:
\emph{(i)~} a program
that generates a linear order of size $mkrc^a$
(with parameters $m, k, r, c, a$ defined as in Section~\ref{sec-positive:closed}),
starting from an exponentially smaller order,
that is used to enumerate execution steps, and
\emph{(ii)~} a program that \quotes{guesses} an execution of size up to $mkrc^a$
by selecting for each execution step one instance and one transition,
and that produces the facts that would be produced by the guessed execution.
Then each execution corresponds to one stable model.
The test program $ \Pi_Q^\textsl{test}$ checks if any of the guessed executions yields a new query answer.
\end{proof}
In Theorem~\ref{theorem:sms}, the process is encoded in the program rules
while data and instances are encoded as facts.
Since brave reasoning under SMS is $\textsc{NExpTime}\xspace$ in program size and $\textsc{NP}\xspace$ in data size~\cite{Gottlob-Eiter-LP-Journal-2001},
we have that process and combined complexity are in $\textsc{co-NExpTime}\xspace$,
and data and instance complexity are in $\textsc{co-NP}\xspace$.
From this and Lemma~\ref{lem:instance:complexity:closed:acyclic}
it follows that instance complexity is $\textsc{co-NP}\xspace$-complete.
To show that stability is
$\textsc{co-NExpTime}\xspace$-complete in process and $\textsc{co-NP}\xspace$-complete in data
complexity we encode brave reasoning into stability.
Query complexity is $\Pi^\textsc{P}_2\xspace$-complete for the same reasons as in the positive variant.
\begin{theorem}
\label{proposition:cy-cl-process-hd:extended}
For every Datalog program $\Pi \cup \D$, possibly with negation, and fact~$A$,
one can construct a singleton \DABP $\tup{\P_{\Pi,A},\mathcal{I}} \newcommand{\J}{\mathcal{J}_0,\D}$
such that for the query $Q_{\textit{test}}\leftarrow\dummy$ we have:
$\Pi \cup D \models_{\textit{brave}} A$ \ iff \ $Q_{\textit{test}}$ is stable in $\tup{\P_{\Pi,A},\mathcal{I}} \newcommand{\J}{\mathcal{J}_0,\D}$
under closed executions.
\end{theorem}
\endinput
\section{Acyclic Closed \DABP{s}} \label{sec:acyclic:arbitrary}
If a process net is cycle-free, all closed executions have finite length.
More specifically, in an acyclic \DABP with $m$ transitions and $k$ running instances,
the maximal length of an execution is $mk$.
Based on this observation, we modify the encoding for the positive closed variant in Section~\ref{sec-positive:closed}
so that it can cope with negation and exploit the absence of cycles.
For an acyclic \DABP, there cannot exist any greedy steps, which would stay in a strongly connected component of the net.
Therefore, we drop the encodings of greedy traversals and the greedy generation rules.
We keep the rules for critical steps, but drop the atoms of relations $\textit{Reach}^i$ and $\mathit{SCC}^i$.
Now, in contrast to the positive closed variant, we may have negation in
the conditions $E_t$ and $B_t$.
However, the modified Datalog program is non-recursive, since each relation $R^i$ and $\textit{State}^i$
is defined in terms of $R^j$'s and $\textit{State}^j$'s where $j<i$.
Let $\PiPIQacyccl$ be the program encoding an acyclic $\B=\tup{\P,\mathcal{I}} \newcommand{\J}{\mathcal{J},\D}$ as described above
and let $\PiPIQtest$ be the test program as in the cyclic variant.
\begin{theorem} \label{theorem:encoding:closed:acyclic:checking}
$Q$ is instable in the closed acyclic $\B$
\ iff \quad
$\PiPIQacyccl \cup \D \cup \PiPIQtest \models \instable$.
\end{theorem}
\paragraph*{Complexity}
As upper bounds for combined and data complexity,
the encoding gives us the analogous bounds for non-recursive $\DATALOGNEG$ programs,
that is, $\textsc{PSpace}\xspace$ in combined and $\textsc{AC}\ensuremath{^0}\xspace$ in data complexity
\cite{Gottlob-Eiter-LP-Journal-2001}.
Already in the positive variant,
we inherit $\textsc{PSpace}\xspace$-hardness of process complexity (and therefore also of combined complexity)
from the program complexity of non-recursive \DATALOG.
We obtain matching lower bounds by a reverse encoding.
\begin{lemma} \label{lem:acyclic:complexity}
For every non-recursive Datalog program $\Pi$ and every fact $A$,
one can construct a singleton acyclic positive \DABP $\tup{\P_{\Pi,A},\mathcal{C}} \newcommand{\D}{\mathcal{D}_0}$ such that
for the query $Q_{\textit{test}}\leftarrow\dummy$ we have:
$\Pi \not \models A$ iff $Q_{\textit{test}}$ is stable in $\tup{\P_{\Pi,A}, \mathcal{C}} \newcommand{\D}{\mathcal{D}_0}$ under closed executions.
\end{lemma}
We observe that for closed executions, the cycles increase the complexity,
and moreover, cause a split between variants with and without negation.
Lemma~\ref{lem:instance:complexity:closed:acyclic} and
Theorem~\ref{theorem:sms} together imply
that instance complexity is $\textsc{co-NP}\xspace$-complete.
Query complexity is $\Pi^\textsc{P}_2\xspace$-complete for the same reasons as in other closed variants.
\section{Positive Fresh \DABP{s}}
\label{sec:DABP-Datalog-power-short}
All decidable variants of \DABP{s} that we investigated until now
were so because we allowed only closed executions.
In this and the next section we show that decidability
can also be guaranteed if conditions and rules are positive,
or if relations are divided into read and write relations (rowo).
We look first at the case where initially there are no running instances.
When fresh instances start, their input can bring an arbitrary
number of new constants into the database.
Thus, processes can produce arbitrarily many new facts.
First we show how
infinitely many executions of a positive or rowo \DABP
can be faithfully abstracted to finitely many over
a simplified process such that
a query is stable over the original process iff
it is stable over the simplified one.
For such simplified positive \DABP{s}, we show how to encode stability checking into query answering in Datalog.
\paragraph*{Abstraction Principle}
Let $\B=\tup{\P,\mathcal{I}} \newcommand{\J}{\mathcal{J},\D,\tau_\B}$ be a positive or rowo \DABP
and let $Q$ be a query that we want to check for stability.
Based on $\B$ and $Q$
we construct an \DABP $\B'=\tup{\P',\mathcal{I}} \newcommand{\J}{\mathcal{J},\D,\tau_\B}$
that has the same impact on the stability of $Q$
but uses at most linearly many fresh values from the domain.
Let $\adom$ be the active domain of $\B$ and $Q$,
that is the set of all constants appearing in $\B$ and $Q$.
Let $\tau_1,\dots,\tau_n$ be all timestamps including $\tau_\B$
that appear in comparisons in $\B$ such that $\tau_i<\tau_{i+1}$.
We introduce $n+1$
many fresh timestamps $\tau'_0,\ldots,\tau'_n \not \in \adom$ such that
$
\tau_0'<\tau_1<\tau_1'< \dots < \tau_n < \tau_n'.
$
If there are no comparisons in $\B$ we introduce one fresh timestamp $\tau'_0$.
Further, let $a$ be a fresh value such that $a \not \in \adom$.
Let $\adomExt = \adom \cup \set{\tau'_0,\ldots,\tau'_n} \cup \set{a}$
be the \emph{extended active domain}.
Then,
we introduce the \emph{discretization} function
$\delta_{\B} \colon \mathit{dom}_{\RationalsPos} \to \mathit{dom}_{\RationalsPos}$
that based on $\adomExt$
\quotes{discretizes}
$\mathit{dom}_{\RationalsPos}$
as follows:
for each $\tau \in {\mathbb Q}^+$
\emph{(i)~}
$\delta_{\B}(\tau)= \tau$ if $\tau =\tau_i$ for some $i$;
\emph{(ii)~}
$\delta_{\B}(\tau)= \tau_i'$ if $\tau_i<\tau< \tau_{i+1}$ for some $i$;
\emph{(iii)~}
$\delta_{\B}(\tau)= \tau_0'$ if $\tau<\tau_1$;
\emph{(iv)~} and
$\delta_{\B}(\tau)= \tau_n'$ if $\tau_n<\tau$;
\emph{(v)~}
and for $c\in \mathit{dom}$ if $c \in \adomExt$ then $\delta_{\B}(c)=c$;
otherwise $\delta_{\B}(c)=a$.
If $\B$ has no comparisons then $\delta_{\B}(\tau)= \tau_0'$
for each $\tau$.
We extend $\delta_{\B}$ to all syntactic objects containing constants,
including executions.
Now, we define $\P'$ to be as $\P$, except that
we add conditions on each outing transition from ${\textit{start\/}}$
such that only instances with values from $\adomExt$
can traverse, and instances with the timestamps greater or equal than $\tau_\B$.
\begin{proposition}[Abstraction]
\label{prop-abstractions:of:timestamps
Let
$\Upsilon= \mathcal{C}} \newcommand{\D}{\mathcal{D} \rightsquigarrow
\mathcal{C}} \newcommand{\D}{\mathcal{D}_1 \rightsquigarrow \dots \rightsquigarrow\mathcal{C}} \newcommand{\D}{\mathcal{D}_m$
be an execution in $\B$ that produces a set of facts $W$, and let
$\Upsilon'=\delta_{\B}\Upsilon =\delta_{\B} \mathcal{C}} \newcommand{\D}{\mathcal{D} \rightsquigarrow
\delta_{\B} \mathcal{C}} \newcommand{\D}{\mathcal{D}_1 \rightsquigarrow \dots \rightsquigarrow \delta_{\B}\mathcal{C}} \newcommand{\D}{\mathcal{D}_m$.
Further,
let $\Upsilon''$ be an execution in $\B'$.
Then the following holds:
\begin{enumerate}[label=\alph*)]
\item
$\Upsilon'$ is an execution in $\B'$ that produces $\delta_{\B} W$;
\item
$Q(\D)\neq Q( \D \cup W)$ iff $Q(\D)\neq Q( \D \cup \delta_{\B} W)$;
\item
$\Upsilon''$ is an execution in $\B$.
\end{enumerate}
\end{proposition}
In other words,
each execution in $\B$ can be $\delta_{\B}$-abstracted and it will be an execution in~$\B'$,
and more importantly,
an execution in $\B$ produces a new query answer if and only if
the $\delta_{\B}$-abstracted version produces a new query answer in $\B'$.
\paragraph*{Encoding into Datalog}
Since $\B'$ allows only finitely many new values in fresh instances,
there is a bound on the maximal extensions of $\D$ that can be produced.
Moreover, since there is no bound on the number of fresh instances that can start,
there is only a single maximal extension of $\D$, say $\D'$, that can result from $\B'$.
We now define the program $\PiPQposfr \cup \D$ whose least fixpoint is exactly this $\D'$.
First, we introduce the relations that we use in the encoding.
To record which fresh instances can reach a place $p$ in $\P$,
we introduce for each $p$ a relation $\textit{In}_p$ with the same arity as $\textit{In}$.
That is, $\textit{In}_p(\ts)$ evaluates to true in the program iff
an instance with the input record $\textit{In}(\ts)$ can reach $p$.
As in the closed variant, we use a primed version $R'$ for each relation $R$
to store $R$-facts produced by the process.
Now we define the rules.
Initially, all relevant fresh instances
(those with constants from $\adomExt$) sit at the ${\textit{start\/}}$ place.
We encode this by the \emph{introduction rule}:
$
\textit{In}_{\textit{start\/}}(X_1,\dots,X_n) \leftarrow \adomExt(X_1),\dots,\adomExt(X_n).
$
Here, with slight abuse of notation, $\adomExt$ represents a unary relation that we initially instantiate with the constants from $\adomExt$.
Also initially, we make a primed copy of each database fact,
that is, for each relation $R$ in $\P$ we define the \emph{copy rule}:
$R'(\xoverline{X}) \leftarrow R(\xoverline{X})$.
Then we encode instance traversals.
For every transition~$t$ that goes from a place~$q$ to a place $p$,
we introduce a \emph{traversal rule} that mimics how instances having reached $q$
move on to $p$,
provided their input record satisfies the execution condition for $t$.
Let
$E_t = \textit{In}(\ts), R_1(\ts_1), \dots, R_l(\ts_l), G_t$
be the execution condition for $t$,
where $G_t$ comprises the comparisons.
We define the condition
$E_t'(\ts)$ as $\textit{In}_q(\ts), R'_1(\ts_1), \dots, R'_l(\ts_l), G_t$,
obtained from $E_t$ by renaming the $\textit{In}$-atom and priming all database relations.
Then, the \emph{traversal rule} for $t$ is:
$
\textit{In}_p(\ts) \leftarrow E'_t(\ts).
$
Here, $E'_t(\ts)$ is defined over the primed signature
since a disabled transition may become enabled as new facts are produced.
Which facts are produced by traversing $t$ is captured by
a \emph{generation rule}.
Let $W_t \colon$ $R(\tuple{u}) \leftarrow B_t(\tuple{u})$
be the writing rule for~$t$, with the query
$B_t(\tuple{u}) \leftarrow \textit{In}(\ts'), R_1(\ts'_1), \dots, R_n(\ts'_n), M_t$,
where $M_t$ comprises the comparisons.
Define
$B'_t(\ts',\tuple{u}) \leftarrow \textit{In}_q(\ts'), R'_1(\ts'_1), \dots, R'_n(\ts'_n), M_t$.
The corresponding generation rule is
$
R'(\tuple{u}) \leftarrow E_t'(\ts) ,B_t'(\ts',\tuple{u}), \ts=\ts',
$
which combines the constraints on the instance record from $E_t$ and $W_t$.
Let $\PiPQposfr$ be the program defined above, encoding the positive fresh $\B'$ obtained from $\B$.
The program is constructed in such a way that it computes exactly the atoms
that are in the maximal extension $\D'$ of $\D$ produced by $\B'$.
Let $R'(\tpl v)$ be a fact.
\begin{lemma}
\label{lemma:encoding:positive}
There is an execution in the positive fresh $\B$ producing $R(\tpl v)$ \ iff\\
$\PiPQposfr \cup \D \models R'(\tpl v)$.
\end{lemma}
Let $\Pi_Q^\textsl{test}$ be
defined like $\PiPIQtest$ in Section~\ref{sec-positive:closed},
except that there is only one rule for $Q'$,
obtained from \eqref{eqn-Q:prime:test:rule}
by replacing $R^i_j$ with $R'_j$.
Then Proposition~\ref{prop-abstractions:of:timestamps}
and Lemma~\ref{lemma:encoding:positive} imply:
\begin{theorem}
\label{th-instability}
$Q$ is instable the positive fresh $\B$
\ iff \
$\PiPQposfr \cup \D \cup \Pi_Q^\textsl{test} \models \instable$.
\end{theorem}
\paragraph*{Complexity}
Since $\PiPQposfr \cup \D \cup \Pi_Q^\textsl{test}$ is a program with stratified negation,
stability checking over positive fresh \DABP{s} is in $\textsc{ExpTime}\xspace$ for process and combined complexity,
and in $\textsc{PTime}\xspace$ for data complexity \cite{Gottlob-Eiter-LP-Journal-2001}.
From Lemma~\ref{lem:positive:cyclic:complexity} we know
that these are also lower bounds for the respective complexity measures.
Query complexity is $\Pi^\textsc{P}_2\xspace$-complete as usual, and instance complexity is trivial
for fresh processes.
\paragraph*{Positive \DABP{s}}
To reason about arbitrary positive \DABP{s}, we can combine the encoding
for the fresh variant ($\PiPQposfr$) from this section and the one for
the closed variant from Section~\ref{sec-positive:closed} ($\PiPIpocl$).
The main idea is that to obtain maximal extensions,
each greedy execution sequence is augmented by also flooding the process with fresh instances.
The complexities for the full positive variant are inherited from the closed variant.
\endinput
COMMENTS
- Turing process into positive is another way to get a decidable case
Structure:
- Assume comparisons of the form: var < const
- Abstraction principle is on that
[
in model
- Assume dom that is dense order wrt build comparisions
- Assume a domain that has a dense order such as rationals.
- And then we say that the last value of the input relation In is reserved for the timestamp
- We aslo say that the process timestamp <P,I,D,t> also exists
]
- So now we want to abstract away fresh values and timestamps.
- Let d1, ..., dn be value from adom
- Then we introduce linearly many new timestamps
- for each d_i and d_i+1 we introduce new timestamps
by using constants from the database
- If we allow comparisions between variables linearly many fresh values is not enough and exponentially many fresh values is required to abstact fainthfully.
- Our encoding can be extened for this case.
The idea is to start from polynomially many fresh constanst
and generate exponentially long linear order on tuples.
Then one can inotrduce extended singature where those tuples are then used to similate dabatabase constants.
Then rest of the encoding has the same logic as the above one.
- In case of rowo, liniarely many is still enough.
\section{Example}
\label{section:appendix:example}
As an illustration of the concepts in our formalism,
we provide an example about student enrollment at a university.
\subsection{Scenario: Student Registration}
One year in November, the student office distributes a report
on the numbers of new student registrations for the offered programs.
When comparing the numbers with those of the previous years,
the Master in Computer Science (\emph{mscCS}) shows a decrease,
in contrast with the Master in Economics (\emph{mscEco}),
which has registered a substantial increase.
An analysis task force at university level cannot identify a plausible cause.
Eventually, a secretary discovers
that the reason is a complication in the registration process,
which foresees two routes to registration:
a regular one and a second one via international federated study programs
to which some programs, like the \emph{mscCS}, are affiliated.
Due to different deadlines, regular registration has been concluded in November
while registration for students from federated programs has not.
Since the \emph{mscCS} is affiliated to some federated programs, but the \emph{mscEco} is not,
the query asking for all \emph{mscEco} students was stable in November,
while the query for all \emph{mscCS} students was not and returned too
low a number.
\subsection{\DABP Representation of the Scenario}
Table~\ref{tb:registration} shows
the student registration process $\B_{\reg}=\langle \P_{\reg}, \mathcal{C}} \newcommand{\D}{\mathcal{D}_{\reg} \rangle$.
Part~\emph{(a)} reports the process net and
Part~\emph{(b)} the execution conditions and writing rules.
A process instance starts when a student submits an online request,
providing as input the student name $S$ and the course name $C$.
Automatically, the system attaches a time stamp $\mathcal{T}$ to the request.
The application is then represented as an $\textit{In}$-record $\textit{In}(S,C, \mathcal{T}\,)$.
The procedure distinguishes between applications
to \emph{international} courses,
which are part of programs involving universities from different countries
and where an international commission decides whom to admit,
and to \emph{regular} programs, where the university itself evaluates the applications.
Accordingly, a process first checks for the type of application.
The transition \qact{is intl.~app.} can only be traversed,
if the execution condition $\textit{In}(S,C,\mathcal{T}\,), \textit{StudyPlan}(C,{\text{\emph{intl}}},P)$ succeeds,
which is the case when the course of the application
is stored in the relation $\textit{StudyPlan}$ and associated to a program with type $\text{\text{\emph{intl}}}$.
Subsequently, the process checks if the student has already been admitted \act{is admitted}.
If so, it pursues the upper branch of the net.
If not, it checks if the course is also open to regular
applications \act{isn't admitted}.
Similarly, the execution condition on \qact{is reg.~app.} ensures that the course
is associated to a program of type $\text{\text{\emph{reg}}}$, but not of type $\text{\text{\emph{intl}}}$.
Then, applications for regular courses follow the bottom branch.
Deadlines give rise to conditions on the application timestamp $\mathcal{T}$.
While applications are accepted starting from 1$^\text{st}$\ Sep,
the deadline for regular courses is 31$^\text{st}$\ Oct,
and for international courses it is 31$^\text{st}$\ Dec.
Candidates who applied until 30$\nth$ Sep can pre-enroll,
that is, register provisionally.
After that date, admitted candidates have to register directly.
Provisional registration gives students the possibility
\emph{(i)~} to enroll conditionally and complete an application not fully complete, and
\emph{(ii)~} to confirm or withdraw the registration before being formally enrolled.
Modeling the completion of incomplete applications leads to cycles in the net,
while non-determinism, e.g.\ due to human intervention or interaction with other systems,
is modeled by labeling the transitions emanating from a place
(like \qact{acad.~check} or \qact{stud.~decis.}) with non-exclusive execution conditions.
Some transitions are labeled with a writing rule.
When \qact{pre-enrol cond.} is traversed,
the rule $\tlbl{Conditional}(S,C) \leftarrow \textit{In}(S,C,\mathcal{T}\,)$
records that the application is conditionally accepted
by writing a fact into the relation $\tlbl{Conditional}$.
This relation, on the other hand, is read by the execution condition of the transition \qact{complete app.}
\input{Sources/table-registration-process}
Table~\ref{tb:registration}\emph{(c)} shows
a database instance $\D_{\reg}$ for our running example.
Courses offered are stored in the relation \emph{StudyPlan},
together with their type (\text{\emph{intl}}\ or \text{\emph{reg}})
and the program they are associated with.
The remaining tables store information about the students.
Table~\ref{tb:registration}\emph{(d)}
reports the running process instances $\mathcal{I}} \newcommand{\J}{\mathcal{J}_{\reg}$ in the form of a relation.
\subsection{Stability of the Example Queries}
Consider the queries
\begin{align*}
& Q_\text{eco}(S) \leftarrow \textit{Registered}(S,C),
\textit{StudyPlan}(C, T, \textit{mscEco}), \\
& Q_\text{cs}(S) \leftarrow \textit{Registered}(S,C),
\textit{StudyPlan}(C, T, \textit{mscCS}),
\end{align*}
which ask for the students registered for the master in CS,
and the master in Economics, respectively.
We analyze their stability over different periods,
specified in Table~\ref{table:stability-intervals}.
For each period from $\tau_1$ to $\tau_2$,
we ask if the query is stable until $\tau_2$ in a variant of $\B_{\reg}$
where
\emph{(i)~} the current date is in the interval and
\emph{(ii)~} there are no running applications with a start date later than~$\tau_2$
(and also no data in the tables about the students having submitted one).
\begin{table}[!ht]
\begin{center}
\begin{tabular}{@{} c c c c c @{}}
\toprule
\emph{Period} &
{$<$ 1$^\text{st}$\ Sep} &
{1$^\text{st}$\ Sep--31$^\text{st}$\ Oct} &
{1$^\text{st}$\ Nov--31$^\text{st}$\ Dec} &
{$>$ 31$^\text{st}$\ Dec} \\ \midrule
$Q_\text{eco}$ &
stable &
instable &
stable &
stable \\
$Q_\text{cs}$ &
stable &
instable &
instable &
stable \\ \bottomrule
\end{tabular}
\end{center}
\caption{Stability of the queries $Q_\text{eco}$ and $Q_\text{cs}$ for different intervals.}
\label{table:stability-intervals}
\vspace*{-0.5em}
\end{table}%
During the period before 1$^\text{st}$\ Sep,
neither program allows registrations to proceed
and thus both queries are stable until this date.
For the period {1$^\text{st}$\ Sep--31$^\text{st}$\ Nov},
the programs allow for new registrations and
both queries are instable.
If the current time is within the period 1$^\text{st}$\ Nov--31$^\text{st}$\ Dec
and there are no pending applications,
$Q_\text{eco}$ is stable
because the program \emph{mscEco} is not affiliated with any international (\text{\emph{intl}}) course and
the deadline for the regular programs has passed.
However, \emph{mscCS} has an affiliated course to which student \emph{Mary} is admitted.
She is not registered yet and potentially could submit an application
before the 31$^\text{st}$\ Dec, which would be accepted.
Thus, $Q_\text{cs}$ is not stable for this period.
If all the admitted students had already been registered,
the query would be stable,
since no new registration would be possible.
The query would also be stable in the case
the process is closed for new instances to start
(e.g., because the limit on registered students has been reached).
In this case, only running instances would be allowed to finish their execution.
Thus, candidate \emph{Mary} would not be able to register even though she is admitted.
If the current time is after $3$1$^\text{st}$\ Dec, both queries are stable regardless
whether the process is closed or not because all the registration deadlines have expired.
\subsection{Variants of the Example Process}
The model of $\B_{\reg}$ is general, since the
relations \emph{Pre-enrolled} and \emph{Conditional} are both read
and written;
the rules are normal, though only with negation on database relations
that are not updated;
the net is clearly cyclic.
We can imagine that at the beginning
of the registration period the process starts with a fresh configuration
(i.e., no running applications).
The case of arbitrary configurations includes situations that
arise as exceptions in the registration process and
cannot evolve from a fresh configuration.
For instance, a regular application received after the deadline for a valid
reason may be placed by a secretary at a certain place in the process
that it would not be able to reach from the {\textit{start\/}}\ place.
Our example is not closed.
If after the last deadline (31$^\text{st}$\ Dec.)
the web form for submitting new applications will be no
more available the process will run under closed executions.
Note that, in our running example, negation in the conditions appears only
on the database relations that are not updated by the process.
For this case we can still apply the encoding from this section and obtain
a semipositive Datalog program.
\section{Closed \DABP{s}}
\label{subsubsec:normal:cyclic:arbitrary:extended}
\subsection{Proof of Theorem~\ref{theorem:sms}}
The encoding program consists of the following rules:
(a)~\emph{Ordering rules} that generate a linear order of
size $m k r c^a$ (see Section~\ref{sec-positive:closed}) that we use to enumerate all executions steps;
(b)~\emph{Selection rules} that for each execution step non-deterministically
selects one instance and transition meaning that the selected instances
traverses the selected transition at that step;
(c)~\emph{Control rules} that discard cases where guesses execution sequence do not correspond to a valid execution in the process;
(d)~\emph{Generation rules} that generate facts produced by a valid execution;
(e)~\emph{Testing rules} that test if any of the guessed executions yield a new query answer.
\paragraph*{Generating Exponentially Big Linear Order}
Assume we are given an \DABP $\B=\tup{\P,\mathcal{I}} \newcommand{\J}{\mathcal{J},\D}$
possible with cycles and negation in the rules.
As we discussed,
to check stability in $\B$ cyclic \DABP{s} it is sufficient to consider
executions that have up to
$
m k r c^a
$
executions steps,
where $ m, k, r, c$ and $a$ are parameters of $\B$ as defined
in Section~\ref{sec-positive:closed}.
We introduce a Datalog program that
generates a liner order of size $m k r c^a$
starting from a much smaller order (exponentially smaller).
To define a small order we introduce
a set of constants, called \emph{digits},
$
\textit{Dig}_\B =\set{d_1,\dots,d_l}
$
of size $l$ an we establish one linear order $<$ on $\textit{Dig}_\B$:
$
d_1<d_2<\dots<d_l.
$
Assume that $\textit{Dig}_\B^g$ is the Cartesian power of $\textit{Dig}_\B$ of size $g$.
That is, each tuple $\bar k$ from $\textit{Dig}_\B^g$ is of the form
$
\bar k = \tup{d_{i_1},\dots,d_{i_g}},
$
for $d_{i_1},\dots,d_{i_g} \in \textit{Dig}_\B$.
We define $<^g$ as the lexicographical order
on the tuples from $\textit{Dig}_\B^g$.
Here $l$ and $g$ are selected such that
\emph{(i)~}
$ l= kc$ and thus depends on $\P, \mathcal{I}} \newcommand{\J}{\mathcal{J}$ and $D$, and
\emph{(ii)~}
$g > m+r+a$
where $m$, $r$, and $a$ are the parameters that depend only on $\P$.
Then, it is not hard to check that it holds
\[
l^g \ge m k r c^a.
\]
In other words,
linear order on $<^g$ is sufficient to enumerate all executions steps.
Adopting the idea in \cite{Gottlob-Eiter-LP-Journal-2001},
we define a positive Datalog program
that generates $<^g$.
In particular, we want generate a relation $\textit{Succ}$ that stores
the immediate successor in the order.
The order $<^g$ is generated based on the orders $<^i$
on $\textit{Dig}_\B^i$ for $i<g$.
For that and to count the execution steps
we introduce the the following relations.
\textbf{Notation}
We introduce:
\emph{(i)~}
$\textit{Digit}$ -- a unary relation such that $\textit{Digit}(d)$ is true iff $d \in \textit{Dig}_\B$;
\emph{(i)~}
$\textit{First}^i$ --
an auxiliary relation of arity $i$ such that
$\textit{First}^i(\bar d)$ is true iff
$\bar d$ is the first element of the linear order $<^i$;
\emph{(ii)~}
$\textit{Last}^i$ --
an auxiliary relation of arity $i$ such that
$\textit{Last}^i(\bar d)$ is true iff
$\bar d$ is the last element of the linear order $<^i$;
\emph{(ii)~}
$\textit{Step}$ -- a $g$-ary relation such that $\textit{Step}(\bar k)$ is true iff $\bar k$ is a tuple from $\textit{Dig}_\B^g$ that
corresponds to some execution step, that is any tuple from $\textit{Dig}_\B^g$ except for the first one in the order $<^g$;
\emph{(iii)~}
$\textit{Succ}^i$ -- a relation of arity $2i$ such that
$Succ^i(\bar d_1,\bar d_2)$ is true
iff $\bar d_2$ is the immediate successor of $\bar d_1$ in the order $<^i$.
\textbf{Ordering Rules}
To generate $\textit{Succ}^i$, $\textit{First}^i$, and $\textit{Last}^i$ we introduce the following rules:
\begin{align*}
& \textit{Succ}^{i+1}(Z,\xoverline{X};Z,\xoverline{Y}) \leftarrow \textit{Digit}(Z), \textit{Succ}^i(\xoverline{X};\xoverline{Y}) \\
& \textit{Succ}^{i+1}(Z_1,\xoverline{X};Z_2,\xoverline{Y}) \leftarrow \textit{Succ}^1(Z_1;Z_2), \textit{First}^i(\xoverline{X}), \textit{Last}^i(\xoverline{Y}) \\
&\textit{First}^{i+1}(X_1,\xoverline{X}) \leftarrow \textit{First}^1(X_1), \textit{First}^i(\xoverline{X}) \\
&\textit{Last}^{i+1}(Y_1,\xoverline{Y}) \leftarrow \textit{Last}^1(Y_1), \textit{Last}^i(\xoverline{Y}).
\end{align*}
\noindent
Then, we populate relation $\textit{Step}$ with the following rule:
\begin{align*}
\textit{Step}(K_1,\dots,K_g) \leftarrow \textit{Digit}(K_1),\dots,\textit{Digit}(K_g), \neg \textit{First}(K_1,\dots,K_g)
\end{align*}
\noindent
In the following we use $\textit{Succ}$ for $\textit{Succ}^g$,
$\textit{First}$ for $\textit{First}^g$, and $\textit{Last}$ for $\textit{Last}^g$.
We denote the above program as
$
\Pi^\textit{succ}_\P \cup \D_\B
$.
Here, $\Pi^\textit{succ}_\P$ is a program that is polynomial in the size of $\P$, and
$\D_\B$ is a database instance that contains
facts for relations $\textit{Digit}$, $\textit{First}^1$, $\textit{Last}^1$ and
$\textit{Succ}^1$, and thus it is that is polynomial in the size of $\B$.
Then it holds:
\begin{lemma}
\label{lemma:succ:order}
Let $\bar k$, $\bar k_1$ and $\bar k_2$ be tuples of size $g$, then:
\begin{itemize}
\item[\emph{(i)~}] $\Pi^\textit{succ}_\P \cup \D_\B \models \textit{Succ}(\bar k_1,\bar k_2)$
\ iff \
$\bar k_2$ is the successor of $\bar k_1$.
\item[\emph{(i)~}]
$\Pi^\textit{succ}_\P \cup \D_\B \models \textit{Step}(\bar k)$
\ iff \
$\bar k \in \textit{Dig}^g$;
\end{itemize}
\end{lemma}
In other words, the program $\Pi^\textit{succ}_\P \cup \D_\B$ generates the linear order in $\textsc{PTime}\xspace$ in the size of data and instances, and in $\textsc{ExpTime}\xspace$ in the size of process.
\paragraph*{Encoding Stability into Datalog with Negation}
In the following we define a Datalog program with negation
that, based on the linear order from above,
produces all maximal extended databases.
Each maximal extended database is going to be encoded
as one of the SMs of the program.
The program adapts \emph{guess and check}
methodology from answer-set programming that
organizes rules in guessing rules that generate SM candidates,
and checking rules that discards bad candidates.
\textbf{Notation}
To encode guessing of executions
we introduce relations $\InGuess$ and $\NonInGuess$ of size $g+1$
such that $\InGuess(\bar k,o)$ means that instance $o$ traverses at step $\bar k$,
and $\NonInGuess(\bar k,o)$ means the opposite.
Here, $\NonInGuess$ is needed for technical reasons.
Similarly, for transitions we introduce relations $\TGuess$ and $\NonTGuess$ such that
$\TGuess(\bar k,t)$ means that at step $\bar k$ transition $t$ is traversed; and
$\NonTGuess(\bar k,t)$ means the opposite.
Further,
we introduce relation $\Done$ of size $g$
that we use to keep track of the steps that are completed.
That is, $\Done(\bar k)$ is true if step $\bar k$ is completed
and steps that precede $\bar k$ are also completed.
Then, to store the positions of each instance after
some execution step we use relation $\textit{Place}$.
E.g., if after $\bar k$-th step instance $o$ is at place $p$
then $\textit{Place}(\bar k,o,p)$ is true.
To store facts that are produced up to a certain step
we introduce prime version relation $R'$ for each $R$ in $\Sigma_{\B}$.
Then $R'(\bar k,\ts)$ is true iff $R(\ts)$ is produced up to step $\bar k$.
First we define \emph{guessing rules}:
\begin{align*}
\textit{Moved}(\xoverline{K};O) & \leftarrow \textit{Step}(\xoverline{K}), \textit{In}^0(O,\blank), \neg \textit{NotMoved}(\xoverline{K};O), \\
\textit{NotMoved}(\xoverline{K};O) & \leftarrow \textit{Step}(\xoverline{K}), \textit{In}^0(O,\blank), \neg \textit{Moved}(\xoverline{K};O), \\
\bot & \leftarrow \textit{Step}(\xoverline{K}), \textit{Moved}(\xoverline{K};O_1), \textit{Moved}(\xoverline{K};O_2), O_1 \neq O_2, \\
\bot & \leftarrow \textit{In}^0(O,\blank), \textit{Step}(\xoverline{K}), \neg \InGuess(\xoverline{K},O).
\end{align*}
Intuitively, the first two
rules enforce each SM to partition instances into
$\InGuess$ and $\NonInGuess$ for each step $\bar k$,
and the last two ensures that at most one and at least one instance is selected.
We define the same kind of rules
for $\TGuess$ and $\NonTGuess$.
Once an instance and a transition have been selected
for one execution step $\bar k$,
we need to ensure that the instance can actually traverse the transition.
Relation $\Done$ keeps track of that for each step $\bar k$ by checking
if
\emph{(i)~} the selected instance $o$ satisfies the execution condition of the selected transition $t$;
\emph{(ii)~} the instance $o$ is at place $q$ from which $t$ originates; and
\emph{(iii)~} if all previous execution steps were already completed.
This is achieved using the \emph{checking rules}:
\begin{align*}
\textit{Completed}(\xoverline{K}_2) \leftarrow\ & \textit{Moved}(\xoverline{K}_2;O), \textit{Trans}(\xoverline{K}_2;t), \textit{Succ}(\xoverline{K}_1,\xoverline{K}_2),\\
& \textit{Completed}(\xoverline{K}_1), E_t(\xoverline{K}_1;O), \textit{Place}(\xoverline{K}_1;O;q).
\end{align*}
Condition $E_t(\xoverline{K}_1;O)$ is similar to the positive acyclic case where the execution $\bar \omega$ is
replaced with the execution step $\xoverline{K}_1$.
Similarly, we define generation rules that for $R'$ and rules that update
position of instances store in $\textit{Place}$.
Let the above rules
together with the program $\Pi^\textit{succ}_\P \cup \D_\B$
define the program $\Picl$ for closed \DABP{s},
and let $\D_\mathcal{I}} \newcommand{\J}{\mathcal{J}$ be a database instance that contains
$\textit{In}^0$ facts and $\D$.
\begin{lemma}
Let $\bar k$ be an execution step in $\B$, and let
$R(\ts)$ be a fact.
The following is equivalent:
\begin{itemize}
\item There is an execution of length $\bar k$ in $\B$ that produces $R(\ts)$;
\item $\Picl \cup \D_\mathcal{I}} \newcommand{\J}{\mathcal{J} \models_{\textit{brave}} R'(\bar k;\ts)$.
\end{itemize}
\end{lemma}
Now we want to test query $Q$ for stability.
We collect new query answers with the rule:
$
Q'(\xoverline{X}) \leftarrow R'_1(\xoverline{K};\tuple{u}_1),\dots , R'_n(\xoverline{K};\tuple{u}_n).
$
Let $\Pi_Q^\textsl{test}$ be the test program containing $Q$, $Q'$ and the test rule as in the previous case. Then the following holds:
\[
\text{ $Q$ is instable in $\tup{\P,\mathcal{I}} \newcommand{\J}{\mathcal{J},\D}$
\ iff\ \ }
\Picl \cup \D_\mathcal{I}} \newcommand{\J}{\mathcal{J} \cup \Pi_Q^\textsl{test} \models_{\textit{brave}} \instable.
\]
\subsection{Proof of Proposition~\ref{proposition:cy-cl-process-hd:extended}}
\label{sec:hardness-SMS}
In the following we prove Proposition~\ref{proposition:cy-cl-process-hd:extended} defined above.
In particular, we show how to encode
the brave reasoning under Stable Model Semantics (SMS)
for a given
Datalog program $\Pi \cup \D$
with negation
into stability problem for
normal cyclic singleton \DABP $\tup{\P_{\Pi,A},\mathcal{I}} \newcommand{\J}{\mathcal{J}_0,\D}$
under closed semantics,
where program $\Pi$ is encoded in the process model
and data part of the program $\D$ is encoded in the database of the process.
As usual, the test query is $Q_{\textit{test}}$.
\paragraph*{Standard notation for Datalog program with negation}
For Datalog programs under stable model semantics (SMS)
we use the following notation.
A normal Datalog rule is a rule of the form
\begin{align*}
R(\tuple{u}) \leftarrow R_1(\tuple{u}_1),\dots,R_l(\tuple{u}_l), \neg R_{l+1}(\tuple{u}_{l+1}),\dots, \neg R_h(\tuple{u}_h).
\end{align*}
We use $H$ to denote the head of the rule $R(\tuple{u})$, and
$A_1,\dots,A_l, \neg A_{l+1},\dots, \neg A_{h}$
to denote body atoms
$R_1(\tuple{u}_1),\dots,R_l(\tuple{u}_l), \neg R_{l+1}(\tuple{u}_{l+1}),\dots, \neg R_h(\tuple{u}_h)$
Then we can write the rules $r$ as:
\[
H \leftarrow A_1,\dots,A_l,\neg A_{l+1},\dots, \neg A_{h}.
\]
%
We represent a fact $R(\tuple{u})$ as a Datalog \emph{fact rule} $R(\tuple{u}) \leftarrow$.
A Datalog program with negation $\Pi$ is a finite
set of normal Datalog rules $\{r_1,\dots,r_k \}$.
\paragraph*{Grounding of a Datalog program}
Let $r$ be a normal Datalog rule and $C$ a set of constants.
The \emph{grounding} $\textit{gnd}_C(r)$ of $r$ is a set of
rules without variables obtained by substituting the variables in $r$ with constants from $C$
in all possible ways.
In this way we can obtain several grounded rules from a non-grounded rule.
The grounding $\textit{gnd}(\Pi)$ for a program $\Pi$ is a program obtained by grounding rules
in $\Pi$ using the constants from $\Pi$.
We note that program $\textit{gnd}(\Pi)$ and $\Pi$ have the same semantic properties (they have
the same SM, see later).
Program $\textit{gnd}(\Pi)$ is just an expanded version of $\Pi$ (it can be exponentially bigger than $\Pi$).
\paragraph*{Stable model semantics}
Concerning stable model semantics we use
the following notation.
An \emph{interpretation} of a program represented as a set of facts.
Let $M$ be an interpretation.
We define the \emph{reduct} of $\Pi$ for $M$ as the ground
positive program
\begin{align*}
\Pi^M = \{ A\leftarrow A_1,\dots,A_l \mid\ &
A \leftarrow A_1,\dots,A_l,\neg A_{l+1},\dots, \neg A_h \in \textit{gnd}(\Pi), \\
&
M \cap \set{A_{l+1},\dots, A_h} = \emptyset \}
\end{align*}
Since $\Pi^M$ is a positive ground program it has a unique Minimal Model (MM), in the inclusion sense
Then,
\[
M \text{ is a \emph{stable model} (SM) of } \Pi
\quad\text{iff}\quad
M \text{ is the minimal model of } \Pi^M.
\]
Given a program $\Pi$ and a fact $A$ we say that
\begin{align*}
\Pi \models_{\textit{brave}} A
\end{align*}
if there exists a SM $M$ of $\Pi$ such that $A \in M$.
For a given $\Pi$ and a fact $A$, deciding whether $\Pi \models_{\textit{brave}} A$ is $\textsc{NExpTime}\xspace$-hard.
\newcommand{\B_{\P,\D,A}}{\B_{\P,\D,A}}
\newcommand{\Pi \cup \D}{\Pi \cup \D}
\paragraph*{Encoding of Brave Entailment into Stability Problem}
Given a program $\Pi \cup \D$ and a fact $A$ we construct an
\DABP $\B_{\P,\D,A}\tup{\P_{\Pi,A},\mathcal{I}} \newcommand{\J}{\mathcal{J}_0,\D}$ such that
for a test query $Q_{\textit{test}} \leftarrow \dummy$ the following holds:
\[
\text{$\Pi \cup \D \models_{\textit{brave}} A$ iff $Q_{\textit{test}}$ is stable in $\tup{\P_{\Pi,A},\mathcal{I}} \newcommand{\J}{\mathcal{J}_0,\D}$}.
\]
For convenience, in the following we use $\Pi$ to denote $\Pi \cup \D$, unless
otherwise is stated.
Intuitively, process $\B_{\P,\D,A}$ is constructed such that the following holds.
\begin{itemize}
\item
The process generates all possible interpretations for
$\Pi$ using the variables and constants from $\Pi$.
That is, it generates all possible candidates
for SMs of $\Pi$.
\item
For every such SM candidate $M$,
the process checks if $M$ is a SM of $\Pi$
by:
\begin{itemize}
\item[\emph{i)}] computing the MM of $\Pi^M$ denoted with $M'$;
\item[\emph{ii)}] checking if $M' = M$.
\end{itemize}
\item
If $M$ is a SM of $\Pi$ then the process checks for the given fact $A$ whether it holds that $A \in M$.
If so, the process produces $\dummy$.
\end{itemize}
We organize $\B_{\Pi,A}$ in 6 subprocesses represented in Figure~\ref{fig:steps}.
\begin{figure}[!ht]
\begin{center}
\includegraphics[scale=0.35]{Images/Hardness/steps.pdf}
\end{center}
\caption{Subprocesses composing the process net of ${\P_{\Pi,A}}$.}
\label{fig:steps}
\end{figure}
\bigskip
\noindent
The subprocesses are intuitively defined as follows:
\begin{description}
\item[Subp 1.]
\emph{(Compute successor relations)}
First we compute the successor relations
$\textit{Succ}^i$ of sufficient size $i$,
that we need in the next steps.
This we need for technical reasons.
\item[Subp 2.]
\emph{(Guess a SM candidate)}
At this step, the process produces a SM candidate
by non-deterministically producing facts obtained
from relations and constants that appear in the program.
%
Let $R$ be a relation in $\Pi$.
Then, for each $R$-fact that can be obtained by taking
the constants from $\Pi$,
a process does an execution step at
\emph{the choice place}
from which if an instance traverse one way
the process produces this $R$-facts,
and if it traverses the other way
then it does not.
%
%
We denote with $M$ the guessed SM candidate.
\item[Subp 3.]
\emph{(Compute a MM candidate of the reduct)}
We want compute the MM of the reduct $\Pi^M$.
To do so, we first compute a candidate $M'$
for the MM by by non-deterministically applying the rules of
$\Pi^M$.
%
Computing a candidate and the testing if the candidate
is the MM is our approach to find the MM.
%
%
\item[Subp 4.]
\emph{(Check if $M'$ is the MM of the reduct)}
At this step we check if $M'$ is indeed the minimal model
of the reduct $\Pi^M$.
%
If this is not the case, the process is not going to progress further.
\item[Subp 5.]
\emph{(Check if SM candidate is a SM)}
If we are at this step then $M'$ is the MM of $\Pi^M$.
Now we check if $M' = M$.
If this is the case, then $M$ is a stable model of $\Pi$.
\item[Subp 6.]
\emph{(Insert $\dummy$)}
Finally, we check if $A \in M$. If this is the case then the process produces $\dummy$.
\end{description}
\paragraph*{Instance and data part.}
We initialize the instance part $\mathcal{I}} \newcommand{\J}{\mathcal{J}_0$
by placing a single instance at the start place,
we set database to be the data part of the program $\D$.
\paragraph*{Process model.}
In the following we construct the process model $\P_{\Pi,A}$.
\paragraph*{Subp 1: Computing successor relations.}
In order to nondeterministically select which $R$-facts
to produce for a relation $R$ in $\Pi$,
we introduce sufficiently big linear order that index all $R$-facts.
Since there are exponentially many $R$-facts we define the process
rules that compute the order starting from an order of a
polynomial size.
The rules that compute the exponentially big order
uses the same rules define as in Lemma~\ref{lemma:succ:order}.
Here, the difference is that we use constants from $\Pi$
as digits.
Let $C = \{b_1,\dots,b_c\}$ be the constants from $\Pi$.
We define a linear order $<$ on $C$ such that
\[b_1 < b_2 < \dots <b_c.\]
Let $<^j$ be the lexicographical order linear order on $C^j$,
defined from $<$
for some $j>0$.
Further, let $n$ be the maximum between
\begin{itemize}
\item the maximal arity of a relation in $\Pi$; and
\item the largest number of variables in a rule in $\Pi$.
\end{itemize}
We want to compute the successor relation $\textit{Succ}^j$ that contains immediate
successors in the order $<^j$ for $j=1,\dots,n$
\textbf{Vocabulary and Symbols}
To encode the order as database relations we
introduce relations:
$\textit{Const}$ of size $1$ to store constants from $\Pi$;
$\textit{Succ}^j$ of size $2j$ to store
immediate successors in the order $<^j$;
$\textit{First}^j$ and $\textit{Last}^j$ to store
the first and the last element of the order $<^j$.
That is,
\begin{itemize}
\item
$\textit{Const}(b)$ -- is true iff $b$ is a constant from $\Pi$.
\item
$\textit{Succ}^j(\bar b,\bar b')$ -- is true iff
$\bar b$ is the immediate successor of $\bar b'$
in the order $<^j$;
\item
$\textit{First}^j(\bar b)$ -- is true iff
$\bar b$ is the first element in the order $<^j$;
\item
$\textit{Last}^j(\bar b)$ -- is true
iff $\bar b$ is the last element in the order $<^j$.
\end{itemize}
\textbf{Initialization}
We initialize relations for the ordering as follows:
\begin{itemize}
\item
$\textit{Const}(b)$ -- we intialize relation $\textit{Const}$
with all the constants from $\Pi$;
\item
$\textit{Succ}^1(b,b')$ -- we initialize relation $\textit{Succ}^1$
saying that $b'$ is the successor of $b$;
\item
$\textit{First}^j(b,\dots,b)$ -- is the initialization for relation $\textit{First}^j$ such that $b$ is the first element in the order $<$;
\item
$\textit{Last}^j(b,\dots,b)$ -- is the initialization for relation $\textit{Last}^j$
such that $b$ is the last element in the order $<$.
\end{itemize}
\begin{figure}[!ht]
\begin{center}
\includegraphics[scale=0.4]{Images/Hardness/1Subproc.pdf}
\end{center}
\caption{Subprocess 1 computes successor relations $\textit{Succ}^i$ for $i = 1,\dots,n$}
\label{fig:subp1}
\end{figure}
\textbf{Encoding into the process}
We introduce $2n-1$ transitions
$t_1,t'_2,t''_2,\dots,t'_n,t''_n$ (see Figure~\ref{fig:subp1})
such that $t'_j$ and $t''_j$ are used to generate $\textit{Succ}^j$.
Then, we set the execution condition for these transitions to be always executable:
\begin{align*}
E_{t'_j} = E_{t''_j} = \textit{true}.
\end{align*}
We use the writing rules to populate the relations
$\textit{Succ}^j$ for $ 1 < j \leq n$
as follows:
\begin{align*}
& W_{t'_{j+1}}: \textit{Succ}^{j+1}(Z,\xoverline{X},Z,\xoverline{Y}) \leftarrow
\textit{Const}(Z), \textit{Succ}^j(\xoverline{X},\xoverline{Y});\\
& W_{t''_{j+1}}: \textit{Succ}^{j+1}(Z_1,\xoverline{X},Z_2,\xoverline{Y}) \leftarrow
\textit{Succ}^1(Z_1,Z_2), \textit{First}^j(\xoverline{X}), \textit{Last}^j(\xoverline{Y}).
\end{align*}
Once all successor relations are generated transition $t_1$ can be executed:
\begin{align*}
E_{t_1}: \textit{Succ}^n(\xoverline{X},\blank), Last^n(\xoverline{X}).
\end{align*}
\paragraph*{Subp 2: Guessing a SM candidate.}
Let $R_1,\dots,R_m$ be the relations in $\Pi$.
For every relation $R$ in $\Pi$ we create a subprocess $\textit{Guess-}R$
that non-deterministically guesses $R$-facts that belong to a SM candidate $M$.
Subprocess 2 is composed by connecting subprocess $\textit{Guess-}R$
for each relation $R$ as depicted in Figure~\ref{fig:subp2}.
\begin{figure}[!ht]
\begin{center}
\includegraphics[scale=0.4]{Images/Hardness/2Subproc.pdf}
\end{center}
\caption{Subprocess 2}
\label{fig:subp2}
\end{figure}
\textbf{Notation}
We assume the following notations:
$a$ arity of a relation $R$ in $\Pi$;
$m$ is the number of relations in $\Pi$;
$\textit{Done}_R$ is a relation of arity $a$ such that
$\textit{Done}_R(\tuple{u})$ is true after the subprocess $\textit{Guess-}R$
has guessed whether to include $R(\tuple{u})$-fact in the SM candidate or not
\textbf{Encoding into the process}
The subprocess $\textit{Guess-}R$ is defined as in Figure~\ref{fig:subp2-detail}
\begin{figure}[!ht]
\begin{center}
\includegraphics[scale=0.4]{Images/Hardness/3Subproc-detail.pdf}
\end{center}
\caption{Subprocess $\textit{Guess-}R$ }
\label{fig:subp2-detail}
\end{figure}
For convenience introduce condition
$\textit{Current}_R(\xoverline{X})$ that is true if
the next $R(\xoverline{X})$-fact for which the process has to decide
whether to include it in the SM candidate or not.
The condition is defined with:
\begin{align*}
\textit{Current}_R(\xoverline{X}): \textit{Succ}^a(\xoverline{X},\xoverline{Y}), \textit{Done}_R(\xoverline{Y}), \neg \textit{Done}_R(\xoverline{X}).
\end{align*}
Transitions $t_1$ and $t_2$ are executed non-deterministically. Intuitively, they non-deterministically
decide whether the $R$-fact, obtained by grounding $R$ with constants from $\textit{First}^a$,
belongs to the SM candidate ($t_1$) or not ($t_2$):
\begin{align*}
& E_{t_1} = E_{t_2} : \textit{true}; \\
& W_{t_1}: R(\xoverline{X}) \leftarrow \textit{First}^a(\xoverline{X}); \\
& W_{t_2}: \textit{true} \leftarrow \textit{true}.
\end{align*}
Then, transition $t_3$ inserts that the guess for the first $R$-fact has been made by inserting $\textit{Done}_R(\tx)$:
\begin{align*}
& E_{t_3} : \textit{true}; \\
& W_{t_3}: \textit{Done}_R(\xoverline{X}) \leftarrow \textit{First}^a(\xoverline{X}).
\end{align*}
Transitions $t_4$ and $t_5$, similarly to transitions $t_1$ and $t_2$, non-deterministically guess whether
the next $R(\xoverline{X})$-fact belongs to the SM candidate or not:
\begin{align*}
& E_{t_4} = E_{t_5} : \textit{true}; \\
& W_{t_4}: R(\xoverline{X}) \leftarrow \textit{Current}_R(\xoverline{X}); \\
& W_{t_5}: \textit{true} \leftarrow \textit{true}.
\end{align*}
Transition $t_6$, similarly to transition $t_3$, inserts fact $\textit{Done}_R(\xoverline{X})$ after decision for $R(\xoverline{X})$-fact has been made:
\begin{align*}
& E_{t_6} : \textit{true}; \\
& W_{t_6}: \textit{Done}_R(\xoverline{X}) \leftarrow \textit{Current}_R(\xoverline{X}).
\end{align*}
When all guesses have been made, transition $t_7$ can be executed and
the next subprocess will be executed:
\begin{align*}
& E_{t_7} : \textit{Done}_R(\xoverline{X}), \textit{Last}^a(\xoverline{X}); \\
& W_{t_7}: \textit{true} \leftarrow \textit{true}.
\end{align*}
\paragraph*{Subp 3: Compute the minimal model of the reduct.}
The subprocesses 3 and 4 compute the MM $M'$ of $\Pi^M$.
Intuitively, this done in the following way:
\begin{itemize}
\item
Since $\Pi^M$ is a positive ground program the MM of $\Pi^M$
is unique and it can be computed as the Least Fixed Point (LFP) on the rules in $\Pi^M$.
\item
In subprocess 3, depicted in Figure~\ref{fig:subp3}, the process produces facts
that are in the LFP of $\Pi^M$.
For every relation $R$ we introduce a relation $R'$ that stores facts produced by the
LFP computation.
\item
In principle, subprocess 3 can produce all facts from the LFP if it executes
a sufficient number of times. However, it can produce also only a part of the LFP
if it decides to traverse $t_{k+1}$.
\item
In other words, subprocess 3 non-deterministically decides how many facts from the LFP to produce.
\item
In subprocess 4 we check if all facts from the LFP of $\Pi^M$ are indeed produced
at subprocess 3.
\end{itemize}
\textbf{Vocabulary and Symbols}
\begin{itemize}
\item $R'(\tuple{u})$ -- holds iff $R(\tuple{u})$ is in the LFP of $\Pi^M$ (i.e. it is in the MM
of $\Pi^M$) and it is computed by subprocess 3.
\end{itemize}
\begin{figure}[!ht]
\begin{center}
\includegraphics[scale=0.4]{Images/Hardness/4Subproc.pdf}
\end{center}
\caption{Subprocess 3 computes the MM candidate of the reduct}
\label{fig:subp3}
\end{figure}
\textbf{Encoding into the process}
Let $\set{r_1,\dots,r_k}$ be the rules in $\Pi$.
For every rule $r_i$ of the form $H \leftarrow A_1,\dots,A_l ,\neg A_{l+1},\dots, \neg A_h$ we introduce transition $t_i$ as
depicted in Figure~\ref{fig:subp3} with execution condition:
\begin{align*}
E_{t_i}: \textit{true}
\end{align*}
and writing rule as follows:
\begin{align*}
W_{t_i}: H' \leftarrow \ & A_1',\dots,A_l', A_1,\dots,A_l ,\neg A_{l+1},\dots, \neg A_h.
\end{align*}
Here, atoms $H', A_1',\dots,A_l'$ are the same as
$H, A_1,\dots,A_l$,
except that each relation name $R$ is renamed with $R'$.
Atoms $A_1,\dots,A_l ,\neg A_{l+1},\dots, \neg A_h$ evaluates over $M$ and they are true iff there exists a grounding substitution $\theta$ (a substitution that replaces variables with constants) such that the ground rule
$\theta A \leftarrow \theta A_1,\dots,\theta A_l$ is in the reduct $\Pi^M$.
For $l=0$, the fact $\theta H'$ is produced by the process since the rule $\theta H \leftarrow $ is in $\Pi^M$ as thus $H$ is in the LFP of $\Pi^M$.
For $l>0$, assume that $\theta A_1',\dots,\theta A_l'$ are already produced by the process such that $\theta A_1,\dots,\theta A_l$
are in the LFP of $\Pi^M$.
Then we have that $\theta H'$ is produced by the process iff
$\theta H$ is in the LFP of $\Pi^M$.
\paragraph*{Subp 4: Check if the computed model is a minimal model of the reduct.}
After the execution of subprocess 3 we obtain a MM candidate $M'$ as a set of
$R'$-facts produced by the process.
In this step we check if $M'$ is indeed a MM of $\Pi^M$, because in the preceding step
it may be that the process has generated a part of the LFP of $\Pi^M$.
For the check we define the process as in Figure~\ref{fig:subp4}, where each transition
$t_{r_i}$ checks if $M'$ contains all facts in the LFP that
can be produced by the rule $r_i$.
\begin{figure}[!ht]
\begin{center}
\includegraphics[scale=0.4]{Images/Hardness/5Subproc.pdf}
\end{center}
\caption{Subprocess 4 checks if the MM candidate is the MM of the reduct}
\label{fig:subp4}
\end{figure}
\textbf{Notation}
We introduce unary predicate $\textit{fail}_{\textit{MM}}$ that is true iff $M'$ is not a MM.
\textbf{Encoding into the process}
For every rule $r$ we introduce a transition $t_r$ with execution condition
\begin{align*}
E_{t_r}: \textit{true},
\end{align*}
%
and with writing rule as follows:
%
\begin{align*}
W_{t_r}: \textit{fail}_{\textit{MM}} \leftarrow & A_1',\dots,A_l', \neg H', A_1,\dots,A_l ,\neg A_{l+1},\dots, \neg A_h
\end{align*}
Fact $\textit{fail}_{\textit{MM}}$ is produced by the process iff facts $\theta A_1',\dots,\theta A_l'$
are produced by the subprocess 3 while $\theta H'$ is not, for some substitution $\theta$.
Obviously, this is true iff $M'$ is not the MM of the reduct.
Last transition $t_{\textit{check}}$ is executable if none of the previous steps
has generated the $\textit{fail}_{\textit{MM}}$ predicate:
\begin{align*}
E_{t_{\textit{check}}}: \neg \textit{fail}_{\textit{MM}}.
\end{align*}
\paragraph*{Subp 5: Checking if SM candidate is a SM.}
If the process execution can reach subprocess 5 it means that $M'$ is
indeed the MM of reduct $\Pi^M$.
It remains to check if $M$ is a SM of $\Pi$, that is if $M'= M$.
For this check we define the subprocess as in Figure~\ref{fig:subp5}.
Transition $t'_i$ checks if there is a $R'_i$-fact for which there is
no $R_i$-fact and transition $t''_i$ checks if there is a $R_i$-fact for which there is
no $R'_i$-fact.
\begin{figure}[!ht]
\begin{center}
\includegraphics[scale=0.4]{Images/Hardness/6Subproc.pdf}
\end{center}
\caption{Subprocess 5 checks if SM candidate is a SM}
\label{fig:subp5}
\end{figure}
\textbf{Notation}
We introduce unary predicate $\textit{fail}_i$ that holds if $M' \neq M$.
\textbf{Encoding into the process}
Transition $t'_i$ is encoded as follows:
\begin{align*}
W_{t'_i}: \textit{fail}_i \leftarrow R'_i(X), \neg R_i(X).
\end{align*}
Transition $t''_i$ is encoded as follows:
\begin{align*}
W_{t''_i}: \textit{fail}_i \leftarrow R_i(X), \neg R'_i(X).
\end{align*}
\paragraph*{Subp 6: Insert $\dummy$.}
After the execution of subprocess 5 if no $\textit{fail}_i$ facts were produced,
then $M' = M$
Subprocess 6 checks whether this is the case. If $M' = M$ and $A \in M$ the process inserts $\dummy$
\begin{figure}[!ht]
\begin{center}
\includegraphics[scale=0.4]{Images/Hardness/7Subproc.pdf}
\end{center}
\caption{Subprocess 6 inserts $\dummy$}
\label{fig:subp6}
\end{figure}
\textbf{Encoding into the process}
The subprocess is depicted in Figure~\ref{fig:subp6}
Transition $t_{\dummy}$ checks if $M'= M$ with the execution condition:
\begin{align*}
E_{t_{\dummy}}: \neg \textit{fail}_1,\dots,\neg \textit{fail}_m.
\end{align*}
By traversing $t_{\dummy}$ if condition $A \in M$ then $\dummy$ is inserted with the
following writing rule:
\begin{align*}
W_{t_{\dummy}}: \dummy \leftarrow A.
\end{align*}
All together, we have that fact $A$ is produced by the process iff
there exists a SM of the program that contains $A$.
This concludes the proof.
\section{Rowo \DABP{s}}
\endinput
We first show encodings for fresh open cases and
then for closed arbitrary.
As in the general case,
the encodings for open arbitrary cases can be obtained
combined the corresponding fresh open and closed arbitrary cases.
To check stability of a rowo DABP,
we construct a non-recursive Datalog program.
However, the process complexity is even smaller.
It is a complex as evaluating CQ.
In principle, one can rewrite process as a single CQ (or as a union of CQs)
but such approach is very technical, and as such we think
it is not of practical interest.
On the the other hand,
the process complexity is even simpler than non-recursive Datalog rules.
In fact, in rowo data and instance complexities in are ACz
which means that checking stability can be done
by evaluating a Boolean First-Order (FO) query over a
database that contains process instances and database facts.
Since FO queries corresponds to SQL queries, one can in principle,
implement stability checking as query answering over SQL engine
where SQL query encodes process part.
intro what we are going to show
- say that we think that main characteristics is low data and instance complexity
- there results can be obtained already by adopting encoding from
general case to a non-recursive Datalog programs
- from there we obtain complexities for data and instance
- secondly, process complexity is even weaker than non-recursive Datalog programs, that is as hard as evaluating CQs
- In principle, it would be possible to define such a query however it is very technical and thus not of practical interesting
So in the following we first present encoding
then we discuss process complexity
-------------
some general principles before adopting encoding from general
- (a) to produce maximal database it is enough to traverse each transition at most once
- (b) negation is always unstratified since it is on the read only part of the database
- (c) in case of arbitrary instances cannot communicate it is always one can instead of analyzing all possible transitions for all together analyze one at the time
------------
very short intuition how we are going to show open cases
for open cases:
- combination of bounded cases and open cases for
- every rule becomes ...
very short intuition how we are going to show closed cases
for closed cases:
- we adopt acyclic case
again for the same reasons even in the presence of cyclic
------------
process complexity
upper bounds
approach
- say that for singleton can be decided in NP time
- now since they execute independently closed cases
- in open case we have abstraction principle
then we observe that it is enough to consider only instances that takes
constans from K
- then we introduce each possible instance that takes constants from K
(which is polynomially many in size of process)
- then we need to produce at most as many atoms are in the query
- then we introduce for each instantiation |Q| many copies at start
- the rest is the same as in the cyclic case, by checking what each
instance can produce and then combining produced atoms in order
to find new answer
2 theorems
- one for singleton processes
- one final that conclude how complex it is
hardness
- give intuition by saying that already evaluating CQ over a fixed database is NP-hard, thus checking stability also ...
------------
comment on query complexity
------------
final theorem [summary]
\subsection{Proof of Theorem~\ref{theorem:rowo}}
We first show encodings for fresh rowo \DABP{s}.
Then we show encodings for closed rowo \DABP{s}, and
finally we combine these two encodings to
obtain encodings for arbitrary rowo \DABP{s}.
\paragraph*{Rowo Fresh \DABP{s}}
\label{subsec:rowo:fresh:open}
First we analyze a fresh rowo $\B=\tup{\P,\D}$.
For this case
we adapt $\PiPposfr$
from Section~\ref{sec:DABP-Datalog-power-short}.
In rowo \DABP{s}, we have that each instance needs not to traverse
a transition more than once in order to produce the most that
the transition can produce.
It may need to traverse some transitions more than once
to reach other transitions, but in total it is sufficient that
it makes at most $m^2$ traversals to reach all transitions,
where $m$ is the number of transitions.
I.e., it is sufficient to consider executions of a single instance of
maximal size $m^2$.
Therefore,
we can eliminate recursion from traversal rules in positive fresh \DABP{s} by
creating a bounded derivation of maximal size $m^2$.
To this end, instead of $\textit{In}_p$ we introduce relations
$\textit{In}^i_p$
for each $i$ up to $m^2$
to record that a fresh instance can reach place $p$ in $i$ steps.
That is,
$\textit{In}^i_p(\ts)$ is true iff a fresh instance with $\textit{In}(\ts)$-record
can reach place $p$ in $i$ steps.
Next we adapt the rules.
\textbf{Traversal Rules}
For each transition $t$ from a place $q$ to a place $p$
and for each $i$ up to $m^2$ we adapt a \emph{traversal rule} as follows:
\[
\textit{In}^{i+1}_p(\ts) \leftarrow E_t^i(\ts)
\]
Note that, as a difference from the general case, here $E_t^i(\ts)$ denotes the execution condition evaluated over the initial database
(rather than on the extended database
as $E'_t(\ts)$ would denote), and where
$\textit{In}(\ts)$ condition is replaced with $\textit{In}^{i}_q(\ts)$.
The database relations are not changed.
\textbf{Generation Rules}
Similarly, for each transition $t$ from above we introduce the following
\emph{generation rule}:
\[
R'(\tuple{u}) \leftarrow E_t^i(\ts) ,B_t^i(\ts',\tuple{u}), \ts=\ts'
\]
As pointed in the observations
negation in $E_t$ and $B_t$
does not make reasoning more complex
{since negation is on the base relations
that are not updated by the process}.
\textbf{Summary}
Let $\PiProwofr$ be the non-recursive Datalog program with stratified negation
that encodes the rowo process $\P$
obtained from $\PiPposfr$
substituting the traversal and generation rules with the rules above.
The rest of the program is the same as in the positive variant.
\begin{lemma}
Let $R'(\tuple{u})$ be a fact defined over $\adomExt$, then the following is equivalent:
\begin{itemize}
\item there is an execution in $\B$ that produces $R(\tuple{u})$
\item $\PiProwofr \cup \D \models R'(\tuple{u})$
\end{itemize}
\end{lemma}
Let $\Pi_Q^\textsl{test}$ be the test
program based on a query $Q$ as defined for the general variant.
\begin{theorem}
\label{rowo-th-instability}
The following is equivalent:
\begin{itemize}
\item $Q$ is instable in $\B$;
\item $\PiProwofr \cup \D \cup \Pi_Q^\textsl{test} \models \instable$
\end{itemize}
\end{theorem}
\endinput
In particular,
each transition rule of the form $\textit{In}_p(\xoverline{X}) \leftarrow \textit{In}_q(\xoverline{X}), E_t(\xoverline{X})$
is now encoded as
$$
\textit{In}^{i+1}_p(\xoverline{X}) \leftarrow \textit{In}^{i}_q(\xoverline{X}), E_t(\xoverline{X})
$$
where $i= 1\dots m^2-1$.
The rest of the program is the same as in the general positive open variant.
As pointed in \emph{(iii)~} negation does not make reasoning more complex.
Let $\PiProwofr$ be the non-recursive Datalog program with stratified negation
that encodes the rowo process $\P$, and let $\Pi_Q^\textsl{test}$ be the test
program based on a query $Q$ as defined for the general variant.
\begin{theorem}
\label{th-rowo-fresh}
The following are equivalent:
\begin{itemize}
\item $Q$ is instable in $\B$ under open semantics;
\item $\PiProwofr \cup \D \cup \Pi_Q^\textsl{test} \models \instable$.
\end{itemize}
\end{theorem}
\subsection{Rowo Complexity}
\subsection{Proof of Proposition~\ref{prop-rowo:generability:complexity}}
\begin{proof}
Assume the instance $o$ is at place $p$
and it has an input record $I(\bar s)=M_S(o)$.
To show the claim it is sufficient
to guess a closed execution $\Upsilon$
consisting of the traversals by $o$,
and then verify whether atoms $A_1,\ldots,A_n$ can
be produced by such execution.
In the case of singleton rowo \DABP{s} under closed executions,
a closed execution is uniquely determined by
a path in $\P$.
Thus, we guess a path $t_1,\ldots,t_m$ in $\P$
that starts in $p$.
This guess is polynomial in the size of $\P$.
For all transitions on the path, we further guess
assignments
$\alpha_1,\ldots,\alpha_m$ for the execution conditions
$E_{t_1},\ldots,E_{t_m}$.
Then for each writing rule $W_{t_i}$ of the transition $t_i$
we guess up to $n$ assignments
$\beta^l_{t_i}$ for $1 \le l \le n$,
because a rule may need to produce more than
one fact, but no more than the size of the query.
In principle, only a subset of
$W_{t_1},$ \ldots, $W_{t_m}$ may be
needed to produce atoms $A_1,\ldots,A_n$.
Wlog we can guess the assignments for all.
Now we verify.
Firstly, we verify whether
the path can be traversed by the instance.
This is, if for every execution condition $E_{t_i}$
the ground query $\alpha_i E_{t_i}$ evaluates to
$\textit{true}$ in $\D\cup\set{\textit{In}(\bar s)}$.
Secondly, we verify whether $A_1,\ldots,A_n$
are produced on the path by checking if
for every $A_i$ there exist a writing rule
$W_{t_j} \colon A_{t_j} \leftarrow B_{t_j}$
and assignment $\beta^l_{t_j}$ such that
the ground query $\beta^l_{t_j} B_{t_j}$
evaluates to $\textit{true}$ in $\D\cup\set{\textit{In}(\bar s)}$ and
$A_i$ is equal with the head of the writing rule
$\beta^l_{t_j} A_{t_j}$.
Since all guesses and checks are polynomial
in the size of $\B$ the claim
follows directly.
\end{proof}
| {'timestamp': '2015-12-23T02:01:39', 'yymm': '1512', 'arxiv_id': '1512.06912', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06912'} | arxiv |
\section{Introduction}
We consider the problem faced by a statistician \Bay{} who analyses data and communicates her findings to a third party \Adv{}. While \Bay{} wants to learn as much as possible \emph{from} the data, she doesn't want \Adv{} to learn \emph{about} any individual datum. This is for example the case where \Adv{} is an insurance agency, the data are medical records, and \Bay{} wants to convey the efficacy of drugs to the agency, without revealing the specific illnesses of individuals in the population.
Such requirements of \emph{privacy} are of growing interest in the learning~\cite{chaudhuri2012convergence,duchi:local-privacy}, theoretical computer science~\cite{dpStats,MechDesign} and databases communities~\cite{Barak2007,zhang2014privbayes} due to the impact on individual privacy by real-world data analytics.
In our setting, we assume that \Bay{} is using \emph{Bayesian inference} to draw conclusions from observations of a system of random variables by updating a prior distribution on parameters (\ie \emph{latent} variables) to a posterior. Our goal is to release an approximation to the posterior that preserves privacy. We adopt the formalism of \emph{differential privacy} to characterise how easy it is for \Adv{} to discover facts about the \emph{individual} data from the \emph{aggregate} posterior. Releasing the posterior permits external parties to make further inferences at will. For example, a third-party pharmaceutical might use the released posterior as a prior on the efficacy of drugs, and update it with their own patient data. Or they could form a predictive posterior for classification or regression, all while preserving differential privacy of the original data.
Our focus in this paper is Bayesian inference in \emph{probabilistic graphical models} (PGMs), which are popular as a tool for modelling conditional independence assumptions. Similar to the effect on statistical and computational efficiency of non-private inference, a central tenet of this paper is that independence structure should impact privacy. \emph{Our mechanisms and theoretical bounds are the first to establish such a link between PGM graph structure and privacy.}
\paragraph{Main Contributions.}
We develop the first mechanisms for Bayesian inference on the flexible PGM framework (\cf Table~\ref{tab:summary}). We propose two posterior perturbation mechanisms for networks with likelihood functions from exponential families and conjugate priors, that add Laplace noise~\cite{Dwork06} to posterior parameters (or their Fourier coefficients) to preserve privacy. The latter achieves stealth through consistent posterior updates. For general Bayesian networks, posteriors may be non-parametric. In this case, we explore a mechanism~\cite{alt:robust} which samples from the posterior to answer queries---no additional noise is injected.
We complement our study with a maximum \emph{a posteriori} estimator that leverages the exponential mechanism~\cite{MechDesign}. Our utility and privacy bounds connect privacy and graph/dependency structure, and are complemented by illustrative experiments with Bayesian na\"ive Bayes and linear regression.
\paragraph{Related Work.}
Many individual learning algorithms have been adapted to maintain differential privacy, including regularised logistic regression~\cite{ChaudhuriM08}, the SVM~\cite{privateSVM,dpERM}, PCA~\cite{NIPS2012_4565}, the functional mechanism~\cite{zhang2012functional} and trees~\cite{5360518}.
Probabilistic graphical models have been used to preserve privacy. \citet{zhang2014privbayes} learned a graphical model from data, in order to generate \emph{surrogate data} for release; while \citet{ProbInfDP} fit a model to the response of private mechanisms to clean up output and improve accuracy. \citet{xiao2012bayesian} similarly used Bayesian credible intervals to increase the utility of query responses.
Little attention has been paid to private inference in the Bayesian setting. We seek to adapt Bayesian inference to preserve differential privacy when releasing posteriors. \citeauthor{alt:robust}~(\citeyear{alt:robust};~\citeyear{arxiv:robust}) introduce a differentially-private mechanism for Bayesian inference based on posterior sampling---a mechanism on which we build---while \citet{472366} considers further refinements.
\citet{DBLP:journals/corr/WangFS15} explore Monte Carlo approaches to Bayesian inference using the same mechanism, while \citet{mir2012differentially} was the first to establish differential privacy of the Gibbs estimator~\cite{MechDesign} by minimising risk bounds.
This paper is the first to develop mechanisms for differential privacy under the general framework of Bayesian inference on multiple, dependent r.v.'s. Our mechanisms consider graph structure and include a purely Bayesian approach that only places conditions on the prior. We show how the (stochastic) Lipschitz assumptions of \citet{alt:robust} lift to graphs of r.v.'s, and bound KL-divergence when releasing an empirical posterior based on a modified prior. While~\citet{dpERM} achieve privacy in regularised Empirical Risk Minimisation through objective randomisation, we do so through conditions on priors. We develop an alternate approach that uses the additive-noise mechanism of~\citet{Dwork06} to perturb posterior parameterisations; and we apply techniques due to~\citet{Barak2007}, who released marginal tables that maintain consistency in addition to privacy, by adding Laplace noise in the Fourier domain. Our motivation is novel: we wish to guarantee privacy against omniscient attackers and stealth against unsuspecting third parties.
\begin{table*}
\centering
\resizebox{1.0\linewidth}{!}{
\begin{tabular}{| l | c | p{5.0cm} | p{4.0cm} | l |}
\hline
&\textbf{DBN only} & \textbf{Privacy} & \textbf{Utility type} & \textbf{Utility bound}\\
\hline
Laplace & \ding{51} & $(\epsilon, 0)$ & closeness of posterior&$\bigoh{m n\ln n}\left[1-\exp\left(-\frac{n\epsilon}{2|\I|}\right)\right]+\sqrt{-\bigoh{m n\ln n}\ln\delta}$ \\ \hline
Fourier & \ding{51} & $(\epsilon, 0)$ & close posterior params & $\frac{4|\dclose|}{\epsilon} \left(2^{|\pi_i|}\log\frac{|\dclose|}{\delta} + t |\dclose|\right)$\\ \hline
Sampler & \ding{55} & $(2L, 0)$ if Lipschitz; or\ \ \ \linebreak[4] $(0, \sqrt{M/2}$) stochastic Lipschitz & expected utility functional wrt posterior & $\bigoh{\eta + \sqrt{\ln (1/\delta)/N}}$ \cite{arxiv:robust}\\ \hline
MAP & \ding{55} & $(\epsilon, 0)$ & closeness of MAP & $\Pr(S^{c}_{2t})\leq \exp(-\epsilon t)/\pri{S_{t}}$\\
\hline
\end{tabular}
}
\caption{Summary of the privacy/utility guarantees for this paper's mechanisms. See below for parameter definitions.}
\label{tab:summary}
\end{table*}
\section{Problem Setting}
Consider a Bayesian statistician \Bay{} estimating the parameters $\vparam$ of some family of distributions $\family = \cset{p_{\vparam}}{\vparam \in \Params}$ on a system of r.v.'s $\v{X}=\cset{X_i}{i \in \I}$, where $\I$ is an index set, with
observations denoted $x_i\in \X_i$, where $\X_{i}$ is the sample space of $X_{i}$.
\Bay{} has a prior distribution\footnote{Precisely, a probability measure on a $\sigma$-algebra $(\Params_i,\field{\Params_i})$.} $\bel$ on $\Params$ reflecting her prior belief, which she updates on an observation $\v{x}$ to obtain posterior
\begin{align*}
\bel(B \mid \v{x})&=\frac{\int_{B}\lih{\vparam}{\v{x}} \dd\pri{\vparam}}{\phi(\v{x})},\enspace \forall B\in\field{\Params}
\end{align*}
where $\phi(\v{x})\triangleq\int_{\Params}\lih{\vparam}{\v{x}}d\pri{\vparam}$.
Posterior updates are iterated over an \iid dataset $\data\in \mathcal{D}=(\prod_{i} \X_{i})^{n}$ to
$\bel(\cdot \mid \data)$.
\Bay{}'s goal is to communicate her posterior distribution to a third party \Adv{}, while limiting the information revealed about the original data.
From the point of view of the data provider, \Bay{} is a trusted party.\footnote{Cryptographic tools for untrusted \Bay{} do not prevent information leakage to \Adv{} \cf \eg \cite{pagning:indocrypt:2014}.}
However, she may still inadvertently reveal information.
We assume that \Adv{} is computationally unbounded, and has knowledge of the prior $\bel$ and the family $\family$.
To guarantee that \Adv{} can gain little additional information about $\data$ from their communication, \Bay{} uses Bayesian inference to learn from the data, and a differentially-private posterior to ensure disclosure to \Adv{} is carefully controlled.
\subsection{Probabilistic Graphical Models}
Our main results focus on PGMs which model conditional independence assumptions with joint factorisation
\[
p_{\vparam}(\v{x}) = \prod_{i \in \I} \lih{\vparam}{x_i\mid x_{\pi_i}},
\quad
x_{\pi_i} = \cset{x_j}{j \in \pi_i}\enspace,
\]
where
$\pi_i$ are the parents of the $i$-th variable in a Bayesian network---a
directed acyclic graph with r.v.'s as nodes.
\begin{ex}\label{ex:boolean}
For concreteness, we illustrate some of our mechanisms on systems of Bernoulli r.v.'s $X_i\in\{0,1\}$. In that case, we represent the conditional distribution of $X_i$ given its parents as Bernoulli with parameters $\param_{i,j} \in [0,1]$ :
\[
(X_i \mid X_{\pi_i} = j) \sim \Bernoulli(\param_{i,j})\enspace.
\]
The choice of conjugate prior $\bel(\vparam) = \prod_{i,j} \bel_{i,j}(\param_{i,j})$ has Beta marginals with parameters $\alpha_{i,j}, \beta_{i,j}$, so that:
\[
(\param_{i,j} \mid \alpha_{i,j} = \alpha, \beta_{i,j} = \beta)
\sim
\Beta(\alpha, \beta)\enspace.
\]
Given observation $\v{x}$, the updated posterior Beta parameters are $\alpha_{i,j} := \alpha_{i,j} + x_{i}$ and $\beta_{i,j} := \beta_{i,j} + (1 - x_{i})$ if $x_{\pi_i} = j$.
\label{ex:beta}
\end{ex}
\subsection{Differential Privacy}
\Bay{} communicates to \Adv{} by releasing information about the posterior distribution, via randomised mechanism $M$ that maps dataset $\data\in\mathcal{D}$ to a response in set $\CY$. \citet{Dwork06} characterise when such a mechanism is private:
\begin{defn}[Differential Privacy]
A randomised mechanism $M : \CD \to \CY $ is $(\epsilon, \delta)$-DP if for any \emph{neighbouring} $\data, \tilde{\data} \in \CD$, and measurable $B \subseteq \CY$:
\[
\Pr[M(\data)\in B]\leq e^{\epsilon} \Pr[M(\tilde{\data})\in B] + \delta,
\]
where $\data = (\v{x}^i)_{i=1}^n$, $\tilde{\data} = (\tilde{\v{x}}^i)_{i=1}^n$ are neighbouring if $\v{x}^i \neq \tilde{\v{x}}^i$ for at most one $i$.
\label{def:differential-privacy}
\end{defn}
This definition requires that neighbouring datasets induce similar response distributions. Consequently, it is impossible for \Adv{} to identify the true dataset from bounded mechanism query responses. Differential privacy assumes no bounds on adversarial computation or auxiliary knowledge.
\section{Privacy by Posterior Perturbation}
One approach to differential privacy is to use additive Laplace noise~\citep{Dwork06}. Previous work has focused on the addition of noise directly to the outputs of a non-private mechanism. We are the first to apply Laplace noise to the posterior parameter updates.
\subsection{Laplace Mechanism on Posterior Updates}
Under the setting of Example~\ref{ex:beta}, we can add Laplace noise to the posterior parameters. Algorithm~\ref{alg:laplace} releases perturbed parameter updates for the Beta posteriors, calculated simply by \emph{counting}.
\begin{algorithm}[htb]
\begin{algorithmic}[1]
\STATE \textbf{Input} data \data; graph $\I, \{\pi_i\mid i\in\I\}$; parameter $\epsilon>0$
\STATE calculate posterior updates: $\Delta\alpha_{i,j}, \Delta\beta_{i,j}$ for all \\ $i\in\I, j\in \{0,1\}^{|\pi_{i}|}$
\STATE perturb updates: $\Delta\alpha'_{i,j} \triangleq \Delta\alpha_{i,j} + \lap{\frac{2|\I|}{\epsilon}}$, \\ $\Delta\beta'_{i,j} \triangleq \Delta\beta_{i,j} + \lap{\frac{2|\I|}{\epsilon}}$.
\STATE truncate: $Z^{(1)}_{i,j} \triangleq \mathbf{1}_{[0,n]}(\Delta\alpha'_{i,j}), Z^{(2)}_{i,j} \triangleq \mathbf{1}_{[0,n]}(\Delta\beta'_{i,j})$
\STATE output $\v{Z}_{i,j}=(Z^{(1)}_{i,j}, Z^{(2)}_{i,j})$
\end{algorithmic}
\caption{Laplace Mechanism on Posterior Updates \label{alg:laplace}}
\end{algorithm}
It then adds zero-mean Laplace-distributed noise to the updates $\Delta\v{\omega}=(\cdots, \Delta\alpha_{i,j}, \Delta\beta_{i,j}, \cdots)$. This is the final dependence on \data. Finally, the perturbed updates $\Delta\v{\omega}'$ are truncated at zero to rule out invalid Beta parameters and are upper truncated at $n$. This yields an upper bound on the raw updates and facilitates an application of McDiarmid's bounded-differences inequality
\iftoggle{fullpaper}{(\cf Lemma~\ref{McDiarmid} in the Appendix)}{(\cf full report~\citenop{arxiv:full})}
in our utility analysis. Note that this truncation only improves utility (relative to the utility pre-truncation), and does not affect privacy.
\paragraph{Privacy.}
To establish differential privacy of our mechanism, we must calculate a Lipschitz condition for the vector $\v{\Delta\omega}$ called \term{global sensitivity}~\cite{Dwork06}.
\begin{lemma}\label{lemma:laplace-gs}
For any \emph{neighbouring} datasets $\data,\tilde{\data}$, the corresponding updates $\Delta\v{\omega},\Delta\tilde{\v{\omega}}$ satisfy $\left\|\Delta\v{\omega}-\Delta\tilde{\v{\omega}}\right\|_1\leq 2|\I|$.
\end{lemma}
\begin{proof}
By changing the observations of one datum, at most two counts associated with each $X_{i}$ can change by 1.
\end{proof}
\begin{cor}
Algorithm~\ref{alg:laplace} preserves $\epsilon$-differential privacy.
\end{cor}
\begin{proof}
Based on Lemma~\ref{lemma:laplace-gs}, the intermediate $\Delta\v{\omega}'$ preserve $\epsilon$-differential privacy~\cite{Dwork06}. Since truncation depends only on $\Delta\v{\omega}'$, the $\v{Z}$ preserves the same privacy.
\end{proof}
\paragraph{Utility on Updates.}
Before bounding the effect on the posterior of the Laplace mechanism, we demonstrate a utility bound on the posterior update counts.
\begin{prop}\label{prop:laplace-util-updates}
With probability at least $1-\delta$, for $\delta\in(0,1)$, the update counts computed by Algorithm~\ref{alg:laplace} are close to the non-private counts
$$\left\|\Delta\v{\omega}-\Delta\v{\omega}'\right\|_{\infty}\leq \frac{{2|\I|}}{\epsilon}\ln\left(\frac{2m}{\delta}\right)\enspace,$$
where $m=\sum_{i\in I}2^{|\pi_{i}|}.$
\end{prop}
This bound states that w.h.p., none of the updates can be perturbed beyond $O(|\I|^{2}/\epsilon)$.
This implies the same bound on the deviation between $\Delta\v{\omega}$ and the revealed truncated $\v{Z}$.
\paragraph{Utility on Posterior.}
We derive our main utility bounds for Algorithm~\ref{alg:laplace} in terms of posteriors, proved in the
\iftoggle{fullpaper}{Appendix}{full report~\cite{arxiv:full}}.
We abuse notation, and use $\bel$ to refer to the prior density; its meaning will be apparent from context.
Given priors
$\bel_{i,j}(\theta_{i,j})=\bet{\alpha_{i,j}}{\beta_{i,j}}$,
the posteriors on $n$ observations are
\begin{equation}
\bel_{i,j}(\theta_{i,j}|D)=\Beta(\alpha_{i,j}+\Delta\alpha_{i,j},\beta_{i,j}+\Delta\beta_{i,j})\enspace.\nonumber
\end{equation}
The privacy-preserving posterior parametrised by the output of Algorithm~\ref{alg:laplace} is $$\bel'_{i,j}(\theta_{i,j}|D)=\Beta\left(\alpha_{i,j}+Z^{(1)}_{i,j},\beta_{i,j}+Z^{(2)}_{i,j}\right)\enspace.$$
It is natural to measure utility by the KL-divergence between the joint product posteriors $\bel(\v{\theta}|D)$ and $\bel'(\v{\theta}|D)$, which is the sum of the component-wise divergences, with each having known closed form.
\iffalse
\begin{eqnarray*}
&&D_{KL}(\bel_{i,j}(\theta_{i,j}|D)||\bel_{i,j}'(\theta_{i,j}|D))\\
&=&\ln\left(\frac{\Gamma(\alpha_{i,j}+\Delta\alpha_{i,j})\Gamma(\beta_{i,j}+\Delta\beta_{i,j})}{\Gamma(\alpha_{i,j}+Z^{(1)}_{i,j})\Gamma(\beta_{i,j}+Z^{(2)}_{i,j})}\right)\\
&&\ \ +(\Delta\alpha_{i,j}-Z^{(1)}_{i,j})\psi(\alpha_{i,j}+\Delta\alpha_{i,j})\\
&&\ \ +(\Delta\beta_{i,j}-Z^{(2)}_{i,j})\psi(\beta_{i,j}+\Delta\beta_{i,j})
\end{eqnarray*}
where $\psi(x)=\frac{\Gamma'(x)}{\Gamma(x)}$ is the digamma function.
\fi
In our analysis, the divergence is a random quantity, expressible as the sum
$\sum_{i,j}^{m}f_{i,j}(\v{Z}_{i,j})$, where the randomness is due to the added noise.
We demonstrate this r.v. is not too big, w.h.p.
\begin{thm}\label{thm:McDiarmid}
Let $m=\sum_{i\in \I}2^{|\pi_{i}|}$. Assume that $Z_{i,j}$ are independent and $f$ is a mapping from $\mathcal{Z}^{m}$ to $\mathbb{R}$: $f(\cdots, \v{z}_{i,j}, \cdots)\triangleq\sum_{i,j} f_{i,j}(\v{z}_{i,j})$.
Given $\delta>0$, we have
\begin{align*}
\Pr\left[f(\v{Z})\geq \E(f(\v{Z}))+\left(-\frac{1}{2}\sum_{i,j}c_{i,j}\ln\delta\right)^{\frac{1}{2}}\right]\leq \delta
\end{align*}
where $c_{i,j}\leq (2n+1)\ln[(\alpha_{i,j}+n+1)+(\beta_{i,j}+n+1))$ and $\E(f_{i,j}(\v{Z}_{i,j})]\leq n\ln((\alpha_{i,j}+\Delta\alpha_{i,j})(\beta_{i,j}+\Delta\beta_{i,j}))=\mathcal{U}$. \\
Moreover, when $n\geq b=\frac{2|\I|}{\epsilon}$, the bound for expectation can be refined as the following
\begin{align*}
\ln[(\alpha_{i,j}+n+1)(\beta_{i,j}+n+1)]\left(\frac{n}{2}\exp\left(-\frac{n\epsilon}{2|\I|}\right)\right)\enspace.
\end{align*}
The loss of utility measured by KL-divergence is no more than
$$\bigoh{m n\ln n}\left[1-\exp\left(-\frac{n\epsilon}{2|\I|}\right)\right]+\sqrt{-\bigoh{m n\ln n}\ln\delta}$$
with probability at least $1-\delta$.
\end{thm}
Note that $m$ depends on the structure of the network: bounds are better for networks with an underlying graph having smaller average in-degree.
\subsection{Laplace Mechanism in the Fourier Domain}
Algorithm~\ref{alg:laplace} follows \term{Kerckhoffs's Principle}~\cite{Kerckoffs} of ``no security through obscurity'': differential privacy defends against a mechanism-aware attacker. However \emph{additional stealth} may be required in certain circumstances. An oblivious observer will be tipped off to our privacy-preserving activities by our independent perturbations, which are likely inconsistent with one-another (\eg noisy counts for $X_1,X_2$ and $X_2,X_3$ will say different things about $X_2$). To achieve differential privacy and stealth, we turn to \citet{Barak2007}'s study of consistent marginal contingency table release. This section presents a particularly natural application to Bayesian posterior updates.
Denote by $\ctab\in\mathbb{R}^{\{0,1\}^{|\I|}}$ the \term{contingency table} over r.v.'s \I induced by \data: \ie for each combination of variables $j\in\{0,1\}^{|\I|}$, component or \term{cell} $\ctab_j$ is a non-negative count of the observations in \data with characteristic $j$. Geometrically \ctab is a real-valued function over the $|\I|$-dimensional Boolean hypercube. Then the parameter delta's of our first mechanism correspond to cells of $(|\pi_i|+1)$-way marginal contingency tables $\proj{\extpar{i}}{\ctab}$ where vector $\extpar{i}\triangleq\pi_i+e_i$ and the projection/marginalisation operator is defined as
\begin{eqnarray}
\left(\proj{j}{\ctab}\right)_\gamma &\triangleq& \sum_{\eta : \langle\eta,j\rangle=\gamma} h_\eta\enspace. \label{eq:proj}
\end{eqnarray}
We wish to release these statistics as before, however we will not represent them under their Euclidean coordinates but instead in the Fourier basis $\{f^j : j\in\{0,1\}^{|\I|}\}$ where
\begin{eqnarray*}
f^j_\gamma &\triangleq& (-1)^{\langle\gamma,j\rangle} 2^{-|\I|/2}\enspace.
\end{eqnarray*}
Due to this basis structure and linearity of the projection operator, any marginal contingency table must lie in the span of few projections of Fourier basis vectors~\cite{Barak2007}:
\begin{thm}
For any table $\ctab\in\mathbb{R}^{\{0,1\}^{|\I|}}$ and set of variables $j\in\{0,1\}^{|\I|}$, the marginal table on $j$ satisfies $\proj{j}{\ctab}=\sum_{\gamma\preceq j}\left\langle f^\gamma,\ctab\right\rangle\proj{j}{f^\gamma}$.
\end{thm}
This states that marginal $j$ lies in the span of only those (projected) basis vectors $f^\gamma$ with $\gamma$ contained in $j$. The number of values needed to update $X_i$ is then $2^{|\pi_i|+1}$, potentially far less than suggested by~\eqref{eq:proj}. To release updates for two r.v.'s $i,j\in\I$ there may well be significant overlap $\langle\extpar{i}, \extpar{j}\rangle$; we need to release once, coefficients $\langle f^\gamma,\ctab\rangle$ for $\gamma$ in the downward closure of variable neighbourhoods:
\begin{eqnarray*}
\dclose &\triangleq& \bigcup_{i\in\I}\bigcup_{j\preceq \extpar{i}} j\enspace.
\end{eqnarray*}
\paragraph{Privacy.}
By~\cite[Theorem~6]{Barak2007} we can apply Laplace additive noise to release these Fourier coefficients.
\begin{cor}\label{cor:fourier-privacy}
For any $\epsilon>0$, releasing for each $\gamma\in \dclose$ the Fourier coefficient $\langle f^\gamma, \ctab\rangle+\lap{2|\dclose|\epsilon^{-1}2^{-|\I|/2}}$ (and Algorithm~\ref{alg:fourier}) preserves $\epsilon$-differential privacy.
\end{cor}
\begin{rem}
Since $|\dclose|\leq|\I|2^{1+\max_{i\in\I}\indeg{i}}$, at worst we have noise scale
\[
|\I| 2^{2+\max_i\indeg{i}-|\I|/2}/\epsilon.
\] This compares favourably with Algorithm~\ref{alg:laplace}'s noise scale provided no r.v. is child to more than half the graph. Moreover the denser the graph---the more overlap between nodes' parents and the less conditional independence assumed---the greater the reduction in scale. This is intuitively appealing.
\end{rem}
\paragraph{Consistency.} What is gained by passing to the Fourier domain, is that the perturbed marginal tables of Corollary~\ref{cor:fourier-privacy} are consistent: anything in the span of projected Fourier basis vectors corresponds to some valid contingency table on $\I$ with (possibly negative) real-valued cells~\cite{Barak2007}.
\begin{algorithm}[htb]
\begin{algorithmic}[1]
\STATE \textbf{Input} data \data; graph $\I, \{\pi_i\mid i\in\I\}$; prior parameters $\v{\alpha},\v{\beta}\succeq \v{0}$; parameters $t,\epsilon>0$
\STATE define contingency table $h\in\mathbb{R}^{\{0,1\}^{|\I|}}$ on \data
\STATE define downward closure $\dclose=\bigcup_{i\in\I}\bigcup_{j\preceq \extpar{i}}j$
\FOR{$\gamma\in\dclose$}
\STATE Fourier coefficient $z_\gamma=\langle f^\gamma, h\rangle + \lap{\frac{2|\dclose|}{\epsilon 2^{|\I|/2}}}$
\ENDFOR
\STATE increment first coefficient $z_{\v{0}}\leftarrow z_{\v{0}} + \frac{4 t |\dclose|^2}{\epsilon 2^{|\I|/2}}$
\FOR{$i\in\I$}
\STATE project marginal for $X_i$ as $h^i = \sum_{\gamma\preceq\extpar{i}} z_\gamma \proj{\extpar{i}}{f^\gamma}$
\FOR{$j\preceq \pi_i$}
\STATE output posterior param $\left(\alpha_{ij}+ h^i_{e_i+ j}, \beta_{ij}+ h^i_j\right)$
\ENDFOR
\ENDFOR
\end{algorithmic}
\caption{Laplace Mechanism in the Fourier Domain \label{alg:fourier}}
\end{algorithm}
\paragraph{Non-negativity.} So far we have described the first stage of Algorithm~\ref{alg:fourier}. The remainder yields \term{stealth} by guaranteeing releases that are non-negative w.h.p.
We adapt an idea of \citet{Barak2007} to increase the coefficient of Fourier basis vector $f^{\v{0}}$, affecting a small increment to each cell of the contingency table. While there is an exact minimal amount that would guarantee non-negativity, it is data dependent. Thus our efficient $\bigoh{|\dclose|}$-time approach is randomised.
\begin{cor}
For $t>0$, adding $4 t |\dclose|^2 \epsilon^{-1} 2^{-k/2}$ to $f^{\v{0}}$'s coefficient induces a non-negative table w.p. $\geq 1-\exp(-t)$.
\end{cor}
Parameter $t$ trades off between the probability of non-negativity and the resulting (minor) loss to utility.
In the rare event of negativity, re-running Algorithm~\ref{alg:fourier} affords another chance of stealth at the cost of privacy budget $\epsilon$. We could alternatively truncate to achieve validity, sacrificing stealth but not privacy.
\paragraph{Utility.} Analogous to Proposition~\ref{prop:laplace-util-updates}, each perturbed marginal is close to its unperturbed version w.h.p.
\begin{thm}\label{thm:fourier-utility}
For each $i\in\I$ and $\delta\in(0,1)$, the perturbed tables in Algorithm~\ref{alg:fourier} satisfy with probability at least $1-\delta$:
\begin{eqnarray*}
\left\|\proj{\extpar{i}}{h} - h^i\right\|_1 &\leq& \frac{4|\dclose|}{\epsilon} \left(2^{|\pi_i|}\log\frac{|\dclose|}{\delta} + t |\dclose|\right)\enspace.
\end{eqnarray*}
\end{thm}
Note that the scaling of this bound is reasonable since the table $h^i$ involves $2^{|\pi_i|+1}$ cells.
\section{Privacy by Posterior Sampling}
For general Bayesian networks, \Bay{} can release samples from the posterior~\cite{alt:robust} instead of perturbed samples of the posterior's parametrisation. We now develop a calculus of building up (stochastic) Lipschitz properties of systems of r.v.'s that are locally (stochastic) Lipschitz. Given smoothness of the entire network, differential privacy and utility of posterior sampling follow.
\subsection{(Stochastic) Lipschitz Smoothness of Networks}
The distribution family $\{p_{\theta}:\theta\in \Theta\}$ on outcome space $\mathcal{S}$, equipped with pseudo metric\footnote{Meaning that $\rho(x,y)=0$ does not necessarily imply $x=y$.} $\rho$, is \term{Lipschitz continuous} if
\begin{assumption}[Lipschitz Continuity]
\label{ass:hoelder-observations}
Let $d(\cdot, \cdot)$ be a metric on $\mathbb{R}$. There exists $L>0$ such that, for any $\theta\in \Theta$:
\begin{align*}
d(p_{\theta}(x), p_{\theta}(y)) \leq L\rho(x,y), \forall x,y\in \mathcal{S}.
\end{align*}
\end{assumption}
We fix the distance function $d$ to be the absolute log-ratio (\cf differential privacy).
Consider a general Bayesian network. The following lemma shows that the individual Lipschitz continuity of the conditional likelihood at every $i\in{\I}$ implies the global Lipschitz continuity of the network.
\begin{lemma}\label{lemma:Lip-Con}
If there exists $\v{L}=(L_{1}, \cdots, L_{|\I|})\geq\v{0}$ such that $\forall i\in \I$, $\forall\v{x}, \v{y} \in \X= \prod^{|\I|}_{i=1} \X_{i}$ we have $d(p_{\v{\theta}}(x_{i}|x_{\pi_{i}}), p_{\v{\theta}}(y_{i}|y_{\pi_{i}}))\leq L_{i}\rho_{i}(x_{i},y_{i})$,
then $d(p_{\v{\theta}}(\v{x}), p_{\v{\theta}}(\v{y})) \leq \| \v{L}\|_{\infty} \v{\rho}(\v{x},\v{y})$ where $\v{\rho}(\v{x},\v{y})=\sum^{|I|}_{i=1}\rho_{i}(x_{i}, y_{i})$.
\end{lemma}
Note that while Lipschitz continuity holds uniformly for some families \eg the exponential distribution, this is not so for many useful distributions such as the Bernoulli. In such cases a relaxed assumption requires that the prior be concentrated on smooth regions.
\begin{assumption}[Stochastic Lipschitz Continuity]
\label{ass:hoelder-measure-observations}
Let the set of $L$-Lipschitz $\param$ be $$\Theta_{L}\triangleq \left\{\theta\in \Theta: \sup_{x,y\in \mathcal{S}}\{d(p_{\theta}(x), p_{\theta}(y)) - L\rho(x, y)\} \leq 0 \right\}$$ Then there exists constants $c, L_{0}>0$ such that, $\forall L\geq L_{0}$: $\xi(\Theta_{L})\geq 1-e^{-cL}.$
\end{assumption}
\begin{lemma}\label{lemma:Sto-Lip-Con}
For the conditional likelihood at each node $i\in\I$, define the set ${\Theta}_{i, L}$ of parameters for which Lipschitz continuity holds with Lipschitz constant $L$.
If $\exists \v{c}=(c_{1}, \cdots, c_{|\I|})$ such that $\forall i, L\geq L_{0}$,
$\xi(\Theta_{i, L})\geq 1-e^{-c_{i}L}$, then
$\xi(\Theta_{L})\geq 1-e^{-c'L},$ where $c'=\min_{i\in \I} c_{i}-\ln{|\I|}/L_{0}$ when $|\I|\leq e^{L_0\min_{i\in\I} c_{i}}$.
\end{lemma}
Therefore, \cite[Theorem 7]{arxiv:robust} asserts differential privacy of the Bayesian network's posterior.
\begin{thm}\label{thm:sampler-dp}
Differential privacy is satisfied using the log-ratio distance, for all $B\in \field{\Params}$ and $\v{x},\v{y}\in\v{\X}$:
\begin{enumerate}
\item Under the conditions in Lemma~\ref{lemma:Lip-Con}:
$$\bel(B \mid \v{x}) \leq \exp\{ 2L \v{\rho}(\v{x},\v{y}) \} \bel(B \mid \v{y})$$
\ie the posterior $\bel$ is
$(2 \| \v{L}\|_{\infty}, 0)$-differentially private under pseudo-metric $\v{\rho}(\v{x},\v{y})$.
\item Under the conditions in Lemma~\ref{lemma:Sto-Lip-Con}, if $\v{\rho}(\v{x},\v{y})\leq (1-\delta)c$ uniformly for all $\v{x}, \v{y}$ for some $\delta\in(0,1)$:
$$\abs{\bel(B \mid \v{x}) - \bel(B \mid \v{y})} \leq \sqrt{\frac{M}{2} \cdot \max\{\v{\rho}(\v{x},\v{y}),1\}}$$
where $M=\left(\frac{\kappa}{c}+L_{0}(\frac{1}{1-e^{-\omega}}+1)+\ln{C}\right.$ $\left.+\ln\left(e^{-L_{0}\delta c}(e^{-\omega(1-\delta)}-e^{-\omega})^{-1}+e^{L_{0}(1-\delta)c}\right)\right)C$; constants $\kappa=4.91081$ and $\omega=1.25643$; $C=\prod^{|I|}_{i}C_{i}$; and
\begin{eqnarray*}
C_i &=& \sup_{\v{x}\in\v{\X}}\frac{p_{\theta^\star_{i,\mathrm{MLE}}}(x_i\mid x_{\pi_i})}{\int_{\Theta_i} p_{\theta_i}(x_i\mid x_{\pi_i}) d\xi(\theta_i)}\enspace,
\end{eqnarray*}
the ratio between the maximum and marginal likelihoods of each likelihood function.
Note that $M=\bigoh{\left(\frac{1}{c}+\ln{C}+L_{0}\right)C}$
\ie the posterior $\bel$ is
$\left(0, \sqrt{\frac{M}{2}}\right)$-differentially private under pseudo-metric $\sqrt{\v{\rho}}$ for $\v{\rho}(\v{x},\v{y})\geq 1$.
\end{enumerate}
\end{thm}
\subsection{MAP by the Exponential Mechanism}
As an application of the posterior sampler, we
now turn to releasing
MAP point estimates via the exponential mechanism~\cite{MechDesign}, which samples responses from a likelihood exponential in some score function. By selecting a utility function that is maximised by a target non-private mechanism, the exponential mechanism can be used to privately approximate
that target with high utility. It is natural then to select as our utility $\util$ the posterior likelihood $\pri{\cdot|\data}$.
This $\util$ is maximised by the MAP estimate.
\begin{algorithm}[htb]
\begin{algorithmic}[1]
\STATE \textbf{Input} data \data; prior $\pri{\cdot}$; appropriate smoothness parameters $c, L, M>0$; parameters distance $r>0$, privacy $\epsilon>0$
\STATE calculate posterior $\pri{{\param}|\data}$
\STATE set $\Delta = \begin{cases} \sqrt{L r}\ , & \mbox{if Lipschitz continuous} \\\sqrt{0.5 M}\ , & \mbox{if stochastic Lipschitz}\end{cases}$
\STATE output $\hat{\param}$ sampled $\propto\exp\left(\frac{\epsilon\pri{\param|\data}}{2\Delta}\right) \pri{\param}$
\end{algorithmic}
\caption{Mechanism for MAP Point Estimates \label{alg:map}}
\end{algorithm}
Formally, Algorithm~\ref{alg:map}, under the assumptions of Theorem~\ref{thm:sampler-dp}, outputs response $\param$ with probability proportional to $\exp(\epsilon \util(D,\param) / 2\Delta)$ times a base measure $\mu(\param)$. Here $\Delta$ is a Lipschitz coefficient for $\util$ with sup-norm on responses and pseudo-metric ${\rho}$ on datasets as in the previous section.
Providing the base measure is non-trivial in general, but for discrete finite outcome spaces can be uniform~\cite{MechDesign}. For our mechanism to be broadly applicable, we can safely take $\mu(\param)$ as $\pri{\param}$.\footnote{In particular the base measure guarantees we have a proper density function: if $\util(D,\param)$ is bounded by $M$, then we have normalising constant $\int_{\param}{\exp(\epsilon \util(D,\param))\mu(\param)d\param}\leq\exp(M\epsilon)<\infty.$}
\begin{figure*}[t!]
\begin{minipage}[t]{.49\textwidth}
\centering
\includegraphics[width=0.95\textwidth]{DNB_16_var-accuracy-eps.pdf}
\caption{Effect on Bayesian na\"ive Bayes predictive-posterior accuracy of varying the privacy level.}
\label{fig:map-bound}
\end{minipage}\hfill
\begin{minipage}[t]{.49\textwidth}
\centering
\includegraphics[width=0.95\linewidth]{lr-mse-samplerate.pdf}
\caption{Effect on linear regression of varying prior concentration. Bands indicate standard error over repeats.}
\label{fig:census}
\end{minipage}\\%\hfill
\end{figure*}
\begin{cor}
Algorithm~\ref{alg:map} preserves $\epsilon$-differential privacy wrt pseudo-metric $\rho$ up to distance $r>0$.
\end{cor}
\begin{proof}
The sensitivity of the posterior score function corresponds to the computed $\Delta$~\cite[Theorem 6]{arxiv:robust} under either Lipschitz assumptions. The result then follows from \cite[Theorem 6]{MechDesign}.
\end{proof}
Utility for Algorithm~\ref{alg:map} follows from \cite{MechDesign}, and states that the posterior likelihood of responses is likely to be close to that of the MAP.
\begin{lemma}\label{lemma:map-utility}
Let $\param^\star=\max_\param \pri{\param|\data}$ with maximizer the MAP estimate, and let
$S_{t}=\{\param\in\Theta : \pri{\param|\data} > \param^\star -t\}$ for $t>0$. Then $\Pr(S^{c}_{2t})\leq \exp(-\epsilon t)/\pri{S_{t}}$.
\end{lemma}
\section{Experiments}
Having proposed a number of mechanisms for approximating exact Bayesian inference in the general framework of probabilistic graphical models, we now demonstrate our approaches on two simple, well-known PGMs: the (generative) na\"ive Bayes classifier, and (discriminative) linear regression. This section, with derivations in the
\iftoggle{fullpaper}{Appendix,}{full report~\cite{arxiv:full},}
illustrates how our approaches are applied, and supports our extensive theoretical results with experimental observation. We focus on the trade-off between privacy and utility (accuracy and MSE respectively), which involves the (private) posterior via a predictive posterior distribution in both case studies.
\subsection{Bayesian Discrete Na\"ive Bayes}
An illustrative example for our mechanisms is a Bayesian na\"ive Bayes model on Bernoulli class $Y$ and attribute variables $X_i$, with full conjugate Beta priors. This PGM directly specialises the running Example~\ref{ex:boolean}.
We synthesised data generated from a na\"ive Bayes model, with $16$ features and $1000$ examples. Of these we trained our mechanisms on only $50$ examples, with uniform Beta priors. We formed predictive posteriors for $Y|\v{X}$ from which we thresholded at 0.5 to make classification predictions on the remaining, unseen test data so as to evaluate classification accuracy. The results are reported in Figure~\ref{fig:map-bound}, where average performance is taken over 100 repeats to account for randomness in train/test split, and randomised mechanisms.
\emph{The small size of this data represents a challenge in our setting, since privacy is more difficult to preserve under smaller samples~\cite{Dwork06}.} As expected, privacy incurs a sacrifice to accuracy for all private mechanisms.
For both Laplace mechanisms that perturb posterior updates, note that the
$d$ Boolean attributes and class label (being sole parent to each) yields nodes $|\I|=d+1$ and downward closure size $|\dclose|=2d+2$. Following our generic mechanisms, the noise added to sufficient statistics is independent on training set size, and is similar in scale. $t$ was set for the Fourier approach, so that stealth was achieved 90\% of the time---those times that contributed to the plot. Due to the small increments to cell counts for Fourier, necessary to achieve its \emph{additional stealth property}, we expect a \emph{small decrease to utility which is borne out in Figure~\ref{fig:map-bound}}.
For the posterior sampler mechanism, while we can apply Assumption~\ref{ass:hoelder-measure-observations} to a Bernoulli-Beta pair to obtain a generalised form of $(\epsilon,\delta)$-differential privacy, we wish to compare with our $\epsilon$-differentially-private mechanisms and so choose a route which satisfies Assumption~\ref{ass:hoelder-observations} as detailed in the
\iftoggle{fullpaper}{Appendix.}{full report~\cite{arxiv:full}.}
We trim the posterior before sampling, so that probabilities are lower-bounded.
Figure~\ref{fig:map-bound} demonstrates that for small $\epsilon$, the minimal probability at which to trim is relatively large resulting in a poor approximate posterior. But past a certain threshold, \emph{the posterior sampler eventually outperforms the other private mechanisms.}
\subsection{Bayesian Linear Regression}
We next explore a system of continuous r.v.'s in Bayesian linear regression, for which our posterior sampler is most appropriate. We model label $Y$ as \iid Gaussian with known-variance and mean a linear function of features, and the linear weights endowed with multivariate Gaussian prior with zero mean and spherical covariance. To satisfy Assumption~\ref{ass:hoelder-observations} we conservatively truncate the Gaussian prior (\cf the
\iftoggle{fullpaper}{Appendix),}{full report~\citenop{arxiv:full}),}
and sample from the resulting truncated posterior; form a predictive posterior; then compute mean squared error. To evaluate our approach we used the U.S. census records dataset from the \emph{Integrated Public Use Microdata Series}~\cite{census} with $370$k records and $14$ demographic features.
To predict \emph{Annual Income}, we train on $10\%$ data with the remainder for testing. Figure~\ref{fig:census} displays MSE under varying prior precision $b$ (inverse of covariance) and weights with bounded norm $10/\sqrt{b}$ (chosen conservatively). As expected, more concentrated prior (larger $b$) leads to worse MSE for both mechanisms, as stronger priors reduce data influence. Compared with linear regression, private regression suffers only slightly worse MSE. At the same time the posterior sampler enjoys increasing privacy (that is proportional to the bounded norm as given in the
\iftoggle{fullpaper}{Appendix).}{full report).}
\section{Conclusions}
We have presented a suite of mechanisms for differentially-private inference in graphical models, in a Bayesian framework. The first two perturb posterior parameters to achieve privacy. This can be achieved either by performing perturbations in the original parameter domain, or in the frequency domain via a Fourier transform. Our third mechanism relies on the choice of a prior, in combination with posterior sampling. We complement our mechanisms for releasing the posterior, with private MAP point estimators. Throughout we have proved utility and privacy bounds for our mechanisms, which in most cases depend on the \emph{graph structure of the Bayesian network: naturally, conditional independence affects privacy.} We support our new mechanisms and analysis with applications to two concrete models, with experiments exploring the privacy-utility trade-off.
\paragraph{Acknowledgements.}
This work was partially supported by the Swiss National Foundation grant ``Swiss Sense Synergy'' \texttt{CRSII2-154458}\iftoggle{fullpaper}{}{, and by the Australian Research Council (\texttt{DE160100584})}.
\iftoggle{fullpaper}
{
| {'timestamp': '2015-12-23T02:05:04', 'yymm': '1512', 'arxiv_id': '1512.06992', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06992'} | arxiv |
\section{Introduction}
\mbox{\includegraphics[height=9em]{state.png}}
A computer program or computing device changes state in discrete steps in response to discrete events.
If $E$ is the set of events and $E^*$ is the set of finite sequences over $E$, then each element
$s\in E^*$ describes a sequence of events that drives a system from an inital state to some \emph{current
state}. An
equation of the form
\[\ul{y} = F(x)\]
where $x$ is a free variable over $E^*$ defines \(\ul{y}\) as a discrete
``state variable". The underline is a mental aid
to remind us that state variables of this sort depend on the sequence parameter.
If \(\ul{y} = F(x)\) and \(\ul{z} = G(x) \) then
\[ \ul{y} < \ul{z}\]
is true if and only if \(F(x) < G(x)\) for all $x\in E^*$. Three operators on these state variables
make it possible to define state variables for large scale state systems while leaving
$F$ and often $E$ implicit. The first is a kind of ``zero". If
$nulls$ is the empty sequence and \( \ul{y} = F(x)\) then \(\mathbf{initial}\ \ul{y} = F(nulls)\). So $\mathbf{initial}\ \ul{y}$
is the initial state value of $\ul{y}$.
The second modifer is like ``add one" - it extends the sequence by one event so that
\( \AFTER{e}\ul{y} = F(x.e)\) where $s.e$ is the sequence obtained by appending event $e$ to
sequence $s$. The
third operator is for substitution and, as shown below, can be used to define state
variables of systems that are constructed by interconnecting parallel components in layers. For
the same $\ul{y}$ let \(\SUB{u}\ul{y} = F(u)\). The fun cases are when $u$ is itself
a state variable. Suppose \(\ul{z}\) is sequence valued in which
case \(\SUB{\ul{z}} \ul{y} = F(\ul{z})= F(G(x))\).
The approach outlined above is built on three components. The first is a conception of state
machines (automata) as maps $F: E^*\to X$ that was mentioned in a number of works from the 1960s but made
explicit in for example Arbib \cite{Arbib} in a slightly different form. Second, Peter \cite{Peter}
defined a class
of primitive recursive word functions that extended primitive recursion on integers to
primitive recursion on words (sequences). This formulation inspires the first two operators - although, it is related to Arbib's sequentiality property. The last operator imports
a general automata product \cite{gecseg} --- perhaps the biggest jump here. The general
product offers a way of abitrarily connecting state machines so that outputs can help
steer inputs. This feeback of outputs is essential for representing how computer components
connect but mainstream automata theory was too entranced by Krohn-Rhodes\cite{Holcombe}
theory to look into it much.
The next section clarifies the state machine and primitive recursive function
basis of the methods. Section \ref{examples} illustrates applications to
simple examples and to reliable message delivery. There is a short final section
on more compact notation -- the limited notation used here is wordier than it needs
to be in an effort to make it more readily comprehensible.
\section{State machines}
Classically, if a map $\gamma$ is defined by a pair
of equations $\gamma(0)=x_0$ and $\gamma(n+1) = \alpha(\gamma(n))$ where $\alpha$ is already defined, we know that
$\gamma$ is well defined on all non-negative integers. This construction is called ``primitive recursion".
Peter\cite{PeterComputer} observed that the same construction works for
finite sequences where appending takes the place of ``add one". So if $F(nulls) = x_0$ and $F(w.e) = G(F(w),e)$ then, if
$G$ is well-defined, so is $F$. This construction is fundamental to how state machines operate: computing the ``next state"
from the ``current state" and the next input event.
\subsection{State machines}
A deterministic state machine is usually
given with some variant of:
\(M=(E,X,S, \iota, \delta, \lambda)\) where
set \(E\) is the alphabet of events, set \(X\) is the set of outputs. The
set \(S\) is the state set and \(\iota \in S\) is the initial state. The map \( \delta: S\times E\to S \)
is the transition map and \( \lambda:S\to X\) is the output map which defines the difference between internal state and visible state.
I am going to call this a "generalized Moore machine" because it is a classical
Moore machine\cite{Moore} without a restriction to finite sets. All actual
digital computing devices are finite state, but infinite state machines can be useful abstractions even when thinking
about finite devices - as seen in the examples below.
Given a generalized Moore machine
\(M=(E,X,S, \iota ,\delta, \lambda)\) the primitive recursive extension of
\(\delta\) to sequences in \(E^*\) is straightforward.
Let \(\delta^*(null) = \iota \) and let \(\delta^*(w.e) = \delta(\delta^*(w),e). \)
To avoid wasting another letter define: \( M^*(w) = \lambda(\delta^*(w)). \) The map \(M^*\)
is a primitive recursive function on finite words over \(E \).
The construction of a generalized Moore machine from a map $f:E^*\to X$ is straightforward as well.
Suppose $f:E^*\to X$ is given and define an equivalence
relation as follows:
\[ \mbox{if }w,z\in E^*\mbox{ then } w \sim_f z\mbox{ iff }(\forall u\in E^*) f(concat(w,u)) = f(concat(z,u))\]
where $concat$ is concatenation of sequences. Note that if $w\sim_f z$ then
$w.e \sim_f z.e$. Partition $E^*$ into sets $\{w\}_f$ where
$\{w\}_f =\{z: z\in E^*, w \sim_f z\}$. Let
$S_f = \{ \{w\}_f: w\in E^*\}$ be the state set\footnote{If we define the congruence by $z\cong_f w \leftrightarrow (\forall u,v)(f(uzv)=f(uwz))$ then instead of a state set we get a monoid under concatenation of representative elements.}.
Then define $\delta_f(\{w\}_f,e) = \{w.e\}_f$ and $\lambda_f(\{w\}_f) = f(w)$.
The state machine defined in this way $M_f$ has initial state $\{null\}_f$.
It's easy to see that $M_f^* = f$. This type of construction is basically
the the same as state machine minimization and is well known in a slightly
different context\footnote{ There are an infinite number of distinct generalized Moore machines that generate the
same primitive recursive map $M^*$, but the differences between those machines are not interesting for our
purposes. In fact, those differences are essentially artifacts of the presentation if all we are interested
in is modeling the behavior of discrete state systems.}.
\subsection{State machine products}
Gecseg \cite{gecseg} has a nice formulation of a ``general product" of automata that is fairly simple as a block diagram.
{\includegraphics[height=14em]{feed.png}}
Adapting it to
generalized Moore machines, the idea is that we have an alphabet of events
$E$,
a collection of (not necessarily distinct) generalized Moore machines $M_1\dots , M_n$ and a collection of maps $\phi_i: E \times X_1\times \dots X_n\to E_i$.
The product machine is constructed by letting each $\phi_i$ steer each
component state machine depending on the input from $E$ and the ``feedback"
which is the output of the component machines.
The product machine $M = \Pi_{i=1}^n[M_i,\phi_i]$ has a state set consisting
of the cross product $S = \times_{i=1}^n S_i$ and a transition map
$\delta(s,a) = (\delta(s_1,e_1), \dots \delta(s_n,e_n))$ where
$s=(s_1,\dots s_n)$ and $e_i = \phi_i(e,\lambda_1(s_1),\dots \lambda_n(s_n))$
\footnote{This type of product was
described in a by-the-way manner in multiple works in early automata research -- for example in Hartmanis\cite{Hartmanis}.
Researchers, however, early on became focused on "loop free" decomposition of automata for a number of reasons including the
very interesting relationship between automata decomposition and group theory that is described in the Krohn-Rhodes theorem. By
the 1970s, more general automata products were such an obscure topic that
people writing papers about formal methods routinely claimed that it was not possible to model interaction and
parallel computation with plain old state machines. }.
The primitive recursive nature of the general product should be reasonably clear. If $f_i = M_i^*$ then
define $g_i(nulls) = nulls$ and $g_i(w.s) = g_i(w).\phi_i(e,g_1(w),\dots g_n(w))$. Then
$F(w) = (f_1(g_1(w)),\dots f_n(g_n(w))$ defines $F$ so that $F = M^*$ for the product machine $M$.
\subsection{State variables}
For any generalized Moore machine, $M$, then, there is a $\ul{y}$ so that $\ul{y} = M^*(x)$. If $\ul{y}$ is specified
in terms of $\mathbf{initial}\ $ and $\AFTER{e}$ then there is an $M$ so that $\ul{y} = M^*(x)$. Of course it is possible
to define state variables that do not have solutions or that have many solutions.
To accomplish the product construction with state variables, assume that
we have $\ul{y}_1\dots ,\ul{y}_n$. where each $\ul{y}_i = f_i(x)$. Now
construct $\ul{u}_i$ by
\begin{eqnarray} \mathbf{initial}\ \ul{u}_i = nulls \label{product}\\
\AFTER{e}\ul{u}_i = \ul{u}_i.\phi_i(e,\SUB{\ul{u}_1}\ul{y}_1,...\SUB{\ul{u}_n}\ul{y}_n) \\
\ul{Y} = (\SUB{\ul{u}_1}\ul{y}_1,\dots \SUB{\ul{u}_n}\ul{y}_n)\end{eqnarray}
A further step where components can move multiple steps on a single step of the product is also simple and
preseves the state machine semantics. For this case the maps $\phi_i$ are sequence valued and we use
concatenation instead of appending.
\[\AFTER{e}\ul{u}_i = concat(\ul{u}_i,\phi_i(e,\SUB{\ul{u}_1}\ul{y}_1,...\SUB{\ul{u}_n}\ul{y}_n)) \]
Say that a state variable $\ul{y}$ is ``finite state" if $\ul{y} = f(x)$ where $S_f$ (the partition of $E^*$ by
the equivalence relation $\sim_f$) is finite. Note that if each $\ul{y}_i$ is finite state, then $\ul{Y}$
is finite state in the construction above even when the feedback maps are finite sequence valued.
\section{Illustrative example\label{examples}}
\subsection{Simple examples}
I'm going to define some examples $\ul{y} = f(x)$ and then ``solve for" $f$
to build some intuition about what the operators do.
\begin{itemize}
\item A mod $c$ counter that counts events:
\[\begin{array}{l}\mathbf{initial}\ \ul{C}=0,\\ \AFTER{e}\ul{C}= \ul{C}+1 \bmod c.
\end{array}\]
Implictly $\ul{C} = f(x)$ for some $f$. Since $\mathbf{initial}\ \ul{C} = f(nulls)=0$
and
\[\begin{array}{ll}
\AFTER{e}\ul{C}
&=f(x.e)\\
&=\ul{C} + 1\bmod c \\
&=f(x) +1 \bmod c \end{array}\]
$f$ is completely defined and so is $\ul{C}$.
\item An unbounded counter that counts events:
\[\begin{array}{l}\mathbf{initial}\ \ul{C_{unbounded}}=0,\\
\AFTER{e}\ul{C_{unbounded}}= \ul{C_{unbounded}}+1.
\end{array}\]
\item Two connected mod $c$ counters - to illustrate substitution.
First define $\ul{D}$ to be composed
from the previously defined mod $c$ counter $\ul{C}$ and $\SUB{\ul{u}}\ul{C}$ where $\ul{u}$ is to be defined. Here $*$ is just ordinary multiplication.
\[ \ul{D} = \ul{C} + c * \SUB{\ul{u}}\ul{C}\]
Now define $\ul{u}$.
\[\begin{array}{l} \mathbf{initial}\ \ul{u} = nulls,\\ \AFTER{e}\ul{u} = \begin{cases}
\ul{u}.e &\mbox{if }\ul{C}= c-1;\\
\ul{u} &\mbox{otherwise.}\end{cases}
\end{array}\]
Solve for $g$ so that $\ul{u} = g(x)$ remembering that $\ul{C} = f(x)$.
\[\begin{array}{ll}
\mathbf{initial}\ \ul{u} & = g(nulls)= nulls\\
\AFTER{e}\ul{u}& = g(x.e)\\
&=\begin{cases}
\ul{u}.e = g(x).e &\mbox{if }f(x) = c-1;\\
\ul{u} = g(x) &\mbox{otherwise.}\end{cases}
\end{array}\]
so $g$ is completely defined and so is $\ul{u}$. Now solve for $h$ so that
$\ul{D} = h(x)$.
\[\begin{array}{ll}
h(x)& = \ul{D}\\
& = \ul{C} + c* \SUB{\ul{u}}\ul{C}\\
&= f(x) + c* f(g(x))
\end{array}\]
\item It is not necessary for state variables to be scalar valued. In fact, because of the nature of computer
systems where code and data are fluid categories, map valued state variables are natural.
Consider a queue to be a map from non-negative integers to queued values where $\ul{Q}(1)$ is the first element,
$\ul{Q}(2)$ is the second and so on. To start, I'll assume we have no bound on the length of the queue, although such
a thing is impossible in real-life, and that there is some special element $nullv$ so that $\ul{Q}(i)=nullv$ if
there is no value at position $i$. Suppose there is a set $V$ of possible values to be put in the queue (of course, $nullv \notin V)$. The events that change queue state are $\mathtt{deq}$ and $\ENQ{v}$ for $v\in V$. Events not in those sets are just ignored.
\[\begin{array}{l}
\ul{Q}(i)=nullv \mbox{ and } j>i\rightarrow \ul{Q}(j)=nullv\\
\mathbf{initial}\ \ul{Q}(1)=nullv\\
\AFTER{e}\ul{Q}(i) = \begin{cases}
v&\mbox{if }e = \ENQ{v}, v\in V \mbox{ and }i=1\\
\ul{Q}(i-1)&\mbox{if }e = \ENQ{v}, v\in V \mbox{ and }i>1\\
\ul{Q}(i+1)&\mbox{if }e = \mathtt{deq}\\
\ul{Q}(i) &\mbox{otherwise}\end{cases} \end{array}\]
\item What about a bounded length queue? There are a number of alternatives for what happens when someone tries to push
such a queue beyond its boundaries. One is to just leave it unspecified. Suppose the queue has a maximum length of $c$
elements. Then we might only specify behavior when the queue is not empty and has never been over-filled.
\[\begin{array}{l}
\ul{CQ}\mbox{ is a }c\mbox{ queue if } \ul{Q}(1)\neq nullv \mbox{ and } \ul{HighWater} < c \rightarrow \ul{CQ}=\ul{Q}(1)\\
\mathbf{initial}\ \ul{HighWater} = 0\\
\AFTER{e} \ul{HighWater} = max\{\ul{HighWater},\mbox{ max }\{i: Q(i) \neq nullv\}\}\\
\end{array}\]
In this case, $\ul{Q}$ is just used to define how the actual bounded queue must behave. There are an infinite
number of maps $h$ so that $\ul{CQ}= h(x)$ since nothing is said about the value of $\ul{CQ}$ if the high water mark is ever
passed or if the queue is empty\footnote{The so-called ``formal methods" literature is replete with many examples of researchers
mistaking "not-specified" for "non-deterministic". The first is a quality of the specification. The second is a
property of a mathematical object. Specifying that an engineered computer system is non-deterministic, seems to me
something that one would rarely if ever need to do.}.
\end{itemize}
\subsection{Reliable broadcast}
For a less trivial example, I'm going to describe a computer network and algorithms for committing messages.
A common set of network properties is that
message transmit is a broadcast (can be received by some or all other nodes), is unreliable (in that
messages may not be received), and that there are no spurious messages (a received message must
have been sent). To ``commit" a message, a sender has to be assured that all recipients in a group have received
the message. Describing this system in terms of state variables permits us to leave most of the behavior of the
network unspecified, which is good because the network has an enormous number of states and depends on many parameters
we don't want to even think about here.
I want to begin with state variables for
network nodes (the computers connected to the network). These are undoubtedly complex objects, but we only need some
simple properties. Suppose we have a set $\mathit{Messages}$ of messages.
and a state variable $\ul{T}$ that indicates what, if any, messsage the node
wants to transmit in the current state. As is common with variables like this, we need a value $nullm\notin \mathit{Messages}$
to indicate "no message", so $\ul{T}=m\in \mathit{Messages}$ means that in the current state the node is attempting to transmit
$m$ and $\ul{T}=nullm$ means the node has nothing to say in the current state. The event alphabet $E_{node}$ should
include one event $\mathtt{tx}$ to indicate that a message has been transmitted and one event $\RX{m}$ for each $m\in \mathit{Messages}$ to
indicate that message $m$ has been received by the node
\footnote{ The symbols $\RX{m}$ are, again, just indexed symbols. Think of the $[m]$ as
subscripts that are not small font (easier to read) and higher than normal if you want.}. There can be any number of other
events in $E_{node}$ but those are not things we have to specify here.
To keep track of which messages the node has received and sent we can define two state variables that are set valued.
$\ul{R}$ is the set of messages that have been received and $\ul{S}$ is the set of messages that have been sent.
These don't necessarily correspond with anything implemented in the node computer, they are just abstract properties:
\[ \mathbf{initial}\ \ul{R} = \mathbf{initial}\ \ul{S} = \emptyset\]
\[ \AFTER{e}\ul{R}= \begin{cases}
\ul{R}\cup\{m\} &\mbox{if }e = \RX{m}\mbox{ for }m\in \mathit{Messages};\\
\ul{R}&\mbox{otherwise.}\end{cases}\]
\[ \AFTER{e}\ul{S}= \begin{cases}
\ul{S}\cup\{\ul{T}\} &\mbox{if }e = \mathtt{tx}\mbox{ and }\ul{T}\in \mathit{Messages};\\
\ul{T}&\mbox{otherwise.}\end{cases}\]
In a more detailed treatment, we'd probably
want to make messages expire so that that, e.g. at some point a message $m$ is no longer considered to be `` received" by a node.
Expiry would allow reuse of messages. For this example, however, we can assume the set of messages is effectively infinite.
\newcommand{\snode}[1]{\SUB{\ul{u}_{#1}}}
Suppose we have a set $N$ of node names and want to connect nodes together. There will be an alphabet $E$ for the
network and a relationship between network events and node events. For each node $n$, there is an event sequence
$\ul{u}_n \in E_{node}^*$. Then $\snode{n}\ul{T}$ is the state variable $\ul{T}$ in the context of the state of node $n$.
Unlike the simple examples above, we don't know nearly enough to specify these completely. The initial state
value will just have the node name -- so that each node begins life knowing its own name.
\[\mathbf{initial}\ \ul{u}_n = nulls.n \]
We can then require that each node know its own id:
\[\snode{n}\ul{Id}=n\]
Node internal events may be very complex, but all we care about is interaction with the network. First, to keep it simple,
make sure that when the network advances one step, each node advances at most one step.
\[\AFTER{e}\ul{u}_n \in\ \{ \ul{u}_n, \ul{u}_n.e', e'\in E_{node}\}\]
A $\RX{m}$ event needs to be associated with a $\mathtt{tx}$ event of the same message $m$
\footnote{Here I am
providing a really simple model of a network where messages pass directly between nodes. A more
realistic model would have a network medium of some sort.}.
\[\begin{array}{ll}
\AFTER{e}\ul{u}_n= \ul{u}_n.\RX{m}\rightarrow (\exists n')(&\AFTER{e}\ul{u}_{n'}=\ul{u}_{n'}.\mathtt{tx}\\
&\mbox{and }\snode{n'}\ul{T}=m\in \mathit{Messages})\end{array}
\]
There is no reciprocity - a $\mathtt{tx}$ event may not be associated with any receive at all. These constraints model
an unreliable broadcast network with no spurious messages.
\begin{lemma} $m\in \snode{n_1}\ul{R} \rightarrow (\exists n_2)(m\in \snode{n_2}\ul{S})$
\label{ltx}\end{lemma}
Proof by induction on state. $\mathbf{initial}\ \snode{n_1}=\emptyset$ so there is nothing to prove. Assuming the lemma
in the current state, there is only one interesting case $m\notin\snode{n_1}\ul{R} \mbox{ and }m\in \AFTER{e}\snode{n_1}\ul{R}$.
In this case $\AFTER{e}\ul{u}_{n_1} = \ul{u}_{n_1}.\RX{m}$ so $(\exists n_2)\snode{n_2}\ul{T}=m$ and $\AFTER{e}\ul{u}_{n_2}=\ul{u}_{n_2}\mathtt{tx}$
The challenge is for one node to determine whether a group
of other nodes have received a particular message. That is, can we define a boolean map valued state variable
$\ul{Commit}$ so that for some $G\subset N$:
\[\snode{n} \ul{Commit}(G,m)=1 \rightarrow (\forall n'\in G)m\in \snode{n'}\ul{R}\]
The obvious solution is to make each recipient send a matching acknowledgment message for each data message. Suppose
we have a subset $D\subset \mathit{Messages}$ so that for each $d\in D$ and each $n\in N$ there is a unique $a_{d,n}\in \mathit{Messages}$ which
is an acknowledgment of $d$ from $n$. Require that a site transmit $a_{d,n}$ only if it has received $d$
and either it is node $n$ or it is resending an ack it already received:
\[ \ul{T}=a_{d,n} \rightarrow d\in \ul{R}\mbox{ and } (\ul{Id}=n \mbox{ or }a_{d,n}\in \ul{R}).\]
\begin{lemma}
$a_{d,n'}\in \snode{n}\ul{R} \implies d\in \snode{n'}\ul{R}$.
\end{lemma}
Let's prove this for
$(\exists n)a_{d,n'}\in \snode{n}\ul{R} \implies a_{d,n'}\in \snode{n'}\ul{S}$ using induction on state. Clearly
true in the initial state. Suppose the left side is false in the current state and true after $e$. Then by lemma
\ref{ltx} there is some $n''$ so that after $d_{d,n'}\in \snode{n''}\ul{S}$
The hypothesis says that
$a_{d,n'}\notin\snode{n''}\ul{R}$ so $n'=n''$ and $d\in \snode{n'}\ul{R}$.
Once a message is in $\ul{R}$ it stays there, so QED.
If $\ul{Commit}(G,m)$ is defined to be $(\forall n\in G)(a_{d,n}\in \ul{R})$
the main result follows immediately.
A better method relies on
cycles of receivers each taking a turn \cite{xchang} to broadcast an ack.
Suppose $|G| =k $ is the number of nodes in the group and
$\pi:\{0 ... k-1\}\to G$ is onto. Further suppose that data and ack messages
carry sequence numbers so $d_i$ and $a_i$ have the same sequence number $i$.
First, we need to require that sequence numbers of messages that are sent
are uniquely
identifying (a more detailed treatment would cycle sequence numbers).
\begin{equation} d_i\in \snode{n_1}\ul{S} \mbox{ and } d'_i\in \snode{n_2}\ul{S} \rightarrow d'_i = d_i
\end{equation}
Next: a node can send an ack $a_i$ only if is resending it (if it received
it already) or if $\pi$ maps the sequence number mod $k$ to the node identifier.
As we increase sequence numbers, we cycle through the set of nodes.
\begin{equation}
\ul{T}=a_i \rightarrow \pi(i\bmod k) = \ul{Id}\mbox{ or }a_i\in \ul{R}
\end{equation}
Finally, the core of the algorithm is that acks are only sent if all previous messages and acks have
been received.
\begin{equation}
\ul{T}=a_i \rightarrow \begin{cases}
\exists d_i \in \ul{R} \mbox{ and }\forall j < i, \exists a_j,d_j\\
\qquad a_j \in \ul{R}\mbox{ and } d_j \in \ul{R})\end{cases}
\end{equation}
Suppose $d_i\in \SUB{\ul{u}_n}R$ and
Suppose $a_{i+k}\in \SUB{\ul{u}_n}\ul{R}$. It follows that
$a_{i+k} \in \SUB{\ul{u}_{\pi((i+k)\bmod k)}}\ul{S}$ which implies that there is a complete cycle of
nodes in $G$ that have received $d_i$.
\section{Some notes}
\subsection{Simplified notation}
The goal here has been something that would help for sketching out designs on
paper -- and perhaps a basis for some automated tools as well. For
scratching out specifications on paper, however, the notation for the three
operators is a little wordy. Usually, I omit the underline when the state variables are clear
from context. In place of $\mathbf{initial}\ \ul{y}$, I often write
$\downarrow y$. In place of $\AFTER{e}\ul{y}$ we can
write $e y$ -- just juxtaposition. And $\SUB{u}\ul{y}$ can be written
$u|y$ borrowing some similar
semantics from UNIX\cite{Ritchie} where $|$ is used to connect
the output of the value on the left to the input of the value on the right.
The general product equations starting at equation \ref{product} above would
then look like the following.
\[ \downarrow u_i = nulls\]
\[ e u_i = u_i.\phi_i(e,u_1|y_1,...u_n|y_n) \]
\[ Y = (u_1|y_1,\dots u_n|y_n)\]
Notation is not the point of this work\footnote{This is not a formal methods paper.} but using this notation declutters things enough to better see, for example, what loop-free products look like.
\subsection{Loop free and nearly loop free products}
In a loop-free or cascade product $\phi_i$ references only
$u_i|y_i \dots u_n|y_n$:
\[ e u_i = u_i.\phi_i(e,u_i|y_i,...u_n|y_n). \]
In this case, there is no feedback - each component $i$ sees only the output
from the higher numbered components. There is a lot of work in algebraic automata theory on the algebraic consequences of such a design\cite{Holcombe}.
Systems that can be designed with this kind of communication
pattern are perhaps amenable to certain optimizations. I wonder also if decompositions that are ``almost"
loop-free have interesting properties. Consider a shift register that shifts only left. Let $\ul{cell}$ be a state
variable for a single storage cell: $e\ul{cell}=e$. A register of $n$ cells looks like
$\ul{Register} = (u_1|cell,\dots u_n|cell)$. A loop free shift right register is implemented by defining $u_i$ as
follows:
\[ \downarrow u_i = nulls\]
\[ e u_i = \begin{cases} u_i.(u_{i-1}|cell)&\mbox{if }i>0;\\
u_i.e&\mbox{if }i=1\\
\end{cases}\]
Suppose, though that elements of $E$ are $(1,v)$ (shift in $v$ to the right) and $(-1,v)$ (shift in $v$ to the left).
\[ (r,v) u_i = \begin{cases} u_i.(u_{i-r}|cell)&\mbox{if } 0< r-i < n;\\
u_i.v&\mbox{otherwise}\\
\end{cases}\]
In this case, $\ul{Register}$ is definitely not loop-free, but it operates in a loop-free way for each event. Does that
mean anything either algebraically for the underlying monoid or for the structure of a primitive recursive word function?
Certainly, engineers work to reduce communication and synchronization complexity
in system design -- e.g. by using time synchronization to replace hand-shake protocols.
\bibliographystyle{abbrv}
| {'timestamp': '2016-02-23T02:10:04', 'yymm': '1512', 'arxiv_id': '1512.06788', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06788'} | arxiv |
\section{Introduction}
One of the main areas in which computer vision can aid vehicle design is improving safety for occupants. Examples of this include lane tracking \cite{Bottazzi2013,Hanwell2012}, collision prediction systems \cite{SarahBonninThomasH.WeisswangeFranzKummert2014,Monwar2013,Sivaraman2013}, and alertness monitoring for the driver \cite{Vicente2015,Garcia2012}. One such area that has received particular {research interest is automatic occupant classification \cite{Huang2012,Huang2011,Gao2010,Goktuk2005}}. This has traditionally been for the purpose of airbag suppression, where it is sometimes safer to not deploy an airbag in a collision if the occupant is a small child \cite{Glass2000,Member2001}.
{Non-vision sensors have been used for the tasks of occupant detection \cite{George2010,mehney2000vehicle} and classification \cite{wallace2003vehicle}, but there are a number of incentives to replace these with a camera based system. These include the possibility of introducing additional functionality without any additional hardware (for example, determining if an occupant is using a control surface \cite{Cheng2010}), and reducing the cost to the vehicle manufacturer.}
Designing a computer vision system to work reliably in a safety-critical automotive environment presents a number of challenges. These include a large variety of lighting conditions (including over exposure in some cases), skin tones, clothing, postures and occupant behavior. The bias of the system should also be considered - is it better to incorrectly identify an adult as a child or vice versa, for example? Finally, any evaluation should be robust enough to highlight the system's shortcomings, should any exist.
{In this paper, a method is proposed that can handle the tasks of occupant detection and occupant classification, that functions in all passenger seats using a single camera. An occupant detection system would allow a vehicle to automatically turn on infotainment systems and seatbelt warnings, for example. The two use cases of occupant classification we address here are airbag suppression and automatic child locks. Currently, these two features, which have different age cutoffs and intra-class costs, have to be switched off and on manually, leading to the possibility of human error.}
To address the issues raised above, it is important to make full use of the available training data from every seat. Thus, a transfer learning technique is introduced to allow a classifier for one seat to use training information from others whilst still maintaining some control over {the bias generated by the transfer process}. More specifically, Histogram of Orientated Gradient (HOG) and binned motion statistics are extracted from training images and used as features. Joint Discriminant Analysis (JDA) is applied to find a space of reduced dimensionality shared by both the source and target features. Source features are then transferred to bring them closer to the target feature distributions whilst being attracted to classes with a lower misclassification cost. Finally, these features are used to train a weighted Support Vector Machine (SVM) classifier, which can then classify unseen images from the target seat.
\begin{figure*}
\begin{centering}
\subfloat[An empty cabin.]{\includegraphics[width=\fisheyewidth\columnwidth]{images/empty.jpg}} \hspace{2mm}
\subfloat[Three children. The front passenger is not seated correctly, and the rear passengers are putting seatbelts on.]{\includegraphics[width=\fisheyewidth\columnwidth]{images/child_anon1.jpg}} \hspace{2mm}
\subfloat[Two children and one adult. Some overexposure is present, particularly in the front passenger region.]{\includegraphics[width=\fisheyewidth\columnwidth]{images/child_anon2.jpg}}
\end{centering}
\caption{Some example images from our dataset with child faces blurred.}
\label{fig:dataset_examples}
\end{figure*}
{To evaluate the proposed method, a dataset was collected featuring 40 adults and 60 children. {To the best of our knowledge} this is the first time such a large {dataset, including children,} has been used to evaluate an occupant classification method using computer vision.}
{Our contributions in this work are threefold. Perhaps the most important is the proposed cost-based transfer learning method. This is the first time intra-class costs have been addressed from a transfer learning perspective, and applied to a weighted classification problem. Secondly, computer vision has not previously been used to investigate automatic child locks, which is presented here in the same framework as an automatic airbag suppression method. Finally, this is also the first time a single sensor has been used to perform the occupant classification task for multiple seats simultaneously}. Whilst this paper attempts to solve occupant detection and classification tasks, the transfer learning method has the potential for wider use in computer vision. It would be most applicable in cases where learning from multiple sources is desirable but not currently used due to a high cost of misclassification for some classes. For example, a road sign classification system could incorporate additional sources of training data, while taking into account that it is worse to misclassify a 20mph road sign as a 60mph than it is to classify a 50mph as a 30mph.
Next, in Section \ref{sec:related_work}, a review of occupant classification literature and related techniques is given. Section \ref{sec:dataset} introduces the dataset and Section \ref{sec:method} presents the proposed method, which is evaluated and discussed in Section \ref{sec:experiments}. Finally, we conclude and suggest future work in Section \ref{sec:conclusion}.
\section{Related work }\label{sec:related_work}
Camera-based occupant classification systems are not normally used in production vehicles, so we will begin by giving an overview of different sensors and associated methods and assessing their suitability for our task. We will then justify our choice of pursuing a computer vision solution, and introduce related computer vision occupant classification literature.
The majority of occupant detection systems rely on weight sensors in the seat \cite{mehney2000vehicle}, and are used to warn when an occupant is not wearing a seatbelt. Arrays of weight sensors have been suggested as a way to perform occupant classification by monitoring the pressure on different parts of the seat \cite{wallace2003vehicle}, but there are issues which are yet to be addressed. For example, the weight of a child seat (some weigh over 10kg) or an overweight child could could result in the confusion of the small and large child classes, causing an airbag deployment instead of a suppression. Additionally, an automotive-grade weight sensor costs around three times that of a single camera, so there are cost savings to switching to a computer vision approach.
Ultrasound \cite{seip2002linear} and inductive \cite{George2010} sensors have also been suggested for the occupant detection task, but while detection with them is possible, they have some shortcomings when applied to the classification task. A child in a booster seat could be confused for an adult when using overhead ultrasound sensors as their heads would be similar heights, and inductive sensors provide no way to distinguish between occupant types.
Several works have been published using multiple camera setups to obtain depth information \cite{Kong2004,Cheng2004} to then help with a foreground segmentation stage. Similarly, time of flight cameras have also been used for depth information from frontal \cite{Goktuk2005} and side-on \cite{Alefs2008} views.
One potential issue with using depth sensors to monitor all the vehicle occupants is that they have a limited depth range in which they operate correctly, and also a field of view that makes observing more than one occupant difficult. A cheap, single camera with a wide field of view lens (e.g. see Figure \ref{fig:dataset_examples}) would be the ideal choice of sensor from a manufacturer's perspective\footnote{This work is supported and guided by Jaguar Land Rover.} as one could be used to observe the whole cabin, assuming it could demonstrate acceptable accuracy.
One of the major problems when using cameras in an automotive environment is the variability of illumination conditions. Proposed solutions to this problem are to use high dynamic range (HDR) imagery \cite{Koch2002} or infra-red illumination at night time and cameras that operate in this frequency range \cite{Farmer2007}.
Most vision-based occupant classification systems, such as \cite{Farmer2003,Kong2004,Goktuk2005,Zhang2005,Devarakota2007,Alefs2008,Gao2010,Huang2011}, tend to follow a standard classification pipeline, usually consisting of a feature extraction stage, dimensionality reduction stage, and classification stage.
However, there are issues that are yet to be addressed in the literature. These include how a system should work on more than one seating position at a time can most effectively use all the training data available, and how methods perform on a dataset with real children (not just dolls and blankets \cite{Goktuk2005,Farmer2007,Alefs2008}) and with a robust evaluation (\ie not leave one out cross-validation \cite{Farmer2003} or subjects appearing in both training and test sets \cite{Huang2010}).
Intuitively, occupancy detection and classification seems like an ideal problem for improvement via some transfer of knowledge. We will classify occupants in four separate seats, and while these seating areas will not look identical, there should be some kind of correlation, for example, in feature space between a child in a front seat and a child in a rear seat. This will allow us to leverage more training data, as training data for each seat can be used to help in the training process in all the others if necessary.
Traditionally, transfer learning has focussed on one of three approaches: unsupervised, transductive, or inductive \cite{Pan2010a}. Unsupervised learning (such as \cite{Baktashmotlagh2014})
takes place when no class labels are known for either the source or target domains, so is not applicable here. Inductive transfer occurs when some labelled examples are known for both the source and the target domains \cite{Wang2014,Shao2012}. Some works contain a large number of source labels and a small number of target labels, but in the proposed dataset there will also be a large number of target labels which enables a better understanding of the target distribution. This makes it more suitable for the adaptation of transductive \cite{Campos2013,Rohrbach2013} techniques (which are used when no target labels are known, but tend to rely on information about the shape of the whole source and target distributions) on a class by class basis. An interesting transductive example is that by Farajidavar \etal \cite{Farajidavar2014}, who introduced a method for fine-tuning feature projections in a subspace shared by both the source and target domains. Whilst labels were not available for the target data, it was assumed that the entire target distribution (\ie all the features for the target test data) was known as a prior. This contrasts with the data we have, where we have some labelled examples from source and target domains, but their entire distributions are unknown.
\section{Dataset}\label{sec:dataset}
Whilst previous methods have used blankets and dolls to simulate children, these cannot provide the necessary variability to adequately evaluate a system that is critical in nature. As such, for this study we recruited 60 children between the ages of 3 and 9, along with 40 adults. A high variability in the data was ensured by asking the participants to spend some time behaving normally, and some time ``acting up'' for the camera. There are a large number of clothing types, skin tones, lighting conditions, postures and behaviors in the footage.
A single near infra-red (NIR) camera with a 190$^\circ$ field of view lens was mounted just above the rear view mirror, so that all the seats were fully visible apart from the rear nearside and offside seats, which were mostly visible. {An NIR camera was chosen as it is more robust to the wide variety of illumination conditions found in vehicles, including the ability to operate at night.
The first 30-60 seconds were filmed after the occupants entered the vehicle. Participants were seated in different configurations (\eg adult in front passenger seat, child in booster seat in rear nearside, empty rear middle and rear offisde), with each participant taking part in around three different sequences. In total, there are 122 sequences {each containing footage of 4 seats, some with occupants and some empty}. Examples are given in Figure \ref{fig:dataset_examples}.
\section{Proposed method} \label{sec:method}
In the proposed approach, after some preprocessing, features are extracted from each frame and put through a dimensionality reduction stage. An initial location in the feature space, shared by the source and target domains, for each feature is calculated, followed by a procedure to adjust these locations based on the cost of misclassification. The final stage is to train a classifier that takes these features as an input and outputs the predicted class of the occupant.
\subsection{Data preparation, feature extraction and dimensionality reduction}
The first stage of the processing is to correct the fisheye distortion of the $190^{\circ}$ FOV lens by following the calibration procedure of Scaramuzza \etal \cite{Scaramuzza2006}.
Various features have been used in the literature for occupancy detection, including Haar responses \cite{Huang2011},
edge features \cite{Zhang2005},
and shape statistics \cite{Farmer2007},
amongst others. We trialled a number of these, but found using HOG features, concatenated with optical flow \cite{Brox2004} based motion descriptors (the mean flow magnitude and orientation from the previous 5 frames were taken from each bin), produced the best results.
{Once image features are extracted, dimensionality reduction needs to be performed before they can be passed to a classifier. Standard dimensionality reduction techniques such as Principal Component Analysis (PCA) or more recent methods \cite{Coifman2005} would not be applicable for this task, as the distributions of the source and target features are not necessarily the same.
A better option is to use a method that is aware of different source and target distributions. Dimensionality can be reduced while simultaneously transforming the feature distributions of source and target features so they more closely match.
A commonly used technique is to exploit the Maximum Mean Discrepancy (MMD) measure \cite{Gretton2012}, which gives a measurement of how different two distributions are. Examples can be found in \cite{Kim2013} and \cite{Pan2008}, amongst others. Long \etal \cite{Long2013} introduced Joint Discriminant Analysis (JDA), where they expanded on the MMD measure by allowing it to determine the differences in marginal and conditional distributions of the features. Figure \ref{fig:dim_red} shows example reduced source and target feature distributions generated by JDA.}
\begin{figure}
\centering
\subfloat[Source - front passenger.]{\includegraphics[width=0.95\columnwidth]{images/src_trn3d.pdf}} \\
\subfloat[Target - rear offside passenger.]{\includegraphics[width=0.95\columnwidth]{images/tar_trn3d.pdf}}
\caption{Example source and target distributions in the shared reduced space. Note, only the three most significant dimensions from the JDA process are shown, while our classifier uses 50 dimensions (where better separation between the classes are achieved).}
\label{fig:dim_red}
\end{figure}
\subsection{Feature transfer via weighted Gaussians} \label{sec:gaussians}
Once the initial embeddings of the source features in the shared reduced space have been found, we would like to take into account the way classes are arranged in this shared space and adjust each feature's location accordingly.
The first step is to model the location and distribution of each source class, which is done by fitting a mixture of Gaussians to each class separately. Here, we take $N$ classes with $G$ Gaussians per class, and say the $j$th Gaussian belonging to the $i$th class has the following mean, covariance and weighting parameters
\begin{equation} \label{eq:gauss_src_params}
\lambda_{ij}^{src} = \left\lbrace \mu_{ij}^{src}, \Sigma_{ij}^{src}, w_{ij}^{src} \right\rbrace.
\end{equation}
Each source feature $f$ can then be represented by a matrix $F^{src}$ containing its relative likelihood with respect to each Gaussian on a class by class basis. We write the $i$th row and $j$th column as
\begin{equation} \label{eq:F_src1}
F_{ij}^{src} = \frac{w_{ij}^{src}P(f | \lambda_{ij}^{src})}{\sum_j w_{ij}^{src}P(f | \lambda_{ij}^{src}) }.
\end{equation}
The same process is then performed for $f$ with respect to the target classes, which gives
\begin{equation} \label{eq:gauss_tar_params}
\lambda_{ij}^{tar} = \left\lbrace \mu_{ij}^{tar}, \Sigma_{ij}^{tar}, w_{ij}^{tar} \right\rbrace
\end{equation}
and
\begin{equation} \label{eq:F_tar1}
F_{ij}^{tar} = \frac{w_{ij}^{tar}P(f | \lambda_{ij}^{tar})}{\sum_j w_{ij}^{tar}P(f | \lambda_{ij}^{tar}) }.
\end{equation}
Given a set of all $S$ source features $\left\lbrace f_1,...,f_S \right\rbrace$ with class labels $\left\lbrace l_1,...,l_S \right\rbrace$, we would like to find new features $\left\lbrace \tilde f_1,...,\tilde f_S \right\rbrace$ with the same labels such that their probabilities of lying in the target class distribution are similar to how they lie in the source class distribution. This is achieved by defining a function
\begin{equation} \label{eq:min1}
T(\tilde f_k) = \sum_i \sum_j D(F_{kij}^{src}, \tilde F_{kij}^{tar}),
\end{equation}
where $D$ is a similarity measure (\eg the norm function), which is then minimized for every pair $f_k^{src}$ and $\tilde f_k^{tar}$. For this case, a high penalty should be imposed for large differences between $F_k^{src}$ and $F_k^{tar}$, whereas smaller differences will be less important to correct. It will also be desirable for a large number of non-zero differences to contribute, so the $L^3$ norm is chosen. Note how $D$ may have to be chosen differently if applied to different tasks.
Minimising (\ref{eq:min1}) is necessary in the case where all classes are treated equally, \ie where the metric used to evaluate the system is the true positive rate. However, in our occupant detection and classification system, it is desirable to have some control over the bias of this feature transfer procedure. For example, when deciding whether to activate a child lock, it does not matter if the ``empty'' class is classified as ``adult'' or ``child'', but a manufacturer would be concerned about confusion of the ``adult'' and ``child'' classes. Moreover, they may wish to bias the system by penalising a misclassification of a child as an adult more than a misclassification of an adult as a child for safety reasons, or vice versa so as not to cause embarrassment for the vehicle owner.
Equation (\ref{eq:min1}) can also take into account this desired bias if (\ref{eq:F_tar1}) is modified. First, an $N$ by $N$ cost matrix $\Phi$ is defined, where the entry $\Phi(u,v)$ denotes the cost of misclassifying class $u$ as class $v$. The condition $\forall u, \forall v, 0 \leq \Phi(u,v) \leq 1 $ is enforced. Next, a monotonically increasing function $\Psi$ is chosen, such that $\forall x \in \left[ 0 , 1 \right] , \Psi(x) > 0 $. Equation (\ref{eq:F_tar1}) then becomes
\begin{equation} \label{eq:F_tar2}
F_{ij}^{tar} = \frac{ \Psi(\Phi_{il_k}) w_{ij}^{tar}P(f | \lambda_{ij}^{tar})}{\sum_j \Psi(\Phi_{il_k}) w_{ij}^{tar}P(f | \lambda_{ij}^{tar}) }.
\end{equation}
The choice of $\Psi$ and $\Phi$ is very important to the overall effectiveness of the proposed method. The more ``aggressive'' $\Psi$ is (\ie the harder it pulls features towards the centre of their target class distribution and pushes them away from target class distributions which have a higher cost), the lower the probability of the transferred features causing an undesirable misclassification. However, increasing this aggression means that the transferred features are less likely to provide useful additional information to the classifier. Conversely, a weaker $\Psi$ can influence a classifier's predictions more, but at the possible cost of more undesirable misclassifications. A similar situation occurs when choosing $\Phi$. Costs of either 0 or 1 could be chosen, reducing the classification to a two class problem, but this would mean less information about the overall shape of the target distribution would be transferred. {We determined the best choices for $\Psi$ and $\Phi$ empirically for our experiments. As an example, for the classes labelled as Empty (E), Adult (A), Small child (S) and Large child (L) for the occupant detection case, $\Psi$ was chosen as the exponential function and $\Phi$ as:}
\begin{equation}
\Phi = \bordermatrix{~ & \mbox{E} & \mbox{A} & \mbox{S} & \mbox{L} \cr
\mbox{E} & 0 & 0.4 & 0.2 & 0.3 \cr
\mbox{A} & 0.4 & 0 & 0.2 & 0.1 \cr
\mbox{S} & 0.2 & 0.4 & 0 & 0.1 \cr
\mbox{L} & 0.3 & 0.1 & 0.1 & 0 \cr}.
\end{equation}
\subsection{Gradient descent procedure}
Now that we have an objective function to minimize, we can proceed by gradient descent (we use the method from Lagarias \etal \cite{Lagarias1998}). However, an important issue that has to be considered is where this process should start from. As we are dealing with high dimensional data (in practice, 50 dimensions are retained after the dimensionality reduction stage) with the potential for a large number of local minima, the final state of a gradient descent process is likely to be sensitive to its initial state. As mentioned in Section \ref{sec:related_work}, Farajidavar \etal \cite{Farajidavar2014} proposed a method for transferring features when target labels are not known. Their method relied on an initial embedding based on the overall shapes of the source and target data as the target labels were not available. This initial embedding could be used here, but as we have access to target labels it is appropriate to incorporate this additional information to enhance the initial embedding. We thus proceed by adopting the approach in \cite{Farajidavar2014}, but using it one class at a time.
For each source feature $f_k$, an initial embedding $\tilde f_k$ is taken, where $\tilde f_k = f_k + \tau u_k$, where $\tau$ is a large scaling factor. The quantity $u_k$ is obtained by taking the Gaussians fitted to the target classes with parameters $\lambda_{l_k,j}^{tar}$ for $j=0,...,G$. Then we set
\begin{equation} \label{eq:uk}
u_{kd} = \frac{1}{S \sqrt{w_{l_kj}^{tar}}}\sum_k P(\lambda_{l_kj}^{tar} | f_k) \frac{f_{dk} - \mu_{d l_k j}^{tar}}{\sigma_{d l_k j}^{tar}}.
\end{equation}
This quantity can be easily computed by taking the mean component of the Fischer vector from \cite{Perronnin2006}.
\subsection{Classification}
For the classification stage, an SVM is used {with a radial basis function (RBF) kernel}. When training a classifier to evaluate the performance over all classes with no weightings provided (in Section \ref{sec:overall_classification}), a grid search over the parameters for the LIBSVM implementation is conducted \cite{CC01a}.
When training and testing weightings for specific tasks (in Section \ref{sec:weighted_classification}), the cost-sensitive one-versus-one (CSOVO) SVM modification by Lin is used \cite{Lin2010}.
\section{Experiments} \label{sec:experiments}
{To demonstrate the effectiveness of the transfer learning procedure, the proposed method in its entirety is evaluated, with and without deploying training data from other seats. For comparative analysis, we show our results against two approaches. The first is the method of Zhang \etal \cite{Zhang2005}\footnote{We developed our own implementation of \cite{Zhang2005} as faithfully as possible.} which relies on a dense Haar feature response as the feature vector and an RBF SVM for classification. Many works use Edge based features instead of Haar responses, such as \cite{Kong2004,Huang2010,Gao2010}, with variations on the classification stage. As such, the second method we compare against deploys a standard edge feature extractor (as used in \cite{Huang2010}) followed by PCA and an RBF SVM, and we refer to this hereafter as the ``Classic Approach.''}
More recent works have used techniques such as finite state machines to combine results from different frames \cite{Huang2010}, whereas here we are focussing on maximising the classification performance on single images. {We chose the approaches we compare against because clear implementation details were available, they use similar camera positions for the front passenger which indicated the features used would work well with our footage, and the amount of training and testing data we use suggests an SVM is both an appropriate choice of classifier and allows more direct comparison.}
Results are given for the front passenger (FP), rear nearside (RN), rear middle (RM) and rear offside (RO) seats. The driver's seat is not relevant here, as detection and classification of the driver are unnecessary if the car is being driven. Other than the parameters determined empirically as discussed before (i.e. $\Psi$, $\Phi$ \etc) no other significant parameters are required.
To reduce the possibility of overfitting to certain occupants, no occupant appears in both the training and testing sets. To prevent very similar images appearing in either the training or testing sets, images from the same video sequence are chosen that are more than one second apart. The following results are for training and testing sets of 1000 randomly selected images per seat (subject to the above conditions), and the accuracy presented is taken as the mean over 10 runs.
First, results will be presented for standard classifiers to investigate how accurate these methods are at differentiating between all the labelled classes. This will be followed by results from weighted classifiers tuned to the tasks of occupant detection, classification for child locks and classification for airbag suppression, as would be necessary in a production vehicle.
\subsection{Overall classification performance} \label{sec:overall_classification}
We first test the the classification accuracy over all 8 labelled classes. These are:
empty seat,
small child in booster seat,
small child in child seat,
small child with no additional seat,
large child in booster seat,
large child in child seat,
large child with no additional seat and
adult.
In training, children up to Year 2 of school were assigned to the small child classes, and those in Year 3 and above were assigned to the large child classes, making the cutoff around 6 years old.
The outcome of this experiment are displayed in Table \ref{tab:classifiction8}. The proposed method, using transferred information, averages 78.8\%, an improvement over 76.5\% when not using transferred information, 74.0\% when using the classic approach and 65.9\% when using the method of Zhang \etal \cite{Zhang2005}.
\begin{table}
\begin{center}
\small
\begin{tabular}{l|l|l|l|l||l|}
\cline{2-5}
& \multicolumn{4}{ c| }{\bf Seat} \\ \cline{1-5}
\hline
\multicolumn{1}{ |l|| }{\bf Method} & \bf{FP} & \bf{RN} & \bf{RM} & \bf{RO} & {\bf Avg.}\\
\hline\hline
\multicolumn{1}{ |l|| }{Proposed (non trans.)} & 85.1 & 77.3 & 72.0 & {\bf 71.7} & 76.5\\
\multicolumn{1}{ |l|| }{Proposed} & {\bf 86.0} & {\bf 82.0} & {\bf 77.3} & 69.9 & {\bf 78.8}\\
\multicolumn{1}{ |l|| }{Zhang \cite{Zhang2005}} & 74.7 & 64.3 & 68.0 & 56.5 & 65.9 \\
\multicolumn{1}{ |l|| }{Classic Approach} & 80.5 & 72.5 & 71.8 & 71.0 & 74.0\\
\hline
\end{tabular}
\end{center}
\caption{Unweighted classification percentage accuracy over all eight classes for unweighted classifiers. FP denotes the front passenger seat, RN the rear nearside seat, RM the rear middle seat and RO the rear offside seat.}
\label{tab:classifiction8}
\end{table}
\begin{table}
\begin{center}
\small
\begin{tabular}{l|l|l|l|l||l|}
\cline{2-5}
& \multicolumn{4}{ c|| }{\bf Seat} \\ \cline{1-5}
\hline
\multicolumn{1}{ |l|| }{\bf Method} & \bf{FP} & \bf{RN} & \bf{RM} & \bf{RO} & {\bf Avg.}\\
\hline\hline
\multicolumn{1}{ |l|| }{Proposed (non trans.)} & 87.2 & 89.7 & 85.2 & 86.3 & 87.1\\
\multicolumn{1}{ |l|| }{Proposed} & {\bf 90.0} & {\bf 91.2} & {\bf 91.1} & {\bf 88.1} & {\bf 90.1} \\
\multicolumn{1}{ |l|| }{Zhang \cite{Zhang2005}} & 80.8 & 76.8 & 75.6 & 57.8 & 72.7 \\
\multicolumn{1}{ |l|| }{Classic Approach} & 88.1 & 80.1 & 82.0 & 80.6 & 82.7\\
\hline
\end{tabular}
\end{center}
\caption{Unweighted classification percentage accuracy over the empty, adult, small child and large child classes for unweighted classifiers.}
\label{tab:classifiction4}
\end{table}
\subsection{Weighted classification performance}\label{sec:weighted_classification}
For the three use cases of occupant detection, classification for childlocks and classification for airbag suppression, it is possible to reduce the number of labelled classes to four - Empty (E), Adult (A), Small child (S) and Large child (L), with the same child age cutoff as earlier. The cost matrices for weighted SVMs used for these tasks are given in Figure \ref{fig:svm_cost}. Note that the cost matricies chosen for the transfer bias in Section \ref{sec:gaussians} (which feature elements not equal to zero and one to help retain distribution information) do not have to be the same as the cost matrices used for SVM classification.
As a comparison, the unweighed performance over these four superclasses is given in Table \ref{tab:classifiction4}. The transferred features increase the average classification accuracy in this case from 87.1\% to 90.1\% (the classic approach scores 82.7\% and \cite{Zhang2005} 72.2\%).
Table \ref{tab:detection} shows the weighted classification accuracies, using the cost matrix in Figure \ref{fig:det_mat} for the occupant detection task. The transferred features increase the average classification accuracy in this case from 93.8\% to 96.7\%, compared to 91.7\% for the classic approach and 85.8\% for \cite{Zhang2005}. An example decision outcome is shown in Figure \ref{fig:example_detection}.
Next, Table \ref{tab:childlock} shows the results for the child lock task, using the cost matrix in Figure \ref{fig:child_lock_mat}. This time, the transferred features increase the average classification accuracy from 94.1\% to 97.2\%, compared to 92.2\% for the classic approach and 83.9\% for \cite{Zhang2005}. An example decision outcome is shown in Figure \ref{fig:example_childlock}.
Finally, Table \ref{tab:airbag} shows the results for the weighted classification for automatic airbag suppression, and uses the cost matrix in Figure \ref{fig:airbag_mat}. Again, the transferred features increase the average classification accuracy, from 92.0\% to 94.4\%, compared to 89.1\% for the classic approach and 84.3\% for \cite{Zhang2005}. An example decision outcome is shown in Figure \ref{fig:example_airbag}.
\begin{figure}
\begin{centering}
\subfloat[Occupant detection.\label{fig:det_mat}]{\begin{tabular}{p{1.0mm} | p{1.0mm} p{1.0mm} p{1.0mm} p{1.0mm} }
& E & A & S & L\\
\hline
E & 0 & 1 & 1 & 1\\
A & 1 & 0 & 0 & 0\\
S & 1 & 0 & 0 & 0\\
L & 1 & 0 & 0 & 0\\
\end{tabular}} \hspace{1.8mm}
\subfloat[Child locks.\label{fig:child_lock_mat}]{\begin{tabular}{p{1.0mm} | p{1.0mm} p{1.0mm} p{1.0mm} p{1.0mm} }
& E & A & S & L\\
\hline
E & 0 & 0 & 0 & 0\\
A & 0 & 0 & 1 & 1\\
S & 1 & 1 & 0 & 0\\
L & 1 & 1 & 0 & 0\\
\end{tabular}} \hspace{1.8mm}
\subfloat[Airbag suppression.\label{fig:airbag_mat}]{\begin{tabular}{p{1.0mm} | p{1.0mm} p{1.0mm} p{1.0mm} p{1.0mm} }
& E & A & S & L\\
\hline
E & 0 & 0 & 0 & 0\\
A & 1 & 0 & 1 & 0\\
S & 0 & 1 & 0 & 1\\
L & 1 & 0 & 1 & 0\\
\end{tabular}}
\end{centering}
\caption{Cost matrices used by weighted SVMs. The classes denoted are Empty seat (E), Adult (A), Small child (S) and Large child (L).}
\label{fig:svm_cost}
\end{figure}
\begin{table}
\begin{center}
\small
\begin{tabular}{l|l|l|l|l||l|}
\cline{2-5}
& \multicolumn{4}{ c| }{\bf Seat} \\ \cline{1-5}
\hline
\multicolumn{1}{ |l|| }{\bf Method} & \bf{FP} & \bf{RN} & \bf{RM} & \bf{RO} & {\bf Avg.}\\
\hline\hline
\multicolumn{1}{ |l|| }{Proposed (non trans.)} & 96.1 & 93.2 & 93.3 & 92.5 & 93.8 \\
\multicolumn{1}{ |l|| }{Proposed} & {\bf 98.0} & {\bf 95.3} & {\bf 97.4} & {\bf 95.9} & \bf{96.7} \\
\multicolumn{1}{ |l|| }{Zhang \cite{Zhang2005}} & 90.9 & 88.1 & 89.9 & 74.3 & 85.8 \\
\multicolumn{1}{ |l|| }{Classic Approach} & 96.2 & 90.0 & 90.5 & 90.1 & 91.7 \\
\hline
\end{tabular}
\end{center}
\caption{Weighted classification percentage accuracy for occupant detection using the cost matrix in Figure \ref{fig:det_mat}.}
\label{tab:detection}
\end{table}
\begin{table}
\begin{center}
\small
\begin{tabular}{l|l|l|l|l||l|}
\cline{2-5}
& \multicolumn{4}{ c| }{\bf Seat} \\ \cline{1-5}
\hline
\multicolumn{1}{ |l|| }{\bf Method} & \bf{FP} & \bf{RN} & \bf{RM} & \bf{RO} & {\bf Avg.}\\
\hline\hline
\multicolumn{1}{ |l|| }{Proposed (non trans.)} & 94.2 & 95.1 & 98.2 & 89.2 & 94.1 \\
\multicolumn{1}{ |l|| }{Proposed} & {\bf 98.9} & {\bf 97.1} & {\bf 98.3} & {\bf 94.5} & \bf{97.2} \\
\multicolumn{1}{ |l|| }{Zhang \cite{Zhang2005}} & 90.1 & 88.0 & 87.2 & 70.4 & 83.9 \\
\multicolumn{1}{ |l|| }{Classic Approach} & 94.7 & 91.1 & 92.0 & 90.8 & 92.2 \\
\hline
\end{tabular}
\end{center}
\caption{Weighted classification percentage accuracy for automatic child locks using the cost matrix in Figure \ref{fig:child_lock_mat}.}
\label{tab:childlock}
\end{table}
\begin{table}
\begin{center}
\small
\begin{tabular}{l|l|l|l|l||l|}
\cline{2-5}
& \multicolumn{4}{ c| }{\bf Seat} \\ \cline{1-5}
\hline
\multicolumn{1}{ |l|| }{\bf Method} & \bf{FP} & \bf{RN} & \bf{RM} & \bf{RO} & {\bf Avg.}\\
\hline\hline
\multicolumn{1}{ |l| }{Proposed (non trans.)} & 92.8 & 93.6 & 92.1 & 89.3 & 92.0 \\
\multicolumn{1}{ |l| }{Proposed} & {\bf 96.2} & {\bf 96.0} & {\bf 94.4} & {\bf 91.1} & \bf{94.4} \\
\multicolumn{1}{ |l|| }{Zhang \cite{Zhang2005}} & 90.4 & 85.4 & 85.7 & 75.6 & 84.3 \\
\multicolumn{1}{ |l| }{Classic Approach} & 92.8 & 88.4 & 87.9 & 87.2 & 89.1 \\
\hline
\end{tabular}
\end{center}
\caption{Weighted classification percentage accuracy for automatic airbag suppression using the cost matrix in Figure \ref{fig:airbag_mat}.}
\label{tab:airbag}
\end{table}
\begin{figure*}
\begin{centering}
\subfloat[Occupant detection task. Green highlighting indicates an occupant is present.\label{fig:example_detection}]{\includegraphics[width=\fisheyewidth\columnwidth]{images/result_detection.png}} \hspace{2mm}
\subfloat[Automatic childlocks. Green highlighting indicates a childlock should be engaged.\label{fig:example_childlock}]{\includegraphics[width=\fisheyewidth\columnwidth]{images/result_childlock.png}} \hspace{2mm}
\subfloat[Automatic airbag suppression. Green highlighting indaces an airbag should be suppressed.\label{fig:example_airbag}]{\includegraphics[width=\fisheyewidth\columnwidth]{images/result_airbag.png}}
\end{centering}
\caption{Some example weighted classification decisions with child faces blurred.}
\label{fig:result_examples}
\end{figure*}
\subsection{Discussion}
The most important result to take away from the experiments is that the inclusion of transferred information does indeed increase the success rate for the weighted classification tasks. Improvements are found in the successful decisions for occupancy detection, classification for automatic child locks, and classification for automatic airbag suppression. An improvement is also observed for unweighted classification, although as the proposed method is not designed specifically for this task, it may well be the case that other inductive transfer techniques would perform better for unweighted classification.
Another trend that is visible across all our weighted classification experiments is that the front passenger seat obtains higher scores than the rear seats. This is not necessarily surprising, as more detail is visible due to proximity to the camera. The front seats and occupants can also partially occlude the view of the rear of the vehicle.
An interesting failure case worth noting can be found in Table \ref{tab:classifiction8} which presents the results of the unweighted classification across all classes. Whilst including transferred features in the training set increases the overall classification accuracy for the front passenger, rear nearside and rear middle seats, including it for the rear offside seat results in a less successful classification rate. This suggests that the proposed method is more well suited to weighted classification than unweighted and is probably caused by unrelated classes having an equal pull on each feature.
\section{Conclusion}\label{sec:conclusion}
In this paper, a framework was introduced to perform the tasks of occupant detection and occupant classification for automatic child locks and airbag suppression. The method works for all passenger seats using a single overheard NIR camera. To make full use of the training data from all seats, a cost-based transfer learning technique was introduced to adjust source features in a reduced space, whilst taking into account the cost of misclassifying these features as certain classes. An evaluation was performed on a large dataset consisting of 40 adult and 60 child volunteers in real vehicles, and the transferred features contributed to an improved classification accuracy.
There are a number of possible avenues for future work leading on from what has been presented here. One is to investigate if the proposed method can also incorporate information from standard object datasets \cite{Deng2009} to recognize objects left behind in the cabin, and issue warnings if it is likely to be stolen. Here, costs can be attributed to certain items - a laptop would have a higher cost of being left behind than a book, for instance. {Another is to investigate how well features learned in one type of car can be transferred to another type, e.g. those with lower roofs in ``sporty'' models giving a different viewpoint.}
{\small
\bibliographystyle{ieee}
| {'timestamp': '2015-12-23T02:07:31', 'yymm': '1512', 'arxiv_id': '1512.07080', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.07080'} | arxiv |
\section{Introduction}
The recognition of anomalies provides useful application-specific insights \cite{aggarwal:13:outlier}. More specifically, the field of anomaly detection focusses on the identification of data that significantly differ from the rest of the dataset --- so different that it gives rise to the suspicion that it was generated by a different mechanism. Such an anomaly may, e.g., occur because of an error, it may be an outlier, or it may be a highly unexpected data point. It is hard, if not impossible, to distinguish between such different reasons automatically. Hence, anomalies should be inspected manually to decide whether it should, e.g., be removed, corrected, or simply remain in the data ``as is''. One should thus preferably not report an overly large list of potentially anomalous data points and, at the very least, that list should be ordered such that the most anomalous data points appear on top.
For transactional data anomaly detection usually boils down to pointing out those transactions that show unexpected behaviour. This unexpected behaviour can manifest itself in different ways and each detection algorithm is limited to find only those anomalies which fit the corresponding framework. For example, much work has been done to detect unexpected behaviour which can be expressed by the compressed size of a transaction given a pre-processed model \cite{smets:11:odd,akoglu:12:comprex}. That is, transactions that badly fit the norm of the data are deemed to be anomalous. Another example is to score transactions based on the number of frequent patterns that reside in it \cite{He:02:fp-outlier}. Yet another method scores transactions based on items missing from a transaction which were expected given the set of mined association rules \cite{narita:08:outlier-degree}. All these methods have their own advantages, however, none of them is able to detect an anomaly based on the presence of multiple items in a single transaction that are not expected to occur together. Therefore in this work we focus on this class of anomalies, not to improve existing methods, but to improve the field of anomaly detection by making it more comprehensive.
In addition to only highlighting the transactions that show anomalous behaviour, our method describes anomalies in more detail by providing the most unlikely co-occurrence of patterns in a transaction. As an example consider a dataset containing people's drinking habits where roughly half of the people drinks Coca Cola and the other half drinks Pepsi Cola. Now each individual who drinks Coke or Pepsi is not surprising. Moreover, someone drinking both Coke and Pepsi also does not seem surprising as it can be compressed well using the methods of \cite{smets:11:odd,akoglu:12:comprex}, it contains multiple frequent patterns \cite{He:02:fp-outlier} and there is nothing missing \cite{narita:08:outlier-degree}. However, in this dataset almost everyone drinks either Pepsi or Coke, but not both. Therefore, someone drinking both Coke and Pepsi is an anomaly by definition, drinking both is unexpected. We propose to score each transaction based on the most unlikely co-occurrence between patterns and therefore our method will be able to find the described class of anomalies.
For this example, the score we introduce is minus the log of the lift of the association rule Pepsi $\rightarrow$ Coke and, except the log, has been introduced before in \cite{lavrac:99:measures} as the \emph{novelty} of an association rule. The difference is that we do not score a rule, but a transaction and do so by the maximal novelty of the rules that apply to this transaction. Perhaps even more important is that we give an algorithm that does not require one to mine for all association rules with a support of 1 to find the most surprising transactions.
Our new class of anomalies, their score, and the algorithm to discover these anomalies introduced in this paper is complementary to the two other well-known anomaly classes for transaction data. The first class describes transactions with a deviating length (i.e. the number of items in the transaction) and is quite trivial. The second class, for which the most work has been done \cite{smets:11:odd,akoglu:12:comprex}, describes unexpected transactions given a model of the data. To illustrate the complementarity of this latter class and our new class we show in our experiments that where current methods fail to identify our new class of anomalies, our method quickly finds them. Note, however, that our method is not intended to replace any existing methods that can discover other classes of anomalies. Rather, one should use different methods, for different classes of anomalies, that are complementary to each other.
The remainder of this paper is organised as follows. We first introduce notation in Section~\ref{sec:not}. In Section~\ref{sec:anomaly} we discuss the concept of anomalies in transaction data, introducing a novel class. Section~\ref{sec:how} explains how to use our score in practice. We discuss related work in Section~\ref{sec:rel}, and empirically evaluate our score in Section~\ref{sec:exp}. We round up with discussion and conclusions in Sections~\ref{sec:dis} and \ref{sec:con}, respectively.
\section{Notation} \label{sec:not}
In this section we provide the notation used throughout the paper. We consider transaction datasets $D\xspace$ containing $|D\xspace|$ transactions. Each transaction $t$ contains a subset, of size $|t|$, of the items from the alphabet $\Omega$. Categorical data consists of $|A|$ attributes, where each attribute $A_i \in A$ has a domain $\Omega_i$, and can also be regarded as transaction data by mapping each attribute value pair to a different item. For categorical data each transaction will have the same length as each attribute should be specified. All logarithms are to base 2, and by convention 0 $\log$ 0 = 0. Further, we use $P(\cdot)$ to denote a probability density function.
\section{Anomalies in Transaction Data}
\label{sec:anomaly}
What is an Anomaly? Anomalies are also referred to as abnormalities, discordants, deviants, or outliers in the data mining and statistics literature \cite{aggarwal:13:outlier}. As we consider transaction data we use the following definition.
\begin{definition}
A transaction is anomalous when it deviates from what we expect considering the whole dataset.
\end{definition}
Given this definition an anomaly can manifest itself in different ways, resulting in multiple classes of anomalies for transaction data. In this section we recall 2 classes of anomalies, define 1 new class, and we show how to identify all of them by formalising appropriate anomaly scores. We want to emphasise again that the scores for different classes of anomalies are complementary to each other. Further, for ease of interpretation and computation we take the negative log-likelihood for the scores in each class.
\subsection{Class 0: Unexpected Transaction Lengths}
A transaction can be anomalous not as a result of the patterns it contains, but solely on its deviating length.
\begin{definition}
A class 0 anomaly is a transaction with significantly deviating transaction length.
\end{definition}
We propose an anomaly score which represents the number of bits needed to describe the transaction length given all transaction lengths in the data, i.e. for a transaction $t$ we have
\[
\tscore_0(t) = -\log(P(|t|)) = -\log \left( \displaystyle\frac{|\{t' \in D\xspace \mid |t'| = |t|\}|}{|D\xspace|} \right)\ .
\]
The intuition behind the subscript 0 for this score is that we have to take no patterns into account at all to identify these anomalies. As a result, using this score we will not be able to identify interesting co-occurrences. Further, as it is a fairly trivial score we will not further evaluate it.
\subsection{Class 1: Unexpected Transactions}
When a transaction contains none or only few frequent patterns, which do occur in (almost) all other transactions, it can be regarded to be anomalous.
\begin{definition}
A class 1 anomaly is a transaction that contains very little regularity.
\end{definition}
The state-of-the-art in transaction anomaly detection focusses on what we call class 1 anomalies. For example, OC$^3$\xspace \cite{smets:11:odd} scores transactions using a descriptive pattern set $\CS$. Transactions containing few of these patterns but mostly singletons will get a higher score. That is, because such a transaction cannot be explained well by the pattern set that is descriptive for the data.
We generalise this idea by defining a score based on the probability of a transaction. More formally, $\tscore_1$ scores each transaction based on the number of bits needed to describe it, i.e. for a transaction $t$ we have
\[
\tscore_1(t) = -\log P(t) \quad .
\]
For compression based methods such as OC$^3$\xspace this score is defined by the compressed length of the transaction given the model of the data. However, any method that can assign a probability to a transaction based on the whole data can be used here. Note that, as transactions are scored as a whole, this approach will unlikely detect unexpected co-occurrences of patterns. For example, using OC$^3$\xspace, all patterns that describe a transaction will contribute to a its score independently. As much work has been done to detect these anomalies we will not further evaluate their identification, but focus on the next class of anomalies.
\subsection{Class 2: Unexpected Co-occurrences}
The focus of this paper lies on identifying unexpected co-occurrences of patterns. To the best of our knowledge we are the first to address these class 2 anomalies. Before we explain how to identify them, we start with a definition.
\begin{definition} \label{def:unexano}
A transaction contains a class 2 anomaly when it contains two patterns which occur much less together in the data than what could be expected from their individual supports.
\end{definition}
As this definition is somehow the opposite of that of a pattern, which is formed when two smaller patterns occur together more frequently than expected, we can also use the terms negative pattern or negative interaction pattern for a class 2 anomaly. These negative patterns cannot be identified using currently available methods as these do not consider negative interaction patterns. An example of a class 2 anomaly is someone drinking both Coke and Pepsi when everybody else only drinks either Pepsi or Coke. In other words, a very rare co-occurrence of the two frequent patterns Coke and Pepsi.
Now to identify anomalous transactions based on class 2 anomalies we would like to score a transaction higher the more unexpected a co-occurrence of patterns it contains is. That is, we propose to rank a transaction based on its most unexpected co-occurrence. Intuitively this means that for each transaction we compute the number of bits we need to explain the most unlikely co-occurrence given a pattern set $\CS$ and the data. For a transaction $t$ we thus have \[
\tscore_2(t) = \hspace{-1em}\max\limits_{\{X,Y \in \CS \mid X,Y \subseteq t\}} \hspace{-1em}{ - \log P(XY) + \log\big(P(X) \times P(Y)\big) } \; .
\]
In the remainder of this paper we refer to $\tscore_2$ as the \textsc{BnB}\xspace (Beauty and Brains) score. We compute $P(X)$ as $X$'s support or relative frequency in the data. A compression based approach similar to OC$^3$\xspace to compute $P(X)$ based on its relative usage makes no sense here as we are looking for unexpected co-occurrences and are not trying to describe the entire transaction.
Given a \textsc{BnB}\xspace score for a transaction we can readily explain its anomalousness as we know which co-occurrence of patterns is responsible for the score. Therefore our method has the nice property of producing very interpretable rankings.
Our score is related to the concept of lift~\cite{shapiro:91:lev} used in the context of association rules. In our setting we use it to describe the difference between two patterns appearing together in a transaction and what would be expected if they were statistically independent. Therefore, the higher our score the more unexpected the pattern co-occurrence.
Scores that are constructed to identify class 1 anomalies are not able to detect these class 2 anomalies as they look at all patterns \emph{independently}. For example, OC$^3$\xspace \cite{smets:11:odd} and \textsc{CompreX}\xspace \cite{akoglu:12:comprex} will not give a class 2 anomaly a higher score as both individual patterns are frequent and will add little to the anomaly score. Similarly, the frequent pattern based method from He et al.~\cite{He:02:fp-outlier} and the method from Narita et al.~\cite{narita:08:outlier-degree} have no means to give higher scores to class 2 anomalies. As a result, methods for identifying class 1 anomalies do not identify unexpected co-occurrences, while these actually do indicate anomalous behaviour.
\subsubsection*{Which patterns to consider}\label{sec:compl}
Given the relation between our score and the lift of association rules, a straightforward way to find high scoring transactions may seem to simply mine for high-lift association rules. However, to maximize the score the individual patterns $X$ and $Y$ should have a support as high as possible while $XY$ should have a support as low as possible. That is we should mine for all rules including those with a support of 1 to ensure that we don't miss the most interesting transactions.
Clearly this becomes infeasible for all but the smallest data sets quickly. Not only because discovering all these rules will take an inordinate amount of time, but also since the post-processing of all these rules necessary to identify the most surprising transactions becomes an even more daunting task.
The alternative we take is by starting from a set of patterns $\CS$. We compute the score of each pair of patterns from $\CS$ and identify those transaction in which pairs with a (very) high score occur.
Clearly, not just any pattern set will do as want to find the highest scoring transactions. The set of all frequent patterns $\mathcal{F}$ will be very descriptive, yet far too large to be able to consider the interactions between each pair of patterns. For all but the smallest of datasets this will quickly yield infeasibly large pattern sets. That is, worst case we need to consider each co-occurrence of patterns for each transaction, thus leading to a computational complexity of
\[
O( |D\xspace| \times \mathcal{|F|} \times \mathcal{|F|} ) \quad .
\]
Choosing a higher minimum support will yield smaller pattern sets but as a result we might miss important patterns. We could use condensed representations such as closed \cite{pasquier:99:discovering} or non-derivable \cite{calders:07:ndidami} frequent patterns to remove as much redundancy as possible, however these sets will still be too large. By sampling \cite{hasan:09:musk} patterns we can attain small sets of patterns, however, the choice of the size of the sample determines which anomalies one will (likely) find. A set that is too small might miss some important patterns, but a set that is too large probably contains redundancy and becomes a bottleneck in our approach as we need to look at each combination of patterns in the set. Since it is not straightforward to choose the right size for the required pattern set, we choose to use \textsc{Krimp}\xspace \cite{vreeken:11:krimp} or \textsc{Slim}\xspace \cite{smets:12:slim} to automatically find small descriptive pattern sets that describe the data well without containing noise or redundancy. Using these pattern sets it will hold that $|\CS| \ll |\mathcal{F}|$. We thus dramatically reduce the complexity, making the \textsc{BnB}\xspace score practically feasible as we will show in our experiments in Section~\ref{sec:exp}. Using such a vastly smaller set induces, of course, the risk that we miss anomalies. However in other research we have seen that the pattern sets chosen by \textsc{Krimp}\xspace and \textsc{Slim}\xspace are highly characteristic for the data. The experiments in Section~\ref{sec:exp} bear out that this is also the case here: all anomalies we inject in synthetic data are discovered using these small sets only.
Next to computational complexity, another advantage of small descriptive pattern sets is that they are more easily interpretable, which is convenient when explaining the identified anomalies.
\begin{figure}[t]
\centering
\includegraphics[width=8cm]{cantelli.png}
\caption{\textbf{Example of setting a threshold using Cantelli's inequality.} Based on the positive class we compute a threshold corresponding to a false-negative rate of 10\%. }
\label{fig:cant}
\end{figure}
\vspace{1em}
\section{How to use our scores}\label{sec:how}
In the process of explorative data mining, one has to consider that all 3 classes of anomalies we identify give different insight. In practice, one should instantiate all 3 scores and investigate the top-ranked anomalies for each class. Here, our focus is of course on class 2 anomalies.
To determine which of the \textsc{BnB}\xspace top-ranked transactions to investigate, as well as to verify the significance of the scores, we propose the following two methods based on the Bootstrap. Recall that bootstrap methods consider the given data as a sample, and generate a number of pseudo-samples from it; for each pseudo-sample calculate the statistic of interest, and use the distribution of this statistic across pseudo-samples to infer the distribution of the original sample statistic \cite{cameron:08:bootstrap}.
\subsection{Significance test} \label{sec:sig}
For a synthetic dataset it is easy to test the significance of anomaly scores, as we can generate data with and without anomalies for which the resulting scores must clearly differ. For real world data this is unfortunately not the case as we do not know which and how much (negative) patterns the data comprises. Nevertheless, to give a measure of significance we use the following bootstrap approach. We randomly sample transactions from our original dataset (with replacement) to retrieve an equally sized new dataset. We repeat this a thousand times and save the highest anomaly score for each dataset. Then we repeat this process, but we first remove the transaction with the highest \textsc{BnB}\xspace score from the sample set. That is, the top-ranked anomaly is definitely not present in the bootstrap samples of the second kind and may or may not be present in the bootstrap samples of the first kind. The bigger the difference between the distributions of scores with and without the top-ranked transaction, the more significant the top-ranked anomaly.
\subsection{Which transactions to investigate} \label{sec:inves}
Choosing the right parameter value is never easy in explorative data mining. As the \textsc{BnB}\xspace score produces a ranking on al transactions, where higher scores indicate a higher chance on being anomalous, it does not need any parameters. To determine which transactions to investigate based on this ranking we employ Cantelli's inequality to identify the transactions that significantly differ from the norm.
\begin{theorem}
\textbf{Cantelli's inequality} \cite{grimmett:01:prob}. Let $X$ be a random variable with expectation $\mu_X$ and standard deviation $\sigma_X$. Then for any $k \in \mathcal{R^+}$,
\[
P(X - \mu_X \ge k\sigma_X) \le \frac{1}{1+k^2} \quad .
\]
\end{theorem}
Smets and Vreeken \cite{smets:11:odd} proposed a well-founded way to determine threshold values to distinguish between `normal' and anomalous transactions. The positive class comprises anomaly scores for `normal' transactions and based on the distribution of these scores we can choose a threshold by choosing an upper bound on the false-negative rate (FNR). For example, if we choose a confidence level of 10\%, Cantelli's inequality tells us that this corresponds to a threshold $\theta$ at 3 standard deviations from the mean, given by $\theta = \mu + k \sigma$. This means that the chance on a future transaction with an anomaly score above the threshold is less than 10\%, see Figure~\ref{fig:cant}.
To compute these thresholds we need the distribution of the positive class, i.e. the anomaly scores for all `normal' transactions. Unfortunately, we only have the one dataset available which can contain both transactions from the positive and negative (actual anomalies) class. As by definition the number of anomalies must be relatively small we use the entire dataset to estimate the distribution of the positive class again using a bootstrap approach. That is, we generate bootstrap datasets by randomly sampling transactions (with replacement) from the original dataset. We then use all anomaly scores from all bootstrap datasets to estimate the distribution.
\section{Related Work} \label{sec:rel}
In this paper we study anomaly detection in binary transaction data. As anomalies are referred to in many different ways, mostly with slightly different definitions, we refer to \cite{markou:03:novelty} and \cite{aggarwal:13:outlier} for in-depth overviews on this field of research. In general, most anomaly detection methods rely on distances. Here we focus on discrete data, nominal attributes, for which meaningful distance measures are typically not available.
Of the methods that are applicable on transaction data, that of Smets and Vreeken \cite{smets:11:odd} is perhaps the most relevant. They propose to identify anomalies as those transactions that cannot be described well by the model of the data, where as models they use small descriptive pattern sets. Their method OC$^3$\xspace works very well for one-class classification, however it is not able to identify unexpected co-occurrences in the data. Akoglu et al. \cite{akoglu:12:comprex} proposed \textsc{CompreX}\xspace which takes a similar approach in that they also rank transactions based on their encoded length. The difference is that they do not use a single code table to describe the data, but a code table for each partition of correlated features. Although this method achieves very good results it is only suitable for categorical data and not for transaction data in general.
Note that, following our generalised anomaly score for class 1 anomalies, any method that provides a probability for a transaction can be used. Examples based on pattern sets are those of Wang and Parthasarathy \cite{wang:06:summaxent} and Mampaey et al.~ \cite{mampaey:12:mtv}.
He et al. \cite{He:02:fp-outlier} rank transactions based on the number of frequent patterns they contain given only the top-$k$ frequent patterns, and Narita et al. \cite{narita:08:outlier-degree} rank transactions based on confidence of association rules but need a minimum confidence level as parameter. All these methods have no means to identify class 2 anomalies.
In the Introduction we already mentioned the relation between our score and \emph{novelty} as introduced in \cite{lavrac:99:measures}. As stated there, the difference is that we score transactions rather than rules and we give an algorithm to quickly discover the highest scoring transactions. Our notion of anomaly is also related to the conditional anomalies introduced in \cite{song:2007:conditional}. In our running example, Pepsi could be seen as the context that makes a purchase of Coke unexpected in their terminology. The difference is that we do not expect the user to define such contexts, they are discovered automatically. Moreover, we use a small set of patterns to discover all the class-2 anomalies rather than probabilistic models on context and other attributes.
To compute the \textsc{BnB}\xspace score we need a small pattern set that contains the key patterns of the data. In general, we can use the result of standard frequent pattern mining~\cite{agrawal:96:fast,pasquier:99:discovering} although this incurs a high computational cost. Instead, we can resort to pattern sampling techniques~\cite{hasan:09:musk,boley:11:direct}, yet then we have to choose the number of patterns to be sampled. Instead, Siebes et al.~ \cite{siebes:06:item} proposed to mine such pattern sets by the Minimum Description Length principle \cite{grunwald:07:book}. That is, they identify the best set of patterns as the set of patterns that together most succinctly describe the data. By definition this set is not redundant and does not contain noise. \textsc{Krimp}\xspace \cite{vreeken:11:krimp} and \textsc{Slim}\xspace \cite{smets:12:slim} are two deterministic algorithms that heuristically optimise this score. Other pattern set mining techniques, especially those that mine patterns characteristic for the data such as~\cite{mampaey:12:mtv,geerts:04:tiling,wang:06:summaxent}, are also meaningful choices to be used with \textsc{BnB}\xspace.
\section{Experiments} \label{sec:exp}
In this section we evaluate the power of the \textsc{BnB}\xspace score to identify class 2 anomalies. Firstly, we show how we generated synthetic data needed for some of the experiments. Secondly, we provide a baseline comparison where we show that the size of the input set of patterns is of great importance. Next we show the performance of \textsc{BnB}\xspace on synthetic data and show its statistical power. Lastly, we show some nice results of class 2 anomalies on a wide variety of real world datasets.
We implemented our algorithms in C++ and generated our synthetic data using Python. Our code, both to compute anomaly scores and to generate synthetic data, is available for research purposes.\!\footnote{\url{http://eda.mmci.uni-saarland.de/bnb/}} All experiments were conducted on a 2.6 GHz system with 64 GB of memory.
\subsection{Generating Synthetic Data}
Here we describe how we generated both transaction and categorical synthetic data.
\subsubsection*{Transaction Data} \label{sec:gentra}
To generate synthetic transaction datasets we first choose the number of transactions $|D\xspace|$ and the size of the alphabet $|\Omega|$. Further, we generate a set of random patterns $\mathcal{P}$ and for each pattern in this set we choose a random support in the range [5-10\%] and a random size from 3 to 6 items. In addition we similarly generate 2 more patterns with a support of 20\%, which we call the anomaly generators. Then we build our dataset by first adding the 2 anomaly generators for which we make sure that they only occur together in the same transaction once; that is the anomaly. Thereafter, we do the following for each transaction. With the probability corresponding to its support each pattern from $\mathcal{P}$ is added to the transaction as long as it does not interfere with the anomaly. In addition, each singleton from $\Omega$ is added to each transaction similarly with a probability of 10\%.
\subsubsection*{Categorical Data}\label{sec:gencat}
To generate categorical data we take a similar approach. Firstly, we choose the number of transactions $|D\xspace|$, the number of attributes $|A|$ and the alphabet size per attributes $|\Omega_i|$. We generate random patterns with the same settings as for transaction data and again first add the anomaly generators to the dataset. We then try to add the other patterns as long as they fit and do not interfere with the anomaly. Then we fill the unspecified attributes for each transaction with random singletons.
\subsection{Baseline Comparison}
In the following sections we will show that \textsc{BnB}\xspace gives very reliable scores, but first we show its efficiency here. To emphasise the necessity for using small pattern sets as input for our \textsc{BnB}\xspace score we compare the use of \textsc{Slim}\xspace \cite{smets:12:slim} pattern sets with a minimum support of 1 against the use of all closed frequent patterns with a minimum support at 5\%. We generated random transaction data with $|D\xspace|$ = 5\,000, $|\Omega|$ = 50 and we ranged $|\mathcal{P}|$ from 10 to 35 patterns. We then ran our method on both input sets keeping track of the runtimes and the size of the input set $\CS$ for which we have to consider all $|\CS| \times |\CS|$ possible combinations. Both approaches always rank the anomaly highest, therefore further we can focus on the runtime and the number of patterns that were considered. Note that, the runtimes include the time needed to compute the used pattern sets, however, these are negligible as the exponential growth in runtime for the baseline approach is caused by the exponential growth of $\CS$. Figure~\ref{fig:baseline} shows the results which are averages over 5 runs per setting. For higher minimum support thresholds the baseline approach starts missing important patterns and it cannot identify the anomaly. Other settings for generating synthetic data lead to a similar figure. Since using a \textsc{Slim}\xspace pattern set as input set for \textsc{BnB}\xspace we attain similar results compared to the baseline approach, that is we correctly identify the planted anomaly, in the remainder of this paper we always use the \textsc{Slim}\xspace pattern set to compute the \textsc{BnB}\xspace score.
\begin{figure}[t]
\centering
\includegraphics[width=8cm]{FPvsCT.png}
\caption{\textbf{\textsc{Slim}\xspace pattern set versus closed frequent patterns (baseline).} We computed the \textsc{BnB}\xspace scores on 5\,000 transactions using both input sets with a minimum support of 1 for \textsc{Slim}\xspace and at 5\% for the baseline. Using both input sets $\mathcal{S}$ the anomaly is always ranked first, but for the baseline both $|\mathcal{S}|$ and the runtime quickly explode when we increase the number of planted patterns in the data. The runtimes include the time needed to compute the used input set. }
\label{fig:baseline}
\end{figure}
\subsection{Performance on Synthetic Transaction Data}
The goal of this experiment is twofold. Firstly, we show that our method is able to identify class 2 anomalies in transaction data. Secondly, we justify the definition of the different classes of anomalies as we show that the class 2 anomalies are not identified by the state-of-the-art class 1 anomaly detector, which is OC$^3$\xspace \cite{smets:11:odd}. We emphasise again that as a result both scores should not be further compared as they are complementary to each other.
We generated random datasets as described in Section~\ref{sec:gentra} with various settings. The results in Table~\ref{tab:syn-tra} show that \textsc{BnB}\xspace always ranks the anomaly highest and that OC$^3$\xspace does not identify them.
\begin{table}[t]
\centering
\caption{\textbf{The performance of \textsc{BnB}\xspace on transaction data.} The number of generated transactions is represented by $|D\xspace|$, the alphabet size by $|\Omega|$, and the number of synthetic patterns by $|\mathcal{P}|$. All experiments were performed 10 times and the average ranks and runtimes (in seconds) are reported.}
\label{tab:syn-tra}
\begin{tabular}{cccc@{}ccc@{}cc}
\toprule
\multicolumn{3}{l}{\textbf{Generated Data}} && \multicolumn{2}{l}{\textbf{\textsc{BnB}\xspace}} && \multicolumn{2}{l}{\textbf{OC$^3$\xspace}} \\
\cmidrule{1-3}
\cmidrule{5-6}
\cmidrule{8-9}
$|D\xspace|$ &
$|\Omega|$ &
$|\mathcal{P}|$ &
&
rank &
time ($s$)&
&
rank &
time ($s$)\\
\midrule
5\,000 & 50 & 100 && 1 & 4 && 2\,420 & 1 \\
5\,000 & 100 & 100 && 1 & 6 && 2\,757 & 2 \\
5\,000 & 100 & 200 && 1 & 18 && 2\,433 & 4 \\
10\,000 & 100 & 100 && 1 & 11 && 5\,464 & 4 \\
20\,000 & 50 & 100 && 1 & 18 && 8\,281 & 4 \\
\bottomrule
\end{tabular}
\end{table}
\subsection{Performance on Synthetic Categorical Data}
Knowing that \textsc{BnB}\xspace correctly identifies class 2 anomalies for transaction data, here we compared it to the state-of-the-art on categorical data, which is \textsc{CompreX}\xspace \cite{akoglu:12:comprex}. Again we note that we only compare these methods to show that class 2 anomalies are different from class 1 anomalies and that these two methods thus should be used complementary to each other.
We generated random datasets as described in Section~\ref{sec:gencat} with various settings. The results in Table~\ref{tab:syn-cat} show that \textsc{BnB}\xspace always ranks the anomalous transaction first and \textsc{CompreX}\xspace is not able to identify it (gives it a much lower rank).
\begin{table}[t]
\centering
\caption{\textbf{The performance of \textsc{BnB}\xspace on categorical data.} Each dataset contains 5\,000 transactions over $|A|$ attributes, each with an alphabet size of $|\Omega_i|$. The number of synthetic patterns is refered to by $|\mathcal{P}|$. All experiments were performed 10 times. We report the average ranks and runtimes (in seconds).}
\label{tab:syn-cat}
\begin{tabular}{cccc@{}ccc@{}cc}
\toprule
\multicolumn{3}{l}{\textbf{Generated Data}} && \multicolumn{2}{l}{\textbf{\textsc{BnB}\xspace}} && \multicolumn{2}{l}{\textbf{\textsc{CompreX}\xspace}} \\
\cmidrule{1-3}
\cmidrule{5-6}
\cmidrule{8-9}
$|A|$ &
$|\Omega_i|$ &
$|\mathcal{P}|$ &
&
rank &
time ($s$)&
&
rank &
time ($s$) \\
\midrule
20 & 5 & 100 && 1 & 1 && 3\,119 & 221 \\
50 & 5 & 100 && 1 & 6 && 2\,028 & 885 \\
100 & 5 & 100 && 1 & 29 && 3\,121 & 5\,477 \\
20 & 10 & 100 && 1 & 1 && 2\,244 & 429 \\
50 & 10 & 200 && 1 & 5 && 2\,714 & 1\,978 \\
\bottomrule
\end{tabular}
\end{table}
\subsection{Statistical Power}
Our aim here is to examine the power of the \textsc{BnB}\xspace score for identifying class 2 anomalies. For this purpose, we perform statistical tests using synthetic data. To this end, the null hypothesis is that the data contains no class 2 anomalies. To determine the cutoff for testing the null hypothesis, we first generate 100 transaction datasets without the single co-occurrence between the 2 anomaly generators, whereafter we generate another 100 datasets with this co-occurrence included. For all datasets we choose $|D\xspace|$ = 5\,000, $|\Omega|$ = 25 items and $|\mathcal{P}|$ = 100. Next, we report the highest \textsc{BnB}\xspace score for all 100 datasets without anomaly. Subsequently, we set the cutoff according to the significance level $\alpha = 0.05$. The power of the \textsc{BnB}\xspace score is the proportion of the highest scores from the 100 datasets with anomaly that exceed the cutoff. Note that, we only look at the highest score for each dataset as we know that this must be the anomaly for the datasets containing it. We show the results in Figure~\ref{fig:statpow} while varying the the range from which we randomly choose the supports for the patterns in $\mathcal{P}$ from [4-8\%] to [8-16\%] and the support for the anomaly generators from 16\% to 32\%. In Figure~\ref{fig:statpow} we label these linearly growing supports with their growth factor from 1 to 2. With other settings to generate the data we observe the same trend. Again, only to emphasise that methods to identify class 1 anomalies are not suitable to discover class 2 anomalies, in Figure~\ref{fig:statpow} we also plotted the statistical power of OC$^3$\xspace regarding class 2 anomalies. As \textsc{CompreX}\xspace is not applicable to transaction data we performed a similar experiment on categorical data. This resulted in a similar plot with \textsc{BnB}\xspace at the top and \textsc{CompreX}\xspace at the bottom.
\begin{figure}[h]
\centering
\includegraphics[width=8cm]{statpow.png}
\caption{[Higher is better] \textbf{Statistical power of \textsc{BnB}\xspace.} Whereas OC$^3$\xspace does not identify any class 2 anomalies, \textsc{BnB}\xspace does perfectly with large enough supports. We observe the same behaviour for categorical data comparing \textsc{BnB}\xspace and \textsc{CompreX}\xspace (not shown in this plot). The growth factor on the x-axis describes the increase of the pattern supports in the data.}
\label{fig:statpow}
\end{figure}
In Figure~\ref{fig:distr} we show the distribution of the highest scores for both the datasets with and without an anomaly and with pattern supports in range [7-14\%] and an anomaly generator support at 28\%. We can see a clear distinction between the scores for `normal' and anomalous transactions.
\begin{figure}[t]
\centering
\includegraphics[width=8cm]{distr.png}
\caption{\textbf{Significance of \textsc{BnB}\xspace scores.} The plot shows a clear separation between the highest \textsc{BnB}\xspace scores for random synthetic datasets with and without class 2 anomalies.}
\label{fig:distr}
\end{figure}
\subsection{Real World Data}
To show that class 2 anomalies actually exist, are not identified by the state-of-the-art in anomaly detection, and can give much insight we performed multiple experiments on real world datasets from various domains. We used the \textit{Adult}, \textit{Zoo} and \textit{Bike Sharing} datasets from the UCI repository,\!\footnote{\url{http://archive.ics.uci.edu/ml/datasets.html}} together with the \textit{Mammals} \cite{mitchell-jones:societas} en \textit{ICDM Abstracts} \cite{debie:11:dami} datasets.
\subsubsection*{Adult}
The \textit{Adult} dataset contains information about 48\,842 people about their age, education, occupation, marital-status and more and is used to predict whether someone's income exceeds \$50K a year.
We computed a ranking based on the \textsc{BnB}\xspace score and found some interesting anomalies. The top-ranked transaction contains the very unexpected co-occurrence of someone for which the attribute sex is female yet for whom the relationship status has the value of husband. The following 3 anomalies are persons with a similar situation but with the patterns reversed. That is, the dataset contains 3 persons who's sex is male and who's relationship is wife. The OC$^3$\xspace rankings of these first 4 people are 115, 148, 89 and 4\,090, respectively. These examples show that class-2 anomalies indeed exist in real datasets, and that \textsc{BnB}\xspace is effective at identifying these -- whether for further investigation, or data cleaning.
To get an idea of the significance of these results we performed the significance test as described in Section~\ref{sec:sig}. Figure~\ref{fig:sig-adult} shows the difference in the distribution of highest scores for bootstrap samples without (blue) and possibly with (red) the top-ranked transaction from the original dataset. Figure~\ref{fig:sig-adult} gives insight in how much this transaction deviates from the norm, as the difference between the two distributions can only be caused by this transaction.
\begin{figure}[t]
\centering
\includegraphics[width=8cm]{adult_significance.png}
\caption{\textbf{Significance test on \textit{Adult} dataset.} This plot shows the difference in the distribution of highest scores for bootstrap samples without (blue) and possibly with (red) the highest ranked transaction from the original dataset.}
\label{fig:sig-adult}
\end{figure}
\subsubsection*{Zoo}
The \textit{Zoo} data contains 17 attributes describing 101 different animals.
We performed the bootstrap method described in Section~\ref{sec:inves} to determine which transactions are worth investigating. To this end, we generated 1\,000 bootstrap samples for which we computed the anomaly scores for all transactions. In Figure~\ref{fig:thresh} we show the distribution of all these scores with a histogram. Further, in the left plot we show the threshold ($\theta$) values corresponding to false-negative rates (FNR) of 50\%, 20\%, 10\% and 5\% respectively, together with the number of transactions from the original dataset that score above $\theta$. In the right plot we show the anomaly scores of the 5 highest ranked transactions in the original dataset together with the FNR corresponding to a $\theta$ equal to their score.
In Figure~\ref{fig:thresh} in the left plot we see that with an FNR below 10\% only the top-ranked transaction scores above $\theta$. This transaction contains information about the platypus (duck bill) and from our results we found that the co-occurrence causing this high score is that the platypus is the only oviparous mammal in the dataset. In Figure~\ref{fig:thresh} in the right plot we see that the chance that the second ranked animal belongs to the positive class is less than 11\%. This is the scorpion for which \textsc{BnB}\xspace found that it is the only animal without teeth that is not oviparous.
\begin{figure*}[h]
\centering
\includegraphics[width=17cm]{threshold_zoo.png}
\caption{\textbf{Anomalies in the \textit{Zoo} dataset.} The histogram shows the estimated distribution of anomaly scores. (left) The vertical lines show the decision thresholds at false-negative rates of 50\%, 20\%, 10\% and 5\%, together with the number of original transactions that score above the threshold. (right) The vertical lines show the scores of the top-5 ranked anomalies in the original dataset, together with the false-negative rates corresponding to the decision threshold for their score.}
\label{fig:thresh}
\end{figure*}
\subsubsection*{ICDM Abstracts}
Next we ran our algorithm on the \textit{ICDM Abstracts} dataset. This dataset consists of the abstracts from the ICDM conference, after stemming, and removing stopwords.\!\footnote{The data is available upon request from the author of~\cite{debie:11:dami}.}
For this data we would expect co-occurrences of terms used in different research (sub)fields to rank highly. In Table~\ref{tab:icdm} we show the top 5 highest ranked abstracts with their explanation. That is, we show the unexpected co-occurrence responsible for the high \textsc{BnB}\xspace score. Further, only to show that these class 2 anomalies are not identified by the state-of-of-the-art, we show their OC$^3$\xspace rank. The abstract with the highest \textsc{BnB}\xspace rank contains both the frequently used words `pattern mining' and `training', which is an unexpected combination. After reading the corresponding abstract it appears that the term `training' was used to refer to physical exercise rather than that of an algorithm. Other highly ranked abstracts show similar unexpected co-occurrences, for example `learning' on one side and `frequent pattern mining' on the other or `frequent pattern mining' and `compare', which suggest that exploratory algorithms are difficult to compare.
\begin{table*}[h]
\centering
\caption{\textbf{The top 5 out of 859 abstracts from \textit{ICDM Abstracts}, with the corresponding unexpected co-occurrences explaining the high \textsc{BnB}\xspace scores.} Next to the \textsc{BnB}\xspace rank also the OC$^3$\xspace rank is reported to show that class 2 anomalies are not identified, but ranked low, using an algorithm constructed for class 1 anomalies. }
\label{tab:icdm}
\begin{tabular}{cccccc}
\toprule
\textbf{\textsc{BnB}\xspace} &&&& \textbf{OC$^3$\xspace} \\
\cmidrule{1-3}
\cmidrule{5-5}
& \multicolumn{2}{l}{\textbf{Most unexpected co-occurrence explaining the anomaly score}} && \\
\cmidrule{2-3}
Rank & Pattern A & Pattern B && Rank \\
\midrule
1 & ['mine', 'pattern'] & ['train'] && 165 \\
2 & ['algorithm', 'mine', 'pattern', 'frequent'] & ['learn'] && 183 \\
3 & ['rule'] & ['vector'] && 132 \\
4 & ['frequent', 'itemset'] & ['learn'] && 193 \\
5 & ['mine', 'pattern', 'frequent'] & ['compar'] && 556 \\
\bottomrule
\end{tabular}
\end{table*}
\subsubsection*{Mammals}
The \textit{Mammals} dataset consists of presence/absence records of 121 European mammals within 2\,183 geographical areas of 50 $\times$ 50 kilometres.\!\footnote{The full dataset~\cite{mitchell-jones:99:atlas} is available upon request from the Societas Europea Mammalogica, \url{http://www.european-mammals.org}.} In this dataset an anomaly constitutes two large territories of (groups of) animals which only overlap in a small region.
Figure~\ref{fig:mam} shows two top-ranked area's (in red and pointed to by arrows) and readily explains why these are anomalous. For each of these two area's two groups of animals share this territory where the rest of their territory is completely separated. On the left in Figure~\ref{fig:mam} we see that the large habitat of the beech marten intersects with that of the moose, the European hedgehog and the mountain hare only in this single area. On the right in Figure~\ref{fig:mam} we see a similar phenomenon for the Etruscan shrew on one side and the raccoon dog on the other. The ranks of these two areas using OC$^3$\xspace are 591 and 294 out of the 2\,183, respectively. There are also top-ranked areas that are explained by two groups of animals which habitat intersects in multiple areas (of course including the area that has received this score).
\begin{figure}[h]
\centering
\includegraphics[width=8cm]{mammals.png}
\caption{\textbf{\textsc{BnB}\xspace in action; top-ranked anomalies on the \textit{Mammals} dataset.} The explanations for these highly ranked area's are as follows. On the left we see that the habitat of the beech marten (blue) only intersects with that of the moose, European hedgehog and mountain hare (green) at the (red) area pointed to by the arrow. On the right we see the habitat of the Etruscan shrew (blue) only intersects with that of the raccoon dog (green) at the (red) area pointed to by the arrow.}
\label{fig:mam}
\end{figure}
\subsubsection*{Bike Sharing}
The \textit{Bike Sharing} dataset contains the daily count of rental bikes in the years 2011 and 2012 in the Capital Bikeshare system with corresponding weather and seasonal information.
The \textsc{BnB}\xspace score of the highest ranked day in the dataset is not the result of any rental behaviour, but shows a very rare co-occurrence of a relatively low real temperature in combination with a relatively high apparent (perceived) temperature. This indeed seems strange as people more often feel colder as a result of wind-chill. Although this anomaly gives us no information about bike sharing, it is an actual class 2 anomaly present in the data.
\section{Discussion} \label{sec:dis}
The experiments show that although the state-of-the-art in anomaly detection is not able to identify the newly defined class 2 anomalies, we can identify them using our new \textsc{BnB}\xspace score. We demonstrated that a naive baseline approach using closed frequent items as input set quickly becomes infeasible when the number of patterns present in the data grows. Using a \textsc{Slim}\xspace pattern set to compute our \textsc{BnB}\xspace score, however, we attain similar results in a fraction of the time. We showed the statistical power of our method which scores transactions containing planted class 2 anomalies significantly higher than `normal' transactions. Moreover, both on transaction and categorical synthetic data we showed that \textsc{BnB}\xspace always ranked the planted anomaly at the top.
From our experiments on real world datasets we find that the class 2 anomalies do actually exist and can provide useful insights. That is, because next to identifying interesting transactions the \textsc{BnB}\xspace score also readily explains which co-occurrence of patterns is responsible for the transaction's anomaly score. For example, in the \textit{Adult} dataset we found a very unexpected individual who is described as being a female husband. Further we showed how a \textsc{BnB}\xspace ranking can be used to study the significance of identified anomalies using a bootstrap approach. For example, in the \textit{Zoo} dataset we found that the platypus, which is special because its the only oviparous mammal, has a less than 8\% chance on being `normal' given the data. Each of these class 2 anomalies were not identified, i.e.\ ranked low, using OC$^3$\xspace or \textsc{CompreX}\xspace.
\section{Conclusion} \label{sec:con}
In this paper we introduced a new class of anomalies which we refer to as unexpected co-occurrences of patterns. We showed that the anomalies identified by state-of-the-art in anomaly detection are of a different class and that these methods are not able to identify unexpected co-occurrences of patterns. We introduced the \textsc{BnB}\xspace score which intuitively scores a transactions based on its most unexpected co-occurrence of patterns. Using \textsc{BnB}\xspace we ably identify all planted anomalies in synthetic data and find interesting explanations for anomalous transactions in real world data. Besides useful for identifying interesting behaviour, \textsc{BnB}\xspace also makes it possible to detect errors in data that previous methods cannot, making it also very suited for data cleaning purposes.
\section*{Acknowledgments}
Roel Bertens and Arno Siebes are supported by the Dutch national program COMMIT.
Jilles Vreeken is supported by the Cluster of Excellence ``Multimodal Computing and Interaction'' within the Excellence Initiative of the German Federal Government.
\balance
\bibliographystyle{abbrv}
| {'timestamp': '2016-02-11T02:09:11', 'yymm': '1512', 'arxiv_id': '1512.07048', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.07048'} | arxiv |
\section{Introduction}
\noindent Convolutional neural networks (CNNs) have made great progress in various
fields, such as object classification~\cite{krizhevsky2012imagenet},
detection~\cite{RCNN} and character
recognition~\cite{cirecsan2011convolutional}. One of the key factors
contributing to the success of the modern deep learning models is using the non-saturated
activation function (\textit{e.g.} ReLU) to replace its saturated counterpart
(\textit{e.g.} sigmoid and tanh), which not only solves the problem of ``exploding/vanishing
gradient" but also makes the deep networks converge fast. Among all the
proposed non-saturated activation functions, the Rectified Linear Unit (ReLU)~\cite{ReLU} is widely viewed as one of the several reasons for the remarkable performance of deep
networks ~\cite{krizhevsky2012imagenet}.
Recently, there are some other activation functions proposed to boost the performance of CNNs. Leaky ReLU (LReLU)~\cite{LReLU}
assigns the negative part with a non-zero slope.~\cite{PReLU} proposed the parametric rectified
linear unit (PReLU), which requires learning the negative part instead of using predefined values. Adaptive piecewise linear activation (APL) proposed in~\cite{learnactivationfunction} sums up several hinge-shared linear
functions.~\cite{maxout} proposed the ``maxout" activation function,
which approximates arbitrary convex functions by computing the maximum of $k$ linear functions for each neuron as the output.
Although the activation functions mentioned above have been reported to achieve
good performance in CNNs, they all suffer from a weaknesses, \textit{i.e.,} their limited
ability to learn non-linear transformation. For example, none of ReLU, LReLU, PReLU and maxout can learn the non-convex
functions since they are essentially all convex functions. Although APL can approximate
non-convex function, it requires the rightmost linear function in all the component
functions to have a unit slope and bias 0, which is an inappropriate
constraint and undermines its representation ability.
Inspired by the fundamental Webner-Fechner law~\cite{weber1851annotationes} and Stevens law~\cite{stevens} in psychophysics and
neural sciences, we propose a novel kind of activation unit, namely the S-shaped
rectified linear unit (SReLU). Two examples of SReLU's function forms are
shown in Figure~\ref{activationlaw}(c)(d). Briefly speaking, both the
Webner-Fechner law and the Stevens law describe the relationship between
the magnitude of a physical stimulus and its perceived intensity or strength~\cite{neuralcoding}. The Webner-Fechner law holds that the perceived magnitude $s$ is
a logarithmic function of the stimulus intensity $p$ multiplied by a modality and a
dimension specific constant $k$. That is,
\begin{equation}
\label{eq:Webner-Fechner} s = k\log p.
\end{equation} And the Stevens law explains the relationship through a power
function, \textit{i.e.},
\begin{equation}
\label{eq:Stevens} s = kp^e,
\end{equation} where all the parameters have the same definitions as in the
Webner-Fechner law, except for an additional parameter $e$ which is an exponent depending on the type of the stimulus. The function forms proposed by the two
laws are shown in Figure~\ref{activationlaw}(a)(b). These laws are usually valid for
general sensory phenomena and can account for many properties of sensory
neurons~\cite{animalphysiology}. More detailed discussions will be
presented in Related Work.
Roughly, SReLU consists of three piecewise linear functions constrained by
four learnable parameters as shown in Eqn.~(\ref{eq:SReLU}). The usage of SReLU brings two advantages to the deep
network. Firstly, SReLU can learn both
convex and non-convex functions, without imposing any constraints on its learnable parameters, thus the deep
network with SReLU has a stronger feature learning capability. Secondly, since SReLU
utilizes piecewise linear functions rather than saturated functions, thus it shares the same advantages of the non-saturated
activation functions: it does not suffer from the ``exploding/vanishing gradient" problem
and has a high computational speed during the forward and back-propagation of deep
networks. To verify the effectiveness of SReLU, we test it with two popular deep
architectures, Network in Network and GoogLeNet, on
four datasets with different scales, including
CIFAR10, CIFAR100 and MNIST and ImageNet. The experimental
results have shown remarkable improvement over other activation functions.
\section{Related Work}
\begin{figure}[!t] \centering \hspace{-0.2cm}
\includegraphics[width=8cm]{af}
\caption{Piecewise linear activation functions: ReLU, LReLU, PReLU, APL and
maxout.}
\label{af}
\end{figure} In this section, we first review some activation units
including ReLU, LReLU, PReLU, APL and maxout. Then we introduce two basic laws
in psychophysics and neural sciences: Webner-Fechner law~\cite{fechner} and
Stevens law~\cite{stevens}, as well as our motivation.
\subsection{Rectified Units}
\begin{itemize}
\item Rectified Linear Unit (ReLU) and Its Generalizations\\ ReLU~\cite{ReLU} is defined as
\begin{equation}
\label{eq:ReLU} h(x_i) = \max (0,x_i )
\end{equation}
where $x_i$ is the input and $h(x_i)$ is the output. LReLU ~\cite{LReLU} assigns a slope to its negative input. It is defined as
\begin{equation}
\label{eq:LReLU} h(x_i) = \min (0,a_i x_i ) + \max (0,x_i )
\end{equation}
where $a_i\in(0,1)$ is a predefined slope. PReLU is only different from LReLU in that the former needs to learn the slope parameter
$a_i$ via back propagation during the training phase.
\item Adaptive Piecewise Linear Units (APL)
APL is defined as a sum of
hinge-shared functions:
\begin{equation}
\label{eq:APL} h(x_i ) = \max (0,x_i ) + \sum\limits_s^S {a_i^s \max (0, - x_i
+ b_i^s )},
\end{equation} where $S$ is the number of hinges, and the variables $a_i^s,b_i^s,
i\in 1,...,S$ are parameters of linear functions.
\quad One disadvantage of APL is it explicitly forces the rightmost line to have unit slope 1 and bias
0. Although it is stated that if the output of APL
serves as the input to a linear function $wh(x_i)+z$, the linear function will
restore the freedom of the rightmost line which is lost due to the constraint, we argue that
this does not always hold because in many cases for deep networks, the function taking the output of APL as the input is non-linear or unrestorable,
such as local response normalizatioin~\cite{krizhevsky2012imagenet} and
dropout~\cite{krizhevsky2012imagenet}.
\item Maxout Unit\\ Maxout unit takes as the input the output of multiple linear
functions and returns the largest:
\begin{equation}
\label{eq:5} h(x_i ) = \mathop {\max }\limits_{k \in \{ 1,...,K\} } w^k \cdot
x_i + b^k.
\end{equation}
\end{itemize}
In theory, maxout can approximate any convex
function~\cite{maxout}, but unfortunately, it lacks the ability to learn non-convex
functions. Moreover, a large number of extra parameters introduced by the $K$ linear functions of each
hidden maxout unit result in large storage memory cost
and considerable training time, which affect the training efficiency of very deep
CNNs, \textit{e.g.} GoogLeNet~\cite{googlenet}.\\
\subsection{Basic Laws in Psychophysics and Neural Sciences} The Webner-Fechner
law~\cite{fechner} and the Stevens law~\cite{stevens} are two basic laws in
psychophysics~\cite{animalphysiology}~\cite{neuralcoding} and neural
sciences~\cite{actionratedayan2001theoretical}. Webner first observed through
experiments that the amount of change needed for sensory detection to occur
increases with the initial intensity of a stimulus, and is proportional to
it~\cite{weber1851annotationes}. Based on Webner's work, Fechner proposed the
Webner-Fechner law which developed the theory by stating that the subjective sense of intensity is related
to the physical intensity of a stimulus by a logarithmic function, which is
formulated as Eqn.~(\ref{eq:Webner-Fechner}) and shown in Figure~\ref{activationlaw}(a). Stevens refuted the Webner-Fechner law by arguing that the
subjective intensity is related to the physical intensity of a stimulus by a power function~\cite{neuralcoding}, which is formulated as Eqn.~(\ref{eq:Stevens}) and shown
in Figure~\ref{activationlaw}(b). The two laws have been verified through lots of experiments~\cite{naturecounting}. For example, in vision, the
amount of change in brightness with respect to the present brightness accords with the
Webner-Fechner law, \textit{i.e.,} Eqn.~(\ref{eq:Stevens}).~\cite{stevens}
shows various examples, one of which is that the perception of
pain and taste follows the Stevens law but with different exponent values. In neural
sciences, these two laws also explain many properties of sensory
neurons and the response characteristics of receptor
cells~\cite{naturecounting}~\cite{actionratedayan2001theoretical}. The more detailed
discussion is beyond the range of this paper.
Motivated by the previous research on these two laws, we propose SReLU
which imitates the logarithm function and the power function given by the Webner-Fechner law and the Stevens law, repectively, and uses piecewise linear functions to approximate non-linear convex and non-convex functions. Through experiments, we find that our method can be universally used for current deep networks, and significantly boosts the performance.
\section{S-shaped Rectified Linear Units (SReLU)} In this section, we introduce
in detail our proposed SReLU. Firstly, we present the definition and the training process of SReLU. Secondly, we propose a method to initialize the parameters of SReLU as a good starting point for training. Finally, we discuss the relationship of SReLU with other activation
functions.\\
\subsection{Definition of SReLU} SReLU is essentially defined as a combination of three
linear functions, which perform mapping $\mathbb{R} \to \mathbb{R}$ with the
following formulation: \\
\begin{equation}
\label{eq:SReLU} h(x_i) = \left\{ \begin{array}{l} t_i^r + a_i^r (x_i - t_i^r
),\,\,\,x_i \ge t_i^r \\
x_i,\qquad\qquad\, t_i^r > x_i > t_i^l \\
t_i^l + a_i^l (x_i - t_i^l ),\,\,\,\,\,x_i \le t_i^l \\
\end{array} \right.
\end{equation}
where $\left\{t_i^r, a_i^r, t_i^l, a_i^l\right\}$ are four
learnable parameters used to model an individual SReLU activation unit. The subscript $i$
indicates that we allow SReLU to vary in different channels. As shown in Figure~\ref{activationlaw}(c)(d), in the positive direction, $a_i^r$ is the slope of the right line when the
inputs exceed the threshold $t_i^r$. Symmetrically, $t_i^l$ is used to represent
another threshold in the negative direction. When the inputs are smaller than $t_i^l$,
the outputs are calculated by the left line. When the inputs of SReLU fall into the range of
$\left( t_i^l, t_i^r \right)$, the outputs are linear functions with unit slope 1 and bias 0.
By designing SReLU in this way, we hope that it can imitate the
formulations of multiple non-linear functions, including the logarithm function (Eqn.~(\ref{eq:Webner-Fechner})) and the power function (Eqn.~(\ref{eq:Stevens})) given by the Webner-Fechner law and the Stevens law, respectively. As shown in Figure~\ref{activationlaw}(c), when $t_i^r >1, a_i^r > 0$, the
positive part of SReLU imitates the power function with
the exponent $e$ larger than 1; when $1 > t_i^r > 0, a_i^r > 0$,
the positive part of SReLU imitates the logarithm function; when $t_i^r=1, a_i^r > 0$, SReLU follows the power function with the exponent 1. For the negative part of SReLU, we have a similar observation except for the inverse representation of the logarithm function and the power function as analyzed for its positive counterpart. The reason for setting the middle line to be a linear function
with slope 1 and bias 0 when the input is within the range $\left( t_i^l, t_i^r \right)$ is that it can better approximate both Eqn.~(\ref{eq:Webner-Fechner}) and Eqn.~(\ref{eq:Stevens}) using such a function, because the change of the outputs with respect to the inputs is slow when the inputs are in small magnitudes.
Unlike APL which restricts the form of rightmost line, we do not apply any constraints or regularization to the
parameters, thus both the thresh parameters and slope parameters can be learned freely as the training goes on. It is
noteworthy that no divergence of deep networks occurs although SReLU is allowed to be trained without any constraints in all of our experiments. As shown in Table 3, the learned parameters are all in reasonable condition.
In our method, we learn an independent SReLU following each channel of
kernels. Thus the number of the parameters for SReLU in the deep
networks is only $4N$, where $N$ is the overall number of
kernel channels in the whole network. Compared with the large number of parameters in CNNs,
\textit{e.g.} 5 million parameters in GooLeNet~\cite{googlenet}, such an increase in the number
of parameters (21.7K in GoogLeNet with SReLU, as shown in Table~\ref{imagenet_compare}) is negligible. This is a good
property of SReLU, because on one hand, we avoid the overfitting effectively by increasing only a negligible number of parameters, and on the
other hand we keep the memory size and the computing time almost
unchanged. Similar to PReLU~\cite{PReLU}, we also try the channel-shared variant of SReLU. In this case the number of SReLU is equal to the overall number of layers in the deep network. In Tabel 1, we compare the performance of these two variants of SReLU on CIFAR-10 without data augmentation and find that the channel-wise version performs slightly better than the channel-shared version.
\begin{table}[!t]
\caption{Comparison of error rates between the channel-shared variant and
the channel-wise variant of SReLU on CIFAR-10 without data augmentation.}
\centering \small
\begin{tabular}{ll}
\hline Model & Error Rates \\
\hline NIN + ReLU [Lin
et. al.] & 10.43\% \\
NIN + SReLU (channel-shared) & 9.01\% \\
NIN + SReLU (channel-wise) \ \ \ \ \ \ \ \ & 8.41\% \\ \hline
\end{tabular}
\label{channelwise-shared}
\end{table}
With respect to the training of SReLU, we use the gradient descent algorithm and
jointly train the parameters of SReLU with the deep networks. The update rule of
$\left\{t_r, a_r, t_l, a_l\right\}$ is derived by the chain rule:
\begin{equation}
\label{eq:chain-rule} \frac{{\partial L}}{{\partial t_i^r }} =
\sum\limits_{x_i } {\frac{{\partial L}}{{\partial h(x_i )}}} \frac{{\partial
h(x_i )}}{{\partial o_i }}
\end{equation}
where $o_i\in\left\{t_i^r ,a_i^r ,t_i^l ,a_i^l\right\}$ and $L$
represents the objective function of the deep network. The term
${\frac{{\partial L}}{{\partial h(x_i )}}}$ is the gradient back-propagated from the
higher layer of SReLU. The summation $\sum\nolimits_{x_i } $ is applied in all positions of
the feature map. For the channel-shared variant, the gradient of $o_i$ is
$\frac{{\partial L}}{{\partial o_i }} = \sum\nolimits_i {\sum\nolimits_{x_i }
{\frac{{\partial L}}{{\partial h(x_i )}}} } \frac{{\partial h(x_i )}}{{\partial
o_i }}$, where $\sum\nolimits_{x_i } $ is the sum over all channels in each
layer. Specifically, the gradient for each parameter of SReLU is given by
\begin{equation}
\label{eq:gradient-srelu}
\begin{array}{l} \frac{{\partial h(x_i )}}{{\partial t_i^r }} = I\{ x_i \ge
t_i^r \} (1 - a_i^r) \\ \frac{{\partial h(x_i )}}{{\partial a_i^r }} = I\{ x_i
\ge t_i^r \} (x_i - t_i^r ) \\ \frac{{\partial h(x_i )}}{{\partial t_i^l }} =
I\{ x_i \le t_i^l \} (1 - a_i^l) \\ \frac{{\partial h(x_i )}}{{\partial a_i^l }}
= I\{ x_i \le t_i^l \} (x_i - t_i^l ) \\
\end{array}
\end{equation} where $I\{ \cdot \} $ is an indicator function and $I\{ \cdot
\}=1 $ when the expression inside holds true, otherwise $I\{ \cdot \}=0 $. By
this way, the gradient of the input is
\begin{equation}
\label{eq:gradient-input} h(x_i ) = \left\{ \begin{array}{l} a_i^r ,\,\,\,\,x_i
\ge t_i^r \\ 1\,\,\,,\,\,\,\,t_i^r > x_i > t_i^l \\
a_i^l ,\,\,\,\,x_i \le t_i^l .\\
\end{array} \right.
\end{equation}
The rule for updating $o_i$ by momentum method is:
\begin{equation}
\label{eq:update-srelu} \Delta o_i : = \mu \Delta o_i + \varepsilon
\frac{{\partial L}}{{\partial o_i }}.
\end{equation}
Here $\mu$ is the momentum and $\varepsilon$ is the learning
rate. Because the weight decay term tends to pull the parameters to zero, we do
not use weight decay ($l_2$ regularization) for $o_i$.\\
\subsection{Adaptive Initialization of SReLU}
\begin{figure}[!t] \centering
\includegraphics[width=6cm]{magnitude_googlenet}
\caption{The distribution of the magnitude of the input to SReLU following convolution layers in GoogLeNet. The indexes of convolution layers follow a low-level to high-level order. The magnitudes shown here are calculated by averaging the activations of all SReLUs in each layer.}
\label{magnitude_googlenet}
\end{figure} One problem we are faced in training SReLU is how to
initialize the parameters in SReLU. An intuitive way is to set the parameters manually. However,
such an initialization method is cumbersome. Furthermore, if the manually set initialization values are not appropriate, \textit{e.g.} too large or too small compared with the real value of its input, SReLU may not work well. For example, if $t_i^r$ is set to be very large, based on Eqn.~(\ref{eq:gradient-srelu}), nearly all the inputs for the SReLU will lie in the
left part of $t_i^r$, which will cause $t_i^r$ and $a_i^r$ to be insufficiently learned. In current deep networks, the magnitude of the inputs in
each layer varies a lot (see Figure~\ref{magnitude_googlenet}), making it more
difficult to manually set parameters. To deal with this problem, we propose to
firstly initialize each $o_i$ to be $\{\tilde t_i , 1, 0, \tilde a_i \}$ in all
layers, where $\tilde t_i$ is any positive real number and $\tilde a_i \in
\left(0, 1\right)$, and we ``freeze" the update of the parameters of SReLU during the initial several training epochs. By this method, SReLU is degenerated into a conventional LReLU at
the beginning of the training. Then upon the end of the ``freezing" phase, we set $t_i^r$ to be the largest $k^{th}$ value of each SReLU's input from all training data, \textit{i.e.},
\begin{equation}
\label{eq:initialization-srelu} t_i^r=\textrm{supp}\left(\mathbf{X_i},k\right)
\end{equation}
where $\textrm{supp}\left(\mathbf{X}, k\right)$ calculates the $k^{th}$
largest value from the set $\textbf{X}$, and $\mathbf{X_i}$ represents all the input
values of an individual SReLU. Our initialization method offers following two advantages.
Firstly, it learns adaptively the initial values of $t_i$ to fit better to the real distributions of the training data, thus providing a good starting point for the training of SReLU. Secondly, it enables SReLU to re-use the per-trained model with LReLU, thus it can reduce the training time compared with training the whole network from the scratch.
\subsection{Comparison with Other Activation Functions} In this part, we compare
our method with five published nonlinear activation functions: ReLU, LReLU,
PReLU, APL and maxout.
By checking Eqn.~(\ref{eq:ReLU}), Eqn.~(\ref{eq:LReLU}) and Eqn.~(\ref{eq:SReLU}), it can be easily concluded that ReLU, LReLU and PReLU can be seen as special cases of
SReLU. Specifically, when $t_i^r\geq 0,a_i^r=1,t_i^l=0,a_i^l=0$, SReLU
is degenerated into ReLU; when $t_i^r \geq 0, a_i^r=1, t_i^l=0, a_i^l > 0$,
SReLU is transformed to LReLU and PReLU. However, ReLU, LReLU and PReLU can
only approximate convex functions, while SReLU is able to approximate both
convex and non-convex functions. Compared with APL, when the inputs have large magnitudes and lie in the rightmost region of the activate function, SReLU allows its parameters to take more flexible values and gives output features with adaptive scaling over the inputs. This is similar to the Webner-Fechner law that has logarithm function form to suppress the outputs for the input with too large magnitude. SReLU models such suppression effect by learning the slope of its rightmost line adaptively. In contrast, APL constrains the output to be same as input even when the inputs have very large magnitudes. This is the key difference between SReLU and APL and also the main reason why SReLU consistently outperforms APL. The experimental results shown in Table 2 clearly demonstrate this point. Without data augmentation and the proposed initialization strategy, NIN + SReLU outperforms NIN + APL by 0.98\% and 3.04\% on CIFAR-10 and CIFAR-100, respectively. Compared to maxout, which can only approximate convex functions and introduces a large number of extra parameters, SReLU needs much less parameters, therefore SReLU is more suitable for training very deep networks, \textit{e.g.} GoogLeNet.
\section{Experiments and Analysis}
\subsection{Overall Settings} To evaluate our method thoroughly, we conduct
experiments on four datasets with different scales, including CIFAR-10, CIFAR-100~\cite{cifar}, MNIST~\cite{MNIST} and a much larger dataset, ImageNet~\cite{imagenet} with two popular deep networks, \textit{i.e.,} NIN~\cite{NIN} and GoogLeNet~\cite{googlenet}.
NIN is used on CIFAR-10, CIFAR-100 and MNIST and GoogLeNet
is used on ImageNet. NIN replaces the single linear
convolution layers in the conventional CNNs by multilayer perceptrons, and uses
the global average pooling layer to generate
feature maps for each category. Compared to NIN, GoogLeNet is much larger with
22 layers built on \textit{Inception} model, which can be seen as a deeper and
wider extension of NIN. Both these two networks have achieved state-of-the-art
performance on the datasets we use.
Since we mainly focus on testing the effects of SReLU on the performance of deep
networks, in all our experiments, we only replace the ReLU in the original networks with SReLU and keep the other parts of
networks unchanged. For the setting of hyperparameters (such as learning rate,
weight decay and dropout ratio, etc.), we follow the published
configurations of original networks. To compare LReLU with our method, we try
different slope values in Eqn.~(\ref{eq:LReLU}) and picks the one that gets the best performance on validation set. For
PReLU in our experiments, we follow the initialization methods
presented in~\cite{PReLU}. For every dataset, we randomly sample 20\% of the
total training data as the validation set to configure the needed hyperparameters in different methods. After fixing
hyperparameters, we train the model from the scratch with the whole
training data. For SReLU, we use $a^l=0.2$ and $k=\lceil0.9\times|\mathbf{X_i}|\rceil$ for all datasets. In
all experiments, we \emph{ONLY} use single model and single view test.
We choose Caffe~\cite{caffe} as the platform to conduct our experiments. To
reduce the training time, four NVIDIA TITAN GPUs are employed in parallel for
training. Other hardware information of the PCs we use includes Intel Core i7
3.3GHz CPU, 64G RAM and 2T hard disk. The codes of SReLU are available at https://github.com/AIROBOTAI/caffe/tree/SReLU.
\begin{table}[!t]
\scriptsize
\caption{Error rates on CIFAR-10 and CIFAR-100. In the column for comparing the
no. of parameters, the number after ``+" is the extra number of parameters (in KB)
introduced by corresponding methods. For the row of NIN + APL, 5.68K and 2.84K
correspond to the extra parameters for CIFAR-10 and CIFAR-100,
respectively.} \centering
\begin{tabular}{llcc} \hline Model & No. of Param.(MB) & CIFAR-10 & CIFAR-100
\\ \hline \multicolumn{4}{c}{ Without Data Augmentation} \\
\hline Maxout & \textgreater 5M & 11.68\% &38.57\% \\
Prob maxout & \textgreater 5M & 11.35\% & 38.14\% \\
APL & \textgreater 5M & 11.38\% & 34.54\% \\
DSN & 0.97M & 9.78\% & 34.57\% \\
Tree based priors & -& - & 36.85\% \\
\hline NIN & 0.97M & 10.41\% & 35.68\% \\
NIN + ReLU & 0.97M & 9.67\% & 35.96\% \\
NIN + LReLU & 0.97M & 9.75\% & 36.00\% \\
NIN + PReLU(ours) & 0.97M + 1.42K & 9.74\% & 35.95\% \\
NIN + APL & 0.97M + 5.68K/2.84K & 9.59\% & 34.40\% \\
NIN + SReLU\footnotemark(ours) & 0.97M + 5.68K & 8.61\% & 31.36\% \\
NIN + SReLU (ours)& 0.97M + 5.68K & \textbf{8.41\%} & \textbf{31.10\%} \\
\hline \multicolumn{4}{c}{ With Data Augmentation} \\
\hline Maxout & \textgreater 5M & 9.38\% &- \\
Prob maxout & \textgreater 5M & 9.39\% & - \\
APL& \textgreater 5M & 9.89\% & 33.88\% \\
DSN & 0.97M & 8.22\% & - \\
\hline NIN & 0.97M & 8.81\% & - \\
NIN + ReLU & 0.97M & 7.73\% & 32.75\% \\
NIN + LReLU & 0.97M & 7.69\% & 32.70\% \\
NIN + PReLU (ours) & 0.97M + 1.42K & 7.68\% & 32.67\% \\
NIN + APL & 0.97M + 5.68K/2.84K & 7.51\% & 30.83\% \\
NIN + SReLU (ours) & 0.97M + 5.68K & \textbf{6.98\%} & \textbf{29.91\%} \\
\hline
\end{tabular}
\label{table:CIFARRESULT}
\end{table}\footnotetext{Manually set initialization parameters in SReLU}
\subsection{CIFAR} The CIFAR-10 and CIFAR-100 datasets contain
color images with size of 32x32 from 10 and 100 classes, respectively. Both of them
have 50,000 training images and 10,000 testing images. The preprocessing methods
follow the way used in~\cite{maxout}. The comparison results of SReLU with
other methods (including maxout~\cite{maxout}, prob maxout~\cite{probmaxout}, APL~\cite{learnactivationfunction}, DSN~\cite{dsn}, tree based priors~\cite{treebased}, NIN~\cite{NIN}, etc.) on these two datasets either when the data augmentation is applied
or not are shown in Tabel~\ref{table:CIFARRESULT}, from which we can see that our proposed SReLU
achieves the best performance against all the compared methods.
When no data augmentation is used, compared with ReLU, LReLU and PReLU, our
method reduces the error significantly by 1.26\%, 1.34\%, 1.33\% on
CIFAR-10, respectively. On CIFAR-100, the error reduction is 4.86\%, 4.90\%, 4.85\%,
respectively. SReLU also demonstrates superiority by surpassing other activation
functions including APL and maxout. When compared with other deep network
methods, such as tree based priors and DSN, our method also beats them
by a remarkable gap, demonstrating a promising ability to help boost the
performance of deep models. We also compare the number of parameters used in
each method, from which we notice that SReLU only incurs a very slight increase
(5.68K) to the total number of parameters (0.97M in original NIN). APL uses the
same number of additional parameters as SReLU on CIFAR-10, but its performance in
either case of applying data augmentation or not is inferior to our method. The convergence curve of SReLU with other methods on CIFAR-10 and CIFAR-100 are shown in Figure 4(a) and Figure 4(b), respectively.
To observe the learned parameters of SReLU, we list in Table~\ref{showSReLUparam} the parameters' values after the training phase. Since the
SReLUs we use are channel-wise, we simply calculate the average of the input for
all SReLUs in the same layer. It is interesting to observe that SReLUs in different
layers learn meaningful parameters in coincide with our motivations. For example, the SReLUs following conv1 and cccp1 learns $a^r$ less
than 1 (0.81 and 0.77, respectively) on CIFAR-10, while SReLUs following conv3 and cccp5 on CIFAR-100 learns $a^r$ larger than 1 (1.42 and 1.36, respectively). SReLU following conv2 on CIFAR-10 learns $a^r$ nearly equal to 1 (1.01). These experimental results verify that SReLU has a strong ability to learn various forms of nonlinear functions, which can either
be convex or non-convex. Moreover, in Table 3, we can see that $t^r$ is of very large value in higher layers. It's because that the inputs of SReLU have higher average values than the ones in lower layers. Therefore, SReLU in higher layers learns larger $t^r$ for adapting to inputs. This demonstrates the strong adaptive ability of SReLU to distribution of its inputs.
In the experiments on the augmented version of CIFAR-10 and CIFAR-100, we simply use random horizontal reflection during training for both datasets. In this case, SReLU still consistently outperforms other methods.
\begin{table}[]
\centering
\caption{The parameters' values of SReLU after training with NIN on CIFAR-10 and CIFAR-100, respectively. The layers listed in the tabel are all convolution layers. ``conv" layers are with kernel sizes larger than 1 and ``cccp" layers are with kernel sizes equal to 1. Each layer in the tabel is followed by channel-wise SReLUs. For more details of the layers in NIN, please refer to~\cite{NIN}}
\label{my-label}\scriptsize
\begin{tabular}{c|c|c|c|c}
\hline
\multirow{2}{*}{layers} & \multicolumn{4}{c}{CIFAR-10 / CIFAR-100} \\ \cline{2-5}
& $t^r$ & $t^l$ & $a^r$ & $a^l$ \\ \hline
conv1 & 0.91 / 0.73 & -0.48 / -0.68 & 0.81 / 0.62 & -0.25 / -0.22\\ \hline
cccp1 & 1.06 / 0.52 & -0.36 / -0.34 & 0.77 / 0.38 & -0.04 / 0.04 \\ \hline
cccp2 & 1.27 / 0.37 & -0.20 / -0.26 & 0.47 / 0.51 & 0.39 / 0.44\\ \hline
conv2 & 5.32 / 4.02 & -0.31 / -0.51 & 1.01 / 0.88 & 0.07 / 0.06\\ \hline
cccp3 & 6.95 / 4.73 & -0.21 / -0.79 & 0.92 / 0.64 & -0.01 / 0.05\\ \hline
cccp4 & 8.18 / 5.79 & -0.08 / -0.13 & 0.77 / 0.56 & 0.61 / 0.45\\ \hline
conv3 & 25.17 / 23.72 & -0.15 / -0.61 & 1.21 / 1.42 & 0.05 / 0.07\\ \hline
cccp5 & 31.09 / 36.44 & -0.47 / -0.46 & 0.97 / 1.36 & -0.16 / -0.02\\ \hline
cccp6 & 72.03 / 66.13 & -0.13 / -0.21 & 1.53 / 1.23 & -0.44 / -0.35\\ \hline
\end{tabular}
\label{showSReLUparam}
\end{table}
\begin{table}[!t]
\label{MNIST_result} \small
\caption{Error rates on MNIST without data augmentation. }
\centering
\begin{tabular}{lll} \hline Model & No. of Param.(MB) & {Error Rates} \\
\hline Stochastic Pooling & - & 0.47\% \\
Maxout& 0.42M & 0.47\% \\
DSN & 0.35M & 0.35\% \\
\hline NIN + ReLU & 0.35M & 0.47\% \\
NIN + LReLU (ours) & 0.35M & 0.42\% \\
NIN + PReLU (ours) & 0.35M + 1.42K & 0.41\% \\
NIN + SReLU (ours)& 0.35M + 5.68K & \textbf{0.35\%} \\
\hline
\end{tabular}
\end{table}
\subsection{MNIST} MNIST~\cite{MNIST} contains 70,000 28x28 gray scale images of
numerical digits from 0 to 9, divided as 60,000 images for training and 10,000
images for testing. In this dataset, we do not apply any preprocessing to the
data and only compare models without data augmentation. The experiment results on
this dataset are shown in Tabel 4, from which we see SReLU performs
better than other methods.
\begin{table}[!t] \scriptsize \renewcommand{\arraystretch}{1}
\caption{Error rates on ImageNet. Tests are by single model single view.}
\label{table_example} \centering
\begin{tabular}{lll} \hline Model & No. of Param.(MB) & Error Rates \\ \hline
GoogLeNet\footnotemark & 5M & 11.1\% \\ GoogLeNet + SReLU (ours)& 5M +
21.6K & \textbf{9.86\%} \\ \hline
\end{tabular}
\label{imagenet_compare}
\end{table}
\footnotetext{\scriptsize{$\textrm{https://}\textrm{github}.\textrm{com/}\textrm{BVLC/}\textrm{caffe/}\textrm{tree/}\textrm{master/}\textrm{models/}\textrm{bvlc}_{\textrm{-}}\textrm{googlenet}$}}
\subsection{ImageNet} To further evaluate our method on large-scale datasets,
we perform a much more challenging image classification task on
1000-class ImageNet dataset, which contains about 1.2 million training images, 50,000
validation images and 100,000 test images. Our baseline model is GoogLeNet
model, which achieved the best performance on image classification in ILSVRC 2014~\cite{ILSVRC15}. We run experiments using the publicly available configurations in
Caffe~\cite{caffe}. For this dataset, no additional preprocessing method is used
except subtracting the image mean from each input raw image.
Table~\ref{imagenet_compare} compares the performance of GoogLeNet using SReLU and the
original GoogLeNet released by Caffe. The GoogLeNet with SReLU achieves
significant improvement (1.24\%) on this challenging dataset compared with the original
GoogLeNet using ReLU, at the cost of only 21.6K additional parameters (versus
the total number of 5M parameters in the original GoogLeNet).
\begin{figure}[!t] \centering \hspace{-0.2cm}
\includegraphics[width=8.5cm]{cifar10-100}
\caption{(a) The convergence curves of SReLU and other methods on CIFAR-10. (b) the convergence curves of SReLU and other methods on CIFAR-100.}
\label{CIFAR-10}
\end{figure}
\section{Conclusion} In this paper, inspired by the fundamental laws in
psychophysics and neural sciences, we proposed a novel S-shaped rectified linear
unit (SReLU) to be used in deep networks. Compared to other activation functions,
SReLU is able to learn both convex and non-convex functions, and can be universally used in existing deep networks. Experiments on four datasets including
CIFAR-10, CIFAR-100, MNIST and ImageNet with NIN and GoogLeNet demonstrate
that SReLU effectively boosts the performance of deep networks. In our future work, we will exploit the applications of SReLU in other domains beyond vision, such as NLP.
\bibliographystyle{aaai} | {'timestamp': '2015-12-23T02:06:04', 'yymm': '1512', 'arxiv_id': '1512.07030', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.07030'} | arxiv |
\section{Introduction}
Content on the Internet is becoming increasingly multilingual. A prime example is Wikipedia. In 2001, the majority of pages were written in English, while in 2015, the percentage of English articles has dropped to 14\%. At the same time, online news has begun to dominate reporting of current events. However, machine translation remains relatively rudimentary. It allows people to understand simple phrases on web pages, but remains inadequate for more advanced understanding of text. In this paper we consider the intersection of these developments: how to track events which are reported about in multiple languages.
The term event is vague and ambiguous, but for the practical purposes, we define it as ``any significant happening that is being reported about in the media.'' Examples of events would include shooting down of the Malaysia Airlines plane over Ukraine on July 18th, 2014 and HSBC's admittance of aiding their clients in tax evasion on February 9th, 2015 (Figure~\ref{fig:event2}). Events such as these are covered by many articles and the question is how to find all the articles in different languages that are describing a single event. Generally, events are more specific than general themes as the time component plays an important role -- for example, the two wars in Iraq would be considered as separate events.
\begin{figure}
\centering
\includegraphics[width=1\textwidth]{events2.png}
\caption{\label{fig:event2} Events are represented by collections of articles about an event, in this case the Malaysian airliner which was shot down over Ukraine. The results shown in the figure can be obtained using the query \protect\url{http://eventregistry.org/event/997350\#?lang=eng\&tab=articles}. The content presented is part of the Event Registry system, developed by the authors.}
\end{figure}
As input, we consider a stream of articles in different languages and a list of events. Our goal is to assign articles to their corresponding events. A priori, we do not know the coverage of the articles, that is, not all the events may be covered and we do not know that all the articles necessarily fit into one of the events. The task is divided into two parts: detecting events within each language and then linking events across languages. In this paper we address the second step.
We consider a high volume of articles in different languages. By using a language detector, the stream is split into separate monolingual streams. Within each monolingual stream, an online clustering approach is employed, where tracked clusters correspond to our definition of events - this is based on the Event Registry system~\cite{Leban2014W,Leban2014I}. Our main goal in this paper is to connect such clusters (representations of events) across languages, that is, to detect that a set of articles in language $A$ reports on the same event as a set of articles in language $B$.
Our approach to link clusters across languages combines two ingredients: a cross-lingual document similarity measure, which can be interpreted as a language independent topic model, and semantic annotation of documents, which enables an alternative way to comparing documents. Since this work represents a complicated pipeline, we concentrate on these two specific elements. Overall, the approach should be considered from a systems' perspective (considering the system as a whole) rather than considering these problems in isolation.
The first ingredient of our approach to link clusters across languages represents a continuation of previous work~\cite{nips,sikdd,nips2,iti} where we explored representations of documents which were valid over multiple languages. The representations could be interpreted as multilingual topics, which were then used as proxies to compute cross-lingual similarities between documents. To learn the representations, we use Wikipedia as a training corpus. Significantly, we do not only consider the major or \emph{hub} languages such as English, German, French, etc. which have significant overlap in article coverage, but also smaller languages (in terms of number of Wikipedia articles) such as Slovenian and Hindi, which may have a negligible overlap in article coverage. We can then define a similarity between any two articles regardless of language, which allows us to cluster the articles according to topic. The underlying assumption is that articles describing the same event are similar and will therefore be put into the same cluster.
Based on the similarity function, we propose a novel algorithm for linking events/clusters across languages. The approach is based on learning a classification model from labelled data based on several sets of features. In addition to these features, cross-lingual similarity is also used to quickly identify a small list of potential linking candidates for each cluster.
This greatly increases the scalability of the system.
The paper is organized as follows: we first provide an overview of the system as a whole in Section~\ref{sec:pipeline}, which includes a subsection that summarizes the main system requirements. We then present related work in Section~\ref{sec:related}. The related work covers work on cross-lingual document similarity as well as work on cross-lingual cluster linking. In Section~\ref{sec:crosslingual}, we introduce the problem of cross-lingual document similarity computation and describe several approaches to the problem, most notably a new approach based on hub languages.
In Section~\ref{sec:linking}, we introduce the central problem of cross-lingual linking of clusters of news articles and our approach that combines the cross-lingual similarity functions with knowledge extraction based techniques. Finally, we present and interpret the experimental results in Section~\ref{sec:evaluation} and discuss conclusions and point out several promising future directions.
\section{Pipeline}\label{sec:pipeline}
We base our techniques of cross-lingual event linking on an online system for detection of world events, called Event Registry~\cite{Leban2014W,Leban2014I}. Event Registry is a repository of events, where events are automatically identified by analyzing news articles that are collected from numerous news outlets all over the world. The important components in the pipeline of the Event Registry are shown in Figure~\ref{fig:erpipeline}. We will now briefly describe the main components.
\begin{figure}[tbp]
\centering
\includegraphics[width=\textwidth]{pipeline.pdf}
\caption{\label{fig:erpipeline} The Event Registry pipeline. After new articles are collected, they are first analyzed individually (Article-level processing). In the next step, groups of articles about the same event are identified and relevant information about the event is extracted (Event construction phase). Although the pipeline contains several components, we focus only on the two highlighted in the image.}
\end{figure}
The collection of the news articles is performed using the Newsfeed service~\cite{Trampus2012}. The service monitors RSS feeds of around 100,000 mainstream news outlets available globally. Whenever a new article is detected in the RSS feed, the service downloads all available information about the article and sends the article through the pipeline. Newsfeed downloads daily on average around 200,000 news articles in various languages, where English, Spanish and German are the most common.
Collected articles are first semantically annotated by identifying mentions of relevant concepts -- either entities or important keywords. The disambiguation and entity linking of the concepts is done using Wikipedia as the main knowledge base. The algorithm for semantic annotation uses machine learning to detect significant terms within unstructured text and link them to the appropriate Wikipedia articles. The approach models link probability and combines prior word sense distributions with context based sense distributions. The details are reported in~\cite{Milne:2008:LLW:1458082.1458150} and ~\cite{zhang2014saaacamactat}. As a part of the semantic annotation we also analyze the dateline of the article to identify the location of the described event as well as to extract dates mentioned in the article using a set of regular expressions. Since articles are frequently revised we also detect if the collected article is just a revision of a previous one so that we can use this information in next phases of the pipeline. The last important processing step on the document level is to efficiently identify which articles in other available languages are most similar to this article. The methodology for this task is one of the main contributions of this paper and is explained in details in Section~\ref{sec:crosslingual}.
As the next step, an online clustering algorithm is applied to the articles in order to identify groups of articles that are discussing the same event. For each new article, the clustering algorithm determines if the article should be assigned to some existing cluster or into a new cluster. The underlying assumption is that articles that are describing the same event are similar enough and will therefore be put into the same cluster. For clustering, each new article is first tokenized, stop words are removed and the remaining words are stemmed.
The remaining tokens are represented in a vector-space model and normalized using TF-IDF\footnote{The IDF weights are dynamically computed for each new article over all news articles within a 10 day window.} (see Section~\ref{sec:tfidf} for the definition). Cosine similarity is used to find the most similar existing cluster, by comparing the document's vector to the centroid vector of each cluster. A user-defined threshold is used to determine if the article is not similar enough to any existing clusters (0.4 was used in our experiments). If the highest similarity is above the threshold, the article is assigned to the corresponding cluster, otherwise a new cluster is created, initially containing only the single article. Whenever an article is assigned to a cluster, the cluster's centroid vector is also updated. Since articles about an event are commonly written only for a short period of time, we remove clusters once the oldest article in the cluster becomes more than 4 days old. This housekeeping mechanism prevents the clustering from becoming slow and also ensures that articles are not assigned to obsolete clusters. Details of the clustering approach are described in~\cite{brank2014}.
Once the number of articles in a cluster reaches a threshold (which is a language dependent parameter), we assume that the articles in the cluster are describing an event. At that point, a new event with a unique ID is created in Event Registry, and the cluster with the articles is assigned to it. By analyzing the articles, we extract the main information about the event, such as the event location, date, most relevant entities and keywords, etc.
Since articles in a cluster are in a single language, we also want to identify any other existing clusters that report about the same event in other languages and join these clusters into the same event. This task is performed using a classification approach which is the second major contribution of this paper. It is described in detail in Section~\ref{sec:linking}.
When a cluster is identified and information about the event is extracted, all available data is stored in a custom-built database system. The data is then accessible through the API or a web interface at \protect\url{http://eventregistry.org/}, which provide numerous search and visualization options.
\subsection{System Requirements}
\label{sec:sysreq}
Our goal is to build a system that monitors global media and analyzes how events are being reported on. Our approach consists of two steps: tracking events separately in each language (based on language detection and an online clustering approach) and then connecting them. The pipeline must be able to process millions of articles per day and perform billions of similarity computations each day. Both steps rely heavily on similarity computation, which implies that this must be highly scalable.
Therefore, we focus on implementations that run on a single shared memory machine, as opposed to clusters of machines. This simplifies implementation and system maintenance.
To summarize, the following properties are desirable:
\begin{itemize}
\item \textbf{Training} - The training (building cross-lingual models) should scale to many languages and should be robust to the quality of training resources. The system should be able to take advantage of comparable corpora (as opposed to parallel translation-based corpora), with missing data.
\item \textbf{Operation efficiency} - The similarity computation should be fast - the system must be able to handle billions of similarity computations per day. Computing the similarity between a new document and a set of known documents should be efficient (the main application is linking documents between two monolingual streams).
\item \textbf{Operation cost} - The system should run on a strong shared machine server and not rely on paid services.
\item \textbf{Implementation} - The system is straightforward to implement, with few parameters to tune.
\end{itemize}
We believe that a cross-lingual similarity component that meets such requirements is very desirable in a commercial setting, where several different costs have to be taken into consideration.
\section{Related work}\label{sec:related}
In this section, we describe previous work described in the literature. Since there are two distinctive tasks that we tackle in this paper (computing cross-lingual document similarity and cross-lingual cluster linking), we have separated the related work into two corresponding parts.
\subsection{Cross-lingual document similarity}
There are four main families of approaches to cross-lingual similarity.
\textbf{Translation and dictionary based}. The most obvious way to compare documents written in different languages is to use machine translation and perform monolingual similarity, see ~\cite{multilingualBook,plagiarism} for several variations of translation based approaches. One can use free tools such as Moses~\cite{moses} or translation services, such as Google Translate (\protect\url{https://translate.google.com/}). There are two issues with such approaches: they solve a harder problem than needs to be solved and they are less robust to training resource quality - large sets of translated sentences are typically needed. Training Moses for languages with scarce linguistic resources is thus problematic. The issue with using online services such as Google Translate is that the APIs are limited and not free. The operation efficiency and cost requirements make translation-based approaches less suited for our system. Closely related are works Cross-Lingual Vector Space Model (CL-VSM)~\cite{plagiarism} and the approach presented in~\cite{pouliquen2008story} which both compare documents by using dictionaries, which in both cases are EuroVoc dictionaries~\cite{eurovoc}. The generality of such approaches is limited by the quality of available linguistic resources, which may be scarce or non-existent for certain language pairs.
\textbf{Probabilistic topic models}. There exist many variants to modelling documents in a language independent way by using probabilistic graphical models. The models include: Joint Probabilistic Latent Semantic Analysis (JPLSA)~\cite{platt2010translingual}, Coupled Probabilistic LSA (CPLSA)~\cite{platt2010translingual}, Probabilistic Cross-Lingual LSA (PCLLSA)~\cite{PCL_LSA} and Polylingual Topic Models (PLTM)~\cite{polyLDA} which is a Bayesian version of PCLLSA. The methods (except for CPLSA) describe the multilingual document collections as samples from generative probabilistic models, with variations on the assumptions on the model structure. The topics represent latent variables that are used to generate observed variables (words), a process specific to each language. The parameter estimation is posed as an inference problem which is typically intractable and one usually solves it using approximate techniques. Most variants of solutions are based on Gibbs sampling or Variational Inference, which are nontrivial to implement and may require an experienced practitioner to be applied. Furthermore, representing a new document as a mixture of topics is another potentially hard inference problem which must be solved.
\textbf{Matrix factorization}. Several matrix factorization based approaches exist in the literature. The models include: Non-negative matrix factorization based~\cite{nonnegfactor_lsi}, Cross-Lingual Latent Semantic Indexing CL-LSI~\cite{cl_lsi,multilingualBook}, Canonical Correlation Analysis (CCA)~\cite{Hotelling}, Oriented Principal Component Analysis (OPCA)~\cite{platt2010translingual}. The quadratic time and space dependency of the OPCA method makes it impractical for large scale purposes. In addition, OPCA forces the vocabulary sizes for all languages to be the same, which is less intuitive. For our setting, the method in ~\cite{nonnegfactor_lsi} has a prohibitively high computational cost when building models (it uses dense matrices whose dimensions are a product of the training set size and the vocabulary size). Our proposed approach combines CCA and CL-LSI. Another closely related method is Cross-Lingual Explicit Semantic Analysis (CL-ESA)~\cite{ESA}, which uses Wikipedia (as do we in the current work) to compare documents. It can be interpreted as using the sample covariance matrix between features of two languages to define the dot product which is used to compute similarities.
The authors of CL-ESA compare it to CL-LSI and find that CL-LSI can outperform CL-ESA in an information retrieval, but is costlier to optimize over a large corpus (CL-ESA requires no training). We find that the scalability argument does not apply in our case: based on advances in numerical linear algebra we can solve large CL-LSI problems (millions of documents as opposed to the 10,000 document limit reported in~\cite{ESA}). In addition, CL-ESA is less suited for computing similarities between two large monolingual streams. For example, each day we have to compute similarities between 500,000 English and 500,000 German news articles. Comparing each German news article with 500,000 English news articles is either prohibitively slow (involves projecting all English articles on Wikipedia) or consumes too much memory (involves storing the projected English articles, which for a Wikipedia of size 1,000,000 is a 500,000 by 1000,0000 non-sparse matrix).
\textbf{Monolingual}. Finally, related work includes monolingual approaches that treat document written in different languages in a monolingual fashion. The intuition is that named entities (for example, ``Obama'') and cognate words (for example, ``tsunami'') are written in the same or similar fashion in many languages. For example, the Cross-Language Character n-Gram Model (CL-CNG)~\cite{plagiarism} represents documents as bags of character $n$-grams. Another approach is to use language dependent keyword lists based on cognate words ~\cite{pouliquen2008story}. These approaches may be suitable for comparing documents written in languages that share a writing system, which does not apply to the case of global news tracking.
Based on our requirements in Section~\ref{sec:sysreq}, we chose to focus on methods based on vector space models and linear embeddings. We propose a method that is more efficient than popular alternatives (a clustering-based approach and latent semantic indexing), but is still simple to optimize and use.
\subsection{Cross-lingual cluster linking}
Although there are a number of services that aggregate news by identifying clusters of similar articles, there are almost no services that provide linking of clusters over different languages. Google News as well as Yahoo! News are able to identify clusters of articles about the same event, but offer no linking of clusters across languages. The only service that we found, which provides cross-lingual cluster linking, is the European Media Monitor (EMM)~\cite{pouliquen2008story,Steinberger2008}. EMM clusters articles in 60 languages and then tries to determine which clusters of articles in different languages describe the same event. To achieve cluster linking, EMM uses three different language independent vector representations for each cluster. The first vector contains the weighted list of references to countries mentioned in the articles, while the second vector contains the weighted list of mentioned people and organizations. The last vector contains the weighted list of Eurovoc subject domain descriptors. These descriptors are topics, such as \emph{air transport}, \emph{EC agreement}, \emph{competition} and \emph{pollution control} into which articles are automatically categorized~\cite{Pouliquen2006}. Similarity between clusters is then computed using a linear combination of the cosine similarities computed on the three vectors. If the similarity is above the threshold, the clusters are linked. Compared to EMM, our approach uses document similarities to obtain a small set of potentially equivalent clusters. Additionally, we do not decide if two clusters are equivalent based on a hand-set threshold on a similarity value -- instead we use a classification model that uses a larger set of features related to the tested pair of clusters.
A system, which is significantly different but worth mentioning, is the GDELT project~\cite{Leetaru2013Gdelt}. In GDELT, events are also extracted from articles, but in their case, an event is specified in a form of a triple containing two actors and a relation. The project contains an extensive vocabulary of possible relations, mostly related to political events. In order to identify events, GDELT collects articles in more than 65 languages and uses machine translation to translate them to English. All information extraction is then done on the translated article.
\section{Cross-lingual Document Similarity}
\label{sec:crosslingual}
Document similarity is an important component in techniques from text mining and natural language processing. Many techniques use the similarity as a black box, e.g., a kernel in Support Vector Machines. Comparison of documents (or other types of text snippets) in a monolingual setting is a well-studied problem in the field of information retrieval ~\cite{Salton88term-weightingapproaches}. We first formally introduce the problem followed by a description of our approach.
\subsection{Problem definition}\label{sec:tfidf}
We will first describe how documents are represented as vectors and how to compare documents in a mono-lingual setting. We then define a way to measure cross-lingual similarity which is natural for the models we consider.
\noindent\textbf{Document representation.}
The standard vector space model~\cite{Salton88term-weightingapproaches} represents documents as vectors, where each term corresponds to a word or a phrase in a fixed vocabulary. Formally, document $d$ is represented by a vector $x \in \mathbb{R}^n$, where $n$ corresponds to the size of the vocabulary, and vector elements $x_k$ correspond to the number of times term $k$ occurred in the document, also called \emph{term frequency} or $TF_k(d)$.
We also used a term re-weighting scheme that adjusts for the fact that some words occur more frequently in general. A term weight should correspond to the importance of the term for the given corpus. The common weighting scheme is called \emph{Term Frequency Inverse Document Frequency} ($TFIDF$) weighting. An \emph{Inverse Document Frequency} ($IDF$) weight for the dictionary term $k$ is defined as $\log\left( \frac{N}{DF_k} \right)$, where $DF_k$ is the number of documents in the corpus which contain term $k$.
When building cross-lingual models, the IDF scores were computed with respect to the Wikipedia corpus. In the other part of our system, we computed TFIDF vectors on streams of news articles in multiple languages. There the IDF scores for each language changed dynamically - for each new document we computed the IDF of all news articles within a 10 day window.
Therefore we can define a document's $TFIDF$ as
$$ x_{ij} := \frac{\mbox{term frequency in document } i}{\mbox{inverse document frequency of term } j}.$$
The $TFIDF$ weighted vector space model document representation corresponds to a map $\phi : \text{text} \rightarrow \mathbb{R}^n$ defined by:
$$\phi(d)_k = {TF}_k(d) \log\left( \frac{N}{{DF}_k}\right).$$
\noindent\textbf {Mono-lingual similarity.}
A common way of computing similarity between documents is \emph{cosine similarity},
$$sim(d_1, d_2) = \frac{\langle \phi(d_1), \phi(d_2)\rangle}{\|\phi(d_1)\| \|\phi(d_2)\|},$$
where $\langle \cdot,\cdot \rangle$ and $\|\cdot\|$ are standard inner product and Euclidean norm. When dealing with two or more languages, one could ignore the language information
and build a vector space using the union of tokens over the languages. A cosine similarity function in such a space can be useful to some extent, for example ``Internet'' or ``Obama'' may appear both in Spanish and English texts and the presence of such terms in both an English and a Spanish document would contribute to their similarity. In general however, large parts of vocabularies may not intersect. This means that given a language pair, many words in both languages cannot contribute to the similarity score. Such cases can make the similarity function very insensitive to the data.
\noindent\textbf {Cross-lingual similarity.}
Processing a multilingual dataset results in several vector spaces with varying dimensionality, one for each language. The dimensionality of the vector space corresponding to the $i$-th language is denoted by $n_i$ and the vector space model mapping is denoted by $\phi_i : \text{text} \rightarrow \mathbb{R}^{n_i}$.
The similarity between documents in language $i$ and language $j$ is defined as a bilinear operator represented as a matrix $S_{i,j} \in \mathbb{R}^{n_i \times n_j}$:
$$sim_{i,j}(d_1, d_2) = \frac{ \langle \phi_i (d_1), S_{i,j} \phi_j (d_2) \rangle }{\|\phi_i(d_1)\| \|\phi_j(d_2)\|},$$
where $d_1$ and $d_2$ are documents written in the $i$-th and $j$-th language respectively. If the maximal singular value of $S_{i,j}$ is bounded by $1$, then the similarity scores will lie on the interval $[-1, 1]$. We will provide an overview of the models in Section \ref{sec:models} and then introduce additional notation in \ref{sec:notation}. Starting with Section \ref{sec:kmeans} and ending with Section \ref{sec:hublang} we will describe some approaches to compute $S_{i,j}$ given training data.
\subsection{Cross-Lingual Models}\label{sec:models}
In this section, we will describe several approaches to the problem of computing the multilingual similarities introduced in Section~\ref{sec:tfidf}. We present four approaches:
a simple approach based on $k$-means clustering in Section~\ref{sec:kmeans}, a standard approach based on singular value decomposition in Section~\ref{sec:LSI}, a related
approach called Canonical Correlation Analysis (CCA) in Section~\ref{sec:CCA} and finally a new method, which is an extension of CCA to more than two languages in Section~\ref{sec:hublang}.
CCA can be used to find correlated patterns for a pair of languages, whereas the extended method optimizes a
Sum of Squared Correlations (SSCOR) between several language pairs, which was introduced in~\cite{Kettenring}. The SSCOR problem is difficult to solve in our setting (hundreds of thousands of features, hundreds of thousands of examples). To tackle this, we propose a method which consists of two ingredients.
The first one is based on an observation that certain datasets (such as Wikipedia) are biased towards one language (English for Wikipedia), which can be exploited
to reformulate a difficult optimization problem as an eigenvector problem. The second ingredient is dimensionality reduction using CL-LSI, which
makes the eigenvector problem computationally and numerically tractable.
We concentrate on approaches that are based on linear maps rather than alternatives, such as machine translation and probabilistic models, as discussed in the section on related work.
We will start by introducing some notation.
\subsection{Notation}\label{sec:notation}
The cross-lingual similarity models presented in this paper are based on comparable corpora. A \emph{comparable corpus} is a collection of documents in multiple languages, with alignment between documents that are of the same topic, or even a rough translation of each other. Wikipedia is an example of a comparable corpus, where a specific entry can be described in multiple languages (e.g., ``Berlin" is currently described in 222 languages). News articles represent another example, where the same event can be described by newspapers in several languages.
More formally, a \emph{multilingual document} $d = (u_1,\ldots u_m)$ is a tuple of $m$ documents on the same topic (comparable), where $u_i$ is the document written in language $i$. Note that an individual document $u_i$ can be an empty document (missing resource) and each $d$ must contain at least \textbf{two nonempty documents}. This means that in our analysis we discard strictly monolingual documents for which no cross-lingual information is available. A comparable corpus $D = {d_1, \ldots, d_s}$ is a collection of $s$ multilingual documents. By using the vector space model, we can represent $D$ as a set of $m$ matrices $X_1,\ldots,X_m$, where $X_i \in \mathbb{R}^{n_i \times s}$ is the matrix corresponding to the language $i$ and $n_i$ is the vocabulary size of language $i$. Furthermore, let $X_i^{\ell}$ denote the $\ell$-th column of matrix $X_i$ and the matrices respect the document alignment - the vector $X_i^\ell$ corresponds to the TFIDF vector of the $i$-th component of multilingual document $d_\ell$. We use $N$ to denote the total row dimension of $X$, i.e., $N:= \sum_{i=1}^m n_i$. See Figure~\ref{fig:stacked_matrices} for an illustration of the introduced notation.
\begin{figure}[tbp]
\centering
\includegraphics[width=9cm]{stacked_matrices1-crop.pdf}
\caption{\label{fig:stacked_matrices} Multilingual corpora and their matrix representations using the vector space model.}
\end{figure}
We will now describe four models to cross-lingual similarity computation in the next sub-sections.
\subsection{$k$-means}\label{sec:kmeans}
The $k$-means algorithm is perhaps the most well-known and widely-used clustering algorithm. Here, we present its application
to compute cross-lingual similarities. The idea is based on concatenating the corpus matrices, running standard $k$-means clustering to obtain the matrix of centroids, ``reversing" the concatenation step to obtain a set of aligned bases, which are finally used to compute cross-lingual similarities. See Figure~\ref{fig:kmeans} for overview of the procedure. The left side of Figure~\ref{fig:kmeans} illustrates the decomposition and the right side summarizes the coordinate change.
\begin{figure}[tbp]
\centering
\includegraphics[width=10cm]{kmeans.pdf}
\caption{\label{fig:kmeans} $k$-means algorithm and coordinate change.}
\end{figure}
In order to apply the algorithm, we first merge all the term-document matrices into a single matrix $X$ by stacking the individual term-document matrices (as seen in Figure~\ref{fig:stacked_matrices}):
$$X := \begin{bmatrix}X_1^T ,X_2^T, \cdots, X_m^T \end{bmatrix}^T,$$
such that the columns respect the alignment of the documents (here MATLAB notation for concatenating matrices is used). Therefore, each document is represented by a long vector indexed by the terms in all languages.
We then run the $k$-means algorithm~\cite{kmeans} and obtain a centroid matrix $C \in \mathbb{R}^{N \times k}$, where the $k$ columns represent centroid vectors. The centroid matrix can be split vertically into $m$ blocks: $$C = [C_1^T \cdots C_m^T]^T,$$ according to the number of dimensions of each language, i.e., $C_i \in \mathbb{R}^{n_i \times k}$.
To reiterate, the matrices $C_i$ are computed using a multilingual corpus matrix $X$ (based on Wikipedia for example).
To compute cross-lingual document similarities on new documents, note that each matrix $C_i$ represents a vector space basis and can be used to map points in $\mathbb{R}^{n_i}$ into a $k$-dimensional space, where the new coordinates of a vector $x \in \mathbb{R}^{n_i}$ are expressed as: $$(C_i^T C_i)^{-1} C_i^T x_i.$$
The resulting matrix for similarity computation between language $i$ and language $j$ is defined up to a scaling factor as:
$$C_i(C_i^T C_i)^{-1} (C_j^T C_j)^{-1} C_j.$$
The matrix is a result of mapping documents in a language independent space using pseudo-inverses of the centroid matrices $P_i = (C_i^T C_i)^{-1} C_i$ and then comparing them using the standard inner product, which results in the matrix $P_i^T P_j$. For the sake of presentation, we assumed that the centroid vectors are linearly independent. (An independent subspace could be obtained using an additional Gram-Schmidt step~\cite{golub} on the matrix $C$, if this was not the case.)
\subsection{Cross-Lingual Latent Semantic Indexing}\label{sec:LSI}
The second approach we consider is Cross-Lingual Latent Semantic Indexing (CL-LSI)~\cite{cl_lsi} which is a variant of LSI~\cite{lsi} for more than one language. The approach is very similar to $k$-means, where we first concatenate the corpus matrices, compute a decomposition, which in case of CL-LSI is a truncated Singular Value Decomposition (SVD), decouple the
column space matrix and use the blocks to compute linear maps to a common vector space, where standard cosine similarity is used to compare documents.
The method is based on computing a truncated singular value decomposition of the concatenated corpus matrix $X \approx U S V^T$. See Figure~\ref{fig:lsi} for the decomposition. Representing documents in ``topic`` coordinates is done in the same way as in the $k$-means case (see Figure~\ref{fig:kmeans}), we will describe how to compute the coordinate change functions.
\begin{figure}[tbp]
\centering
\includegraphics[width=10cm]{lsi.pdf}
\caption{\label{fig:lsi} LSI multilingual corpus matrix decomposition.}
\end{figure}
The cross-lingual similarity functions are based on a rank-$k$ truncated SVD: $X \approx U \Sigma V^T,$ where $U \in \mathbb{R}^{N \times k}$ are basis vectors of interest and $\Sigma \in \mathbb{R}^{k \times k}$ is a truncated diagonal matrix of singular eigenvalues. An aligned basis is obtained by first splitting $U$ vertically according to the number of dimensions of each language: $U = [U_1^T \cdots U_m^T]^T$. Then, the same as with $k$-means clustering, we compute the pseudoinverses $P_i = (U_i^T U_i)^{-1} U_i^T$. The matrices $P_i$ are used to change the basis from the standard basis in $\mathbb{R}^{n_i}$ to the basis spanned by the columns of $U_i$.
\paragraph{Implementation note}
Since the matrix $X$ can be large we could use an iterative method like the Lanczos algorithm with reorthogonalization~\cite{golub} to find the left singular vectors (columns of $U$) corresponding to the largest singular values. It turns out that the Lanczos method converges slowly as the gap between the leading singular values is small. Moreover, the Lanczos method is hard to parallelize. Instead, we use a randomized version of the SVD~\cite{tropp} that can be viewed as a block Lanczos method. That enables us to use parallelization and speeds up the computation considerably.
To compute the matrices $P_i$ we used the QR algorithm~\cite{golub} to factorize $U_i$ as $U_i = Q_i R_i$, where $Q_i^TQ_i = I$ and $R_i$ is a triangular matrix. $P_i$ is then obtained by solving $R_i P_i = Q_i$.
\subsection{Canonical Correlation Analysis}\label{sec:CCA}
We now present a statistical technique to analyze data from two sources, an extension of which will be presented in the next section.
Canonical Correlation Analysis (CCA)~\cite{Hotelling} is a dimensionality reduction technique similar to Principal Component Analysis (PCA)~\cite{Pearson1901On}, with the additional assumption that the data consists of feature vectors that arose from two sources (two views) that share some information. Examples include: bilingual document collection ~\cite{mrpqr} and collection of images and captions~\cite{Hardoon_usingimage}. Instead of looking for linear combinations of features that maximize the variance (PCA) we look for a linear combination of feature vectors from the first view and a linear combination for the second view, that are maximally correlated.
Interpreting the columns of $X_i$ as observation vectors sampled from an underlying distribution $\mathcal{X}_i \in \mathbb{R}^{n_i}$, the idea is to find two weight vectors $w_i \in \mathbb{R}^{n_i}$ and $w_j \in \mathbb{R}^{n_j}$ so that the random variables $w_i^T \cdot \mathcal{X}_i$ and $w_j^T \cdot \mathcal{X}_j$ are maximally correlated ($w_i$ and $w_j$ are used to map the random vectors to random variables, by computing weighted sums of vector components). Let $\rho(x,y)$ denote the sample-based correlation coefficient between two vectors of observations $x$ and $y$. By using the sample matrix notation $X_i$ and $X_j$ (assuming no data is missing to simplify the exposition), this problem can be formulated as the following optimization problem:
\begin{equation*}
\begin{aligned}
& \underset{w_i \in \mathbb{R}^{n_i}, w_j \in \mathbb{R}^{n_j}}{\text{maximize}}
& & \rho(w_i^T X_i , w_j^T X_j) = \frac{w_i^T C_{i,j} w_j}{\sqrt{w_i^T C_{i,i} w_i} \sqrt{w_j^T C_{j,j} w_j}},
\end{aligned}
\end{equation*}
where $C_{i,i}$ and $C_{j,j}$ are empirical estimates of variances of $\mathcal{X}_i$ and $\mathcal{X}_j$ respectively and $C_{i,j}$ is an estimate for the covariance matrix. Assuming that the observation vectors are centered (only for the purposes of presentation), the matrices are computed in the following way: $C_{i,j} = \frac{1}{n-1}X_i X_j^T$, and similarly for $C_{i,i}$ and $C_{j,j}$.
The optimization problem can be reduced to an eigenvalue problem and includes inverting the variance matrices $C_{i,i}$ and $C_{j,j}$. If the matrices are not invertible, one can use a regularization technique by replacing $C_{i,i}$ with $(1- \kappa)C_{i,i} + \kappa I$, where $\kappa \in [0,1]$ is the regularization coefficient and $I$ is the identity matrix. (The same can be applied to $C_{j,j}$.)
A single canonical variable is usually inadequate in representing the original random vector and typically one looks for $k$ projection pairs $(w_i^1, w_j^1),\ldots,(w_i^k, w_j^k)$, so that $(w_i^{u})^T \mathcal{X}_i$ and $(w_j^{u})^T \mathcal{X}_j$ are highly correlated and $(w_i^{u})^T \mathcal{X}_i$ is uncorrelated with $(w_i^{v})^T \mathcal{X}_i$ for $u \neq v$ and analogously for $w_j^u$ vectors.
Note that the method in its original form is only applicable to two languages where an aligned set of observations is available. The next section will describe a scalable extension of CCA to more than two languages.
\subsection{Hub language based CCA Extension}\label{sec:hublang}
Building cross-lingual similarity models based on comparable corpora is challenging for two main reasons. The first problem is related to missing alignment data: when a number of languages is large, the dataset of documents that cover all languages is small (or may even be empty). Even if only two languages are considered, the set of aligned documents can be small (an extreme example is given by the Piedmontese and Hindi Wikipedias where no inter-language links are available), in which case none of the methods presented so far are applicable.
The second challenge is scale - the data is high-dimensional (many languages with hundreds of thousands of features per language) and the number of multilingual documents may be large (over one million in case of Wikipedia). The optimization problem posed by CCA is not
trivial to solve: the covariance matrices themselves are prohibitively large to fit in memory (even storing a 100,000 by 100,000 element matrix requires 80GB of memory) and iterative matrix-multiplication based approaches to solving generalized eigenvalue problems are required (the covariance matrices can be expressed as products of sparse matrices, which means we have fast matrix-vector multiplication).
We now describe an extension of CCA to more than two languages, which can be trained on large comparable corpora and can handle missing data.
The extension we consider is based on a generalization of CCA to more than two views, introduced in~\cite{Kettenring}, namely the Sum of Squared Correlations SSCOR, which we will state formally later in this section. Our approach exploits a certain characteristic of the data, namely the \emph{hub language} characteristic (see below) in two
ways: to reduce the dimensionality of the data and to simplify the optimization problem.
\paragraph{Hub language characteristic.}
In the case of Wikipedia, we observed that even though the training resources are scarce for certain language pairs, there often exists indirect training data. By considering a third language, which has training data with both languages in the pair, we can use the composition of learned maps as a proxy. We refer to this third language as a hub language.
A \emph{hub language} is a language with a high proportion of non-empty documents in $D = \left\{d_1,..., d_{\ell}\right\}$. As we have mentioned, we only focus on multilingual documents that include at least two languages. The prototypical example in the case of Wikipedia is English. Our notion of the hub language could be interpreted in the following way.
If a non-English Wikipedia page contains one or more links to variants of the page in other languages, English is very likely to be one of them. That makes English a hub language.
We use the following notation to define subsets of the multilingual comparable corpus: let $a(i,j)$ denote the index set of all multilingual documents with non-missing data for the $i$-th and $j$-th language: $$a(i,j) = \left\{k~ |~ d_k = (u_1,...,u_m), u_i \neq \emptyset, u_j \neq \emptyset \right\},$$ and let $a(i)$ denote the index set of all multilingual documents with non missing data for the $i$-th language.
We now describe a two step approach to building a cross-lingual similarity matrix. The first part is related to LSI and reduces the dimensionality of the data. The second step refines the linear mappings and optimizes the linear dependence between data.
\paragraph{Step 1: Hub language based dimensionality reduction.}
The first step in our method is to project $X_1, \ldots, X_m$ to lower-dimensional spaces without destroying the cross-lingual structure. Treating the nonzero columns of $X_i$ as observation vectors sampled from an underlying distribution $\mathcal{X}_i \in V_i = \mathbb{R}^{n_i}$, we can analyze the empirical cross-covariance matrices:
$$C_{i,j} = \frac{1}{|a(i,j)|-1 }\sum_{\ell \in a(i,j)} (X_i^{\ell} - c_i)\cdot (X_j^{\ell} - c_j)^T,$$
where $c_i = \frac{1}{a_i} \sum_{\ell \in a(i)}X_i^{\ell}$. By finding low-rank approximations of $C_{i,j}$ we can identify the subspaces of $V_i$ and $V_j$ that are relevant for extracting linear patterns between $\mathcal{X}_i$ and $\mathcal{X}_j$. Let $X_1$ represent the hub language corpus matrix. The LSI approach to finding the subspaces is to perform the singular value decomposition on the full $N \times N$ covariance matrix composed of blocks $C_{i,j}$. If $|a(i,j)|$ is small for many language pairs (as it is in the case of Wikipedia), then many empirical estimates $C_{i,j}$ are unreliable, which can result in overfitting. For this reason, we perform the truncated singular value decomposition on the matrix $C = [C_{1,2} \cdots C_{1,m}] \approx U S V^T$, where $U \in \mathbb{R}^{n_1 \times k}, S \in \mathbb{R}^{k \times k}, V \in \mathbb{R}^{(\sum_{i=2}^m n_i) \times k}$. We split the matrix $V$ vertically in blocks with $n_2, \ldots, n_m$ rows: $V = [V_2^T \cdots V_m^T]^T$. Note that columns of $U$ are orthogonal but columns in each $V_i$ are not (columns of V are orthogonal). Let $V_1 := U$. We proceed by reducing the dimensionality of each $X_i$ by setting: $Y_i = V_i^T \cdot X_i$, where $Y_i \in \mathbb{R}^{k\times N}$. To summarize, the first step reduces the dimensionality of the data and is based on CL-LSI, but optimizes only the hub language related cross-covariance blocks.
\paragraph{Step 2: Simplifying and solving SSCOR.}
The second step involves solving a generalized version of canonical correlation analysis on the matrices $Y_i$ in order to find the mappings $P_i$. The approach is based on the sum of squares of correlations formulation by Kettenring~\cite{Kettenring}, where we consider only correlations between pairs $(Y_1, Y_i), i >1$ due to the hub language problem characteristic.
We will present the original unconstrained optimization problem, then a constrained formulation based on the hub language problem characteristic. Then we will simplify the constraints and reformulate the problem as an eigenvalue problem by using Lagrange multipliers.
The original sum of squared correlations is formulated as an unconstrained problem:
\begin{equation*}
\begin{aligned}
& \underset{w_i \in \mathbb{R}^{k}}{\text{maximize}}
& & \sum_{i < j}^m \rho(w_i^T Y_i, w_j^T Y_j)^2.
\end{aligned}
\end{equation*}
We solve a similar problem by restricting $i=1$ and omitting the optimization over non-hub language pairs.
Let $D_{i,i} \in \mathbb{R}^{k \times k}$ denote the empirical covariance of $\mathcal{Y}_i$ and $D_{i,j}$ denote the empirical cross-covariance computed based on $\mathcal{Y}_i$ and $\mathcal{Y}_j$. We solve the following constrained (unit variance constraints) optimization problem:
\begin{equation}\label{squaredCorHubOriginal}
\begin{aligned}
& \underset{w_i \in \mathbb{R}^{k}}{\text{maximize}}
& & \sum_{i = 2}^m \left(w_1^T D_{1,i} w_i \right)^2
& \text{subject to}
& & w_i^T D_{i,i} w_i = 1, \quad\forall i = 1,\ldots, m.
\end{aligned}
\end{equation}
The constraints $w_i^T D_{i,i} w_i$ can be simplified by using the Cholesky decomposition $D_{i,i} = K_i^T \cdot K_i$ and substitution: $y_i := K_i w_i$. By inverting the $K_i$ matrices and defining $G_i := K_1^{-T} D_{1,i} K_i^{-1}$, the problem can be reformulated:
\begin{equation}\label{squaredCorHub}
\begin{aligned}
& \underset{y_i \in \mathbb{R}^{k}}{\text{maximize}}
& & \sum_{i = 2}^m \left(y_1^T G_{i} y_i \right)^2
& \text{subject to}
& & y_i^T y_i = 1, \quad\forall i = 1,\ldots, m.
\end{aligned}
\end{equation}
A necessary condition for optimality is that the derivatives of the Lagrangian vanish. The Lagrangian of (\ref{squaredCorHub}) is expressed as:
$$ L(y_1, \ldots, y_m, \lambda_1, \ldots, \lambda_m) = \sum_{i = 2}^m \left(y_1^T G_{i} y_i \right)^2 + \sum_{i=1}^m \lambda_i \left(y_i^T y_i - 1\right).$$
Stationarity conditions give us:
\begin{equation}\label{dLdx1}
\frac{\partial}{\partial x_1} L = 0 \Rightarrow \sum_{i = 2}^m \left(y_1^T G_{i} y_i \right) G_i y_i + \lambda_1 y_1 = 0,
\end{equation}
\begin{equation}\label{dLdxi}
\frac{\partial}{\partial x_i} L = 0 \Rightarrow \left(y_1^T G_{i} y_i \right) G_{i}^T y_1 + \lambda_i y_i = 0,~i > 1.
\end{equation}
Multiplying the equations (\ref{dLdxi}) with $y_i^T$ and applying the constraints, we can eliminate $\lambda_i$ which gives us:
\begin{equation}\label{eqy1yi}
G_{i}^T y_1 = \left(y_1^T G_{i} y_i \right) y_i,~i > 1.
\end{equation}
Plugging this into (\ref{dLdx1}), we obtain an eigenvalue problem:
$$\left( \sum_{i = 2}^m G_i G_{i}^T \right) y_1 + \lambda_1 y_1 = 0.$$
The eigenvectors of $\left( \sum_{i = 2}^m G_i G_{i}^T \right)$ solve the problem for the first language. The solutions for $y_i$ are obtained from (\ref{eqy1yi}): $y_i := \frac{G_{i}^T y_1}{\| G_{i}^T y_1 \|}$.
Note that the solution (\ref{squaredCorHubOriginal}) can be recovered by: $w_i := K_i^{-1} y_i$. The linear transformation of the $w$ variables are thus expressed as:
$$ Y_1 := \text{eigenvectors of} \sum_{i = 2}^m G_i G_{i}^T, $$
$$ W_1 = K_1^{-1} Y_1 $$
$$ W_i = K_i^{-1} G_{i}^T Y_1 N,$$
where $N$ is a diagonal matrix that normalizes $G_{i}^T Y_1$, with $N(j,j) := \frac{1}{\|G(_{i} Y_1(:,j)\|}$.
\paragraph{Remark.} The technique is related to Generalization of Canonical Correlation Analysis (GCCA) by Carroll~\cite{Carroll}, where an unknown group configuration variable is defined and the objective is to maximize the sum of squared correlations between the group variable and the others. The problem can be reformulated as an eigenvalue problem. The difference lies in the fact that we set the unknown group configuration variable as the hub language, which simplifies the solution. The complexity of our method is $O(k^3)$, where $k$ is the reduced dimension from the LSI preprocessing step, whereas solving the GCCA method scales as $O(s^3)$, where $s$ is the number of samples (see~\cite{gifi}). Another issue with GCCA is that it cannot be directly applied to the case of missing documents.
To summarize, we first reduced the dimensionality of our data to $k$-dimensional features and then found a new representation (via linear transformation) that maximizes directions of linear dependence between the languages. The final projections that enable mappings to a common space are defined as: $P_i(x) = W_i^T V_i^T x.$
\section{Cross-lingual Event Linking}\label{sec:linking}
The main application on which we test the cross-lingual similarity is cross-lingual event linking. In online media streams -- particularly news articles -- there is often duplication of reporting, different viewpoints or opinions, all centering around a single event. The same events are covered by many articles and the question we address is how to find all the articles in different languages that are describing a single event. In this paper we consider the problem of matching events from different languages. We do not address the problem of detection of events and instead base our evaluation on an online system for detection of world events, Event Registry. The events are represented by clusters of articles and so ultimately our problem reduces to finding suitable matchings between clusters with articles in different languages.
\subsection{Problem definition}
The problem of cross-lingual event linking is to match monolingual clusters of news articles that describing the same event across languages. For example, we want to match a cluster of Spanish news articles and a cluster of English news articles that both describe the same earthquake.
Each article $a \in A$ is written in a language $\ell$, where $\ell \in L = \{\ell_1,\ell_2,...,\ell_m\}$. For each language $\ell$, we obtain a set of monolingual clusters $C_{\ell}$. More precisely, the articles corresponding to each cluster $c \in C_{\ell}$ are written in the language $\ell$. Given a pair of languages $\ell_a \in L$, $\ell_b \in L$ and $\ell_a \not= \ell_b$, we would like to identify all cluster pairs $(c_i, c_j) \in C_{\ell_a} \times C_{\ell_b}$ such that $c_i$ and $c_j$ describe the same event.
\begin{figure}[tb]
\centering
\includegraphics[width=0.7\textwidth]{clusters.pdf}
\caption{\label{fig:clusters} Clusters composed of English and Spanish news articles. Arrows link English articles with their Spanish $k$-nearest neighbor matches according to the cross-lingual similarity.}
\end{figure}
Matching of clusters is a \emph{generalized matching} problem. We cannot assume that there is only one cluster per language per event, nor can we assume complete coverage -- i.e., that there exists at least one cluster per event in every language. This is partly due to news coverage which might be more granular in some languages, partly due to noise and errors in the event detection process. This implies that we cannot make assumptions on the matching (e.g., one-to-one or complete matching) and excludes the use of standard weighted bipartite matching type of algorithms for this problem. An example is shown in Figure~\ref{fig:clusters}, where a cluster may contain articles which are closely matched with many clusters in a different language.
We are also seeking for an algorithm which does not do exhaustive comparison of all clusters, since that can become prohibitively expensive when working in a real-time setting. More specifically, we wish to avoid testing cluster $c_i$ with all the clusters from all the other languages. Performing exhaustive comparison would result in $O(|C|^2)$ tests, where $|C|$ is the number of all clusters (over all languages), which is not feasible when the number of clusters is on the order of tens of thousands. We address this by testing only clusters that are connected with at least one $k$-nearest neighbor (marked as \emph{candidate clusters} in Figure~\ref{fig:clusters}).
\subsection{Algorithm}\label{algo:features}
In order to identify clusters that are equivalent to cluster $c_i$, we have developed a two-stage algorithm. For a cluster $c_i$, we first efficiently identify a small set of candidate clusters and then find those clusters among the candidates, which are equivalent to $c_i$. An example is shown in Figure~\ref{fig:clusters}.
The details of the first step are described in Algorithm~\ref{cluster_merge_algo1}. The algorithm begins by individually inspecting each news article $a_i$ in the cluster $c_i$. Using a chosen method for computing cross-lingual document similarity (see Section~\ref{sec:models}), it identifies the 10 most similar news articles to $a_i$ in each language $\ell \in L$. For each similar article $a_j$, we identify its corresponding cluster $c_j$ and add it to the set of candidates. The set of candidate clusters obtained in this way is several orders of magnitude smaller than the number of all clusters, and at most linear with respect to the number of news articles in cluster $c_i$. In practice, clusters contain highly related articles and as such similar articles from other languages mostly fall in only a few candidate clusters.
Although computed document similarities are approximate, our assumption is that articles in different languages describing the same event will generally have a higher similarity than articles about different events. While this assumption does not always hold, redundancy in the data mitigates these false positives. Since we compute the 10 most similar articles for each article in $c_i$, we are likely to identify all the relevant candidates for cluster $c_i$.
\begin{algorithm}[t!]
\SetKwInput{KwInput}{input}\SetKwInput{KwOutput}{output}
\KwInput{test cluster $c_i$, a set of clusters $C_\ell$ for each language $\ell \in L$}
\KwOutput{a set of clusters $C$ that are potentially equivalent to $c_i$}
$C \leftarrow \{\}$\;
\For{article $a_i \in c_i$} {
\For{language $\ell \in L$} {
\tcc{use hub CCA to find 10 most similar articles to article $a_i$ in language $\ell$}
$SimilarArticles = getCCASimilarArticles(a_i, \ell)$\;
\For{article $a_j \in SimilarArticles$} {
\tcc{find cluster $c_j$ to which article $a_j$ is assigned to}
$c_j \leftarrow c$, such that $c \in C_\ell$ and $a_j \in c$\;
\tcc{add cluster $c_j$ to the set of candidates $C$}
$C \leftarrow C \cup \{ c_j \}$\;
}
}
}
\caption{Algorithm for identifying candidate clusters $C$ that are potentially equivalent to $c_i$}
\label{cluster_merge_algo1}
\end{algorithm}
The second stage of the algorithm determines which (if any) of the candidate clusters are equivalent to $c_i$. We treat this task as a supervised learning problem. For each candidate cluster $c_j \in C$, we compute a vector of learning features that should be indicative of whether $c_i$ and $c_j$ are equivalent or not and apply a binary classification model that predicts if the clusters are equivalent or not. The classification algorithm that we used to train a model was a linear Support Vector Machine (SVM) method~\cite{shawe-taylor04kernel}.
We use three groups of features to describe cluster pair $(c_i, c_j)$. The first group is based on {\bf cross-lingual article links}, which are derived using cross-lingual similarity: each news article $a_i$ is linked with its $10$-nearest neighbors articles from all other languages (10 per each language). The group contains the following features:
\begin{itemize}
\item \texttt{linkCount} is the number of times any of the news articles from $c_j$ is among $10$-nearest neighbors for articles from $c_i$. In other words, it is the number of times an article from $c_i$ has a very similar article (i.e., is among 10 most similar) in $c_j$.
\item \texttt{avgSimScore} is the average similarity score of the links, as identified for \texttt{linkCount}, between the two clusters.
\end{itemize}
The second group are {\bf concept-related features}. Articles that are imported into Event Registry are annotated by disambiguating mentioned \emph{entities} and \emph{keywords} to the corresponding Wikipedia pages~\cite{zhang2014}. Whenever Barack Obama is, for example, mentioned in the article, the article is annotated with a link to his Wikipedia page. In the same way, all mentions of entities (people, locations, organizations) and ordinary keywords (e.g., bank, tax, ebola, plane, company) are annotated. Although the Spanish article about Obama will be annotated with his Spanish version of the Wikipedia page, in many cases we can link the Wikipedia pages to their English versions. This can be done since Wikipedia itself provides information regarding which pages in different languages represent the same concept/entity. Using this approach, the word ``avi\'on'' in a Spanish article will be annotated with the same concept as the word ``plane'' in an English article. Although the articles are in different languages, the annotations can therefore provide a language-independent vocabulary that can be used to compare articles/clusters. By analyzing all the articles in clusters $c_i$ and $c_j$, we can identify the most relevant entities and keywords for each cluster. Additionally, we can also assign weights to the concepts based on how frequently they occur in the articles in the cluster. From the list of relevant concepts and corresponding weights, we consider the following features:
\begin{itemize}
\item \texttt{entityCosSim} is the cosine similarity between vectors of entities from clusters $c_i$ and $c_j$.
\item \texttt{keywordCosSim} is the cosine similarity between vectors of keywords from clusters $c_i$ and $c_j$.
\item \texttt{entityJaccardSim} is Jaccard similarity coefficient~\cite{levandowsky1971} between sets of entities from clusters $c_i$ and $c_j$.
\item \texttt{keywordJaccardSim} is Jaccard similarity coefficient between sets of keywords from clusters $c_i$ and $c_j$.
\end{itemize}
The last group of features contains three {\bf miscellaneous features} that seem discriminative but are unrelated to the previous two groups:
\begin{itemize}
\item \texttt{hasSameLocation} feature is a boolean variable that is true when the location of the event in both clusters is the same. The location of events is estimated by considering the locations mentioned in the articles that form a cluster and is provided by Event Registry.
\item \texttt{timeDiff} is the absolute difference in hours between the two events. The publication time and date of the events is computed as the average publication time and date of all the articles and is provided by Event Registry.
\item \texttt{sharedDates} is determined as the Jaccard similarity coefficient between sets of date mentiones extracted from articles. We use extracted mentions of dates provided by Event Registry, which uses an extensive set of regular expressions to detect and normalize mentions of dates in different forms.
\end{itemize}
\section{Evaluation}\label{sec:evaluation}
We will describe the main dataset for building cross-lingual models which is based on Wikipedia and then present two sets of experiments. The first set of experiments
establishes that the hub based approach can deal with language pairs where little or no training data is available. The second set of experiments compares the main approaches
that we presented on the task of mate retrieval and the task of event linking. Finally, we examine how different choices of features impact the event linking performance.
\subsection{Wikipedia Comparable Corpus}
To investigate the empirical performance of the low-rank approximations we will test the algorithms on a large-scale, real-world multilingual dataset that we extracted from Wikipedia by using inter-language links for alignment. This results in a large number of weakly comparable documents in more than $200$ languages. Wikipedia is a large source of multilingual data that is especially important for the languages for which no translation tools, multilingual dictionaries as Eurovoc~\cite{eurovoc}, or strongly aligned multilingual corpora as Europarl~\cite{europarl} are available. Documents in different languages are related with so called 'inter-language' links that can be found on the left of the Wikipedia page. The Wikipedia is constantly growing. There are currently 12 Wikipedias with more than 1 million
articles, $52$ with more than 100k
articles, $129$ with more than 10k articles, and $236$ with more than $1,000$ articles.
Each Wikipedia page is embedded in the page tag. First, we check if the title of the page starts with a Wikipedia namespace (which includes categories and discussion pages) and do not process the page if it does. Then, we check if this is a redirection page and we store the redirect link because inter-language links can point to redirection links also. If none of the above applies, we extract the text and parse the Wikipedia markup. Currently, all the markup is removed.
We get inter-language link matrix using previously stored redirection links and inter-language links. If an inter-language link points to the redirection we replace it with the redirection target link. It turns out that we obtain the matrix $M$ that is not symmetric, consequently the underlying graph is not symmetric. That means that existence of the inter-language link in one way (i.e., English to German) does not guarantee that there is an inter-language link in the reverse direction (German to English). To correct this we transform this matrix to be symmetric by computing $M+M^T$ and obtaining an undirected graph. In the rare case that after symmetrization we have multiple links pointing from the document, we pick the first one that we encountered. This matrix enables us to build an alignment across all Wikipedia languages (for dumps available in 2013).
\subsection{Experiments With Missing Alignment Data}\label{experiments:hubcca}
In this subsection, we will investigate the empirical performance of hub CCA approach. We will demonstrate that this approach can be successfully applied even in the case of fully missing alignment information.
To this purpose, we select a subset of Wikipedia languages containing three major languages, English (4,212k articles)--\emph{en} (hub language), Spanish (9,686k articles)--\emph{es}, Russian (9,662k articles)--\emph{ru}, and five minority (in terms of Wikipedia sizes) languages, Slovenian (136k articles)--\emph{sl}, Piedmontese (59k articles)--\emph{pms}, Waray-Waray (112k articles)--\emph{war} (all with about 2 million native speakers), Creole (54k articles)--\emph{ht} (8 million native speakers), and Hindi (97k articles)--\emph{hi} (180 million native speakers). For preprocessing, we remove the documents that contain less than 20 different words (referred to as stubs\footnote{Such documents are typically of low value as a linguistic resource. Examples include the titles of the columns in the table, remains of the parsing process, or Wikipedia articles with very little or no information contained in one or two sentences.}) and remove words occurring in less than 50 documents as well as the top 100 most frequent words (in each language separately). We represent the documents as normalized TFIDF~\cite{Salton88term-weightingapproaches} weighted vectors. The IDF scores are computed for each language based on its aligned documents with the English Wikipedia. The English language IDF scores are based on all English documents for which aligned Spanish documents exist.
The evaluation is based on splitting the data into training and test sets.
We select the test set documents as all multilingual documents with at least one nonempty alignment from the list: (\emph{hi}, \emph{ht}), (\emph{hi}, \emph{pms}), (\emph{war}, \emph{ht}), (\emph{war}, \emph{pms}). This guarantees that we cover all the languages. Moreover this test set is suitable for testing the retrieval through the hub as the chosen pairs have empty alignments. The remaining documents are used for training. In Table \ref{table:train_test}, we display the corresponding sizes of training and test documents for each language pair.
On the training set, we perform the two step procedure to obtain the common document representation as a set of mappings $P_i$. A test set for each language pair, $test_{i,j} = \{(x_\ell,y_\ell) | \ell = 1:n(i,j)\} $, consists of comparable document pairs (linked Wikipedia pages), where $n(i,j)$ is the test set size. We evaluate the representation by measuring mate retrieval quality on the test sets: for each $\ell$, we rank the projected documents $P_j(y_1),\ldots, P_j(y_{n(i,j)})$ according to their similarity with $P_i(x_\ell)$ and compute the rank of the mate document $r(\ell) = rank(P_j(y_\ell))$. The final retrieval score (between -100 and 100) is computed as: $\frac{100}{n(i,j)} \cdot \sum_{\ell = 1}^{n(i,j)} \left( \frac{n(i,j) - r(\ell)}{n(i,j) -1} -0.5\right)$. A score that is less than 0 means that the method performs worse than random retrieval and a score of 100 indicates perfect mate retrieval. The mate retrieval results are included in Table \ref{table:retrieval}.
We observe that the method performs well on all pairs of languages, where at least 50,000 training documents are available(\emph{en}, \emph{es}, \emph{ru}, \emph{sl}). We note that taking $k = 500$ or $k = 1,000$ multilingual topics usually results in similar performance, with some notable exceptions: in the case of (\emph{ht}, \emph{war}) the additional topics result in an increase in performance, as opposed to (\emph{ht}, \emph{pms}) where performance drops, which suggests overfitting. The languages where the method performs poorly are \emph{ht} and \emph{war}, which can be explained by the quality of data (see Table \ref{table:rank} and explanation that follows). In case of \emph{pms}, we demonstrate that solid performance can be achieved for language pairs (\emph{pms}, \emph{sl}) and (\emph{pms}, \emph{hi}), where only 2,000 training documents are shared between \emph{pms} and \emph{sl} and no training documents are available between \emph{pms} and \emph{hi}. Also observe that in the case of (\emph{pms}, \emph{ht}) the method still obtains a score of 62, even though training set intersection is zero and \emph{ht} data is corrupted, which we will show in the next paragraph.
{
\renewcommand\tabcolsep{3pt}
\begin{table}[h!]
\centering
\caption{Training -- test sizes (in thousands).
The first row represents the size of the training sets used to construct the mappings in low-dimensional language independent space using \emph{en} as a hub. The diagonal elements represent the number of the unique training documents and test documents in each language.
}
\label{table:train_test}
{
\small
\begin{tabular}{c|c|c|c|c|c|c|c|c|}
& en& es& ru& sl& hi& war& ht& pms\\\cline{1-9}
en& 671~-~4.64& 463~-~4.29& 369~-~3.19& 50.3~-~2& 14.4~-~2.76& 8.58~-~2.41& 17~-~2.32& 16.6~-~2.67\\
\cline{2-9}
es& \multicolumn{1}{c|}{} & 463~-~4.29& 187~-~2.94& 28.2~-~1.96& 8.72~-~2.48& 6.88~-~2.4& 13.2~-~2& 13.8~-~2.58\\
\cline{3-9}
ru& \multicolumn{2}{c|}{} & 369~-~3.19& 29.6~-~1.92& 9.16~-~2.68& 2.92~-~1.1& 3.23~-~2.2& 10.2~-~1.29\\
\cline{4-9}
sl& \multicolumn{3}{c|}{} & 50.3~-~2& 3.83~-~1.65& 1.23~-~0.986& 0.949~-~1.23& 1.85~-~0.988\\
\cline{5-9}
hi& \multicolumn{4}{c|}{} & 14.4~-~2.76& 0.579~-~0.76& 0.0~-~2.08& 0.0~-~0.796\\
\cline{6-9}
war& \multicolumn{5}{c|}{} & 8.58~-~2.41& 0.043~-~0.534& 0.0~-~1.97\\
\cline{7-9}
ht& \multicolumn{6}{c|}{} & 17~-~2.32& 0.0~-~0.355\\
\cline{8-9}
pms& \multicolumn{7}{c|}{} & 16.6~-~2.67\\
\cline{9-9}
\end{tabular}
}
\end{table}
}
{
\renewcommand\tabcolsep{3pt}
\begin{table}[h!]
\caption{Pairwise retrieval, 500 topics on the left -- 1,000 topics on the right}\label{table:retrieval}
\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|c|c|}
\cline{1-9}
& en& es& ru& sl& hi& war& ht& pms\\\cline{1-9}
en& & 98~-~98& 95~-~97& 97~-~98& 82~-~84& 76~-~74& 53~-~55& 96~-~97\\
\cline{1-9}
es& 97~-~98& & 94~-~96& 97~-~98& 85~-~84& 76~-~77& 56~-~57& 96~-~96\\
\cline{1-9}
ru& 96~-~97& 94~-~95& & 97~-~97& 81~-~82& 73~-~74& 55~-~56& 96~-~96\\
\cline{1-9}
sl& 96~-~97& 95~-~95& 95~-~95& & 91~-~91& 68~-~68& 59~-~69& 93~-~93\\
\cline{1-9}
hi& 81~-~82& 82~-~81& 80~-~80& 91~-~91& & 68~-~67& 50~-~55& 87~-~86\\
\cline{1-9}
war& 68~-~63& 71~-~68& 72~-~71& 68~-~68& 66~-~62& & 28~-~48& 24~-~21\\
\cline{1-9}
ht& 52~-~58& 63~-~66& 66~-~62& 61~-~71& 44~-~55& 16~-~50& & 62~-~49\\
\cline{1-9}
pms& 95~-~96& 96~-~96& 94~-~94& 93~-~93& 85~-~85& 23~-~26& 66~-~54& \\
\cline{1-9}
\end{tabular}
\end{center}
\end{table}
}
We further inspect the properties of the training sets by roughly estimating the fraction $\frac{rank(A)}{min\left(rows\left(A\right),~cols\left(A\right)\right)}$ for each English training matrix and its corresponding mate matrix, where $rows(A)$ and $cols(A)$ denote the number of rows and columns respectively. The denominator represents the theoretically highest possible rank the matrix $A$ could have. Ideally, these two fractions should be approximately the same - both aligned spaces should have reasonably similar dimensionality. We display these numbers as pairs in Table \ref{table:rank}.
\begin{table}[h]
\caption{Dimensionality drift. Each column corresponds to a pair of aligned corpus matrices between English and another language. The numbers represent the ratio between the numerical rank and the highest possible rank. For example, the column $en -- ht$ tells us that for the English-Creole pairwise-aligned corpus matrix pair, the English counterpart has full rank, but the Creole counterpart is far having full rank.}
\label{table:rank}
\begin{tabular}{|c|c|c|c|c|c|c|}
\cline{1-7}
en -- es & en -- ru & en -- sl & en -- hi & en -- war & en -- ht & en -- pms\\
\cline{1-7}
0.81 -- 0.89 & 0.8 -- 0.89 & 0.98 -- 0.96 & 1 -- 1 & 0.74 -- 0.56 & 1 -- 0.22 & 0.89 -- 0.38\\
\cline{1-7}
\end{tabular}
\end{table}
It is clear that in the case of the Creole language only at most $22\%$ documents are unique and suitable for the training. Though we removed the stub documents, many of the remaining documents are nearly the same, as the quality of some smaller Wikipedias is low. This was confirmed for the Creole, Waray-Waray, and Piedmontese languages by manual inspection. The low quality documents correspond to templates about the year, person, town, etc. and contain very few unique words.
There is also a problem with the quality of the test data. For example, if we look at the test pair (\emph{war}, \emph{ht}) only 386/534 Waray-Waray test documents are unique but on the other side almost all Creole test documents (523/534) are unique. This indicates a poor alignment which leads to poor performance.
\subsection{Evaluation Of Cross-Lingual Event Linking}
In order to determine how accurately we can predict cluster equivalence, we performed two experiments in a multilingual setting using English, German and Spanish languages for which we had labelled data to evaluate the linking performance. In the first experiment, we tested how well the individual approaches for cross-lingual article linking perform when used for linking the clusters about the same event. In the second experiment we tested how accurate the prediction model is when trained on different subsets of learning features. To evaluate the prediction accuracy for a given dataset we used 10-fold cross validation.
We created a manually labelled dataset in order to evaluate cross-lingual event linking using two human annotators. The annotators were provided with an interface listing the articles, their content from and top concepts for a pair of clusters and their task was to determine if the clusters were equivalent or not (i.e., discuss same event). To obtain a pair of clusters $(c_i, c_j)$ to annotate, we first randomly chose a cluster $c_i$, used Algorithm~\ref{cluster_merge_algo1} to compute a set of potentially equivalent clusters $C$ and randomly chose a cluster $c_j \in C$. The dataset provided by the annotators contains 808 examples, of which 402 are equivalent clusters pairs and 406 are not. Clusters in each learning example are either in English, Spanish or German. Although Event Registry imports articles in other languages as well, we restricted our experiments to these three languages. We chose only these three languages since they have very large number of articles and clusters per day which makes the cluster linking problem hard due to large number of possible links.
In Section~\ref{sec:models}, we described three main algorithms for identifying similar articles in different languages. These algorithms were $k$-means, LSI and hub CCA. As a training set, we used common Wikipedia alignment for all three languages. To test which of these algorithms performed best, we made the following test. For each of the three algorithms, we analyzed all articles in Event Registry and for each article computed the most similar articles in other languages. To test how informative the identified similar articles are for cluster linking we then trained three classifiers as described in Section~\ref{algo:features} -- one for each algorithm. Each classifier was allowed to use as learning features \textbf{only} the cross-lingual article linking features for which values are determined based on the selected algorithm ($k$-means, LSI and hub CCA). The results of the trained models are shown in Table~\ref{table:linkingEvalAlgos}. We also show how the number of topics (the dimensions of the latent space) influences the quality, except in the case of the $k$-means algorithm, where only the performance on 500 topic vectors is reported, due to higher computational cost.
We observe that, for the task of cluster linking, LSI and hub CCA perform comparably and both outperform $k$-means.
We also compared the proposed approaches on the task of Wikipedia mate retrieval (the same task as in Section~\ref{experiments:hubcca}). We computed the Average (over language pairs) Mean Reciprocal Rank (AMRR)~\cite{voorhees1999trec} performance of the different approaches on the Wikipedia data by holding out $15,000$ aligned test documents and using $300,000$ aligned documents as the training set. Figure~\ref{pic:AMRR} shows AMRR score as the function of the number of feature vectors. It is clear that hub CCA outperforms LSI approach and $k$-means lags far behind when testing on Wikipedia data. The hub CCA approach with $500$ topic vectors manages to perform comparably to the $LSI$-based approach with $1,000$ topic vectors, which shows that the $CCA$ method can improve both model memory footprint as well as similarity computation time.
Furthermore, we inspected how the number of topics influences the accuracy of cluster linking. As we can see from Table~\ref{table:linkingEvalAlgos} choosing a number of features larger than $500$ barely affects linking performance, which is in contrast with the fact that additional topics helped to improve AMMR, see Figure~\ref{pic:AMRR}. Such differences may have arisen due to different domains of training and testing (Wikipedia pages versus news articles).
We also analyzed how cluster size influences the accuracy of cluster linking. We would expect that if the tested pair of clusters has a larger number of articles then the classifier should be able to more accurately predict whether the clusters should be linked or not. The reasoning is that the large clusters would provide more document linking information (more articles mean more links to other similar articles) as well as more accurately aggregated semantic information. In the case of smaller clusters, the errors of the similarity models have greater impact which should decrease the performance of the classifier, too. To validate this hypothesis we have split the learning examples into two datasets -- one containing cluster pairs where the combined number of articles from both clusters is below 20 and one dataset where the combined number is 20 or more. The results of the experiment can be seen in Table~\ref{table:linkingEvalAlgosLargeSmall}. As it can be seen, the results confirm our expectations: for smaller clusters it is indeed harder to correctly predict if the cluster pair should be merged or not.
The hub CCA attains higher precision and classification accuracy on the task of linking small cluster pairs than the other methods, while LSI is slightly better on linking large cluster pairs. The gain in precision of LSI over hub CCA on linking large clusters is much smaller than the gain in precision of hub CCA over LSI on linking small clusters. For that reason we decided to use hub CCA as the similarity computation component in our system.
\begin{figure}
\centering
\begin{tikzpicture}[scale=0.8]
\begin{axis}[%
width=4.520833in,
height=3.565625in,
at={(0.758333in,0.48125in)},
scale only axis,
every outer x axis line/.append style={black},
every x tick label/.append style={font=\color{black}},
xmin=100,
xmax=1000,
xlabel={Number of feature vectors},
every outer y axis line/.append style={black},
every y tick label/.append style={font=\color{black}},
ymin=0.2,
ymax=0.9,
ylabel={AMRR},
axis x line*=bottom,
axis y line*=left,
legend style={at={(0.692559,0.152778)},anchor=south west,legend cell align=left,align=left,draw=black}
]
\addplot [color=red,solid]
table[row sep=crcr]{%
100 0.574094231082746\\
200 0.645978450670063\\
300 0.682226506762222\\
400 0.710722094692085\\
500 0.731517169423203\\
600 0.746223870375363\\
700 0.758312886611436\\
800 0.766279310559898\\
900 0.768159613081689\\
1000 0.76200517888255\\
};
\addlegendentry{Hub CCA};
\addplot [color=blue,dash pattern=on 1pt off 3pt on 3pt off 3pt]
table[row sep=crcr]{%
100 0.388773162433835\\
200 0.49061571487968\\
300 0.550801867794634\\
400 0.592565604079171\\
500 0.625657099289601\\
600 0.65240747960386\\
700 0.675602522126668\\
800 0.694149727717174\\
900 0.711511053167843\\
1000 0.726455461653153\\
};
\addlegendentry{LSI};
\addplot [color=black,dash pattern=on 1pt off 3pt on 3pt off 3pt,mark=*,mark options={solid}]
table[row sep=crcr]{%
100 0.203799120889507\\
200 0.275537657758881\\
300 0.334738107118325\\
400 0.378380649062479\\
500 0.409668545430712\\
600 0.427765004442194\\
700 0.454449272479224\\
800 0.477291178317808\\
900 0.490692600634559\\
1000 0.518392823243787\\
};
\addlegendentry{k-means};
\end{axis}
\end{tikzpicture}%
\caption{Average of mean reciprocal ranks}
\label{pic:AMRR}
\end{figure}
\begin{table}[h]
\caption{Accuracy of cluster linking with 500/800/1,000 topic vectors obtained from different cross-lingual similarity algorithms. The table shows for each of the algorithms the obtained classification accuracy, precision and recall.}
\label{table:linkingEvalAlgos}
\begin{center}
\begin{tabular}{|c|c|c|c|c|}
\hline
\cline{1-5}
Models & Accuracy \% & Precision \% & Recall \% & $F_1$ \% \\ \cline{1-5}
hub CCA & 78.2/79.6/80.3 & 76.3/78.0/80.5 & 81.6/82.1/79.9 & 78.9/80.0/80.2
\\ \cline{1-5}
LSI & 78.9/78.7/80.6 & 76.8/77.0/78.7 & 83.3/80.6/83.6 & 79.9/78.8/81.1 \\ \cline{1-5}
$k$-means & 73.9/-/- & 69.5/-/- & 84.6/-/- & 76.3/-/- \\ \cline{1-5}
\end{tabular}
\end{center}
\end{table}
\begin{table}[h]
\caption{Accuracy of cluster linking using $500$ topic vectors on two datasets containing large (left number) and small (right number) clusters. The dataset with small clusters contained the subset of learning examples in which the combined number of articles from both clusters of the cluster pair were below 20. The remaining learning examples were put into the dataset of large clusters.}
\label{table:linkingEvalAlgosLargeSmall}
\begin{center}
\begin{tabular}{|c|c|c|c|c|}
\hline
\cline{1-5}
Models & Accuracy \% & Precision \% & Recall \% & $F_1$ \% \\ \cline{1-5}
hub CCA & 81.2 - 77.8 & 80.5 - 74.5 & 91.3 - 57.5 & 85.6 - 64.9 \\ \cline{1-5}
LSI & 82.8 - 76.4 & 81.3 - 70.9 & 93.1 - 57.5 & 86.8 - 63.5 \\ \cline{1-5}
$k$-means & 75.5 - 71.2 & 72.8 - 70.8 & 95.3 - 36.2 & 82.5 - 47.9 \\ \cline{1-5}
\end{tabular}
\end{center}
\end{table}
In the second experiment, we evaluate how relevant individual groups of features are to correctly determine cluster equivalence. For this purpose, we computed accuracy using individual groups of features, as well as using different combination of groups. Since hub CCA had the best performance of the three algorithms, we used it to compute the values of the cross-lingual article linking features. The results of the evaluation are shown in Table~\ref{table:linkingEval}. We can see that using a single group of features, the highest prediction accuracy can be achieved using concept-related features. The classification accuracy in this case is 88.5\%. By additionally including also the cross-lingual article linking features, the classification accuracy rises slightly to 89.4\%. Using all three groups of features, the achieved accuracy is 89.2\%.
To test if the accuracy of the predictions is language dependent we have also performed the evaluations separately on individual language pairs. For this experiment we have split the annotated learning examples into three datasets, where each dataset contained only examples for one language pair. When training the classifier all three groups of features were available. The results are shown in Table~\ref{table:langPairEval}. We can see that the performance of cluster linking on the English-German dataset is the highest in terms of accuracy, precision, recall and $F_1$. The performance on the English-Spanish dataset is comparable to the performance on the English-German dataset, where the former achieves higher recall (and slightly higher $F_1$ score), while the latter achieves higher precision. A possible explanation of these results is that the higher quantity and quality of English-German language resources leads to a more accurate cross-lingual article similarity measure as well as to a more extensive semantic annotation of the articles.
Based on the performed experiments, we can make the following conclusions. The cross-lingual similarity algorithms provide valuable information that can be used to identify clusters that describe the same event in different languages. For the task of cluster linking, the cross-lingual article linking features are however significantly less informative compared to the concept-related features that are extracted from the semantic annotations. Nevertheless, the cross-lingual article similarity features are very important for two reasons. The first is that they allow us to identify for a given cluster a limited set of candidate clusters that are potentially equivalent. This is a very important feature since it reduces the search space by several orders of magnitude. The second reason these features are important is that concept annotations are not available for all articles as the annotation of news articles is computationally intensive and can only be done for a subset of collected articles. The prediction accuracies for individual language pairs are comparable although it seems that the achievable accuracy correlates with the amount of available language resources.
\begin{table}[h]
\caption{The accuracy of the classifier for story linking using different sets of learning features.}
\label{table:linkingEval}
\begin{center}
\begin{tabular}{|c|c|c|c|c|}
\hline
\cline{1-5}
Features & Accuracy \% & Precision \% & Recall \% & $F_1$ \% \\ \cline{1-5}
hub CCA & $78.3 \pm 5.9$ & $78.2 \pm 7.0$ & $78.9 \pm 5.2$ & $78.4 \pm 5.5$ \\ \cline{1-5}
Concepts & $88.5 \pm 2.7$ & $88.6 \pm 4.8$ & $88.6 \pm 2.2$ & $88.5 \pm 2.4$ \\ \cline{1-5}
Misc & $54.8 \pm 6.7$ & $61.8 \pm 16.5$ & $58.2 \pm 30.2$ & $52.4 \pm 13.0$ \\ \cline{1-5}
hub CCA + Concepts & $89.4 \pm 2.5$ & $89.4 \pm 4.6$ & $89.6 \pm 2.4$ & $89.4 \pm 2.3$ \\ \cline{1-5}
hub CCA + Misc & $78.8 \pm 5.0$ & $78.9 \pm 7.1$ & $79.4 \pm 4.6$ & $79.0 \pm 4.5$ \\ \cline{1-5}
Concepts + Misc & $88.7 \pm 2.6$ & $88.8 \pm 4.6$ & $88.8 \pm 2.2$ & $88.7 \pm 2.3$ \\ \cline{1-5}
All & $89.2 \pm 2.6$ & $88.8 \pm 4.9$ & $90.1 \pm 1.9$ & $89.3 \pm 2.3$ \\ \cline{1-5}
\hline
\end{tabular}
\end{center}
\end{table}
\begin{table}[h]
\caption{The accuracy of the classifier for story linking on training data for each language pair separately using all learning features.}
\label{table:langPairEval}
\begin{center}
\begin{tabular}{|c|c|c|c|c|}
\hline
\cline{1-5}
Language pair & Accuracy \% & Precision \% & Recall \% & $F_1$ \% \\ \cline{1-5}
en, de & $91.8 \pm 5.5$ & $91.7 \pm 6.3$ & $93.7 \pm 6.3$ & $92.5 \pm 5.1$ \\ \cline{1-5}
en, es & $87.7 \pm 5.4$ & $87.7 \pm 7.4$ & $88.5 \pm 9.8$ & $87.6 \pm 5.9$ \\ \cline{1-5}
es, de & $88.6 \pm 4.3$ & $89.7 \pm 9.1$ & $84.3 \pm 11.9$ & $85.9 \pm 6.0$ \\ \cline{1-5}
\hline
\end{tabular}
\end{center}
\end{table}
\subsection{Remarks on the scalability of the implementation}
One of the main advantages of our approach is that it is highly scalable. It is fast, very robust to quality of training data, easily extendable, simple to implement and has relatively small hardware requirements. The similarity pipeline is the most computationally intensive part and currently runs on a machine with two Intel Xeon E5-2667 v2, 3.30GHz processors with 256GB of RAM. This is sufficient to do similarity computation over a large number of languages if needed. It currently uses Wikipedia as a freely available knowledge base and experiments show that the similarity pipeline dramatically reduces the search space when linking clusters.
Currently, we compute similarities over $24$ languages with tags: \emph{eng}, \emph{spa}, \emph{deu}, \emph{zho}, \emph{ita}, \emph{fra}, \emph{rus}, \emph{swe}, \emph{nld}, \emph{tur}, \emph{jpn}, \emph{por}, \emph{ara}, \emph{fin}, \emph{ron}, \emph{kor}, \emph{hrv}, \emph{tam}, \emph{hun}, \emph{slv}, \emph{pol}, \emph{srp}, \emph{cat}, \emph{ukr} but we support any language from the top $100$ Wikipedia languages. Our data stream is Newsfeed (\protect\url{http://newsfeed.ijs.si/}) which provides 430k unique articles per day. Our system currently computes 2 million similarities per second, that means that we compute $16 \cdot 10^{10}$ similarities per day. We
store one day buffer for each language which requires 1.5 GB of memory with documents stored as 500-dimensional vectors. We note that the time complexity of the similarity computations scales linearly with dimension of the feature space and does not depend on number of languages. For each article, we compute the top $10$ most similar ones in every other language.
For all linear algebra matrix and vector operations, we use high performance numerical linear algebra libraries as BLAS, OPENBLAS and Intel MKL, which currently allows us to process more than one million articles per day.
In our current implementation, we use the variation of the hub approach. Our projector matrices are of size $500\times 300,000,$ so every projector takes about $1.1$ GB of RAM. Moreover, we need proxy matrices of size $500\times500$ for every language pair. That is 0.5 GB for $24$ languages and $9.2$ GB for $100$ languages. All together we need around 135 GB of RAM for the system with 100 languages.
Usage of proxy matrices enables the projection of all input documents in the common space and handling language pairs with missing or low alignment. That enables us to do block-wise similarity computations further improving system efficiency. Our code can therefore be easily parallelized using matrix multiplication rather than performing more matrix - vector multiplications. This speeds up our code by a factor of around $4.$ In this way, we obtain some caching gains and ability to use vectorization.
Our system is also easily extendable. Adding a new language requires the computation of a projector matrix and proxy matrices with all other already available languages.
\section{Discussion and Future Work}
In this paper we have presented a cross-lingual system for linking events in different languages. Building on an existing system, Event Registry, we present and evaluate several approaches to compute a cross-lingual similarity function. We also present an approach to link events and evaluate effectiveness of various features. The final pipeline is scalable both in terms of number of articles and number of languages, while accurately linking events.
On the task of mate retrieval, we observe that refining the LSI-based projections with hub CCA leads to improved retrieval precision, but the methods perform comparably on the task of event linking. Further inspection showed that the CCA-based approach reached a higher precision on smaller clusters. The interpretation is that the linking features are highly aggregated for large clusters, which compensates the lower per-document precision of LSI. Another possible reason is that the advantage that we show on Wikipedia is lost on the news domain. This hypothesis could be validated by testing the approach on documents from a different domain.
The experiments show that the hub CCA-based features present a good baseline, which can greatly benefit from additional semantic-based features. Even though in our experiments the addition of CCA-based features to semantic features did not lead to great performance improvements, there are two important benefits in the approach. First, the linking process can be sped up by using a smaller set of candidate clusters. Second, the approach is robust to languages where semantic extraction is not available, due to scarce linguistic resources.
\subsection{Future Work}
Currently the system is loosely-coupled -- the language component is built independently from the rest of the system, in particular the linking component. It is possible that better embeddings can be obtained by methods that jointly optimize a classification task and the embedding.
Another point of interest is to evaluate the system on languages with scarce linguistic resources, where semantic annotation might not be available. For this purpose, the labelled dataset of linked clusters should be extended first. The mate retrieval evaluation showed that even for language pairs with no training set overlap, the hub CCA recovers some signal.
In order to further improve the performance of the classifier for cluster linking, additional features should also be extracted from articles and clusters and checked if they can increase the accuracy of the classification. Since the amount of linguistic resources vary significantly from language to language it would also make sense to build a separate classifier for each language pair. Intuitively, this should improve performance since weights of individual learning features could be adapted to the tested pair of languages.
| {'timestamp': '2015-12-23T02:06:44', 'yymm': '1512', 'arxiv_id': '1512.07046', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.07046'} | arxiv |
\section{Introduction}
\label{sec:intro}
Robotic folding of a garment is a difficult task because it requires sequential manipulations of a highly unconstrained, deformable object.
Given the garment shape, the robot can fold it by following a folding plan~\cite{millerICRA2011}\cite{Milleretal_IJRR2012}.
However, the layout of the same folding action can vary in terms of the material properties such as cloth hardness and the environment such as friction between the garment and the table.
Given the starting and ending folding positions, different folding trajectories will lead to different results.
In this paper, we propose a novel method that learns optimal folding trajectory parameters from predicted thin shell simulations of similar garments, which can then be applied to a real garment folding task (see Figure~\ref{fig:intro}). The contributions of our paper are:
\begin{itemize}
\item[-] A fast and robust algorithm that can detect garment key points such as sleeve ends, collar, and waist corner, automatically. These key points can be used for folding plan generation.
\item[-] An online optimization algorithm that learns optimal trajectories for manipulation from mathematical model evolution combined with predictive thin shell simulation.
\item[-] A novel approach that adjusts the simulation environment to the robot working environment for the purpose of creating a similar manipulation result.
\item[-] The trajectories are general in that they can be scaled to accommodate similar garments of different size.
\item[-] Experimental results with a Baxter robot showing successful folding trajectories for a number of different garments including sweaters, pants, and towels.
\end{itemize}
Figure~\ref{fig:flowchart} shows the complete pipeline of garment manipulation, as well as the key steps of garment folding.
The garment folding is the final step of the entire pipeline of garment manipulation which contains grasping, visual recognition, regrasping, unfolding, placing flat, and folding.
Our previous work~\cite{LiICRA2014}\cite{LiIROS2014}\cite{LiICRA2015} has successfully addressed all the stages of the pipeline with the exception of the final folding task.
This paper specifically addresses the robotic folding task (purple rectangle in Figure~\ref{fig:flowchart}) with the goal of finding optimal trajectories to successfully fold garments.
We begin by assuming the garment is placed flat on the table initially, as shown in our previous work~\cite{LiICRA2015}.
By detecting the key points of the garment (see section~\ref{sec:localization}), a pre-defined folding plan is used to create optimal trajectories for folding the garment.
After several steps, we obtain a desired folding result in the real world using the Baxter robot, which is comparable to the result from the simulation.
\begin{figure}[t]
\begin{center}
\centering
\includegraphics[width=0.48\textwidth]{fig/Trajectory_Figure_1-eps-converted-to.pdf}
\end{center}
\caption{
Comparison of our simulation of robotic manipulation ({\sc{TOP}}) and real
robot implementation ({\sc{BOTTOM}}). The green curves show the virtual and the real trajectories for folding.}
\label{fig:intro}
\end{figure}
\begin{figure*}[!htb]
\centering
\includegraphics[width=0.99\textwidth]{fig/BaxterFlowChart-eps-converted-to.pdf}
\caption{
{\sc Top Row: } The entire pipeline of dexterous manipulation of deformable objects.
In this paper, we are focusing on the phases of garment folding, as highlighted in the purple rectangle.
{\sc Bottom Row: } Details of the folding procedure. We apply off-line simulation with iterative trajectory optimization to find the best trajectory for a specific folding action by comparing the result (light blue contour) with template (black contour). Similar steps are repeated until the garment is folded in the simulator. Then all the folding trajectories are exported, adapted, and implemented on a real robot. Green arcs illustrate the actual trajectories of robotic arms.}
\label{fig:flowchart}
\end{figure*}
\section{Related Work}
\label{sec:relatedwork}
There are many challenges associated with the manipulation of a deformable object such as a garment.
One of the challenges is unfolding a garment from an arbitrary state and placing it flat on a table.
Many researchers start with simple garments such as a towel~\cite{Shepard2010}.
By iteratively looking for the lowest corner point of the towel, the robot is able to unfold it and place flat on a table.
Then the towel can be quickly folded by symmetric information.
For more complicated garments such as sweaters and pants, their states (poses) have to be recognized first by either image-based perception~\cite{Willimon2013}\cite{LiICRA2014}\cite{DoumanoglouECCV2014} or 3D shape matching~\cite{Kita2009}\cite{LiIROS2014}, etc..
Deformable objects such as a garment have large dimensional state spaces which are hard to track and recognize.
Therefore, for such tasks, many researchers employ a large database which contains exemplars of different states of an object from off-line simulation or real garments as the training data.
By using SIFT feature~\cite{Willimon2013}\cite{LiICRA2014} or volumetric features~\cite{DoumanoglouECCV2014}\cite{LiIROS2014}, the state of a garment is recognized and tracked.
After regrasping several times, the garment can be unfolded and placed flat on a table by a dual-arm robot~\cite{Towner2011}\cite{StriaIROS2014}\cite{LiICRA2015}, a prerequisite for garment folding.
With the garment fully spread on the table, attention is turned to parsing its shape.
S. Miller~\emph{et al.}\xspace have designed a parametrized shape model for unknown garments~\cite{millerICRA2011}\cite{Milleretal_IJRR2012}.
Each set of parameters defines a certain type of garment such as a sweater or a towel.
The contour-based garment shape model was further improved by J. Stria~\emph{et al.}\xspace using polygonal models~\cite{Stria2014TAROS}.
The detected garment contour is matched to a polygonal model by removing non-convex points using a dynamic programming approach.
Folding is the ultimate goals of garment manipulation and only a few researchers have achieved this.
F. Osawa \emph{et al.}\xspace used a robot to fold a garment with a special purpose table that contains a plate that can bend and fold the clothes assisted by a dual-arm robot.
Another folding method using a PR2 robot was implemented by J. van den Berg \emph{et al.}\xspace~\cite{vandenberg2010}.
The core of their approach was the geometry reasoning with respect to the cloth model without any physical simulation.
Similar work done by J. Stria~\emph{et al.}\xspace~\cite{StriaIROS2014} using two industrial arms and a polygonal contour model.
Kita,~\emph{et al.}\xspace~\cite{Kita2014} use a humanoid robot to fold a garment starting from a random configuration.
None of the previous works focus on trajectory optimization for garment folding, which brings uncertainty to the layout given the same folding plan.
One possible case is that the garment shifts on the table during one folding action so that the targeted folding position is also moved.
Another case is that an improper folding trajectory causes additional deformation of the garment itself, which can accumulate.
\begin{figure}[!htpb]
\begin{center}
\includegraphics[width=0.49\textwidth]{fig/Failure_Examples_camera_ready-eps-converted-to.pdf}
\end{center}
\caption{Failure example with improper folding trajectories.
{\sc{First Row:}} Folding trajectory is low and flat that causes drift to the towel and long-sleeve T-Shirt.
{\sc{Second Row:}} Folding trajectory is too high when the gripper approaching the target folding position that piles up the towel.
{\sc{Third Row:}} Dual-arm folding. If the distance between the two arms is too close, the folding may fail.}
\label{fig:failure_examples}
\end{figure}
Figure~\ref{fig:failure_examples} shows a few failure examples with improper trajectories.
We use green tape on the table to show the original position of the garments.
The first two rows show that if the moving trajectory is too low and close to the garment, the folded part will fall down, pull the rest, and cause drift of the whole garment.
These cases usually happen when the folding step is lengthy without trajectory optimization.
The third row shows a case where the folding trajectory is too high, which will cause extra wrinkles or even piling up.
The last row shows two cases using two arms to fold.
If the arms are close, the part in between loses tension, and will fall down and pull the rest away.
The focus of this paper is to create trajectories for folding that will overcome these problems.
\section{Simulation Environment}
\label{section:Simulation}
\subsection{Folding Pipeline in Simulation}
In the model simulation, we use a physics engine~\cite{urlMaya} to simulate the movement and deformation of the garment mesh models.
We assume there is only one garment for each folding task, which has been placed flat on a table.
A virtual table is added to the scene which the garment lies on, as shown in Figure~\ref{fig:intro}, top.
During each folding step, the robot arm picks up a small part of the mesh, moves it to the target position following a computed trajectory, and places it on the table to simulate an entire folding scenario.
If the part of the garment to be folded is relatively wide, then both left and right arms may be involved.
The trajectory is generated using a B\'ezier curve, which will be discussed in section~\ref{sec:trajectory_optimization}.
Most of the garment mesh models are built from our test garments.
A garment mesh is created by first extracting the contour of the garment (see section~\ref{sec:localization}).
Then by inserting points on the inside of the garment contour, we triangulate a mesh by connecting these points.
Lastly, we mirror the mesh to construct a two-sided garment mesh
\subsection{Parameter Adaptation}
There are two key parameters needed to accurately simulate the real world folding environment.
The first is the material properties of the fabric, and the second is the frictional forces between the garment and the table.
\subsubsection{Material properties}
Through many experiments, we found that the most important property for the garments in the simulation environment is shear resistance.
It specifies the amount the simulated mesh model resists shear under strain; when the garment is picked up and hung by gravity, the total length will be elongated due to the balance between gravity force and shear resistance.
An appropriate shear resistance measure allows the simulated mesh to reproduce the same elongation as the real garment.
This parameter will bridge the gap between the simulation and the real world for the garment mesh model.
For each garment, we follow the steps described below to measure the shear resistance.
Figure~\ref{fig:measurement} shows an example.
\begin{itemize}
\item[-] Manually pick one extremum part of the garment such as the sleeve end of a T-shirt, the waist part of a pair of pants, and a corner of a towel.
\item[-] Hang the garment under gravity and measure the length between the picking point and the lowest point as $L_1$
\item[-] Slowly put down the garment on a table and keep the picking point and the lowest point in the previous step at maximum spread condition. Measure the distance between these two points again as $L_2$. The shear resistance fraction is defined as the following
\begin{align}
shear\_frac = ({L_1} - {L_2})/{L_2}
\end{align}
\item[-] We then pick up and hang the virtual garment in \emph{Maya}, adjusting the \emph{Maya} shear parameter such that the shear fraction as calculated in the simulator is identical to the real world.
\end{itemize}
\begin{figure}[!htpb]
\begin{center}
\includegraphics[width=0.48\textwidth]{fig/measurement-eps-converted-to.pdf}
\end{center}
\caption{Method for measuring the shear resistance.
{\sc{Left:}} Diagonal length measurement.
{\sc{Middle:}} Zoomed in regions.
{\sc{Right:}} The garment is hanging under gravity.}
\label{fig:measurement}
\end{figure}
\subsubsection{Frictional forces}
The surface of the table can be rough if covered by a cloth sheet or slippery if not covered, which leads to variance in friction between the table and garment.
A shift of the garment during the folding can possibly impair the whole process and cause additional repositioning.
Adjusting the frictional level in the simulation to the real world is crucial and necessary for trajectory optimization.
To measure the friction between the table and the garment, we do the following steps.
\begin{itemize}
\item[-] Place a real garment on the real table of length $L_t$.
\item[-] Slowly lift up one side of the real table, until the garment in the real world begins to slide. The lifted height is $H_s$. The friction angle is computed as,
\begin{align}
{\angle _{Friction}} = {\sin ^{ - 1}}({H_s}/{L_t})
\end{align}
\item[-] In the virtual environment, the garment is placed flat on a table with gravity. Assign a relatively high friction value to the virtual table. Lift up one side of the virtual table to the angle of ${\angle _{Friction}}$.
\item[-] Gradually decrease the frictional force in the virtual environment until the garment begins to slide.
Use this frictional force in the virtual environment as it mirrors the real world
\end{itemize}
With these two parameters, we obtain similar manipulation results for both the simulation and the real garment.
\section{Trajectory Optimization}
\label{sec:trajectory_optimization}
The goal of the folding task is specified by the initial and folded
shapes of the garment, and by the starting and target positions of the
grasp point (as in Figure~\ref{fig:traj_opt}). Given the simulation
parameters, we seek the trajectory that effects the desired set of folds.
We first describe how to optimize the trajectory for a single end
effector, and then discuss the case of two end effectors.
\subsection{Trajectory parametrization}
We use a B\'ezier curve~\cite{Farin:1988} to describe the trajectory.
An $n$-th order B\'ezier curve $\mathbf{T}(u)$ has $(n+1)$ control points
$\mathbf{P}_k = ({P}_{k,x}, {P}_{k,y}, {P}_{k,z})^T\in \mathbb{R}^3$, defined by
\begin{align}
\mathbf{T}(u) = \sum_{k=0}^n B_k^n(u) \mathbf{P}_k,
\end{align}
where $B_k^n(u) = \begin{pmatrix} n \\ k \end{pmatrix} (1-u)^{n-k} u^k$ are the Bernstein basis
functions.
\begin{figure}[!htpb]
\centering
\includegraphics[width=0.98\linewidth]{fig/trajectory_optimization-eps-converted-to.pdf}
\caption{An example of the folding task: we want to fold a sleeve into the blue
target position, by using a robotic gripper to move the tip of the sleeve
(grasp point) from the starting position ($\mathbf{P}_0$) to the target position
($\mathbf{P}_3$), following a trajectory, shown as the red curve.
$\mathbf{P}_1$ and $\mathbf{P}_2$ are knot points that form the B\'ezier trapezoid.}
\label{fig:traj_opt}
\end{figure}
We use $n=3$ for simplicity, but our method can be easily extended to
deal with higher order curves. $\mathbf{P}_0$ and $\mathbf{P}_3$ are
fixed to the specified starting and target positions of the grasp
point (as in Figure~\ref{fig:traj_opt}). The intermediate control points $\mathbf{x} =
(\mathbf{P}_1^T, \mathbf{P}_2^T)^T$ can then be adjusted to define a new trajectory using the objective function defined below. The update rule is described in section~\ref{sec:optimization}.
\begin{align}
\label{eq:objective}
\mathbf{x}_{opt} = \operatornamewithlimits{argmin}_{\mathbf{x}} \{\underbrace{ l_\mathbf{x} + \alpha D(\mathcal{S}_t, \mathcal{S}_{\mathbf{x}}) }_{C(\mathbf{x})} \}^2.
\end{align}
\begin{wrapfigure}{r}{0.2\textwidth}
\begin{center}
\includegraphics[width=1.0\linewidth]{fig/dissimilarity-eps-converted-to.pdf}
\end{center}
\caption{The dissimilarity captures the misalignment between
$\mathcal{S}_t$ and $\mathcal{S}_{\mathbf{x}}$ by integrating the distance
between the corresponding points $\mathbf{y} \in \mathcal{S}_t$ and
$\mathbf{q}(\mathbf{y}) \in \mathcal{S}_{\mathbf{x}}$ over the garment.}
\label{fig:dissimilarity}
\end{wrapfigure}
Here $C(\mathbf{x})$ is a cost function with two terms. The first term
penalizes the trajectory length
$l_\mathbf{x}$, thus preferring a folding path that is efficient in
time and energy. The second term seeks the desired fold, by penalizing dissimilarity $D(\mathcal{S}_t, \mathcal{S}_{\mathbf{x}})$
between the desired folded shape $\mathcal{S}_t$, compared to
the shape $\mathcal{S}_{\mathbf{x}}$ obtained by the
candidate folding trajectory $\mathbf{x}$, as predicted by a cloth simulation; we used a physical simulation engine~\cite{urlMaya},
for the cloth simulation.
The weight $\alpha$ balances the two terms; we used $\alpha
= 10^3$ in our experiment.
See section~\ref{sec:optimization} for optimization details.
Intuitively, dissimilarity measures the difference between the desired folded shape and the folded garment in simulation.
We define the dissimilarity term as
\begin{align}\label{eq:dissimilarity-cont}
D(\mathcal{S}_t, \mathcal{S}_{\mathbf{x}}) =
\frac{1}{|\mathcal{S}_t|}\int_{\mathcal{S}_t} \|\mathbf{q}(\mathbf{y}) -
\mathbf{y}\| dA,
\end{align}
where $|\mathcal{S}_t|$ is the total surface area of the garment mesh including both sides of the garment, $\mathbf{y} \in
\mathcal{S}_t$ is a point on the target folded shape $\mathcal{S}_t$,
$\mathbf{q}(\mathbf{y}) \in \mathcal{S}_{\mathbf{x}}$ is the corresponding
point on the simulated folded shape, and $dA$ is the area measure, see
Figure~\ref{fig:dissimilarity}.
Our implementation assumes $\mathcal{S}_t$
and $\mathcal{S}_{\mathbf{x}}$ are given as triangle meshes, and
discretizes~\eqref{eq:dissimilarity-cont} as
\begin{align}
\tilde{D}(\mathcal{S}_t, \mathcal{S}_{\mathbf{x}}) =
\frac{1}{|\mathcal{S}_t|}\sum_i \|\mathbf{q}_i - \mathbf{y}_i\| A_i,
\end{align}
where $\mathbf{y}_i$ is the barycenter of $i$-th triangle on the target shape,
$\mathbf{q}_i$ is the (corresponding) barycenter of $i$-th triangle on the simulated
shape, and $A_i$ is the area of the $i$-th triangle on the target shape.
To compute the trajectory length $l_\mathbf{x}$, we use the De Casteljau's
algorithm~\cite{Farin:1988} to recursively subdivide the B\'ezier curve
$\mathbf{T}$ into a set of B\'ezier curves $\mathbf{T}^{(j)}$, until the
deviation between the chord length ($\|\mathbf{P}_0^{(j)} -
\mathbf{P}_3^{(j)}\|$) and the total length between the control points
($\sum_{i=0}^2 \|\mathbf{P}_i^{(j)} - \mathbf{P}_{i+1}^{(j)}\|$) for each
subdivided curve $\mathbf{T}^{(j)}$ is sufficiently small. Then, $l_\mathbf{x}$
is approximated by summing up the chord lengths of all the subdivided curves:
$l_\mathbf{x} \approx \sum_j \|\mathbf{P}_0^{(j)} - \mathbf{P}_3^{(j)}\|$.
We initialize $\mathbf{P}_1$ and $\mathbf{P}_2$ as
\begin{align}
\mathbf{P}_1 = \frac{2}{3}\mathbf{P}_0 + \frac{1}{3}\mathbf{P}_3 + h \|\mathbf{P}_0-\mathbf{P}_3\| \mathbf{e}_v,\\
\mathbf{P}_2 = \frac{1}{3}\mathbf{P}_0 + \frac{2}{3}\mathbf{P}_3 + h \|\mathbf{P}_0-\mathbf{P}_3\| \mathbf{e}_v,
\end{align}
where $\mathbf{e}_v$ is the unit vector in the upward vertical direction,
$h$ is a constant value of $1/3$, which means the initial trajectory will have equal horizontal extent between knot points.
\subsection{Optimization.}
\label{sec:optimization}
To optimize equation \eqref{eq:objective}, we apply a secant version of
the Levenberg-Marquardt algorithm~\cite{Madsen:2004}\cite{Nocedal:2006}.
For the current trajectory generated by $\mathbf{x}$, we estimate the derivative $\nabla C(\mathbf{x})$ of
the cost function $C(\mathbf{x})$ numerically, by sampling slightly modified
trajectories $\mathbf{x} + \delta \mathbf{e}_j$, where $\mathbf{e}_j,
1\leq j \leq \textrm{dim}(\mathbf{x})$, are the orthonormal bases, and we used
$\delta = 10^{-1}$ in our implementation.
The secant version of Levenberg-Marquardt algorithm iteratively builds a local
quadratic approximation of $\{C(\mathbf{x})\}^2$ based on the numerical
derivative, and then takes a step toward an improved state. The direction of
the step is a combination of the steepest gradient descent direction and the
conjugate gradient direction. We use the specific approach described
by Madsen et al.~\cite{Madsen:2004} (see \S3.5 therein).
The iterative procedure terminates when the improvement in $\{C(\mathbf{x})\}^2$ becomes
sufficiently small.
\subsection{Multiple arms.}
In the case of using multiple arms, we associate an individual trajectory
$\mathbf{x}_i$ to each of the arms $R_i$. We then extend the state variable
to $\mathbf{x} = (\mathbf{x}_1^T, ...)^T$. The rest of the optimization
procedure is the same as the single arm case.
Note that both single and dual-arm trajectories are in 3D space.
The optimization for dual-arm trajectories is able to find a solution which will overcome failures such as shown in Figure~\ref{fig:failure_examples} bottom.
\section{Application to Garment Folding}
\subsection{Key Points Localization}
\label{sec:localization}
We assume the garment is placed roughly in the center of the table, as shown in the Figure~\ref{fig:garment_snakes}, bottom.
Our first step is to segment the garment from the background.
Since we can easily obtain a table or a surface with homogeneous color~\cite{millerICRA2011}\cite{Stria2014TAROS}, a fast color-based supervised image segmentation method is suitable for our task.
We apply a marker-based watershed method~\cite{vincent1991} with the four corners of the table initialized as background and the center initialized as the foreground.
More complicated scenes can employ advanced image segmentation algorithms such as GrabCut~\cite{Rother_grabcut}.
\begin{figure}[!htpb]
\center
\includegraphics[width=0.48\textwidth]{fig/snakes-eps-converted-to.pdf}
\caption{ Red dots are the predefined key points for the garment, such as sleeve ends.
Left column is a long-sleeve t-shirt example, and the right column is a pants example.
{\sc{Top:}} Initialized contour. Each garment category is initialized with a different contour.
{\sc{Middle:}} Fitting results. The contour shrinks onto the boundary of the garment according to the distance field.
{\sc{Bottom:}} Fitting results mapped back to the original input image.}
\label{fig:garment_snakes}
\end{figure}
To register the feature points, such as the corner points of sleeves,
we employ a 2D registration technique to register a pre-defined garment template
(as in Figure~\ref{fig:garment_snakes} top row) with the captured
garment mask. Our 2D registration is based on our 3D non-rigid
registration code for thin shell models~\cite{LiICRA2015},
and can deal with garment masks that have curved contours.
We first initialize a distance field using the segmented mask from
the previous step.
The category of the garment can be easily recognized by using a template matching algorithm, which leads to an associated garment initial template.
We register the template with the garment mask by minimizing the following energy function:
\begin{align}
\label{eqn:energy}
E_{T}(S,\bar{S}) = E_{\textrm{fit}}(S,T) + \kappa E_{\textrm{stretch}}(\bar{S}, \mathbf{x})
+ \beta E_{\textrm{bend}}(\bar{S}, \mathbf{x}),
\end{align}
where $T$ is the target garment mask, $S$ is the current deformed 2D
contour, and $\bar{S}$ is a reference 2D contour, which is from the previous state.
$E_{\textrm{fit}}(S,T)$ penalizes discrepancies between the
contour and the target mask.
The last two terms seek
to limit and regularize the deformation of the contour in order to
preserve the angle features,
which includes the stretching and bending energies, weighted by
user specified coefficients $\kappa$ and $\beta$.
We represent the contour as a closed loop consisting of line segments.
In this discrete representation, $E_{\textrm{fit}}$ is computed as
\begin{align}
\tilde{E}_{\textrm{fit}}(S,T) = \sum_i \left( \textrm{dist}_T(\mathbf{x}_i) \right)^2 l_i,
\end{align}
where $l_i$ and $\mathbf{x}_i$ are the length and the midpoint of the $i$-th
line segment of the deformed contour.
$E_{\textrm{stretch}}$ is computed as
\begin{align}
\tilde{E}_{\textrm{stretch}}(\bar{S}, \mathbf{x}) = \frac{1}{2} \sum_i \left( \frac{l_i}{\bar{l}_i} - 1\right)^2 \bar{l}_i,
\end{align}
where $\bar{l}_i$ is length of the $i$-th line segment of the reference contour.
$E_{\textrm{bend}}$ is computed as
\begin{align}
\tilde{E}_{\textrm{bend}}(\bar{S}, \mathbf{x}) = \frac{1}{2} \sum_j \left( \frac{\theta_j}{\bar{\theta}_j} -1 \right)^2 \bar{L}_j,
\end{align}
where $\theta_j$ and $\bar{\theta}_j$ are the angles between the adjacent
line segments at $j$-th vertex of the deformed and the reference contours,
respectively. $\bar{L}_j$ are the average length of the adjacent line segments
at $j$-th vertex of the reference contour.
Our registration iteratively updates $S$ by using the secant version of
the Levenberg-Marquardt algorithm~\cite{Madsen:2004}\cite{Nocedal:2006}.
Initially, each vertex in the template polygon is marked as a \textit{
feature point} (red points in Figure~\ref{fig:garment_snakes}, top row), and is
assigned a unique ID to identify its semantic meaning.
At the end of each step, we subdivide each contour segment if its length is
larger than a threshold, and mark the newly added vertex as
\textit{non-feature points} (green points in
Figure~\ref{fig:garment_snakes}, middle row).
Next, we merge any pair of adjacent segments if they do not share a feature point and their length is below a threshold.
The subdivide and merge operations guarantee that the garment
contour is sufficiently but not overly sampled. Then, we update the
reference contour $\bar{S}$ by $S$.
We repeat the iteration until
the reduction in $E_{T}(S,\bar{S})$ becomes sufficiently small.
Finally, the positions as well as the semantic meanings of the feature
points in the garment mask are identified by retrieving the feature points via the unique point ID
in the registered contour.
\section{Experimental Results}
\label{section:experiments}
To evaluate our results, we tested our method on several different garments such as long-sleeve t-shirts, pants, and towels for multiple trials, as shown in Figure~\ref{fig:garment_stat} left.
These garments require both single and dual-arm folds.
A high resolution video of our experimental results is online at {\url{http://www.cs.columbia.edu/~yli/IROS2015}}.
\subsection{Robot Setup}
In our experiments, we use a Baxter research robot, which is equipped with two arms with seven degrees of freedom.
We mount a Prime Sense Xtion range sensor~\cite{primesense} on top of the Baxter head panel, which has been calibrated to the robot base frame
To improve grasp stability and form a closed loop controller, we add tactile sensors to the grippers.
\subsection{Measurement of parameters}
To make the off-line simulation better approximate the real scenario, as described in Section~\ref{section:Simulation}, we manually measure the stretch resistance of each garment and friction on the table.
Figure~\ref{fig:garment_stat}, left shows a picture of all the test garments we used in different colors, sizes, and material properties.
Figure~\ref{fig:garment_stat}, right table shows the measured parameters of each test garment, including stretch percentage and Friction angle, and corresponding \emph{Maya} parameters.
For common garments, these parameters do not have a significant variance.
Therefore, we suggest that if researchers use simulators such as \emph{Maya}, the average values of each column are a reasonably good initialization.
\begin{figure*}[t]
\begin{minipage}[]{0.4\textwidth}
\centering
\includegraphics[width=0.80\textwidth]{fig/all_garments-eps-converted-to.pdf}
\end{minipage}
\begin{minipage}[]{0.6\textwidth}
\small
\centering
\footnotesize
\begin{tabular}{c|p{0.8cm}|p{1.3cm}|p{1.6cm} | p{1.1cm}} \hline
Garment Type & \centering Stretch (\%) & \centering Friction Angle ($^{\circ}$) & \centering Maya Shear Resistance &\centering Maya Friction \tabularnewline \hline
Long-Sleeve T-Shirt (large) & \centering $2.9$ & \centering $24.3$ & \centering $200$ & \centering $0.7$ \tabularnewline
Long-Sleeve T-Shirt (small) & \centering $2.9$ & \centering $24.7$ & \centering $200$ & \centering $0.7$ \tabularnewline
Jeans & \centering $2.9$ & \centering $19.1$ & \centering $200$ & \centering $0.5$ \tabularnewline
Pants & \centering $1.7$ & \centering $21.9$ & \centering $340$ & \centering $0.6$ \tabularnewline
Large Towel & \centering $2.2$ & \centering $18.7$ & \centering $260$ & \centering $0.5$ \tabularnewline
Medium Towel & \centering $3.1$ & \centering $22.3$ & \centering $190$ & \centering $0.6$ \tabularnewline
Small Towel & \centering $1.1$ & \centering $24.3$ & \centering $530$ & \centering $0.7$ \tabularnewline \hline
{\bf{Average}} & \centering ${\bf{2.4}}$ & \centering ${\bf{22.2}}$ & \centering $\bf{274}$ & \centering $\bf{0.6}$ \tabularnewline
\hline
\end{tabular}
\end{minipage}
\caption{{\sc{Left:} }A picture of our test garments.
{\sc{Right:}} Results for each unfolding test on the garments.
We show the results of stretch percentage, Friction angle of the table, and the corresponding parameters in Maya by each test.
The last row shows the average of each measurement component.
}
\label{fig:garment_stat}
\end{figure*}
\subsection{Garment manipulation and folding}
Figure~\ref{fig:good_examples} shows three successful folding examples from the simulation and the real world, including a long-sleeve shirt, a pair of pants, and a medium size towel.
We show six key frames for each folding task.
The folding poses from the simulation are in the first row of each group with an optimized trajectory.
We also show corresponding results from the real world.
The green tape contour on the table indicates the original position of the garment.
Each garment is first segmented from the background and key points are detected from the binary mask, which takes $3-5$ secs on a regular CPU.
The algorithm discussed in Sec.~\ref{sec:localization}.
Given the key points, a corresponding multi-step folding plan is created
For each garment, we have optimized trajectories for each folding step.
Here, we map these optimized trajectories to our scenario according to the generated folding plan.
Then the Baxter robot follows the folding plan with optimized trajectories to fold the garment.
We can see that the deformation of the real garment and the simulated garment is very similar.
Therefore, the final folding outcome is comparable to the simulation.
Table~\ref{fig:garment_experiments_stat} shows statistical results of the garment folding test.
Each time one or two robotic arms fold the garment counts as one fold.
We run $10$ trials for each test garment.
It turns out that the folding performance of the Long-Sleeve T-Shirts and Towels are very stable with our optimized trajectories.
Jeans and pants are less stable because the shear resistance of the surface is relatively high, and sometimes is difficult to bend, leading to unsuccessful folding.
In the successful folding cases for jeans and pants, we sometimes ended up with small wrinkles, but the folding plan was still able to complete successfully.
We also show the average time to fold a garment in the last row.
The robot is able to fold most garments in about $1.5$ minutes.
There is a trade-off between doing contour fitting at each step and total time spent to fold a garment.
In this work, we start with one template and then assume that each step after that the folded garment is close to that in the simulation.
Our results in Table~\ref{fig:garment_experiments_stat} verify that this method works well and is able to save time since we only do the contour fitting once.
With our simulated trajectories, the Baxter robot is able to fold a garment under predefined steps correctly.
An alternative method could use the contour fitting at each step but this would require more time and computation.
We note that some failures due to the motor control error from the Baxter robot.
When the robot executes an optimized trajectory, its arm suffers from a sudden drop or jitter.
Such actions will raise pull forces to the garment, leading to drift and inaccurate folding.
This can be solved by using an industrial level robotic arm with more accurate control.
We also note that failures can be recognized with the correct sensing suite, and we are currently investigating ways to effect online error recovery for such failures.
One difference between the simulation and the real world we found is that moving a point on the mesh in the simulation is different from using a gripper to grasp a small area of a real garment and move it.
In the future, we hope to be able to simulate a similar grasp effect for the trajectory optimization.
\begin{figure*}[t]
\begin{center}
\includegraphics[width=0.99\textwidth]{fig/Good_Examples-eps-converted-to.pdf}
\end{center}
\caption{Successful folding examples with optimized folding trajectories from off-line simulation.
The first row of each group is from the simulation and the second row is from the real world (Green tape shows the original garment contour position).
{\sc{Top Group:}} Long-sleeve shirt folding with $3$ steps.
{\sc{Middle Group:}} Long pants folding with $2$ steps.
{\sc{Bottom Group:}} Medium size towel folding with $2$ steps.}
\label{fig:good_examples}
\end{figure*}
\begin{table}[t]
\centering
\footnotesize
\begin{tabular}{c|p{1.0cm}|p{1.6cm}|p{1.6cm} } \hline
Garment Type & \centering \# of folds & \centering Success Rate & \centering Avg. Time (sec) \tabularnewline \hline
L-S T-Shirt (large) & \centering $3$ & \centering $10/10$ & \centering $121$ \tabularnewline
L-S T-Shirt (small) & \centering $3$ & \centering $10/10$ & \centering $118$ \tabularnewline
Jeans & \centering $2$ & \centering $7/10$ & \centering $88$ \tabularnewline
Pants & \centering $2$ & \centering $8/10$ & \centering $88$ \tabularnewline
Large Towel & \centering $2$ & \centering $10/10$ & \centering $90$ \tabularnewline
Medium Towel & \centering $2$ & \centering $10/10$ & \centering $88$ \tabularnewline
Small Towel & \centering $2$ & \centering $10/10$ & \centering $83$ \tabularnewline \hline
{\bf{Average}} & \centering ${\bf{2.3}}$ & \centering ${\bf{9.3/10}}$ & \centering ${\bf{97}}$ \tabularnewline
\hline
\end{tabular}
\caption{Results of folding test for each garment . We show the number of folding steps, successful rate, and total time of each garment. Each garment has been tested $10$ times. L-S stands for Long-Sleeve. The time is the average over all successful trials for each garment.
}
\label{fig:garment_experiments_stat}
\end{table}
\section{Conclusion}
In this paper, we propose a novel solution to find an optimal trajectory for manipulation of deformable garments.
We first create a simulation environment that is comparable to the real world.
By minimizing a quadratic objective function that measures dissimilarity between simulated folded shape and user specified shape iteratively, we obtain an optimized trajectory.
The trajectory is then mapped to a real robot and executed accordingly.
Experimental results demonstrate that with our optimized trajectories, the Baxter robot can manipulate the garment efficiently and accurately.
\textbf{Acknowledgments} We'd like to thank J. Weisz and J. Varley, for many discussions.
We'd also like to thank NVidia Corporation, Intel Corporation, and Takktile LLC for the hardware support.
This material is based upon work supported by the National Science Foundation under Grant No. 1217904 and in part by the JSPS Postdoctoral Fellowships for Research Abroad.
\bibliographystyle{plain}
| {'timestamp': '2015-12-23T02:01:58', 'yymm': '1512', 'arxiv_id': '1512.06922', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06922'} | arxiv |
\section{Introduction}
It is hard to overstate the influence that the economic idea of \textit{perfect rationality} has had on our way of designing artificial agents \citep{RussellNorvig2010}. Today, many of us in the fields of artificial intelligence, control theory, and reinforcement learning, design our agents by encoding the desired behavior into an objective function that \emph{the agents must optimize in expectation}. By doing so, we are relying on the theory of \textit{subjective expected utility} (SEU), the standard economic theory of decision making under uncertainty \citep{Neumann1944, Savage1954}. SEU theory has an immense intuitive appeal, and its pervasiveness in today's mindset is reflected in many widely-spread beliefs: \textit{e.g.} that probabilities and utilities are orthogonal concepts; that two options with the same expected utility are equivalent; and that randomizing can never improve upon an optimal deterministic choice. Put simply, if we find ourselves violating SEU theory, we would feel strongly compelled to revise our choice.
Simultaneously, it is also well-understood that SEU theory prescribes policies that are intractable to calculate save for very restricted problem classes. This was recognized soon after expected utility theory was formulated \citep{Simon1956}. In agent design, it became especially apparent more recently, as we continue to struggle in tackling problems of moderate complexity in spite of our deeper understanding of the planning problem \citep{Duff2002, Hutter2004, Legg2008, Ortega2011} and the vast computing power available to us. For instance, there are efficient algorithms to calculate the optimal policy of a \emph{known} Markov decision process (MDP) \citep{Bertsekas1996}, but no efficient algorithm to calculate the exact optimal policy of an \emph{unknown} MDP or a \emph{partially observable} MDP \citep{PapadimitriouTsitsiklis1987}. Due to this, in practice we either make severe domain-specific \emph{simplifications}, as in linear-quadratic-Gaussian control problems \citep{Stengel1994}; or we \emph{approximate} the ``gold standard'' prescribed by SEU theory, exemplified by the reinforcement learning algorithms based on stochastic approximations \citep{Sutton1998, Szepesvari2010} and Monte-Carlo tree search \citep{Kocsis2006, Veness2011, Mnih2015}.
Recently, there has been a renewed interested in models of \emph{bounded rationality} \citep{Simon1972}. Rather than approximating perfect rationality, these models seek to formalize decision-making with limited resources such as the time, energy, memory, and computational effort allocated for arriving at a decision. The specific way in which this is achieved varies across these accounts. For instance, \textit{epsilon-optimality} only requires policies to be ``close enough'' to the optimum \citep{Dixon2001}; \textit{metalevel rationality} proposes optimizing a trade-off between utilities and computational costs \citep{Zilberstein2008}; \textit{bounded optimality} restricts the computational complexity of the programs implementing the optimal policy \citep{Russell1995b}; an approach that we might label \textit{procedural bounded rationality} attempts to explicitly model the limitations in the decision-making procedures \citep{Rubinstein1998}; and finally, the \textit{heuristics} approach argues that general optimality principles ought to be abandoned altogether in favor of collections of simple heuristics \citep{Gigerenzer2001}.
Here we are concerned with a particular flavor of bounded rationality, which we might call ``information-theoretic'' due to its underlying rationale. While this approach solves many of the shortcomings of perfect rationality in a simple and elegant way, it has not yet attained widespread acceptance from the mainstream community in spite of roughly a decade of research in the machine learning literature. As is the case with many emerging fields of research, this is partly due to the lack of consensus on the interpretation of the mathematical quantities involved. Nonetheless, a great deal of the basics are well-established and ready for their widespread adoption; in particular, some of the algorithmic implications are much better understood today. Our goal here is to provide a consolidated view of some of the basic ideas of the theory and to sketch the intimate connections to other fields.
\subsection{A Short Algorithmic Illustration}
\paragraph{Perfect Rationality.}
Let $\Pi = \{\pi_1, \pi_2, \ldots, \pi_N\}$ be a finite set of $N \in \mathbb{N}$ candidate choices or policies, and let $U: \Pi \rightarrow [0,1]$ be a utility function mapping each policy into the unit interval. Consider the problem of finding a maximizing element $\pi^\ast \in \Pi$. For simplicity we assume that, given an element $\pi \in \Pi$, its utility $U(\pi)$ can be evaluated in a constant number of computation steps. Imposing no particular structure on $\Pi$, we find $\pi^\ast$ by sequentially evaluating each utility $U(\pi)$ and returning the best found in the end.
\begin{procframed}
\caption{PerfectlyRationalChoice($\Pi, U$)}
\DontPrintSemicolon
$\pi^\ast \leftarrow \pi_1 \in \Pi$ \;
\ForEach{$\pi \in \{\pi_2, \pi_3, \ldots, \pi_N\}$}{
\lIf{$U(\pi) \geq U(\pi^\ast)$}{$\pi^\ast \leftarrow \pi$}
}
\Return $\pi^\ast$
\end{procframed}
This \textit{exhaustive evaluation} algorithm works well if~$N$ is small, but it does not scale to the case when~$N$ is \emph{very} large. In real-world tasks, such \emph{very large decision spaces} are not the exception but rather the norm, and an agent faces them in most stages of its information-processing pipeline (\textit{e.g.}~attention focus, model selection, action selection). In these cases, the agent does not have enough resources to exhaustively evaluate each element in $\Pi$; rather, it only manages to inspect a negligible subset of $K \ll N$ elements in $\Pi$, where $K$ depends on the agent's limitations.
\paragraph{Bounded Rationality.}
We model this limitation as a constraint on the agent's \emph{information capacity} of relating utility functions with decisions. This limitation changes the nature of the decision problem in a fundamental way; indeed, information constraints yield optimal choice algorithms that look very unusual to someone who is used to the traditional optimization paradigm.
One simple and general way of implementing the decision process is as follows. A bounded rational agent inspects the choices until it finds one that is \textit{satisficing}. The order of inspection is random: the agent draws (without replacement) the candidate policies from a distribution $Q$ that reflects the \emph{prior knowledge} about the good choices. Then, for each proposed element $\pi \sim Q$, the agent decides whether $\pi$ is good enough using a stochastic criterion that depends both on the utility and the capacity. Importantly, the agent can inspect the policies \emph{in parallel} as is illustrated in the following pseudo-code.
\begin{procframed}
\caption{BoundedRationalChoice($\Pi,U, \alpha, U^\ast$)}
\DontPrintSemicolon
\SetKwBlock{llRepeat}{repeat in parallel}{end}
\llRepeat{
$\pi \sim Q$ \;
$u \sim \mathcal{U}[0,1]$ \;
\lIf{$u \leq \exp\{\alpha (U(\pi) - U^\ast)\}$}{\Return $\pi$}
}
\end{procframed}
The stochastic criterion is parametrized by $\alpha \in \mathbb{R}$ and $U^\ast \in [0,1]$ which jointly determine the size of the solution space and thereby the choice difficulty. The parameter~$\alpha$ is known as the \textit{inverse temperature}, and it plays the role of the \emph{degree of rationality}; whereas $U^\ast$ is an \emph{aspiration level} which is typically chosen to be the maximum utility that can be attained in principle, \textit{i.e.} $U^\ast = 1$ in our example.
The behavior of this algorithm is exemplified in Fig.~\ref{fig:intro-simulation}. In this simulation, the size $N$ of the policy space $\Pi$ was set to one million. The utilities were constructed by first mapping $N$ uniformly spaced points in the unit interval into $f(x) = x^2$ and then randomly assigning these values to the policies in $\Pi$. For the prior $Q$ we chose a uniform prior. Together, the utility and the prior determine the shape of the choice space illustrated in the left panel. The remaining panels show the performance of the algorithm in terms of the utility (center panel) and the number of inspected policies before a satisficing policy was found (right panel). This simulation shows two important aspects of the algorithm. First, the performance in utility is marginally decreasing in the search effort, as illustrated by the concavity of $U(\alpha)$ and the roughly proportional dependency between search effort and $\alpha$. Second, the parameter $\alpha$ essentially controls the performance of the algorithm. In contrast, it is easy to see that this performance is unaffected by the size of the set of policies, as long as the shape of the choice space is preserved.
\paragraph{Properties.}
Although the algorithm seems counter-intuitive at a first glance, it has the following advantages:
\begin{enumerate}
\item \emph{Use of prior knowledge.} If the agent possesses a distribution $Q$ over $\Pi$, where $Q(\pi)$ denotes the probability of $\pi$ being the best policy, then it can exploit this knowledge. In particular, if it already knows the maximizer $\pi^\ast$, \textit{i.e.}\ if $Q$ is a degenerate distribution given by a Kronecker delta function $\delta[\pi = \pi^\ast]$, then it will only query said policy.
\item \emph{Protection from adversarial enumeration.} If the agent were to inspect the policies using a fixed deterministic order, then it could fall prey to an adversarial shuffling of the utilities. The above randomization technique protects the agent from such an attack.
\item \emph{Control of complexity.} The agent can control the size of the solution space by choosing an appropriate value for the $\alpha$ parameter. More precisely, $|\alpha| \approx 0$ corresponds to an easy problem in which most proposals $\pi \sim P$ will be accepted; and $|\alpha| \gg 0$ is a hard problem.
\item \emph{Parallel.} The policies can be inspected in parallel, in contrast to perfect rationality\footnote{The running time of exhaustive search can be brought down to $O(\log N)$ through dynamic programming and parallelism, but the number of inspected policies is still $N$.}. Technically, this is possible because ``$\pi^\ast$ is satisficing'' is a statement in propositional logic. Instead, ``$\pi^\ast$ is a maximizer'', which can be rewritten as ``for every policy $\pi$, $\pi^\ast$ has larger utility than $\pi$'', is a statement in first-order logic with a universal quantifier that depends on exhaustive inspection.
\end{enumerate}
The above basic choice algorithm is very general. Apart from modeling intractability, it can be used to represent choices under model uncertainty, risk and ambiguity sensitivity, and other players' attitudes towards the agent. In the main text, we will see how to derive the algorithm from first principles, how to model general information constraints in decision making, and how to extend the basic decision-making scheme to sequential scenarios.
\begin{figure}[t]
\centering
\includegraphics[width=\textwidth]{figures/intro-simulation.pdf}
\caption{Simulation of bounded-rational choices. The left panel shows the shape of the utility function for 100 randomly chosen policies out of one million. These are shown both in the way the agent sees them ($\circ$-markers) and sorted in ascending order of the utility ($\bullet$-markers). The shaded area under the curve is an important factor in determining the difficulty of the policy search problem. The center and right panels illustrate the performance as a function of the inverse temperature, measured in terms of the utility (center panel) and the number of inspected policies before acceptance (right panel). Both panels show the mean (black curve) and the bands capturing 80\% of the choices excluding the first and last decile (shaded area). The values were calculated from 300 samples per setting of the inverse temperature.}\label{fig:intro-simulation}
\end{figure}
\subsection{Outlook}
In the next section we briefly review the ideas behind SEU theory. We touch upon two-player games in order to motivate a central concept: the certainty-equivalent. The section then finishes with two open problems of SEU theory: intractability and model uncertainty. Section~\ref{sec:boundedness} lays out the basic conceptual framework of information-theoretic bounded rationality. We analyze the operational characterization of having limited resources for deliberation, and state the main mathematical assumptions. From these, we then derive the free energy functional as the replacement for the expected utility in decision making. Section~\ref{sec:single-step} applies the free energy functional to single-step decision problems. It serves the purpose of further sharpening the intuition behind the free energy functional, both from a theoretical and practical view. In particular, the notion of equivalence of bounded-rational decision problems is introduced, along with practical rejection sampling algorithms. Section~\ref{sec:sequential-decisions} extends the free energy functional to sequential decisions. We will see that the notion of equivalence plays a crucial role in the construction and interpretation of bounded rational decision trees. We show how such decision trees subsume many special decision rules that represent risk-sensitivity and model uncertainty. The section finishes with a recursive rejection sampling algorithm for solving bounded-rational decision trees. The last section discusses the relation to the literature and concludes.
\section{Preliminaries in Expected Utility Theory}\label{sec:preliminaries}
Before we introduce the ideas that underlie bounded-rational decision-making, in this section we will set the stage by briefly reviewing SEU theory.
\paragraph{Notation.}
Sets are denoted with calligraphic letters such as in $\mathcal{X}$. The set $\Delta(\mathcal{X})$ corresponds to the simplex over $\mathcal{X}$, \textit{i.e.} the set of all probability distributions over $\mathcal{X}$. The symbols $\prob$ and $\expect$ stand for the probability measure and expectation respectively, relative to some probability space with sample space $\Omega$. Conditional probabilities are defined as
\begin{equation}\label{eq:cond-prob}
\prob(A|B) := \frac{ \prob(A \cap B) }{ \prob(B) }
\end{equation}
where $A,B \subset \Omega$ are measurable subsets, and where $B$ is such that $\prob(B) \neq 0$.
\subsection{Variational principles}
The behavior of an agent is typically described in one of two ways: either \emph{dynamically}, by directly specifying the agent's actions under any contingency; or \emph{teleologically}, by specifying a \emph{variational problem} (\textit{e.g.} a convex objective function) that has the agent's policy as its optimal solution. While these two descriptive methods can be used to represent the same policy, the teleological description has a greater explanatory power because in addition it encodes a \emph{preference relation} which justifies why the policy was preferred over the alternatives\footnote{Notice also that in this sense, the qualifier ``optimal'' is a statement that only holds relative to the objective function. That is, ``being optimal'' is by no means an absolute statement, because given \emph{any policy}, one can always engineer a variational principle that is extremized by it.}.
Because of the explanatory power of variational principles, they are widely used to justify design choices. For example, virtually every sequential decision-making algorithm is conceived as a \textit{maximum expected utility} problem. This encompasses popular problem classes such as multi-armed bandits, Markov decision processes (MDPs) and partially observable Markov decision processes (POMDPs)---see \citet{RussellNorvig2010} for a discussion. In learning theory, \textit{regret minimization} \citep{Loomes1982} is another popular variational principle to choose between learning algorithms \citep{CesaBianchiLugosi2006}.
\subsection{Subjective expected utility}\label{sec:seu}
Today, the theory of \emph{subjective expected utility} \citep{Savage1954} is the \textit{de facto} theory of rationality in artificial intelligence and reinforcement learning \citep{RussellNorvig2010}. The bedrock of the theory is a representation theorem stating that the preferences of a rational agent can be described in terms of comparisons between expected utilities. The qualifiers ``subjective'' and ``expected'' in its name derive from the fact that both the utility function and the belief distribution are assumed to be properties that are specific to each agent, and that the utility of a random realization is equated with the expected utility over the individual realizations.
\paragraph{Decision problem.}
Let $\set{X}$ and $\set{Y}$ be two finite sets, the former corresponding to the \emph{set of actions} available to the agent and the latter to the \emph{set of observations} generated by the environment in response to an action. A \emph{realization} is a pair $(x,y) \in \set{X} \times \set{Y}$. Furthermore, let $U: (\set{X} \times \set{Y}) \rightarrow \field{R}$ be a \emph{utility function}, such that $U(x,y)$ represents the desirability of the realization $(x,y) \in (\set{X}\times\set{Y})$; and let $Q(\cdot|\cdot)$ be a conditional probability distribution where $Q(y|x)$ represents the probability of the observation $y \in \set{Y}$ given the action $x \in \set{X}$.
\paragraph{Optimal policy.} The agent's goal is to choose a \emph{policy} that yields the highest expected utility; in other words, a probability distribution $P \in \Delta(\set{X})$ over actions that maximizes the functional (see Fig.~\ref{fig:eu-simplex})
\begin{equation}\label{eq:expected_utility}
EU[\tilde{P}]
:= \sum_x \tilde{P}(x) \expect[U|x]
= \sum_x \tilde{P}(x) \biggl\{ \sum_y Q(y|x) U(x,y) \biggl\}.
\end{equation}
Thus, an \emph{optimal policy} is any distribution $P$ with no support over suboptimal actions, that is, $P(x) = 0$ whenever $\expect[U|x] \leq \max_z \expect[U|z]$. In particular, because the expected utility is linear in the policy's probabilities, one can always choose a solution that is a vertex of the probability simplex $\Delta(\set{X})$:
\begin{equation}\label{eq:optimal_expected_utility}
P(x)
= \delta_{x^\ast}^x
= \begin{cases}
1 & \text{if $x = x^\ast := \arg\max_x \expect[U|x]$}\\
0 & \text{otherwise,}
\end{cases}
\end{equation}
where $\delta$ is the Kronecker delta. Hence, there always exists a deterministic optimal policy.
\begin{figure}
\centering
\includegraphics[width=0.6\textwidth]{figures/eu-simplex.pdf}
\caption{Expected Utility Theory. Left: A decision problem can be represented as a tree with two levels. Choosing a policy amounts to assigning transition probabilities for the decision node located at the root~($\bigtriangleup$), subject to the fixed transition probabilities in the chance nodes~($\bigcirc$) and the utilities at the leaves ($\square$). Right: Mathematically, this is equivalent to choosing a member $P$ of the simplex over actions $\Delta(\mathcal{X})$ that maximizes the convex combination over conditional expected utilities $\expect[U|x]$.}\label{fig:eu-simplex}
\end{figure}
\paragraph{Utility distribution.} Given the optimal policy, the utility $U$ becomes a well-defined random variable with probability distribution
\begin{equation}\label{eq:utility_distribution}
\prob(U=u)
= \prob\bigl\{ (x,y) : U(x,y) = u \bigr\} \nonumber \\
= \sum_{U^{-1}(u)} P(x) Q(y|x).
\end{equation}
Even though the optimal policy might be deterministic, the utility of the ensuing realization is in general a non-degenerate random variable. Notably, perfectly rational agents are insensitive to the higher-order moments of the utility: so two actions yielding utilities having very different variances are regarded as being equal if their expectations are the same.
\paragraph{Friends and foes.}
What happens when the environment is yet another agent? According to \emph{game theory} \citep{Neumann1944}, we can model this situation again as a decision problem, but with the crucial difference that the agent lacks the conditional probability distribution $Q(\cdot|\cdot)$ over observations that it needs in order evaluate expected utilities. Instead, the agent possesses a second utility function $V: (\set{X} \times \set{Y}) \rightarrow \field{R}$ representing the desires of the environment. Game theory then invokes a \emph{solution concept}, most notably the \emph{Nash equilibrium}, in order to propose a substitute for the missing distribution $Q(\cdot|\cdot)$ based on $U$ and $V$, thereby transforming the original problem into as a well-defined decision problem.
To simplify, we assume that the agent chooses first and the environment second, and we restrict ourselves to two special cases: (a) the fully \emph{adversarial} case $U(x,y) = -V(x,y)$; and (b) the fully \emph{friendly} case $U(x,y) = V(x,y)$. The Nash equilibrium then yields the decision rules \citep{Osborne1999}
\begin{align}
P &= \arg\max_{\tilde{P}} \sum_x \tilde{P}(x)
\biggl\{ \min_{\tilde{Q}} \tilde{Q}(y|x) U(x,y) \biggr\},
\label{eq:minmax} \\
P &= \arg\max_{\tilde{P}} \sum_x \tilde{P}(x)
\biggl\{ \max_{\tilde{Q}} \tilde{Q}(y|x) U(x,y) \biggr\}
\label{eq:maxmax}
\end{align}
for the two cases respectively. Comparing these to~\eqref{eq:expected_utility}, we observe two properties. First, the overall objective function appears to arise from a modular composition of two nested choices: the outer for the agent and the inner for the environment. Second, there are essentially three ways in which the utilities of a choice are aggregated---namely through maximization, expectation, and minimization---depending on the nature of the choice.
\paragraph{Certainty-equivalent.}
An agent plans ahead by recursively aggregating future value into present value. As we have seen, it does so by summarizing the value of each choice using one of three aggregation types: \emph{minimization} ($\bigtriangledown$), representing an adversarial choice; \emph{expectation} ($\bigcirc$), representing an indifferent (random) choice; and \emph{maximization} ($\bigtriangleup$), representing a friendly choice. This summarized value is known as the \emph{certainty-equivalent}, because if the agent were to substitute a choice with multiple alternatives with an equivalent (degenerate) choice with a single alternative, the latter would have this value (see Fig.~\ref{fig:ce-examples}). Notice that for planning purposes, it is irrelevant whether the decision is made by the agent or not; to the agent, what matters is the degree to which an outcome (be it an action or an observation) contributes positively to its objective function (as encoded by one of the three possible aggregation operators). Indeed, another (concise) way to describe subjective expected utility theory is that the certainty-equivalent of random outcomes is given by the expectation.
\begin{figure}[ht]
\centering
\includegraphics[width=0.8\textwidth]{figures/ce-examples.pdf}
\caption{Decision problems (top row) and their certainty-equivalents (bottom row).}\label{fig:ce-examples}
\end{figure}
\subsection{Two open problems}\label{sec:open-problems}
We finish this section by presenting two very common situations in which the application of perfect rationality does not seem to be the right thing to do: very large choice spaces and model uncertainty.
\paragraph{Very large choice spaces.}
Consider the problem of choosing the longest straw in a given collection. Expected utility theory works well when the number of elements is small enough so that the agent can exhaustively measure all their lengths and report the longest found. This is the case in the situation depicted in Fig.~\ref{fig:large-scale}a, where it is easily seen that the top-most straw is the longest. The situation of Fig.~\ref{fig:large-scale}b however appears to be very different. Here, the number of straws is very large and their arrangement is unstructured. The lack of structure prevents us from grouping the straws for simplifying our search, \textit{i.e.} there are no symmetries for defining equivalence classes that would reduce the cardinality of our search space. Consequently, there is no obvious improvement over testing some elements by picking at random until finding one that is sufficiently good.
\begin{figure}[h]
\centering
\includegraphics[width=\textwidth]{figures/large-decision-spaces.pdf}
\caption{Very large choice spaces. a) Perfect rationality can capture decision problems involving a small number of choices. b) However, perfect rationality is intractable in very large and unstructured choice spaces.}\label{fig:large-scale}
\end{figure}
\paragraph{Model uncertainty.}
Consider a task in which you must choose one of two boxes containing $100$ black and white balls. After your choice is announced, a ball is drawn at random from the box, and you win $\$ 100$ if the color is black (or nothing otherwise). If you get to see the contents of the two boxes then you would choose the box containing a larger proportion of black balls. For instance, in Fig.~\ref{fig:ellsberg}a you would choose the left box. However, which box would you choose in the situation shown in Fig.~\ref{fig:ellsberg}b? In his seminal paper, \citet{Ellsberg1961} showed that most of people bet on the left box. A simple explanation for this phenomenon is that people fill the missing information of the right box by enumerating all the possible combinations of 100 black and white balls, attaching prior probabilities to them in a risk-averse way. Thus, such prior beliefs assigns a larger marginal probability to the loosing color---in this case, ``white''.
Now, assume that you place your bet, but no ball is drawn. Instead, you are asked to revise your bet. The contents of the boxes are assured to stay exactly the same, but now you are told that this time you win for ``white'' rather than ``black''. Would you change your bet? Empirically, most of the people stick with their initial bet. However, there is no single prior distribution over combinations that can predict this particular preference pattern, as this would contradict expected utility theory. Are people thus irrational? Perhaps, but it is worthy to point out that L. J. Savage, who formulated subjective expected utility theory, was among the people who violated the theory \citep{Ellsberg1961}.
\begin{figure}[h]
\centering
\includegraphics[width=\textwidth]{figures/ellsberg.pdf}
\caption{The Ellsberg paradox. a) Two boxes with known proportions of black and white balls. b) Two boxes where only the proportions of the left box are known.}\label{fig:ellsberg}
\end{figure}
One explanation for this apparent paradox is that the right box of second experiment involves unknown probabilities\footnote{Importantly, the economic literature distinguishes between \textit{risk} (= known probabilities) and \textit{ambiguities} (= unknown probabilities) \citep{Knight1921, Ellsberg1961}. Savage defined subjective expected utility theory as a theory of decision making \emph{under risk}. There is currently no widely agreed upon definition of ambiguities, although there exist proposals, such as the framework of \textit{variational preferences} \citep{Rustichini2006}.} which affect the net value of a choice. In this case, people might actually have a uniform model over combinations of black and white balls, but they nevertheless discount the value of the box as an expression of \textit{distrust} in the model. On the other hand, there are people who perceive increased net values in some situations. Such could be the case, for instance, if they knew and trusted the person who set up the experiment. We will see later in the text how this interaction between the trust in the beliefs and the utility can be modeled using the bounded-rational framework.
\section{The Mathematical Structure of Boundedness}\label{sec:boundedness}
We now tackle the problem of formalizing boundedness. First, we will pursue an obvious route, namely that of \textit{meta-reasoning}. While meta-reasoning models can model important aspects of complex decision-making (\textit{e.g.} preliminary resource allocation and reasoning about other agents), it ultimately falls short in adequately modeling bounded-rationality.
\subsection{Meta-reasoning}\label{sec:meta-resoning}
One straightforward attempt to address the problem of intractability of expected utility theory is through \emph{meta-reasoning} \citep{Zilberstein2008}, \textit{i.e.}\ by letting the agent reason about the very costs of choosing a policy. The rationale is that, an agent can avoid prohibitive costs by finding a trade-off between the utility of a policy and the cost of evaluating said policy.
\paragraph{Formal solution.} The argument proceeds as follows. Let $U: \Pi \rightarrow \mathbb{R}$ be a bounded utility function that maps each policy $\pi \in \Pi$ into a value $U(\pi)$ in the unit interval. A perfectly-rational agent then solves the problem
\begin{equation}\label{eq:maximisation}
\max_{\pi \in \Pi} U(\pi),
\end{equation}
and uses any solution $\pi^\ast$ as its policy. Rather than solving~\eqref{eq:maximisation} which is deemed to be too hard, a \emph{meta-level rational} agent solves the problem
\begin{equation}\label{eq:meta-level}
\max_{\pi \in \Pi} \Bigl\{ U(\pi) - C(\pi) \Bigr\},
\end{equation}
where $C(\pi) \in \mathbb{R}^{+}$ is a positive penalization term due to the cost of evaluating the policy~$\pi$ that is spent by the agent's policy-search algorithm, \textit{e.g.} time or space complexity of a Turing machine.
\paragraph{Criticism.} While the idea of meta-reasoning is intuitively appealing, it fails to simplify the original decision problem. This is seen by defining $U'(\pi) := U(\pi) - C(\pi)$ and noting that the agent's meta-level reasoning maximizes the objective function
\begin{equation}\label{eq:meta-2}
\max_{\pi \in \Pi} U'(\pi),
\end{equation}
which is itself another perfectly-rational decision problem. But then, the rationale of meta-reasoning tells us that evaluating the meta-level utilities $U'(\pi)$ should come with penalizations $C'(\pi)$ due to the costs incurred by the policy-search algorithm that is used at the meta-level\ldots
There are two problems with this scheme. First, it is quickly seen that this line of reasoning leads to an infinite regress when carried to its logical conclusion. Every time the agent instantiates a meta-level to reason about lower-level costs, it generates new costs at the meta-level. Second, the problem at a meta-level is typically harder than the lower-level one. How can we circumvent these problems?
\subsection{Incomplete Information and Interrupted Deliberation}\label{sec:incomplete-information}
The central problem with meta-reasoning lies in its self-referential logic: whenever an agent attempts to reason about its own costs of reasoning, it creates a new perfectly-rational decision problem at the meta-level that comes with additional costs that are left out. Due to this, we conclude that it is \emph{impossible} for an agent to fully apprehend its own resources of deliberation. Notice that this does not prevent agents from using meta-reasoning; it just excludes meta-reasoning as a formal solution to the bounded-rationality problem.
\paragraph{Formal solution.} The problem can be solved by modeling the agent's deliberation as a \textit{game of incomplete information} or \textit{Bayesian game} \citep{Harsanyi1967}. Such a game allows us to represent the agent's ignorance about the very objective function it is supposed to optimize. Loosely speaking, it allows us to model the ``unknown uncertainties'' (as opposed to ``known uncertainties'') that the agent has about its goals. We refer the reader to the texts on game theory by \citet{Osborne1999} or \citet{Leyton2008} for an introduction to Bayesian games.
We model the agent's decision as single-player game of incomplete information. For this, it is useful to distinguish between the agent's \emph{alleged} objective and the \emph{perceived} objective as seen by an external observer. The agent is equipped with an objective function $U(\pi)$ that it \emph{attempts} to optimize with respect to the policy $\pi \in \Pi$. However, it unexpectedly runs out of resources, effectively being interrupted at an indeterminate point in its deliberation, and forced to commit to a suboptimal policy $\pi^{\circ} \in \Pi$. From an external observer's point of view, $\pi^{\circ} \in \Pi$ \emph{appears} to be the result of an intentional deliberation seeking to optimize an alternative objective function $U(\pi) - C(\pi)$ that trades off utilities and deliberation costs.
Formally, let $\mathcal{C}$ be a discrete set of penalization functions of the form $C:\Pi \rightarrow \field{R}$ that model different interruptions. Then, the agent does not solve a particular problem, but rather a \emph{collection of problems} given by
\begin{equation}\label{eq:interrupted}
\forall C \in \mathcal{C},\qquad \max_{\pi \in \Pi} \Bigl\{ U(\pi) - C(\pi) \Bigr\}.
\end{equation}
In other words, the agent finds an optimal policy $\pi^\ast_C$ for \emph{any} penalization function $C \in \mathcal{C}$.
This abstract multi-valued optimization might appear unusual. However, one simple way of thinking about it is in terms of an \textit{any-time} optimization. In this scheme, the agent's computation generates ``intermediate'' solutions $\pi_1, \pi_2, \ldots$ to
\[
U - C_1, \quad
U - C_2, \quad
U - C_3, \quad
\ldots
\]
respectively, where $C_1, C_2, \ldots$ is an exhaustive enumeration of $\mathcal{C}$. This ordering of $\mathcal{C}$ is not specified by~\eqref{eq:interrupted}; however, one can link this to computational resources by demanding an ascending ordering $C_1(\pi_1) \leq C_2(\pi_2) \leq \ldots$ of penalization. Nature secretly chooses a penalization function~$C^\circ \in \mathcal{C}$, which is only revealed when the agent produces the solution~$\pi^\circ$ to $U-C^\circ$. This causes the computation to stop and the agent to return $\pi^\circ$. Now, notice that since the agent does not know $C^\circ$, its computational process can be regarded as an \textit{a priori} specification of the solution to the multi-valued optimization problem \eqref{eq:interrupted}.
\subsection{Commensurability of utility and information}\label{sec:commensurable}
The fact that finding a good policy comes at a cost that changes the net value of the agent's pay-off suggests that utilities and search costs should be translatable into each other, \textit{i.e.} they should be \emph{commensurable}. The aim of this section is to present a precise relationship between the two quantities. This relationship, while straightforward, has rich and conceptually non-trivial consequences that significantly challenge our familiar understanding of decision-making.
\paragraph{Search.} We first introduce a search model that will serve as a concrete example for our exposition. In this model, the agent searches by repeatedly obtaining a random point from a \emph{very large and unstructured domain} until a desired target is hit. For this, we consider a finite \emph{sample space}~$\Omega$ and a probability measure $\prob$ that assigns a probability $\prob(S)$ to every subset $S \subset \Omega$; a \emph{reference set} $B \subset \Omega$ with $\prob(B) \neq 0$; and a \emph{target set} $A \subset B \subset \Omega$. In each round, the agent samples a point $\omega$ from the conditional probability distribution $\prob(\cdot|B)$. If $\omega$ falls within the target set $A$, then the agent stops. Otherwise, the next round begins and the sampling procedure is repeated.
The components of this model are interpreted as follows. The agent's \emph{prior knowledge} is modeled using the reference set~$B$. The points that lie outside of~$B$ are those that are never inspected by the agent (\textit{e.g.} because it knows that these points are undesirable or because they are simply inaccessible). Every choice of a reference set induces a \emph{prior} distribution~$\prob(\cdot|B)$. Furthermore, the difficulty of finding the target is relative: The number of samples~$N$ that the agent has to inspect up until hitting the target depends upon the relative size of~$A$ with respect to~$B$, which is given by the conditional probability $\prob(A|B)$. Thereby, $N$ is a random variable that follows a geometric distribution $N \sim \mathcal{G}(p)$ with success probability $p := \prob(A|B)$, having the expected value
\begin{equation}\label{eq:expected-target}
\expect[ N ] = \frac{ 1 }{ \prob(A|B) }.
\end{equation}
\comment{
\paragraph{``Straw pile'' assumptions.} To make our model more realistic for large-scale search domains, we make the following additional informal assumptions:
\begin{enumerate}
\item \emph{Very large:} Although finite, we assume that the sample space $\Omega$ is very large.
\item \emph{Negligible probability:} The agent's knowledge is at all times limited, and every singleton has negligible probability mass relative to the reference, i.e.\ $\prob(\{\omega\}|B) \approx 0$.
\item \emph{Irreducible:} The elements of the sample space cannot be grouped in any meaningful way so as to reduce the effective size of the search domain.
\item \emph{Lack of structure:} We assume that previous samples do not provide any significant information about the location of the target.
\end{enumerate}
One way to imagine these assumptions is in terms of the simple ``straw pile'' analogy introduced in Sec.~\ref{sec:open-problems} illustrated in Fig.~\ref{fig:straw}b, where the agent has to find a long straw inside of a very large pile of straw. To do so, the agent starts by using his prior knowledge: it first decides to focus its attention on a smaller region that it knows to contain a much larger proportion of long straw than the original pile. It then repeatedly selects a straw and checks its length until it finds one that matches the requirement. Importantly, that region contains too many straws that are disordered and essentially indistinguishable from each other at a first glance. Because of this, the agent \emph{cannot do not better} than just inspecting one by one, chosen at random.
\begin{figure}[htbp]
\centering
\includegraphics[width=0.6\textwidth]{figures/straw.pdf}
\caption{``Straw Pile'' Assumptions. }\label{fig:straw}
\end{figure}
}%
\paragraph{Decision complexity.} Based on the previous search model, we now define the \textit{decision complexity} $\cost(A|B)$ as a measure of the cost required to specify a target set $A$ given a reference $B$, where $A$ and $B$ are arbitrary measurable subsets of the sample space $\Omega$ with $\prob(B) \neq 0$. We impose the following properties on the measure $\cost$:
\begin{mdframed}
\begin{enumerate}
\item[a)] \emph{Functional form:} For every $A, B$ such that $A \subset B \subset \Omega$,
\[\cost(A|B) := f \circ \prob(A|B),\]
where $f$ is a continuous, real-valued mapping.
\item[b)] \emph{Additivity:} For every $A, B, C$ such that $A \subset B \subset C \subset \Omega$,
\[ \cost(A|C) = \cost(B|C) + \cost(A|B). \]
\item[c)] \emph{Monotonicity:} For every $A, B, C, D$ such that $A \subset B \subset \Omega$ and $C \subset D \subset \Omega$,
\[ \prob(A|B) > \prob(C|D) \quad \Longleftrightarrow \quad \cost(A|B) < \cost(C|D). \]
\end{enumerate}
\end{mdframed}
\begin{figure}[htbp]
\centering
\includegraphics[width=\textwidth]{figures/desiderata.pdf}
\caption{Decision complexity. In each figure, the reference and target sets are depicted by light and dark-colored areas respectively. a) The complexity varies continuously with the target $A$ and the reference $B$. b) The complexity can be decomposed additively. c) The complexity decreases monotonically when increasing the conditional probability.}\label{fig:desiderata}
\end{figure}
How does $\cost$ look like? We first observe that the desideratum (a) allows us to restrict our attention only to continuous functions~$f$ that map the unit interval $[0,1]$ into real numbers. Then, the desiderata~(b) and~(c) imply that any~$f$ must fulfill the functional equation
\begin{equation}\label{eq:functional-equation-f}
f(pq) = f(p) + f(q)
\end{equation}
for any $p,q \in [0,1]$ subject to the constraint $f(p) < f(q)$ whenever $p > q$. It is well-known that any solution to the previous functional equation must be of the form
\begin{equation}\label{eq:solution-f}
f(p) = - \frac{1}{\alpha} \log p,
\end{equation}
where $\alpha > 0$ is an arbitrary positive number. Thus, the complexity measure is given by
\begin{equation}\label{eq:cost}
\cost(A|B) = -\frac{1}{\alpha} \log P(A|B) = \frac{1}{\alpha} \log \expect[N],
\end{equation}
that is, proportional to the \emph{Shannon information} $-\log \prob(A|B)$ of $A$ given $B$. This shows that the decision complexity is proportional to the minimal amount of bits necessary to specify a choice and proportional to the logarithm of the expected number of points $\expect[N]$ that the agent has to sample before finding the target.
\paragraph{Utility.}
Let us take one step back to revisit the concept of utility. Utilities were originally envisioned as \emph{auxiliary} quantities for conceptualizing \emph{preferences} in terms of simple numerical comparisons. In turn, a \emph{preference} is an empirical tendency for choosing one course of action over another that the agent repeats under similar circumstances. In the economic literature, this rationale that links probability of choice and preferences is known as \emph{revealed preferences} \citep{Samuelson1938}.
It is interesting to note that subjective expected utility is a theory that is particularly stringent in its behavioral demands, because it assumes that an agent will unequivocally choose the exact same course of action whenever it faces an equivalent situation---rather than just displaying a \emph{tendency} towards repeating a choice. Intuitively though, it seems natural to admit weaker forms of preferences. For instance, consider the situation in Fig.~\ref{fig:embedding}a depicting an agent's choice probabilities $Q(x)$ and $P(x)$ before and after deliberation respectively. Even though the agent does not commit to any particular choice, it is plausible that its preference relation $\succ$ is such that $x_2 \succ x_3 \succ x_1$, meaning that $U(x_2) > U(x_3) > U(x_1)$ for an appropriately defined notion of utility.
\begin{figure}
\centering
\includegraphics[width=\textwidth]{figures/embedding.pdf}
\caption{Deliberation as search. a) An agent's deliberation is a transformation of prior choice probabilities $Q(x)$ into posterior choice probabilities $P(x)$. The relative changes reflect the agent's preferences. b) To understand the complexity of this transformation, we model it as a search process with the convention $Q(x) = \prob(x|Q)$ and $P(x) = \prob(x|P)$, where $P \subset Q \subset \Omega$.}\label{fig:embedding}
\end{figure}
\paragraph{Free energy.}
We have discussed several concepts such as decisions, choice probabilities, utilities, and so forth. Our next step consists in reducing these to a single primitive concept: decision complexity. This synthesis is desirable both due the theoretical parsimony as well as the integrated picture of decision-making that it delivers. To proceed, we first note that an agent's deliberation process transforming a prior~$Q$ into a posterior~$P$ can be cast in terms of a search process where~$Q$ and~$P$ are the reference and target sets respectively. As illustrated in Fig.~\ref{fig:embedding}b, the set of available choices $\mathcal{X}$ forms a partition of the sample space $\Omega$. The distributions~$P$ and~$Q$ are encoded as nested subsets $P \subset Q \subset \Omega$ using the notational convention
\begin{equation}\label{eq:convention-prob}
P(x) := \prob(x|P) \qquad \text{ and } \qquad Q(x) := \prob(x|Q),
\end{equation}
that is, where the two sets induce distributions over the choices through conditioning. With these definitions in place, we can now derive an expression for the complexity $\cost(P|Q)$ in terms of choice-specific complexities $\cost(x \cap P|x \cap Q)$:
\begin{align}
\nonumber
\cost(P|Q) &= -\frac{1}{\alpha} \log \prob(P|Q) \vphantom{\biggl|}\\
\nonumber
&= - \frac{1}{\alpha} \sum_x \prob(x|P)
\nonumber
\log \biggl\{ \prob(P|Q) \frac{ \prob(x|P) \prob(x|Q) }{ \prob(x|P) \prob(x|Q) } \biggr\}\\
\nonumber
&= - \frac{1}{\alpha} \sum_x \prob(x|P) \log \frac{ \prob(x \cap P|Q) }{ \prob(x|Q) }
+ \frac{1}{\alpha} \sum_x \prob(x|P) \log \frac{ \prob(x|P) }{ \prob(x|Q) } \\
\label{eq:CPQ}
&= \sum_x \prob(x|P) \cost(x \cap P|x \cap Q)
+ \frac{1}{\alpha} \sum_x \prob(x|P) \log \frac{ \prob(x|P) }{ \prob(x|Q) }.
\end{align}
The first equality is obtained through an application of the definition~\eqref{eq:cost}. The second equality is obtained by multiplying the constant term $\prob(P|Q)$ with another term that equals one and subsequently taking the expectation with respect to $P(x|P)$. Separating the terms in the logarithm into two different sums and using the product rule $\prob(x \cap P|Q) = \prob(x|P) \cdot \prob(P|Q)$ gives the third equality (note that $P \cap Q = P$). The last step of the derivation is another application of \eqref{eq:cost}. If we now use the convention \eqref{eq:convention-prob} we get
\begin{equation}\label{eq:free-energy-cost}
\cost(P|Q) =
\sum_x P(x) \cost(x \cap P|x \cap Q)
+ \frac{1}{\alpha} \sum_x P(x) \log \frac{ P(x) }{ Q(x) }.
\end{equation}
How can we interpret this last expression? In essence, it relates the decision complexities of two different states of knowledge. If the agent's state of knowledge is $(x \cap Q)$, then the complexity of finding the target $(x \cap P)$ is equal to $\cost(x \cap P|x \cap Q)$. This assumes that the agent knows that the resulting choice will be $x$ for sure. However, since the agent does not know the final choice, then \eqref{eq:free-energy-cost} says that the total complexity of deliberation is equal to the average choice-specific complexities \emph{plus} a penalty (given by the KL-divergence) due to not knowing of the future outcome. Put differently, the certainty-equivalent complexity of an uncertain choice \emph{is larger than the expected complexity}. This constitutes the most important deviation from subjective expected utility theory.
Equation \eqref{eq:free-energy-cost} derived above can now be turned into a variational principle by observing that the r.h.s.\ is convex in the posterior choice probabilities. Thus, define \emph{utilities} as quantities that, up to a constant $C \in \mathbb{R}$, are equal to negative complexities:
\[
U(x) := -\cost(x \cap P|x \cap Q) + C.
\]
Then, subtracting $C$ from \eqref{eq:free-energy-cost} and taking the negative gives the functional
\begin{equation}\label{eq:free-energy-functional}
F[\tilde{P}] := \sum_x \tilde{P}(x) U(x)
- \frac{1}{\alpha} \sum_x \tilde{P}(x) \log \frac{ \tilde{P}(x) }{ Q(x) },
\end{equation}
which now is \emph{concave} in $\tilde{P}$ and, when maximized, minimizes the complexity of transforming~$Q$ into~$P$ subject to the utilities~$U(x)$. Equation \eqref{eq:free-energy-functional} is the so-called \emph{free energy functional}, or simply the \emph{free energy}\footnote{Here we adopt this terminology to relate to existing work on statistical mechanical approaches to control. To be precise however, in the statistical mechanical literature this functional corresponds to (a shifted version of) the \emph{negative free energy difference}. This is because utilities are negative energies, and because \eqref{eq:free-energy-functional} characterizes the \emph{difference} between two free energy potentials.}, and it will serve as the foundation for the approach to bounded-rational decision making of this work.
\section{Single-Step Decisions}\label{sec:single-step}
\subsection{Bounded-rational decisions}
In this section we will take the free energy functional~\eqref{eq:free-energy-functional} as the objective function for modeling bounded-rational decision making. We will first focus on simple one-step decisions and explore their conceptual and algorithmic implications.
\paragraph{Decision problem.}
A bounded-rational agent, when deliberating, transforms prior choice probabilities into posterior choice probabilities in order to maximize the expected utility---but it does so subject to information constraints. Formally, a \emph{bounded-rational decision problem} is a tuple $(\alpha, \mathcal{X}, Q, U)$, where: $\alpha \in \mathbb{R}$ is the \emph{inverse temperature} which acts as a rationality parameter; $\mathcal{X}$ is a finite set of possible \emph{outcomes}; $Q \in \Delta(\mathcal{X})$ is a prior probability distribution over $\mathcal{X}$ representing a \emph{prior policy}; and $U: \mathcal{X} \rightarrow \mathbb{R}$ is a real-valued mapping of the outcomes called the \emph{utility function}.
\paragraph{Goal.}
Given a bounded-rational decision problem $(\alpha, \mathcal{X}, Q, U)$, the \emph{goal} consists in finding the \emph{posterior policy} $P \in \Delta(\mathcal{X})$ that \emph{extremizes} the \emph{free energy functional}
\begin{equation}\label{eq:fe}
F[\tilde{P}] :=
\underbrace{ \sum_x \tilde{P}(x) U(x) }_\text{Expected Utility}
- \frac{1}{\alpha} \underbrace{ \sum_x \tilde{P}(x) \log \frac{\tilde{P}(x)}{Q(x)} }_\text{Information Cost}.
\end{equation}
Thus, the free energy functional captures a fundamental decision-theoretic trade-off: it corresponds to the expected utility, regularized by the information cost of representing the final distribution~$P$ using the base distribution~$Q$. The functional is illustrated in Fig.~\ref{fig:free-energy-simplex}.
\paragraph{Inverse temperature.}
The inverse temperature $\alpha$ controls the trade-off between utilities and information costs by setting the exchange rate between units of information (in \emph{bits}) and units of utility (in \emph{utiles}). An agent's deliberation process can be affected by a number of disparate factors imposing information constraints; nonetheless, here the central assumption is that all of them can ultimately be condensed into the single parameter $\alpha$.
Furthermore, notice that we have extended the domain of $\alpha$ to the real values $\mathbb{R}$. The sign of $\alpha$ determines the type of optimization: when $\alpha>0$ is positive, then the free energy functional $F_\alpha$ is concave in $\tilde{P}$ and the posterior policy $P$ is the \emph{maximizer}; and when $\alpha<0$ is negative, then $F$ is convex in $\tilde{P}$ and $P$ is the \emph{minimizer}. We will further elaborate on the meaning of the negative values later when analyzing sequential decisions.
\begin{figure}
\centering
\includegraphics[width=0.8\textwidth]{figures/free-energy-simplex.pdf}
\caption{The Free Energy Functional. A bounded-rational decision-problem combines a linear and a non-linear cost function, the first being the expected utility and the latter the KL-divergence of the posterior from the prior choice probabilities. The optimal distribution is the point on the linear subspace (defined by the expected utility and the inverse temperature) that minimizes the KL-divergence to the prior. In \emph{information geometry}, this point is known as the \emph{information projection} of the prior onto the linear subspace \citep{Csiszar2004}.}\label{fig:free-energy-simplex}
\end{figure}
\paragraph{Optimal choice.}
The optimal solution to \eqref{eq:fe} is given by the Gibbs distribution
\begin{equation}\label{eq:optimal}
P(x) = \frac{1}{Z_\alpha} Q(x) \exp\{ \alpha U(x) \},
\qquad Z_\alpha = \sum_x Q(x) \exp\{ \alpha U(x) \},
\end{equation}
where the normalizing constant $Z_\alpha$ is the \emph{partition function}. Inspecting \eqref{eq:optimal}, we see that the optimal choice probabilities $P(x)$ is a standard Bayesian posterior\footnote{We will further elaborate on this connection later in the text.} obtained by multiplying the prior $Q(x)$ with a \emph{likelihood} term that grows monotonically with the utility $U(x)$. The inverse temperature controls the balance between the prior $Q(x)$ and the modifier $\exp\{ \alpha U(x) \}$.
\begin{figure}[htb]
\centering
\includegraphics[width=0.8\textwidth]{figures/ce-versus-beta.pdf}
\caption{Certainty-equivalent and optimal choice. a) The certainty-equivalent $\frac{1}{\alpha} \log Z_\alpha$, seen as a function of the inverse temperature $\alpha \in \mathbb{R}$, has a sigmoidal shape that moves between $\min U$ and $\max U$, passing through $\expect[U]$ at $\alpha = 0$. Panel (b) shows three optimal choice distributions for selected values of $\alpha$. Notice that $\alpha_2 = 0$, $P(x) = Q(x)$.}\label{fig:ce-versus-beta}
\end{figure}
\paragraph{Certainty-equivalent.}
To understand the \emph{value} that the agent assigns to a given decision problem, we need to calculate its \emph{certainty-equivalent}. To do so, we insert the optimal choice probabilities~\eqref{eq:optimal} into the free energy functional~\eqref{eq:fe}, obtaining the expression
\begin{equation}\label{eq:certainty-equivalent}
F := F[P]
= \frac{1}{\alpha} \log Z_\alpha
= \frac{1}{\alpha} \log \biggl( \sum_x Q(x) e^{\alpha U(x)} \biggr).
\end{equation}
In the text, we will always use the notation $F[\cdot]$ (with functional brackets) for the free energy and $F$ (without brackets) for the certainty-equivalent. An interesting property of the certainty-equivalent is revealed when we analyze its change with the inverse temperature $\alpha$ (Fig.~\ref{fig:ce-versus-beta}). Obviously, the more the agent is in control, the more effectively it can control the outcome, and thus the higher it values the decision problem. In particular, the value and the choice probabilities take the following limits,
\begin{align*}
\vphantom{\sum_x}
\alpha &\rightarrow +\infty &
\tfrac{1}{\alpha} \log Z_\alpha
&= \max_x U(x)
& P(x) &= \mathcal{U}_{\max}(x)\\
\vphantom{\sum_x}
\alpha &\rightarrow 0 &
\tfrac{1}{\alpha} \log Z_\alpha
&= \sum_x Q(x) U(x)
& P(x) &= Q(x)\\
\vphantom{\sum_x}
\alpha &\rightarrow -\infty &
\tfrac{1}{\alpha} \log Z_\alpha
&= \min_x U(x)
& P(x) &= \mathcal{U}_{\min}(x),
\end{align*}
where $\mathcal{U}_{\max}$ and $\mathcal{U}_{\min}$ are the uniform distribution over the maximizing and minimizing subsets
\begin{align*}
\set{X}_{\max}
&:= \{x \in \set{X}: U(x) = \max_{x'} U(x') \}\\
\set{X}_{\min}
&:= \{x \in \set{X}: U(x) = \min_{x'} U(x') \}
\end{align*}
respectively. Here we see that the inverse temperature $\alpha$ plays the role of a boundedness parameter and that the single expression $\frac{1}{\alpha} \log Z$ is a generalization of the classical concept of \emph{value} in reinforcement learning (see Fig.~\ref{fig:decision-problem}).
\begin{figure}
\centering
\includegraphics[width=\textwidth]{figures/decision-problem.pdf}
\caption{Approximation of the classical decision rules using bounded-rational decision problems. a) We represent a bounded-rational decision problem using a colored square node, where the color encodes the inverse temperature. b--d) Classical decision rules and their bounded-rational approximations.}\label{fig:decision-problem}
\end{figure}
\subsection{Stochastic choice}\label{sec:stochastic-choice}
A perfectly-rational agent must always choose the alternative with the highest expected utility. In general, this operation cannot be done without exhaustive enumeration, which is more often than not intractable. In contrast, we expect a bounded-rational agent to inspect only a \emph{subset of alternatives} until it finds one that is good enough---that is, a \emph{satisficing} choice. Furthermore, the effort put into analyzing the alternatives should scale with the agent's level of rationality. A central feature of information-theoretic bounded rationality is that this ``algorithmic'' property of analyzing just a subset is built right into the theory.
More precisely, this simplification is achieved by noticing that acting optimally amounts to obtaining \emph{just one random sample} from the posterior choice distribution. Any other choice scheme that does not conform to the posterior choice probabilities, such as picking the mode of the distribution for instance, violates the agent's information constraints modeled by the objective function. We review a basic sampling scheme that is readily suggested by the specific shape of the posterior distribution.
\paragraph{Rejection sampling.}
The simplest sampling scheme is immediately suggested by the form of the posterior choice distribution \eqref{eq:optimal}, illustrated in Fig.~\ref{fig:rejection-sampling}. If we interpret $Q$ as prior knowledge that is readily available to the agent in the form of random samples, then it can filter them to generate samples from $P$ using rejection sampling. This works as follows: the agent first draws a sample $x$ from $Q$ and then accepts it with probability
\begin{equation}\label{eq:rejection}
A(x|U^\ast) = \min\bigl\{ 1, e^{ \alpha [U(x) - U^\ast] } \bigr\},
\end{equation}
where $U^\ast \in \field{R}$ is a target value set by the agent. This is repeated until a sample is accepted. Notice that this sampling scheme does not require the agent to draw the samples sequentially: indeed, rejection sampling can be \emph{parallelized} by drawing many samples and returning \emph{any} of the accepted choices. The next theorem guarantees that rejection sampling does indeed generate a sample from $P$.
\begin{figure}[ht]
\begin{center}
\includegraphics[width=\textwidth]{figures/rejection-sampling.pdf}
\end{center}
\caption{Choosing optimally amounts to sampling from the posterior choice distribution $P(x) \propto Q(x) \exp\{\alpha U(x)\}$ using rejection sampling. a) A utility function $U(x)$ and a target utility $U^\ast$. b)~The choice is phrased as a search process where the agent attempts to land a sample into the target set (dark area). Generating \emph{any choice} corresponds to obtaining a successful Bernoulli random variate $Z \sim \mathcal{B}(p_\alpha)$, where the probability of success is equal to $p_\alpha = Z_\alpha / \exp\{\alpha U^\ast\}$.}
\label{fig:rejection-sampling}
\end{figure}
\begin{theorem}\label{theo:rejection}
Rejection sampling with acceptance probability~\eqref{eq:rejection} produces the correct distribution as long as $U^\ast \geq \max_x\{ U(x) \}$ when $\alpha \geq 0$ and $U^\ast \leq \min_x\{ U(x) \}$ when $\alpha \leq 0$.
\end{theorem}
\begin{proof}
First, we need a constant $c$ such that for all $x$, $P(x) \leq c \cdot Q(x)$. The smallest constant is given by
\[
\frac{ P(x) }{ Q(x) }
= \frac{ e^{ \alpha U(x) } }{ \sum_{x'} Q(x') e^{ \alpha U(x') } }
\leq \frac{ e^{ \alpha U^\ast } }{ \sum_{x'} Q(x') e^{ \alpha U(x') } }
= c.
\]
These inequalities hold whenever $U^\ast$ is chosen as $U^\ast = \max_x U(x)$ if $\alpha \geq 0$ and $U^\ast = \min_x U(x)$ if $\alpha \leq 0$. Hence, given a sample $x$ from $Q$, the acceptance probability is
\[
\frac{ P(x) }{ c \cdot Q(x) }
= \frac{ \frac{1}{Z} Q(x) e^{\alpha U(x)} }
{ \frac{1}{Z} Q(x) e^{\alpha U^\ast} }
= \frac{ e^{\alpha U(x)} }{ e^{\alpha U^\ast} }.
\]
\end{proof}
\paragraph{Efficiency.}
Notice that rejection sampling is equal to the search process defined in \ref{sec:commensurable}, where the probability of the target set is equal to
\begin{equation}
p_\alpha = \sum_x Q(x) e^{\alpha[U(x) - U^\ast]}
= \frac{ Z_\alpha }{ e^{\alpha U^\ast} }.
\end{equation}
In other words, obtaining \emph{any} sample is equivalent to obtaining a successful Bernoulli random variate $\mathcal{B}(p_\alpha)$. Thus, the number of samples until acceptance $N_\alpha$ follows a geometric distribution $\mathcal{G}(p_\alpha)$, and the expected value is $\expect[N_\alpha] = 1/p_\alpha$. Furthermore, the number of samples $N_\alpha(\delta)$ needed so as to guarantee acceptance with a small failure probability $\delta > 0$ is given by
\begin{equation}\label{eq:required-samples}
N_\alpha(\delta) = \biggl\lceil \frac{ \log \delta }{ \log (1-p_\alpha) } \biggr\rceil.
\end{equation}
This function is plotted in Fig.~\ref{fig:number-samples}a.
\paragraph{Limit efficiency.} What is the most efficient sampler? Assume w.l.g.\ that the inverse temperature $\alpha$ is fixed and strictly positive. From the definition of utilities \eqref{eq:convention-prob} and the probability-complexity equivalence \eqref{eq:cost} we get
\[
U(x) = -\cost(x \cap P|x \cap Q) + C = \frac{1}{\alpha} \log \prob(x \cap P|x \cap Q) + C.
\]
Inspecting Fig.~\ref{fig:rejection-sampling}b, we see that in rejection sampling the probability of finding any posterior choice is such that $\prob(x \cap P|x \cap Q) = \exp\{ U(x) - U^\ast \}$. Using this substitution implies
\begin{equation}\label{eq:offset-target}
U(x) = U(x) - U^\ast + C \qquad \Longrightarrow \qquad U^\ast = C,
\end{equation}
that is, the target utility $U^\ast$ is exactly equal to the offset $C$ that transforms complexities into utilities. Thus, choosing an inverse temperature $\alpha$ and a target utility $U^\ast$ indirectly determine the decision complexities and thereby also the probability of accepting a sample~$p_\alpha$. Since decision complexities are positive and their absolute differences fixed through the utilities, the optimal choice of the target utility must be
\begin{equation}\label{eq:most-efficient}
U^\ast = \max_x \{ U(x)\}.
\end{equation}
Picking a smaller value for $U^\ast$ is not permitted, as it would violate the assumptions about the underlying search model (Sec.~\ref{sec:commensurable}).
\begin{figure}[ht]
\begin{center}
\includegraphics[width=0.9\textwidth]{figures/number-of-samples-for-acceptance.pdf}
\end{center}
\caption{a) Number of samples until acceptance. b) Granularity. Increasing the resolution of the choice set from $\mathcal{X}$ to $(\mathcal{X}\times\mathcal{Y})$ does not change the success probability.}
\label{fig:number-samples}
\end{figure}
\paragraph{Granularity.} Typically, one would expect that the number of samples to be inspected before making a decision depends on the number of available options. However, in the bounded-rational case, this is not so. Indeed, we can augment the granularity of the choice set without affecting the agent's decision effort. This is seen as follows. Assume that we extend the choice set from $\mathcal{X}$ to $(\mathcal{X} \times \mathcal{Y})$, with the understanding that every pair $(x,y) \in (\mathcal{X} \times \mathcal{Y})$ is a sub-choice of $x \in \mathcal{X}$. Then, the utilities $U(x)$ correspond to the certainty-equivalents of the utilities $U(x,y)$, that is
\begin{equation}\label{eq:granularity}
U(x)
= \frac{1}{\alpha} \log Z_\alpha(x)
= \frac{1}{\alpha} \log \biggl( \sum_{y \in x} Q(y|x) e^{\alpha U(x,y)} \biggr).
\end{equation}
Inserting this into the partition function for $x$, we get
\[
Z_\alpha
= \sum_x Q(x) e^{\alpha U(x)}
= \sum_{x,y} Q(x,y) e^{\alpha U(x,y)},
\]
that is, the partition function $Z_\alpha$ is independent of the level of resolution of the choice set. This, in turn, guarantees that the success probability of rejection sampling $p_\alpha = Z_\alpha / \exp\{ \alpha U^\ast \}$ stays the same no matter how we partition the choice set.
\subsection{Equivalence}\label{sec:equivalence}
There is more than one way to represent a given choice pattern. Two different decision problems can lead to identical transformations of prior choice probabilities~$Q$ into posterior choice probabilities~$P$, and have the same certainty-equivalent. When these two conditions are fulfilled, we say that these decision problems are \emph{equivalent}. The concept of equivalence is important because a given decision problem can be re-expressed in a more convenient form when necessary. This will prove to be \emph{essential} when analyzing sequential decision problems later in the text.
\paragraph{Formal relation.}
Consider two equivalent bounded-rational decision problems $(\alpha, \set{X}, Q, U)$ and $(\beta, \set{X}, Q, V)$ with non-zero inverse temperatures $\alpha, \beta \neq 0$. Then, their certainty-equivalents are equal, that is,
\begin{equation}\label{eq:equivalent-ce}
\frac{1}{\alpha} \log Z_\alpha = \frac{1}{\beta} \log Z_\beta,
\end{equation}
where the partition functions are $Z_\alpha = \sum_x Q(x) \exp\{\alpha U(x)\}$ and $Z_\beta = \sum_x Q(x) \exp\{ \beta V(x) \}$ respectively. The optimal choice probabilities of the second decision problem are equal to
\[
P(x)
= \frac{1}{Z_\beta} \exp\bigl\{ \beta V(x) \bigr\}
= \exp\bigl\{ \beta [V(x) - \tfrac{1}{\beta} \log Z_\beta] \bigr\}
= \exp\bigl\{ \beta [V(x) - \tfrac{1}{\alpha} \log Z_\alpha] \bigr\},
\]
where the last equality substitutes one certainty-equivalent for the other. Since these probabilities are equal to the ones of the first decision problem, we have
\[
\exp\bigl\{ \beta[V(x) - \tfrac{1}{\alpha} \log Z_\alpha] \bigr\}
= \exp\bigl\{ \alpha[U(x) - \tfrac{1}{\alpha} \log Z_\alpha] \}.
\]
Then, taking the logarithm and rearranging gives
\begin{equation}\label{eq:transf-ce}
V(x) = \frac{\alpha}{\beta} U(x) + \left( \frac{1}{\alpha} - \frac{1}{\beta} \right) \log Z_\alpha.
\end{equation}
Thus, \eqref{eq:transf-ce} is an explicit formula for the relation between the inverse temperatures $\alpha, \beta$ and utilities $U(x), V(x)$ of two equivalent bounded-rational decision problems. Essentially, equivalent decision problems have utilities that are scaled versions of each other around the axis defined by the certainty-equivalent (see Fig.~\ref{fig:equivalent}). From the figure, we see that increasing the inverse temperature by a factor $c$ requires decreasing the distance of the utilities to the certainty-equivalent by a factor $1/c$, so that the product is maintained at all times.
\begin{figure}[ht]
\begin{center}
\includegraphics[width=12cm]{figures/equivalent.pdf}
\end{center}
\caption{Equivalent bounded-rational decision problems. The plot shows the utility curves for three equivalent decision problems with inverse temperatures $\alpha = 1, \frac{1}{2}$ and $-1$ respectively. The resulting utilities are scaled versions of each other with respect to the symmetry axis given by the certainty-equivalent $\frac{1}{\alpha}\log Z_\alpha$.}
\label{fig:equivalent}
\end{figure}
\paragraph{Sampling from equivalent decision problems.}
In rejection sampling, the success probabilities $p_\alpha$ and $p_\beta$ of two equivalent decision problems $(\alpha, \mathcal{X}, Q, U)$ and $(\beta, \mathcal{X}, Q, V)$ respectively are the same, that is,
\begin{equation}\label{eq:success-eq}
p_\alpha = \frac{ Z_\alpha }{ e^{\alpha U^\ast} } = \frac{ Z_\beta }{ e^{\beta V^\ast} } = p_\beta,
\end{equation}
as long as their target utilities $U^\ast$ and $V^\ast$ obey the relation~\eqref{eq:transf-ce}, i.e.\
\begin{equation}\label{eq:conv-target}
V^\ast = \frac{\alpha}{\beta} U^\ast
+ \biggl( \frac{1}{\alpha} - \frac{1}{\beta} \biggr) \log Z_\alpha.
\end{equation}
An important problem is to sample directly from a decision problem $(\beta, \mathcal{X}, Q, V)$ given the inverse temperature $\alpha$ and the target utility $U^\ast$ of an equivalent decision problem. A naive way of doing so consists in using \eqref{eq:conv-target} and $\frac{1}{\alpha}\log Z_\alpha = \frac{1}{\beta} \log Z_\beta$ to derive an explicit formula for $V^\ast$:
\[
V^\ast = \frac{\alpha}{\beta} U^\ast
+ \biggl( 1 - \frac{\alpha}{\beta} \biggr) \frac{1}{\beta}\log Z_\beta.
\]
This formula requires integrating over the choice set to obtain the partition function~$Z_\beta$. However, this is a costly operation that does not scale to very large choice spaces: recall that all we are allowed to do is inspecting the utilities $V(x)$ for a few samples obtained from $Q(x)$. Instead, we can relate the success probability $p_\alpha$ to the samples obtained from $(\beta, \mathcal{X}, Q, V)$. This is seen by rewriting $p_\alpha$ as follows:
\[
p_\alpha
= \exp\biggl\{ \alpha \Bigl[ \frac{1}{\alpha} \log Z_\alpha - U^\ast \Bigr] \biggr\}
= \exp\biggl\{ \alpha \Bigl[ \frac{1}{\beta} \log Z_\beta - U^\ast \Bigr] \biggr\}.
\]
Then we express the inverse temperature as $\alpha = (\frac{\alpha}{\beta}) \cdot \beta$ and simplify the previous expression to
\begin{equation}\label{eq:sampling-equivalent}
p_\alpha = p^\frac{\alpha}{\beta},
\qquad \text{where} \qquad
p := \biggl( \frac{Z_\beta}{e^{\beta U^\ast}} \biggr).
\end{equation}
This result has a convenient operational interpretation. The original problem, which consisted in obtaining one successful Bernoulli sample with success probability $p_\alpha$ has been rephrased as the problem of \emph{obtaining $\frac{\alpha}{\beta}$ successful Bernoulli samples} with probability of success~$p$. Intuitively, the reason behind this change is that the new success probability~$p$ can be larger/smaller than the original success probability $p_\alpha$, resulting in a more/less challenging search problem: therefore, \eqref{eq:sampling-equivalent} equalizes the search complexity by demanding less/more successful samples. Note that this conversion only works if the resulting rejection sampling problem fulfills the conditions of Theorem~\ref{theo:rejection}, that is: $U^\ast \geq \max_x \{V(x)\}$ for strictly positive $\beta$, or $U^\ast \leq V(x)$ for strictly negative $\beta$. To use~\eqref{eq:sampling-equivalent} effectively, we need to identify algorithms to sample an arbitrary, possibly non-integer amount of $\xi \in \mathbb{R}$ consecutive Bernoulli successes based only on a sampler for $\mathcal{B}(p)$, which in turn depends on the choice sampler $Q$. We first consider three base cases and then explain the general case.
\paragraph{Case $\xi \in \mathbb{N}$.} If $\xi$ is a natural number, then the Bernoulli random variate $Z \sim \mathcal{B}(p^\xi)$ is obtained in the obvious way by attempting to generate $\xi$ consecutive Bernoulli $\mathcal{B}(p)$ successes. If \emph{all} of them succeed, then $B$ is a success; otherwise $Z$ is a failure (see Algorithm~\ref{alg:sampling-natural}).
\begin{algoframed}
\caption{Rejection-sampling trial for $\xi \in \mathbb{N}$}\label{alg:sampling-natural}
\SetKwInOut{Input}{input}\SetKwInOut{Output}{output}
\Input{A target $U^\ast$, a number $\xi \in \mathbb{N}$, and a choice sampler $Q$}
\Output{A sample $x$ or failure $\epsilon$}
\DontPrintSemicolon
\For{$n=1,\ldots,\xi$}{
Draw $x \drawnfrom Q(x)$ and $u \drawnfrom \mathcal{U}(0,1)$\;
\lIf{$u > \exp\{ \beta [V(x) - U^\ast] \}$}{\Return $\epsilon$}
}
\Return $x$
\end{algoframed}
\paragraph{Case $\xi \in (0,1)$.} If $\xi$ is in the unit interval, then the Bernoulli success for $\mathcal{B}(p^\xi)$ is easier to generate than for $\mathcal{B}(p)$. Thus, we can tolerate a certain number of failures from $\mathcal{B}(p)$. The precise number is based the following theorem.
\begin{theorem}\label{theo:bernoulli}
Let $Z$ be a Bernoulli random variate with bias $(1-f_N)$ where
\[
f_N = \sum_{n=1}^N b_n, \qquad\text{and}\qquad
b_n = (-1)^{n+1} \frac{ \xi (\xi-1) (\xi-2) \cdots (\xi-n+1) }{ n! }
\]
for $0 < \xi < 1$ and where $N$ is a Geometric random variate with probability
of success $p$. Then, $Z$ is a Bernoulli random variate with bias $p^\xi$.
\end{theorem}
An efficient use of this sampling scheme is as follows. First, we generate an upper bound $f^\ast \sim \mathcal{U}(0,1)$ that will fix the maximum number of tolerated failures and initialize the ``trial counter'' to $f = 0$. Then, we repeatedly attempt to generate a successful Bernoulli sample $Z \sim \mathcal{B}(p)$ as long as $f < f^\ast$. If it succeeds, we return the sample; otherwise, we add a small penalty to the counter $f$ and repeat---see Algorithm~\ref{alg:sampling-unit-int}.
\begin{algoframed}
\caption{Rejection-sampling trial for $\xi \in (0,1)$}\label{alg:sampling-unit-int}
\SetKwInOut{Input}{input}\SetKwInOut{Output}{output}
\Input{A target $U^\ast$, a number $\xi \in (0,1)$, and a choice sampler $Q$}
\Output{A sample $x$ or failure $\epsilon$}
\DontPrintSemicolon
$f^\ast \drawnfrom \mathcal{U}(0,1)$\;
Set $b \leftarrow -1$, $f \leftarrow 0$, and $k \leftarrow 1$\;
Draw $x \drawnfrom Q(x)$ and $u \drawnfrom \mathcal{U}(0,1)$\;
\While{$u > \exp\{\beta[V(x)-U^\ast]\}$}{
Set $b \leftarrow -b \cdot \frac{(\xi-k+1)}{k}$, $f \leftarrow f + b$,
and $k \leftarrow k + 1$\;
Draw $x \drawnfrom Q(x)$ and $u \drawnfrom \mathcal{U}(0,1)$\;
\lIf{$f^\ast \leq f$}{\Return $\epsilon$}}
\Return $x$\;
\end{algoframed}
\paragraph{Case $\xi = -1$.} If $\xi$ is $-1$, then the interpretation of the target utility $U^\ast$ is flipped: an upper-bound becomes a lower-bound and \textit{vice versa}. The resulting success probability is then equal to
\[
p_\alpha = \frac{e^{\beta U^\ast}}{ Z_\beta }.
\]
We do not know how to efficiently generate a sample from the \emph{inverse} partition function. Instead, we use the following trick: we invert our acceptance criterion by basing our comparison on \emph{reciprocal probabilities} as shown in Algorithm~\ref{alg:sampling-inverse}.
\begin{algoframed}
\caption{Rejection-sampling trial for $\xi = -1$}\label{alg:sampling-inverse}
\SetKwInOut{Input}{input}\SetKwInOut{Output}{output}
\Input{A target $U^\ast$ and a choice sampler $Q$}
\Output{A sample $x$ or failure $\epsilon$}
\DontPrintSemicolon
Draw $x \drawnfrom Q(x)$ and $u \drawnfrom \mathcal{U}(0,1)$\;
\lIf{$1/u < \exp\{ \beta [V(x) - U^\ast] \}$}{\Return $\epsilon$}
\Return $x$
\end{algoframed}
\paragraph{General case.} The rejection sampling algorithm for an arbitrary value of $\xi \in \mathbb{R}$ is constructed from the preceding three cases. First, the sign of $\xi$ determines whether we will base our acceptance criterion on either probabilities or reciprocal probabilities. Then, we decompose the absolute value $|\xi|$ into its integer and unit-interval parts, applying the associated algorithms to generate a choice.
\comment{
\paragraph{Efficiency.}
\begin{mdframed}
Explain that the number of samples in an equivalence transformation varies, but the number of bits to be generated is the same!
\end{mdframed}
} %
\subsection{Comparison}
We finish this section with a brief comparison of decision-making based upon expected utility versus free energy. Table~\ref{tab:comparison} tabulates the differences according to several criteria explained in the following. The \emph{rationality paradigm} refers to general decision-making rationale of the agent. We have seen that perfect rationality and bounded rationality can be regarded as choice models that are valid approximations to different scales or \emph{domain sizes}. The different scales, in turn, suggest different \emph{search strategies} and \emph{search scopes}: the perfect rational agent can use a fixed, deterministic rule that exploits the symmetries in the choice set in order to single out the optimal choice; while the bounded-rational agent has to settle on a satisficing choice found through random inspection---as if it were a search in a pile of straw. The two objective functions also differ in their dependency on the choice probabilities. The \emph{functional form} is such that this dependency is linear in the expected utility case and non-linear in the free energy case. Because of this, the perfectly rational agent's preferences depend only upon the expected value of the utility; whereas a bounded-rational agent also takes into account the higher-order moments of the utility's distribution (\emph{utility sensitivity}), which is easily seen through a Taylor expansion of the KL-divergence term of the free energy.
\begin{table}[ht]
\centering
\caption{Comparison of Decision Rules.}\label{tab:comparison}
\begin{tabular}{lcc}
\toprule
Objective function & Expected Utility & Free Energy \\
\midrule
Rationality paradigm & perfect & bounded \\
Preferred domain size & small & large \\
Search strategy & deterministic & randomized \\
Search scope & complete & incomplete \\
Functional form & linear & non-linear \\
Utility sensitivity & first moment & all moments \\
\bottomrule
\end{tabular}
\end{table}
\section{Sequential Decisions}\label{sec:sequential-decisions}
In the previous section we have fleshed out the basic theory for \emph{single-step} bounded-rational decision making. In real-world applications however, agents have to plan ahead over \emph{multiple} time steps and interact with another system called the \emph{environment}. In these \emph{sequential decision problems}, agents have to devise a \emph{policy}---that is, a decision plan---that prescribes how to act under any situation that the agent might encounter in the future.
\begin{figure}[ht]
\centering
\includegraphics[width=\textwidth]{figures/gametrees.pdf}
\caption{Decision trees}\label{fig:gametrees}
\end{figure}
Like in single-step decision problems, policies are chosen using a decision rule. The classical decision rules that are used in the literature depend upon the type of system the agent is interacting with. Three such decision rules that are popular are: \textsc{Expectimax}, when the agent is interacting with a stochastic environment; \textsc{Minimax}, where the agent is playing against an adversary; and \textsc{Expectiminimax} in games with both an adversary and chance elements such as in Backgammon. The dynamical structure of the interactions between the agent and the environment is captured in a \emph{decision tree} (or a \emph{game tree}) like those illustrated in Figure~\ref{fig:gametrees}. These decision trees were built from composing the primitives $\bigtriangledown$, $\bigcirc$, and $\bigtriangleup$ (discussed in Section~\ref{sec:seu}) representing an adversarial, stochastic, and friendly transition respectively. The optimal solution is then obtained using dynamic programming\footnote{Also known as ``solving the \emph{Bellman optimality equations}'' in the control and reinforcement learning literature, and \emph{backtracking} in the economics literature.} by recursively calculating the certainty-equivalent, and then taking the transition promising the highest value. Notice that, for planning purposes, it is immaterial whether the transitions are eventually taken by the agent or by the environment: all what matters is the degree to which a particular transition contributes towards the agent's overall objective. Thus, a max-node $\bigtriangleup$ can stand both for the agent's action or another player's cooperative move for instance.
\begin{figure}[ht]
\centering
\includegraphics[width=0.9\textwidth]{figures/gm-approx.pdf}
\caption{A bounded-rational approximation. Classical decision trees, such as the \textsc{Expectiminimax} decision tree, can be approximated with a bounded-rational decision tree (b) by substituting the classical nodes with bounded-rational counterparts. Recall that the nodes are color-coded, with darker nodes corresponding to higher inverse temperatures.}\label{fig:gm-approx}
\end{figure}
These classical decision trees can be approximated by bounded-rational decision trees. Recall from Section~\ref{sec:seu} that the classical certainty-equivalent operators $\bigtriangledown$, $\bigcirc$, and $\bigtriangleup$ can be approximated by bounded-rational decision problems with appropriately chosen inverse temperatures. The very same idea can be used to substitute the nodes in a classical decision tree (see \textit{e.g.} Figure~\ref{fig:gm-approx}).
\begin{figure}[ht]
\centering
\includegraphics[width=\textwidth]{figures/map-of-rules.pdf}
\caption{Map of bounded-rational decision rules. Panels (a--d) depict several two-step decision problems, where the agent and environment interact with inverse temperatures $\alpha$ and $\beta$ respectively: a) case $\alpha \gg 0, \beta \approx 0$ approximates expected utility; b) case $\alpha \gg 0, \beta \ll 0$ is an approximation of a minimax/robust decision; c) case $\alpha > 0, \beta \approx 0$ is a bounded-rational control of a stochastic environment; and d) $\alpha > 0, \beta > 0$ corresponds to risk-seeking bounded-rational control. Panel~(e) shows a map of the decision rules.}\label{fig:map-of-rules}
\end{figure}
This approximation immediately suggests a much broader class of bounded-rational sequential decision problems that is interesting in its own right. The decision trees in this class are such that each node can have its own inverse temperature to model a variety of information constraints that result from \emph{resource} limitations, \emph{risk}, and \emph{trust} sensitivity. Figure~\ref{fig:map-of-rules} illustrates some example decision types. Our next goal is to formalize these bounded-rational decision trees, explain how they follow from the single-step case, and present a sampling algorithm to solve them.
\subsection{Bounded-rational decision trees}
\paragraph{Definition.}
A \emph{bounded-rational decision tree} is a tuple $(T, \set{X}, \alpha, Q, R, F)$ with the following components. $T \in \field{N}$ is the \emph{horizon}, \textit{i.e.}\ the depth of the tree. $\mathcal{X}$ is the \emph{set of interactions} or \emph{transitions} of the tree. We assume that it is finite, but potentially \emph{very} large. Together with the horizon, it gives rise to an associated \emph{set of states} (or nodes) of the tree $S$, defined as
\[
S := \bigcup_{t=0}^T \mathcal{X}^t.
\]
Each member $s \in S$ is a path of length $t \leq T$ that uniquely identifies a node in the tree. Excepting the (empty) root node $\epsilon \in S$, every other member $s' \in S$ can be reached from a preceding node $s \in S$ as long as $sx = s'$ for a transition $x \in \mathcal{X}$. The function $\alpha: S \rightarrow \mathbb{R}$ is the \emph{inverse temperature function}, and it assigns an inverse temperature $\alpha(s)$ to each node $s \in S$ in the tree. We will assume that $\alpha(s) \neq 0$ for all $s \in S$. The conditional probability distribution $Q(\cdot|\cdot)$ defines the \emph{prior transition probabilities}: thus, $Q(x|s)$ corresponds to the probability of moving to node $s'=sx \in S$ from $s \in S$ via the transition $x \in \mathcal{X}$. Obviously, $\sum_x Q(x|s) = 1$ for each node $s \in S$. Every transition has, in turn, an associated \emph{conditional reward}~$R(x|s) \in \mathbb{R}$. We assume that these rewards are additive, so that $R(uv|w) = R(u|w) + R(u|v,w)$ for any disjoint sets $u, v, w$. Finally, $F: S \rightarrow \mathbb{R}$ is the \emph{terminal certainty-equivalent function} which attaches a value $F(s)$ to each terminal state $s \in \mathcal{X}^T$. Fig.~\ref{fig:br-decision-tree} shows an example.
\begin{figure}[ht]
\centering
\includegraphics[width=\textwidth]{figures/br-decision-tree.pdf}
\caption{Bounded-rational decision trees. Panel (a) shows a simple bounded-rational decision tree with two steps and $\mathcal{X} = \{1, 2\}$. These can be used to model complicated situations such as the \textit{Ellsberg Paradox} discussed in Section~\ref{sec:open-problems} shown in panel~(b). This tree models the following three random variables: $\theta$, the proportion of black \& white balls in the box (only two of its 101 children nodes are shown); $D$, the agent's bet on the left or right urn; and $C$, corresponding to the color of the ball drawn from the chosen box. We do not annotate the transitions with rewards, as we assume that they are all equal to zero. Notice that the initial choice of $\theta$ is made adversarially ($\alpha < 0$) in spite of the uniform prior over the 101 possible combinations. Because of this, the agent biases his bet towards the left box, irrespective of whether black ($x=1$) or white ($x=0$) wins.}\label{fig:br-decision-tree}
\end{figure}
\paragraph{Sequence of interactions.}
The bounded-rational decision tree models a (prior) probability distribution over random sequences $X_1, \ldots, X_T$ of length $T$. It suggests a chronological generative model: at time~$t$, \textit{i.e.}\ after having observed the $t-1$ previous interactions $X_{<t} = x_{<t}$, it draws the next interaction $X_t$ from the conditional $Q(X_t|X_{<t})$. The agent has the ability to influence the course of realization of the interaction sequence by changing the prior $Q$ into a posterior $P$. However, the extent to which it can do so depends on the state's inverse temperature.
\paragraph{Free energy.}
As in the single-step scenario, the objective function optimized by the agent is the free energy functional. For bounded-rational decision trees, the free energy functional $F[\tilde{P}]$ is given by
\begin{equation}\label{eq:fe-dt}
F[\tilde{P}] =
\sum_{x_{\leq T}} \tilde{P}(x_{\leq T})
\biggl\{ \sum_{t=1}^T \biggl[
R(x_t|x_{<t})
- \frac{1}{\alpha(x_{<t})} \log \frac{\tilde{P}(x_t|x_{<t})}{Q(x_t|x_{<t})}
\biggr]
+ F(x_{\leq T}) \biggr\}.
\end{equation}
Inspection of \eqref{eq:fe-dt} reveals that it is an expectation taken w.r.t.\ the realizations of the tree, where each node $s \in S$ contributes a free energy term of the form
\[
\sum_{x} P(x|s) R(x|s) - \frac{1}{\alpha(s)} \sum_x P(x|s) \log\frac{ \tilde{P}(x|s) }{ Q(x|s) }
\]
that is specific to the transition. In addition, each leaf supplies an extra term $F(s)$, which can be thought of as the certainty-equivalent of the future after time step $T$ that is not explicitly represented in the decision-tree.
\subsection{Derivation of the free energy functional}
The free energy functional for decision trees is not arbitrary: it is \emph{derived} from the free energy functional for the single-step case \textit{via} equivalence transformations. The derivation is conceptually straightforward (see Fig.~\ref{fig:ms-cons}), although notationally cumbersome.
\paragraph{Construction.}
Our goal is to transform a bounded-rational decision problem represented by the tuple $(\beta, \mathcal{X}^T, Q, V)$ into a bounded-rational decision tree $(T, \mathcal{X}, \alpha, Q, R, F)$, where the inverse temperature function $\alpha$ is prescribed and the rewards $R$ and $F$ are to be determined, and where the other members $T$, $\mathcal{X}$ and $Q$ stay fixed. The free energy functional of the single-step decision problem is
\begin{equation}\label{eq:fe-nested-1}
F[\tilde{P}] =
\sum_{x_{\leq T}} \tilde{P}(x_{\leq T}) V(x_{\leq T})
- \frac{1}{\beta} \sum_{x_{\leq T}} \tilde{P}(x_{\leq T}) \log\frac{ \tilde{P}(x_{\leq T}) }{ Q(x_{\leq T}) }.
\end{equation}
This free energy with the inverse temperature $\beta$ and utility function $V$ can be restated as an equivalent bounded-rational decision problem with inverse temperature $\alpha(\epsilon)$ and utility function $U_\epsilon$, where $\alpha(\epsilon)$ is the prescribed value for the root node of the desired decision tree. The subindex in $U_\epsilon$ is just to remind us that the utility function is paired to inverse temperature $\alpha(\epsilon)$ of the root node. This yields
\begin{equation}\label{eq:fe-nested-2}
F[\tilde{P}] =
\sum_{x_{\leq T}} \tilde{P}(x_{\leq T}) U_\epsilon(x_{\leq T})
- \frac{1}{\alpha(\epsilon)} \sum_{x_{\leq T}} \tilde{P}(x_{\leq T}) \log\frac{ \tilde{P}(x_{\leq T}) }{ Q(x_{\leq T}) }.
\end{equation}
Recall that this does not change the resulting optimal choice, as equivalent decision problems share the prior, the posterior, and the certainty-equivalent. In Fig.~\ref{fig:ms-cons}, this corresponds to the transformation from (a) to (b).
In order to introduce step-wise reinforcements of decision trees, we assume that the utilities can be recursively broken down into a sum of an instantaneous reward plus the utility of the remaining tail. For the first step, this is
\begin{equation}\label{eq:utility-additive}
U_\epsilon(x_{\leq T}) = R(x_1) + U_\epsilon(x_{2:T}|x_1),
\end{equation}
where $R(x_1)$ is the reward of the first step and $U_\epsilon(x_{2:T}|x_1)$ is the utility of the tail $x_{2:T}$ rooted at $x_1$. How much reward we place in $R(x_1)$ is arbitrary, as long as all the paths starting with $x_1$ put the same amount of reward into this transition. Substituting this back into \eqref{eq:fe-nested-1} and rearranging yields
\begin{align}
\nonumber
F[\tilde{P}]
&= \sum_{x_{\leq T}} \tilde{P}(x_{\leq T}) \biggl\{ R(x_1) + U_\epsilon(x_{2:T}|x_1) \biggr\}
- \frac{1}{\alpha(\epsilon)} \sum_{x_{\leq T}} \tilde{P}(x_{\leq T}) \log\frac{ \tilde{P}(x_{\leq T}) }{ Q(x_{\leq T}) } \\
\label{eq:fe-nested-3}
&= \sum_{x_1} \tilde{P}(x_1)
\biggl\{ R(x_1) - \frac{1}{\alpha(\epsilon)}\log\frac{ \tilde{P}(x_1) }{ Q(x_1) } + F[\tilde{P}](x_1) \biggr\},
\end{align}
where we have defined the free energies $F[\tilde{P}](x_1)$ as
\begin{equation}\label{eq:fe-nested-4}
F[\tilde{P}](x_1) = \sum_{x_{2:T}} \tilde{P}(x_{2:T}) U_\epsilon(x_{2:T}|x_1)
- \frac{1}{\alpha(\epsilon)} \sum_{x_{2:T}} \tilde{P}(x_{2:T}|x_1)
\log\frac{ \tilde{P}(x_{2:T}|x_1) }{ Q(x_{2:T}|x_1) }.
\end{equation}
Note that through this operation, we have split the original single-step decision problem over choices $x_{\leq T} \in \mathcal{X}^T$ into a two-step decision problem in which the first step is a choice among the $x_1 \in \mathcal{X}$ and the second among the tails $x_{2:T} \in \mathcal{X}^{T-1}$. That is, each initial choice~$x_1$ leads to separate single-step decision problem of the form $(\alpha(\epsilon), \mathcal{X}^{T-1}, Q(\cdot|x_1), U_\epsilon)$.
\begin{figure}[t]
\centering
\includegraphics[width=\textwidth]{figures/ms-cons.pdf}
\caption{Construction of a bounded-rational decision tree. Panel a: Starting from a (single-step) bounded-rational decision problem over a product space $\mathcal{X}^T$, we apply an equivalence transformation to set a new inverse temperature, split each choice into a transition (head) and a tail sequence, and then recur on the tails until the desired bounded-rational decision tree is fully built (Panels~b--d).}\label{fig:ms-cons}
\end{figure}
We now continue this process for $t=2,3,\ldots,T-1$, recurring in a breadth-first fashion on the nested free energies $F[\tilde{P}](x_1)$, $F[\tilde{P}](x_{\leq 2})$, \ldots, $F[\tilde{P}](x_{\leq T-2})$. Every time we do so, we first substitute the decision problem with an equivalent one having inverse temperature $\alpha(x_{\leq t})$, utility function $U_{x_{\leq t}}$, and then split the utilities into a reward $R(x_t|x_{<t})$ and a tail utility $U_{x_{\leq t}}(x_{t+1:T}|x_{\leq t})$. This results in the following expression of nested free energies:
\begin{align}
\nonumber
F[\tilde{P}]
= & \sum_{x_1} \tilde{P}(x_1)
\biggl\{ R(x_1) - \frac{1}{\alpha(\epsilon)}\log\frac{ \tilde{P}(x_1) }{ Q(x_1) } \\
\nonumber
& + \sum_{x_2} \tilde{P}(x_2|x_1)
\biggl\{ R(x_2|x_1) - \frac{1}{\alpha(x_1)}\log\frac{ \tilde{P}(x_2|x_1) }{ Q(x_2|x_1) } \\
\nonumber
& \phantom{+} \vdots \\
\label{eq:fe-nested-5}
& \phantom{+} + \sum_{x_{T-1}} \tilde{P}(x_{T-1}|x_{<T-1})
\biggl\{ F[\tilde{P}](x_{<T}) \biggr\} \cdots \biggr\}\biggr\}.
\end{align}
Finally, for the base case of the recursion given by the collection of the innermost free energies $F[\tilde{P}](x_{<T})$, which are equal to
\[
F[\tilde{P}](x_{<T}) = \sum_{x_T} P(x_T|x_{<T}) U_{x_{<T}}(x_T|x_{<T})
- \frac{1}{\alpha(x_{<T})} \sum_{x_T} P(x_T|x_{<T}) \log \frac{ \tilde{P}(x_T|x_{<T}) }{ Q(x_T|x_{<T}) },
\]
we split the utilities arbitrarily into a reward $R(x_T|x_{<T})$ and a terminal free energy $F(x_{\leq T})$, that is,
\[
U_{x_{<T}}(x_T|x_{<T}) = R(x_T|x_{<T}) + F(x_{\leq T}).
\]
Inserting this back into \eqref{eq:fe-nested-5} and rearranging the probabilities gives the desired free energy functional for the bounded rational decision tree \eqref{eq:fe-dt}.
\paragraph{Insights from the construction.}
This derivation shows that the multi-step case does not require introducing any additional theory---everything can be reduced to the building blocks already developed in Section~\ref{sec:single-step} for the single-step case.
It is worthwhile pointing out that the sequence of steps we took in order to derive the decision tree's free energy functional from the single-step decision problem is completely reversible. It is easy to see how to extend this procedure to formulate an algorithm that takes any source decision-tree and transforms it into another equivalent decision tree with a prescribed inverse temperature function. In other words, every bounded-rational decision tree $(T, \set{X}, \alpha, Q, R, F)$ can be transformed into another one $(T, \set{X}, \alpha', Q, R', F')$ with an arbitrarily chosen inverse temperature function $\alpha'$ as long as both $\alpha$ and $\alpha'$ are non-zero. In this case, we say that these decision trees are equivalent.
This equivalence relation induces a quotient space (\textit{i.e.} a set of equivalence classes) on the set of bounded-rational decision trees that has rather counterintuitive properties. For instance, it turns out that a bounded-rational \textsc{Minimax} decision-problem can be turned into an equivalent anti-rational, risk-seeking decision-problem, where the agent picks an deleterious action in the hope that the environment will save it!
\subsection{Bellman recursion and its solution}
Given a bounded-rational decision tree $(T, \mathcal{X}, \alpha, Q, R, F)$, we can express its associated free energy functional \eqref{eq:fe-dt} as a Bellman recursion. The Bellman recursion has the advantage of offering a simplified, \emph{functional} view of the sequential planning problem that facilitates the characterization of the optimal policy.
\paragraph{Free energy.}
The recursive form of the free energy functional is readily obtained from the nested form of the free energy~\eqref{eq:fe-nested-5}. First, for each leaf node $s \in S$ we equate the free energy functional to the certainty-equivalent, that is, $F[\tilde{P}](s) = F(s)$. These correspond to the base cases of the recursion. Then, for each internal node $s \in S$, we have
\begin{equation}\label{eq:fe-rec}
F[\tilde{P}](s) = \sum_{x} P(x|s) \biggl[ R(x|s)
- \frac{1}{\alpha(s)} \log \frac{ \tilde{P}(x|s) }{ Q(x|s) }
+ F[\tilde{P}](sx) \biggr].
\end{equation}
This was obtained by exploiting the self-similar structure of~\eqref{eq:fe-nested-5}.
\paragraph{Certainty-equivalent.}
Before we state the optimal solution, it is convenient to first present the recursive characterization of the certainty-equivalent. For this, consider an internal node $s \in S$. Once the certainty-equivalents $F(sx)$ of its children nodes become available, the multi-step decision problem rooted at $s$ reduces to a single-step decision problem $(\alpha(s), \mathcal{X}, Q(\cdot|s), U_s)$ where the utility function is given by the sum $U_s(x) := R(x|s) + F(sx)$ of the instantaneous reward and the summarized future rewards for all $x \in \mathcal{X}$. Hence, using the formula for the certainty-equivalent \eqref{eq:certainty-equivalent} we get
\begin{equation}\label{ce-rec}
F(s) = \frac{1}{\alpha(s)} \log \sum_x Q(x|s)
\exp\biggl\{ \alpha(s) \Bigl[ R(x|s) + F(sx) \Bigr] \biggr\}.
\end{equation}
This can be regarded as an operator on the transition probabilities, rewards and free energies of the child nodes (Figure~\ref{fig:smp-rec}a).
\begin{figure}[t]
\centering
\includegraphics[width=\textwidth]{figures/smp-rec.pdf}
\caption{a) The certainty-equivalent $F(s)$ of the node $s \in S$ is calculated from the transition probabilities $Q(x|s)$, immediate rewards $R(x|s)$, and certainty-equivalents $F(sx)$ of its children nodes. b) When a path's inverse temperature changes from $\alpha(s)$ to $\alpha(sx)$, then the sampler must equalize this transition by requiring $\alpha(sx)/\alpha(s)$ successful samples from the subtree rather than just one. }\label{fig:smp-rec}
\end{figure}
\paragraph{Optimal solution.} Similarly, given an internal node $s \in S$ and the certainty-equivalents $F(sx)$ of its children nodes, the optimal decision at $s$ is obtained immediately from the equation for the single-step case~\eqref{eq:optimal}:
\begin{equation}\label{eq:opt-rec}
P(x|s) = \frac{1}{Z(s)}
Q(x|s) \exp\biggl\{
\alpha(s) \Bigl[ R(x|s)
+ F(sx)
\Bigr] \biggr\},
\end{equation}
where $Z(s)$ is the partition function which normalizes the probabilities. Notice that the immediate rewards $R(x|s)$ (given $\alpha(s)$ and the $Q(x|s)$) do not form an alternative representation of the probabilities $P(x|s)$. Rather, a complete specification requires taking the sums $R(x|s) + F(sx)$ as primitives for the representation.
\subsection{Recursive rejection sampling}
Similarly to the single-step decision case, choosing an optimal action amounts to sampling from the optimal choice distribution~\eqref{eq:opt-rec}. The naive way of doing this consists in computing~\eqref{eq:opt-rec} recursively and then to sample from it. A second, slightly more elaborate way, consists in transforming the original bounded-rational decision tree into a single-step decision problem by setting every node's inverse temperature to a single value $\beta$ using equivalence transformations, and then to sample an optimal choice using rejection sampling as explained in Section~\ref{sec:stochastic-choice}. Unfortunately, both aforementioned methods depend on computing the free energies~$F(sx)$, and this operation does not scale to very large choice spaces.
Instead, we can sample a path $\tau \in \mathcal{X}^T$ from \eqref{eq:opt-rec} using a recursive form of rejection sampling without ever calculating a free energy. To do so, we first make the following two observations that follow immediately from the single-step case. First, the probability of obtaining \emph{any} successful sample using rejection sampling is a Bernoulli random variable with success probability
\begin{equation}\label{eq:sp-rec}
\biggl( \frac{Z(s)}{e^{\alpha(s) U^\ast(s)}} \biggr)
= \sum_x Q(x|s) \frac{ \exp\Bigl\{ \alpha(s) \Bigl[R(x|s) + F(sx)\Bigr] \Bigr\} }{ \exp\Bigl\{ \alpha(s) U^\ast(s) \Bigr\} },
\end{equation}
where $U^\ast(s)$ is a given target utility for node $s \in S$ that has to be either larger than $\max_x \{R(x|s) + F(sx)\}$ if $\alpha(s) > 0$ or smaller than $\min_x \{R(x|s) + F(sx)\}$ if $\alpha(s) < 0$ respectively.
Second, the free energy and the partition function are related as
\begin{equation}\label{eq:fe-pf}
F(s) = \frac{1}{\alpha(s)} \log Z(s).
\end{equation}
If $s \in S$ is an internal node, then we can use the latter equation to substitute the free energies in expression \eqref{eq:sp-rec}. This in turn allows us to rewrite the success probability recursively:
\begin{align}
\nonumber
\biggl( \frac{Z(s)}{e^{\alpha(s) U^\ast(s)}} \biggr)
&= \sum_x Q(x|s) \frac{ \exp\Bigl\{ \alpha(s) \Bigl[R(x|s) + \frac{1}{\alpha(sx)} \log Z(sx)\Bigr] \Bigr\} }{ \exp\Bigl\{ \alpha(s) U^\ast(s) \Bigr\} } \\
\nonumber
&= \sum_x Q(x|s) \frac{ \exp\Bigl\{ \alpha(s) \Bigl[\frac{1}{\alpha(sx)} \log Z(sx)\Bigr] \Bigr\} }{ \exp\Bigl\{ \alpha(s) \Bigl[ U^\ast(s) - R(x|s)\Bigr] \Bigr\} } \\
\label{eq:samp-rec}
&= \sum_x Q(x|s) \biggl( \frac{Z(sx)}{e^{\alpha(sx) U^\ast(sx)}} \biggr)^\frac{ \alpha(sx) }{ \alpha(s) },
\end{align}
where we have defined $U^\ast(sx) := U^\ast(s) - R(x|s)$ as the target utility for the subtree rooted as $sx \in S$. Thus, \eqref{eq:samp-rec} says that obtaining a sample from an internal node $s \in S$ amounts to first picking a random transition $x \in \mathcal{X}$ and then obtaining $\alpha(sx)/\alpha(s)$ successful samples from the subtree rooted at $sx \in S$, which we know is an equivalent subtree having inverse temperature $\alpha(sx)$---see Figure~\ref{fig:smp-rec}b. We have already seen in Section~\ref{sec:equivalence} how to sample this operation using (modifications of) the rejection sampling algorithm. If $s \in S$ is a terminal node instead, then we can treat it as a normal single-step decision problem and sample a choice using rejection sampling.
\begin{figure}[p]
\begin{algoframed}
\caption{\textsc{sample}($s, U^\ast, \sigma$)}\label{alg:smp-rec}
\IncMargin{2cm}
\DontPrintSemicolon
\SetKwInOut{Input}{input}\SetKwInOut{Output}{output}
\Input{A state $s$, a target utility $U^\ast$, and a sign $\sigma$}
\Output{An accepted trajectory $\tau$, otherwise $\epsilon$}
\BlankLine
\emph{Proposal:}\;
$x \drawnfrom Q(x|s)$\;
\BlankLine
\emph{Base case:}\;
\If{$sx$ is a leaf}{
$u \drawnfrom \mathcal{U}(0,1)$\;
$p \leftarrow \exp\{\alpha(s) (R(x|s)+F(sx)-U^\ast)\}$\;
\lIf{$(\sigma > 0$ and $u \leq p)\phantom{1/}$}{\Return $sx$}
\lIf{$(\sigma < 0$ and $1/u \geq p)$}{\Return $sx$}
\Return $\epsilon$\;
}
\BlankLine
\emph{Recursion:}\;
$\sigma \leftarrow \sigma \cdot \mathrm{sign}(\alpha(s)/\alpha(sx))$\;
$\xi \leftarrow \mathrm{abs}(\alpha(s)/\alpha(sx))$\;
\BlankLine
\Begin(\emph{Attempt to generate $\lfloor \xi \rfloor$ successful samples.}){
\For{$1, \ldots, \lfloor \xi \rfloor$}{
$\tau \leftarrow \textsc{sample}(sx, U^\ast - R(x|s), \sigma)$\;
\lIf{$\tau = \epsilon$}{\Return $\epsilon$}
}
\lIf{$\xi = \lfloor \xi \rfloor$}{\Return $\tau$}
}
\BlankLine
\Begin(\emph{Attempt to generate $\xi - \lfloor \xi \rfloor$ successful samples.}){
$u \drawnfrom \mathcal{U}(0,1)$\;
$a \leftarrow \lfloor \xi \rfloor - \xi$\;
set $b \leftarrow -1$, $f \leftarrow 0$, and $k \leftarrow 1$\;
$\tau \leftarrow \textsc{sample}(sx, U^\ast - R(x|s), \sigma)$\;
\While{$\tau = \epsilon$}{
set $b \leftarrow -b \cdot (a-k+1) / k$, $f \leftarrow f + b$,
and $k \leftarrow k + 1$\;
$\tau \leftarrow \textsc{sample}(sx, U^\ast - R(x|s), \sigma)$\;
\lIf{$u \leq f$}{\Return $\epsilon$}
}
\Return $\tau$\;
}
\end{algoframed}
\end{figure}
A detailed pseudocode for this recursive rejection sampling algorithm is listed in Algorithm~\ref{alg:smp-rec}. The function \textsc{sample}($s, U^\ast, \sigma$) takes as arguments a node $s \in S$; a target utility $U^\ast$ for the whole path; and a sign-flag $\sigma \in \{-1,+1\}$, which keeps track of whether we are using normal ($\sigma = +1$) or reciprocal probabilities ($\sigma = -1$) in the rejection sampling step due to the possible change of sign in the inverse temperature. It returns either an accepted path $\tau \in \mathcal{X}^T$ or $\epsilon$ if the proposal is rejected. Planning is invoked on the root node by executing \textsc{sample}($\epsilon, U^\ast, 1$), where $U^\ast$ is the global target utility. For this recursive sampler to return a path drawn from the correct distribution, the value of $U^\ast$ must be chosen so as to be larger than the rewards of any path, \textit{i.e.} for all $x_{\leq T} \in \mathcal{X}^T$,
\[
U^\ast \geq \sum_{t=1}^T R(x_t|x_{<t}) + F(x_{\leq T})
\]
whenever the root node's inverse temperature $\alpha(\epsilon) > 0$ is strictly positive; or smaller than the rewards of any path whenever $\alpha(\epsilon) < 0$.
Finally we note that, as in the single-step case, the agent can parallelize the recursive rejection sampler by simultaneously exploring many stochastically generated paths, and then return \emph{any} of the accepted ones.
\section{Discussion}
\subsection{Relation to literature}
In this paper we have presented a summary of an information-theoretic model of bounded-rational decision-making that has precursors in the economic literature \citep{McKelvey1995, Mattsson2002, Wolpert2004, Sims2003, Sims2005, Sims2006, Sims2011} and that has emerged through the application of information-theoretic methods to stochastic control and to perception-action systems \citep[see \textit{e.g.}][]{Mitter2005, Kappen2005a, Todorov2006, Todorov2009, Theodorou2010, Theodorou2015, Still2009, Still2012, Broek2010, Friston2010, Peters2010, Tishby2011, Kappen2012, Neumann2012, Rawlik2012, Rubin2012, Fox2012, Neumann2013, GrauMoya2013, Zaslavsky2015, Tanaka2015, Mohamed2015, Genewein2015, Leibfried2015}. In particular, the connection between the free energy functional and bounded rationality, the identification of the free energy extremum as the certainty-equivalent in sequential games, and the implementation of the utility-complexity trade-off based on sampling algorithms, were developed in a series of publications within this community \citep[see \textit{e.g.}][]{BraunOrtega2011, OrtegaBraun2011b, OrtegaBraun2013, Ortega2014a, OrtegaKimLee2015}\nocite{Ortega2011, OrtegaBraun2012, BraunOrtega2014, OrtegaLee2014}. The most distinguishing feature of this approach to bounded rationality is the formalization of resources in terms of information.
\paragraph{Historical roots.}
The problem of bounded rational decision-making gained popularity in the 1950s originating in the work by Herbert Simon \citep{Simon1956, Simon1972, Simon1984}. Simon proposed that bounded rational agents do not optimize, but \textit{satisfice}---that is, they do not search for the absolute best option, but rather settle for an option that is good enough. Since then the research field for bounded rational decision-making has considerably diversified leading to a split between optimization-based approaches and approaches that dismiss optimization as a misleading concept altogether \citep{Lipman1995, Russell1995a, Russell1995b, Aumann1997, Rubinstein1998, Gigerenzer2001}. In particular, the formulation as a constrained optimization problem is argued to lead to an infinite regress, and the paradoxical situation that a bounded rational agent would have to solve a more complex (\textit{i.e.} constrained) optimization problem than a perfectly rational agent. Information-theoretic bounded rationality provides a middle ground here, as the agent randomly samples choices, but does not incur into a meta-optimization, because the random search simply stops when resources run out. In fact, the equations for information-theoretic bounded rational agent can be interpreted as a stochastic satisficing procedure instantiated by rejection sampling.
\paragraph{KL-Control.}
From the vantage point of an external observer, information-theoretic bounded rational agents appear to trade off any gains in utility against the additional information-theoretic complexity as measured by the KL-divergence between a prior decision strategy and a posterior decision strategy after deliberation. Recently, a number of studies have suggested the use of the relative entropy as a cost function for control, which is sometimes referred to as \textit{KL-Control} \citep{Todorov2006, Todorov2009, Kappen2012}. In the work by \citet{Todorov2006}, the transition probabilities of a Markov decision process are controlled directly, and the control costs are given by the KL-divergence between the controlled dynamics and the passive dynamics described by a baseline distribution. This framework has also been extended to the continuous case, leading to the formulation of path integral control \citep{Kappen2005a, Theodorou2010}. Conceptually, the most important difference to the bounded-rational interpretation is that in KL-Control the stochasticity of choice is thought to arise from environmental passive dynamics rather than being a direct consequence of limited information capacities.
\paragraph{Psychology.}
In the psychological and econometric literature, stochastic choice rules have extensively been studied starting with \citet{Luce1959}, extending through \citet{McFadden1974}, \citet{Meginnis1976}, \citet{Fudenberg1993}, \citet{McKelvey1995} and \citet{Mattsson2002}. The vast majority of models has concentrated on \textit{logit choice models} based on the \textit{Boltzmann distribution} which includes the \textit{softmax rule} that is popular in the reinforcement learning literature \citep{Sutton1998}. \citet{McFadden1974} has shown that such Boltzmann-like choice rules can arise, for example, when utilities are contaminated with additive noise following an extreme value distribution. From the physics literature, it is also well-known that Boltzmann distributions arise in the context of variational principles in the free energy implying a trade-off between utility and entropic resource costs. The information-theoretic model of bounded rationality generalizes these ubiquitous logit choice models by allowing arbitrary prior distributions, as for example in \citet{McKelvey1995}. This corresponds to a trade-off in utility gains and additional resource costs incurred by deviating from the prior, which ultimately entails a variational principle in a free energy difference.
\paragraph{Economics.}
In the economic literature, variational principles for choice have been suggested in the context of \textit{variational preference models} \citep{Rustichini2006}. In variational preference models the certainty-equivalent value of a choice consists of two terms: the expected utility and an ambiguity index. A particular instance of the variational preference model is the \textit{multiplier preference model} where the ambiguity index is given by a Kullback-Leibler divergence \citep{Hansen2008}. In particular, it has been proposed that multiplier preference models allow dealing with model uncertainty, where the KL-divergence indicates the degree of model uncertainty. Free energy variational principles also appear in variational Bayesian inference. In this case the utility function is given by the negative log-likelihood and the free energy trade-off captures the transformation from Bayesian prior to posterior. The variational Bayes framework has recently also been proposed as a theoretical framework to understand brain function \citep{Friston2009, Friston2010} where perception is modeled as variational Bayesian inference over hidden causes of observations.
\paragraph{Computational approaches.}
While the free energy functional does not depend on domain-specific assumptions, the exact relationship between information-theoretic constraints and the standard measures of algorithmic complexity in computer science (\textit{e.g.} space and time) is not known. In contrast, the notion of \textit{bounded optimality} defines the optimal policy as the program that achieves the highest utility score on a particular machine given complexity constraints, and oftentimes relies on meta-reasoning for practical implementations \citep{Horvitz1989, Russell1995b}. This view has recently experienced a revival in computational neuroscience under the name of \textit{computational rationality} \citep{Lieder2014, Lewis2014, Griffiths2015, Gershman2015}. Another recent approach to model bounded resources with profound implications is \textit{space-time embedded intelligence} in which agents are treated as \textit{local computation patterns} within a global computation of the world \citep{Orseau2012}. It remains an interesting challenge for the future to extend the framework of information-theoretic bounded rationality to the realm of programs and to relate it to notions of algorithmic complexity.
\comment{%
\subsection{Relationship to Bayesian inference}
\subsection{Relationship to minimax, Markovitz \& regret}
Real-life decisions are risk-sensitive. For instance, expected utility is indifferent between two
choices as long as they have the same expected utility. However, real-life investors also consider higher-order moments when designing their portofolios; such optimal portofolios mix assets in order to balance returns and risks.
Modern portfolio theory: One notable case that is widely used in practice is modern portfolio theory. Here, an investor trades off asset resutns versus porfolio risk, encoded into a regularisation term that is quadratic in the policy \citep{Markovitz1952}. The objective function blabla
Regret theory \citep{Fishburn1982, Bell1982, LoomesSugden1982} .
\subsection{Bounded-rational games}
}
\subsection{Conclusions}
The original question we have addressed is: how do agents make decisions in very large and unstructured choice spaces? The need for solving this question is becoming increasingly critical, as these decision spaces are ubiquitous in modern agent systems. To answer this, we have formalized resource limitations as information constraints, and then replaced the objective function of subjective expected utility theory with the free energy functional. An advantage of the free energy functional is that its optimal solution has a clear operational interpretation. As a result, the optimal solution is a fully parallelizable stochastic choice strategy that strikes a trade-off between the utility and the search effort.
Perhaps more fundamentally though, the theory lays out a general method to model reasoning under information constraints that arise \emph{as symptoms} of intractability, model uncertainty, or other causes. This feature becomes especially apparent in the sequential decision case, where a bounded-rational decision-tree captures an agent's dynamics of trust---both in its own ability to shape \& predict the future, and in the other players' intentions. We have seen that model uncertainty biases the value estimates of an agent, forcing it to pay attention to the higher-order moments of the utility.
For the sake of parsimony of the exposition, in this work we have refrained from elaborating on specific applications or extensions. There are obvious connections to Bayesian statistics that we have not fleshed out. Furthermore, the ideas outlined here can be applied to any choice process that is typically subject to information constraints, among them: attention focus and generation of random features; model selection and inference in probabilistic programming; and planning in active learning, Bayesian optimization, multi-agent systems and partially-observable Markov decision processes. The success of the theory will ultimately depend on its usefulness in these application domains.
\subsection*{Acknowledgments}
The authors would like to thank Daniel Polani, Bert J. Kappen, and Evangelos Theodorou, who provided innumerable insights during many discussions. This study was funded by the Israeli Science Foundation Center of Excellence, the DARPA MSEE Project, the Intel Collaborative Research Institute for Computational Intelligence (ICRI-CI), and the Emmy Noether Grant BR 4164/1-1.
| {'timestamp': '2015-12-22T02:26:27', 'yymm': '1512', 'arxiv_id': '1512.06789', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06789'} | arxiv |
\section{Introduction}
\label{sec:intro}
This paper follows recent work on the combinatorics of linear lambda terms, which has uncovered various connections to the theory of graphs on surfaces (or ``maps'').
It is currently known that there exist size-preserving correspondences between all of the following pairs of families of objects, some with explicit bijections but all at least at the level of generating functions \cite{bodini-et-al,zg2015rpmnpt,z2015counting}:
\begin{center}
\begin{oldtabular}{|@{\,}c@{\,}|@{\,}c@{\,}|@{\,}c@{\,}|}
\hline
Family of rooted maps & Family of lambda terms & OEIS entry
\\
\hline\hline
rooted trivalent maps & linear lambda terms & \href{https://oeis.org/A062980}{A062980}\\
\hline
rooted planar maps & normal planar lambda terms & \href{https://oeis.org/A000168}{A000168} \\
\hline
rooted maps & normal linear lambda terms / $\sim$ & \href{https://oeis.org/A000698}{A000698} \\
\hline
\end{oldtabular}
\end{center}
(Here ``OEIS'' is short for \emph{The On-Line Encyclopedia of Integer Sequences} \cite{oeis}.)
Although the existence of such connections is intriguing, it is not yet obvious to what extent they have a deeper ``meaning''.
My aim in this article, therefore, is to revisit the basic situation of rooted trivalent maps and propose a slightly more general and conceptual account of the bijection originally given by Bodini, Gardy, and Jacquot -- an account which hopefully suggests some clear directions for further exploration.
The main insights I hope to convey are that:
\begin{enumerate}
\item Bodini~\etal's bijection between \emph{closed} linear lambda terms and rooted trivalent maps \emph{on compact oriented surfaces without boundary} is really an instance of a more general bijection that relates linear lambda terms with free variables to rooted trivalent maps with a marked boundary of free edges.
\item If we represent linear lambda terms using a natural diagrammatic syntax, then the corresponding rooted trivalent maps are obtained simply by erasing some information stored locally at the nodes of the diagram.
Moreover, through a little bit of category theory, this way of representing linear lambda terms (which is folklore) can be understood within the wider context of \emph{string diagrams}, as a notation for endomorphisms of a reflexive object in a symmetric monoidal closed (bi)category.
\item Conversely, by considering connectivity properties of the underlying graph, it is possible to invert this forgetful transformation through a recursive decomposition of rooted trivalent maps with free edges (similar in spirit to Tutte's seminal analysis of rooted planar maps \cite{tutte1968}). In effect, a linear lambda term can be seen as a \emph{topological invariant} of a rooted trivalent map (analogous to, say, the chromatic polynomial of a graph), which is moreover a complete invariant in the sense that it characterizes the rooted trivalent map up to isomorphism.
\end{enumerate}
One immediate application of this analysis will be a simple characterization of rooted trivalent maps without bridges, as linear lambda terms with no closed proper subterms.
I will then show how to combine this characterization with a link between typing and graph-coloring, to yield a surprising yet natural lambda calculus reformulation of the Four Color Theorem (in its equivalent form as the statement that every bridgeless trivalent planar map is edge 3-colorable).
The rest of the paper is structured as follows.
\Cref{sec:review-maps,sec:review-lambda} provide some elementary background on maps and lambda calculus, while \Cref{sec:stringdiagrams} explains how to represent linear lambda terms graphically and how to interpret these diagrams categorically.
The bijection between linear lambda terms with free variables and rooted trivalent maps with free edges (which extends the bijection of \cite{bodini-et-al} on closed terms) is presented in \Cref{sec:linear-trivalent,sec:trivalent-linear}.
Finally, \Cref{sec:4ct} discusses the characterization of bridgeless rooted trivalent maps, and the reformulation of the Four Color Theorem (4CT).
\section{Classical definitions for rooted trivalent maps}
\label{sec:review-maps}
This section recalls some standard definitions from the theory of maps (for further background on the subject, see Lando and Zvonkin \shortcite{landozvonkin}).
In topological terms, a map can be defined as a 2-cell embedding $i : G \hookrightarrow X$ of an undirected graph $G$ (loops and multiple edges allowed) into a surface $X$: that is, a representation of the vertices $v \in G$ by points $i(v) \in X$ and the edges $v_1 \overset{e}{\leftrightarrow} v_2 \in G$ by arcs $i(v_1) \overset{i(e)}\frown i(v_2) \in X$, such that no two arcs cross, and such that the complement of the graph inside the surface $X \setminus i(G)$ is a disjoint union of simply-connected regions (called \emph{faces}; note that this last condition implies that if the underlying surface $X$ is connected, then $G$ must be a connected graph).
Two maps $G \overset{i}\hookrightarrow X$ and $G' \overset{i'}\hookrightarrow X'$ are said to be \emph{isomorphic} if there is a homeomorphism between the underlying surfaces $h : X \to X'$ whose restriction $h|_{i(G)}$ witnesses an isomorphism of graphs $G \to G'$.
One of the beautiful aspects of the theory is that in many situations, maps also admit a purely algebraic description as a collection of permutations satisfying a few properties.
For example, a 2-cell embedding of a graph into any \emph{compact oriented surface without boundary} \cite{jones-singerman} may be represented as a pair of permutations $v$ and $e$ on a set $M$ such that
\begin{enumerate}
\item $e$ is a fixed point-free involution, and
\item the group $\freegp{v,e}$ generated by the permutations acts transitively on $M$ (i.e., for any pair of elements $x,y\in M$ it is possible to go from $x$ to $y$ by some sequence of applications of $v$ and $e$).
\end{enumerate}
This kind of representation is sometimes called a \emph{combinatorial map}.
The idea is that the elements of the set $M$ stand for ``darts'' or ``half-edges'', so that the involution $e$ describes the gluing of pairs of darts to form an edge, while the permutation $v$ encodes the cyclic (say, counterclockwise) ordering of darts around each vertex.
\Cref{fig:example-map} gives an example of a planar map (i.e., an embedding of a graph into the sphere $X = S^2$) represented by such permutations.
In addition to the \emph{vertex permutation} $v$ and the \emph{edge permutation} $e$, to any combinatorial map one may associate a \emph{face permutation} $f$ by the equation $f = (ev)^{-1} = v^{-1}e$, representing the cyclic ordering of darts around each face of the corresponding embedded graph.
\begin{figure}
\begin{center}
\begin{minipage}{0.2\textwidth}
\begin{tikzpicture}
\node (a) at (0,0) {$\bullet$};
\node (b) at (-1,1) {$\bullet$};
\node (c) at (0.1,1.5) {$\bullet$};
\node (d) at (2,1.6) {$\bullet$};
\node (e) at (1.8,0.2) {$\bullet$};
\node (f) at (0.2,2.5) {$\bullet$};
\node (g) at (2.4,-0.2) {};
\draw (a.center) to node [pos=0.2] {\tiny$3$} (b.center);
\draw (b.center) to node [pos=0.2] {\tiny$4$} (a.center);
\draw (a.center) to node [pos=0.3] {\tiny$2$} (c.center);
\draw (c.center) to node [pos=0.2] {\tiny$14$} (a.center);
\draw (b.center) to node [pos=0.2] {\tiny$5$} (c.center);
\draw (c.center) to node [pos=0.2] {\tiny$13$} (b.center);
\draw (c.center) to node [pos=0.2] {\tiny$12$} (d.center);
\draw (d.center) to node [pos=0.2] {\tiny$10$} (c.center);
\draw (d.center) to node [pos=0.2] {\tiny$11$} (e.center);
\draw (e.center) to node [pos=0.2] {\tiny$15$} (d.center);
\draw (e.center) to node [pos=0.15] {\tiny$16$} (a.center);
\draw (a.center) to node [pos=0.15] {\tiny$1$} (e.center);
\draw (b.center) to node [pos=0.2] {\tiny$6$} (f.center);
\draw (f.center) to node [pos=0.2] {\tiny$7$} (b.center);
\draw (f.center) to node [pos=0.2] {\tiny$8$} (d.center);
\draw (d.center) to node [pos=0.2] {\tiny$9$} (f.center);
\draw [bend right=45,rounded corners=5pt] (e.center) to node [pos=0.3] {\tiny$17$} (g.center) to node [pos=0.7] {\tiny$18$} (e.center);
\end{tikzpicture}
\end{minipage}
\qquad\qquad
\begin{minipage}{0.6\textwidth}
\begin{align*}
M &= \set{1,\dots,18} \\
v &= \trip 123\trip 456\tup 78\trip{9}{10}{11}\trip{12}{13}{14}(15~16~17~18) \\
e &= \tup 1{16}\tup 2{14}\tup 34\tup 5{13}\tup 67\tup 89\tup{10}{12}\tup {11}{15}\tup{17}{18} \\
f &= (1~15~10~14)(2~13~4)(3~6~8~11~18~16)(5~12~9~7)(17)
\end{align*}
\end{minipage}
\end{center}
\caption{A planar map represented by permutations}
\label{fig:example-map}
\end{figure}
Two combinatorial maps $(M,v,e)$ and $(M',v',e')$ are considered as isomorphic if there is a bijection between the underlying sets $h : M \to M'$ which is compatible with the action of the permutations, $hv = v'h$, $he = e'h$.
The following definition rephrases all of this a bit more efficiently:
\begin{definition}
Let $\cartgp$ be the group $\cartgp \defeq \freegp{v,e \mid e^2 = 1}$. A (combinatorial) \definand{map} (on a compact oriented surface without boundary) is a transitive $\gset\cartgp$ on which the generator $e$ acts without fixed points.
\end{definition}
\noindent
One nice feature of combinatorial maps is that it is easy to compute their \emph{genus}.
\begin{definition}
Let $M$ be a combinatorial map.
The \definand{genus} $g$ of $M$ is defined by the Euler-Poincar\'e formula $c(v) - c(e) + c(f) = 2 - 2g$, where $v$, $e$, and $f$ are respectively the vertex, edge, and face permutations associated to $M$, and $c(\pi)$ counts the number of cycles in the cycle decomposition of $\pi$.
(For example, for the genus $g=0$ map of \Cref{fig:example-map} we have $c(v) - c(e) + c(f) = 6 - 9 + 5 = 2$.)
\end{definition}
\noindent
In the rest of the paper we will be focused on \emph{trivalent} maps (also called cubic maps), which can be defined by the algebraic condition that the vertex permutation is fixed point-free and of order three.
\begin{definition}
\label{def:trivalent}
Let $\trigp$ be the group $\trigp \defeq \freegp{v,e \mid v^3 = e^2 = 1}$. A \definand{trivalent map} is a transitive $\gset\trigp$ on which the generators $v$ and $e$ act without fixed points.
\end{definition}
\noindent
Moreover, we will always be speaking about so-called ``rooted'' maps.
\begin{definition}
\label{def:rooted}
A \definand{rooted} (trivalent) map is a (trivalent) map $M$ with a distinguished element $r \in M$ called the \uline{root}.
An isomorphism of rooted maps $f : (M,r) \to (M',r')$ is an isomorphism of maps $f : M \to M'$ which preserves the root $f(r) = r'$.
\end{definition}
\noindent
Topologically, a rooting of a map can be described as the choice of an edge, vertex, and face all mutually incident, or equivalently as the choice of an edge together with an orientation of that edge.
The original motivation for the study of rooted maps in combinatorics was that they are \emph{rigid} objects (meaning that they have no automorphisms other than the identity) and hence are easier to count than unrooted maps,\footnote{For a historical account, see Ch.~10 of Tutte's \emph{Graph Theory as I Have Known it} (1998, Oxford).} but it is also worth remarking that there is a general correspondence
\begin{center}
pointed transitive $G$-sets $\leftrightarrow$ subgroups of $G$
\end{center}
which sends any transitive $\gset{G}$ $M$ equipped with a distinguished point $r \in M$ to the stabilizer subgroup $G_r = \set{g \in G \mid g \ast r = r}$, and any subgroup $H \subseteq G$ to the action of $G$ on cosets $G/H$ together with the distinguished coset $H$.
In particular, every rooted trivalent map uniquely determines a subgroup of the modular group $\trigp \cong \mathrm{PSL}(2,\mathbb{Z})$, while an unrooted map only determines one up to conjugacy \cite{jones-singerman94schneps,vidal2010}.
Finally, it is fairly common (cf.~\cite{jones-singerman94schneps,vidal2010}) to relax the conditions of fixed point-freeness in the definition of a general map and/or of a trivalent map.
Intuitively, fixed points of $e$ represent ``dangling'' edges, while fixed points of $v$ represent univalent vertices.
Precise formulations differ, however, and in \Cref{sec:linear-trivalent} we will introduce a generalization of the classical definition of rooted trivalent maps which is motivated by the correspondence with linear lambda terms.
\section{Basic definitions for linear lambda terms}
\label{sec:review-lambda}
Here we cover the small amount of background on lambda calculus that we will need in order to talk about linear lambda terms (for a more general introduction, see Barendregt \shortcite{barendregt1984}).
The terms of pure lambda calculus are constructed from variables ($x,y,\dots$) using only the two basic operations of \emph{application} $t(u)$ and \emph{abstraction} $\lambda x[t]$.
Within a given term, one distinguishes \emph{free} variables from \emph{bound} variables.
An abstraction $\lambda x[t]$ is said to bind the occurrences of $x$ within the subterm $t$, and any variable which is not bound by an abstraction is said to be free.
Two lambda terms are considered equivalent (``$\alpha$-equivalent'') if, roughly speaking, they differ only by renaming of bound variables.
A term is said to be \emph{linear} if every variable (free or bound) has exactly one occurrence: for example, the terms $\lambda x[x(\lambda y[y])]$, $\lambda x[\lambda y[x(y)]]$, and $\lambda x[\lambda y[y(x)]]$ are linear, but the terms $\lambda x[x(x)]$, $\lambda x[\lambda y[x]]$, and $\lambda x[\lambda y[y]]$ are non-linear.
To make this definition more precise, it is natural to consider linear lambda terms as indexed explicitly by lists of free variables, called \emph{contexts}, which also affects the definition of $\alpha$-equivalence.
\begin{definition}\label{def:linear}
A \definand{context} is an ordered list of distinct variables $\Gamma = (x_1,\dots,x_k)$.
We write $(\Gamma,\Delta)$ for the concatenation of two contexts $\Gamma$ and $\Delta$, with the implicit condition that they contain disjoint sets of variables.
Let $\Gamma\vdash t$ be the relation between contexts and lambda terms defined inductively by the following rules:
\begin{equation}
\infer{x \vdash x}{}
\qquad
\infer{\Gamma,\Delta \vdash t(u)}{\Gamma \vdash t & \Delta \vdash u}
\qquad
\infer{\Gamma \vdash \lambda x[t]}{\Gamma, x \vdash t}
\qquad\qquad
\infer{\Gamma, x,y,\Delta \vdash t}{\Gamma, y,x,\Delta \vdash t}
\label{eqn:linrules}
\end{equation}
Then a \definand{linear lambda term} is a pair $(\Gamma,t)$ of a context and a term such that $\Gamma \vdash t$.
Two linear lambda terms $(\Gamma,t)$ and $(\Gamma',t')$ are said to be \definand{$\alpha$-equivalent} if they only differ by a series of changes of free or bound variables, defined as follows.
Supposing that $\Gamma = (\Gamma_1,x,\Gamma_2)$ and $\Gamma' = (\Gamma_1,y,\Gamma_2)$, then $(\Gamma,t)$ and $(\Gamma',t')$ differ by a single \definand{change of free variable} if $t' = t\{y/x\}$, where $t\{y/x\}$ denotes the substitution of $y$ for $x$ in $t$.
Similarly, $(\Gamma,t)$ and $(\Gamma',t')$ differ by a single \definand{change of bound variable} if $t'$ arises from $t$ by replacing some subterm $\lambda x[u]$ by $\lambda y[u\{y/x\}]$.
\end{definition}
\noindent
For combinatorists, it might be helpful to see the two-variable generating function counting $\alpha$-equivalence classes of linear lambda terms of a given size in a given context.
Let $t_{n,k}$ stand for the number of $\alpha$-equivalence classes of linear lambda terms with $n$ total applications and abstractions and with $k$ free variables.
Then the generating function
$\GFlin(z,x) = \sum_{n,k} t_{n,k} \frac{x^k z^n}{k!}$
satisfies the following functional-differential equation:
\begin{equation}
\GFlin(z,x) = x + z\GFlin(z,x)^2 + z\frac{\partial}{\partial x}\GFlin(z,x)
\label{eqn:lingf}
\end{equation}
The three summands in equation (\ref{eqn:lingf}) correspond to the three rules on the left side of (\ref{eqn:linrules}),
$$
\infer{x \vdash x}{}
\qquad
\infer{\Gamma,\Delta \vdash t(u)}{\Gamma \vdash t & \Delta \vdash u}
\qquad
\infer{\Gamma \vdash \lambda x[t]}{\Gamma, x \vdash t}
$$
while the rule on the right side of (\ref{eqn:linrules})
$$
\infer{\Gamma, x,y,\Delta \vdash t}{\Gamma, y,x,\Delta \vdash t}
$$
explains why the generating function $\GFlin(z,x)$ is of \emph{exponential type} in the parameter $x$: if $(\Gamma,t)$ is a linear lambda term, then so is $(\Gamma',t)$ for any permutation $\Gamma'$ of $\Gamma$.
Finally, note that instantiating $\GFlin(z,0)$ gives the ordinary generating function (OGF) counting \emph{closed} linear lambda terms by total number of applications and abstractions,
$$
L(z,0) = z + 5z^3 + 60z^5 + 1105z^7 + 27120z^9 + \dots
$$
and which also counts rooted trivalent maps (OEIS \href{https://oeis.org/A062980}{A062980}; cf.~\cite{vidal2010,bodini-et-al}).
Besides the notion of $\alpha$-equivalence itself, the real interest of lambda calculus is that one can \emph{calculate} with it using the rules of \emph{$\beta$-reduction} and/or \emph{$\eta$-expansion}:
$$(\lambda x[t])(u) \overset\beta\to t\{u/x\}
\qquad
t \overset\eta\to \lambda x[t(x)]$$
Since $\beta$-reduction and $\eta$-expansion preserve linearity, the fragment of lambda calculus consisting of the linear lambda terms can be seen as a proper subsystem with various special properties (for example, computing the $\beta$-normal form of a linear lambda term is PTIME-complete \cite{mairson2004}, whereas for non-linear terms it is undecidable whether a normal form even exists).
Although it is sufficient to consider $\alpha$-equivalence for the purpose of presenting the bijection between linear lambda terms and rooted trivalent maps (which we will describe in \Cref{sec:linear-trivalent,sec:trivalent-linear}), we should nonetheless be aware that $\beta$-reduction and $\eta$-expansion are lurking in the background (and as mentioned in the introduction, there are some known connections between enumeration of $\beta$-normal terms and enumeration of rooted maps \cite{zg2015rpmnpt,z2015counting}).
\section{String diagrams for reflexive objects}
\label{sec:stringdiagrams}
\tikzset{->-/.style={decoration={
markings,
mark=at position .5 with {\arrow{>}}},postaction={decorate}}}
\tikzset{!->-/.style={decoration={
markings,
mark=at position #1 with {\arrow{>}}},postaction={decorate}}}
A natural way of visualizing a lambda term is to begin by drawing a tree representing the underlying structure of applications and abstractions, and then add extra edges connecting each bound variable occurrence to its corresponding abstraction.
For example, for the term $\lambda x[\lambda y[x(\lambda z[y(z)])]]$
we begin with the tree on the left, adding links to obtain the diagram on the right:
\begin{equation}\label{eqn:lambda-graph}
\vcenter{\hbox{
\begin{tikzpicture}[scale=0.8,level/.style={sibling distance=15em/#1, level distance=2em}]
\node (z) {} child {
node (a) {$\lambda$}
child { node (b) {$\lambda$}
child {
node (c) {$@$}
child {node (d) {} }
child {node (e) {$\lambda$}
child {node (f) {$@$}
child { node (g) {} }
child { node (h) {} }
}}
}}};
\end{tikzpicture}}}
\quad\leadsto\quad
\vcenter{\hbox{
\begin{tikzpicture}[scale=0.8,level/.style={sibling distance=15em/#1, level distance=2em}]
\node (z) {} child {
node (a) {$\lambda$}
child { node (b) {$\lambda$}
child {
node (c) {$@$}
child {node (d.center) {} }
child {node (e) {$\lambda$}
child {node (f) {$@$}
child { node (g.center) {} }
child { node (h.center) {} }
}}
}}};
\node (x) [right=1em of h] {};
\node (y) [below=8.5em of a] {};
\node (z) [right=4em of y] {};
\draw (d.center) to [bend right=30,rounded corners=5pt] (y) to [bend right=30,rounded corners=5pt] (z) to [bend right=75,rounded corners=5pt] (a);
\draw[bend right=135] (h.center) to (e);
\draw[bend right=45,rounded corners=5pt] (g.center) to (x.center) to (b);
\end{tikzpicture}}}
\end{equation}
This approach is especially natural for linear lambda terms, since each $\lambda$-abstraction binds exactly one variable occurrence.
Mairson \shortcite{mairson2002dilbert} refers to these kinds of diagrams as \emph{proof-nets} (probably because they are essentially equivalent to Girard's proof-nets for the implicative fragment of linear logic), while Bodini et.~al \shortcite{bodini-et-al} speak of them as ``syntactic trees''.
I do not know just how far back the idea goes, but I've even seen such a diagram used to display a (linear) lambda term in an old essay by Knuth \shortcite{knuth1970}, who called it a particular kind of \emph{information structure}.
In \Cref{sec:linear-trivalent,sec:trivalent-linear} we will use these types of diagrams to help explain the bijection between linear lambda terms and rooted trivalent maps.
The aim of this section is to briefly present a \emph{rational reconstruction} of the diagrams for the interested reader, using the framework of Joyal and Street \shortcite{joyal-street-i} to read these ``string diagrams'' as a notation for endomorphisms of a reflexive object.
I will assume that the reader already has some background in category theory -- for others, this section can be safely skipped, since the rest of the paper will only make use of the informal description of the diagrams, and not their categorical characterization.\footnote{The analysis given here follows \cite[Zeilberger and Giorgetti (2015, \S3.1)]{zg2015rpmnpt} but is considerably simplified; otherwise, the observation that the framework of string diagrams can be used to link lambda calculus proof-nets to reflexive objects is original as far as I know.}
An important insight of Dana Scott was that the equational theory of pure lambda calculus can be modelled using a \emph{reflexive object} in a cartesian closed category, in the sense of an object $U$ equipped with a retraction to its space of internal endomorphisms $U^U$ \cite{scott1980,hyland-lambda-calculus}.
To capture linear lambda calculus rather than classical lambda calculus, it suffices to rephrase Scott's original definition in the setting of \emph{symmetric monoidal closed} (smc) categories, replacing the exponential object $U^U$ by the internal hom object $\impR[U]{U}$ \cite{jacobs1993}.
Moreover, one can model the theory of ($\beta\eta$-)rewriting rather than the theory of equality by working with \emph{bicategories} rather than categories \cite{seely1987}.
Consider then the following definition:
\begin{definition}\label{defn:reflexive-object}
A \definand{reflexive object} in a smc bicategory $\mathcal{K}$ is an object $U$ equipped with an adjunction to its space of internal endomorphisms $\impR[U]{U}$.\footnote{This definition of reflexive object can be seen as a common generalization of two definitions introduced by Seely~\shortcite{seely1987} and by Jacobs~\shortcite{jacobs1993}, who considered, respectively, how to generalize Scott's definition to the setting of (cartesian closed) bicategories and of smc (1-)categories.}
\end{definition}
\noindent
A reflexive object in this sense consists of a pair of 1-cells
$$
\xymatrixcolsep{3pc}
\xymatrixrowsep{2.5pc}
\xymatrix{U \rtwocell^@_\lambda{'} & V}
$$
where the object $V = \impR[U]{U}$ comes with an equivalence of categories $\mathcal{K}(X \otimes U,U) \cong \mathcal{K}(X,V)$ natural in $X$,
together with a pair of 2-cells
$$
\xymatrixcolsep{3pc}
\xymatrixrowsep{2.5pc}
\xymatrix{\rrtwocell<\omit>{<3>\eta}U \ar[dr]_{@}\ar@{=}[rr] & & U \\ & V\ar[ur]_\lambda &}
\qquad\qquad
\xymatrix{\rrtwocell<\omit>{<5>\beta} & U\ar[dr]^{@} & \\ V \ar[ur]^{\lambda}\ar@{=}[rr] & & V}
$$
satisfying the zig-zag identities
$(\lambda \beta) \circ (\eta \lambda) = 1_\lambda$ and
$(\beta @) \circ (@ \eta) = 1_@$.
Such data provides a model of linear lambda calculus in the following sense:
\begin{claim}[Soundness] \label{claim:soundness}
Let $U$ be a reflexive object in a smc bicategory $\mathcal{K}$.
Any linear lambda term $(\Gamma,t)$ can be interpreted as a 1-cell $\sem{t} : U^{\otimes k} \to U$ in $\mathcal{K}$, where $\Gamma = x_1,\dots,x_k$ and $U^{\otimes k}$ is the $k$-fold tensor product of $U$.
Moreover, this interpretation respects $\alpha$-equivalence, $\beta$-reduction, and $\eta$-expansion.
\end{claim}
\noindent
To make the connection between reflexive objects and the ``proof-nets'' for lambda terms, let's begin by observing that a special kind of smc bicategory is a \emph{compact closed} bicategory \cite{stay2013}, where the internal hom can be defined in terms of the tensor and dualization: $\impR[U]{U} \cong U \otimes U^*$.
There is a fairly standard set of conventions for drawing morphisms of compact closed (bi)categories as string diagrams \cite{selinger-survey,stay2013}, typically using orientations on the ``wires'' to distinguish between an object $A$ and its dual $A^*$.
Applying these conventions to the data of a reflexive object in a compact closed bicategory, the 1-cells $@ : U \to U \otimes U^*$ and $\lambda : U \otimes U^* \to U$ get drawn (running down the page) as nodes of the shape
$$
\vcenter{\hbox{\begin{tikzpicture}
\node (fn) {};
\node (app) [below=1em of fn] {$@$};
\node (cont) [below left=1em of app] {};
\node (arg) [below right=1em of app] {};
\draw[->-] (fn.center) to (app);
\draw[->-] (app) to (cont.center);
\draw[->-] (arg.center) to (app);
\end{tikzpicture}}}
\qquad\text{and}\qquad
\vcenter{\hbox{\begin{tikzpicture}
\node (root) {};
\node (lam) [above=1em of root] {$\lambda$};
\node (var) [above right=1em of lam] {};
\node (body) [above left=1em of lam] {};
\draw[->-] (lam) to (root.center);
\draw[->-] (lam) to (var.center);
\draw[->-] (body.center) to (lam);
\end{tikzpicture}}}
$$
while the 2-cells $\eta$ and $\beta$ become rewriting rules
$$
\vcenter{\hbox{
\begin{tikzpicture}
\node (in) {};
\node (out) [below=5em of in] {};
\draw[->-] (in.center) to (out.center);
\end{tikzpicture}}}
\qquad\overset\eta\Longrightarrow\qquad
\vcenter{\hbox{
\begin{tikzpicture}
\node (fn) {};
\node (app) [below=1em of fn] {$@$};
\node (lam) [below=2em of app] {$\lambda$};
\node (root) [below=1em of lam]{};
\draw[->-] (fn.center) to (app);
\draw[->-,bend right=90] (app) to (lam);
\draw[->-,bend right=90] (lam) to (app);
\draw[->-] (lam) to (root.center);
\end{tikzpicture}}}
\qquad\qquad\qquad
\vcenter{\hbox{
\begin{tikzpicture}
\node (lam) {$\lambda$};
\node (var) [above right=1em of lam] {};
\node (body) [above left=1em of lam] {};
\node (app) [below=2em of lam] {$@$};
\node (cont) [below left=1em of app] {};
\node (arg) [below right=1em of app] {};
\draw[->-] (body.center) to (lam);
\draw[->-] (lam) to (var.center);
\draw[->-] (lam) to (app);
\draw[->-] (app) to (cont.center);
\draw[->-] (arg.center) to (app);
\end{tikzpicture}}}
\qquad\overset\beta\Longrightarrow\qquad
\vcenter{\hbox{
\begin{tikzpicture}
\node (in1) {};
\node (in2) [right=1.5em of in1] {};
\node (out1) [below=5em of in1] {};
\node (out2) [below=5em of in2] {};
\draw[->-] (in1.center) to (out1.center);
\draw[->-] (out2.center) to (in2.center);
\end{tikzpicture}}}
$$
with the zig-zag identities expressing a coherence condition on these rewriting rules.
For ease of reference, we'll also give names (adopted from Mairson \shortcite{mairson2002dilbert}) to the different wires positioned around the 1-cells: running clockwise around an $@$-node, the incoming wire at the top is called the \definand{function} port, followed by the (incoming) \definand{argument} and (outgoing) \definand{continuation}, and running counterclockwise around a $\lambda$-node, the outgoing wire at the bottom is called the \definand{root} port, followed by the (outgoing) \definand{parameter} and (incoming) \definand{body}.\footnote{The reader might suspect that there is some degree of arbitrariness in these layout conventions, for example if we had used left implication $\impL[U]{U}$ instead of right implication $\impR[U]{U}$ in \Cref{defn:reflexive-object}.
The bijection we present in \Cref{sec:linear-trivalent,sec:trivalent-linear} works for any layout convention, and will only rely on having a particular convention fixed.
I should also point out this way of ordering the wires corresponds to what was briefly discussed as the ``RL'' convention in \cite[Zeilberger and Giorgetti (2015, \S3.1)]{zg2015rpmnpt}, rather than the ``LR'' convention which was mainly used in that paper.}
As an example, the closed linear lambda term $t = \lambda x[\lambda y[x(\lambda z[y(z)])]]$ we considered above denotes a morphism $\sem{t} : 1 \to U$ in any smc bicategory with a reflexive object $U$.
Drawing this 1-cell as a string diagram using the compact closed conventions we get the following picture:
\begin{equation}\label{eqn:lambda-string-diagram}
\vcenter{\hbox{
\begin{tikzpicture}
\node (root) {};
\node (lamx) [above=1em of root] {$\lambda$};
\node (lamy) [above left=1em of lamx] {$\lambda$};
\node (appx) [above=2em of lamy] {$@$};
\node (lamz) [right=2em of appx] {$\lambda$};
\node (appy) [above=1em of lamz] {$@$};
\node (vary) [above right=0.5em and 0em of appy] {};
\node (dumy) [right=2em of lamz] {};
\node (varx) [above right=4em and 1em of appx] {};
\draw[->-] (lamx) to (root.center);
\draw[->-] (lamy) to (lamx);
\draw[->-,bend right=60] (appx) to (lamy);
\draw[->-,bend left=45] (lamz) to (appx);
\draw[->-,bend right=20,rounded corners=5pt] (lamy) to (dumy.center) to (vary.center) to (appy);
\draw[->-,bend right=80,min distance=3cm,rounded corners=5pt] (lamx) to (varx.center) to [bend right=30,min distance=0em] (appx);
\draw[->-,bend right=90] (appy) to (lamz);
\draw[->-,bend right=90] (lamz) to (appy);
\end{tikzpicture}}}
\end{equation}
Observe that this diagram is essentially the same as the one in (\ref{eqn:lambda-graph}), just turned upside down and with explicit orientations on the wires.
The correspondence with the original linear lambda term can be made a bit more evident by labelling the wires with \emph{subterms} of $t$:
$$
\begin{tikzpicture}
\node (root) {};
\node (lamx) [above=1em of root] {$\lambda$};
\node (lamy) [above left=1em of lamx] {$\lambda$};
\node (appx) [above=2em of lamy] {$@$};
\node (lamz) [right=2em of appx] {$\lambda$};
\node (appy) [above=1em of lamz] {$@$};
\node (vary) [above right=0.5em and 0em of appy] {};
\node (dumy) [right=2em of lamz] {};
\node (varx) [above right=4em and 1em of appx] {};
\draw[->-] (lamx) to node [left] {\tiny$t$} (root.center);
\draw[->-] (lamy) to node [left] {\tiny$\lambda y[x(\lambda z[y(z)])]$} (lamx);
\draw[->-,bend right=60] (appx) to node [left] {\tiny$x(\lambda z[y(z)])$} (lamy);
\draw[->-,bend left=45] (lamz) to node [below=-3pt] {\tiny$\lambda z[y(z)]$} (appx);
\draw[->-,bend right=20,rounded corners=5pt] (lamy) to node [right=1pt] {\tiny$y$} (dumy.center) to (vary.center) to (appy);
\draw[->-,bend right=80,min distance=3cm,rounded corners=5pt] (lamx) to node [right] {\tiny$x$} (varx.center) to [bend right=30,min distance=0em] (appx);
\draw[->-,bend right=90] (appy) to node [left=-3pt] {\tiny$y(z)$} (lamz);
\draw[->-,bend right=90] (lamz) to node [right=-2pt] {\tiny$z$} (appy);
\end{tikzpicture}
$$
One thing it is important to point out is that not every physical combination of $@$-nodes and $\lambda$-nodes represents a linear lambda term, a consequence of the fact that not every smc (bi)category is compact closed.
For instance, the diagrams
$$
\vcenter{\hbox{
\begin{tikzpicture}
\node (root) {};
\node (lam) [above=1em of root] {$\lambda$};
\node (lam2) [above left=1em of lam] {$\lambda$};
\node (app) [right=2em of lam] {$@$};
\node (xl) [above=0.5em of lam2] {};
\node (xr) [below=0.5em of app] {};
\draw[->-] (lam) to (root.center);
\draw[->-,bend left=60] (lam) to (app);
\draw[->-] (lam2) to (lam);
\draw[->-,bend right=70,looseness=1] (lam2) to (xl.center) to (lam2);
\draw[->-,bend right=70,looseness=1] (app) to (xr.center) to (app);
\end{tikzpicture}}}
\qquad\text{and}\qquad
\vcenter{\hbox{
\begin{tikzpicture}
\node (root) {};
\node (appx) [above right=1em and 0em of root] {$@$};
\node (lamx) [right=2em of appx] {$\lambda$};
\node (lamy) [above left=1em of lamx] {$\lambda$};
\node (vary) [above=0.5em of lamy] {};
\node (varx) [above=3em of appx] {};
\draw[->-] (appx) to (root.center);
\draw[->-,bend left=60] (lamx) to (appx);
\draw[->-] (lamy) to (lamx);
\draw[->-,bend right=70,looseness=1] (lamy) to (vary.center) to (lamy);
\draw[->-,bend right=70,looseness=1,rounded corners=5pt] (lamx) to (varx.center) to [bend right=10] (appx);
\end{tikzpicture}}}
$$
do not correspond to the interpretation of a linear lambda term.
(This phenomenon is well-known in proof-nets, and is often analyzed by considering additional ``correctness criteria'' for the diagrams.)
Nonetheless, the interpretation of linear lambda terms using reflexive objects in smc bicategories is complete in the following sense:
\begin{claim}[Completeness] \label{claim:completenes}
There is a smc bicategory $\mathcal{K}_\Lambda$ equipped with a reflexive object $U$, such that every 1-cell $f : U^{\otimes k} \to U$ is the interpretation $f = \sem{t}$ of a unique (up to $\alpha$-equivalence) linear lambda term $t$ with $k$ free variables, and such that there is a 2-cell $\sem{t_1} \Rightarrow \sem{t_2}$ if and only if $t_1$ can be rewritten to $t_2$ (up to $\alpha$-equivalence) by a series of $\beta$-reductions and $\eta$-expansions.
\end{claim}
\noindent
The proof essentially follows Hyland's analysis of Scott's Representation Theorem \cite{hyland-lambda-calculus}, replacing cartesian closed categories by smc bicategories.
The idea is to take $\mathcal{K}_\Lambda$ as a presheaf bicategory $[\mathcal{C}^\op,\Cat]$, where $\mathcal{C}$ is a symmetric monoidal bicategory whose 0-cells are contexts, 1-cells are tuples of linear lambda terms, and 2-cells are rewritings between tuples.
The smc structure on $[\mathcal{C}^\op,\Cat]$ is defined by Day convolution, and the reflexive object is constructed as the representable presheaf for a singleton context.
(Note that $[\mathcal{C}^\op,\Cat]$ is \emph{not} compact closed.)
\section{From linear lambda terms to rooted trivalent maps}
\label{sec:linear-trivalent}
Once we view linear lambda calculus through the lens of string diagrams, it is pretty clear how to turn any closed linear lambda term into a rooted trivalent map: just look at its string diagram and forget the distinction between $@$-nodes and $\lambda$-nodes, as well as the orientations on the wires.
Here we apply this transformation on $\lambda x[\lambda y[x(\lambda z[y(z)])]]$ and its corresponding string diagram (\ref{eqn:lambda-string-diagram}):
$$
\vcenter{\hbox{\scalebox{0.9}{
\begin{tikzpicture}
\node (root) {};
\node (lamx) [above=1em of root] {$\lambda$};
\node (lamy) [above left=1em of lamx] {$\lambda$};
\node (appx) [above=2em of lamy] {$@$};
\node (lamz) [right=2em of appx] {$\lambda$};
\node (appy) [above=1em of lamz] {$@$};
\node (vary) [above right=0.5em and 0em of appy] {};
\node (dumy) [right=2em of lamz] {};
\node (varx) [above right=4em and 1em of appx] {};
\draw[->-] (lamx) to (root.center);
\draw[->-] (lamy) to (lamx);
\draw[->-,bend right=60] (appx) to (lamy);
\draw[->-,bend left=45] (lamz) to (appx);
\draw[->-,bend right=20,rounded corners=5pt] (lamy) to (dumy.center) to (vary.center) to (appy);
\draw[->-,bend right=80,min distance=3cm,rounded corners=5pt] (lamx) to (varx.center) to [bend right=30,min distance=0em] (appx);
\draw[->-,bend right=90] (appy) to (lamz);
\draw[->-,bend right=90] (lamz) to (appy);
\end{tikzpicture}}}}
\qquad\mapsto\qquad
\vcenter{\hbox{\scalebox{0.9}{
\begin{tikzpicture}
\node (root) {};
\node (lamx) [above=1em of root] {$\bullet$};
\node (lamy) [above left=1em of lamx] {$\bullet$};
\node (appx) [above=2em of lamy] {$\bullet$};
\node (lamz) [right=2em of appx] {$\bullet$};
\node (appy) [above=1em of lamz] {$\bullet$};
\node (vary) [above right=0.5em and 0em of appy] {};
\node (dumy) [right=2em of lamz] {};
\node (varx) [above right=4em and 1em of appx] {};
\draw (lamx.center) to (root.center);
\draw (lamy.center) to (lamx.center);
\draw[bend right=60] (appx.center) to (lamy.center);
\draw[bend left=45] (lamz.center) to (appx.center);
\draw[bend right=20,rounded corners=5pt] (lamy.center) to (dumy.center) to (vary.center) to (appy.center);
\draw[bend right=80,min distance=3cm,rounded corners=5pt] (lamx.center) to (varx.center) to [bend right=30,min distance=0em] (appx.center);
\draw[bend right=90] (appy.center) to (lamz.center);
\draw[bend right=90] (lamz.center) to (appy.center);
\end{tikzpicture}}}}
$$
Even though we identify $@$-nodes and $\lambda$-nodes, it is important that we take care to remember the \emph{ordering} of the wires around each node, since we are interested in obtaining a combinatorial map rather than an abstract trivalent graph.
Strictly speaking the diagram on the right is not a trivalent map in the sense of \Cref{def:trivalent} since it has a dangling edge, but it can be interpreted as a rooted trivalent map (in the sense of \Cref{def:rooted}) by reading the outgoing trivalent vertex as a ``normal vector'' to the root dart of a map with that vertex smoothed out:
$$
\vcenter{\hbox{\scalebox{0.9}{
\begin{tikzpicture}
\node (root) {};
\node (lamx) [above=1em of root] {$\bullet$};
\node (lamy) [above left=1em of lamx] {$\bullet$};
\node (appx) [above=2em of lamy] {$\bullet$};
\node (lamz) [right=2em of appx] {$\bullet$};
\node (appy) [above=1em of lamz] {$\bullet$};
\node (vary) [above right=0.5em and 0em of appy] {};
\node (dumy) [right=2em of lamz] {};
\node (varx) [above right=4em and 1em of appx] {};
\draw (lamx.center) to (root.center);
\draw (lamy.center) to (lamx.center);
\draw[bend right=60] (appx.center) to (lamy.center);
\draw[bend left=45] (lamz.center) to (appx.center);
\draw[bend right=20,rounded corners=5pt] (lamy.center) to (dumy.center) to (vary.center) to (appy.center);
\draw[bend right=80,min distance=3cm,rounded corners=5pt] (lamx.center) to (varx.center) to [bend right=30,min distance=0em] (appx.center);
\draw[bend right=90] (appy.center) to (lamz.center);
\draw[bend right=90] (lamz.center) to (appy.center);
\end{tikzpicture}}}}
\qquad\leftrightarrow\qquad
\vcenter{\hbox{\scalebox{0.9}{
\begin{tikzpicture}
\node (lamx-inv) {};
\node (lamy) [above left=1em of lamx-inv] {$\bullet$};
\node (appx) [above=2em of lamy] {$\bullet$};
\node (lamz) [right=2em of appx] {$\bullet$};
\node (appy) [above=1em of lamz] {$\bullet$};
\node (vary) [above right=0.5em and 0em of appy] {};
\node (dumy) [right=2em of lamz] {};
\node (varx) [above right=4em and 1em of appx] {};
\draw[bend right=60] (appx.center) to (lamy.center);
\draw[bend left=45] (lamz.center) to (appx.center);
\draw[bend right=20,rounded corners=5pt] (lamy.center) to (dumy.center) to (vary.center) to (appy.center);
\draw[!->-=.2,bend right=10,rounded corners=5pt] (lamy.center) to (lamx-inv.center) to [bend right=80,min distance=2.5cm,rounded corners=5pt] (varx.center) to [bend right=30,min distance=0em] (appx.center);
\draw[bend right=90] (appy.center) to (lamz.center);
\draw[bend right=90] (lamz.center) to (appy.center);
\end{tikzpicture}}}}
$$
Actually, there is a hiccup in performing this last step for the identity term $\mathrm{I} = \lambda x[x]$,
$$
\vcenter{\hbox{
\begin{tikzpicture}
\node (root) {};
\node (lamx) [above=1em of root] {$\lambda$};
\node (varx) [above=0.5em of lamx] {};
\draw[->-] (lamx) to (root.center);
\draw[->-,bend right=70,looseness=1] (lamx) to (varx.center) to (lamx);
\end{tikzpicture}}}
\qquad\mapsto\qquad
\vcenter{\hbox{
\begin{tikzpicture}
\node (root) {};
\node (lamx) [above=1em of root] {$\bullet$};
\node (varx) [above=0.7em of lamx] {};
\draw (lamx.center) to (root.center);
\draw[bend right=90,looseness=1] (lamx.center) to (varx.center) to (lamx.center);
\end{tikzpicture}}}
\qquad\leftrightarrow\qquad
\vcenter{\hbox{
\begin{tikzpicture}
\node (lamx-inv) {};
\node (varx) [above=0.7em of lamx-inv] {};
\draw[!->-=0.2,bend right=90,looseness=1] (lamx-inv.center) to (varx.center) to (lamx-inv.center);
\end{tikzpicture}}}
$$
since the no-vertex map is not technically a rooted map (again in the sense of \Cref{def:rooted}), although studies of the combinatorics of rooted maps often treat the empty map as an exceptional case \cite{tutte1968}.
Both of these minor technical issues will be resolved smoothly once we adopt the more general notion of rooted trivalent map to be described shortly.
The real reason for considering this more general notion, though, is that we would also like to interpret linear lambda terms with free variables as rooted trivalent maps.
Consider the term $x(\lambda z[y(z)])$ with free variables $x$ and $y$, whose string diagram corresponds to a subdiagram of (\ref{eqn:lambda-string-diagram}):
\begin{equation}\label{eqn:subdiagram}
\vcenter{\hbox{\scalebox{0.9}{
\begin{tikzpicture}
\node (root) {};
\node (appx) [above right=1.5em and 0em of root] {$@$};
\node (lamz) [right=2em of appx] {$\lambda$};
\node (appy) [above=1em of lamz] {$@$};
\node (vary) [above=1em of appy] {};
\node (varx) [above=3.4em of appx] {};
\draw[->-] (appx) to (root.center);
\draw[->-,bend left=45] (lamz) to (appx);
\draw[->-] (vary.center) to (appy);
\draw[->-] (varx.center) to (appx);
\draw[->-,bend right=90] (appy) to (lamz);
\draw[->-,bend right=90] (lamz) to (appy);
\end{tikzpicture}}}}
\end{equation}
Identifying $@$-nodes and $\lambda$-nodes in (\ref{eqn:subdiagram}) yields a trivalent map with three dangling edges,
$$
\vcenter{\hbox{\scalebox{0.9}{
\begin{tikzpicture}
\node (root) {};
\node (appx) [above right=1.5em and 0em of root] {$\bullet$};
\node (lamz) [right=2em of appx] {$\bullet$};
\node (appy) [above=1em of lamz] {$\bullet$};
\node (vary) [above=1em of appy] {};
\node (varx) [above=3.2em of appx] {};
\draw (appx.center) to (root.center);
\draw[bend left=45] (lamz.center) to (appx.center);
\draw (vary.center) to (appy.center);
\draw (varx.center) to (appx.center);
\draw[bend right=90] (appy.center) to (lamz.center);
\draw[bend right=90] (lamz.center) to (appy.center);
\end{tikzpicture}}}}
$$
but since it is no longer clear from the diagram which dangling edge marks the root,
we attach an extra univalent vertex to one of them (turning it into a full edge):
$$
\vcenter{\hbox{\scalebox{0.9}{
\begin{tikzpicture}
\node (root) {};
\node (appx) [above right=1.5em and 0em of root] {$@$};
\node (lamz) [right=2em of appx] {$\lambda$};
\node (appy) [above=1em of lamz] {$@$};
\node (vary) [above=1em of appy] {};
\node (varx) [above=3.4em of appx] {};
\draw[->-] (appx) to (root.center);
\draw[->-,bend left=45] (lamz) to (appx);
\draw[->-] (vary.center) to (appy);
\draw[->-] (varx.center) to (appx);
\draw[->-,bend right=90] (appy) to (lamz);
\draw[->-,bend right=90] (lamz) to (appy);
\end{tikzpicture}}}}
\qquad\mapsto\qquad
\vcenter{\hbox{\scalebox{0.9}{
\begin{tikzpicture}
\node (root) {$\bullet$};
\node (appx) [above right=1.5em and 0em of root] {$\bullet$};
\node (lamz) [right=2em of appx] {$\bullet$};
\node (appy) [above=1em of lamz] {$\bullet$};
\node (vary) [above=1em of appy] {};
\node (varx) [above=3.2em of appx] {};
\draw (appx.center) to (root.center);
\draw[bend left=45] (lamz.center) to (appx.center);
\draw (vary.center) to (appy.center);
\draw (varx.center) to (appx.center);
\draw[bend right=90] (appy.center) to (lamz.center);
\draw[bend right=90] (lamz.center) to (appy.center);
\end{tikzpicture}}}}
$$
By considering the output of this transformation on linear lambda terms with any number of free variables we arrive at the following generalization of \Cref{def:rooted}:
\begin{definition}\label{def:rtmb}
For any $\gset{G}$ $X$ and $g\in G$, let $\fixpt{g}(X) \defeq \set{x \in X \mid g * x = x}$, and again take $\trigp \defeq \freegp{v,e \mid v^3 = e^2 = 1}$.
A \definand{rooted trivalent map with boundary} is a transitive $\gset\trigp$ $M$ with a distinguished element $r\in M$ and a list of distinct elements $x_1,\dots,x_k \in M$, such that $\fixpt{v}(M) = \set{r}$ and $\fixpt{e}(M) = \set{x_1,\dots,x_k}$.
We refer to the unique $v$-fixed point as the \definand{root} $r(M)$ of the map, the ordered list of $e$-fixed points as the \definand{boundary} $\Gamma(M)$ of the map, and to the integer $k$ (= the number of $e$-fixed points) as the \definand{degree} of the boundary.
A rooted trivalent map with boundary of degree 0 is called a \definand{closed} rooted trivalent map.
\end{definition}
\noindent
From now on, when we say ``rooted trivalent map'' without qualification we mean rooted trivalent map with boundary in the sense of \Cref{def:rtmb}, referring to the sense of \Cref{def:rooted} as ``classical rooted trivalent map''.
\begin{proposition}\label{prop:bijroot}
For all $n>0$, there is a bijection between closed rooted trivalent maps with $n+1$ trivalent vertices and classical rooted trivalent maps with $n$ trivalent vertices.
This extends to a bijection for all $n \ge 0$ if the empty $\gset\trigp$ is admitted as a classical rooted trivalent map.
\end{proposition}
\begin{proof}
As explained in the first paragraph of this section.
\end{proof}
\noindent
Observe that the simplest possible rooted trivalent map with boundary is the singleton $\gset{\trigp}$ $M = \set{x}$ with $r(M) = \Gamma(M) = x$, corresponding to the trivial map
$\vcenter{\hbox{\scalebox{0.6}{
\begin{tikzpicture}
\node (root) {$\bullet$};
\node (varx) [above=0.5em of root] {};
\draw (varx.center) to (root.center);
\end{tikzpicture}}}}$
with no trivalent vertices and one free edge.
With this definition, it is clear how any linear lambda term induces a rooted trivalent map with boundary.
\begin{proposition}\label{prop:linear-trivalent}
To any linear lambda term with $k$ free variables, $p$ applications and $q$ abstractions there is naturally associated a rooted trivalent map with boundary of degree $k$ and $p+q$ trivalent vertices.
\end{proposition}
\begin{proof}
Consider the string diagram of the term, which has $k$ incoming wires and one outgoing wire, as well as $p$ $@$-nodes and $q$ $\lambda$-nodes internal to the diagram.
Transform $@$-nodes and $\lambda$-nodes into trivalent vertices, attach a univalent vertex to the end of the outgoing wire, and finally forget the orientations of the wires.
The result is manifestly a rooted trivalent map with boundary of degree $k$ and $p+q$ trivalent vertices.
\end{proof}
\noindent
We call the map described in the proof of \Cref{prop:linear-trivalent} the \definand{underlying rooted trivalent map} of a linear lambda term.
Although the high-level description is clear enough, we can also explicitly compute the permutations $v$ and $e$ associated to the underlying rooted trivalent map by induction on the structure of the linear lambda term, which just requires a bit of bookkeeping.
What is somewhat more surprising is that this ``forgetful'' transformation can be reversed -- our next topic.
\section{From rooted trivalent maps to linear lambda terms}
\label{sec:trivalent-linear}
Given a rooted trivalent map $M$ (with a boundary of dangling edges $\Gamma(M)$), our task is to find a linear lambda term (with free variables $\Gamma$) whose underlying rooted trivalent map is $M$ (hopefully, such a linear lambda term always exists and is unique!).
To be able to do this, clearly we will somehow have to decide for each trivalent vertex whether it corresponds to an application ($@$) or an abstraction ($\lambda$).
The trick is that there is always an immediate answer for the trivalent vertex incident to the root: if removing that vertex disconnects the underlying graph then the vertex corresponds to an $@$-node, and otherwise it corresponds to a $\lambda$-node.
In either case, we can re-root the resulting submap(s) (while adjusting the boundary)
$$
\vcenter{\hbox{\scalebox{0.8}{
\begin{tikzpicture}
\node (root) {$\bullet$};
\node (app) [above=1em of root] {$\bullet$};
\node (map1) [above left=1em of app] {$M_1$};
\node (map2) [above right=1em of app] {$M_2$};
\draw (app.center) to (root.center);
\draw (map1) to (app.center);
\draw (map2) to (app.center);
\end{tikzpicture}}}}
\quad\overset{\text{disconnected}}\longrightarrow\quad
\vcenter{\hbox{\scalebox{0.8}{
\begin{tikzpicture}
\node (root) {$\bullet$};
\node (map1) [above=1em of root] {$M_1$};
\draw (map1) to (root.center);
\end{tikzpicture}}}}
+
\vcenter{\hbox{\scalebox{0.8}{
\begin{tikzpicture}
\node (root) {$\bullet$};
\node (map2) [above=1em of root] {$M_2$};
\draw (map2) to (root.center);
\end{tikzpicture}}}}
\qquad\qquad
\vcenter{\hbox{\scalebox{0.8}{
\begin{tikzpicture}
\node (root) {$\bullet$};
\node (lam) [above=1em of root] {$\bullet$};
\node (map1) [above left=1em of lam] {$M_1$};
\draw (lam.center) to (root.center);
\draw (map1) to (lam.center);
\draw[bend right=90,min distance=3em] (lam.center) to (map1);
\end{tikzpicture}}}}
\quad\overset{\text{connected}}\longrightarrow\quad
\vcenter{\hbox{\scalebox{0.8}{
\begin{tikzpicture}
\node (root) {$\bullet$};
\node (map1) [above=1em of root] {$M_1$};
\node (varx) [right=1em of root] {};
\draw (map1) to (root.center);
\draw [bend right=45,min distance=1em] (varx.center) to (map1);
\end{tikzpicture}}}}
$$
and continue the process recursively until we eventually arrive at the trivial map
$\vcenter{\hbox{\scalebox{0.6}{
\begin{tikzpicture}
\node (root) {$\bullet$};
\node (varx) [above=0.5em of root] {};
\draw (varx.center) to (root.center);
\end{tikzpicture}}}}$.
For example, here we start applying this process to a closed rooted trivalent map
$$
\vcenter{\hbox{\scalebox{0.7}{
\begin{tikzpicture}
\node (root) {$\bullet$};
\node (lamx) [above=1em of root] {$\bullet$};
\node (lamy) [above left=1em of lamx] {$\bullet$};
\node (appx) [above=2em of lamy] {$\bullet$};
\node (lamz) [right=2em of appx] {$\bullet$};
\node (appy) [above=1em of lamz] {$\bullet$};
\node (vary) [above right=0.5em and 0em of appy] {};
\node (dumy) [right=2em of lamz] {};
\node (varx) [above right=4em and 1em of appx] {};
\draw (lamx.center) to (root.center);
\draw (lamy.center) to (lamx.center);
\draw[bend right=60] (appx.center) to (lamy.center);
\draw[bend left=45] (lamz.center) to (appx.center);
\draw[bend right=20,rounded corners=5pt] (lamy.center) to (dumy.center) to (vary.center) to (appy.center);
\draw[bend right=80,min distance=3cm,rounded corners=5pt] (lamx.center) to (varx.center) to [bend right=30,min distance=0em] (appx.center);
\draw[bend right=90] (appy.center) to (lamz.center);
\draw[bend right=90] (lamz.center) to (appy.center);
\end{tikzpicture}}}}
\overset{\text{connected}}\longrightarrow\quad
\vcenter{\hbox{\scalebox{0.7}{
\begin{tikzpicture}
\node (root) {$\bullet$};
\node (lamy) [above=1em of root] {$\bullet$};
\node (appx) [above=2em of lamy] {$\bullet$};
\node (lamz) [right=2em of appx] {$\bullet$};
\node (appy) [above=1em of lamz] {$\bullet$};
\node (vary) [above right=0.5em and 0em of appy] {};
\node (dumy) [right=2em of lamz] {};
\node (varx) [above=3em of appx] {};
\draw (lamy.center) to (root.center);
\draw[bend right=60] (appx.center) to (lamy.center);
\draw[bend left=45] (lamz.center) to (appx.center);
\draw[bend right=20,rounded corners=5pt] (lamy.center) to (dumy.center) to (vary.center) to (appy.center);
\draw (varx.center) to (appx.center);
\draw[bend right=90] (appy.center) to (lamz.center);
\draw[bend right=90] (lamz.center) to (appy.center);
\end{tikzpicture}}}}
\quad\overset{\text{connected}}\longrightarro
\vcenter{\hbox{\scalebox{0.7}{
\begin{tikzpicture}
\node (root) {$\bullet$};
\node (appx) [above right=1.5em and 0em of root] {$\bullet$};
\node (lamz) [right=2em of appx] {$\bullet$};
\node (appy) [above=1em of lamz] {$\bullet$};
\node (vary) [above=1em of appy] {};
\node (varx) [above=3.2em of appx] {};
\draw (appx.center) to (root.center);
\draw[bend left=45] (lamz.center) to (appx.center);
\draw (vary.center) to (appy.center);
\draw (varx.center) to (appx.center);
\draw[bend right=90] (appy.center) to (lamz.center);
\draw[bend right=90] (lamz.center) to (appy.center);
\end{tikzpicture}}}}
\quad\overset{\text{disconnected}}\longrightarrow\quad
\vcenter{\hbox{\scalebox{0.7}{
\begin{tikzpicture}
\node (root) {$\bullet$};
\node (varx) [above=1em of root] {};
\draw (varx.center) to (root.center);
\end{tikzpicture}}}}
+
\vcenter{\hbox{\scalebox{0.7}{
\begin{tikzpicture}
\node (root) {$\bullet$};
\node (lamz) [above=1em of root] {$\bullet$};
\node (appy) [above=1em of lamz] {$\bullet$};
\node (vary) [above=1em of appy] {};
\node (varz) [right=1em of vary] {};
\draw (vary.center) to (appy.center);
\draw[bend right=90] (appy.center) to (lamz.center);
\draw[bend right=90] (lamz.center) to (appy.center);
\draw (lamz.center) to (root.center);
\end{tikzpicture}}}}
$$
and continue until we are left with only trivial maps:
$$
\vcenter{\hbox{\scalebox{0.8}{
\begin{tikzpicture}
\node (root) {$\bullet$};
\node (lamz) [above=1em of root] {$\bullet$};
\node (appy) [above=1em of lamz] {$\bullet$};
\node (vary) [above=1em of appy] {};
\node (varz) [right=1em of vary] {};
\draw (vary.center) to (appy.center);
\draw[bend right=90] (appy.center) to (lamz.center);
\draw[bend right=90] (lamz.center) to (appy.center);
\draw (lamz.center) to (root.center);
\end{tikzpicture}}}}
\quad\overset{\text{connected}}\longrightarrow\quad
\vcenter{\hbox{\scalebox{0.8}{
\begin{tikzpicture}
\node (root) {$\bullet$};
\node (appy) [above=1em of root] {$\bullet$};
\node (vary) [above=1em of appy] {};
\node (varz) [right=1em of vary] {};
\draw (vary.center) to (appy.center);
\draw[bend right=90] (appy.center) to (root.center);
\draw[out=-90,in=-60] (varz.center) to (appy.center);
\end{tikzpicture}}}}
\quad\overset{\text{disconnected}}\longrightarrow\quad
\vcenter{\hbox{\scalebox{0.8}{
\begin{tikzpicture}
\node (root) {$\bullet$};
\node (varx) [above=1em of root] {};
\draw (varx.center) to (root.center);
\end{tikzpicture}}}}
+
\vcenter{\hbox{\scalebox{0.8}{
\begin{tikzpicture}
\node (root) {$\bullet$};
\node (varx) [above=1em of root] {};
\draw (varx.center) to (root.center);
\end{tikzpicture}}}}
$$
From the trace of this decomposition, we can reconstruct the necessarily unique linear lambda term whose underlying rooted trivalent map is our original map:
$$
\vcenter{\hbox{\scalebox{0.8}{
\begin{tikzpicture}
\node (root) {};
\node (varx) [above=1em of root] {};
\draw[->-] (varx.center) to (root.center);
\end{tikzpicture}}}}
+
\vcenter{\hbox{\scalebox{0.8}{
\begin{tikzpicture}
\node (root) {};
\node (varx) [above=1em of root] {};
\draw[->-] (varx.center) to (root.center);
\end{tikzpicture}}}}
\quad\underset{@}\longrightarrow\quad
\vcenter{\hbox{\scalebox{0.8}{
\begin{tikzpicture}
\node (root) {};
\node (appy) [above=1em of root] {$@$};
\node (vary) [above=1em of appy] {};
\node (varz) [right=1em of vary] {};
\draw[->-] (vary.center) to (appy);
\draw[->-,bend right=90] (appy) to (root.center);
\draw[->-,out=-90,in=-60] (varz.center) to (appy);
\end{tikzpicture}}}}
\quad\underset{\lambda}\longrightarrow\quad
\vcenter{\hbox{\scalebox{0.8}{
\begin{tikzpicture}
\node (root) {};
\node (lamz) [above=1em of root] {$\lambda$};
\node (appy) [above=1em of lamz] {$@$};
\node (vary) [above=1em of appy] {};
\node (varz) [right=1em of vary] {};
\draw[->-] (vary.center) to (appy);
\draw[->-,bend right=90] (appy) to (lamz);
\draw[->-,bend right=90] (lamz) to (appy);
\draw[->-] (lamz) to (root.center);
\end{tikzpicture}}}}
$$
$$
\vcenter{\hbox{\scalebox{0.7}{
\begin{tikzpicture}
\node (root) {};
\node (varx) [above=1em of root] {};
\draw[->-] (varx.center) to (root.center);
\end{tikzpicture}}}}
+
\vcenter{\hbox{\scalebox{0.7}{
\begin{tikzpicture}
\node (root) {};
\node (lamz) [above=1em of root] {$\lambda$};
\node (appy) [above=1em of lamz] {$@$};
\node (vary) [above=1em of appy] {};
\node (varz) [right=1em of vary] {};
\draw[->-] (vary.center) to (appy);
\draw[->-,bend right=90] (appy) to (lamz);
\draw[->-,bend right=90] (lamz) to (appy);
\draw[->-] (lamz) to (root.center);
\end{tikzpicture}}}}
\quad\underset{@}\longrightarrow\quad
\vcenter{\hbox{\scalebox{0.7}{
\begin{tikzpicture}
\node (root) {};
\node (appx) [above right=1.5em and 0em of root] {$@$};
\node (lamz) [right=2em of appx] {$\lambda$};
\node (appy) [above=1em of lamz] {$@$};
\node (vary) [above=1em of appy] {};
\node (varx) [above=3.2em of appx] {};
\draw[->-] (appx) to (root.center);
\draw[->-,bend left=45] (lamz) to (appx);
\draw[->-] (vary.center) to (appy);
\draw[->-] (varx.center) to (appx);
\draw[->-,bend right=90] (appy) to (lamz);
\draw[->-,bend right=90] (lamz) to (appy);
\end{tikzpicture}}}}
\quad\underset{\lambda}\longrightarrow\quad
\vcenter{\hbox{\scalebox{0.7}{
\begin{tikzpicture}
\node (root) {};
\node (lamy) [above=1em of root] {$\lambda$};
\node (appx) [above=2em of lamy] {$@$};
\node (lamz) [right=2em of appx] {$\lambda$};
\node (appy) [above=1em of lamz] {$@$};
\node (vary) [above right=0.5em and 0em of appy] {};
\node (dumy) [right=2em of lamz] {};
\node (varx) [above=3em of appx] {};
\draw[->-] (lamy) to (root.center);
\draw[->-,bend right=60] (appx) to (lamy);
\draw[->-,bend left=45] (lamz) to (appx);
\draw[->-,bend right=20,rounded corners=5pt] (lamy) to (dumy.center) to (vary.center) to (appy);
\draw[->-] (varx.center) to (appx);
\draw[->-,bend right=90] (appy) to (lamz);
\draw[->-,bend right=90] (lamz) to (appy);
\end{tikzpicture}}}}
\quad\underset{\lambda}\longrightarrow\quad
\vcenter{\hbox{\scalebox{0.7}{
\begin{tikzpicture}
\node (root) {};
\node (lamx) [above=1em of root] {$\lambda$};
\node (lamy) [above left=1em of lamx] {$\lambda$};
\node (appx) [above=2em of lamy] {$@$};
\node (lamz) [right=2em of appx] {$\lambda$};
\node (appy) [above=1em of lamz] {$@$};
\node (vary) [above right=0.5em and 0em of appy] {};
\node (dumy) [right=2em of lamz] {};
\node (varx) [above right=4em and 1em of appx] {};
\draw[->-] (lamx) to (root.center);
\draw[->-] (lamy) to (lamx);
\draw[->-,bend right=60] (appx) to (lamy);
\draw[->-,bend left=45] (lamz) to (appx);
\draw[->-,bend right=20,rounded corners=5pt] (lamy) to (dumy.center) to (vary.center) to (appy);
\draw[->-,bend right=80,min distance=3cm,rounded corners=5pt] (lamx) to (varx.center) to [bend right=30,min distance=0em] (appx);
\draw[->-,bend right=90] (appy) to (lamz);
\draw[->-,bend right=90] (lamz) to (appy);
\end{tikzpicture}}}}
$$
\begin{theorem}\label{thm:trivalent-linear}
To any rooted trivalent map $M$ with boundary of degree $k$ and $n$ trivalent vertices there is a unique linear lambda term with $k$ free variables, $p$ applications and $q$ abstractions whose underlying rooted trivalent map is $M$, for some $p+q = n$.
\end{theorem}
\begin{proof}
As sketched above, by induction on $n$.
Note that uniqueness relies on the fact that we define rooted trivalent maps with boundary as equipped with a fixed ordering on dangling edges, which determines the ordering of the free variables inside the context of the corresponding linear lambda term.
\end{proof}
\begin{corollary}\label{corr:bijection}
Rooted trivalent maps with boundary of degree $k$ and $n$ trivalent vertices are in one-to-one correspondence with linear lambda terms with $k$ free variables and $n$ total applications and abstractions.
Both families are counted by the generating function satisfying the functional-differential equation (\ref{eqn:lingf}).
\end{corollary}
\begin{example}\label{ex:bc}
The standard linear combinators \cite{curryhindleysendlin} $\mathrm{B} = \lambda x[\lambda y[\lambda z[x(yz)]]]$ and $\mathrm{C} = \lambda x[\lambda y[\lambda z[(xz)y]]]$ correspond to two different rooted embeddings of the $K_4$ graph (respectively, a planar embedding and a toric one):
$$
\vcenter{\hbox{\scalebox{1}{
\begin{tikzpicture}
\node (a) at (-1,0) {$\bullet$};
\node (b) at (0,1.73) {$\bullet$};
\node (c) at (1,0) {$\bullet$};
\node (d) at (0,0.7) {$\bullet$};
\node (e) at (0,0) {$\bullet$};
\node (root) at (0,-0.5) {$\bullet$};
\draw (a.center) to (b.center);
\draw (b.center) to (c.center);
\draw (c.center) to (e.center);
\draw (e.center) to (a.center);
\draw (e.center) to (root.center);
\draw (a.center) to (d.center);
\draw (b.center) to (d.center);
\draw (d.center) to (c.center);
\end{tikzpicture}
}}}
\quad\mapsfrom\quad
\vcenter{\hbox{\scalebox{1}{
\begin{tikzpicture}
\node (a) at (-1,0) {$\lambda$};
\node (b) at (0,1.73) {$\lambda$};
\node (c) at (1,0) {$@$};
\node (d) at (0,0.7) {$@$};
\node (e) at (0,0) {$\lambda$};
\node (root) at (0,-0.75) {};
\draw [->-] (b) to (a);
\draw [->-] (c) to (b);
\draw [->-] (e) to (c);
\draw [->-] (a) to (e);
\draw [->-] (e) to (root);
\draw [->-] (a) to (d);
\draw [->-] (b) to (d);
\draw [->-] (d) to (c);
\end{tikzpicture}
}}
$$
$$
\vcenter{\hbox{\scalebox{1}{
\begin{tikzpicture}
\node (a) at (-1,0) {$\bullet$};
\node (b) at (-1,2) {$\bullet$};
\node (c) at (1,0) {$\bullet$};
\node (d) at (1,2) {$\bullet$};
\node (e) at (0,0) {$\bullet$};
\node (root) at (0,-0.5) {$\bullet$};
\draw (a.center) to (b.center);
\draw (b.center) to (c.center);
\draw (c.center) to (e.center);
\draw (e.center) to (a.center);
\draw (e.center) to (root.center);
\draw (a.center) to (d.center);
\draw (b.center) to (d.center);
\draw (d.center) to (c.center);
\end{tikzpicture}
}}}
\quad\mapsfrom\quad
\vcenter{\hbox{\scalebox{1}{
\begin{tikzpicture}
\node (a) at (-1,0) {$\lambda$};
\node (b) at (-1,2) {$\lambda$};
\node (c) at (1,0) {$@$};
\node (d) at (1,2) {$@$};
\node (e) at (0,0) {$\lambda$};
\node (root) at (0,-0.75) {};
\draw [->-] (b) to (a);
\draw [->-] (d) to (b);
\draw [->-] (e) to (c);
\draw [->-] (a) to (e);
\draw [->-] (e) to (root);
\draw [!->-=0.25] (a) to (d);
\draw [!->-=0.25] (b) to (c);
\draw [->-] (c) to (d);
\end{tikzpicture}
}}}
$$
\end{example}
\begin{example}\label{ex:petersen}
A rooted embedding of the Petersen graph, and its corresponding linear lambda term ($\lambda a[\lambda b[\lambda c[\lambda d[\lambda e[a(\lambda f[c(e(b(d(f))))])]]]]]$):
$$
\vcenter{\hbox{\scalebox{1}{
\begin{tikzpicture}
\node (0) at (-1, -0.5) {$\bullet$};
\node (root) at (0, -1) {$\bullet$};
\node (2) at (-1.5, 1.25) {$\bullet$};
\node (3) at (1, -0.5) {$\bullet$};
\node (4) at (0, 2.5) {$\bullet$};
\node (5) at (1.5, 1.25) {$\bullet$};
\node (6) at (0, -0.5) {$\bullet$};
\node (7) at (-0.75, 1) {$\bullet$};
\node (8) at (0, 1.5) {$\bullet$};
\node (9) at (0.75, 1) {$\bullet$};
\node (10) at (-0.5, 0.25) {$\bullet$};
\node (11) at (0.5, 0.25) {$\bullet$};
\draw (0.center) to (2.center);
\draw (5.center) to (3.center);
\draw (4.center) to (5.center);
\draw (2.center) to (4.center);
\draw (6.center) to (0.center);
\draw (3.center) to (6.center);
\draw (6.center) to (root.center);
\draw (4.center) to (8.center);
\draw (10.center) to (8.center);
\draw (9.center) to (10.center);
\draw (7.center) to (9.center);
\draw (11.center) to (7.center);
\draw (8.center) to (11.center);
\draw (5.center) to (9.center);
\draw (2.center) to (7.center);
\draw (10.center) to (0.center);
\draw (3.center) to (11.center);
\end{tikzpicture}}}}
\qquad\mapsfrom\qquad
\vcenter{\hbox{\scalebox{1}{
\begin{tikzpicture}
\node (0) at (-1, -0.5) {$\lambda$};
\node (root) at (0, -1.25) {};
\node (2) at (-1.5, 1.25) {$\lambda$};
\node (3) at (1, -0.5) {$@$};
\node (4) at (0, 2.5) {$\lambda$};
\node (5) at (1.5, 1.25) {$\lambda$};
\node (6) at (0, -0.5) {$\lambda$};
\node (7) at (-0.75, 1) {$@$};
\node (8) at (0, 1.5) {$@$};
\node (9) at (0.75, 1) {$@$};
\node (10) at (-0.5, 0.25) {$@$};
\node (11) at (0.5, 0.25) {$\lambda$};
\draw [->-] (2) to (0);
\draw [->-] (3) to (5);
\draw [->-] (5) to (4);
\draw [->-] (4) to (2);
\draw [->-] (0) to (6);
\draw [->-] (6) to (3);
\draw [->-] (6) to (root);
\draw [->-] (4) to (8);
\draw [->-] (8) to (10);
\draw [->-] (10) to (9);
\draw [->-] (9) to (7);
\draw [->-] (7) to (11);
\draw [->-] (11) to (8);
\draw [->-] (5) to (9);
\draw [->-] (2) to (7);
\draw [->-] (0) to (10);
\draw [->-] (11) to (3);
\end{tikzpicture}}}}
$$
\end{example}
\section{Indecomposable linear lambda terms and the 4CT}
\label{sec:4ct}
Recall that a \emph{bridge} in a connected graph is any edge whose removal disconnects the graph.
Among the first five non-trivial closed rooted trivalent maps, exactly three of them contain bridges (we do not count the outgoing root edge as a bridge):
$$
\vcenter{\hbox{\scalebox{0.8}{
\begin{tikzpicture}
\node (root) {$\bullet$};
\node (lamx) [above=1em of root] {$\bullet$};
\node (appx) [above=1em of lamx] {$\bullet$};
\node (varx) [above right=2em and 0em of appx] {};
\node (lamy) [right=1em of appx] {$\bullet$};
\node (vary) [above=0.6em of lamy] {};
\draw[] (lamx.center) to (root.center);
\draw[bend right=45] (appx.center) to (lamx.center);
\draw[bend left=45,dotted] (lamy.center) to (appx.center);
\draw[bend right=80,rounded corners=5pt,min distance=2cm] (lamx.center) to (varx.center) to [bend right=10,min distance=0em] (appx.center);
\draw[bend right=90] (lamy.center) to (vary) to (lamy.center);
\end{tikzpicture}}}}
\qquad
\vcenter{\hbox{\scalebox{0.8}[0.6]{
\begin{tikzpicture}
\node (root) {$\bullet$};
\node (lamx) [above=1em of root] {$\bullet$};
\node (lamy) [above left=1em and 0em of lamx] {$\bullet$};
\node (appx) [above=2em of lamy] {$\bullet$};
\node (varx) [above right=1em and 0em of appx] {};
\draw[] (lamx.center) to (root.center);
\draw[] (lamy.center) to (lamx.center);
\draw[bend right=60] (appx.center) to (lamy.center);
\draw[bend right=45] (lamy.center) to (appx.center);
\draw[bend right=80,rounded corners=5pt] (lamx.center) to (varx.center) to [bend right=30] (appx.center);
\end{tikzpicture}}}}
\qquad
\vcenter{\hbox{\scalebox{0.8}[0.6]{
\begin{tikzpicture}
\node (root) {$\bullet$};
\node (lamx) [above=1em of root] {$\bullet$};
\node (lamy) [above left=1em and 0em of lamx] {$\bullet$};
\node (appx) [above=2em of lamy] {$\bullet$};
\node (varx) [above right=1em and 0em of appx] {};
\draw[] (lamx.center) to (root.center);
\draw[] (lamy.center) to (lamx.center);
\draw[bend right=60] (appx.center) to (lamy.center);
\draw[bend right=45,rounded corners=5pt] (lamy.center) to (varx.center) to (appx.center);
\draw[bend right=45] (lamx.center) to (appx.center);
\end{tikzpicture}}}}
\qquad
\vcenter{\hbox{\scalebox{0.8}[0.6]{
\begin{tikzpicture}
\node (root) {$\bullet$};
\node (lamx) [above=1em of root] {$\bullet$};
\node (appx) [above=1em of lamx] {$\bullet$};
\node (lamy) [above=1em of appx] {$\bullet$};
\node (vary) [above=0.6em of lamy] {};
\draw[] (lamx.center) to (root.center);
\draw[,bend right=45] (appx.center) to (lamx.center);
\draw[bend right=45] (lamx.center) to (appx.center);
\draw[dotted] (lamy.center) to (appx.center);
\draw[bend right=90] (lamy.center) to (vary) to (lamy.center);
\end{tikzpicture}}}}
\qquad
\vcenter{\hbox{\scalebox{0.8}{
\begin{tikzpicture}
\node (root) {$\bullet$};
\node (appx) [above right=1em and 0em of root] {$\bullet$};
\node (lamy) [right=1.5em of appx] {$\bullet$};
\node (vary) [above=0.6em of lamy] {};
\node (lamx) [above=1em of appx] {$\bullet$};
\node (varx) [above=0.6em of lamx] {};
\draw[] (appx.center) to (root.center);
\draw[bend left=45,dotted] (lamy.center) to (appx.center);
\draw[dotted] (lamx.center) to (appx.center);
\draw[bend right=90] (lamx.center) to (varx) to (lamx.center);
\draw[bend right=90] (lamy.center) to (vary) to (lamy.center);
\end{tikzpicture}}}}
$$
If we look at the corresponding string diagrams,
$$
\vcenter{\hbox{\scalebox{0.8}{
\begin{tikzpicture}
\node (root) {};
\node (lamx) [above=1em of root] {$\lambda$};
\node (appx) [above=1em of lamx] {$@$};
\node (varx) [above right=2em and 0em of appx] {};
\node (lamy) [right=1em of appx] {$\lambda$};
\node (vary) [above=0.6em of lamy] {};
\draw[->-] (lamx) to (root.center);
\draw[->-,bend right=45] (appx) to (lamx);
\draw[->-,bend left=45] (lamy) to (appx);
\draw[->-,bend right=80,rounded corners=5pt,min distance=2cm] (lamx) to (varx.center) to [bend right=10,min distance=0em] (appx);
\draw[->-,bend right=90] (lamy) to (vary) to (lamy);
\end{tikzpicture}}}}
\qquad
\vcenter{\hbox{\scalebox{0.8}{
\begin{tikzpicture}
\node (root) {};
\node (lamx) [above=1em of root] {$\lambda$};
\node (lamy) [above left=0.5em and 0em of lamx] {$\lambda$};
\node (appx) [above=2em of lamy] {$@$};
\node (varx) [above right=1em and 0em of appx] {};
\draw[->-] (lamx) to (root.center);
\draw[->-] (lamy) to (lamx);
\draw[->-,bend right=60] (appx) to (lamy);
\draw[->-,bend right=45] (lamy) to (appx);
\draw[->-,bend right=80,rounded corners=5pt] (lamx) to (varx.center) to [bend right=30] (appx);
\end{tikzpicture}}}}
\qquad
\vcenter{\hbox{\scalebox{0.8}{
\begin{tikzpicture}
\node (root) {};
\node (lamx) [above=1em of root] {$\lambda$};
\node (lamy) [above left=0.5em and 0em of lamx] {$\lambda$};
\node (appx) [above=2em of lamy] {$@$};
\node (varx) [above right=1em and 0em of appx] {};
\draw[->-] (lamx) to (root.center);
\draw[->-] (lamy) to (lamx);
\draw[->-,bend right=60] (appx) to (lamy);
\draw[->-,bend right=45,rounded corners=5pt] (lamy) to (varx.center) to (appx);
\draw[->-,bend right=45] (lamx) to (appx);
\end{tikzpicture}}}}
\qquad
\vcenter{\hbox{\scalebox{0.8}{
\begin{tikzpicture}
\node (root) {};
\node (lamx) [above=1em of root] {$\lambda$};
\node (appx) [above=1em of lamx] {$@$};
\node (lamy) [above=1em of appx] {$\lambda$};
\node (vary) [above=0.6em of lamy] {};
\draw[->-] (lamx) to (root.center);
\draw[->-,bend right=45] (appx) to (lamx);
\draw[->-,bend right=45] (lamx) to (appx);
\draw[->-] (lamy) to (appx);
\draw[->-,bend right=90] (lamy) to (vary) to (lamy);
\end{tikzpicture}}}}
\qquad
\vcenter{\hbox{\scalebox{0.8}{
\begin{tikzpicture}
\node (root) {};
\node (appx) [above right=1em and 0em of root] {$@$};
\node (lamy) [right=1.5em of appx] {$\lambda$};
\node (vary) [above=0.6em of lamy] {};
\node (lamx) [above=1em of appx] {$\lambda$};
\node (varx) [above=0.6em of lamx] {};
\draw[->-] (appx) to (root.center);
\draw[->-,bend left=45] (lamy) to (appx);
\draw[->-] (lamx) to (appx);
\draw[->-,bend right=90] (lamx) to (varx) to (lamx);
\draw[->-,bend right=90] (lamy) to (vary) to (lamy);
\end{tikzpicture}}}}
$$
we see that each of the bridges corresponds to a wire oriented towards an $@$-node (either in function or in argument position), and that it sends a \emph{closed subterm} of the underlying linear lambda term (in these three cases an identity term $\mathrm{I}$) to that $@$-node.
\begin{definition}\label{def:subterm}
Let $(\Gamma,t)$ be a linear lambda term.
A \definand{subterm} of $(\Gamma,t)$ is a linear lambda term $(\Delta,u)$ that appears in the derivation of $\Gamma \vdash t$.
Explicitly:
\begin{itemize}
\item $(\Gamma,t)$ is a subterm of itself;
\item if $t = t_1(t_2)$ for some $\Gamma_1 \vdash t_1$ and $\Gamma_2 \vdash t_2$, then every subterm $(\Delta,u)$ of $(\Gamma_1,t_1)$ or $(\Gamma_2,t_2)$ is also a subterm of $(\Gamma,t)$; and
\item if $t = \lambda x.t_1$ for some $\Gamma,x \vdash t_1$, then every subterm $(\Delta,u)$ of $((\Gamma,x),t_1)$ is also a subterm of $(\Gamma,t)$.
\end{itemize}
We refer to all the subterms of $(\Gamma,t)$ other than $(\Gamma,t)$ itself as \definand{proper subterms}.
\end{definition}
\begin{definition}\label{def:indecomposable}
A linear lambda term is said to be \definand{decomposable} if it has a closed proper subterm, and \definand{indecomposable} otherwise.
\end{definition}
\begin{proposition}\label{claim:bridgeless}
A closed rooted trivalent map is bridgeless if and only if the corresponding closed linear lambda term is indecomposable.
\end{proposition}
\noindent
To prove this claim, let's first recall the notion of the \emph{lambda lifting} of a term with free variables.
\begin{definition}
Let $(\Gamma,t)$ be a linear lambda term, where $\Gamma = (x_1,\dots,x_k)$.
The \definand{lambda lifting} of $(\Gamma,t)$ is the closed linear lambda term $\llift{\Gamma}t \defeq \lambda x_1[\cdots\lambda x_k[t]\cdots]$.
\end{definition}
\begin{proof}[Proof of \Cref{claim:bridgeless}]
By \Cref{thm:trivalent-linear}, it suffices to do an induction over linear lambda terms, and check whether the underlying rooted trivalent map of their lambda lifting contains a bridge (and again, we do not count the outgoing root edge itself as a bridge).
From examination of the root-deletion procedure, it is immediate that the only way of potentially introducing a bridge is by using an $@$-node to form an application $t = t_1(t_2)$, so we just have to check whether or not removing the edge corresponding to either the function port ($t_1$) or argument port ($t_2$) of the $@$-node disconnects the diagram of $\llift{\Gamma}t$.
Well, if $t_i$ has a free variable $x$, then the subdiagram rooted at $t_i$ will remain connected to the root port of $\llift{\Gamma}t$, by a path running through the root port of the $\lambda$-node for $x$.
Hence, the edge corresponding to $t_i$ is a bridge in the underlying rooted trivalent map of $\llift{\Gamma}t$ just in case $t_i$ is closed.
\end{proof}
\noindent
This analysis immediately suggests a way of enumerating bridgeless rooted trivalent maps.
\begin{proposition}
The generating function $\GFlinind(z,x)$ counting indecomposable linear lambda terms by size (= number of applications and abstractions) and number of free variables satisfies the following functional-differential equation:
\begin{equation}
\GFlinind(z,x) = x + z(\GFlinind(z,x)-\GFlinind(z,0))^2 + z\frac{\partial}{\partial x}\GFlinind(z,x)
\label{eqn:lingf-ind}
\end{equation}
In particular, the OGF $$\GFlinind(z,0) = z + 2z^3 + 20z^5 + 352 z^7 + 8624^9 + 266784 z^{11} + \dots$$
counts closed indecomposable linear lambda terms by size, as well as closed bridgeless rooted trivalent maps (on oriented surfaces of arbitrary genus) by number of trivalent vertices.
\end{proposition}
\noindent
Now, let us say that a linear lambda term is \definand{planar} just in case its underlying rooted trivalent map is planar.
Planar lambda terms have the special property that after we've fixed the convention for ordering wires around $@$-nodes and $\lambda$-nodes, there is always exactly one planar term with any given underlying tree of applications and abstractions (see \cite[Zeilberger and Giorgetti (2015, \S2)]{zg2015rpmnpt}).
This makes them easy to count, and the following ``discrete analogues'' of (\ref{eqn:lingf}) and (\ref{eqn:lingf-ind}) define the two-variable generating functions for planar lambda terms and indecomposable planar lambda terms, respectively:
\begin{align}
\GFpla(z,x) &= x + z\GFpla(z,x)^2 + z\frac{\GFpla(z,x) - \GFpla(z,0)}{x} \label{eqn:plagf} \\
\GFplaind(z,x) &= x + z(\GFplaind(z,x)-\GFplaind(z,0))^2 + z\frac{\GFplaind(z,x) - \GFplaind(z,0)}{x} \label{eqn:plagf-ind}
\end{align}
In particular, the OGF $\GFplaind(z,0) = z + z^3 + 4z^5 + 24 z^7 + 176 z^9 + 1456 z^{11} + \dots$ counts rooted bridgeless planar trivalent maps by number of trivalent vertices, as originally enumerated by Tutte \shortcite{tutte1962} (OEIS \href{https://oeis.org/A000309}{A000309}; keep in mind that we define closed rooted trivalent maps to contain one extra trivalent vertex relative to the classical definition, cf.~\Cref{prop:bijroot}).
Bridgeless planar trivalent maps are closely related to the Four Color Theorem: by Tait's well-known reduction \cite{thomas98}, the statement that every bridgeless planar map has a proper 4-coloring of its faces is equivalent to the statement that every bridgeless planar trivalent map has a proper 3-coloring of its edges, i.e., a labelling of the edges by colors in $\set{R,G,B}$ such that every vertex has the form
$$
\vcenter{\hbox{\begin{tikzpicture}
\node (R) at (0,0.6) {};
\node (G) at (0.5,-0.5) {};
\node (B) at (-0.5,-0.5) {};
\node (v) at (0,0) {$\bullet$};
\path
(R) edge [red] node [near start,right,black] {\tiny R} (v.center)
(G) edge [darkgreen] node [near start,right,black] {\tiny G} (v.center)
(B) edge [blue] node [near start,left,black] {\tiny B} (v.center);
\node (vp) at (0,0) {$\bullet$};
\end{tikzpicture}}}
\qquad\text{or}\qquad
\vcenter{\hbox{\begin{tikzpicture}
\node (R) at (0,0.6) {};
\node (B) at (0.5,-0.5) {};
\node (G) at (-0.5,-0.5) {};
\node (v) at (0,0) {$\bullet$};
\path
(R) edge [red] node [near start,right,black] {\tiny R} (v.center)
(B) edge [blue] node [near start,right,black] {\tiny B} (v.center)
(G) edge [darkgreen] node [near start,left,black] {\tiny G} (v.center);
\node (vp) at (0,0) {$\bullet$};
\end{tikzpicture}}}.
$$
For the purposes of coloring, there is little difference between rooted and unrooted maps: without loss of generality, it suffices to root a trivalent map $M$ arbitrarily at some edge by splitting it with a trivalent vertex, assign both halves of that edge the same arbitrary color
($
\vcenter{\hbox{\scalebox{0.6}{
\begin{tikzpicture}
\node (root) at (0,-0.3) {$\bullet$};
\node (Rl) at (0.5,0.5) {};
\node (Rr) at (-0.5,0.5) {};
\node (v) at (0,0) {$\bullet$};
\node (map) at (0,0.5) {$M$};
\path
(root.center) edge (v.center)
(Rl.center) edge [red] node [near end,right,black] {\tiny R} (v.center)
(Rr.center) edge [red] node [near end,left,black] {\tiny R} (v.center)
(Rl.center) edge [dotted,bend right=90] (Rr.center);
\node (vp) at (0,0) {$\bullet$};
\end{tikzpicture}}}}
$),
and then look for a proper 3-coloring of the remaining edges.
It seems that the problem of 3-coloring the edges of a rooted trivalent map may be naturally formulated as a \emph{typing} problem in linear lambda calculus.
Typing for linear lambda calculus is standardly defined by the following rules:
\begin{equation}\label{eqn:typing}
\infer{x:X \vdash x:X}{}
\quad
\infer{\Gamma,\Delta \vdash t(u) : Y}{\Gamma \vdash t : \impL[Y]{X} & \Delta \vdash u : X}
\quad
\infer{\Gamma \vdash \lambda x[t] : \impL[Y]{X}}{\Gamma,x:X \vdash t : Y}
\quad
\quad
\infer{\Gamma, x:X,y:Y,\Delta \vdash t:Z}{\Gamma, y:Y,x:X,\Delta \vdash t : Z}
\end{equation}
General types ($X,Y,\dots$) are built up from some set of type variables ($\alpha,\beta,\dots$) using only implication ($\impL[Y]{X}$), and the typing judgment $x_1:X_1,\dots,x_k:X_k \vdash t:Y$ expresses that the given term $t$ has type $Y$ assuming that the free variables have the prescribed types $X_1,\dots,X_k$.
In this way, closed linear lambda terms can be seen as proofs of tautologies in a very weak, purely implicative logic (sometimes called BCI logic, after the combinators $\mathrm{B}$, $\mathrm{C}$, and $\mathrm{I}$).
Moreover, planar lambda terms are typable without using the rightmost rule, resulting in an even weaker logic.
The standard typing rules can also be expressed concisely using string diagrams, where they correspond to the following conditions for annotating the wires by types (cf.~\cite{mairson2002dilbert,z2015balanced}):
$$
\vcenter{\hbox{\begin{tikzpicture}
\node (fn) {};
\node (app) [below=1em of fn] {$@$};
\node (cont) [below left=1em of app] {};
\node (arg) [below right=1em of app] {};
\path
(fn.center) edge [->-] node [near start,right] {\tiny$\impL[Y]{X}$} (app)
(app) edge [->-] node [near end,left] {\tiny$Y$} (cont.center)
(arg.center) edge [->-] node [near start,right] {\tiny$X$} (app);
\end{tikzpicture}}}
\qquad\qquad
\vcenter{\hbox{\begin{tikzpicture}
\node (root) {};
\node (lam) [above=1em of root] {$\lambda$};
\node (var) [above right=1em of lam] {};
\node (body) [above left=1em of lam] {};
\path
(lam) edge [->-] node [near end,right] {\tiny$\impL[Y]{X}$} (root.center)
(lam) edge [->-] node [near end,right] {\tiny$X$} (var.center)
(body.center) edge [->-] node [near start,left=1pt] {\tiny$Y$} (lam);
\end{tikzpicture}}}
$$
In this form, the connection to edge-coloring is more suggestive.
Indeed, we can use a specific interpretation of types in order to obtain a new reformulation of the map coloring theorem (cf.~\cite{penrose,kauffman1990,barnatan97}):
Recall that the \emph{Klein Four Group} can be defined as a group whose underlying set has four elements $\mathbb{V} = \set{1,R,G,B}$, with unit element 1 and the following multiplication table for non-unit elements:
$$
\begin{array}{c|ccc}
& R & G & B \\
\hline
R & 1 & B & G \\
G & B & 1 & R\\
B & G & R & 1
\end{array}
$$
Observe that the product operation of the Klein Four Group is commutative $xy = yx$, and that every element is its own inverse $x^{-1} = x$.
\begin{definition}
We write $\vdash_{\mathbb V}$ for the typing judgment induced from (\ref{eqn:typing}) by restricting types to elements of the Klein Four Group $\mathbb{V}$ and interpreting implication by $x \ImpL y = yx^{-1} = xy$ for all $x,y \in \mathbb{V}$.
A \definand{3-typing} of a linear lambda term $t$ with free variables $x_1,\dots,x_k$ is defined as a derivation of the typing judgment $x_1:X_1,\dots,x_k:X_k \vdash_{\mathbb{V}} t:Y$ for some $X_1,\dots,X_k$ and $Y$ in $\mathbb{V}$.
The 3-typing is said to be \definand{proper} if no proper subterm of $t$ is assigned type 1.
\end{definition}
\begin{theorem}[Reformulation of 4CT]
{\it Every planar indecomposable linear lambda term has a proper 3-typing.}
\end{theorem}
\begin{example}\label{ex:3color-b}
The $\mathrm{B}$ combinator (\Cref{ex:bc}) has most general type
$$\mathrm{B} : \impL[({\impL[{(\impL[\gamma]{\alpha})}]{(\impL[\beta]{\alpha})}})]{(\impL[\gamma]{\beta})}$$
corresponding to the following formal typing derivation with type variables $\alpha,\beta,\gamma$:
$$
\infer{\vdash \lambda x[\lambda y[\lambda z[x(yz)]]] : \impL[({\impL[{(\impL[\gamma]{\alpha})}]{(\impL[\beta]{\alpha})}})]{(\impL[\gamma]{\beta})}}{
\infer{x :\impL[\gamma]{\beta} \vdash \lambda y[\lambda z[x(yz)]] : \impL[{(\impL[\gamma]{\alpha})}]{(\impL[\beta]{\alpha})}}{
\infer{x :\impL[\beta]{\alpha}, y : \impL[\beta]{\alpha} \vdash \lambda z[x(yz)] : \impL[\gamma]{\alpha}}{
\infer{x :\impL[\beta]{\alpha}, y : \impL[\beta]{\alpha}, z : \alpha \vdash x(yz) : \gamma}{
\infer{x :\impL[\gamma]{\beta} \vdash x :\impL[\gamma]{\beta}}{} &
\infer{y : \impL[\beta]{\alpha}, z : \alpha \vdash y(z) : \beta}{
\infer{y : \impL[\beta]{\alpha} \vdash y : \impL[\beta]{\alpha}}{} &
\infer{z : \alpha \vdash z : \alpha}{}
}}}}}
$$
Instantiating $\alpha = R$, $\beta = B$, and $\gamma = G$, we obtain a proper 3-typing of the combinator:
$$
\vcenter{\hbox{\scalebox{1}{
\begin{tikzpicture}[scale=2]
\node (a) at (-1,0) {$\lambda$};
\node (b) at (0,1.73) {$\lambda$};
\node (c) at (1,0) {$@$};
\node (d) at (0,0.7) {$@$};
\node (e) at (0,0) {$\lambda$};
\node (root) at (0,-0.75) {};
\draw [->-,blue] (b) to node [left] {\tiny$\lambda z[x(yz)]:B$} (a);
\draw [->-,color=darkgreen] (c) to node [right] {\tiny$x(yz):G$} (b);
\draw [->-,red] (e) to node [below] {\tiny$x:R$} (c);
\draw [->-,red] (a) to node [below] {\tiny$\lambda y[\lambda z[x(yz)]]:R$} (e);
\draw [->-] (e) to node [left] {\tiny$\mathrm{B} : 1$} (root);
\draw [->-,color=darkgreen] (a) to node [above=0.0]{\tiny$y:G$} (d);
\draw [->-,red] (b) to node [right=-0.1]{\tiny$z:R$} (d);
\draw [->-,blue] (d) to node [above=0.07]{\tiny$y(z):B$} (c);
\end{tikzpicture}
}}}
$$
\end{example}
\noindent
{\bf Acknowledgments.}
I am grateful to Alain Giorgetti for introducing me to the idea of Tutte decomposition and for emphasizing its importance as a way of representing rooted maps.
Special thanks to Andrej Bauer for inviting me to give a talk at the University of Ljubljana Foundations Seminar, which was the original impetus for writing this article.
Thanks also to Doron Zeilberger for helpful comments on an earlier draft, as well as to the anonymous referees.
Finally, this work has been funded by the ERC Advanced Grant ProofCert.
\bibliographystyle{abbrvnat}
| {'timestamp': '2017-05-05T02:05:27', 'yymm': '1512', 'arxiv_id': '1512.06751', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06751'} | arxiv |
\section{Introduction}
Sparse coding has been successfully applied to numerous computer vision tasks, including face recognition \cite{jwright}, scene categorization \cite{local_sparse_coding} and object detection \cite{Agarwal02}. Application of sparse representation-based classifier (SRC) on face recognition \cite{jwright} demonstrates a startling robustness over noise and occlusions, where the test subjects are still recognizable even when they wear sunglasses or scarf. However, SRC has been found to be highly sensitive to the misalignment of the image dataset: a small amount of image distortion due to translation, rotation, scaling and $3$-dimensional pose variations can lead to a significant degradation on the classification performance \cite{robustface}.
One straightforward way to solve the misalignment problem is to register the test image with dictionary atoms before sparse recovery. By assuming the dictionary atoms are registered, Wagner \emph{et al.} \cite{robustface} parameterize the misalignment of the test image with an affine transformation. These parameters are optimized using generalized Gauss-Newton methods after linearizing the affine transformation constraints. By minimizing the sparse registration error iteratively and sequentially for each class, their framework is able to deal with a large range of variations in translation, scaling, rotation and even $3$D pose variations. Due to the adoption of holistic features, sparse coding is more robust and less likely to overfit.
In the case of local feature-based sparse coding, max pooling strategy \cite{honglaklee} is often employed over the neighboring coefficients to produce local translation-invariant property. Based on spatial pyramid matching framework, Yang \emph{et. al.} \cite{local_sparse_coding} proposed a local sparse coding model with local SIFT features followed by multi-scale max pooling. The results on several large variance datasets achieved plausible performance that can hardly be pursued by simply applying holistic sparse coding. To improve the discriminability of the sparse codes, their dictionary was trained with supervised learning via backpropagation \cite{Yang}. Classification performance of local feature-based sparse coding has also been evaluated on several large datasets in \cite{ICML2011Coates_485}, demonstrating a state-of-art performance that is competitive with deep learning \cite{Hinton06afast}. Another interesting approach is the convolutional sparse coding \cite{lecunn_conv_sparse_coding}, where the local features are reconstructed by convoluting the local sparse codes using local dictionary. Visualization of its dictionary shows that the dictionary atoms contain more complex features, therefore having more discriminative power.
\begin{figure*}[t]
\begin{center}
\centerline{\includegraphics[width=1.0\linewidth]{coding.jpg}}
\end{center}
\captionsetup{justification=raggedright,
singlelinecheck=false
}
\caption{Proposed sparse coding framework: Dictionary tensor atoms $\{\mathbf{D}_n\}_{n=1}^{N}$ and the test tensor image $\mathbf{X}$ are shown in the lower part of the figure. Searching window of size $T = 3\times 3$ within each tensor atom is colored with purple. Each group of neighboring $T$ subatoms $\mathbf{B}_{np}$ is matched with the corresponding vector pixel $\mathbf{x}_{p}$ of the test tensor image, resulting in an aligned subatom $\mathbf{B}_{np}\hat\mathbf{c}_{np}$. After the matching process, the sparse code for $\mathbf{x}_p$ is recovered using all the aligned subatoms $\{\mathbf{B}_{np}\hat\mathbf{c}_{np}\}_{n=1}^N$. For illustration purposes, only five dictionary tensor atoms are shown in the figure and the magnitude of the sparse codes are displayed with various intensities in red.}
\label{fig:pipeline}
\end{figure*}
In this paper, we present a novel sparse coding framework that is robust to image transformation. In the proposed model, each dictionary atom is constructed in the form of a tensor and is aligned with the test image using the large displacement optical flow concept \cite{large_optical_flow}. We show experimentally that the proposed sparse coding framework outperforms most other sparsity-based methods.
Specifically, our paper has the following novelties and contributions: {\it(\romannumeral1)} The proposed algorithm does not require the training dataset to be pre-aligned.
{\it(\romannumeral2)} Adapting the dictionary to the input test image is highly efficient: requiring only ${\cal{O}} (PT)$ operations for adapting each dictionary atom, where $T$ is the number of pixels in a searching window and $P$ is the total number of \emph{subatoms} to be aligned.
{\it(\romannumeral3)} Supervised dictionary learning algorithm is developed for the proposed sparse coding framework.
The remainder of the paper is organized as follows: We first introduce the proposed sparse coding framework for dealing with dataset misalignment in Section \ref{section:sc_imagealignment}. Next, in Section \ref{section:dictionary_learning}, we show how to train the dictionary in a supervised manner by solving a bilevel optimization problem. Finally, in Section \ref{section:experiments}, experimental results demonstrate that the proposed framework has a state-of-art performance, which is more promising over most existing sparsity-based methods.
\section{Sparse Coding with Image Alignment via Large Displacement Optical Flow}
\label{section:sc_imagealignment}
In this section, we first introduce how to construct the dictionary atoms and input images in the form of tensors. We then illustrate how to eliminate the misalignment by dynamically adapt the tensor dictionary atoms to the input tensor image.
In the proposed sparse coding model, as shown in Fig. \ref{fig:pipeline}, both dictionary atom and input image are represented by image tensors. Each pixel in the tensor image is a vectorized version of a local patch in the original image, referred to as a vector pixel. Denote the $n^{\text{th}}$ tensor atom as $\mathbf{D}_n = [\mathbf{d}_{n1},\dots, \mathbf{d}_{nP}]\in{\mathbb R}^{M\times P}$ and a given test tensor image as $\mathbf{X} = [\mathbf{x}_{1},\dots, \mathbf{x}_P]\in {\mathbb R}^{M\times P}$, where $\mathbf{d}_{np}\in{\mathbb R}^{M}$ is the $p^{\text{th}}$ subatom of the $n^{\text{th}}$ tensor atom and $\mathbf{x}_{p}\in{\mathbb R}^M$ is the $p^{\text{th}}$ vector pixel of the input image. $M$ is the dimension of vector pixel, $n$ is the dictionary atom index and $P$ is the total number of subatoms in the tensor atom, which is the same number of vector pixels in the test tensor image. The dictionary is denoted as $\mathbf{D} = [\mathbf{D}_1, \dots, \mathbf{D}_N] \in {\mathbb R}^{M\times NP}$. Given a dictionary with $N$ tensor atoms, a typical sparse recovery problem \cite{jwright} is formulated as:
\begin{align}
\hat\boldsymbol\alpha = \arg\min_{\boldsymbol\alpha } \frac{1}{2}\sum_{p=1}^P \norm{\sum_{n=1}^N \alpha_n \mathbf{d}_{np} - \mathbf{x}_p}_2^2 + \lambda \norm{\boldsymbol\alpha}_1,
\label{eq:model_sc}
\end{align}
where $\boldsymbol\alpha = [\alpha_1, \dots, \alpha_N]^\top\in{\mathbb R}^N$ is the sparse coefficient and $\lambda>0$ is the regularization parameter.
Problem (\ref{eq:model_sc}) is a standard form of $\ell_1$-sparse recovery problem that can be efficiently solved using alternating direction method of multipliers (ADMM) \cite{boyd}.
When images in both the training and test datasets are misaligned, sparse coefficients recovered by solving the problem (\ref{eq:model_sc}) become unreliable, thus resulting in poor classification performance. To alleviate the misalignment problem, we propose to register each tensor atom with the input test image via large displacement optical flow \cite{large_optical_flow}. The notion of optical flow field is used here to describe the displacements of vector pixels within each tensor atom, and the sparse recovery is then performed by using only the best matching subatoms selected from the tensor atoms. The proposed framework is illustrated in Fig. \ref{fig:pipeline}. Denote $\mathbf{B}_{np} \in{\mathbb R}^{M\times T}$ as the $T$ subatoms within the searching window centered at the location $p$ of the $n^{\text{th}}$ tensor atom. The recovery of the optical flow and sparse codes can be formally described as follows:
\begin{equation}
\begin{aligned}
&\left(\hat\boldsymbol\alpha, \{\hat\mathbf{c}_{np}\}\right) = \arg\min_{\boldsymbol\alpha, \{\mathbf{c}_{np}\} } \frac{1}{2}\sum_{p=1}^P \norm{ \sum_{n=1}^N \alpha_n\mathbf{B}_{np} \mathbf{c}_{np} - \mathbf{x}_p}_2^2 + \lambda \norm{\boldsymbol\alpha}_1, \\
&\text{s.t.} \quad \norm{\mathbf{c}_{np}}_0 = 1, \norm{\mathbf{c}_{np}}_1 = 1, \mathbf{c}_{np}\geq \mathbf{0}, \\
& \quad\quad\; \forall n\in[N],p\in[P],
\label{eq:model_of1}
\end{aligned}
\end{equation}
where $\norm{\mathbf{c}_{np}}_0=1$ is the cardinality constraint and $\mathbf{c}_{np}\in {\mathbb R}^{T}$ is the sparse index vector that is used to characterize the optical flow field. The constraint in (\ref{eq:model_of1}) suggests that $\mathbf{c}_{np}$ is a binary index vector and only one element is nonzero, which means that it can only select one subatom within the searching window.
The optimization problem in (\ref{eq:model_of1}) is a mixed-integer problem and NP-hard \cite{optimization_integers}. Therefore, we propose a heuristic algorithm to find an informative $\boldsymbol\alpha$ and the sparse index vectors $\{\mathbf{c}_{np}\}_{n,p=1}^{N,P}$ for all vector pixels. As shown in Fig. (\ref{fig:pipeline}), the optical flow field for each vector pixel is found by searching for the best match between neighboring subatoms and the corresponding input vector pixel. In practice, we found that searching for the best match without involving the sparse code is the key to render plausible performance in both classification accuracy and computational efficiency. Formally, we propose to find a local optimum of problem (\ref{eq:model_of1}) by solving the following optimization problem:
\begin{equation}
\begin{aligned}
&\hat\boldsymbol\alpha = \arg\min_{\boldsymbol\alpha} \frac{1}{2}\sum_{p=1}^P \norm{ \sum_{n=1}^N \alpha_n\mathbf{B}_{np} \hat\mathbf{c}_{np} - \mathbf{x}_p}_2^2 + \lambda \norm{\boldsymbol\alpha}_1 \\
&\text{s.t.} \quad \hat\mathbf{c}_{np} = \arg\min_{\mathbf{c}_{np}} \frac{1}{2}\norm{\mathbf{B}_{np} \mathbf{c}_{np} - \mathbf{x}_p}_2^2, \\
&\quad\quad \norm{ \mathbf{c}_{np} }_0= 1, \norm{\mathbf{c}_{np}}_1 = 1, \mathbf{c}_{np}\geq \mathbf{0}, \\
&\quad\quad\; \forall n\in[N],p\in[P].
\label{eq:model_of2}
\end{aligned}
\end{equation}
In our approach, the sparse coding part of (\ref{eq:model_of2}) is solved by using the alternating direction method of multipliers (ADMM) \cite{boyd}. One important advantage of the above model is that it is highly computational efficient because it only takes ${\cal{O}} (T)$ operations to search for the best match for each vector pixel.
\section{Supervised Dictionary Learning}
\label{section:dictionary_learning}
In order to improve the efficiency of sparse coding and discriminablity of the dictionary, we employ the supervised dictionary learning framework \cite{Yang,bilevelsc,MairalTDDL} to optimize the dictionary and the classifier parameters simultaneously. Formulated as a bilevel optimization problem, the dictionary is updated using back propagation to minimize the classification error. Formally, the supervised dictionary learning problem can be formulated as follows:
\begin{align}
\min\limits_{\mathbf{W}, \mathbf{D}}\mathbb{E}_{\mathbf{y},\mathbf{X}}\left[\ell(\mathbf{y}, \mathbf{W}\hat\boldsymbol\alpha(\mathbf{X}, \{\hat\mathbf{c}_{np}(\mathbf{D})\}, \mathbf{D}))\right] + \frac{\mu}{2}\norm{\mathbf{W}}_F^2,
\label{eq:dl2}
\end{align}
where $\ell(\cdot)$ is some smooth and convex function that is used to define the classification error and $\mu>0$ is the regularization parameter used to alleviate the overfitting of the classifier. Due to the triviality of updating classifier parameters, here we only state the update for the dictionary:
\begin{align}
\mathbf{D}\leftarrow \Pi(\mathbf{D} - \rho^t\cdot \partial \ell / \partial \mathbf{D}),
\end{align}
where $\rho>0$ is the learning rate, $t$ is the iteration counter and $\Pi$ is the projection that regulate the Frobenius norm of every tensor atom to be one. Similar to \cite{Yang,bilevelsc,MairalTDDL}, (\ref{eq:dl2}) suggests that the update of both the dictionary and the classifier are driven by reducing classification error. The local optima can be solved by using descent method \cite{bilevel_survey} based on error backpropagation.
The sparse code $\boldsymbol\alpha$ is an implicit function of $\mathbf{X}, \{\mathbf{c}_{np}\}$ and $\mathbf{D}$. In addition, each optical flow field $\mathbf{c}_{np}$ is an implicit function of $\mathbf{D}$ and $\mathbf{x}_{np}$. Therefore, given an input image $\mathbf{X}$ and an optimal sparse code $\hat\boldsymbol\alpha$, apply the chain rule of differentiation, the direction along which the upper-level cost decreases can be formulated as:
\begin{align}
\frac{\partial \ell(\mathbf{y}, \mathbf{W}\boldsymbol\alpha)}{\partial \mathbf{D}} = \frac{\partial \ell}{\partial \boldsymbol\alpha}\frac{\partial \boldsymbol\alpha}{ \partial \mathbf{D}} + \sum_{p=1}^P\frac{\partial \ell}{\partial \mathbf{C}_p} \frac{\partial \mathbf{C}_{p}}{\partial \mathbf{D}},
\label{eq:chainrule}
\end{align}
where $\mathbf{C}_p = \bigoplus_{n=1}^N \bar\mathbf{c}_{np} \in {\mathbb R}^{NP\times N}$ and $\bigoplus$ denotes the direct sum. Also, $\bar\mathbf{c}_{np}\in{\mathbb R}^{NP}$ is obtained by zero-padding with $\mathbf{c}_{np}$, where $(N-1)P+1$ to $NP$ elements of $\bar\mathbf{c}_{np}$ are from those of $\mathbf{c}_{np}$. Due to the binary constraints on $\{\mathbf{c}_{np}\}$, every element of the gradient $\partial \mathbf{C}_{p}/\partial \mathbf{D}$ equals to zero. On the other hand, the first part of the derivative can be solved by applying fixed point differentiation \cite{differentiablesparse}. Due to the page limitation of the paper and the triviality for deriving the term $\partial\ell/\partial\boldsymbol\alpha$, we only show the final derivation of $\partial \boldsymbol\alpha/\partial \mathbf{D}$ as follows:
\begin{equation}
\frac{\partial \boldsymbol\alpha_\Lambda}{\partial d_{mnp}} = \boldsymbol\Theta_{\Lambda,\Lambda}^{-1} \left( \frac{\partial {(\mathbf{D}\mathbf{C}_p)}_\Lambda^\top}{\partial d_{mnp}}\mathbf{x}_p -\frac{\partial \boldsymbol\Theta_{\Lambda,\Lambda}}{\partial d_{mnp}}\boldsymbol\alpha_\Lambda \right),
\label{eq:dl_alpha_d}
\end{equation}
where $\Lambda$ is the index set of active atoms of the sparse code $\boldsymbol\alpha$. ${(\mathbf{D}\mathbf{C}_p)}_\Lambda$ is the matrix obtained by collecting the active columns of ${\mathbf{D}\mathbf{C}_p}$, $\boldsymbol\Theta = \sum_{\rho=1}^P \mathbf{C}^{\top}_p\mathbf{D}^{\top}\mathbf{D}\mathbf{C}_p$ and $\boldsymbol\Theta_{\Lambda,\Lambda}$ is the submatrix obtained by selecting the active columns and rows of $\boldsymbol\Theta$. The matrix $\boldsymbol\Theta_{\Lambda,\Lambda}$ is always nonsingular since the total number of measurement $MP$ is always significantly larger than the number of active atoms. Combining (\ref{eq:chainrule}) with (\ref{eq:dl_alpha_d}) for each dictionary element, the gradient for updating the dictionary can be achieved. For a large dataset, the dictionary and the classifier parameters are updated in an online manner.
\begin{figure*}[ht]
\centering
\begin{subfigure}[b]{.2\textwidth}
\centering
\centerline{ \includegraphics[width=4.5cm]{sampleFigure.png} }
\caption{}
\label{fig:subsample}
\end{subfigure} \hspace{2em}
\begin{subfigure}[b]{.2\textwidth}
\centering
\centerline{ \includegraphics[width=4.5cm]{translationFigure.png} }
\caption{}
\label{fig:translation}
\end{subfigure} \hspace{2em}
\begin{subfigure}[b]{0.2\textwidth}
\centering
\centerline{ \includegraphics[width=4.5cm]{rotationFigure.png}
}
\caption{}
\label{fig:scaling}
\end{subfigure} \hspace{2em}
\begin{subfigure}[b]{0.2\textwidth}
\centering
\centerline{ \includegraphics[width=4.5cm]{scalingFigure.png}
}
\caption{}
\label{fig:rotation}
\end{subfigure}
\captionsetup{justification=raggedright, singlelinecheck=false}
\caption{\footnotesize The proposed method demonstrates plausible performance on MNIST digits recognition with a small number of training samples. It also demonstrates robustness towards various image deformations. Classification accuracy of different experimental settings are shown in the above sub-figures: (a) Error rate under various sizes of training samples. (b) Translation along $x$ direction versus classification accuracy. (c) In-plane rotation only. (d) Scale variation only. In (b)-(c), red and blue lines are the results of the proposed method and L1SC, respectively. Gray shadow area at the bottom of each figure is the accuracy difference between the proposed method and L1SC. }
\label{fig:invariance}
\end{figure*}
\section{Experiments}
\label{section:experiments}
In this section, we evaluate the proposed algorithm on hand-written digits datasets including the MNIST and USPS. The sparse coding is performed with a single dictionary and linear SVM is used for classification. For a fair comparison, we only compare with the results that are produced with the same SRC strategy. The dictionary size in our paper is set to be no larger than those used in other methods. Similar to \cite{Yang}, parameters in our experiments are chosen heuristically. The batch size for updating the dictionary is $512$. Initial learning rate $\rho$ is set to $0.001$ and $\lambda=0.01$.
\subsection{Evaluation on the MNIST Database}
MNIST \cite{MNIST} consists of a total number of $70,000$ images of digits, of which $60,000$ are training set and the rest $10,000$ are test set. Each digit is centered and normalized in a $28\times28$ field. The dictionary size $N$ is set to be $150$ for this database.
We first evaluate the performance of the proposed algorithm under various number of training samples. We follow the same experimental setting as in \cite{ckn}, examining the classification accuracy given the training size $\{300, 1K, 2K, 5K, 10K, 20K, 40K, 60K\}$. The performance is shown in Fig. \ref{fig:invariance} (a). The proposed method significantly outperforms the $\ell_1$ sparse coding-based algorithm (L1SC) \cite{MairalTDDL}.
We then demonstrate the robustness of the proposed method towards various image deformations. Following a similar setting as in \cite{robustface}, we perform the translation along $x$ direction, rotation and scaling separately only on the test samples. We report the classification accuracy with respect to various levels of deformation and compare the performance with L1SC. The experimental results are shown in Fig. \ref{fig:invariance}(b)-(d). Performance of our method and L1SC are illustrated in red and blue lines, respectively. The shadow area at the bottom of each figure is the accuracy difference between the two methods. We can see for all three deformations, the proposed method consistently outperforms L1SC. In addition, the hump shape of the shadow area indicates that the proposed method is robust to numerous image deformations.
Finally, the error rate for the MNIST is shown in Table \ref{table:oa}. Our method reaches the lowest error rate of $1.12\%$. On MNIST, differences of more than $0.1\%$ are statistically significant \cite{greedy_dnn}. Comparing with the second best algorithm, the proposed method reduces the error rate by $0.12\%$, exhibiting better generality and dictionary compactness.
\subsection{Evaluation on the USPS Database}
The USPS dataset has $7,291$ training and $2,007$ test images, where each of them is of size $16\times 16$. Being compared to MNIST, the USPS dataset has a much larger variance and a smaller training set, which challenges the dictionary generality.
For a fair comparison, the dictionary size $N$ is set to be $80$. Local patch size is $5\times 5$ ($M$ = $25$). Searching window size is $5\times 5$ ($T$ = $25$). The performance of various approaches on USPS database are depicted in Table \ref{table:oa}. Our algorithm achieves the lowest error rate $3.43\%$ among other supervised learning-based methods. The experimental result validates the efficacy of our proposed algorithm on a dataset with a larger variance.
\begin{table}
\begin{center}
\begin{tabular}{|l|c|c|}
\hline
Method & MNIST & USPS \\
\hline\hline
CBN &$1.95$ $(3\times10^4)$ &$4.14$ $(7291)$ \\
ESC \cite{ffs} &$5.16$ $(150)$ &$6.03$ $(80)$\\
Ramirez \emph{et al.} \cite{incoh_dl} & $1.26$ $(800)$ &$3.98$ $(80)$\\
Deep Belief Network \cite{Hinton06afast} &$1.25$ $($-$)$ & - $($-$)$\\
MMDL \cite{zhaowen} &$1.24$ $(150)$ &-$($-$)$\\
Proposed &$\mathbf{1.12}$ $(150)$ &$\mathbf{3.43}$ $(80)$\\
\hline
Improvements &$9.7\%$ &$13.8\%$ \\
\hline
\end{tabular}
\end{center}
\captionsetup{justification=raggedright, singlelinecheck=false}
\caption{ Error Rate (\%) on MNIST and USPS datasets. The dictionary size is shown in the parentheses. Improvements over the second best algorithm is shown in the last line.}
\label{table:oa}
\end{table}
\section{Conclusion}
\label{section:conclusion}
In this paper, we present a novel sparse coding algorithm that is able to dynamically select the dictionary subatoms to adapt to the misaligned image dataset. In the proposed method, both the dictionary atoms and the input test image are represented by tensors, and each vector pixel in the tensor image is a vectorized local patch. Each tensor atom is aligned with the input tensor image using large displacement optical flow, which is highly computationally efficient. Using the fixed point differentiation, a supervised dictionary learning algorithm is developed for the proposed sparse coding framework, which significantly reduces the required dictionary size.
\newpage
{
\bibliographystyle{ieee}
| {'timestamp': '2015-12-22T02:24:29', 'yymm': '1512', 'arxiv_id': '1512.06709', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06709'} | arxiv |
\section[#1
\debug{\fbox {#2}}]{#1 \cmd{msec} \dlabelx{#2}}%
\markboth{\today}{Sec. \thesection}}
\newcommand{\msubsection}[2]{\subsection[#1 \debug{\fbox {#2}}]
{#1 \cmd{msubsection} \dlabelx{#2}}%
\markboth{\today}{Sec. \thesection}}
\newcommand{\msubsubsection}[2]{\subsubsection[#1 \debug{\fbox {#2}}]
{#1 \cmd{msubsubsection} \dlabelx{#2}}%
\markboth{\today}{Sec. \thesection}}
\newtheorem{definition}{Definition}
\newtheorem{notation}{Notation}
\newtheorem{property}{Property}
\newtheorem{claim}{Claim}
\newtheorem{fact}{Fact}
\newtheorem{axiom}{Axiom}
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}{Lemma}
\newtheorem{cor}{Corollary}
\newtheorem{corollary}{Corollary}[theorem]
\renewcommand{{\hfill $\Box$}{\cmd{PE}}}{{\hfill qed}{\cmd{PE}}}
\renewcommand{\dB}{\begin{description}}
\input{tcilatex}
\renewcommand{\dB}{\begin{description}}
\newcommand{\mathbb}{\textbf}
\newcommand{\centerdot}{\cdot}
\begin{document}
\pagenumbering{gobble}
\clearpage
\thispagestyle{empty}
\title{
HDR - A Hysteresis-Driven Routing Algorithm for Energy Harvesting Tag Networks\footnote{Thanks are due to Maria Gorlatova and Gil Zussman for many discussions in the initial stages of this research and to Alexander Lavzin for useful comments.} \\
}
\author{Adrian Segall}
\maketitle
\begin{abstract}
The work contains a first attempt to treat the problem of routing in networks with energy harvesting units. We propose HDR - a Hysteresis Based Routing Algorithm and analyse it in a simple diamond network. We also consider a network with three forwarding nodes. The results are used to give insight into its application in general topology networks and to general harvesting patterns.
\end{abstract}
\newpage
\clearpage
\tableofcontents
\clearpage
\pagenumbering{arabic}
\newpage
\newcommand{consensus.tex}{consensus.tex}
\msec{Introduction}{Introduction}
Recent advances in the design of ultra-low power transceivers and solar cells has made it possible to develop and implement networks with self sustainable energy harvesting devices (\emph{EnHANTs}) that communicate with neighboring devices over wireless links (see e.g. \dcite{GWZ}, \dcite{GMSplus} and references therein). In such networks, node energy increases via harvesting, in addition to it being spent by data transmission and reception. As a result, the algorithms in \emph{EnHANTs} networks differ considerably from the ones in legacy sensor and ad-hoc networks. Moreover, with the devices we are considering, the available energy for control and processing is extremely low and thus the employed algorithms must be simple and the amount of transmitted control data must be minimized.
The present work is the first attempt to design routing protocols for \emph{EnHANTs} networks. We shall analyse the performance of a routing protocol for a very simple network. Then we indicate how this simple analysis can be employed to provide insight into the design of routing algorithms in larger networks.
\msec{The Model}{Model}
Consider a diamond network with 4 nodes as in Fig. \dref{fig-Model}. Nodes $s,d$ are respectively the source and destination nodes. Node $s$ generates data to be transferred via the energy-harvesting nodes 1 and 2 to the destination $d$.
Data is included in packets of fixed size. Time is divided in slots, where all nodes can change activity only at the end of a slot. Therefore, throughout this paper, we shall interchangeably use the terms \emph{"time"} and \emph{"end of slot"}. Each wireless transmission by the source is overheard by both forwarding nodes, but in any given slot only one of them, referred to as \emph{the active node} and denoted by $v$, is forwarding the packets to the destination. Only the active node spends energy in receiving the packet and forwarding it. The other node is said to be \emph{inactive} and is denoted by $x$. If node 1,2 is \emph{active}, we also say that we use \emph{route} 1,2 respectively.
At the end of each slot, the intermediate nodes inform the destination node of their current energy levels. The active node can do this by piggy-backing the information to the last data packet in the given slot, whereas the inactive node needs to use a control message, referred to as a \emph{status message}. Based on this information, the destination node decides what route to use and informs the forwarding nodes accordingly. The decision is sent by the destination node just after having received the status messages, in a control message referred to as a \emph{switch-command message}. We assume that it takes negligible time, but not negligible energy, to send the status messages, to receive the switch command and to apply it by the forwarding nodes.
For the first part of this work we assume that the energy harvesting rates at the two forwarding nodes is constant over a sufficiently long time, at the rate of $e_1,\,e_2$ $mJ / slot$ respectively. We also assume for most of this work that the source generates and transmits data at a fixed rate of $g\,\, packets/slot$. The source and the destination are assumed to be energy unlimited.
If we momentarily disregard the energy spent by control messages, the maximal data rate that can be transmitted from source to destination in this network is
\SB
g_{max} = (e_1 + e_2)/c\text{ ; } packets/slot
\SE
where $c$ is the total combined energy required to receive and send a data packet. This is consistent with the results in many works that treat conditions for maximum flow, for example \dcite{MSZ}, as applied to this simple network. In order to achieve the maximal flow, the traffic must be split between the two routes at average rates $e_1/c$ and $e_2/c$ respectively. Obviously, measurement of the harvesting rates and splitting the traffic accordingly are not easy tasks. The purpose of this work is to design a simple routing protocol that hopefully achieves this split without the need to measure the harvesting rates. We may mention in addition that if this goal is indeed achieved, the split will automatically adapt to (slow) changes in the harvesting rates.
\begin{figure}[hbtp]
\begin{center}
\includegraphics[scale=1]{Fig1.jpg}
\caption{The Model\debug{\fbox{fig-Model}}\label{fig-Model}}
\end{center}
\end{figure}
The proposed algorithm, referred to as the \emph{Hysteresis-Driven Routing(HDR) Algorithm} is as follows. The destination assigns as \emph{active} the node with the \emph{higher energy level}, except that, in order to avoid fast oscillations and high control overhead, it switches routes only when the energy level at the inactive node exceeds the level at the active node by a certain \emph{threshold}. The threshold for switching in one direction may be different from the one in the opposite direction. Since activity can change only at the end of a slot, if the threshold is reached during a slot, the \emph{actual switch time is at the end of that slot}.
\msubsection{Notations and assumptions}{notations}
For simplicity, we shall take the transmission energy for each status message to be the same, whether the information is piggybacked on a data message or sent separately. We need to distinguish between the time \emph{just before} the transfer of the control messages and the time \emph{just after}. We shall refer to the former as \emph{the time just before the end of the slot} and to the latter as \emph{the time at the end of the slot}.
We shall use the following notations. The period between two consecutive switches in the same direction is referred to as a \emph{cycle}.
\begin{description}
\item{$e_u$} - energy harvested by node $u$ in each slot ($mJ/$slot)
\item{$g$} - number of data packets generated by the source node in each slot (packets/slot)
\item{$c$} = combined energy to receive and transmit a data packet ($mJ/$packet)
\item{$c_t$} = energy to transmit a status control packet or status information piggybacked on a data packet($mJ$)
\item{$c_r$} = energy to receive a switch command packet ($mJ$)
\item{$B^{-}_u(i)$} - battery level at node $u$ \emph{just before} the end of slot $i$ in units of energy($mJ$)
\item{$B_u(i)$} - battery level at node $u$ \emph{at} the end of slot $i$, in units of energy ($mJ$)
\item{$B_{max}$} - maximum battery level ($mJ$)
\item{$B_{min}$} = $c_t + c_r$ - minimum battery level that allows transmission of control messages ($mJ$)
\item{$h_1$} - threshold to switch from route 1 to route 2 ($mJ$)
\item{$h_2$} - threshold to switch from route 2 to route 1 ($mJ$)
\item {$h$} = $h_1+h_2$ ($mJ$)
\item {$\gamma^c_u$} = \emph{node cycle throughput} = number of data packets transferred via node $u$ in each cycle (packets/cycle)
\item {$\gamma^c$} = \emph{total cycle throughput} = $\gamma^c_1 + \gamma^c_2$
\item{$1_z$} = 1 if $z$ is true and $0$ otherwise
\end{description}
\msec{Energy equations}{energy}
In the sequel, we develop formulas for the battery level at each node just before the end of each slot and at the end of each slot. We also determine the maximal steady state flow $g_s$ of data.
Since the harvesting rates are not known and they may, hopefully slowly, change with time, we shall also examine the behaviour of the system for arbitrary input rates $g$, both larger and smaller than $g_s$.
In order to avoid the treatment of too many cases however, we shall restrict the input rate to be larger than $max(e_1 ,e_2)/c$. In fact, if for example, $c\,g < e_1 - c_t$, then the energy of node 1 always increases, even when node 1 is active; not a very interesting scenario. We shall also assume that $min(e_1, e_2) > c_t + c_r$.
With the above assumptions, when the battery levels are away from the boundaries $B_{min}$ and $B_{max}$, the battery level at the inactive node $x$ increases from \emph{the end} of a slot until \emph{just before} the end of the next slot by $e_x\,\,mJ$. The battery level at the active node $v$ decreases from \emph{the end} of some slot until \emph{just before the end} of the next slot by $(c\,g - e_v)\,\,mJ$. If the battery at the inactive node reaches $B_{max}$, its harvesting stops. For input rate $g$, when the battery level at the active node $v$ is away from $B_{min}$, it transfers $g$ packets/slot.
It remains to consider the activity of the active node when it is close to the boundary $B_{min}$. If the active node battery reaches $B_{min}$ \emph{during} a slot, say a fraction $\alpha\,$ of the slot period into the slot time, then it will transfer $\alpha g $ packets before it reaches $B_{min}$ and $(1-\alpha)\,e_v/c$ packets afterwards\footnote{For simplicity of notation and analysis, we disregard the fact that we only send whole packets. The simulation does take this fact into account.}.
Next consider the situation at the end of some slot $i$. Recall the order of transmissions starting just before the end of a slot time: first the status messages and then, if necessary, the switch command. If just before the end of the slot, node $v$ is at $B^{-}_v(i) < B_{min}$, it may run into a problem. If we allow it to send the status message, thereby spending $c_t \,\, mJ$ for control, it will not have sufficient energy to receive the switch command, if any. Thus in order to be safe, in this case we instruct the node \emph{to refrain from sending the status message} at the end of slot $i$. The destination will assume that the node is at $B_{min}$ when it does not hear the status message and will act accordingly\footnote{Here, as well as throughout this work, we assume no lost messages.}.
Finally, consider data transmission. If after sending the status message, the energy is less than $B_{min}$, we do not allow transfer of data messages in the next slot, with the hope that the harvested energy will sufficiently increase the battery level to allow it to send the status message at the end of the next slot. Otherwise, the normal algorithm applies.
With the above considerations, we can write down the dynamics of the system.
\ls{0.3}%
\renewcommand{}{B}%
\daddcontentsline{lot}{table}{\debug{\fbox{}}}%
\begin{minipage}{6.25in}%
\ls{0.3}\setcounter{line}{0}%
\begin{tabbing}%
0000\debug{000} \= 111 \= 222 \= 333 \= 444 \= 555 \= 666 \= 777
\= 888 \= 999 \= 000 \kill
\prntvar\\%
\\%
\stepcounter{protblock}
\nl{bc}\>switch = 0
\nl{aa}\>$\mbox{\boldmath $if \;\; $} B^{-}_x(i) - B^{-}_v(i) \geq h_v $
\nl{ab}\>\> switch = 1
\nl{bx}\>$\emph{\textbf{end}}$
\nl{ac}\>$B_x(i)= B^{-}_x(i) - c_t$
\nl{m}\> $\mbox{\boldmath $if \;\; $} (B^{-}_v(i) \geq B_{min})$
\nl{a}\>\> $B_v(i) = B^{-}_v(i) - c_t$
\nl{d}\> $\mbox{\boldmath $else \;\; $}$
\nl{e}\>\> $B_v(i) = B^{-}_v(i)$
\nl{f}\> $\emph{\textbf{end}}$
\nl{y}\>$\mbox{\boldmath $if \;\; $}$ (switch == 1)
\nl{b}\>\> $B_v(i) = B_v(i) - c_r\text { ; }B_x(i) = B_x(i) - c_r $
\nl{g}\>\> $v$ and $x$ switch
\nl{ag}\>\> $B^{-}_x(i+1) = B_x(i) + e_x $
\nl{ad}\>\> $B^{-}_v(i+1) = B_v(i) + e_v - c\,g$
\nl{ae}\>\> $\gamma^c_v(i+1) = \gamma^c_v(i) + g$
\nl{x}\>$\mbox{\boldmath $else \;\; $}$
\nl{ax}\>\> $B^{-}_x(i+1) = min(B_x(i) + e_x, B_{max}) $
\nl{n}\>\> $\mbox{\boldmath $if \;\; $} (B_v(i) < B_{min})$
\nl{j}\>\>\> $B^{-}_v(i+1) = B_v(i) + e_v$
\nl{i}\>\>\> $\gamma^c_v(i+1) = \gamma^c_v(i) $
\nl{p}\>\> $\mbox{\boldmath $else \;\; $}$
\nl{k}\>\>\> $B^{-}_v(i+1) = max(B_{min},B_v(i) +e_v -c\,g)$
\nl{ak}\>\>\> $\alpha = max(0,min(1,(B_v(i)-B_{min})/(c\,g - e_v)))$
\nl{u}\>\>\> $\gamma^c_v(i+1) = \gamma^c_v(i) + \alpha \, g + (1-\alpha)\,e_v/c$
\nl{w}\>\> $\emph{\textbf{end}}$
\nl{z}\>$\emph{\textbf{end}}$
\end{tabbing}
\end{minipage}
\ls{1.2}
It is easy to see that the energy just after the transmission of the status control message, if any, is no smaller than $c_r$, so there is always energy to receive the switch message (see lines \dref{Bb} and \dref{Bab} in the Code above). To avoid confusion, we point out that the code above is not performed by any node. It merely describes the dynamics of the system.
Assume that we have just switched at a slot, referred to as slot $0$, from route 2 to route 1.
This happens because the threshold $h_2$ is reached during slot $0$ or just before its end and was not reached during the previous slot, namely
\begin{equation}\cmd{EB}
h_2 + e_1 - e_2 + c\,g > B^{-}_1(0) - B^{-}_2(0) \geq h_2
\EE{eq-sw1}
The condition that we switch again $I_1$ slots afterwards is
\begin{equation}\cmd{EB}
h_1 + e_2 - e_1 + c\,g > B^{-}_2(I_1) - B^{-}_1(I_1) \geq h_1
\EE{eq-caps}
The differences in battery levels are calculated as sums of the expressions in lines \dref{Ba}, \dref{Be}, \dref{Bb}, \dref{Bk} in the Code above.
We have a similar condition for the next switch from route 2 to route 1.
\msec{Operation away from the boundaries}{away2}
Denote by
\dB
\item{$I_1^a$} = number of slots when node 1 is active in a given cycle $a$, when the system is away from the boundaries
\item{$I_2^a$} = number of slots when node 2 is active in a given cycle $a$, when the system is away from the boundaries
\item{$I^a$} = $I_1^a + I_2^a$
\item{$\gamma$} = $\gamma^c(a) / I^a$ = average throughput per slot in cycle $a$ (packets/slot)
\end{description}
When the system operates away from the boundaries, all \emph{max} and \emph{min} operands in the Code above do not apply. Thus we have
\begin{equation}\cmd{EB}
h_1 + e_2 - e_1 + c\,g > B^{-}_2(I_1^a) - B^{-}_1(I_1^a) = I_1^a\,\, e_2 + I_1^a\,(c\,g - e_1)\, + B^{-}_2(0) - B^{-}_1(0) \geq h_1
\EE{eq-Iaax}
or
\begin{equation}\cmd{EB}
I_1^a = \lceil\frac{(h_1 + B^{-}_1(0) - B^{-}_2(0))}{(c\,g -e_1 + e_2)}\rceil
\EE{eq-Iaa}
where $\lceil\,Z\rceil$ denotes \emph{the smallest integer larger than or equal to $Z$}.
Similarly
\begin{equation}\cmd{EB}
I_2^a = \lceil\frac{(h_2 + B^{-}_2(I_1^a) - B^{-}_1(I_1^a))}{(c\,g -e_2 + e_1)}\rceil
\EE{eq-Iaay}
We shall be interested in the drift in total energy of the system $\Delta_{total} = B_1(I^a) - B_1(0) + B_2(I^a) - B_2(0)$ during a cycle $I^a = I_1^a + I_2^a$. The energy harvested during a cycle is $(e_1 + e_2)\,I^a$. Since $g$ packets are sent in each slot, the energy spent is $c\,g\,I^a$. At the end of each slot, each node spends $c_t$ for control. There are 2 switch times in a cycle and at every switch time each node spends $c_r$. The total drift in energy of both nodes per cycle is given by the difference between the harvested energy and the spent one:
\begin{equation}\cmd{EB}
\Delta_{total} = -4\,c_r + (e_1 + e_2 - 2\,c_t -c\,g)\,I^a \,\,mJ/cycle
\EE{eq-BDtotal}
This is how far we can get analytically with arbitrary parameters. A useful approximation is to select thresholds as multiples of the net slot energy change. This implies that the thresholds are reached exactly at slot time, a fact that considerably simplifies the analysis .
\msec{Thresholds divide slot energies - Operation away from the boundaries}{divide}
Suppose a switch from route 2 to route 1 occurs at the end of slot $0$ and at that time, the energy level difference exactly matches the threshold value. This means $B^{-}_2(0) - B^{-}_1(0) = h_2$. Then, with $h = h_1 + h_2$, we have
\begin{equation}\cmd{EB}
I_1^a=\lceil\frac{h}{ c\,g+(e_2-e_1)}\rceil
\EE{eq-I1aaa}
and a similar expression for $I_2^a$.
If $h$ divides evenly the slot energies $c\,g+(e_2-e_1)$ and $c\,g+(e_1-e_2)$, then
\begin{equation}\cmd{EB}
I_1^a=\frac{h}{ c\,g+(e_2-e_1)}\text{ ; }
I_2^a=\frac{h}{ c\,g+(e_1-e_2)}
\EE{eq-Ia}
\begin{equation}\cmd{EB}
I^a = \frac{2c\,g\,h}{(c\,g)^2 - (e_2 - e_1)^2}
\EE{eq-away}
Moreover, the battery level difference returns to its initial value at the end of a cycle, namely
$B^{-}_2(I^a) - B^{-}_1(I^a) = B^{-}_2(0) - B^{-}_1(0) = h_2$.
In each slot $g$ packets are transferred, thus the average throughput is
\begin{equation}\cmd{EB}
\gamma = g \text{ packets/slot}
\EE{throughput}
independently of the thresholds.
The split ratio between the two routes is
\begin{equation}\cmd{EB}
\frac{\gamma_1^c}{\gamma_2^c} = \frac{g\,I_1^a}{g\,I_2^a} = \frac{c\,g+e_1-e_2}{c\,g+e_2-e_1}
\EE{eq-split0}
In the sequel, we shall also need the following quantities.
Let $\delta B_u (I)$ denote the change in the battery level at node $u$ during an interval of $I$ slots. Then
\begin{equation}\cmd{EB}
\delta B_1(I_1^a) = -\frac{h\,(c\,g -e_1)}{ c\,g+(e_2-e_1)} \text{ ; }
\delta B_2(I_1^a) = \frac{h\, e_2}{ c\,g+(e_2-e_1)}
\EE{eq-Delta}
and
\begin{equation}\cmd{EB}
\delta B_1(I_2^a) = \frac{h\, e_1}{ c\,g+(e_1-e_2)} \text{ ; }
\delta B_2(I_2^a) = -\frac{h(c\, g - e_2)}{ c\,g+(e_1-e_2)}
\EE{eq-Delta1}
The drift $\Delta = B_1(I^a) - B_1(0) = B_2(I^a) - B_2(0)$ is half the total drift (\dref{eq-BDtotal}), namely
\begin{equation}\cmd{EB}
\Delta = -2\,c_r + \frac{(e_1 + e_2 -2\,c_t-c\,g)\,I^a}{2}\,\,mJ/cycle
\EE{eq-B}
\msec{Negligible Control - Thresholds divide slot energies}{negli}
If the energy spent for sending and receiving control messages is negligible, we have
$c_t = c_r = B_{min} = 0$.
\msubsection{Operation away from the boundaries}{awayq}
For negligible control, the drift is $\Delta = (e_1 + e_2 - c\,g)\,I^a/2$.
Let $g_s$ denote the input that induces steady state, namely $\Delta = 0 $. We get $g_s = (e_1 + e_2)/c$. If $g = g_s$, then the condition for the switches to occur at exactly battery level differences $h_1$ and $h_2$ becomes that $h/(2\,e_1)$ and $h/(2\,e_2)$ are integers. For example for $e_1 = 0.8\, , e_2 = 0.6$, any two threshold values $h_1, h_2$ that add up to 4.8 or its multiples will do the job.
We conclude that if $g = g_s$, then the \emph{HDR Algorithm} indeed transfers in dynamic steady state the entire input rate $g_s$. For other values of the input rate $g$, the behavior is transient: the battery levels will drift up if $g < g_s$ until they reach steady state close to $B_{max}$ and down if $g > g_s$ until they reach steady state close to $B_{min}$. The steady state behavior in these cases is treated in the following sections.
\subsection{Drifts and Operation close to boundaries}\dlabel{close}
As before, the analysis here is for negligible control and thresholds evenly dividing the slot energies. Since in practice, the harvesting rates vary, it is important to investigate the behavior of the system when $e_1 + e_2$ is not necessarily equal to $c\,g$.
If $ e_1 + e_2 > c\,g$, then the battery levels drift up, until at least one of them reaches $B_{max}$. Similarly, if $ e_1 + e_2 < c\,g$, the drift is down, until at least one of the batteries reaches the lower bound $B_{min} = 0$. Before reaching the boundary, the switch times are as before Eq. (\dref{eq-Ia}). The drift per slot is $\Delta/I^a$, with $\Delta$ and $I^a$ given in Eq. (\dref{eq-B}) and (\dref{eq-away}).
When a node is \emph{inactive}, its battery charges. Recall that we have assumed $c \,g > e_1, c\,g > e_2$, so the battery level at the \emph{active} node goes down. Thus, only the inactive node can reach the boundary $B_{max}$ and only the active node can reach the lower boundary $B_{min} = 0$. We assume that $B_{max}$ is much larger than the thresholds, so that if one of the nodes reaches some boundary, the other does not reach the opposite boundary in the same cycle.
In addition to the assumption of switching with differences in battery levels equal to the thresholds, in the analysis below we shall also assume that boundaries are reached by nodes exactly at slot times. As before, we point out that the simulation is performed without these assumptions.
Take $0$ to indicate the time of a switch when node $v$ becomes \emph{actiVe}. Recall that we denote by $x$ the other node, namely the one that will become active \emph{neXt}. The condition for the next switch (from route $v$ to route $x$) to occur after slot $I_v$ is given by Eq. (\dref{eq-caps}). Note that the switch time $I_v$ when boundaries are reached may not be the same as $I_v^a$, the switch time when no boundary is met.
If neither node reaches a boundary (0 or $B_{max}$), then the switch time is as before $I_v=I_v^a$.
Let
\begin{description}
\item[$I'_v$] = slot at the end of which node $v$ reaches 0 before a switch, where $0 < I'_v \leq I_v^a$
\item[$I''_v$] = slot at the end of which node $x$ reaches $B_{max}$ before a switch, where $0 < I''_v \leq I_v^a$
\end{description}
If the corresponding boundary is not reached before a switch, then $I'_v \, , I''_v$ respectively is defined to be equal to $I_v$. Note that if either node reaches some boundary before a switch, it stays at that boundary until the next switch, and the other node cannot reach the opposite boundary. Also note that until a boundary is reached, both the $min$ and the $max$ operands in the Code above are inactive.
The switch condition (\dref{eq-caps}) becomes:
\begin{equation}\cmd{EB}
e_x\,\cdot I''_v + (\, c\, g\, - e_v)\,I'_v = h
\EE{eq-swCC}
The cycle dynamics is given below.
\ls{0.3}%
\renewcommand{}{X}%
\daddcontentsline{lot}{table}{\debug{\fbox{}}}%
\begin{minipage}{6.25in}%
\ls{0.3}\setcounter{line}{0}%
\begin{tabbing}%
0000\debug{000} \= 111 \= 222 \= 333 \= 444 \= 555 \= 666 \= 777
\= 888 \= 999 \= 000 \kill
\prntvar\\%
{\em Node v is actiVe, node x is neXt} \` /* $x = v \, mod \, 2 + 1$ \\%
\stepcounter{protblock}
\nl{m}\> $I_v^a = h/(c\,g + e_x -e_v)$
\nl{s}\>$\mbox{\boldmath $case \;\; $} (B_{max}-B_x(0))/e_x < I_v^a$ \{ \` /*node $x$ reaches boundary $B_{max}$
\nl{a}\>\> $I''_v = (B_{max}-B_x(0))/e_x$
\nl{x}\>\> $I_v = (h - (B_{max} - B_x(0)))/(c\,g - e_v)$
\nl{r}\>\> $B_v(I_v) = B_v(0) - I_v\,(c\,g - e_v)\text{ ; }B_x(I_v) = B_{max}$
\nl{f}\>\> $\gamma^c_v=I_v \, g$ \\
\>\> \}
\nl{y}\>$\mbox{\boldmath $case \;\; $} B_v(0)/(c\,g-e_v) < I_v^a$\{ \`/*node $v$ reaches boundary $0$
\nl{b}\>\> $I'_v = B_v(0)/(c\,g-e_v)$
\nl{g}\>\> $I_v = (h - (B_v(0)))/e_x$
\nl{c}\>\> $B_v(I_v) = 0\text{ ; }B_x(I_v) = B_x(0) + I _v\,e_x$
\nl{h}\>\> $\gamma^c_v=I'_v\, g+ (I_v-I'_v)\,(e_v)/c$ \\
\>\> \}
\nl{i}\> $\mbox{\boldmath $else \;\; $}$\{ \` neither node reaches boundary
\nl{j}\>\>\> $I_v = I_v^a$
\nl{p}\>\>\> $B_v(I_v) = B_v(0)-I_v\,(c\,g - e_v)\text{ ; }B_x(I_v) = B_v(0)+I_v\,c\,g$
\nl{k}\>\>\> $\gamma^c_v = I_v \, g$ \\
\>\> \} \\
\end{tabbing}
\end{minipage}
\ls{1.2}
\msubsection{System Throughput and Operation close to the boundaries}{low}
In this Section we examine the operation of the system in terms of throughput and split ratio, at low and high battery level.
We start with low level. If $e_1 + e_2 < c\,g$, the battery levels will drift down while seesawing. An example appears in Fig. \dref{fig-case1}.
\begin{figure}[hbtp]
\begin{center}
\includegraphics[scale=0.5]{Fig2.jpg}
\caption{Only node 1 is at boundary 0 for a non-zero period of time\debug{\fbox{fig-case1}}\label{fig-case1}}
\end{center}
\end{figure}
As we shall see in the sequel, after the time when one of the nodes reaches the boundary 0, the system operates in a periodic dynamic steady state. There are two cases: i) only one node is ever empty for a non-zero period of time ; ii) both nodes alternately reach 0. The condition for these to happen is given below.
\LB{lemma-0}
If $h_1/h_2 \ge (c\,g - e_2)/e_1$, then $B_2$ is never empty for a non-zero period of time and the throughput during a cycle, the cycle length, and the average throughput are as in Eq. (\dref{eq-cycle}) below.
\LE
{\em Proof:\/\ }\cmd{ PB}
The condition above is equivalent to $h_1\, e_1 + h_2\,e_2 - h_2 \,c\,g \ge 0$.
The switch from route 1 to route 2 occurs after slot $I$
when $B_2(I) = B_1(I) + h_1 \ge h_1$.
Afterwards, $B_2$ goes down at a rate $(c\, g -e_2)\,\mu J /slot$.
Node $B_2$ will reach 0 only if during the next $I_2^a$ slots (namely before the next switch) it will do so.
Thus if $h_1-I_2^a\cdot(c\,g - e_2) \ge 0$, the battery $B_2$ will never be at $B_{min}$ for a non-zero period.
Substituting for $I_2^a$ from Eq. (\dref{eq-away}), we obtain the condition above.
Since the system drifts down, at least one battery must hit 0 and if the condition in the Lemma holds, only $B_1$ can do so. After the first time it hits 0, it waits for $B_2$ to reach $h_1$, at which time a switch from route 1 to route 2 occurs. Rename the slot at the end of which this occurs as $I=0$. From this slot on, the system is in dynamic steady state.
The next switch, from 2 to 1, occurs at time $I_2^a$ , and the battery levels are
\begin{equation}\cmd{EB}
B_1(I_2^a) = I_2^a\cdot e_1=\frac{e_1\,h}{c\,g + (e_1-e_2)}
\EE{eq-bat1}
and
\begin{equation}\cmd{EB}
B_2(I_2^a) = B_2(0)+ \delta B_2(I_2^a) =
h_1-\frac{(h_1+h_2)(c\,g-e_2)}{c\,g +(e_1-e_2)} =
\frac{h_1\,e_1 - h_2\,(c\,g -e_2)}{c\,g +(e_1-e_2)}
\EE{eq-bat2}
If we again rename the slot after which the switch from route 2 to route 1 occurs as $I=0$, the battery $B_1$ drains out at time
\SB
I'_1= \frac{e_1\,h}{(c\,g + (e_1-e_2))(c\,g - e_1)}
\SE
and then node 1 waits for $B_2$ to charge to level $h_1$ at time
\SB
(h-\frac{e_1\,h}{c\,g + (e_1-e_2)})/e_2=\frac{h(c\,g-e_2)}{e_2 \cdot (c\,g+(e_1-e_2))}\text{ , }
\SE
where the switch from 1 to 2 occurs at battery levels (\dref{eq-bat1}) , (\dref{eq-bat2}). The scenario repeats from now on.
While active and in dynamic steady state, node 2 transfers a total of
$\gamma^c_2 = (g\,h)/(e_1 - e_2 + c\,g)\text{ packets/cycle } $ , and node 1 transfers
$\gamma^c_1 = (e_1\, g\,h)/ (e_2\,(e_1 - e_2 + c\,g))\text{ packets/cycle } $. The split ratio is
\SB
\gamma_1/\gamma_2 =e_1/e_2
\SE
The total throughput in a cycle $\gamma^c$, the number of slots in a cycle $I$ and the average throughput $\gamma = \gamma^c/I$ are:
\begin{equation}\cmd{EB}
\gamma^c = \frac{g\,(e_1+e_2)\,h}{e_2\,(e_1-e_2+c\,g)}\text { ; }
I = \frac{c\,g\,h}{e_2\cdot(c\,g + e_1 - e_2)}\text{ ; }
\gamma = \frac{e_1+e_2}{c} \text{ packets/slot}
\EE{eq-cycle}
Note that, since $c\,g > e_1 + e_2$, the average throughput above is the maximal possible.
$\otimes$
\LB{lemma-2}
If $h_1/h_2 \leq e_2/(c\,g - e_1)$ , then $B_1$ never empties out and the throughput during a cycle, the cycle length and the average throughput are as in Eq. (\dref{eq-cycle}) with indexes 1 and 2 interchanged.
\LE
\LB{lemma-1}
If $ e_2/(c\,g - e_1) < h_1/h_2 < (c\,g-e_2)/e_1$ , then both batteries alternately reach level 0 and stay there for non-zero numbers of slots, and the throughput during a cycle, the cycle length and the average throughput are as in Eq. (\dref{eq-cycle1}).
\LE
{\em Proof:\/\ }\cmd{ PB}
An example appears in Fig. \dref{fig-case2}.
Since the system drifts down, at least one battery must eventually drain out. Suppose node 1 is the \textbf{first} that hits battery level 0 at a time \emph{that is not its lower tip} . Then it waits for $B_2$ to reach $h_1$, at which time a switch from route 1 to route 2 occurs. Let $I=0$ indicate the slot after which this happens. From this time on, the system is in dynamic steady state.
\begin{figure}[hbtp]
\begin{center}
\includegraphics[scale=0.5]{Fig3.jpg}
\caption{Both nodes empty out alternately\debug{\fbox{fig-case2}}\label{fig-case2}}
\end{center}
\end{figure}
At time $I'_2 = h_1/(c\,g -e_2)<h_2/e_1$, the battery $B_2$ reaches 0. It waits for $B_1$ to reach $h_2$ at time $I_2= h_2/e_1$, at which time the switch from node 2 to node 1 occurs (see Fig. \dref{fig-case2}). The battery levels at this time are
\begin{equation}\cmd{EB}
B_1(I_2) = h_2\text{ ; } B_2(I_2) = 0
\EE{eq-bat3}
Counting slots after that switch, $B_1$ drains out at time $I'_1= h_2/(c\,g - e_1)<h_1/e_2$, waits for $B_2$ to charge to level $h_1$ at time $h_1/e_2$, where the switch from 1 to 2 occurs at battery levels corresponding to (\dref{eq-bat3}) with exchanged indices.
While active, node 2 transfers a total of
$\gamma^c_2 = (e_1\,h_1+e_2\,h_2)/(c\,e_1)$
packets, and node 1 transfers
$\gamma^c_1 = (e_1\,h_1+e_2\,h_2)/(c\,e_2)$. The split ratio is
$\gamma^c_1/\gamma^c_2 =e_1/e_2$.
The total throughput in a cycle $\gamma^c$, the total number of slots in a cycle $I$ and the average throughput $\gamma= \gamma^c/I$ are
\begin{equation}\cmd{EB}
\gamma^c = \frac{(e_1+e_2)(e_1\,h_1 + e_2\,h_2)}{c\,e_1\,e_2}\text{ ; }
I = \frac{h_1\,e_1+h_2\,e_2}{e_1 \,e_2}\text{ ; }
\gamma = \frac{e_1 + e_2}{c} \text{ packets/slot}
\EE{eq-cycle1}
$\otimes$
Next we consider the case when the input rate is less that the total harvesting rates, namely $e_1 + e_2 > c\,g $. In this case the battery levels will drift up while seesawing. The operation here is similar to the one at low-level batteries. An example when only node 2 reaches $B_{max}$ appears in Fig. \dref{fig-case3}. The properties for all cases are stated in the summary section below without proofs. The proofs are similar to the ones above.
\begin{figure}[hbtp]
\begin{center}
\includegraphics[scale=0.5]{Fig4.jpg}
\caption{Node 2 reaches $B_{max}$\debug{\fbox{fig-case3}}\label{fig-case3}}
\end{center}
\end{figure}
\msubsection{Summary of Analytic Results}{summary}
\TB{T-Summary}
Under the assumptions that:
\begin{enumerate}
\item the energies $c_t,c_r$ spent for control are negligible
\item all switches occur at times when the difference in battery levels is exactly equal to the thresholds
\item boundaries are reached at slot time
\end{enumerate}
the system behaves as follows
\begin{enumerate}
\item
While away from the boundaries
\SB
I_1=I_1^a =\frac{h}{c\,g + e_2-e_1}\text{ slots ; }
I_2=I_2^a=\frac{h}{c\,g + e_1-e_2}\text{ slots }
\SE
\SB
\gamma^c_1 = \frac{g\,h}{c\,g + e_2-e_1}\text{ packets ; }
\gamma^c_2 = \frac{g\,h}{c\,g + e_1-e_2}\text{ packets}
\SE
\SB
\frac{\gamma^c_1}{\gamma^c_2} = \frac{c\,g + e_1-e_2}{c\,g + e_2-e_1} \text{ ; }
\gamma^c = \frac{2\,c\,g^2\,h}{(c\,g)^2 - (e_1-e_2)^2 }\text{ packets ; }
\SE
\SB
I = \frac{2\,c\,g\,h}{(c\,g)^2 - (e_1-e_2)^2 } \text{ slots ; }
\gamma = g\text{ packets/slot ; }
\text{Drift per cycle} = \frac{e_1 + e_2 - c\,g}{2}\,\,\mu J
\SE
\item
If $ e_1+e_2 = c\,g$ and the battery levels are initially far from the boundaries, then they are in dynamic steady state with the following:
\SB
I_1=I_1^a =\frac{h}{2\,e_2}\text{ slots ; }
I_2=I_2^a=\frac{h}{2\,e_1}\text{ slots }
\SE
\SB
\gamma^c_1 = \frac{g\,h}{2\,e_2}\text{ packets ; }
\gamma^c_2 = \frac{g\,h}{2\,e_1}\text{ packets}
\SE
\SB
\frac{\gamma^c_1}{\gamma^c_2} = \frac{e_1}{e_2} \text{ ; }
\gamma^c = \frac{c\,g^2\,h}{2\,e_1\,e_2}\text{ packets ; }
\SE
\SB
I = \frac{c\,g\,h}{2\,e_1\,e_2} \text{ slots ; }
\gamma = g\text{ packets/slot ; }
\text{Drift per cycle} = 0
\SE
\item
If $ e_1+e_2 < c\,g$, then the battery levels will drift down while seesawing and
\dB
\item{(a)} If $h_1/h_2 \le e_2/(c\,g - e_1)$ , then $B_1$ is never at level zero level for a non-zero amount of time and in steady state:
\SB
I_1 = \frac{h}{c\,g + (e_2-e_1)}\text{ slots ; }
I_2= \frac{h(c\,g-e_1)}{e_1 \cdot (c\,g+(e_2-e_1))}\text{ slots ; }
\SE
\SB
\gamma^c_1 = \frac{g\,h}{e_2 - e_1 + c\,g}\text{ packets ; }
\gamma^c_2 = \frac{e_2\, g\,h}{e_1\,(e_2 - e_1 + c\,g)}\text{ packets ; }
\SE
\SB
\frac{\gamma^c_1}{\gamma^c_2} =\frac{e_1}{e_2}{ ; }
\gamma^c = \frac{g\,(e_2+e_1)\,h}{e_1\,(e_2-e_1+c\,g)}\text { ; }
I = \frac{c\,g\,h}{e_1\cdot(c\,g + e_2 - e_1)}\text{ ; }
\gamma = \frac{e_1+e_2}{c} \text{ packets/slot}
\SE
\item{(b)}
If $h_1/h_2 \ge (c\,g - e_2)/e_1$, then $B_2$ is never at level zero for a non-zero amount of time and in steady state (see Eq. (\dref{eq-cycle})):
\SB
I_1= \frac{h(c\,g-e_2)}{e_2 \cdot (c\,g+(e_1-e_2))}\text{ ; }
I_2 = \frac{h}{c\,g + (e_1-e_2)}\text{ ; }
\gamma^c_1 = \frac{e_1\, g\,h}{e_2\,(e_1 - e_2 + c\,g)}\text{ ; }
\gamma^c_2 = \frac{g\,h}{e_1 - e_2 + c\,g}
\SE
\SB
\frac{\gamma^c_1}{\gamma^c_2} =\frac{e_1}{e_2}\text{ ; }
\gamma^c = \frac{g\,(e_1+e_2)\,h}{e_2\,(e_1-e_2+c\,g)}\text { ; }
I = \frac{c\,g\,h}{e_2\cdot(c\,g + e_1 - e_2)}\text{ ; }
\gamma = \frac{e_1+e_2}{c} \text{ packets/slot}
\SE
\item{(c)}
If $ e_2/(c\,g - e_1) < h_1/h_2 < (c\,g - e_2)/e_1$, then in steady state both batteries alternately reach level 0 for non-zero amounts of time and (see Eq. (\dref{eq-cycle1})):
\SB
I_1 = \frac{h(c\,g - e_2)}{e_2 ( c\,g +e_1 - e_2)}\text { ; }
I_2 = \frac{h}{c\,g +e_1-e_2}\text { ; }
\gamma^c_2 = \frac{e_1\,h_1+e_2\,h_2}{c\,e_1}\text { ; }
\gamma^c_1 = \frac{e_1\,h_1+e_2\,h_2}{c\,e_2}
\SE
\SB
\frac{\gamma^c_1}{\gamma^c_2} =\frac{e_1}{e_2}\text{ ; }
\gamma^c = \frac{(e_1+e_2)(e_1\,h_1 + e_2\,h_2)}{c\,e_1\,e_2}{ ; }
I = \frac{h_1\,e_1+h_2\,e_2}{e_1 \,e_2}\text{ ; }
\gamma = \frac{e_1 + e_2}{c} \text{ packets/slot}
\SE
\end{description}
\item
If $e_1+e_2 > c\,g$, then the battery levels will drift up while seesawing\footnote{In a previous version of this report, the conditions below were wrongly stated. Now they are correct - thanks to Alex Lavzin for perceiving the error.}
\dB
\item{(a)} If $h_1/h_2 \ge e_1/(c\,g-e_2)$ , then $B_1$ is never at $B_{max}$ for a non-zero amount of time and in steady state:
\SB
I_1 = \frac{e_1 \,h }{(c\,g - e_1)(c\,g +e_1-e_2)}\text{ ; }
I_2 = \frac{h}{c\,g +e_1 - e_2}\text{ ; }
\gamma^c_1 = \frac{e_1 \,h\,g }{(c\,g - e_1)(c\,g +e_1-e_2)}\text{ ; }
\SE
\SB
\gamma^c_2 = \frac{h\,g}{c\,g +e_1 - e_2}\text{ ; }
\gamma^c = \frac{ c\, g^2\, h }{ (c\,g - e_1) (c\,g + e_1 - e_2 )}\text{ ; }
\frac{\gamma^c_1}{\gamma^c_2} = \frac{e_1}{c\,g - e_1}
\SE
\SB
I = \frac{c\,g\,h }{(c\,g - e_1)(c\,g + e_1 -e_2)}\text{ ; }
\gamma = g
\SE
\item{(b)} If $h_1/h_2 \le (c\,g-e_1)/e_2$ , then $B_2$ is never at $B_{max}$ for a non-zero amount of time and in steady state:
\SB
I_1 = \frac{h}{c\,g +e_2 - e_1}\text{ ; }
I_2 = \frac{e_2 \,h }{(c\,g - e_2)(c\,g +e_2-e_1)}\text{ ; }
\gamma^c_1 = \frac{h\,g}{c\,g +e_2 - e_1}
\SE
\SB
\gamma^c_2 = \frac{e_2 \,h\,g }{(c\,g - e_2)(c\,g +e_2-e_1)}\text{ ; }
\gamma^c = \frac{ c\, g^2\, h }{ (c\,g - e_2) (c\,g + e_2 - e_1 )}\text{ ; }
\frac{\gamma^c_1}{\gamma^c_2} = \frac{c\,g - e_2}{e_2}
\SE
\SB
I = \frac{c\,g\,h }{(c\,g - e_2)(c\,g + e_2 -e_1)}\text{ ; }
\gamma = g
\SE
\item{(c)} If $(c\,g-e_1)/e_2 < h_1/h_2 < e_1/(c\,g-e_2)$ , then both $B_1$ and $B_2$ alternately reach $B_{max}$ and stay there for non-zero amounts of time and in steady state:
\SB
I_1 = \frac{h_1}{c\,g - e_1}\text{ ; }
I_2 = \frac{h_2}{c\,g - e_2}\text{ ; }
\gamma^c_1 = \frac{g\,h_1}{c\,g - e_1}\text{ ; }
\gamma^c_2 = \frac{g\,h_2}{c\,g - e_2}
\SE
\SB
\gamma^c = \frac{ g\,(c\,g\,h -e_1\,h_2 - e_2\,h_1) }{ (c\,g - e_2) (c\,g - e_1 )}\text{ ; }
\frac{\gamma^c_1}{\gamma^c_2} = \frac{h_1\,(c\,g - e_2)}{h_2\,(c\,g - e_1)}\text{ ; }
I = \frac{ c\,g\,h -e_1\,h_2 - e_2\,h_1 }{ (c\,g - e_2) (c\,g - e_1 )}\text{ ; }
\gamma = g
\SE
\end{description}
\end{enumerate}
\TE
In words, we can summarize the dynamic steady state activity as follows:
\begin{enumerate}
\item If $e_1 + e_2= c\,g$, steady state occurs at all battery levels away from the boundaries. The throughput is $g$, with split ratio $e_1/e_2$, independent of the thresholds. The thresholds affect only the frequency of switching.
\item If $e_1 + e_2 < c\,g$, steady state occurs close to empty battery levels. The throughput is $(e_1 + e_2)/c$, with split ratio $e_1/e_2$, independent of the thresholds. The thresholds affect only the frequency of switching.
\item If $e_1 + e_2 > c\,g$, steady state occurs close to full battery levels. The throughput is $g$ with split ratio $\neq e_1/e_2$. The thresholds affect the split ratio, as well as the frequency of switching.
\end{enumerate}
\msec{Case when differences in battery levels at switch time do not exactly match the thresholds}{relax}
The switch from route 1 to route 2 (and viceversa) occurs at the end of the slot during which $h_1$ (respectively $h_2$) is reached. If $h_1$ or $h_2$ is reached during a slot (as opposed to just before the end of the slot), the difference in battery levels at switch time is larger than the corresponding threshold.
Consider the case $e_1 + e_2 = c\,g$, namely steady state when away from the boundaries. If the system starts with $B_2 = B_1 + h_2$ and if $h = h_1 + h_2$ is a multiple of both $2\,e_1$ and $2\,e_2$, then all switches will occur with battery level differences equal to the thresholds. Moreover, the battery levels at the end of each cycle are the same as the ones at the beginning of the cycle. Namely the dynamic steady state has \emph{a period of one cycle}.
If $h$ is not a multiple of $2\,e_1$ and $2\,e_2$, then thresholds will be reached not necessarily at the end of slots. As a result, the difference in battery levels at switch time will be larger than the threshold values. On the other hand, since $e_1 + e_2 = c\,g$, the battery levels do not drift and thus the system must be in dynamic steady state. The behavior is now that the battery levels do not return to their initial values after each cycle, but rather after more than one cycle. As a topic for future research, it will be interesting to find conditions for periods containing 1,2,3,.. cycles. We present in Table \dref{Table-Patterns} a few numerical examples for $e_1 = 0.6$, $e_2 = 0.8$, $c= 0.08$, $g = 17.5$. The third column is the number of cycles in each period. The first row in each entry are the switch times, namely the slots at the end of which the switch occurs. The second row represents the battery level differences at switch time.
\begin{table}[hbtp]
\begin{center}
\begin{tabular}{|l|l|c|c|c|c|c|c|c|c|}
\hline
$h_1$ &$h_2$ & period & \multicolumn{7}{c|}{switch at slot ; $B(1)- B(2)$}\\ \hline
4 &0.8 & 1 & 0 & 3 & 7 & & & &\\
& & & 0.8 & -4 & 0.8 & & & &\\ \hline
2 & 1 & 1 & 0 & 3 & 7 & & & &\\
& & & 1.4 & -3.4 & 1.4 & & & &\\ \hline
6.2 & 5 & 2 & 0 & 7 & 17 & 25 & 35 & & \\
& & & 5 & -6.2 & 5.8 & -7 & 5 & & \\ \hline
5 & 5 & 3 & 0 & 7 & 17 & 24 & 33 &40 &49 \\
& & & 5 & -6.2 & 5.8 & -5.4 & 5.4 & -5.8& 5\\
\hline
\end{tabular}
\caption{Switching Patterns \debug{\fbox{Table-Patterns}}\label{Table-Patterns}}
\end{center}
\end{table}
\msec{Non-negligible Power Consumption for Control Messages}{nonnegligible}
Here we consider the situation with non-zero $c_t$ and $c_r$ and look only at the operation away from the boundaries. If $h$ evenly divides the slot energies, the drift $\Delta$ and the cycle length are as in \dref{eq-B}, (\dref{eq-away})
Substituting $I^a$ into $\Delta$, we get
\begin{equation}\cmd{EB}
\Delta = -2\,c_r + \frac{c\,g\,h\,(\tilde{e} - c\,g)}{(c\,g)^2 - (e_2 - e_1)^2}\,\,mJ/cycle
\EE{eq-BD1}
where $\tilde{e} = e_1 + e_2 -2\,c_t$.
The condition for dynamic steady state is $\Delta = 0$. We obtain a quadratic equation for $g$, whose solution, denoted by $g_s$, is given by
\begin{equation}\cmd{EB}
g_s = \frac{h\,\tilde{e}+\sqrt{h^2\,\tilde{e}^2 + 8\,c_r\,(2\,c_r+h)\,(e_2 - e_1)^2}}{2\,c\,(2\,c_r+h)}
\EE{eq-g}
The throughput $g_s$ as a function of the thresholds is shown in Fig. \dref{fig-g}. As expected, the higher the thresholds the less energy is spent on control, since the inter-switch period goes up, and thus more energy is left for data messages. However, high thresholds can lead to the batteries reaching the boundary. With the values of $e_1,\,e_2,\,c$ as in the graph, the value of $g_s$ for negligible control is $(e_1+e_2)/c = 20$.
\begin{figure}[hbtp]
\begin{center}
\includegraphics[scale=0.5]{g.jpg}
\caption{$g_a$ as a function of $h$\debug{\fbox{fig-g}}\label{fig-g}}
\end{center}
\end{figure}
At this point, recall that the analysis is correct if $I_1^a$ and $I_2^a$ are integers.
It is difficult to get explicit conditions for this to hold for arbitrary control values $c_t$ and $c_r$ and we have to resort to numerical simulations.
Consider for example the situation in Fig. \dref{fig-crct}, where $e_1 = 0.8\,\,;\,\,e_2 = 0.6\,\,;\,\,c=0.08\,\,;\,\,h_1 = 6.2\,\,;\,\,h_2 = 5\,\,;\,\,c_r = 0.05\,\,;\,\,c_t = 0.01$.
We get $g_s = 17.10$. The plot shows a drift of about $0.5\, mJ$ in 1000 slots.
This is due to the fact that an average cycle length turns out to be 18.72 slots, as opposed to the theoretical 16.73 slots given by Eq. (\dref{eq-away}).
As an exercise, we have performed the same simulation, but at each step we estimate the current average cycle length and adjust the input rate $g$ so that $\Delta$ given by Eq. (\dref{eq-B}) is zero.
Not surprisingly, with this feedback, there is no drift (see Fig.\dref{fig-crctFeedback}).
\begin{figure}[hbtp]
\begin{center}
\includegraphics[scale=0.5]{crct.jpg}
\caption{Behavior of system with $g = g_s$ \debug{\fbox{fig-crct}}\label{fig-crct}}
\end{center}
\end{figure}
\begin{figure}[hbtp]
\begin{center}
\includegraphics[scale=0.5]{crctFeedback.jpg}
\caption{Behavior of system with $g$ obtained by estimating $I^a$ \debug{\fbox{fig-crctFeedback}}\label{fig-crctFeedback}}
\end{center}
\end{figure}
\msec{Summary so far}{Implications}
The analysis above is performed for a simple system with several helpful assumptions. We have extended it in several directions, like non-negligible power spent on control messages, but we can look at its implications to more general practical systems. In practice, the harvesting rates are time varying, according to various parameters, like time of day and illumination conditions. Our discussion here assumes that those variations are relatively slow. If the pattern is known, the source can try to adapt to the current parameters. For example, it should increase the input rate $g$ when the harvesting rates increase. Also, in this simple network, the wireless transmissions of the intermediate nodes are overheard at the source. The latter can use this information in order to adapt the input rate.
Consider now extensions of the \emph{HDR Algorithm} to larger networks, either with one data collection point (several sources, one destination) or with several source-destination pairs. Many routing procedures have been proposed for legacy ad-hoc and sensor networks with a variety of performance criteria, like maximum lifetime or maximum total throughput (see e.g. \dcite{AY}, \dcite{ASSC}, \dcite{KK}, \dcite{LS} and references therein). In such networks the units spend energy and thus the battery level only goes down. Those algorithms do not seem to be applicable to networks with energy harvesting units, where energy also increases via harvesting. In networks with harvesting nodes, lifetime and total throughput have no meaning.
The analysis in this first work on the topic of routing in harvesting node networks can provide an insight for larger networks. Assuming that the topology of the network does not change often (e.g. tags on books in a library, static tags in a room or building), two or more paths can be established in advance for every source-destination pair. If all units have similar harvesting rates, it makes sense to select node-disjoint paths. If there are units with significantly larger harvesting rates than the others, they can participate in more than one path. One can think of several simple centralized or distributed algorithms to select the paths, but this topic is outside the scope of the present work. The energy levels of the nodes on the path can be periodically collected, either piggy-backed on data messages or via control messages. Using a threshold mechanism as given by the \emph{HDR Algorithm} on the maximum battery level along the path, the destination can decide which path to use. Again, the exact procedures for collecting data and for informing nodes in the network upon the path selection are topics for future research. For instance, one can also consider situations when the collection node has a powerful transmitter that can be simultaneously heard by all nodes. In this case, it can directly communicate routes and switching decisions to all nodes.
\msec{Three Forwarding Nodes}{three}
Having extensively discussed the diamond configuration and having obtained detailed results for its behavior, we can now adventure into looking at larger networks.
In this section we analyze the behaviour of the \emph{HDR Algorithm} in a network with three parallel paths (see Fig. \dref{fig-3nodes}).
\begin{figure}[hbtp]
\begin{center}
\includegraphics[scale=1]{Fig5.jpg}
\caption{Three Forwarding Nodes\debug{\fbox{fig-3nodes}}\label{fig-3nodes}}
\end{center}
\end{figure}
We first consider a simple switching policy, whereby the routes are switched in a round-robin fashion, with thresholds $h_1$, $h_2$, $h_3$ for the switches (1,2),(2,3),(3,1) respectively.
\msubsection{Operation away from the boundaries}{away3}
Let $v$ denote the current actiVe node and $x$ denote the neXt active node. Let $I_v^a$ denote the number of slots when the destination employs route $v$ while the batteries \emph{are away from the boundaries}. We also assume as before that switching occurs at battery level differences exactly matching the value of the thresholds.
If we denote $I^a = I_1^a + I_2^a + I_3^a$ and refer to $I^a$ as a \emph{cycle}, then the operation away from the boundaries is:
\begin{eqnarray}
\nonumber B^{-}_1(0)=B{-}_3(0 )+h_3\text{ ; }B_u(0) = B^{-}_u(0) - c_t -c_r\\
\nonumber B^{-}_2 (I_1^a) = B^{-}_1(I_1^a) + h_1\text{ ; }B_u(I_1^a) = B^{-}_u(I_1^a) - c_t -c_r\\
\nonumber B^{-}_3 (I_1^a+I_2^a) = B^{-}_2(I_1^a+I_2^a) + h_2\text{ ; }B_u(I^a) = B^{-}_u(I^a) - c_t -c_r\\
\nonumber B_1(I_1^a) = B_1(0) - (c\,g+c_t -e_1)\,I_1^a - c_r \\
\nonumber B_2(I_1^a) = B_2(0) + (e_2-c_t)\, I_1^a - c_r \\
\nonumber B_3(I_1^a) = B_3(0) + (e_3-c_t)\, I_1^a -c_r\\
\nonumber B_1(I_1^a+I_2^a) = B_1(I_1^a) + (e_1-c_t)\,I_2^a - c_r \\
\nonumber B_2(I_1^a+I_2^a) = B_2(I_1^a) - (c\,g + c_t - e_2)\,I_2^a -c_r \\
\nonumber B_3(I_1^a+I_2^a) = B_3(I_1^a) + (e_3 - c_t)\,I_2^a -c_r\\
\nonumber B_1(I^a) = B_1(I_1^a+I_2^a) + (e_1-c_t)\,I_3^a - c_r\\
\nonumber B_2(I^a) = B_2(I_1^a+I_2^a) + (e_2 - c_t)\,I_3^a - c_r\\
B_3(I^a) = B_3(I_1^a+I_2^a) - (c\,g + c_t - e_3)\,I_3^a - c_r
\end{eqnarray}
We also require that we are in dynamic steady state, namely that the change in battery level during a cycle is the same for all three batteries (denoted by $\Delta$):
\SB
\Delta = B_1(I^a)-B_1(0) = B_2(I^a)-B_2(0) = B_3(I^a) - B_3(0)
\SE
Substituting above, and selecting the initial condition $B_1(0) = B10$, the system of linear equations has a unique solution. We give here explicitly only the expressions for $I_1^a$, $I_2^a$, $I_3^a$ and for the drift.
\begin{eqnarray}
\nonumber I_1^a = \frac{h\,(c\,g + 2\,e_1 -e_2 -e_3)}{2\,(c^2\,g^2 -e_1^2 - e_2^2 -e_3^2 +e_1\,e_2+e_2\,e_3 +e_3\,e_1)} \\
\nonumber I_2^a = \frac{h\,(c\,g + 2\,e_2 -e_1 -e_3)}{2\,(c^2\,g^2 -e_1^2 - e_2^2 -e_3^2 +e_1\,e_2+e_2\,e_3 +e_3\,e_1)} \\
I_3^a = \frac{h\,(c\,g + 2\,e_3 -e_1 -e_2)}{2\,(c^2\,g^2 -e_1^2 - e_2^2 -e_3^2 +e_1\,e_2+e_2\,e_3 +e_3\,e_1)} \dlabel{eq-away3}
\end{eqnarray}
The throughput is $g$ packets/slot and the split ratio is
\SB
\gamma_1 : \gamma_2 : \gamma_3 = (c\,g + 2\,e_1 -e_2 -e_3) : (c\,g + 2\,e_2 -e_1 -e_3) : (c\,g + 2\,e_3 -e_1 -e_2)
\SE
The cycle length and the drift are
\SB
I^a = \frac{3\,c\,g\,(h_1 + h_2 + h_3)}{2\,(c^2\,g^2 -e_1^2 - e_2^2 -e_3^2 +e_1\,e_2+e_2\,e_3 +e_2\,e_3)}
\SE
\begin{equation}\cmd{EB}
\Delta = -3c_r - \frac{c\,g\,h\,(c\,g - \tilde{e})}{2\,(c^2\,g^2 -E )}
\EE{eq-3drift}
where $\tilde{e} = e_1 + e_2 + e_3-3\,c_t$ and $E = e_1^2 + e_2^2 + e_3^2 - e_1\,e_2 - e_2\,e_3 -e_3\,e_1$.
The system is in steady state if $\Delta = 0$, which occurs at input rate $g = g_s$ given by the solution of the corresponding quadratic equation
\begin{equation}\cmd{EB}
g_s = \frac{h\,\tilde{e}+\sqrt{h^2\,\tilde{e}^2 + 24\,c_r\,(6\,c_r+h)\,E}}{2\,c\,(6\,c_r+h)}
\EE{eq-steady}
\begin{figure}[hbtp]
\begin{center}
\includegraphics[scale=0.5]{g3.jpg}
\caption{$g_s$ as a function of $h$ for a system with 3 forwarding nodes\debug{\fbox{fig-g3}}\label{fig-g3}}
\end{center}
\end{figure}
For $c_r = c_t = 0$, the drift is zero if $ e_1 +e_2 + e_3 = c\,g$, and then $ \gamma_1 : \gamma_2 : \gamma_3 = e_1 : e_2 : e_3$, namely there is no drift and the throughput through each node is proportional to its harvesting rate.
\msubsection{Operation close to the boundaries - negligible control}{close3}
Here we assume negligible energy spending for control messages. If $e_1+e_2+e_3 > c\,g$, the battery levels drift up, until at least one of them reaches $B_{max}$. Similarly, if $ e_1+e_2+e_3 < c\,g$, then the drift is down, until at least one of the batteries empties out. Before reaching the boundary, the switch times are as before Eq. (\dref{eq-away3}). The drift is $\Delta$.
Obviously, when a node is inactive, its battery charges. As before, we assume
$c \,g > max(e_1, e_2, e_3)$, so the battery level at the active node goes down. Thus, only the inactive nodes can reach the boundary $B_{max}$ and only the active node can reach the boundary 0.
\emph{We look first at the system just after a switch from route 3 to route 1.} We shall temporarily refer to the time when this occurs as slot 0. The condition for the next switch (from route 1 to route 2) to occur at the end of slot $I_1$ is given by Eq. (\dref{eq-caps}), which here translates to
\begin{equation}\cmd{EB}
\sum\limits_{0<j\le I_1}( e_2\,1_{( B_2(j-1) < B_{max})}- e_1\,1_{(0< B_1(j-1) )} )+\sum\limits_{0<j\le I_1}c\,g\,1_{(0< B_1(j-1) )}=h_1+ B_1(0) - B_2(0)
\EE{eq-sw3}
Note that since the switch at time 0 is from node 3 and not from node 2, in general $B_1(0) - B_2(0) \neq h_2$.
Note that the switch time $I_1$ when boundaries may be reached for a non-zero amount of time may not be the same as $I_1^a$, the switch time when no boundary is met.
Since nodes 2 and 3 are inactive during $I_1$, their battery level increases, at rates $e_2 , \, e_3 \,\,mJ /slot$ respectively. On the other hand, since $c\,g > e_1$, the battery level at the active node decreases, at a rate $(c\,g - e_1)\, mJ $/slot. For now we assume that $B_{max}$ is large and hence only one of the boundaries can be reached in a given cycle. If none of the three nodes reaches a boundary, then the switch time is at time
\SB
I_1^b = max\left(0,\frac{h_1 + B_1(0) - B_2(0)}{c\,g +e_2 -e_1}\right)
\SE
Let
\begin{description}
\item[$I'_1$] = slot when node 1 reaches $0$ for a non-zero amount of time, where $0 < I'_1 \leq I_1^b$
\item[$I''_1$] = slot when node 2 reaches $B_{max}$ for a non-zero amount of time, where $0 < I''_1 \leq I_1^b$
\end{description}
Each of the two quantities above are defined to equal $I_1$ if the corresponding boundary is not reached for a non-zero amount of time. Note that if any node reaches some boundary, it stays at that boundary until the next switch.
Therefore the switch condition (\dref{eq-sw3}) becomes:
\begin{equation}\cmd{EB}
e_2\cdot I''_1 + (\, c\, g\, - e_1\,)I'_1 = h_1 + B_1(0) - B_2(0)
\EE{eq-swCC3}
if $h_1 + B_1(0) - B_2(0) > 0$ and $I_1 = I'_1 = I''_1 = 0$ otherwise.
The total number of packets transferred $\gamma^c_1$ is $I'_1\cdot g + (I_1-I'_1)\cdot (e_1/c) $ if $I'_1 < I_1^b$ and $I_1\cdot g $ otherwise.
The operation of the system is similar upon the switch from 2 to 3 and then from 3 to 1 (with a round robin substitution).
The evolution of the system is given below, where $B_1(0), B_2(0), B_3(0)$ are the battery levels at their respective time 0:
\vspace{1cm}
\ls{0.3}%
\renewcommand{}{X3}%
\daddcontentsline{lot}{table}{\debug{\fbox{}}}%
\begin{minipage}{6.25in}%
\ls{0.3}\setcounter{line}{0}%
\begin{tabbing}%
0000\debug{000} \= 111 \= 222 \= 333 \= 444 \= 555 \= 666 \= 777
\= 888 \= 999 \= 000 \kill
\prntvar\\%
{\em Node v is active, node x is next} \` /* $x = v \, mod \, 3 + 1$ \\%
\stepcounter{protblock}
\nl{m}\> $I^b = max(0,(h_v +B_v(0) - B_x(0)/(c\,g + e_x -e_v))$
\nl{s}\>$\mbox{\boldmath $case \;\; $} ((B_{max}-B_x(0))/e_x) < I^b$ \{ \` /*node $x$ reaches limit $B_{max}$
\nl{a}\>\> $I''_v = (B_{max}-B_x(0))/e_x$
\nl{d}\>\> $I_v = (h_v - (B_{max} - B_v(0))/(c\,g - e_v)$
\nl{e}\>\> $B_v(I_v) = B_v(0)-I_v\,(c\,g-e_v)\text{ ; }B_x(I_v) = B_{max}$
\nl{n}\>\> $B_u(I_v) = min(B_u(0)+I_v\,e_u, B_{max})$\`/* $u$ is the third node
\nl{f}\>\> $\gamma_v=I_v \, g$ \\
\>\> \}
\nl{y}\>$\mbox{\boldmath $case \;\; $} (B_v(0)/(c\,g-e_v) < I^b)$\{ \`/*node $v$ reaches limit 0
\nl{b}\>\> $I'_v = B_v(0)/(c\,g-e_v)$
\nl{g}\>\>\> $I_v = (h_v - B_x(0))/e_x$
\nl{r}\>\>\> $B_v(I_v)=0\text{ ; }B_x(I_v)= B_x(0)+I_v\,c\,g$
\nl{c}\>\>\> $B_u(I_v)= B_u(0)+I_v\,e_u$\`/* $u$ is the third node
\nl{h}\>\>\> $\gamma_v=I'_v\, g+ (I_v-I'_v)\,(e_v/c)$ \\
\>\> \}
\nl{i}\> $\mbox{\boldmath $else \;\; $}$\{ \` neither node reaches limit
\nl{j}\>\>\> $I_v = I^b$
\nl{p}\>\>\> $B_v(I_v) = B_v(0)-I_v\,(c\,g - e_v)\text{ ; }B_x(I_v) = B_v(0)+I_v\,c\,g$
\nl{o}\>\>\> $B_u(I_v)= B_u(0)+I_v\,e_u$\`/* $u$ is the third node
\nl{k}\>\>\> $\gamma_v = I_v \, g$ \\
\>\> \} \\
\end{tabbing}
\end{minipage}
\ls{1.2}
\msubsection{The Earliest Switch schedule}{ES}
In the Round Robin (RR) switching policy, the active routes are pre-assigned. Suppose node 1 is active. A switch will occur only when the battery level at node 2 exceeds the battery level at node 1 by the corresponding threshold. On the other hand, the battery level at node 3 may exceed the corresponding threshold much earlier. If we allow switches from 1 to 3 as well, the performance of the algorithm might improve. To investigate this possibility, we consider here the \emph{Earliest Switch (ES) schedule}. In \emph{ES}, routes are switched to the node that first reaches the corresponding threshold. For simplicity, we look only at the case when the thresholds $h_{12}, h_{13}$ for the switch from 1 to 2 and from 1 to 3 respectively, are the same, namely $h_{12} = h_{13} = h_1$. Similarly $h_{23} = h_{21} = h_2$ and
$h_{31} = h_{32} = h_3$. Also, we assume negligible $c_t$ and $c_r$ and take $c = 0.08 mJ$/packet.
We have selected a series of sets of parameters as in Table \dref{Table-Param}. We have run all simulations for a duration of 2000 slots, with statistics gathered only beginning at slot 301, to allow for the system to reach dynamic steady state.
\begin{table}[hbtp]
\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|c|c|l|}
\hline
Config & $c\,g$ & $e_1$ & $e_2$ & $e_3$ & $h_1$ & $h_2$ & $h_3$ & Bmax & Comment \\ \hline
A & 1.6 & 0.1 & 0.7 & 0.8 & 5 & 10 & 10 & 100 & $c\,g = e_1 +e_2 + e_3$ \\ \hline
B & 1.6 & 0.1 & 0.7 & 0.8 & 5 & 10 & 10 & 12 & $c\,g = e_1 +e_2 + e_3$ \\ \hline
C & 2.4 & 0.1 & 0.7 & 0.8 & 5 & 10 & 10 & 100 & $c\,g > e_1 +e_2 + e_3$ \\ \hline
D & 1.2 & 0.1 & 0.7 & 0.8 & 5 & 10 & 10 & 100 & $c\,g < e_1 +e_2 + e_3$ \\ \hline
E & 0.2 & 0.1 & 0.01 & 0.01 & 5 & 10 & 10 & 60 & $c\,g > e_1 +e_2 + e_3$ \\ \hline
F & 1.2 & 0.1 & 0.7 & 0.8 & 10 & 10 & 10 & 100 & $c\,g < e_1 +e_2 + e_3$ \\ \hline
G & 1.6 & 0.1 & 0.7 & 0.8 & 5 & 10 & 10 & 60 & $c\,g = e_1 +e_2 + e_3$ \\ \hline
\end{tabular}
\caption{Parameters\debug{\fbox{Table-Param}}\label{Table-Param}}
\end{center}
\end{table}
The results are given in the Table \dref{Table-Results}. We could not find a conclusive statement as to when does the ES schedule perform significantly better then RR. In general, when $Bmax$ is low, it seems that RR waists time in waiting for the corresponding threshold to be reached.
\begin{table}[hbtp]
\begin{center}
\begin{tabular}{|c|c|c|c|}
\hline
Config & & RR & ES \\ \hline
A & Thruput & 20 & 20 \\ \cline{2-4}
& ave cycle (slots) & 32 & 34 \\ \cline{2-4}
& $\#$ of switches & 163 & 156 \\ \hline
B & Thruput & 18.75 & 19.91 \\ \cline{2-4}
& ave cycle (slots) & 13.3 & 28.03 \\ \cline{2-4}
& $\#$ of switches & 163 & 157 \\ \hline
C & Thruput & 20 & 20 \\ \cline{2-4}
& ave cycle (slots) & 46 & 18.52 \\ \cline{2-4}
& $\#$ of switches & 109 & 152 \\ \hline
D & Thruput & 15 & 15 \\ \cline{2-4}
& ave cycle (slots) & 31.3 & 28.8 \\ \cline{2-4}
& $\#$ of switches & 100 & 91 \\ \hline
E & Thruput & 20 & 20 \\ \cline{2-4}
& ave cycle (slots) & 32 & 34 \\ \cline{2-4}
& $\#$ of switches & 163 & 156 \\ \hline
F & Thruput & 15 & 15 \\ \cline{2-4}
& ave cycle (slots) & 36 & 33 \\ \cline{2-4}
& $\#$ of switches & 82 & 85 \\ \hline
G & Thruput & 20 & 20 \\ \cline{2-4}
& ave cycle (slots) & 30.8 & 33 \\ \cline{2-4}
& $\#$ of switches & 163 & 153 \\ \hline
\end{tabular}
\caption{Comparison of Throughputs\debug{\fbox{Table-Results}}\label{Table-Results}}
\end{center}
\end{table}
In the scenario of Fig. \dref{fig-case6}, node 2 becomes active starting at the end of slot 8 and its threshold is $h_2 = 10$. It reaches boundary 0 at end of slot 12 and waits for the other nodes to gather sufficient energy. In RR (not depicted), it would wait for the battery level at node 3, its pre-assigned successor, to reach value 10, which would happen during slot 21. However, the battery level at node 1 reaches value 10 earlier, during slot 17 and in ES, the destination will reroute to node 1 at the end of that slot. The number of packets forwarded from end of slot 17 until the end of slot 21 is the following. In RR, node 2 is active at level 0 and thus it forwards data at rate $e_2/c = 10 \,\, packets/slot$, whereas in ES, node 1 is active away from boundaries and thus it transmits at rate $g = 31 \,\, packets/slot$, for a total gain of $(31-10) \cdot 4 = 84 \,\, packets$.
\begin{figure}[hbtp]
\begin{center}
\includegraphics[scale= 0.5]{SwitchToEarliest.jpg}
\caption{Node 1 becomes active after node 2\debug{\fbox{fig-case6}}\label{fig-case6}}
\end{center}
\end{figure}
\msec{Variable Harvesting Rates and Inputs}{variableV}
Practical systems cannot guarantee time invariant harvesting rates. When harvesting rates and inputs are time varying, the energy equations are the same as in the Algorithm in Sec. \dref{energy}, except that the parameters $e_v(i),e_x(i),g(i)$ are time dependent.
Fig.\dref{fig-Harvest} approximates the pattern of harvesting of two nodes over 8,000 slots that appears in \dcite{GMSplus}. We have investigated the behavior of the system with $c = 0.08, c_t = 0.01, c_r = 0.05, B_{max} = 200$ and two types of inputs, each totaling 48,000 packets over 8,000 slots. With these parameters the total energy required to transfer the packets is 48,000 * 0.08 = 3,840 mJ. During the period under consideration, the nodes harvest 2,553 and 1,595 mJ respectively, for a total of 4,148 mJ. With transmission status messages requiring 160 mJ and receipt of switch commands requiring about 10 mJ, if the harvest and inputs were uniformly distributed, the harvest would have been more than sufficient to transfer all packets.
\begin{figure}[hbtp]
\begin{center}
\includegraphics[scale=1]{Harvest.eps}
\caption{Variable harvesting and input\debug{\fbox{fig-Harvest}}\label{fig-Harvest}}
\end{center}
\end{figure}
In our time-varying scenarios, the harvest changes with time. In the first scenario, the input is uniformly distributed at level of $0.48/c$. The contents of the batteries over the 8,000 slots is shown in Fig. \dref{fig-Variable1} and the inputs vs. the throughput over periods of 1000 slots each appears in Table \dref{Table-Thru1}.
\begin{table}[hbtp]
\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|c|c|}
\hline
input & 6000 & 6000 & 6000 & 6000& 6000 & 6000 & 6000 & 6000 \\ \hline
throughput & 1072 & 4150 & 5983 & 5994 & 5994 & 5994 & 5994 & 5994 \\ \hline
\end{tabular}
\caption{Inputs vs. Throughput in Scenario 1\debug{\fbox{Table-Thru1}}\label{Table-Thru1}}
\end{center}
\end{table}
During the first 1000 slots, node 1 has no harvesting and, except for the first few slots where it uses the initial battery energy (10 mJ), it cannot transfer any packets. Node 2 harvests 0.086 mJ/slot and thus can transfer roughly $g = e_2/c \cong 1 packet/slot$.
The total transfer during the first 1000 slots is 1072 packets. During this period, the source tries to send $0.48/0.08 * 1000 = 6000$ packets.
During the rest of the scenario, the system behaves, for the periods when the harvesting parameters are constant, roughly as predicted in Sec. \dref{low}.
For example, during the period from 3000 to 3500, the approximate cycle length is $I = (2 * 0.48 * 20)/((0.48)^2 - (0.40754 - 0.4)^2) = 85.442$ slots with drift
$(0.40754 + 0.4 - 0.48)/2 = 0.16337 \, mJ/slot$. The simulation shows an 88 slot cycle with drift $13.1/88 = 0.149 \, mJ/slot$. We recall that the analytic results are just approximations calculated under the assumptions that $c_t = c_r = 0$ and that the thresholds are exact multiples of the slot energies.
\begin{figure}[hbtp]
\begin{center}
\includegraphics[scale=0.35]{Variable1.eps}
\caption{Behavior of the System with Fixed Input $cg1/c$\debug{\fbox{fig-Variable1}}\label{fig-Variable1}}
\end{center}
\end{figure}
It is often the case that the node harvesting patterns are roughly known. In this case one can design an appropriate schedule for the input. Assuming that the destination has a transmitter that can be heard at the source, one way to implement this is for it to monitor the transfer and from time to time to transmit desirable input rates to the source. An example of a variable input rate is $cg2/c$ of Fig. \dref{fig-Harvest}, so that the total input over the 8000 slots is the same as in the first example. In the second scenario depicted in Fig. \dref{fig-Variable2}, the total transfer in the first 1000 slots is 977 packets, but the total input attempt is for 1000 packets only. The final result is that the total throughput in the second scenario is 46,353 packets, whereas in the first scenario is only 41,175 packets.
\begin{figure}[hbtp]
\begin{center}
\includegraphics[scale=0.35]{Variable2.eps}
\caption{Behavior of the System with Variable Input $cg2/c$\debug{\fbox{fig-Variable2}}\dlabel{fig-Variable2}}
\end{center}
\end{figure}
\begin{table}[hbtp]
\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|c|c|}
\hline
input & 1000 & 5000 & 8000 & 8000 & 8000 & 8000 & 5000 &5000 \\ \hline
throughput &977 & 3830 & 7580 & 7992 & 7992 & 7992 & 4995 & 4995 \\ \hline
\end{tabular}
\caption{Inputs vs. Throughput in Scenario 2\debug{\fbox{Table-Thru2}}\dlabel{Table-Thru2}}
\end{center}
\end{table}
\newpage
\renewcommand{consensus.tex}{} \renewcommand{}{}
\bibliographystyle{alpha}
\addcontentsline{toc}{section}{References}
| {'timestamp': '2015-12-23T02:05:12', 'yymm': '1512', 'arxiv_id': '1512.06997', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06997'} | arxiv |
\section{Introduction}
Cooperative decision-making under uncertainty is ubiquitous in natural systems as well as in engineering networks. Typically in a distributed cooperative decision-making scenario, there is assimilation of information across a network followed by decision-making based on the collective information. The result is a kind of \emph{collective intelligence}, which is of fundamental interest both in terms of understanding natural systems and designing efficient engineered systems.
A fundamental feature of decision-making under uncertainty is the \emph{explore-exploit} tradeoff. The explore-exploit tradeoff refers to the tension between learning and optimizing: the decision-making agent needs to learn the unknown system parameters (exploration), while maximizing its decision-making objective, which depends on the unknown parameters (exploitation).
MAB problems are canonical formulations of the explore-exploit tradeoff. In a stochastic MAB problem a set of options (arms) are given. A stochastic reward with an unknown mean is associated with each option. A player can pick only one option at a time, and the player's objective is to maximize the cumulative expected reward over a sequence of choices. In an MAB problem, the player needs to balance the tradeoff between learning the mean reward at each arm (exploration), and picking the arm with maximum mean reward (exploitation).
MAB problems are pervasive across a variety of scientific communities and have found application in diverse areas including controls and robotics~\cite{VS-PR-NEL:14}, ecology~\cite{JRK-AK-PT:78, VS-PR-NEL:13}, psychology~\cite{reverdy2014modeling}, and communications~\cite{lai2008medium, anandkumar2011distributed}.
Despite the prevalence of the MAB problem, the research on MAB problems has primarily focused on policies for a single agent. The increasing importance of networked systems warrants the development of distributed algorithms for multiple communicating agents faced with MAB problems. In this paper, we extend a popular single-agent algorithm for the stochastic MAB problem to the distributed multiple agent setting and analyze decision-making performance as a function of the network structure.
The MAB problem has been extensively studied (see~\cite{SB-NCB:12} for a survey). In their seminal work, Lai and Robbins~\cite{lai1985asymptotically} established a logarithmic lower bound on the expected number of times a sub-optimal arm needs to be selected by an optimal policy. In another seminal work, Auer~\emph{et al.}~\cite{PA-NCB-PF:02} developed the upper confidence bound (UCB) algorithm for the stochastic MAB problem that achieves the lower bound in~\cite{lai1985asymptotically} uniformly in time.
Anantharam~\emph{et al.}~\cite{VA-PV-JW:87} extended the results of~\cite{lai1985asymptotically} to the setting of multiple centralized players.
Recently, researchers~\cite{kalathil2014decentralized, anandkumar2011distributed} have studied the MAB problem with multiple players in the decentralized setting. Primarily motivated by communication networks, these researchers assume no communication among agents and design efficient decentralized policies.
Kar~\emph{et al.}~\cite{kar2011bandit} investigated the multiagent MAB problem in a leader-follower setting. They designed efficient policies for systems in which there is one major player that can access the rewards and the remaining minor players can only observe the sampling patterns of the major player. The MAB problem has also been used to perform empirical study of collaborative learning in social networks and the influence of network structure on decision-making performance of human agents~\cite{WM-DJW:12}.
Here, we use a running consensus algorithm~\cite{braca2008enforcing} for assimilation of information, which is an extension of the classical DeGroot model~\cite{MHDG:74} in the social networks literature. Running consensus and related models have been used to study learning~\cite{AJ-AS-ATS:10} and decision-making~\cite{VS-NEL:13f} in social networks.
In the present paper we study the distributed cooperative MAB problem in which a set of agents are faced with a stochastic MAB problem and communicate their information with their neighbors in an undirected, connected communication graph. We use a set of running consensus algorithms for cooperative estimation of the mean reward at each arm, and we design an arm selection heuristic that leads to an order-optimal performance for the group. The major contributions of this paper are as follows.
First, we employ and rigorously analyze running consensus algorithms for distributed cooperative estimation of mean reward at each arm, and we derive bounds on the estimates of mean reward at each arm and the associated variances.
Second, we propose and thoroughly analyze the cooperative UCB algorithm. We derive bounds on decision-making performance for the group and characterize the influence of the network structure on the performance.
Third, we introduce a novel graph centrality measure and numerically demonstrate that this measure captures the ordering of explore-exploit performance of each agent.
The remainder of the paper is organized as follows. In Section~\ref{Background} we recall some preliminaries about the stochastic MAB problem and consensus algorithms. In Section~\ref{sec:coop-est} we present and analyze the cooperative estimation algorithm. We propose and analyze the cooperative UCB algorithm in Section~\ref{DistributedDecisionMaking}. We illustrate our analytic results with numerical examples in Section~\ref{NetworkPerformanceAnalysis}. We conclude in Section~\ref{FinalRemarks}.
\section{Background}
\label{Background}
In this section we recall the standard MAB problem, the UCB algorithm, and some preliminaries on discrete-time consensus.
\subsection{The Single Agent MAB Problem}
Consider an $N$-armed bandit problem, i.e., an MAB problem with $N$ arms.
The reward associated with arm $i\in \until{N}$ is a random variable with an unknown mean $m_i$.
Let the agent choose arm $i(t)$ at time $t \in \until{T}$ and receive a reward $r(t)$.
The decision-maker's objective is to choose a sequence of arms $\seqdef{i(t)}{t\in \until{T}}$ that maximizes the expected cumulative reward $\sum_{t=1}^T m_{i(t)}$, where $T$ is the horizon length of the sequential allocation process.
For an MAB problem, the expected \emph{regret} at time $t$ is defined by $R(t) = m_{i^*}-m_{i(t)}$, where $m_{i^*} = \max \setdef{m_i}{i\in\until{N}}$. The objective of the decision-maker can be equivalently defined as minimizing the expected cumulative regret defined by $\sum_{t=1}^T R(t) = \sum_{i=1}^N \Delta_i \mathbb{E}[n_{i}(T)]$,
where $n_{i}(T)$ is the cumulative number of times arm $i$ has been chosen until time $T$ and $\Delta_i = m_{i^*}-m_i$ is the expected regret due to picking arm $i$ instead of arm $i^*$. It is known that the regret of any algorithm for an MAB problem is asymptotically lower bounded by a logarithmic function of the horizon length $T$~\cite{lai1985asymptotically}, i.e., no algorithm can achieve an expected cumulative regret smaller than a logarithmic function of horizon length as $T \to \infty$.
In this paper, we focus on Gaussian rewards, i.e., the reward at arm $i$ is sampled from a Gaussian distribution with mean $m_i$ and variance $\sigma_s^2$. We assume that the variance $\sigma_s^2$ is known and is the same at each arm.
\subsection{The UCB Algorithm}
A popular solution to the stochastic MAB problem is the UCB algorithm proposed in~\cite{PA-NCB-PF:02}. The UCB algorithm initializes by sampling each arm once, and then selects an arm with maximum
\begin{equation*}
Q_i(t) = \hat{\mu}_i(t) + C_i(t),
\end{equation*}
where $n_i(t)$ is the number of times arm $i$ has been chosen until time $t$, and $\hat{\mu}_i(t)$ and $C_i(t) = \sqrt{\frac{2 \ln(t)}{n_i(t)}}$ are the empirical mean reward of arm $i$ and the associated measure of the uncertainty associated with that mean at time $t$, respectively.
The function $Q_i(t)$ is judiciously designed to balance the tradeoff between explore and exploit: the terms $\hat \mu_i(t)$ and $C_i(t)$ facilitate exploitation and exploration, respectively. The UCB algorithm as described above assumes that rewards have a bounded support $[0,1]$ but this algorithm can be easily extended to distributions with unbounded support~\cite{KL-QZ:11}.
\subsection{The Cooperative MAB Problem}
The cooperative MAB problem is an extension of the single-agent MAB problem where $M$ agents act over the same $N$ arms. Agents maintain bidirectional communication, and the communication network can be modeled as an undirected graph $\mathcal{G}$ in which each node represents an agent and edges represent the communication between agents~\cite{FB-JC-SM:09}. Let $A\in \mathbb{R}^{M\times M}$ be the adjacency matrix associated with $\mathcal G$ and let $L \in \mathbb{R}^{M\times M}$ be the corresponding Laplacian matrix. We assume that the graph $\mathcal G$ is connected, i.e., there exists a path between each pair of nodes.
In the cooperative setting, the objective of the group is defined as minimizing the expected cumulative group regret, defined by $\sum_{k=1}^M \sum_{t=1}^T R^k(t) = \sum_{k=1}^M \sum_{i=1}^N \Delta_i \mathbb{E}[n_{i}^k(T)]$,
where $R^k(t)$ is the regret of agent $k$ at time $t$ and $n_{i}^k(T)$ is the total cumulative number of times arm $i$ has been chosen by agent $k$ until time $T$. In the cooperative setting using Gaussian rewards the lower bound~\cite{VA-PV-JW:87} on the expected number of times a suboptimal arm $i$ is selected by a fusion center that has access to reward for each agent is
\begin{equation}
\sum_{k=1}^M \mathbb{E}[n_i^k(T)] \ge \Big( \frac{2 \sigma_s^2}{\Delta_i^2} +o(1) \Big) \ln T. \label{eqn:fusioncenterregret}
\end{equation}
In the following, we will design a distributed algorithm that samples a suboptimal arm $i$ within a constant factor of the above bound.
\subsection{Discrete-Time Consensus }
Consider a set of agents $\until{M}$, each of which maintains bi-directional communication with a set of neighboring agents. The objective of the consensus algorithms is to ensure agreement among agents on a common value.
In the discrete-time consensus algorithm~\cite{AJ-JL-ASM:02, JNT:84}, agents average their opinion with their neighbors' opinions at each time. A discrete-time consensus algorithm can be expressed as
\begin{equation}
\mathbf{x}(t+1) = P\mathbf{x}(t), \label{UpdateEqn}
\end{equation}
where $\mathbf{x}(t)$ is the vector of each agent's opinion, and $P$ is a row stochastic matrix given by
\begin{equation}
P= \mathcal{I}_M - \frac{\kappa}{d_{\text{max}}} L. \label{Pdefn}
\end{equation}
$\mathcal{I}_M$ is the identity matrix of order $M$, $\kappa \in (0,1]$ is a step size parameter \cite{olfati2004consensus}, $d_{\text{max}} =\max \setdef{\text{deg}(i)}{i \in \until{M}}$, and $\text{deg}(i)$ is the degree of node $i$.
In the following, we assume without loss of generality that the eigenvalues of $P$ are ordered such that $\lambda_1 = 1 > \lambda_2 \geq ... \geq \lambda_M > -1$.
In the context of social networks, the consensus algorithm~\eqref{UpdateEqn} is referred to as the Degroot model~\cite{MHDG:74} and has been successfully used to describe evolution of opinions~\cite{BG-MOJ:10}.
One drawback of the consensus algorithm~\eqref{UpdateEqn} is that it does not allow for incorporating new external information. This drawback can be mitigated by adding a forcing term and the resulting algorithm is called the \emph{running consensus}~\cite{braca2008enforcing}.
Similar to~\eqref{UpdateEqn}, the running consensus updates the opinion at time $t$ as
\begin{equation}\label{eq:running-consensus}
\mathbf{x}(t+1) = P\mathbf{x}(t) + P \boldsymbol \upsilon(t),
\end{equation}
where $\boldsymbol \upsilon(t)$ is the information received at time $t$. In the running consensus update~\eqref{eq:running-consensus}, each agent $k$ collects information $\upsilon_k(t)$ at time $t$, adds it to its current opinion, and then averages its updated opinion with the updated opinion of its neighbors.
\section{Cooperative Estimation of Mean Rewards} \label{sec:coop-est}
In this section we investigate the cooperative estimation of mean rewards at each
arm. To this end, we propose two running consensus algorithms for each arm and analyze their performance.
\subsection{Cooperative Estimation Algorithm}
For distributed cooperative estimation of the mean reward at each arm $i$, we employ two running consensus algorithms: (i) for estimation of total reward provided at the arm, and (ii) for estimation of the total number of times the arm has been sampled.
Let $\hat{s}_i^k(t)$ and $\hat{n}_i^k(t)$ be agent $k$'s estimate of the total reward provided at arm $i$ per unit agent and the total number of times arm $i$ has been selected until time $t$ per unit agent, respectively. Using $\hat{s}_i^k(t) $ and $\hat{n}_i^k(t) $ agent $k$ can calculate $\hat{\mu}_i^k(t)$, the estimated empirical mean of arm $i$ at time $t$ defined by
\begin{equation}
\hat{ \mu}_i^{k}(t) = \frac{\hat{s}_i^{k}(t)}{\hat{n}_i^{k}(t)}. \label{eqnmean}
\end{equation}
Let $i^k(t)$ be the arm sampled by agent $k$ at time $t$ and let $\xi_i^k(t) = \mathds{1} (i^k(t) =i)$. $\mathds{1}(\cdot)$ is the indicator function, here equal to 1 if $i^k(t)= i$ and 0 otherwise.
Define $r_i^k(t) = r^k(t) \cdot \mathds{1} (i^k(t) =i)$, where $r^k(t)$ is the reward of the $k$'th agent at time $t$, which is a random variable sampled from $\mathcal{N}(m_i,\sigma_s^2)$.
The estimates $\hat{s}_i^k(t)$ and $\hat{n}_i^k(t)$ are updated using running consensus as follows
\begin{align} \label{nhatdefn}
\mathbf{\hat{n}}_i(t+1) &= P \mathbf{\hat{n}}_i(t) + P\boldsymbol{\xi}_i(t), \\
\text{and} \quad \mathbf{\hat{s}}_i(t+1) &= P \mathbf{\hat{s}}_i(t) + P\mathbf{r}_i(t), \label{shatdefn}
\end{align}
where $\mathbf{\hat{ n}}_i(t)$, $\mathbf{\hat{ s}}_i(t)$, $\boldsymbol{\xi}_i(t)$, and $\mathbf{r}_i(t)$ are vectors of $\hat n_i^k(t)$, $\hat s_i^k(t)$, $\xi_i^k(t)$, and $r_i^k(t)$, $k\in \until{M}$, respectively.
\subsection{Analysis of the Cooperative Estimation Algorithm}
We now analyze the performance of the estimation algorithm defined by~\eqref{eqnmean},~\eqref{nhatdefn}~and~\eqref{shatdefn}. Let $n_i^{\text{cent}}(t) \equiv \frac{1}{M} \sum_{\tau=0}^t \mathbf{1}_M^\top \boldsymbol{\xi}_i(\tau)$ be the total number of times arm $i$ has been selected per unit agent until time $\tau$, and let $s_i^{\text{cent}}(t) \equiv \frac{1}{M} \sum_{\tau=0}^t \mathbf{1}_M^\top \boldsymbol{r}_i(\tau)$ be the
total reward provided at arm $i$ per unit agent until time $t$. Also, let $\lambda_i$ denote the $i$-th largest eigenvalue of $P$, $\mathbf{u}_i$ the eigenvector corresponding to $\lambda_i$, $u_i^d$ the $d$-th entry of $\mathbf{u}_i$, and
\begin{equation}
\epsilon_n = \sqrt{M} \sum_{p=2}^M \frac{|\lambda_p|}{1-|\lambda_p|}. \label{epsilonndef}
\end{equation}
Note that $\lambda_1=1$ and $\mathbf{u}_1 = \mathbf{1}_M/\sqrt{M}$. Let us define
\begin{align*}
\nu_{pj}^{\text{+sum}} &= \sum_{d=1}^M u_p^d u_j^d \mathds{1}(( \mathbf{u}_p \mathbf{u}_j^\top )_{kk} \geq 0) \\
\text{and} \quad \nu_{pj}^{\text{-sum}} &= \sum_{d=1}^M u_p^d u_j^d \mathds{1}((\mathbf{u}_p\mathbf{u}_j^\top )_{kk} \leq 0).
\end{align*}
We also define
\begin{equation}
a_{pj}(k) = \begin{cases}
\nu_{pj}^{\text{+sum}}(\mathbf{u}_p\mathbf{u}_j^\top)_{kk}, &
\! \! \! \! \text{if } \lambda_p \lambda_j \geq 0 \; \&\; (\mathbf{u}_p\mathbf{u}_j^\top )_{kk} \geq 0, \\
\nu_{pj}^{\text{-sum}}(\mathbf{u}_p\mathbf{u}_j^\top)_{kk}, &
\! \! \! \! \text{if } \lambda_p \lambda_j \geq 0 \; \&\; (\mathbf{u}_p\mathbf{u}_j^\top )_{kk} \leq 0, \\
\nu_{pj}^{\text{max}} |(\mathbf{u}_p\mathbf{u}_j^\top )_{kk} | , & \! \! \! \! \text{if } \lambda_p \lambda_j < 0,
\end{cases}\label{apjdefn}
\end{equation}
where $\nu_{pj}^{\text{max}} = \max{\{ |\nu_{pj}^{\text{-sum}}|, \nu_{pj}^{\text{+sum}}\}} $ and $kk$ indicates the $k$'th diagonal entry. Furthermore, let
\[
\epsilon_c^k = M \sum_{p=1}^M \sum_{j=2}^M \frac{|\lambda_p \lambda_j| }{1-|\lambda_p \lambda_j|} a_{pj}(k).
\]
We note that both $\epsilon_n$ and $\epsilon_c^k$ depend only on the topology of the communication graph. These are measures of distributed cooperative estimation performance.
\begin{proposition}[\bit{Performance of cooperative estimation}]\label{prop:coop-est}
For the distributed estimation algorithm defined in~\eqref{eqnmean},~\eqref{nhatdefn}~and~\eqref{shatdefn}, and a doubly stochastic matrix $P$ defined in~\eqref{Pdefn}, the following statements hold
\begin{enumerate}
\item the estimate $\hat n_i^k(t)$ satisfies
\begin{align*}
n_i^{\text{cent}}(t) - \epsilon_n \le \hat{n}_i^k(t) \le n_i^{\text{cent}}(t) + \epsilon_n;
\end{align*}
\item the estimator $\hat \mu_i^k (t)$ is unbiased, i.e., $\mathbb{E}[\hat \mu_i^k (t)] =m_i$;
\item the variance of the estimate $\hat \mu_i^k(t)$ satisfies
\begin{equation*}
\text{Var}[{\hat{\mu}}_i^k (t)] \leq \frac{\sigma_s^2 }{M} \; \frac{ \hat n_i^k(t) + \epsilon_c^k}{(\hat n_i^k(t))^2}.
\end{equation*}
\end{enumerate}
\end{proposition}
\begin{proof}
We begin with the first statement.
From~\eqref{nhatdefn} it follows that
\begin{align}
\mathbf{\hat{n}}_i(t) & =P^t \mathbf{\hat{n}}_i(0) + \sum_{\tau = 0}^{t-1} P^{t-\tau} \boldsymbol{\xi}_i(\tau) \nonumber \\
&=\sum_{\tau = 0}^{t-1} \Big[ \frac{1}{M} \mathbf{1}_M \mathbf{1}_M^\top \boldsymbol{\xi}_i(\tau) + \sum_{p=2}^{M} \lambda_p^{t-\tau} \mathbf{u}_p {\mathbf{u}_p}^\top \boldsymbol{\xi}_i(\tau) \Big] \nonumber\\
&= n_i^{\text{cent}}(t) \mathbf{1}_M + \sum_{\tau = 0}^{t-1} \sum_{p=2}^{M} \lambda_p^{t-\tau} \mathbf{u}_p {\mathbf{u}_p}^\top \boldsymbol{\xi}_i(\tau). \label{solndecomp}
\end{align}
We now bound the $k$-th entry of the second term on the right hand side of~\eqref{solndecomp}:
\begin{align}
\sum_{\tau = 0}^{t-1} \sum_{p=2}^M \lambda_p^{t-\tau} \big( \mathbf{u}_p {\mathbf{u}_p}^\top \boldsymbol{\xi}_i(\tau) \big)_k \!
&\leq \! \sum_{\tau = 0}^{t-1} \sum_{p=2}^M |\lambda_p^{t-\tau}| \| \mathbf{u}_p\|_2^2 \| \boldsymbol{\xi}_i(\tau) \|_2 \nonumber \\
& \leq \sqrt{M} \sum_{\tau = 0}^{t-1} \sum_{p=2}^M |\lambda_p^{t-\tau}| \le \epsilon_n. \nonumber
\end{align}
This establishes the first statement.
Using a similar approach, from \eqref{shatdefn} we can write
\begin{align*}
\mathbf{\hat{s}}_i(t) &= P^t \mathbf{\hat{s}}_i(0) + \sum_{\tau = 0}^{t-1} P^{t-\tau} \mathbf{r}_i(\tau) = \sum_{\tau = 0}^{t-1} P^{t-\tau} \mathbf{r}_i(\tau).
\end{align*}
It follows that $\mathbb{E}[\mathbf{\hat{s}}_i(t)] = m_i \sum_{\tau = 0}^{t-1} P^{t-\tau} \boldsymbol{\xi}_i(\tau) = m_i \mathbf{\hat{n}}_i(t)$.
This along with the definition~\eqref{eqnmean} establishes the second statement.
To prove the third statement, we note that
\begin{align}
\text{Cov}[\mathbf{\hat{s}}_i(t)] &= \sum_{\tau = 0}^{t-1} P^{t-\tau} \Sigma(\tau) \Sigma^\top(\tau) (P^{t-\tau})^\top \nonumber \\
& = \sum_{\tau = 0}^{t-1} \sum_{p=1}^M \sum_{j=1}^M \lambda_p^{t-\tau} \lambda_j^{t-\tau} \mathbf{u}_p \mathbf{u}_p^\top \Sigma(\tau) \Sigma(\tau) \mathbf{u}_j \mathbf{u}_j^\top \nonumber \\
& = \sigma_s^2 \sum_{\tau = 0}^{t-1} \sum_{p=1}^M \sum_{j=2}^M (\lambda_p \lambda_j)^{t-\tau} \nu_{pj}(\tau) (\mathbf{u}_p \mathbf{u}_j^\top) \nonumber \\
&\quad + \frac{1}{M} \sum_{\tau = 0}^{t-1} \sum_{p=1}^M \lambda_p^{t-\tau} \mathbf{u}_p \mathbf{u}_p^\top \Sigma(\tau) \Sigma(\tau) \mathbf{1}_M \mathbf{1}_M^\top, \label{covssoln}
\end{align}
where $\Sigma(\tau) \!=\! \sigma_s \text{diag}(\boldsymbol{\xi}_i(\tau))$ and $\nu_{pj}(\tau) \!=\! \mathbf{u}_p^\top \text{diag}(\boldsymbol{\xi}_i(\tau)) \mathbf{u}_j$.
We now examine the $kk$-th entry of each term in~\eqref{covssoln}. We begin with the second term:
\begin{align}
& \frac{1}{M}\bigg[ \sum_{\tau = 0}^{t-1} \sum_{p=1}^M \lambda_p^{t-\tau} \mathbf{u}_p \mathbf{u}_p^\top \Sigma(\tau) \Sigma(\tau) \mathbf{1}_M \mathbf{1}_M^\top \bigg]_{kk} \nonumber \\
=& \frac{\sigma_s^2}{M} \bigg[\bigg( \sum_{\tau = 0}^{t-1} \sum_{p=1}^M \lambda_p^{t-\tau} \mathbf{u}_p \mathbf{u}_p^\top \boldsymbol{\xi}_i(\tau) \bigg) \mathbf{1}_M^\top \bigg]_{kk} = \frac{\sigma_s^2}{M} \hat n_i^k(t). \label{2nd3rdterm}
\end{align}
We now analyze the first term of \eqref{covssoln}:
\begin{align}
& \sigma_s^2 \sum_{\tau = 0}^{t-1} \sum_{p=1}^M \sum_{j=2}^M (\lambda_p \lambda_j)^{t-\tau} \nu_{pj}(\tau) (\mathbf{u}_p \mathbf{u}_j^\top)_{kk} & \nonumber \\
& \leq \sigma_s^2 \sum_{\tau = 0}^{t-1} \sum_{p=1}^M \sum_{j=2}^M |\lambda_p \lambda_j|^{t-\tau} | \nu_{pj}(\tau) (\mathbf{u}_p \mathbf{u}_j^\top)_{kk} | \nonumber \\
& \leq \sigma_s^2 \sum_{\tau = 0}^{t-1} \sum_{p=1}^M \sum_{j=2}^M |\lambda_p \lambda_j|^{t-\tau} a_{pj}(k) \nonumber \\
&\leq \sigma_s^2 \sum_{p=1}^M \sum_{j=2}^M \frac{|\lambda_p \lambda_j|}{1-|\lambda_p \lambda_j|} a_{pj}(k). \label{cov1stmid}
\end{align}
Bounds in~\eqref{2nd3rdterm}~and~\eqref{cov1stmid} along with definition~\eqref{eqnmean} establish the third statement.
\end{proof}
\section{Cooperative Decision-Making}
\label{DistributedDecisionMaking}
In this section, we extend the UCB algorithm~\cite{PA-NCB-PF:02} to the distributed cooperative setting in which multiple agents can communicate with each other according to a given graph topology. Intuitively, compared to the single agent setting, in the cooperative setting each agent will be able to perform better due to communication with neighbors. However, the extent of an agent's performance advantage depends on the network structure. We compute bounds on the performance of the group in terms of the expected group cumulative regret. We also propose a metric that orders the contribution of agents to the cumulative group regret in terms of their location in the graph.
\subsection{Cooperative UCB Algorithm}
The cooperative UCB algorithm is analogous to the UCB algorithm, and uses a modified decision-making heuristic that captures the effect of the additional information an agent receives through communication with other agents as well as the rate of information propagation through the network.
The cooperative UCB algorithm is initialized by each agent sampling each arm once and proceeds as follows. At each time $t$, each agent $k$ updates its cooperative estimate of the mean reward at each arm using the distributed cooperative estimation algorithm described in~\eqref{eqnmean}, \eqref{nhatdefn}, and~\eqref{shatdefn}. Then, at time $t$ each agent $k$ selects the arm with maximum $Q_i^{k}(t) = \hat{\mu}_i^{k}(t) + C_i^k(t)$, where
\begin{equation}
C_i^k(t) = \sigma_s \;\sqrt[]{2 \gamma \frac{\hat{n}_i^{k}(t) + \epsilon_c^k}{M\hat{n}_i^{k}(t)}\cdot\frac{ \ln t}{\hat{n}_i^{k}(t)}}, \label{Cdefn}
\end{equation}
and $\gamma > 1$. Note that the heuristic $Q_i^k$ requires the agent $k$ to know $\epsilon_c^k$, which depends on the global graph structure. This requirement can be relaxed by replacing $\epsilon_c^k$ with an increasing sub-logarithmic function of time. We leave rigorous analysis of the alternative policy for future investigation.
\subsection{Regret Analysis of the Cooperative UCB Algorithm}\label{RegretAnalysis}
We now derive a bound on the expected cumulative group regret using the distributed cooperative UCB algorithm. This bound recovers the upper bound given in \eqref{eqn:fusioncenterregret} within a constant factor. The contribution of each agent to the group regret is a function of its location in the network.
\begin{theorem}[\bit{Regret of the Cooperative UCB Algorithm}]\label{thm:regret-coop-ucb}
For the cooperative UCB algorithm and the Gaussian multiarmed bandit problem the number of times a suboptimal arm $i$ is selected by all agents until time $T$ satisfies
\begin{align*}
\sum_{k=1}^M \mathbb{E}[n_i^{k}(T)] &\leq \bigg \lceil M \epsilon_n \! + \! \sum_{k=1}^M \frac{8 \sigma_s^2 \gamma (1+ \epsilon_c^k) }{M \Delta_i^2} \ln(T) \bigg \rceil \! + \! \frac{M\gamma}{\gamma-1}.
\end{align*}
\end{theorem}
\begin{proof}
We proceed similarly to~\cite{PA-NCB-PF:02}. The number of times a suboptimal arm $i$ is selected by all agents until time $T$ is
\begin{align}
\sum_{k=1}^M & n_i^k(T) = \sum_{k=1}^M\sum_{t=1}^T \mathds{1}(i^k(t) = i^k)\nonumber \\
& \leq \sum_{k=1}^M \sum_{t=1}^T \mathds{1}(Q_i^k(t) \geq Q_{i^*}^k(t))\nonumber \\
& \leq \eta + \sum_{t=1}^T \mathds{1}(Q_i^k(t) \geq Q_{i^*}^k(t), M n_i^{\text{cent}} \geq \eta), \label{suboptimal-samples}
\end{align}
where $\eta >0$ is a constant that will be chosen later.
At a given time $t$ an individual agent $k$ will choose a suboptimal arm only if
$ Q_i^k(t) \geq Q_{i^*}^k(t)$.
For this condition to be true at least one of the following three conditions must hold:
\begin{align}
\hat{\mu}_{i^*} &\leq m_{i^*} - C_{i^*}^k(t) \label{1stcond} \\
\hat{\mu}_{i} &\geq m_{i} + C_{i}^k(t) \label{2ndcond} \\
m_{i^*} &< m_{i} + 2 C_{i}^k(t). \label{3rdcond}
\end{align}
We now bound the probability that \eqref{1stcond} holds. It follows that
\begin{align}
\mathbb{P}(\eqref{1stcond} \text{ holds})
& = \mathbb{P} \Big(z \geq \frac{\mathbb{E}[\hat{\mu}_{i^*}]+ C_{i^*}^k(t) - m_{i^*}}{\sqrt{\text{Var}(\hat \mu_{i^*}^k)}} \Big) \nonumber \\
& = \mathbb{P}\Big(z \geq \frac{C_{i^*}^k(t) }{\sqrt{\text{Var}(\hat \mu_{i^*}^k)}} \Big) \nonumber \\
& \le \frac{1}{2} \exp \Big(-\frac{\big(C_{i^*}^k(t) \big)^2}{2 \text{Var}(\hat \mu_{i^*}^k)} \Big) \leq \frac{1}{2t^\gamma},\label{chernofftight}
\end{align}
where $z$ is the standard Gaussian random variable and the last inequality follows from the tail bounds for the error function~\cite{MA-IAS:64} and the second statement of Proposition~\ref{prop:coop-est}.
It follows analogously that
$$
\mathbb{P}(\eqref{2ndcond} \text{ holds}) \leq \frac{1}{2t^\gamma}.
$$
Finally, we examine the probability that \eqref{3rdcond} holds.
It follows that
\begin{align*}
m_{i^*} &< m_{i} + 2 C_{i}^k(t)\\
\implies n_i^{\text{cent}}(t) & < \left \lceil \epsilon_n + \frac{8 \sigma_s^2\gamma (\hat{n}_i^{k}(t) + \epsilon_c^k) \ln(t)}{M\Delta_i^2 (\hat{n}_i^{k}(t))^2} \right\rceil \\
& \le \left \lceil \epsilon_n + \frac{8 \sigma_s^2 (1+ \epsilon_c^k) \ln(t)}{M\Delta_i^2} \right\rceil .
\end{align*}
From monotonicity of $\ln(t)$, it follows that~\eqref{3rdcond} does not hold if $ n_i^{\text{cent}}(t) \ge \big\lceil \epsilon_n + \frac{8 \sigma_s^2 (1+ \epsilon_c^k) \ln(T)}{M\Delta_i^2} \big\rceil$.
Now, setting $\eta = \lceil M \epsilon_n + \sum_{k=1}^M \frac{8 \sigma_s^2 \gamma (1+ \epsilon_c^k) \ln(T)}{M \Delta_i^2} \rceil$ we get from~\eqref{suboptimal-samples} that
\begin{align*}
\sum_{k=1}^M \mathbb{E}[n_i^{k}(T)] & \! \leq \! \bigg \lceil \! M\epsilon_n \! \! + \! \sum_{k=1}^M \! \frac{8 \sigma_s^2 \gamma (1+ \epsilon_c^k) \ln(T)}{M \Delta_i^2} \bigg \rceil \! \! + \! \sum_{k=1}^M \! \sum_{t=1}^T \frac{1}{t^\gamma} \\
\leq \bigg \lceil & M \epsilon_n + \sum_{k=1}^M \frac{8 \sigma_s^2 \gamma (1+ \epsilon_c^k) }{M \Delta_i^2} \ln(T) \bigg \rceil + \frac{M\gamma}{\gamma-1}.
\end{align*}
This establishes the proof.
\end{proof}
\begin{remark}[\bit{Towards Explore-Exploit Centrality}] \label{remark:exploreexploitcent}
Theorem~\ref{thm:regret-coop-ucb} provides bounds on the performance of the group as a function of the graph structure. However, the bound is dependent on the values of $\epsilon_c^k$ for each individual agent. In this sense, $\varsigma^k \equiv 1/\epsilon_c^k$ can be thought of as a measure of node certainty in the context of explore-exploit problems. For $\epsilon_c^k =0$, the agent behaves like a centralized agent. Higher values of $\epsilon_c^k$ reflect behavior of an agent with sparser connectivity. Rigorous connections between $\epsilon_c^k$ and standard notions of network centralities~\cite{MN:10} is an interesting open problem that we leave for future investigation. \oprocend
\end{remark}
\section{Numerical Illustrations}
\label{NetworkPerformanceAnalysis}
In this section, we elucidate our theoretical analyses from the previous sections with numerical examples. We first demonstrate that the ordering on the performance of nodes obtained through numerical simulations is identical to the ordering by our upper bounds. We then investigate the effect of connectivity on the performance of agents in random graphs.
For all simulations below we consider a $10$-armed bandit problem with mean rewards as in Table~\ref{RewardsTable} and $\sigma_s = 30$. \\
\begin{table}[ht]
\centering
\caption{Rewards at each arm $i$ for simulations}
\begin{tabular}{ |c||c|c|c|c|c|c|c|c|c|c| }
\hline
$i$ &1&2&3&4&5&6&7&8&9&10\\
\hline
$m_i$ &40 & 50 & 50 & 60 & 70 & 70 & 80 & 90 & 92 & 95\\
\hline
\end{tabular}
\label{RewardsTable}
\end{table}
\begin{example}[\bit{Regret on Fixed Graphs}]
Consider the set of agents communicating according to the graph in Fig.~\ref{5AgentGraphSim} and using the cooperative UCB algorithm to handle the explore-exploit tradeoff in the distributed cooperative MAB problem.
The values of $\epsilon_c^k$ for nodes $1,2,3,$ and $4$ are $2.31, 2.31, 0,$ and $5.43$, respectively. As predicted by Remark~\ref{remark:exploreexploitcent}, agent $3$ should have the lowest regret, agents $1$ and $2$ should have equal and intermediate regret, and agent $4$ should have the highest regret. These predictions are validated in our simulations shown in Fig.~\ref{5AgentGraphSim}. The expected cumulative regret in our simulations is computed using $500$ Monte-Carlo runs.
\end{example}
\begin{figure}
\centering
\begin{minipage}{.35\textwidth}
\centering
\includegraphics[width=.9\linewidth]{4agent_graphsim}
\end{minipage}%
\begin{minipage}{.13\textwidth}
\centering
\includegraphics[width=.9\linewidth]{4agent_graphsim_graph}
\end{minipage}
\caption{Simulation results comparing expected cumulative regret for different agents in the fixed network shown, using $P$ as in \eqref{Pdefn} and $\kappa = \frac{d_{\text{max}}}{d_{\text{max}}-1}$. Note that agents $1$ and $2$ have nearly identical expected regret.}
\label{5AgentGraphSim}
\end{figure}
We now explore the effect of $\epsilon_c^k$ on the performance of an agent in an Erd{\"o}s-R{\'e}yni random (ER) graph. ER graphs are a widely used class of random graphs where any two agents are connected with a given probability $\rho$~\cite{bollobas1998random}.
\begin{example}[\bit{Regret on Random Graphs}]
Consider a set of $10$ agents communicating according to an ER graph and using the cooperative UCB algorithm to handle the explore-exploit tradeoff in the aforementioned MAB problem.
In our simulations, we consider $100$ connected ER graphs, and for each ER graph we compute the expected cumulative regret of agents using $30$ Monte-Carlo simulations. We show the behavior of the expected cumulative regret of each agent as a function of $\varsigma^k$ in Fig.~\ref{ER_degcentsim}.
It is evident that
increased $\varsigma^k$ results in a sharp increase in performance. Conversely, low $\varsigma^k$ is indicative of very poor performance. This strong disparity is due to agents with lower $\varsigma^k$ doing a disproportionately high amount of exploration over the network, allowing other agents to exploit. The disparity is also seen in Fig. \ref{5AgentGraphSim}, as agent $4$ does considerably worse than the others. Additionally, as shown in Fig.~\ref{5AgentGraphSim} the expected cumulative regret averaged over all agents is higher than the centralized (all-to-all) case.
\end{example}
\begin{figure}[ht]
\includegraphics[width=0.35\textwidth]{ER_degcent2}
\centering
\caption{Simulation results of expected cumulative regret as a function of $\varsigma^k$ for nodes in ER graphs with $\rho = \frac{\ln(10)}{10}$, $P$ as in \eqref{Pdefn}, and $\kappa = \frac{d_{\text{max}}}{d_{\text{max}}-1}$. }
\label{ER_degcentsim}
\end{figure}
\section{Final Remarks}
\label{FinalRemarks}
Here we used the distributed multi-agent MAB problem to explore cooperative decision-making in networks. We designed the cooperative UCB algorithm that achieves logarithmic regret for the group. Additionally, we investigated the performance of individual agents in the network as a function of the graph topology.
We derived a node certainty measure $\varsigma^k$ that predicts the relative performance of the agents.
Several directions of future research are of interest. First, the arm selection heuristic designed in this paper requires some knowledge of global parameters. Relaxation of this constraint will be addressed in a future publication. Another interesting direction is to study the tradeoff between the communication and the performance. Specifically, if agents do not communicate at each time but only intermittently, then it is of interest to characterize performance as a function of the communication frequency.
\bibliographystyle{plain}
| {'timestamp': '2016-05-17T02:17:53', 'yymm': '1512', 'arxiv_id': '1512.06888', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06888'} | arxiv |
\section{Introduction: problem setting}
Minimizing a functional using the Total Variation (TV) of an image was
originally introduced for denoising purposes \cite{rudin1992nonlinear},
but it is useful in more general problems, as a regularization for
ill-posed inverse problems. For instance for image reconstruction in
computed tomography \cite{sidky2008image}, or in regression or
classification settings for brain imaging \cite{michel2011tv}.
In image-recovery applications, unlike with pure prediction problems as in machine
learning, optimizing the corresponding cost function
to a high tolerance is important (see \emph{eg} in brain imaging
\cite{dohmatob2014benchmarking}). Indeed, the penalty is most relevant in
the ill-conditioned region of the data-fit term. However, this
optimization is particularly challenging, as the TV penalty introduces a
long-distance coupling across the image in the final solution. This paper
studies optimization algorithms for TV-penalized inverse problems with an
ill-conditioned and computationally costly data-fit term, as in brain
imaging. In particular, we introduce a new variant of FISTA that is well
suited to inexact proximal operators.
The TV penalty can be seen as an instance of a wider set of
regularizations, analysis sparsity problems \cite{vaiter2014low}, that
impose sparsity on a linear transformation of the image, as \emph{eg} in
TV-$\ell_1$ used in brain imaging \cite{gramfort2013}.
In general, an analysis-sparsity risk-minimization problem is written as
\begin{equation}
\hat{\B{w}} = \underset{\B{w}}{\text{argmin}}
\biggl(\sum_{i=1}^n \mathcal{L}(\B{X}_i, \B{y}_{\!i}, \B{w})
+ \lambda \|\B{K}\, \B{w}\|_\bullet\biggr)
\label{eq:analysis_sparsity}
\end{equation}
where $\mathcal{L}$ is the data-fit term, $\B{K}$ is the ``analysis
operator'', and
$\|{\cdot}\|_\bullet$ is a simple sparsity-inducing norm, such as the
$\ell_1$ or $\ell_{21}$ norm. Often, $\B{K}$ is rank-deficient, as in
over-complete dictionaries, and $\mathcal{L}$ is ill-conditioned.
Problem (\ref{eq:analysis_sparsity}) is thus a challenging
ill-conditioned non-smooth optimization.
With linear models, $\B{X}$ is the design matrix. It is ill-conditioned
when different features are heavily correlated. These unfortunate
settings often happen when the design matrix results from experimental
data, as in brain imaging or genotyping, or for many measurement
operators that are nearly blind to some aspects of the weights $\B{w}$,
\emph{eg} the high frequencies in tomography or image deblurring
applications.
Analysis sparsity is then particularly interesting because it can impose
sparsity with $\B{K}$ specifically along those aspects of the weights.
For instance TV is edge-preserving: it sharpens some high-frequency
features.
\section{State of the art optimizers}
\sloppy
As the norm $\|.\|_\bullet$ is not smooth, standard gradient-based
optimization methods cannot be readily used to solve
(\ref{eq:analysis_sparsity}). Proximal-gradient methods \cite{parikh2013}
generalize the
gradient step with an implicit subgradient step using the
\textit{proximal operator}, defined by
\mbox{$\prox_{g}(\B{y}) = \text{argmin}_\B{x}\frac{1}{2}\|\B{y} - \B{x}\|_2^2 +
g(\B{x})$}.
\paragraph{Proximal iterations}
If $f$ is the data-fit term, which we assume smooth, while $g$ is the
non-smooth penalty, the simplest method is the
Iterative Shrinkage-Thresholding Algorithm (\textbf{ISTA})
\cite{daubechies2004iterative,combettes2011proximalsplitting}: alternating gradient descent on
the smooth part and application of the proximal map on the non-smooth
part with iterations of
\begin{equation}
\B{w}_{k + 1} = \prox_{\frac{1}{L} g}\smash{\left(\B{w}_k -
\frac{1}{L}\nabla_{\!\B{w}} g(\B{w}_k)\right)},
\label{eq:ista_iteration}
\end{equation}
where \(L\) is the Lipschitz constant of \(\nabla_{\!\B{w}} f\).
An accelerated gradient method, that is multi-step, can speed up
convergence for ill-conditioned problems by adding a momentum term:
in the \textit{fast iterative shrinkage-thresholding algorithm}
(\textbf{FISTA}) \cite{beck09afast} the gradient steps are
applied to a
combination of $\B{w}_k$ and $\B{w}_{k - 1}$.
The drawback is that there is no guarantee that each step of FISTA
decreases the energy and large rebounds are common. This
non-monotone behavior can be remedied by switching to ISTA
iterations whenever an increase in cost is detected, as in
\textit{monotone FISTA} (\textbf{mFISTA})
\cite{beck09fastgradient-based}.
\paragraph{Proximal algorithms for analysis sparsity}
The success of ISTA-type algorithms hinges upon the computation of the
proximal operator, that is very efficient for synthesis sparsity as in
lasso and elastic-net like problems ($\ell_1$ and $\ell_1 + \ell_2$
penalties). However, for many analysis-sparsity proximal operators there is
no analytical formula. If the norm used in the analysis sparsity is
$\ell_1$ or an $\ell_{21}$, writing the dual problem leads to a constraint
formulation amenable to an accelerated projected gradient
\cite{beck09fastgradient-based}, as the dual norms are respectively an
$\ell_\infty$ and $\ell_{2\infty}$ with easy projections to the unit
ball. Importantly, a monotone scheme can also be used, and the tolerance of
the optimization can be controlled via the dual gap \cite{michel2011tv}.
While the computation of the proximal operator is no longer exact,
proximal gradient algorithms can be shown to converge as long as error on
the proximal operation decreases sufficiently with the iteration number
$k$ of the outer loop \cite{schmidt2011convergence}. To achieve the best
convergence rates in $k$, the error may be required to decrease as fast
as $\varepsilon_k \sim k^{-4}$. Using an accelerated algorithm to compute
the proximal, achieving a tolerance of $\varepsilon$ is in
$\mathcal{O}(\sqrt{\varepsilon})$. Thus, in such a scheme the cost of
each iteration increases as $k^{2}$, which renders optimization to a
tight tolerance prohibitive.
\paragraph{Operator splitting algorithms}
The costly inner loop is required in ISTA-type algorithms because the
proximal operator cannot be easily computed on the primal variables of
the optimization. Another family of proximal algorithms rely on
``splitting'': introducing auxiliary variables in the analysis space:
$\B{z} = \B{K}\, \B{w}$. Optimizing on these is then a simple $\ell_1$ or
$\ell_{21}$ proximal problem. The alternating direction method of
multipliers (\textbf{ADMM}) is such an approach that is popular for
signal processing applications for its versatility \cite{boyd2011}. Note
that it relies on the choice of a hyper-parameter, $\B{\rho}$ controlling
the tightness of the split that can have an impact on the convergence.
Similarly, the primal-dual algorithm in \cite{chambolle-pock:2011} relies on two
hyperparameters and can be written as a preconditioned version of ADMM.
\paragraph{Optimizing a smooth surrogate}
Newton or quasi-newton algorithms are excellent optimizers for
smooth problems that achieve quadratic convergence rates under weak
conditions and are somewhat unaffected by ill conditioning
\cite{nocedal2006numerical}. In particular, the limited-memory BFGS
(\textbf{LBFGS}) \cite{liu1989limited} quasi-newton scheme is well suited
to high-dimensional problems.
An approach to minimizing a convex non-smooth function relies on
minimizing series of smooth upper bounds, decreasing the approximation as
the algorithm progresses
\cite{dohmatob2014benchmarking,dubois2014predictive}.
Intuitively, the benefit of such an approach is that it should be
well suited to strong ill-conditioning of the smooth part of the energy,
to the cost of more difficulty in optimizing the non-smooth part.
\paragraph{Iteration cost}
When the design matrix $\B{X}$ is large and dense, as in brain imaging or
genomics, the computation cost of multiplying it with a vector or matrix
is by far the most expensive elementary operations as does not fit in
$\B{X}$
CPU cache. Thus it is important to limit as much as possible these
operations, which typically come into play when computing the gradient or
energy of the smooth data-fit part of the problem\footnote{Note that such
situation is different than in many signal-processing applications in
which $\B{X}$ is a sparse or structured operator as a convolution or a
wavelet transform, and thus can be applied very fast.}.
\section{FAASTA: adapting inner tolerance}
ISTA-type schemes are parameter-free algorithms with a good convergence
rate. However their optimal use in analysis-sparsity problems require
balancing the computational cost of the gradient step with that of the
proximal operator. Indeed, while a tight tolerance on the proximal
operator may guarantee the optimal convergence speed in terms of number
of iterations of the outer loop, it implies increasing computing time for
each iteration. Thus, for a low desired tolerance on the global energy
function, it may be beneficial to set a lax tolerance on the dual gap of
the proximal operator, and thus achieve fast iterates. On the opposite,
optimizing the global problem to a stringent tolerance requires very high
precision on the proximal operator, which in turn slows down iterations
of the outer loop.
\algrenewcommand\algorithmicindent{.8em}
\begin{algorithm}[t]
\caption{fAASTA}\label{algo:faasta}
\begin{algorithmic}
\Require \(\B{w}_0\)
\State \(\text{ISTA}\gets False,\qquad\)
\(\B{v}_1\gets \B{w}_0,\qquad\)
\(k\gets 0,\qquad\)
\State \(t_1 \gets 1,\qquad\)
\(dgtol\gets 0.1\)\;
\While{not converged}
\State \(k \gets k + 1,\quad\)
\State \(\B{w}_{k} \gets \prox_{\frac{g}{L}} (\B{v}_k - \frac{1}{L}\nabla
f(\B{v}_k), dgtol)\)\;
\If{\(\mathcal E(\B{w}_k) > \mathcal E(\B{w}_{k - 1})\)}
\State \(\B{w}_k\gets \B{w}_{k - 1},\qquad\)
\(\B{v}_k\gets \B{w}_{k - 1}\)\;
\If{ISTA}
\State \(dgtol\gets dgtol / 5\)\;
\While{
\State\(\mathcal E(
\prox_{\frac{g}{L}} (\B{v}_k -
\frac{1}{L}\nabla_{\!\B{w}} f(\B{v}_k),
dgtol)) > \mathcal E(\B{w}_{k-1})\)}
\State \(dgtol\gets dgtol / 5\)
\EndWhile
\EndIf
\(\text{ISTA}\gets True\)\;
\Else
\If{ISTA}
\State \(\B{v}_k\gets \B{w}_k, \qquad\)
\(\text{ISTA}\gets False\)
\Else\vspace*{-.5ex}
\State
\(t_k\gets\frac{1 +
\sqrt{1 + 4t_{k-1}^2}}{2},\qquad\)
\State \(\B{v}_k\gets \B{w}_k +
\frac{t_{k-1} - 1}{t_k}
(\B{w}_k - \B{w}_{k - 1})\)\;
\EndIf
\EndIf
\EndWhile
\end{algorithmic}
\end{algorithm}
We introduce a new variant of ISTA, fast Adaptively Accurate Shrinkage
Thresholding Algorithm (\textbf{fAASTA}). The core idea is to adapt the
tolerance of the proximal operator as needed for convergence. For this,
we rely on the fact that in an ISTA iteration
--eq.\,(\ref{eq:ista_iteration})-- the global energy must decrease
\cite{daubechies2004iterative}. Thus we adapt the tolerance of the
proximal-operator solver to ensure this decrease. In practice, in the inner loop,
we control that tolerance by checking the dual gap of the proximal
optimization problem, which is much cheaper to compute than the global
energy, as it does not involve the accessing the large, dense design
matrix $\B{X}$. We decrease this dual gap setting by a factor of 5 when
we observe that an ISTA iteration did not result in an energy decrease.
In addition, to benefit from accelerated schemes as in FISTA, we rely on
an mFISTA strategy: we apply FISTA iterations but when the energy
increases, switch to an ISTA step, in which we can then, if needed,
decrease the tolerance on the inner dual gap.
The actual procedure is described in alg.\,\ref{algo:faasta}. One
difficulty is implementing the back and forth between ISTA and FISTA
without recomputing intermediate variables. With speed in mind, another
important implementation aspect is to factor out expressions common to
the gradient and energy computations in order to access the large $\B{X}$
matrix as little as possible. These breakdowns are not detailed here.
\section{Empirical study: TV-$\ell_1$ for decoding}
Here, we benchmark the various algorithms on a brain-decoding
application: the task is to predict subject's behavior, encoded as a
categorical variable in $\B{y}$, from fMRI images that constitute the
design matrix $\B{X}$. For this purpose, we use a TV-$\ell_1$-penalized
logistic regression, which is written as an analysis sparsity problem
in notations of eq.\,(\ref{eq:analysis_sparsity}):
\begin{align}
\rlap{\hspace*{-1.8ex}\text{loss}} \;\;& &
\mathcal{L}(\B{X}_i, \B{y}_{\!i}, \B{w}) &=
\log\bigl(1 + \exp\bigl(-\B{y}_{\!i}(\langle \B{X}_i, \B{w}\rangle + b)\bigr)
\bigr)\hspace*{-1ex}&
\\
\rlap{\hspace*{-1.8ex}\text{penalty}} \;\;& & \|\B{K}\, \B{w}\|_\bullet &=
(1 - \alpha)\| \nabla \B{w}\|_{21} + \alpha\|\B{w}\|_1\hspace*{-1ex}&
\end{align}
where $\nabla$ is the image-domain finite difference operator and the
$\ell_{21}$
norm groups the different image directions for an isotrope TV
formulation.
We set $\alpha = .25$.
We investigate discrimination of whether the subject is presented
images of shoes or scrambled pictures in a study of human vision, using
the data from \cite{haxby2001}.
We rely on the nilearn library for data download, loading and cleaning
\cite{abraham2014machine}.
We study convergence of the following approaches: ISTA and mFISTA schemes
with \emph{i)} a lax dual-gap tolerance ($.1$) on the inner problem,
\emph{ii)} a tight dual-gap tolerance ($10^{-10}$), \emph{iii)} an
adaptive control of the dual-gap tolerance as exposed above, and
\emph{iv)} the
decrease motivated theoretically in \cite{schmidt2011convergence};
an LBFGS optimizer on a series of smooth upper-bounds following the
approach of \cite{dohmatob2014benchmarking}; an ADMM with different
values of the $\rho$ control parameter (implemented as in
\cite{dohmatob2014benchmarking}).
\begin{figure*}[bt]
\includegraphics[width=.365\linewidth]{bench/convergence_alpha_0_014}%
\llap{\raisebox{.14\linewidth}{%
\rlap{$\lambda = 0.0143$}\hspace*{.3\linewidth}}}%
\hfill%
\hspace*{-.05\linewidth}%
\includegraphics[width=.365\linewidth]{bench/convergence_alpha_1_410}%
\llap{\raisebox{.14\linewidth}{%
\rlap{$\lambda = 1.43$}\hspace*{.3\linewidth}}}%
\hfill%
\hspace*{-.05\linewidth}%
\includegraphics[width=.365\linewidth]{bench/convergence_alpha_14_100}%
\hfill%
\llap{\raisebox{.135\linewidth}{%
\rlap{$\lambda = 14.3$}\hspace*{.3\linewidth}}}%
\caption{\textbf{Convergence of the different optimization algorithms},
for 3 scenarios, with weak, medium and strong regularization, where
medium regularization corresponds to the value chosen by
cross-validation. These are log-log plots with the 0 defined as the
lowest energy value reached across all algorithms.
\label{fig:convergence}%
}
\end{figure*}
For all algorithms, we investigate convergence for 3 different values
of the regularization parameter, centered around the value minimizing
prediction error as measured by cross-validation.
On fig.\,\ref{fig:convergence}, we report energy as a function of time.
Importantly, we report time, and not iteration number. Indeed, not only
is computing time the most important quantity for the user, but also it
is suitable to compare different algorithms.
\bigskip
We find that, as expected, ISTA or FISTA with a lax tolerance on the
inner problem reaches an energy plateau before convergence although, for
weak to medium regularization, it progresses fast before hitting this
limitation. On the opposite, setting a stringent tolerance leads to a
slow but steady decrease of the energy (though it eventually also
reaches a plateau before complete convergence in the high-regularization
case). The theoretical decrease on the tolerance has an intermediate
behavior. In particular, it does not stagnate. The convergence of the
ADMM approach depends strongly on its control parameter: on the
one hand, no control parameter achieves satisfying convergence for all
regularization values, on the other hand the ADMM does not converge at
all for a bad choice of the parameter. LBFGS reaches a plateau, but gets
there fast in the case of weak regularization. Finally, our adaptive
approach, whether in its accelerate form, or simply in an ISTA loop,
reaches the lowest energy value.
\section{Discussion and conclusions}
Optimizing an analysis-sparsity functional with a ill-conditioned
data-fit term is a very challenging problem as the non-smooth part cannot
be readily written as a proximal problem with an analytic solution.
Splitting approaches with auxiliary variables in the analysis space are
often put forward as a solution for these problems as the non-smooth
contribution is easy to solve on these variables. However, when the
computation cost of the smooth data-fit part is high, \emph{eg} when the
design matrix is dense and large as in brain imaging, our experience is
that these approaches are sub-optimal --see also
\cite{dohmatob2014benchmarking}, that explored the preconditioned variant
of \cite{chambolle-pock:2011}. We conjecture that in these situations,
the choice of the control parameter becomes crucial to accelerate the
convergence\footnote{We evaluated the heuristics describe in
\cite{boyd2011} to evolve the control parameter, but with no conclusive
success.}.
Our preferred solution relies on using an inexact proximal operator and
adapting ISTA-type algorithms to set the corresponding tolerance.
Experiments show that this approach is robust and always converges to a
high tolerance. For very low regularization, the smooth data-fit part of
the functional dominates and careful use of smooth optimization methods
can achieve a quicker initial rate of convergence but are eventually
limited. We currently lack theory on the optimal strategy to set the
tolerance of the inner problem. Indeed, on the experiment studied in this
contribution, the accelerated gradient variant of the algorithm did not
outperform the single-step variant.
Analysis sparsity can be used to capture structure in a much wider set of
situations than the simpler, more common synthesis sparsity. However it
is seldom used in practice, likely because of the computational cost it
entails. Many problems can benefit from faster solvers outside of brain
imaging, for instance in tomography image recovery \cite{sidky2008image}.
\bibliographystyle{abbrv}
| {'timestamp': '2015-12-23T02:05:16', 'yymm': '1512', 'arxiv_id': '1512.06999', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06999'} | arxiv |
\section{Introduction}
\label{sec:Introduction}
\input{sections/introduction.tex}
\section{Foundations}
\label{sec:Foundations}
\input{sections/foundations.tex}
\section{Related Work}
\label{sec:RelatedWork}
\input{sections/related_work.tex}
\section{Relational Mappings for RDF}
\label{sec:RDFMapping}
\input{sections/rdf_mapping.tex}
\section{Extended Vertical Partitioning}
\label{sec:ExtVP}
\input{sections/extvp.tex}
\section{S2RDF Query Processing}
\label{sec:Querying}
\input{sections/querying.tex}
\section{Evaluation}
\label{sec:Evaluation}
\input{sections/evaluation.tex}
\section{Conclusion}
\label{sec:Conclusion}
\input{sections/conclusion.tex}
\bibliographystyle{abbrv}
\subsection{Linear Queries}
\begin{itemize}
\item [\textbf{L1:}]
\begin{verbatim}
#mapping v1 wsdbm:Website uniform
SELECT ?v0 ?v2 ?v3 WHERE {
?v0 wsdbm:subscribes
?v2 sorg:caption ?v3 .
?v0 wsdbm:likes ?v2 .
}
\end{verbatim}
\item [\textbf{L2:}]
\begin{verbatim}
#mapping v0 wsdbm:City uniform
SELECT ?v1 ?v2 WHERE {
?v2 wsdbm:likes wsdbm:Product0 .
?v2 sorg:nationality ?v1 .
}
\end{verbatim}
\item [\textbf{L3:}]
\begin{verbatim}
#mapping v2 wsdbm:Website uniform
SELECT ?v0 ?v1 WHERE {
?v0 wsdbm:likes ?v1 .
?v0 wsdbm:subscribes
}
\end{verbatim}
\item [\textbf{L4:}]
\begin{verbatim}
#mapping v1 wsdbm:Topic uniform
SELECT ?v0 ?v2 WHERE {
?v0 og:tag
?v0 sorg:caption ?v2 .
}
\end{verbatim}
\item [\textbf{L5:}]
\begin{verbatim}
#mapping v2 wsdbm:City uniform
SELECT ?v0 ?v1 ?v3 WHERE {
?v0 sorg:jobTitle ?v1 .
?v0 sorg:nationality ?v3 .
}
\end{verbatim}
\end{itemize}
\subsection{Star Queries}
\begin{itemize}
\item [\textbf{S1:}]
\begin{verbatim}
#mapping v2 wsdbm:Retailer uniform
SELECT ?v0 ?v1 ?v3 ?v4 ?v5
?v6 ?v7 ?v8 ?v9 WHERE {
?v0 gr:includes ?v1 .
?v0 gr:price ?v3 .
?v0 gr:serialNumber ?v4 .
?v0 gr:validFrom ?v5 .
?v0 gr:validThrough ?v6 .
?v0 sorg:eligibleQuantity ?v7 .
?v0 sorg:eligibleRegion ?v8 .
?v0 sorg:priceValidUntil ?v9 .
}
\end{verbatim}
\item [\textbf{S2:}]
\begin{verbatim}
#mapping v2 wsdbm:Country uniform
SELECT ?v0 ?v1 ?v3 WHERE {
?v0 dc:Location ?v1 .
?v0 sorg:nationality
?v0 wsdbm:gender ?v3 .
?v0 rdf:type wsdbm:Role2 .
}
\end{verbatim}
\item [\textbf{S3:}]
\begin{verbatim}
#mapping v1 wsdbm:ProductCategory uniform
SELECT ?v0 ?v2 ?v3 ?v4 WHERE {
?v0 rdf:type
?v0 sorg:caption ?v2 .
?v0 wsdbm:hasGenre ?v3 .
?v0 sorg:publisher ?v4 .
}
\end{verbatim}
\item [\textbf{S4:}]
\begin{verbatim}
#mapping v1 wsdbm:AgeGroup uniform
SELECT ?v0 ?v2 ?v3 WHERE {
?v0 foaf:age
?v0 foaf:familyName ?v2 .
?v3 mo:artist ?v0 .
?v0 sorg:nationality wsdbm:Country1 .
}
\end{verbatim}
\item [\textbf{S5:}]
\begin{verbatim}
#mapping v1 wsdbm:ProductCategory uniform
SELECT ?v0 ?v2 ?v3 WHERE {
?v0 rdf:type
?v0 sorg:description ?v2 .
?v0 sorg:keywords ?v3 .
?v0 sorg:language wsdbm:Language0 .
}
\end{verbatim}
\item [\textbf{S6:}]
\begin{verbatim}
#mapping v3 wsdbm:SubGenre uniform
SELECT ?v0 ?v1 ?v2 WHERE {
?v0 mo:conductor ?v1 .
?v0 rdf:type ?v2 .
?v0 wsdbm:hasGenre
}
\end{verbatim}
\item [\textbf{S7:}]
\begin{verbatim}
#mapping v3 wsdbm:User uniform
SELECT ?v0 ?v1 ?v2 WHERE {
?v0 rdf:type ?v1 .
?v0 sorg:text ?v2 .
}
\end{verbatim}
\end{itemize}
\subsection{Snowflake Queries}
\begin{itemize}
\item [\textbf{F1:}]
\begin{verbatim}
#mapping v1 wsdbm:Topic uniform
SELECT ?v0 ?v2 ?v3 ?v4 ?v5 WHERE {
?v0 og:tag
?v0 rdf:type ?v2 .
?v3 sorg:trailer ?v4 .
?v3 sorg:keywords ?v5 .
?v3 wsdbm:hasGenre ?v0 .
?v3 rdf:type wsdbm:ProductCategory2 .
}
\end{verbatim}
\item [\textbf{F2:}]
\begin{verbatim}
#mapping v8 wsdbm:SubGenre uniform
SELECT ?v0 ?v1 ?v2 ?v4 ?v5 ?v6 ?v7 WHERE {
?v0 foaf:homepage ?v1 .
?v0 og:title ?v2 .
?v0 rdf:type ?v3 .
?v0 sorg:caption ?v4 .
?v0 sorg:description ?v5 .
?v1 sorg:url ?v6 .
?v1 wsdbm:hits ?v7 .
?v0 wsdbm:hasGenre
}
\end{verbatim}
\newpage
\item [\textbf{F3:}]
\begin{verbatim}
#mapping v3 wsdbm:SubGenre uniform
SELECT ?v0 ?v1 ?v2 ?v4 ?v5 ?v6 WHERE {
?v0 sorg:contentRating ?v1 .
?v0 sorg:contentSize ?v2 .
?v0 wsdbm:hasGenre
?v4 wsdbm:makesPurchase ?v5 .
?v5 wsdbm:purchaseDate ?v6 .
?v5 wsdbm:purchaseFor ?v0 .
}
\end{verbatim}
\item [\textbf{F4:}]
\begin{verbatim}
#mapping v3 wsdbm:Topic uniform
SELECT ?v0 ?v1 ?v2 ?v4 ?v5 ?v6 ?v7 ?v8 WHERE {
?v0 foaf:homepage ?v1 .
?v2 gr:includes ?v0 .
?v0 og:tag
?v0 sorg:description ?v4 .
?v0 sorg:contentSize ?v8 .
?v1 sorg:url ?v5 .
?v1 wsdbm:hits ?v6 .
?v1 sorg:language wsdbm:Language0 .
?v7 wsdbm:likes ?v0 .
}
\end{verbatim}
\item [\textbf{F5:}]
\begin{verbatim}
#mapping v2 wsdbm:Retailer uniform
SELECT ?v0 ?v1 ?v3 ?v4 ?v5 ?v6 WHERE {
?v0 gr:includes ?v1 .
?v0 gr:price ?v3 .
?v0 gr:validThrough ?v4 .
?v1 og:title ?v5 .
?v1 rdf:type ?v6 .
}
\end{verbatim}
\end{itemize}
\newpage
\subsection{Complex Queries}
\begin{itemize}
\item [\textbf{C1:}]
\begin{verbatim}
SELECT ?v0 ?v4 ?v6 ?v7 WHERE {
?v0 sorg:caption ?v1 .
?v0 sorg:text ?v2 .
?v0 sorg:contentRating ?v3 .
?v0 rev:hasReview ?v4 .
?v4 rev:title ?v5 .
?v4 rev:reviewer ?v6 .
?v7 sorg:actor ?v6 .
?v7 sorg:language ?v8 .
}
\end{verbatim}
\item [\textbf{C2:}]
\begin{verbatim}
SELECT ?v0 ?v3 ?v4 ?v8 WHERE {
?v0 sorg:legalName ?v1 .
?v0 gr:offers ?v2 .
?v2 sorg:eligibleRegion wsdbm:Country5 .
?v2 gr:includes ?v3 .
?v4 sorg:jobTitle ?v5 .
?v4 foaf:homepage ?v6 .
?v4 wsdbm:makesPurchase ?v7 .
?v7 wsdbm:purchaseFor ?v3 .
?v3 rev:hasReview ?v8 .
?v8 rev:totalVotes ?v9 .
}
\end{verbatim}
\item [\textbf{C3:}]
\begin{verbatim}
SELECT ?v0 WHERE {
?v0 wsdbm:likes ?v1 .
?v0 wsdbm:friendOf ?v2 .
?v0 dc:Location ?v3 .
?v0 foaf:age ?v4 .
?v0 wsdbm:gender ?v5 .
?v0 foaf:givenName ?v6 .
}
\end{verbatim}
\end{itemize}
\subsection{Incremental User Queries (Type 1)}
\begin{itemize}
\item [\textbf{1-5:}]
\begin{verbatim}
#mapping v0 wsdbm:User uniform
SELECT ?v1 ?v2 ?v3 ?v4 ?v5 WHERE {
?v1 wsdbm:likes ?v2 .
?v2 rev:hasReview ?v3 .
?v3 rev:reviewer ?v4 .
?v4 wsdbm:friendOf ?v5 .
}
\end{verbatim}
\item [\textbf{1-6:}]
\begin{verbatim}
#mapping v0 wsdbm:User uniform
SELECT ?v1 ?v2 ?v3 ?v4 ?v5 ?v6 WHERE {
?v1 wsdbm:likes ?v2 .
?v2 rev:hasReview ?v3 .
?v3 rev:reviewer ?v4 .
?v4 wsdbm:friendOf ?v5 .
?v5 wsdbm:makesPurchase ?v6 .
}
\end{verbatim}
\item [\textbf{1-7:}]
\begin{verbatim}
#mapping v0 wsdbm:User uniform
SELECT ?v1 ?v2 ?v3 ?v4 ?v5 ?v6
?v7 WHERE {
?v1 wsdbm:likes ?v2 .
?v2 rev:hasReview ?v3 .
?v3 rev:reviewer ?v4 .
?v4 wsdbm:friendOf ?v5 .
?v5 wsdbm:makesPurchase ?v6 .
?v6 wsdbm:purchaseFor ?v7 .
}
\end{verbatim}
\item [\textbf{1-8:}]
\begin{verbatim}
#mapping v0 wsdbm:User uniform
SELECT ?v1 ?v2 ?v3 ?v4 ?v5 ?v6
?v7 ?v8 WHERE {
?v1 wsdbm:likes ?v2 .
?v2 rev:hasReview ?v3 .
?v3 rev:reviewer ?v4 .
?v4 wsdbm:friendOf ?v5 .
?v5 wsdbm:makesPurchase ?v6 .
?v6 wsdbm:purchaseFor ?v7 .
?v7 sorg:author ?v8 .
}
\end{verbatim}
\newpage
\item [\textbf{1-9:}]
\begin{verbatim}
#mapping v0 wsdbm:User uniform
SELECT ?v1 ?v2 ?v3 ?v4 ?v5 ?v6
?v7 ?v8 ?v9 WHERE {
?v1 wsdbm:likes ?v2 .
?v2 rev:hasReview ?v3 .
?v3 rev:reviewer ?v4 .
?v4 wsdbm:friendOf ?v5 .
?v5 wsdbm:makesPurchase ?v6 .
?v6 wsdbm:purchaseFor ?v7 .
?v7 sorg:author ?v8 .
?v8 dc:Location ?v9 .
}
\end{verbatim}
\item [\textbf{1-10:}]
\begin{verbatim}
#mapping v0 wsdbm:User uniform
SELECT ?v1 ?v2 ?v3 ?v4 ?v5 ?v6
?v7 ?v8 ?v9 ?v10 WHERE {
?v1 wsdbm:likes ?v2 .
?v2 rev:hasReview ?v3 .
?v3 rev:reviewer ?v4 .
?v4 wsdbm:friendOf ?v5 .
?v5 wsdbm:makesPurchase ?v6 .
?v6 wsdbm:purchaseFor ?v7 .
?v7 sorg:author ?v8 .
?v8 dc:Location ?v9 .
?v9 gn:parentCountry ?v10 .
}
\end{verbatim}
\end{itemize}
\subsection{Incremental Retailer Queries (Type 2)}
\begin{itemize}
\item [\textbf{2-5:}]
\begin{verbatim}
#mapping v0 wsdbm:Retailer uniform
SELECT ?v1 ?v2 ?v3 ?v4 ?v5 WHERE {
?v1 gr:includes ?v2 .
?v2 sorg:director ?v3 .
?v3 wsdbm:friendOf ?v4 .
?v4 wsdbm:friendOf ?v5 .
}
\end{verbatim}
\item [\textbf{2-6:}]
\begin{verbatim}
#mapping v0 wsdbm:Retailer uniform
SELECT ?v1 ?v2 ?v3 ?v4 ?v5 ?v6 WHERE {
?v1 gr:includes ?v2 .
?v2 sorg:director ?v3 .
?v3 wsdbm:friendOf ?v4 .
?v4 wsdbm:friendOf ?v5 .
?v5 wsdbm:likes ?v6 .
}
\end{verbatim}
\item [\textbf{2-7:}]
\begin{verbatim}
#mapping v0 wsdbm:Retailer uniform
SELECT ?v1 ?v2 ?v3 ?v4 ?v5 ?v6
?v7 WHERE {
?v1 gr:includes ?v2 .
?v2 sorg:director ?v3 .
?v3 wsdbm:friendOf ?v4 .
?v4 wsdbm:friendOf ?v5 .
?v5 wsdbm:likes ?v6 .
?v6 sorg:editor ?v7 .
}
\end{verbatim}
\newpage
\item [\textbf{2-8:}]
\begin{verbatim}
#mapping v0 wsdbm:Retailer uniform
SELECT ?v1 ?v2 ?v3 ?v4 ?v5 ?v6
?v7 ?v8 WHERE {
?v1 gr:includes ?v2 .
?v2 sorg:director ?v3 .
?v3 wsdbm:friendOf ?v4 .
?v4 wsdbm:friendOf ?v5 .
?v5 wsdbm:likes ?v6 .
?v6 sorg:editor ?v7 .
?v7 wsdbm:makesPurchase ?v8 .
}
\end{verbatim}
\item [\textbf{2-9:}]
\begin{verbatim}
#mapping v0 wsdbm:Retailer uniform
SELECT ?v1 ?v2 ?v3 ?v4 ?v5 ?v6
?v7 ?v8 ?v9 WHERE {
?v1 gr:includes ?v2 .
?v2 sorg:director ?v3 .
?v3 wsdbm:friendOf ?v4 .
?v4 wsdbm:friendOf ?v5 .
?v5 wsdbm:likes ?v6 .
?v6 sorg:editor ?v7 .
?v7 wsdbm:makesPurchase ?v8 .
?v8 wsdbm:purchaseFor ?v9 .
}
\end{verbatim}
\item [\textbf{2-10:}]
\begin{verbatim}
#mapping v0 wsdbm:Retailer uniform
SELECT ?v1 ?v2 ?v3 ?v4 ?v5 ?v6
?v7 ?v8 ?v9 ?v10 WHERE {
?v1 gr:includes ?v2 .
?v2 sorg:director ?v3 .
?v3 wsdbm:friendOf ?v4 .
?v4 wsdbm:friendOf ?v5 .
?v5 wsdbm:likes ?v6 .
?v6 sorg:editor ?v7 .
?v7 wsdbm:makesPurchase ?v8 .
?v8 wsdbm:purchaseFor ?v9 .
?v9 sorg:caption ?v10 .
}
\end{verbatim}
\end{itemize}
\subsection{Incremental Unbound Queries (Type 3)}
\begin{itemize}
\item [\textbf{3-5:}]
\begin{verbatim}
SELECT ?v0 ?v1 ?v2 ?v3 ?v4 ?v5 WHERE {
?v0 gr:offers ?v1 .
?v1 gr:includes ?v2 .
?v2 rev:hasReview ?v3 .
?v3 rev:reviewer ?v4 .
?v4 wsdbm:friendOf ?v5 .
}
\end{verbatim}
\item [\textbf{3-6:}]
\begin{verbatim}
SELECT ?v0 ?v1 ?v2 ?v3 ?v4 ?v5 ?v6 WHERE {
?v0 gr:offers ?v1 .
?v1 gr:includes ?v2 .
?v2 rev:hasReview ?v3 .
?v3 rev:reviewer ?v4 .
?v4 wsdbm:friendOf ?v5 .
?v5 wsdbm:likes ?v6 .
}
\end{verbatim}
\newpage
\item [\textbf{3-7:}]
\begin{verbatim}
SELECT ?v0 ?v1 ?v2 ?v3 ?v4 ?v5 ?v6
?v7 WHERE {
?v0 gr:offers ?v1 .
?v1 gr:includes ?v2 .
?v2 rev:hasReview ?v3 .
?v3 rev:reviewer ?v4 .
?v4 wsdbm:friendOf ?v5 .
?v5 wsdbm:likes ?v6 .
?v6 sorg:author ?v7 .
}
\end{verbatim}
\item [\textbf{3-8:}]
\begin{verbatim}
SELECT ?v0 ?v1 ?v2 ?v3 ?v4 ?v5 ?v6
?v7 ?v8 WHERE {
?v0 gr:offers ?v1 .
?v1 gr:includes ?v2 .
?v2 rev:hasReview ?v3 .
?v3 rev:reviewer ?v4 .
?v4 wsdbm:friendOf ?v5 .
?v5 wsdbm:likes ?v6 .
?v6 sorg:author ?v7 .
?v7 wsdbm:follows ?v8 .
}
\end{verbatim}
\item [\textbf{3-9:}]
\begin{verbatim}
SELECT ?v0 ?v1 ?v2 ?v3 ?v4 ?v5 ?v6
?v7 ?v8 ?v9 WHERE {
?v0 gr:offers ?v1 .
?v1 gr:includes ?v2 .
?v2 rev:hasReview ?v3 .
?v3 rev:reviewer ?v4 .
?v4 wsdbm:friendOf ?v5 .
?v5 wsdbm:likes ?v6 .
?v6 sorg:author ?v7 .
?v7 wsdbm:follows ?v8 .
?v8 foaf:homepage ?v9 .
}
\end{verbatim}
\item [\textbf{3-10:}]
\begin{verbatim}
SELECT ?v0 ?v1 ?v2 ?v3 ?v4 ?v5 ?v6
?v7 ?v8 ?v9 ?v10 WHERE {
?v0 gr:offers ?v1 .
?v1 gr:includes ?v2 .
?v2 rev:hasReview ?v3 .
?v3 rev:reviewer ?v4 .
?v4 wsdbm:friendOf ?v5 .
?v5 wsdbm:likes ?v6 .
?v6 sorg:author ?v7 .
?v7 wsdbm:follows ?v8 .
?v8 foaf:homepage ?v9 .
?v9 sorg:language ?v10 .
}
\end{verbatim}
\end{itemize}
\subsection{Varying OS Selectivity}
\begin{itemize}
\item [\textbf{1-1:}]
\begin{verbatim}
# ?v0 -- friendOf --> ?v1 -- email --> ?v2
# |VP_fiendOf| = 0.41 * |G|
# SF(ExtVP_OS_fiendOf|email) = 0.90
# SF(ExtVP_SO_email|fiendOf) = 1
SELECT ?v0 ?v1 ?v2 WHERE {
?v0 wsdbm:friendOf ?v1 .
?v1 sorg:email ?v2 .
}
\end{verbatim}
\item [\textbf{1-2:}]
\begin{verbatim}
# ?v0 -- friendOf --> ?v1 -- age --> ?v2
# |VP_fiendOf| = 0.41 * |G|
# SF(ExtVP_OS_fiendOf|age) = 0.50
# SF(ExtVP_SO_age|fiendOf) = 1
SELECT ?v0 ?v1 ?v2 WHERE {
?v0 wsdbm:friendOf ?v1 .
?v1 foaf:age ?v2 .
}
\end{verbatim}
\item [\textbf{1-3:}]
\begin{verbatim}
# ?v0 -- friendOf --> ?v1 -- jobTitle --> ?v2
# |VP_fiendOf| = 0.41 * |G|
# SF(ExtVP_OS_fiendOf|jobTitle) = 0.05
# SF(ExtVP_SO_jobTitle|fiendOf) = 1
SELECT ?v0 ?v1 ?v2 WHERE {
?v0 wsdbm:friendOf ?v1 .
?v1 sorg:jobTitle ?v2 .
}
\end{verbatim}
\item [\textbf{2-1:}]
\begin{verbatim}
# ?v0 -- reviewer --> ?v1 -- email --> ?v2
# |VP_reviewer| = 0.01 * |G|
# SF(ExtVP_OS_reviewer|email) = 0.90
# SF(ExtVP_SO_email|reviewer) = 0.31
SELECT ?v0 ?v1 ?v2 WHERE {
?v0 rev:reviewer ?v1 .
?v1 sorg:email ?v2 .
}
\end{verbatim}
\item [\textbf{2-2:}]
\begin{verbatim}
# ?v0 -- reviewer --> ?v1 -- age --> ?v2
# |VP_reviewer| = 0.01 * |G|
# SF(ExtVP_OS_reviewer|age) = 0.50
# SF(ExtVP_SO_age|reviewer) = 0.31
SELECT ?v0 ?v1 ?v2 WHERE {
?v0 rev:reviewer ?v1 .
?v1 foaf:age ?v2 .
}
\end{verbatim}
\item [\textbf{2-3:}]
\begin{verbatim}
# ?v0 -- reviewer --> ?v1 -- jobTitle --> ?v2
# |VP_reviewer| = 0.01 * |G|
# SF(ExtVP_OS_reviewer|jobTitle) = 0.05
# SF(ExtVP_SO_jobTitle|reviewer) = 0.31
SELECT ?v0 ?v1 ?v2 WHERE {
?v0 rev:reviewer ?v1 .
?v1 sorg:jobTitle ?v2 .
}
\end{verbatim}
\end{itemize}
\newpage
\subsection{Varying SO Selectivity}
\begin{itemize}
\item [\textbf{3-1:}]
\begin{verbatim}
# ?v0 -- follows --> ?v1 -- friendOf --> ?v2
# |VP_fiendOf| = 0.41 * |G|
# SF(ExtVP_OS_follows|fiendOf) = 0.40
# SF(ExtVP_SO_fiendOf|follows) = 0.90
SELECT ?v0 ?v1 ?v2 WHERE {
?v0 wsdbm:follows ?v1 .
?v1 wsdbm:friendOf ?v2 .
}
\end{verbatim}
\item [\textbf{3-2:}]
\begin{verbatim}
# ?v0 -- reviewer --> ?v1 -- friendOf --> ?v2
# |VP_fiendOf| = 0.41 * |G|
# SF(ExtVP_OS_reviewer|fiendOf) = 0.40
# SF(ExtVP_SO_fiendOf|reviewer) = 0.31
SELECT ?v0 ?v1 ?v2 WHERE {
?v0 rev:reviewer ?v1 .
?v1 wsdbm:friendOf ?v2 .
}
\end{verbatim}
\item [\textbf{3-3:}]
\begin{verbatim}
# ?v0 -- author --> ?v1 -- friendOf --> ?v2
# |VP_fiendOf| = 0.41 * |G|
# SF(ExtVP_OS_author|fiendOf) = 0.40
# SF(ExtVP_SO_fiendOf|author) = 0.04
SELECT ?v0 ?v1 ?v2 WHERE {
?v0 sorg:author ?v1 .
?v1 wsdbm:friendOf ?v2 .
}
\end{verbatim}
\item [\textbf{4-1:}]
\begin{verbatim}
# ?v0 -- follows --> ?v1 -- likes --> ?v2
# |VP_likes| = 0.01 * |G|
# SF(ExtVP_OS_follows|likes) = 0.24
# SF(ExtVP_SO_likes|follows) = 0.90
SELECT ?v0 ?v1 ?v2 WHERE {
?v0 wsdbm:follows ?v1 .
?v1 wsdbm:likes ?v2 .
}
\end{verbatim}
\item [\textbf{4-2:}]
\begin{verbatim}
# ?v0 -- reviewer --> ?v1 -- likes --> ?v2
# |VP_likes| = 0.01 * |G|
# SF(ExtVP_OS_reviewer|likes) = 0.24
# SF(ExtVP_SO_likes|reviewer) = 0.31
SELECT ?v0 ?v1 ?v2 WHERE {
?v0 wsdbm:reviewer ?v1 .
?v1 wsdbm:likes ?v2 .
}
\end{verbatim}
\item [\textbf{4-3:}]
\begin{verbatim}
# ?v0 -- author --> ?v1 -- likes --> ?v2
# |VP_likes| = 0.01 * |G|
# SF(ExtVP_OS_author|likes) = 0.24
# SF(ExtVP_SO_likes|author) = 0.04
SELECT ?v0 ?v1 ?v2 WHERE {
?v0 wsdbm:author ?v1 .
?v1 wsdbm:likes ?v2 .
}
\end{verbatim}
\end{itemize}
\newpage
\subsection{Varying SS Selectivity}
\begin{itemize}
\item [\textbf{5-1:}]
\begin{verbatim}
# ?v0 <-- friendOf -- ?v1 -- email --> ?v2
# |VP_fiendOf| = 0.41 * |G|
# SF(ExtVP_SS_fiendOf|email) = 0.90
# SF(ExtVP_SS_email|fiendOf) = 0.40
SELECT ?v0 ?v1 ?v2 WHERE {
?v0 wsdbm:friendOf ?v1 .
?v0 sorg:email ?v2 .
}
\end{verbatim}
\item [\textbf{5-2:}]
\begin{verbatim}
# ?v0 <-- friendOf -- ?v1 -- follows --> ?v2
# |VP_fiendOf| = 0.41 * |G|
# SF(ExtVP_SS_fiendOf|follows) = 0.77
# SF(ExtVP_SS_follows|fiendOf) = 0.40
SELECT ?v0 ?v1 ?v2 WHERE {
?v0 wsdbm:friendOf ?v1 .
?v0 wsdbm:follows ?v2 .
}
\end{verbatim}
\end{itemize}
\subsection{High Selectivity Queries}
\begin{itemize}
\item [\textbf{6-1:}]
\begin{verbatim}
# ?v0 -- likes --> ?v1 -- trailer --> ?v2
# |VP_likes| = 0.01 * |G|
# |VP_trailer| = < 0.01 * |G|
# SF(ExtVP_OS_likes|trailer) < 0.01
# SF(ExtVP_SO_trailer|likes) = 0.96
SELECT ?v0 ?v1 ?v2 WHERE {
?v0 wsdbm:likes ?v1 .
?v1 sorg:trailer ?v2 .
}
\end{verbatim}
\item [\textbf{6-2:}]
\begin{verbatim}
# ?v1 <-- email -- ?v0 -- faxNumber --> ?v2
# |VP_email| = 0.01 * |G|
# |VP_faxNumber| = < 0.01 * |G|
# SF(ExtVP_SS_email|faxNumber) < 0.01
# SF(ExtVP_SS_faxNumber|email) = 0.80
SELECT ?v0 ?v1 ?v2 WHERE {
?v0 sorg:email ?v1 .
?v0 sorg:faxNumber ?v2 .
}
\end{verbatim}
\end{itemize}
\newpage
\subsection{OS vs SO Selectivity}
\begin{itemize}
\item [\textbf{7-1:}]
\begin{verbatim}
# ?v0 -- friendOf --> ?v1 -- follows -->
?v2 -- homepage --> ?v3
# SF(ExtVP_SO_follows|friendOf) = 1
# SF(ExtVP_OS_follows|homepage) = 0.05
SELECT ?v0 ?v1 ?v2 ?v3 WHERE {
?v0 wsdbm:friendOf ?v1 .
?v1 wsdbm:follows ?v2 .
?v2 foaf:homepage ?v3 .
}
\end{verbatim}
\item [\textbf{7-2:}]
\begin{verbatim}
# ?v0 -- artist --> ?v1 -- friendOf -->
?v2 -- follows --> ?v3
# SF(ExtVP_SO_friendOf|artist) = 0.01
# SF(ExtVP_OS_friendOf|follows) = 0.77
SELECT ?v0 ?v1 ?v2 ?v3 WHERE {
?v0 mo:artist ?v1 .
?v1 wsdbm:friendOf ?v2 .
?v2 wsdbm:follows ?v3 .
}
\end{verbatim}
\end{itemize}
\subsection{Empty Result Queries}
\begin{itemize}
\item [\textbf{8-1:}]
\begin{verbatim}
# ?v0 -- friendOf --> ?v1 -- language --> ?v2
# SF(ExtVP_OS_friendOf|language) = 0
# SF(ExtVP_SO_language|friendOf) = 0
SELECT ?v0 ?v1 ?v2 WHERE {
?v0 wsdbm:friendOf ?v1 .
?v1 sorg:language ?v2 .
}
\end{verbatim}
\item [\textbf{8-2:}]
\begin{verbatim}
# ?v0 -- friendOf --> ?v1 -- follows -->
?v2 -- language --> ?v3
# SF(ExtVP_OS_follows|language) = 0
# SF(ExtVP_SO_language|follows) = 0
SELECT ?v0 ?v1 ?v2 ?v3 WHERE {
?v0 wsdbm:friendOf ?v1 .
?v1 wsdbm:follows ?v2 .
?v2 sorg:language ?v3 .
}
\end{verbatim}
\end{itemize}
\subsection{WatDiv Selectivity Testing (ST)}
\label{subsec:WatDivSelectivity}
First, we wanted to quantify the performance benefits of ExtVP in comparison to VP in S2RDF.
For this purpose, we have designed a set of carefully chosen queries to test the different characteristics of ExtVP, listed in Appendix~\ref{sec:AppendixWatDivSelectivity}.
Fig.~\ref{fig:wd10000_selectivity_coords} compares the runtimes of ExtVP and VP, the numbers are listed in Table~\ref{tab:wd_selectivity}.
\begin{figure}[htb]
\centering
\includegraphics[width=1.0\columnwidth]{experiments/plots/WatDiv10000_selectivity_coords_all_column.pdf}
\caption{WatDiv Selectivity Testing (SF10000)}
\label{fig:wd10000_selectivity_coords}
\end{figure}
\begin{table}[htb]
\centering
\scriptsize
\caption{WatDiv Selectivity Testing comparing ExtVP with VP in S2RDF (runtimes in ms)}
\setlength{\tabcolsep}{.05cm}
\input{experiments/plots/Sel}
\label{tab:wd_selectivity}
\end{table}
Queries ST-1-1 to ST-2-3 are used to verify the effectiveness of OS tables in ExtVP (cf.~Fig.~\ref{fig:wd10000_selectivity_coords}(a)).
ST-1-1 to ST-1-3 have the structure \verb|(?v0 friendOf ?v1 . ?v1 p ?v2)| where different predicates are used for \verb|p|. Thus, the input size of VP is large ($|VP_{friendOf}|=0.41*|G|$) while the selectivity factor $SF$ of the corresponding OS tables varies depending on \verb|p| (ST-1-1: 0.9, ST-1-2: 0.5, ST-1-3: 0.05).
ST-2-1 to ST-2-3 have the same structure but we replace \verb|friendOf| by \verb|reviewer| in the first triple pattern which has a much smaller input size in VP ($|VP_{reviewer}|=0.01*|G|$).
We expect the benefits of ExtVP to increase with lower $SF$ values which is clearly underpinned by the runtimes. For example, ST-1-3 is $\sim14$ times faster on ExtVP than on VP.
Of course, the benefit depends on the input size of the query in VP thus ST-1-X profits more than ST-2-X. But still, ST-2-3 is $\sim4$ times faster on ExtVP.
Queries ST-3-1 to ST-4-3 are used to verify the effectiveness of SO tables in ExtVP (cf.~Fig.~\ref{fig:wd10000_selectivity_coords}(b)).
The structure of ST-3-1 to ST-3-3 is \verb|(?v0 p ?v1 . ?v1 friendOf ?v2)|. Again, the choice of predicate for \verb|p| affects the selectivity of corresponding SO tables (ST-3-1: 0.9, ST-3-2: 0.31, ST-3-3: 0.04).
For ST-4-1 to ST-4-3 we replace \verb|friendOf| by \verb|likes| which has a much smaller input size in VP ($|VP_{likes}|=0.01*|G|$).
The outcome is similar to the OS tests before with ExtVP being $\sim18$ times faster for ST-3-3 and $\sim3$ times faster for ST-4-3.
Next, we test the effectiveness of SS tables in ExtVP (cf.~Fig.~\ref{fig:wd10000_selectivity_coords}(c)) using queries ST-5-1 and ST-5-2.
They have the structure \verb|(?v0 friendOf ?v1 . ?v0 p ?v2)| such that choice of \verb|p| affects the selectivity of corresponding SS tables (ST-5-1: 0.9, ST-5-2: 0.77).
As expected, the benefit of ExtVP is proportional to the selectivity of its tables compared to VP: $0.9*$VP for ST-5-1 and $0.7*$VP for ST-5-2.
ST-6-1 and ST-6-2 test the performance of queries with high selectivities ($SF < 0.01$) on small inputs (cf.~Fig.~\ref{fig:wd10000_selectivity_coords}(d)). ST-6-1 is a linear query whereas ST-6-2 is a star query. For both shapes, ExtVP is $\sim4$ times faster than VP and achieves sub-second runtimes on a billion triples.
ST-7-1 and ST-7-2 are designed to demonstrate that some queries benefit more from OS than from SO tables and vice versa. The queries consist of three linear-shaped triple patterns
\verb|(?v0 p1 ?v1 . ?v1 p2 ?v2 . ?v2 p3 ?v3)| such that S2RDF can choose between an SO or an OS table to answer the second triple pattern. For ST-7-1 the selectivity of OS is higher than SO and for ST-7-2 the selectivity of SO is higher than OS.
The last two queries, ST-8-1 and ST-8-2, are designed to demonstrate the usage of statistics. Using ExtVP the system can derive that both queries will not return any results without having to run them as the corresponding ExtVP tables are empty ($SF=0$). Especially ST-8-2 profits a lot from statistics because the first two triple patterns produce a large set of intermediate results in VP which get discarded afterwards.
Overall, the workload clearly underpins the desired characteristics of ExtVP compared to the baseline VP schema in all categories. As expected, the relative performance benefit is proportional to the selectivity of ExtVP tables compared to their corresponding VP counterparts.
\subsection{WatDiv Basic Testing}
\label{subsec:WatDivBasic}
\begin{figure*}[htbp]
\centering
\includegraphics[width=1.0\textwidth]{experiments/plots/WatDiv10000_basic_categories.pdf}
\caption{WatDiv Basic Testing (SF10000)}
\label{fig:wd10000_basic}
\end{figure*}
\begin{table*}[htbp]
\centering
\scriptsize
\caption{WatDiv Basic (in ms), AM-X = AM of category X, AM-T = total AM of all queries}
\setlength{\tabcolsep}{.11cm}
\input{experiments/plots/Basic-1}
\newline
\setlength{\tabcolsep}{.2cm}
\input{experiments/plots/Basic-2}
\label{tab:wd_basic}
\end{table*}
WatDiv comes with a set of 20 predefined query templates called \textit{Basic Testing} use case (listed in Appendix~\ref{sec:AppendixWatDivBasic}) which can be grouped in four categories according to their shape: \textit{star} (S), \textit{linear} (L), \textit{snowflake} (F) and \textit{complex} (C). We instantiated every query template several times for every dataset size and report the average mean (AM) runtime for all systems.
Fig.~\ref{fig:wd10000_basic} compares the different systems on the largest dataset (SF10000), corresponding AM runtimes are listed in Table~\ref{tab:wd_basic}.
We can observe that S2RDF outperforms PigSPARQL and SHARD by several orders of magnitude for all categories due to their underlying MapReduce-based batch execution engine. These systems scale very smooth with the data size but are not able to provide interactive query runtimes. PigSPARQL performs better than SHARD due to its multi-join optimization that can process several triple patterns in a single MapReduce job whereas SHARD uses one job per triple pattern.
The data model of Sempala is based on a unified property table and thus focuses on efficient star-shaped pattern execution where it needs no joins to retrieve the results.
Nonetheless, S2RDF outperforms Sempala by up to an order of magnitude for this category as well (S1-S7). We attribute this to the fact that Sempala, though not performing any joins, has to scan through the whole property table to find the matching rows thus query execution is limited by table scan time.
S2RDF, in contrast, performs a series of joins for star patterns but it can significantly reduce the input size as it can choose from a number of potential ExtVP SS tables and pick the one with the highest selectivity for every triple pattern.
For example, the star pattern of query S3 contains triple patterns with predicates \verb|rdf:type| and \verb|sorg:caption| and the corresponding table $ExtVP_{type|caption}^{SS}$ has selectivity $SF=0.02$, i.e.~it reduces the input size for triple pattern with predicate \verb|rdf:type| to only 2\%.
This underpins our finding from Sec.~\ref{sec:ExtVP} that input size reduction is often more effective than saving of join operations.
Sempala also shows a good performance for the other query types due to the underlying in-memory execution based on Impala but is not able to beat S2RDF for any query.
On average, S2RDF is an order of magnitude faster than Sempala for all four query categories.
The performance of H2RDF+ strongly depends on its execution model as some queries are executed centralized while others are executed using an optimized MapReduce job based on cost estimation.
For smaller datasets H2RDF+ can use efficient centralized merge joins and thus query runtimes are comparable to S2RDF.
However, with increasing data size many queries become too costly for centralized execution and MapReduce must be used instead.
For example, while both systems have nearly the same performance for query F1 on SF1000, S2RDF outperforms H2RDF+ by two orders of magnitude for the same query on SF10000.
The same is true for majority of queries regardless of their type.
There are only a few queries (5 out of 20) where runtimes of H2RDF+ are better than S2RDF on the largest dataset. These queries are highly selective returning only a few results and all of them contain a triple pattern where not only predicate but also subject or object are bound. Such queries are ideal candidates for centralized execution based on HBase lookups. But even for these queries, runtime differences of both systems are within the order of milliseconds.
On average, S2RDF outperforms H2RDF+ by at least one order of magnitude for all four query categories.
For completeness, we also executed the benchmark queries on centralized Virtuoso over the largest dataset (SF10000). We observed that runtimes of Virtuoso strongly correlate with the result size of a query and benefit from repeated execution.
Queries with empty results are generally very fast due to the use of sophisticated indexes.
Furthermore, if a query is executed several times for different template parameter values, its performance improves gradually probably due to caching effects. Thus, query runtimes of Virtuoso are rather skewed with relatively high standard deviations.
In contrast, the runtimes of S2RDF are pretty stable as they do not depend on the result size to such a large extent and we do not use query caching mechanisms. In Table~\ref{tab:wd_basic} we report both, the runtimes of Virtuoso for cold caches where we execute every query only once as well as average runtimes for repeated query execution.
Nonetheless, S2RDF is an order of magnitude faster than Virtuoso on average for all four query categories, even with repeated query execution.
Overall, the evaluation clearly demonstrates the superior performance of S2RDF compared to state of the art distributed and centralized RDF stores for all query shapes. In contrast to most existing approaches, ExtVP does not favor any specific query type and achieves consistent performance regardless of query pattern shape. Thus, S2RDF answers most of the benchmark queries in less than a second on a billion triples RDF graph.
\subsection{WatDiv Incremental Linear Testing (IL)}
\label{subsec:WatDivIncremental}
\begin{figure*}[htbp]
\centering
\includegraphics[width=1.0\textwidth]{experiments/plots/WatDiv10000_incremental_categories.pdf}
\caption{WatDiv Incremental Linear Testing (SF10000)}
\label{fig:wd10000_incremental}
\end{figure*}
\begin{table*}[htbp]
\centering
\scriptsize
\caption{WatDiv IL (in ms), AM-IL-X = AM of query type X, AM-Y = AM of queries with length Y}
\setlength{\tabcolsep}{.05cm}
\input{experiments/plots/Inc-1}
\newline
\setlength{\tabcolsep}{.045cm}
\input{experiments/plots/Inc-2}
\label{tab:wd_incremental}
\end{table*}
The queries of Basic Testing use case in WatDiv are well suited to test the performance for different query shapes but most of them have a rather small diameter. In fact, there are only two queries with a diameter larger than 3 (C1 and C2).
Most distributed RDF stores are optimized for small diameter queries as RDF datasets are typically fragmented based on hashing or graph partitioning algorithms that try to place vertices on the same cluster node that are close to each other in the RDF graph, e.g.~\cite{huang_HadoopRDF3X_2011, lee_SHAPE_2013, rohloff_SHARD_2011, sempala_2014, zhang_EAGRE_2013}.
Therefore, we wanted to have a more fine-grained look at the effects of query diameter on performance of S2RDF and competitors which was not possible with the given Basic Testing use case.
For that reason, we have designed an additional WatDiv use case called \textit{Incremental Linear Testing} focusing on linear queries with increasing size (diameter). It consists of three query types (IL-1, IL-2, IL-3) which are bound by user, retailer or unbound, resp. Each query type starts with a diameter of 5 (i.e.~5~triple patterns) and we incrementally add triple patterns (up to 10).
For example, query IL-1-8 is a user bound query with diameter 8.
All queries are listed in Appendix~\ref{sec:AppendixWatDivIncremental}. They were also added as an official use case to WatDiv and included in the WatDiv download package\footnote{\url{http://dsg.uwaterloo.ca/watdiv/}}. This emphasizes the importance of such a workload that was not adequately covered before.
Fig.~\ref{fig:wd10000_incremental} compares all systems on the largest dataset (SF10000), corresponding AM runtimes are listed in Table~\ref{tab:wd_incremental}.
The first query type (IL-1) starts from a given user following various edges along the graph, i.e.~it has the structure \verb|(u1 p1 ?v1 . ?v1 p2 ?v2 . ?v2 p3 ?v3 . ...)|.
We instantiate every query for 10 different users and we use the same users for all path lengths.
We can observe that S2RDF significantly outperforms all other distributed competitors while runtimes rise only slightly with increasing data size.
The queries make use of the two largest predicates in the dataset (\verb|friendOf| and \verb|follows|) that together represent ca. $70\%$ of all triples in the RDF graph ($0.7*|G|$).
This is probably also the reason why H2RDF+ does not use centralized execution for all queries starting from SF100.
By means of ExtVP, S2RDF can reduce the input size for predicate \verb|follows| from $0.3*|G|$ to only $0.07*|G|$ and from $0.4*|G|$ to $0.065*|G|$ for predicate \verb|friendOf| using a combination of OS and SO tables.
The only system that achieves similar runtimes as S2RDF is centralized Virtuoso with warm caches while being significantly slower for cold caches.
The second query type (IL-2) starts from a given retailer also following various edges along the graph, i.e.~it has the same structure as IL-1 but uses a different sequence of predicates along the path.
Again, we instantiate every query 10 times with different retailers.
Similar to IL-1, S2RDF clearly outperforms all other distributed competitors.
However, there is an interesting aspect when comparing the runtime of S2RDF for IL-2-5 with runtimes of IL-2-6 to IL-2-10. IL-2-5 performs much worse than all other queries despite being a subpattern of them. This seems to be odd at first glance but can be explained by looking at the query pattern.
IL-2-5 ends with following predicate (edge) \verb|friendOf| twice \verb|(... . ?v3 friendOf ?v4 . ?v4 friendOf ?v5)| which is the largest predicate in the graph ($0.4*|G|$).
Unfortunately, SO table $ExtVP_{friendOf|friendOf}^{SO}$ has selectivity $SF = 1$ which means that S2RDF cannot reduce the input size for the last triple pattern $t_5$ in the query and has to use table $VP_{friendOf}$ to retrieve the results for it.
IL-2-6 adds a triple pattern with predicate \verb|likes| to the end which now allows S2RDF to use OS table $ExtVP_{friendOf|likes}^{OS}$ with $SF = 0.24$ for triple pattern $t_5$ which reduces the input size for it from $0.4*|G|$ to $0.1*|G|$.
This example demonstrates that more triple patterns in a query can even lead to better performance in S2RDF despite the fact that it needs more joins.
The third query type (IL-3) has also the same structure as IL-1 and IL-2 but is not bound at all, i.e.~it starts from all vertices in the graph following various edges.
This type of query puts a heavy load on the system and produces very large result sets for large graphs.
Only S2RDF, Sempala and PigSPARQL were able to answer all queries up to diameter 10 on the largest dataset which demonstrate the excellent scalability of these systems.
Virtuoso was not able to answer any of the queries within a 10 hours timeout which confirms the scalability limitations of centralized RDF stores.
Interesting to see is that S2RDF runtime of IL-3-8 is an order of magnitude slower than for all other queries. There is a twofold reason for that.
First, the result size of IL-3-8 on SF10000 is extremely large ($\sim 25$ billion) and gets reduced by adding another triple pattern $t_9$ in IL-3-9 ($\sim 1$ billion).
Second, join order optimization of S2RDF (cf.~Sec.~\ref{subsec:JoinOrderOptimization}) does not simply add the join for $t_9$ in IL-3-9 to the end of join order but pushes it more to the beginning as its corresponding ExtVP table is rather small.
As a result, S2RDF avoids to compute the same output as for IL-3-8 and then joining with $t_9$ to compute the final result for IL-3-9 but instead reduces the intermediate result size significantly.
Overall, S2RDF demonstrates its superior performance and scalability for queries with large diameters, a query type that is not sufficiently covered by the Basic Testing use case and is also underrepresented in other existing RDF/SPARQL benchmarks.
Our new use case reveals that performance of most distributed RDF stores significantly drops for such workloads as their data model is optimized to answer small diameter queries.
It is now included in WatDiv and we hope that this will accelerate a better support in future.
\subsection{SF Threshold}
\label{subsec:SFUpperBound}
\begin{figure*}[htb]
\centering
\includegraphics[width=1.0\textwidth]{experiments/plots/sfub_all.pdf}
\caption{Relative runtimes and storage sizes in relation to increasing SF threshold values}
\label{fig:sfub}
\end{figure*}
In this section we investigate the influence of a threshold for selectivity factor $SF$ of tables in ExtVP (SF TH) as discussed in Sec.~\ref{subsec:ExtVPSize} on runtime and storage size with S2RDF.
For example, a threshold of $0.5$ for $SF$ means that only those ExtVP tables with $SF < 0.5$ are materialized.
\begin{table}[htb]
\centering
\scriptsize
\caption{ExtVP sizes (including VP) for varying SF threshold values (SF10000)}
\begin{tabularx}{\columnwidth}{rrrr}
\toprule
\textbf{SF TH} & \textbf{\# tables (in \%)} & \textbf{\# tuples} & \textbf{HDFS size (in \%)} \\
\midrule
\textbf{0.00} & 86 ~(4\%) & 1091M & 6.6 GB (9\%) \\
\textbf{0.10} & 924 (43\%) & 1508M & 8.8 GB (13\%) \\
\textbf{0.25} & 1275 (60\%) & 3316M & 18.4 GB (26\%) \\
\textbf{0.50} & 1609 (76\%) & 5889M & 32.1 GB (46\%) \\
\textbf{0.75} & 1887 (89\%) & 9480M & 51.3 GB (73\%) \\
\textbf{0.90} & 2006 (94\%) & 11631M & 62.8 GB (89\%) \\
\textbf{1.00} & 2129 (100\%) & 13059M & 70.4 GB (100\%) \\
\bottomrule
\end{tabularx}%
\label{tab:sfub}%
\end{table}%
Table~\ref{tab:sfub} gives an overview of the number of tables maintained by S2RDF (ExtVP + VP), the total number of table tuples and total storage size in HDFS.
SF TH = 0 means that no ExtVP tables are stored at all and hence only VP is used whereas SF TH = 1 means that all tables with $SF < 1$ are considered.
The best performance, of course, is achieved for SF TH = 1 but this also means that we store a lot of tables with low selectivities that cost a lot of storage but do not improve performance to a large extent.
We test the runtimes of S2RDF for WatDiv Basic Testing use case on SF10000 for various SF TH values.
A comparison of relative runtimes (grouped by query category) and actual data size with respect to SF TH values is illustrated in Fig.~\ref{fig:sfub}.
It turns out that for SF TH = 0.25 we already achieve most of the performance benefit compared to the baseline execution with SF TH = 0 (which corresponds to VP). In fact, on average we achieve $95\%$ of the performance benefit that we get when using no threshold. At the same time, we maintain only $3n$ tuples in total over all tables (including VP) with $n$ being the number of triples in the RDF graph, compared to $12n$ for SF TH = 1. Thus, ExtVP implies an overhead of only $2n$ compared to VP for SF TH = 0.25 which also directly corresponds to physical storage in HDFS.
If we compare the different query categories (cf.~Fig.~\ref{fig:sfub}) we can observe that (a) linear-, (b) star- and (d) complex-shaped queries hardly improve anymore for SF TH values larger than 0.25. Only the (c) snowflake-shaped queries noticeably profit from larger values, more precisely F3 and F5. Indeed, both contain several triple patterns where corresponding ExtVP tables have selectivity $0.25 < SF < 0.5$.
In summary, the performance of S2RDF when executed on ExtVP with a threshold of 0.25 for $SF$ is almost the same compared to ExtVP with no threshold on $SF$ while using only $25\%$ of table tuples and storage size.
\subsection{ExtVP in a Nutshell}
\label{subsec:ExtVPNutshell}
Many existing data layouts for RDF are tailored towards a specific kind of query shape (cf.~Sec.~\ref{subsec:RDF_SPARQL}) and most often star-shaped queries are the primary focus as these shapes occur very often in typical SPARQL queries, especially in rather selective ones. Property tables (cf.~Sec.~\ref{subsec:PropertyTables}) are a prominent example for this. One of the design criteria for the data layout of S2RDF is that it should not favor any specific query shape and in particular also provide an improvement for linear (path) patterns as they are often neglected by existing approaches. Furthermore, it should also be applicable for queries with a large diameter as well as complex mixed shapes being a composition of star, linear and snowflake patterns.
Based on our pre-evaluation findings, we decided to use a vertical partitioned (VP) schema as the base data layout for RDF in S2RDF. Using such a schema, the results for a triple pattern with bound predicate can be retrieved by accessing the corresponding VP table only which leads to a large reduction of the input size, in general. Unfortunately, the size of these tables is highly skewed in a typical RDF dataset with some tables containing only a few entries while others comprise a large portion of the entire graph. If a query needs to access such a table, there is still a lot of data to be read (and potentially shuffled) that gets discarded in the following when joined with the results of other triple patterns. To improve this behavior, we developed an extension to the VP schema called \textit{\underline{Ext}ended \underline{V}ertical \underline{P}artitioning} (ExtVP).
The basic idea of ExtVP is to precompute the possible join relations between partitions (i.e.~tables) of VP. For example, consider the BGP in Fig.~\ref{fig:join_vp_extvp} consisting of two triple patterns and the corresponding VP tables for predicates \textit{follows} and \textit{likes} of RDF graph $G_1$. To compute the final result using VP, both tables are joined depending on the position of variable $?y$. This implies 12 comparisons in total but there is only one matching tuple in both tables. Furthermore, it requires both tables to be read and at least partially shuffled, although most tuples will not find a corresponding join partner (\textit{dangling} tuples).
\begin{figure}[htb]
\centering
\includegraphics[width=1.0\columnwidth]{figures/Join_VP_ExtVP.pdf}
\caption{Join comparisons in VP and ExtVP}
\label{fig:join_vp_extvp}
\end{figure}
In ExtVP, the query processor can directly access the subset of table \textit{follows} where the object also exist as a subject in at least one tuple in table \textit{likes} and join it with the equivalent subset of table \textit{likes}. This avoids dangling tuples to be used as input and thus also reduces I/O. In addition, it also reduces the number of comparisons in join computation which further speeds up the overall processing. For example, in Fig.~\ref{fig:join_vp_extvp} the number of comparisons is minimized to one when using ExtVP.
These extra join relations between VP tables can be precomputed and materialized by a series of semi-joins. In practice, the space requirement of ExtVP is reasonable and comparable to existing approaches, e.g.~\cite{papailiou_H2RDF+_2013, sempala_2014, weiss_hexastore_2008}. The size and overhead of ExtVP compared to VP is discussed in more detail in Sec.~\ref{subsec:ExtVPSize}.
\subsection{ExtVP Definition}
\label{subsec:ExtVPDefinition}
The relevant semi-joins between tables in VP are determined by the possible joins that can occur when combining the results of triple patterns during query execution.
The position of a variable that occurs in both triple patterns (called join variable) determines the columns on which the corresponding VP tables must be joined. We call the co-occurrence of a variable in two triple patterns a \textit{correlation}. Fig.~\ref{fig:join_positions} illustrates the possible correlations, e.g.~if the join variable is on subject position in both triple patterns we call this a \textit{subject-subject correlation} (SS) as both VP tables must be joined on their subjects. The other correlations are \textit{subject-object} (SO), \textit{object-subject} (OS) and \textit{object-object} (OO). We do not consider join variables on predicate position as such patterns are primarily used for inference or schema exploration but rarely used in a typical SPARQL query~\cite{abadi_vp_2007}. S2RDF can answer such queries by accessing the base triples table for triple patterns with unbound predicate but is not further optimized for it.
\begin{figure}[htb]
\centering
\includegraphics[width=1.0\columnwidth]{figures/Join_Positions.pdf}
\caption{Correlations between triple patterns}
\label{fig:join_positions}
\end{figure}
The goal of ExtVP is to avoid dangling tuples in join input tables, i.e.~tuples that do not find a join partner. They cause unnecessary I/O and comparisons during join execution as well as an increase in memory consumption. Since Spark is an in-memory system and memory is typically much more limited than HDFS disk space, saving this resource is important for scalability.
To this end, we determine the subsets of a VP table $VP_{p_1}$ that are guaranteed to find at least one match when joined with another VP table $VP_{p_2}$, $p_1, p_2 \in \mathcal{P}$. This can be done with a series of semi-joins.
We do this for SS, OS and SO correlations between all pairs of VP tables (i.e.~all pairs of predicates). We do not precompute OO correlations between VP tables as this would not help much in practice. Two triple patterns in a SPARQL query that are connected by an OO correlation often use the same predicates (cf.~OO in Fig.~\ref{fig:join_positions}) and thus result in a self-join of the corresponding VP table. In this case, a semi-join would reduce nothing but simply return the table itself. So we decided to not precompute OO correlations at all due to their relatively poor cost-benefit ratio. Indeed, it is only a design choice and we could precompute them just as well. The advantage of ExtVP is that none of these precomputations are mandatory. S2RDF makes use of it, if they exist, or uses the normal VP tables instead.
Furthermore, an optional selectivity threshold for ExtVP can be specified such that only those tables are materialized where reduction of the original VP tables is large enough. This reduces the size overhead of ExtVP and we discuss it in more detail in Sec.~\ref{subsec:ExtVPSize}.
For two VP tables $VP_{p_1}$ and $VP_{p_2}$ we compute the following semi-join reductions and materialize the results as separate tables in HDFS (if not empty and selectivity is within the threshold):
\begin{tabbing}
\textbf{SS:}~~~ \= $VP_{p_1} \ltimes_{s=s} VP_{p_2}$~,~ \= $VP_{p_2} \ltimes_{s=s} VP_{p_1}$\\
\textbf{OS:} \> $VP_{p_1} \ltimes_{o=s} VP_{p_2}$~,~ \> $VP_{p_2} \ltimes_{o=s} VP_{p_1}$\\
\textbf{SO:} \> $VP_{p_1} \ltimes_{s=o} VP_{p_2}$~,~ \> $VP_{p_2} \ltimes_{s=o} VP_{p_1}$
\end{tabbing}
Essentially, the idea of ExtVP comes from the fact that a join between two tables $T_1, T_2$ on attributes $A, B$ can be decomposed in the following way:\\
\centerline{$T_1 \Join_{A=B} T_2 = (T_1 \ltimes_{A=B} T_2) \Join_{A=B} (T_1 \rtimes_{A=B} T_2)$}\\
This is a common join optimization technique in distributed database systems to reduce communication costs~\cite{ozsu_principles_2011}. We do not precompute the actual join results itself as this usually would increase space consumption by an order of magnitude or more. Semi-join reductions on the other side are always guaranteed to be a subset of the corresponding base table.
Formally, an ExtVP schema over an RDF graph $G$ can be defined as:
\begin{tabbing}
$ExtVP_{p_1|p_2}^{SS}[G]$ \= $= \{ (s,o) \mid (s,o) \in VP_{p_1}[G] \wedge$\\
\> $\qquad \qquad \exists (s',o') \in VP_{p_2}[G]: s = s' \}$\\[0.5ex]
\> $\equiv VP_{p_1}[G] \ltimes_{s=s} VP_{p_2}[G]$\\[2ex]
$ExtVP^{SS}[G]$ \> $= \{ ExtVP_{p_1|p_2}^{SS}[G] \mid p_1, p_2 \in \mathcal{P} \wedge p_1 \neq p_2 \}$\\
\\[1.5ex]
$ExtVP_{p_1|p_2}^{OS}[G]$ \= $= \{ (s,o) \mid (s,o) \in VP_{p_1}[G] \wedge$\\
\> $\qquad \qquad \exists (s',o') \in VP_{p_2}[G]: o = s' \}$\\[0.5ex]
\> $\equiv VP_{p_1}[G] \ltimes_{o=s} VP_{p_2}[G]$\\[2ex]
$ExtVP^{OS}[G]$ \> $= \{ ExtVP_{p_1|p_2}^{OS}[G] \mid p_1, p_2 \in \mathcal{P} \}$\\
\\[1.5ex]
$ExtVP_{p_1|p_2}^{SO}[G]$ \= $= \{ (s,o) \mid (s,o) \in VP_{p_1}[G] \wedge$\\
\> $\qquad \qquad \exists (s',o') \in VP_{p_2}[G]: s = o' \}$\\[0.5ex]
\> $\equiv VP_{p_1}[G] \ltimes_{s=o} VP_{p_2}[G]$\\[2ex]
$ExtVP^{SO}[G]$ \> $= \{ ExtVP_{p_1|p_2}^{SO}[G] \mid p_1, p_2 \in \mathcal{P} \}$\\
\\[1.5ex]
$ExtVP[G] = \{ ExtVP^{SS}[G], ExtVP^{OS}[G], ExtVP^{SO}[G] \}$
\end{tabbing}
\begin{figure*}[htb]
\centering
\includegraphics[width=1.0\textwidth]{figures/ExtVP_all.pdf}
\caption{ExtVP data model for RDF graph $G_1$. Left side shows ExtVP tables derived from $VP_{follows}$, right side for $VP_{likes}$, resp. Tables marked in green are stored. Red tables are equal to VP and thus not stored.}
\label{fig:extvp_all}
\end{figure*}
The benefit of ExtVP depends on the magnitude of reduction compared to the base VP tables.
Fig.~\ref{fig:extvp_all} illustrates the entire ExtVP schema for RDF graph $G_1$ consisting of two predicates. The green-marked tables are actually stored in HDFS and used for query processing. These are the VP tables itself and those correlation tables of ExtVP that give a reduction of the corresponding VP table. Empty tables and those that do not give a reduction (red-marked) are not stored. In a typical heterogeneous RDF dataset consisting of several classes, many ExtVP tables would be empty because their predicates cannot be combined (e.g.~users have different predicates than products). To avoid these unnecessary semi-join operations when constructing an ExtVP schema, we determine those predicates that have any correlation to one another. For example, the following query determines those predicates that have an OS correlation to predicate~$p_1$:
\\
\verb|SELECT DISTINCT TT.p FROM TriplesTable TT|\\
\verb|LEFT SEMI JOIN VPp1 ON TT.o = VPp1.s|
\paragraph{ExtVP and Classical Database Query Optimization}
The notion of semi-joins was originally proposed to reduce communication cost for join processing in early distributed databases~\cite{bernstein_semijoin_1981}. The idea is to apply semi-joins on the fly during query processing such that a relation is reduced before shipped to another site for join processing. The goal is to derive a semi-join program, i.e.~a sequence of semi-joins, such that no dangling tuples in any relation are shipped when processing a sequence of join operations. Such a program is called a \textit{full reducer} but its derivation is NP-hard, in general.
However, query processing in Spark works different in the sense that a relation is not stored on one site and shipped to another site but joins are executed in parallel on all cluster nodes on portions of the data, similar to an MPP (Massively Parallel Processing) database. This makes the application of semi-joins on the fly during query processing less effective.
Furthermore, VP tables are very narrow with only two columns which further limits the benefits of semi-joins during query processing. Our experiments have shown that on the fly application of semi-joins on VP tables during query processing gives no real performance benefit compared to standard join execution in Spark on average.
But as all VP tables have only two columns, we can afford to precompute semi-join reductions of these tables for all possible correlations (omitting OO correlations for aforementioned reasons). This way, we do not have to compute them on the fly but only once in advance.
Conceptually, the idea of ExtVP is related to the notion of \textit{Join Indices}~\cite{valduriez_JoinIndices_1987} in relational databases and \textit{Access Support Relations}~\cite{kemper_ASR_1992} in object-oriented databases. An $ExtVP_{p_1|p_2}$ table basically resembles a \textit{clustered join index} between VP tables $VP_{p_1}$ and $VP_{p_2}$ as we store the actual table payload in the index instead of unique surrogates. We can afford this because VP tables, in contrast to an arbitrary relational schema, have a fixed two-column layout.
Access support relations (ASR) have been introduced to facilitate path expression evaluation. In principle, $ExtVP^{OS}$ resembles a binary decomposition of all possible ASR (i.e.~paths) in an RDF graph following the edges in forward direction. In addition, $ExtVP^{SO}$ can be seen as a binary decomposition following the edges in backward direction.
\subsection{ExtVP Selectivity Threshold}
\label{subsec:ExtVPSize}
ExtVP comes at the cost of additional storage overhead compared to VP.
But as the effectiveness of ExtVP increases with smaller tables sizes (i.e.~higher selectivity), we can reduce this overhead to a large extent while retaining most of its benefits.
Let $SF$ be the \textit{selectivity factor} of a table in ExtVP, i.e.~its relative size compared to the corresponding VP table: $SF(ExtVP_{p_1|p_2}) = |ExtVP_{p_1|p_2}|/|VP_{p_1}|$. For example, $ExtVP_{follows|likes}^{OS}$ in Fig.~\ref{fig:extvp_all} has a $SF$ value of $0.25$ as its size is only a quarter of $VP_{follows}$.
Let $k = |\mathcal{P}|$ be the number of predicates in an RDF graph $G$ and $n = |G|$ be the number of triples in $G$. It holds that the sum of all tuples in VP, $|VP[G]|$, is also equal to $n$.
W.l.o.g.~assume all VP tables have equal size $n/k$ and $SF = 0.5$ for all ExtVP tables.
The size of an ExtVP schema for $G$ (i.e.~sum of all tuples) can be estimated:
\begin{tabbing}
$|ExtVP[G]|$ \= $= \underbrace{k}_{\text{\#predicates}} *~ (\underbrace{(3k-1)}_{\substack{\text{\#tables} \\ \text{per predicate}}} * \underbrace{\frac{n}{2k}}_{\text{table size}})$\\
\> $= (3k-1) * \frac{n}{2} < \frac{3}{2}kn$
\end{tabbing}
However, this is by far an overestimation of the real size as it assumes that all predicates can be combined with one another. In our experiments, typically more than $90 \%$ of all ExtVP tables were either empty or equal to VP and hence not stored. In general, the more predicates exist in an RDF dataset the more ExtVP tables will be empty as many of these predicates have distinct domains (e.g.~predicates describing products vs.~users).
Exemplary, for a dataset with $n \approx 10^9$ triples and $86$ predicates the actual size of ExtVP was $\sim 11n$ (cf.~Sec.~\ref{sec:Evaluation}). HDFS storage space is normally not a limiting factor in an Hadoop environment and as we use the \textit{Parquet} columnar storage format in combination with \textit{snappy} compression to materialize the tables in HDFS, the physical size of ExtVP (including VP tables) was $\sim 1.3$ times the original input RDF dataset size in N-triples format.
Nonetheless, $11n$ tuples in ExtVP compared to $n$ tuples in VP states a significant overhead. On the one hand, tables with $SF \sim 1$ impose a large overhead while contributing only a negligible performance benefit. On the other hand, tables with $SF < 0.25$ give the best performance benefit while causing only little overhead. To this end, S2RDF supports the definition of a \textit{threshold} for $SF$ such that all ExtVP tables above this threshold are not considered. As demonstrated in Sec.~\ref{subsec:SFUpperBound}, a threshold of $0.25$ reduces the size of ExtVP from $\sim 11n$ to $\sim 2n$ tuples and at the same time already provides $95 \%$ of the performance benefit on average compared to using no threshold.
\subsection{RDF \& SPARQL}
\label{subsec:RDF_SPARQL}
RDF~\cite{rdfprimer} is the W3C recommended standard model for representing information about arbitrary resources. Global identifiers (\textit{IRIs}) are used to identify a resource, e.g.~the IRI for Leonardo da Vinci in DBpedia is \url{http://dbpedia.org/resource/Leonardo_da_Vinci}. For the sake of brevity, we use a simplified notation of RDF without IRIs in the following.
The basic notion of data modeling in RDF is a so-called \textit{triple} $t = (s,p,o)$ where $s$ is called \textit{subject}, $p$ \textit{predicate} and $o$ \textit{object}, respectively. It models the statement ``$s$ has property $p$ with value $o$" and can be interpreted as an edge from $s$ to $o$ labeled with $p$, $s \xrightarrow{p} o$. Hence, a set of triples forms a directed labeled (not necessarily connected) graph $G = \{ t_1, \ldots ,t_n \}$. For example, Fig.~\ref{fig:rdfgraph} visualizes the RDF graph
$G_1 = \{ (A, follows, B), (B, follows, C), (B, follows, D),$\\
$(C, follows, D), (A, likes, I_1), (A, likes, I_2), (C, likes, I_2) \}$.
\begin{figure}[htb]
\centering
\includegraphics[width=0.9\columnwidth]{figures/RDF_Graph.pdf}
\caption{Visualization of RDF graph $G_1$}
\label{fig:rdfgraph}
\end{figure}
SPARQL~\cite{sparql_10} is the W3C recommended query language for RDF. A SPARQL query $Q$ defines a graph pattern $P$ that is matched against an RDF graph $G$. This is done by replacing the variables in $P$ with elements of $G$ such that the resulting graph is contained in $G$ (pattern matching).
The basic notion in SPARQL is a so-called \textit{triple pattern} $tp = (s', p', o')$ with $s' \in \{ s,?s \}$, $p' \in \{ p,?p \}$ and $o' \in \{ o,?o \}$, i.e.~a triple where every part is either an RDF term (called \textit{bound}) or a variable (indicated by $?$ and called \textit{unbound}).
A set of triple patterns forms a \textit{basic graph pattern} (BGP).
For example, the following query $Q_1$ (in SPARQL syntax) contains a single BGP:
\begin{verbatim}
SELECT * WHERE {
?x likes ?w . ?x follows ?y .
?y follows ?z . ?z likes ?w
}
\end{verbatim}
\noindent
It can be interpreted as \textit{``For all users, determine the friends of their friends who like the same things"}. The query graph of $Q_1$ is illustrated in Fig.~\ref{fig:querygraph}.
Matched against RDF graph $G_1$ it gives a single result $(?x \rightarrow A, ?y \rightarrow B, ?z \rightarrow C, ?w \rightarrow I_2)$.
We use RDF graph $G_1$ and SPARQL query $Q_1$ as a running example throughout this paper.
\begin{figure}[htb]
\centering
\includegraphics[width=0.65\columnwidth]{figures/Query_Graph.pdf}
\caption{Query graph of $Q_1$}
\label{fig:querygraph}
\end{figure}
The result of a BGP is a bag of so-called \textit{solution mappings} similar to relational tuples, i.e.~it does not produce triples and hence is not closed.
More formally, we can define the result of a BGP analogous to~\cite{perez_semantics_2009}:
Let $V$ be the infinite set of query variables and $T$ be the set of valid RDF terms.
A \textit{(solution) mapping} $\mu$ is a partial function $\mu:V \rightarrow T$. We call $\mu(?v)$ the variable binding of $\mu$ for $?v$ and $vars(tp)$ the set of variables contained in triple pattern $tp$. Abusing notation, for a triple pattern $tp$ we call $\mu(tp)$ the triple that is obtained by substituting the variables in $tp$ according to $\mu$. The \textit{domain} of $\mu$, $dom(\mu)$, is the subset of $V$ where $\mu$ is defined.
Two mappings $\mu_1, \mu_2$ are called \textit{compatible}, $\mu_1 \sim \mu_2$, iff for every variable $?v \in dom(\mu_1) \cap dom(\mu_2)$ it holds that $\mu_1(?v) = \mu_2(?v)$. It follows that mappings with disjoint domains are always compatible and the set-union (merge) of two compatible mappings, $\mu_1 \cup \mu_2$, is also a mapping.
The answer to a triple pattern $tp$ for an RDF graph $G$ is a bag of mappings $\Omega_{tp} = \lbrace \mu \mid dom(\mu) = vars(tp), \mu(tp) \in G \rbrace$.
The merge of two bags of mappings, $\Omega_1 \Join \Omega_2$, is defined as the merge of all compatible mappings in $\Omega_1$ and $\Omega_2$, i.e. $\Omega_1 \Join \Omega_2 = \lbrace (\mu_1 \cup \mu_2) \mid \mu_1 \in \Omega_1, \mu_2 \in \Omega_2, \mu_1 \sim \mu_2 \rbrace$. It can also be interpreted as a join on the variables that occur in both mappings.
Finally, the result to a basic graph pattern $bgp = \{ tp_1, \ldots, tp_m \}$ is defined as the merge of all mappings from all triple patterns, $\Omega_{bgp} = \Omega_{tp_1} \Join \ldots \Join \Omega_{tp_m}$.
On top of these basic patterns, SPARQL also provides more relational-style operators like \textsc{Optional} and \textsc{Filter} to further process and combine the resulting mappings.
This means that all other SPARQL operators use a bag of mappings as input, i.e.~they are not evaluated on the underlying RDF graph directly but on the result of one or more BGPs or other operators. Consequently, the most important aspect to query RDF data efficiently, is an efficient evaluation of BGPs.
For a detailed definition of the SPARQL syntax, we refer the interested reader to the official W3C Recommendation~\cite{sparql_10}. A formal definition of the SPARQL semantics can also be found in~\cite{perez_semantics_2009}.
\begin{figure}[htb]
\centering
\includegraphics[width=1.0\columnwidth]{figures/Query_Shapes.pdf}
\caption{SPARQL BGP query shapes}
\label{fig:queryshapes}
\end{figure}
\paragraph{Query Shapes}
SPARQL BGPs can have different shapes depending on the position of variables in the triple patterns which can have severe impacts on query performance~\cite{watdiv_2014}. Fig.~\ref{fig:queryshapes} illustrates the most common BGP patterns.
The \textit{diameter} of a SPARQL BGP is defined as the longest path, i.e.~longest connected sequence of triple patterns, ignoring edge direction.
\textit{Star-shaped} patterns have a diameter of one and occur frequently in SPARQL queries, thus many query processors are optimized for this kind of workload. They are characterized by \textit{subject-subject} joins between triple patterns as the join variable is on subject position.
\textit{Linear-} or \textit{path-shaped} patterns are also very common in graph querying, e.g.~famous friend-of-a-friend queries. Linear patterns are made of \textit{object-subject} (or \textit{subject-object}) joins, i.e.~the join variable is on subject position in one triple pattern and on object position in the other. Thus, the diameter corresponds to the number of triple patterns. The performance of such workloads is often worse compared to star-shaped patterns in many RDF triplestores as the selectivity is typically lower and result sets can become large for highly connected graphs.
\textit{Snowflake-shaped} patterns are combinations of several star shapes connected by typically short paths. More complex query structures are essentially compositions of these fundamental patterns.
\subsection{Spark}
\label{subsec:Spark}
\textit{Spark}~\cite{Spark_2012} is a general-purpose in-memory cluster computing system that can run on Hadoop and process data from any Hadoop data source. The central data structure is a so-called \textit{\underline{R}esilient \underline{D}istributed \underline{D}ataset} (RDD)~\cite{RDD_2012} which is a fault-tolerant collection of elements that can be operated on in parallel. Spark attempts to keep an RDD in memory and partitions it across all machines in the cluster.
Conceptually, Spark adopts a \textit{data-parallel} computation model that builds upon a record-centric view of data, similar to \textit{MapReduce} and \textit{Apache Tez}. A job is modeled as a directed acyclic graph (DAG) of tasks where each task runs on a horizontal partition of the data.
Besides performance, the power of Spark comes from its flexibility that assembles previously disparate functionalities in a single unified data processing framework. It comes with a rich stack of high-level tools for batch processing, complex analytics, interactive exploration, graph and real-time stream processing as well as a relational interface called Spark SQL~\cite{Spark_SQL_2015}.
The cornerstone of Spark SQL is a so-called \textit{DataFrame} which is essentially a distributed collection of rows with the same schema and in that sense a special kind of RDD. They are equivalent to a table in a relational database. The advantage of DataFrames compared to classic RDDs is that the built-in optimizer of Spark SQL, \textit{Catalyst}, can apply more tailored optimizations since it knows the data schema and query semantics. When cached in memory, a DataFrame is represented using a columnar storage format that allows to access only required columns and reduces memory footprint by means of compression schemes such as dictionary and run-length encoding.
Spark SQL supports operating on a variety of Hadoop data sources through the DataFrame interface.
We use the general-purpose \textit{Parquet}\footnote{\url{https://parquet.apache.org/}} columnar storage format to persist the data store of S2RDF in HDFS due to several benefits.
First, the schema of tables is preserved such that Spark SQL can automatically infer it on-the-fly when loaded again.
Second, Parquet uses \textit{snappy}\footnote{\url{http://google.github.io/snappy/}} compression in combination with dictionary and run-length encoding to reduce storage consumption and boost access performance.
Third, as Parquet is a general-purpose format and not exclusively tied to Spark, Parquet files created by Spark SQL can also be used by other Hadoop frameworks, e.g.~we can directly load and query the data with \textit{Impala}~\cite{Impala_2015} just as well without any need for data movement or preparation.
\subsection{Basic Approach}
\label{subsec:QueryingBasicApproach}
\begin{figure*}[htb]
\centering
\includegraphics[width=1.0\textwidth]{figures/ExtVP_SQL.pdf}
\caption{SPARQL to SQL for $Q_1$ based on ExtVP. Correlations between triple patterns determine the possible ExtVP tables. From these candidate tables, the ones with best (min) SF values get selected.}
\label{fig:extvp_sql}
\end{figure*}
The basic procedure is that every triple pattern in a BGP $bgp = \{ tp_1, \ldots ,tp_n \}$ is represented by an equivalent subquery $\{ sq_1, \ldots ,sq_n \}$ and the results of these subqueries are joined to compute the result of $bgp$, $\Omega_{bgp} = sq_1 \Join \ldots \Join sq_n$.
For this, the query compiler of S2RDF has to select the appropriate table for every triple pattern $tp_i$. In a VP schema, this choice is unambiguous as it is simply defined by the predicate of $tp_i$ (cf.~Fig.~\ref{fig:vp_sql}). In an ExtVP schema, however, there are potentially several candidate tables defined by the correlations of $tp_i$ to other triple patterns in $bgp$. From these candidates, the table with the best selectivity factor $SF$ should be chosen.
S2RDF collects statistics about all tables in ExtVP during the initial creation process, most notably the selectivities ($SF$ values) and actual sizes (number of tuples), such that these statistics can be used for query generation. It also stores statistics about empty tables (which do not physically exist) as this empowers the query compiler to know that a query has no results without actually running it.
The table selection procedure is depicted in Algorithm~\ref{alg:TableSelection}. If the predicate of the input triple pattern $tp_i$ is a variable, we have to use the base triples table (or union of VP tables) to answer that pattern. If not, it initially starts with the corresponding VP table and iterates over all other triple patterns in the input BGP to check whether they have any correlation (SS, SO, OS) to $tp_i$. If $tp_i$ has more than one correlation to another triple pattern, the algorithm selects the corresponding ExtVP table with smallest (best) $SF$ value.
\begin{algorithm}[htb]
\small
\DontPrintSemicolon
\SetAlgoNoEnd
\SetKwInOut{Input}{input}
\Input{ $TriplePattern~tp_i$ : $(s,p,o)$\\
~$BGP$ : $Set \langle TriplePattern : (s,p,o) \rangle$}
\SetKwInOut{Output}{output}
\Output{ $tab$ : $Table$}
\smallskip
\lIf{$isVar(tp_i.p)$}{ \Return{$TriplesTable$} }\;
\lElse{
$tab \leftarrow VP_{tp_i.p}$ \tcp*[f]{initially start with VP table}
}\;
\smallskip
\ForEach{$tp : TriplePattern \in BGP \neq tp_i$}{
\If{$tp_i.s = tp.s \wedge SF(ExtVP_{tp_i.p|tp.p}^{SS}) < SF(tab)$}{
$tab \leftarrow ExtVP_{tp_i.p|tp.p}^{SS}$ \tcp*[f]{SS correlation}
}
\If{$tp_i.s = tp.o \wedge SF(ExtVP_{tp_i.p|tp.p}^{SO}) < SF(tab)$}{
$tab \leftarrow ExtVP_{tp_i.p|tp.p}^{SO}$ \tcp*[f]{SO correlation}
}
\If{$tp_i.o = tp.s \wedge SF(ExtVP_{tp_i.p|tp.p}^{OS}) < SF(tab)$}{
$tab \leftarrow ExtVP_{tp_i.p|tp.p}^{OS}$ \tcp*[f]{OS correlation}
}
}
\Return{$tab$}
\caption{\textsc{TableSelection}}
\label{alg:TableSelection}
\end{algorithm}
For example, consider triple pattern $tp_3 = (?y, follows, ?z)$ in Fig.~\ref{fig:extvp_sql}. It has a SO correlation to $tp_2 = (?x, follows, ?y)$ on variable $?y$ and an OS correlation to $tp_4 = (?z, likes, ?w)$ on variable $?z$. Hence, in total, there are three candidate tables to answer $tp_3$: (1) $VP_{follows}$, (2) $ExtVP_{follows|follows}^{SO}$ and (3) $ExtVP_{follows|likes}^{OS}$.
From these tables, (3) gets selected as it has the best $SF$ value.
Once the appropriate table is selected, the corresponding SQL subquery to retrieve the results for triple pattern $tp_i$ can be derived from the position of variables and bound values in $tp_i$.
Bound values are used as conditions in the WHERE clause and variable names are used to rename table columns in the SELECT clause such that all subqueries can be easily joined on same column names, i.e.~using natural joins. The mapping of a triple pattern to SQL is depicted in Algorithm~\ref{alg:TP2SQL} using relational algebra notation. It checks all positions of $tp_i$ whether they contain a variable or bound value. In case of a variable, the corresponding column gets renamed by the variable name and added to a list of projections (we combine rename and projection for shorthand notation). For a bound value on subject or object position, the corresponding selection is added to a list of conditions. A bound predicate is already covered by the selected table and thus no additional selection is needed. In Fig.~\ref{fig:extvp_sql} the corresponding SQL subqueries for triple patterns $tp_1, \ldots, tp_4$ are given on the right.
\begin{algorithm}[htb]
\small
\DontPrintSemicolon
\SetAlgoNoEnd
\SetKwInOut{Input}{input}
\Input{ $TriplePattern~tp_i$ : $(s,p,o)$\\
~$tab$ : $Table$}
\SetKwInOut{Output}{output}
\Output{ $query$ : SQL (in relational algebra notation)}
\smallskip
$projections \leftarrow \emptyset$, $conditions \leftarrow \emptyset$\;
\If{$isVar(tp_i.s)$}{
$projections \leftarrow projections \cup (s \rightarrow tp_i.s)$
}
\lElse{ $conditions \leftarrow conditions \cup (s = tp_i.s)$ }\;
\If{$isVar(tp_i.p)$}{
$projections \leftarrow projections \cup (p \rightarrow tp_i.p)$
}
\If{$isVar(tp_i.o)$}{
$projections \leftarrow projections \cup (o \rightarrow tp_i.o)$
}
\lElse{ $conditions \leftarrow conditions \cup (o = tp_i.o)$ }\;
\Return{$query \leftarrow \pi[projections]\sigma[conditions](tab)$}
\caption{\textsc{TP2SQL}}
\label{alg:TP2SQL}
\end{algorithm}
Finally, the subqueries for all triple patterns are joined to compute the BGP result. The overall procedure is depicted in Algorithm~\ref{alg:BGP2SQL}. For every triple pattern in a BGP it calls the table selection algorithm, maps it to the corresponding subquery using the selected table and joins it with the subqueries of the other triple patterns. If one of the selected tables is empty, i.e.~$SF = 0$, it can directly return an empty result without having to run the query. That means, a SPARQL query which contains a correlation between two predicates that does not exist in the dataset, can be answered by using the statistics only.
\begin{algorithm}[htb]
\small
\DontPrintSemicolon
\SetAlgoNoEnd
\SetKwInOut{Input}{input}
\Input{ $BGP$ : $Set \langle TriplePattern : (s,p,o) \rangle$ }
\SetKwInOut{Output}{output}
\Output{ $query$ : SQL (in relational algebra notation)}
\smallskip
$vars \leftarrow \emptyset$, $query \leftarrow \emptyset$\;
\ForEach{$tp : TriplePattern \in BGP$}{
$tab \leftarrow \textsc{TableSelection}(tp, BGP)$\;
\lIf{$SF(tab) = 0$}{
\Return{$\emptyset$}
}\;
\lElseIf{$vars = \emptyset$}{
$query \leftarrow \textsc{TP2SQL}(tp, tab)$
}\;
\lElse{
$query \leftarrow query \Join \textsc{TP2SQL}(tp, tab)$
}\;
$vars \leftarrow vars \cup vars(tp)$\;
}
\Return{$query$}
\caption{\textsc{BGP2SQL}}
\label{alg:BGP2SQL}
\end{algorithm}
The remaining SPARQL 1.0 operators can be more or less directly mapped to the appropriate counterparts in Spark SQL. A \textsc{Filter} expression in SPARQL can be mapped to equivalent conditions in Spark SQL where we essentially have to adapt the SPARQL syntax to the syntax of SQL. These conditions can then be added to the WHERE clause of the corresponding (sub)query. \textsc{Optional} is realized by a left outer join while \textsc{Union}, \textsc{Offset}, \textsc{Limit}, \textsc{Order By} and \textsc{Distinct} are realized using their equivalent clauses in the SQL dialect of Spark.
S2RDF does currently not support the additional features introduced in SPARQL 1.1, e.g.~subqueries and aggregations. This is left for future work.
\subsection{Join Order Optimization}
\label{subsec:JoinOrderOptimization}
Regarding query semantics the order of triple patterns in a SPARQL BGP does not affect the query result, i.e.~a user can specify the triple patterns in any order. However, for query evaluation the order in which triple patterns are actually executed can have severe impacts on performance. For example, the join between two triple patterns that have no common variable results in a cross join.
Obviously, a query processor should avoid such execution plans, if possible. In S2RDF, for a BGP with $n$ triple patterns we need $n-1$ joins between ExtVP tables to compute the result. As query workload is typically I/O bound, it is crucial for efficiency reasons to reduce the amount of intermediate results in this join sequence. In fact, the BGP to SQL mapping depicted in Algorithm~\ref{alg:BGP2SQL} ignores the order of triple patterns and hence is likely to produce suboptimal query plans.
\begin{figure}[htb]
\centering
\includegraphics[width=1.0\columnwidth]{figures/Join_Order_Optimization.pdf}
\caption{Join Order Optimization for query $Q_1$}
\label{fig:join_order_opt}
\end{figure}
Let $sel(tp) = |\Omega_{tp}|/|G|$ be the \textit{selectivity} of a triple pattern $tp$ for RDF graph $G$. The general rule of thumb is to order triple patterns by selectivity, i.e.~$sel(tp_i) < sel(tp_{i+1})$. This is based on the assumption that smaller join inputs usually lead to smaller join outputs which is not always true but tend to be a good approximation in practice. Hence, the first and most obvious optimization is to make sure that patterns with more bound values are executed first and cross joins are avoided as they have the worst selectivity, i.e.~$\bigcup\limits_{j \leq i} vars(tp_j) \cap vars(tp_{i+1}) \neq \emptyset$. This can be derived from the query structure itself without knowing anything about the actual dataset.
In addition, S2RDF can make use of table statistics collected during initial ExtVP creation. As it knows the size of each VP and ExtVP table, it can order those triple patterns with the same amount of bound values by size of the corresponding table that is selected by Algorithm~\ref{alg:TableSelection}. It uses the actual table sizes (number of tuples) instead of selectivity factors as we want to join the smallest tables first and not the ones with the highest reduction compared to VP. The optimized version of Algorithm~\ref{alg:BGP2SQL} is depicted in Algorithm~\ref{alg:BGP2SQLopt}.
\begin{algorithm}[htb]
\small
\DontPrintSemicolon
\SetAlgoNoEnd
\SetKwInOut{Input}{input}
\Input{ $BGP$ : $Set \langle TriplePattern : (s,p,o) \rangle$ }
\SetKwInOut{Output}{output}
\Output{ $query$ : SQL (in relational algebra notation)}
\smallskip
$vars \leftarrow \emptyset$, $query \leftarrow \emptyset$\;
$tmpBGP \leftarrow orderByBoundValues(BGP)$\;
\While{$tmpBGP \neq \emptyset$}{
$tp_{next} \leftarrow \emptyset$, $tab_{next} \leftarrow \emptyset$\;
\ForEach{$tp : TriplePattern \in tmpBGP$}{
$tab \leftarrow \textsc{TableSelection}(tp, BGP)$\;
\If{$tab_{next} = \emptyset~\vee$\\
$~~(Size(tab) < Size(tab_{next})~\wedge~vars \cap vars(tp) \neq \emptyset)$}{
$tp_{next} \leftarrow tp$, $tab_{next} \leftarrow tab$
}
}
\lIf{$SF(tab_{next}) = 0$}{
\Return{$\emptyset$}
}\;
\ElseIf{$vars = \emptyset$}{
$query \leftarrow \textsc{TP2SQL}(tp_{next}, tab_{next})$
}
\lElse{
$query \leftarrow query \Join \textsc{TP2SQL}(tp_{next}, tab_{next})$
}\;
$vars \leftarrow vars \cup vars(tp_{next})$\;
$tmpBGP \leftarrow tmpBGP \setminus \{tp_{next}\}$\;
}
\Return{$query$}
\caption{\textsc{BGP2SQL\_opt}}
\label{alg:BGP2SQLopt}
\end{algorithm}
Consider again our running example in Fig.~\ref{fig:join_order_opt}. All triple patterns have the same amount of bound values and no cross join occurs when processing them in the order as listed. However, evaluating the patterns in given order would first join the two largest tables and produce two intermediate results. One of these results gets discarded in the very last step where it does not find a join partner.
As S2RDF knows the size of all tables, it instead joins the two smallest tables (corresponding to $tp_3$ and $tp_4$) first. Overall, this reduces the amount of intermediate results thus saving I/O, and also the total number of join comparisons thus saving CPU.
\subsection{Triples Table}
\label{subsec:TriplesTable}
It is a common approach by many RDF triplestores to manage RDF data in a relational DBMS back-end, e.g.~\cite{jena_2003}. These solutions typically use a giant so-called \textit{triples table} with three columns, containing one row for each RDF statement, i.e.~$TT(s, p, o)$.
Formally, a triples table over an RDF graph $G$ can be defined as:
\begin{tabbing}
$TT[G] = \{ (s,p,o) \in G \}$
\end{tabbing}
\begin{figure}[htb]
\centering
\includegraphics[width=1.0\columnwidth]{figures/TripleTable_SQL.pdf}
\caption{SPARQL to SQL for $Q_1$ based on TT}
\label{fig:tripletable_sql}
\end{figure}
While being flexible and simple in its representation, it is not an efficient approach for large-scale datasets as query evaluation essentially boils down to a series of self-joins on this table. Fig.~\ref{fig:tripletable_sql} illustrates the mapping from SPARQL query $Q_1$ to SQL based on a triples table representation of RDF. As we can see, the table is referenced four times and different selections are used to retrieve the triples matching the corresponding triple pattern. A naive evaluation would result in four scans over the whole triples table. Of course, an optimizer can reduce it to a single scan but still this is far away from optimal as the whole dataset has to be touched at least once, even if the query only selects a very small subset.
Therefore, it is often accompanied by several indexes over some or all (six) triple permutations~\cite{rdf3x_2010, weiss_hexastore_2008}, e.g.~based on $B^+$-trees, for query speedup.
The triples table approach is conceptually the most straight forward representation of RDF in a relational model but it has several drawbacks in a distributed environment. Most notably, rich indexes are hardly supported by most frameworks on Hadoop due to their complexity in a distributed storage and processing environment which makes them hard to maintain. As a consequence, using a triples table typically requires a query processor based on Hadoop to scan the whole dataset and causes a lot of (unnecessary) network I/O to exchange data between cluster nodes. In our practical experience otherwise, we have observed that query optimization in an Hadoop setup basically always means to minimize I/O, especially from a network perspective. Hence, a triples table is suited for one-time processing of RDF data (e.g.~ETL) but not efficient for repeated querying.
\subsection{Vertical Partitioning}
\label{subsec:VerticalPartitioning}
An often used optimization is a \textit{vertical partitioned} (VP) schema, introduced by Abadi et al.~in~\cite{abadi_vp_2007}. Instead of a single three-column table, it uses a two-column table for every RDF predicate, e.g.~$follows(s, o)$. It evolved from the observation that a triple pattern in a SPARQL query is typically predicate-bound and hence all triple candidates matching the pattern can be found in the corresponding VP table, leading to a significant reduction of query input size.
Let $\mathcal{P}$ be the set of all predicates in an RDF graph $G$. Formally, a vertical partitioning over $G$ can be defined as:
\begin{tabbing}
$VP_p[G]$ \= $= \{ (s,o) \mid (s,p,o) \in G \}$ \\[1ex]
$VP[G]$ \> $= \{ VP_p[G] \mid p \in \mathcal{P} \}$
\end{tabbing}
\begin{figure}[htb]
\centering
\includegraphics[width=1.0\columnwidth]{figures/TripleTable_VP.pdf}
\caption{Vertical Partitioning of $G_1$}
\label{fig:tripletable_vp}
\end{figure}
For RDF graph $G_1$, the vertical partitioning is composed of two tables for predicates \textit{follows} and \textit{likes} (see~Fig.~\ref{fig:tripletable_vp}). As a consequence, the SPARQL to SQL mapping can now select the corresponding VP tables for each triple pattern without the need for additional selections (cf.~Fig.~\ref{fig:vp_sql}).
\begin{figure}[htb]
\centering
\includegraphics[width=1.0\columnwidth]{figures/VP_SQL.pdf}
\caption{SPARQL to SQL for $Q_1$ based on VP}
\label{fig:vp_sql}
\end{figure}
For large RDF datasets with many predicates, this representation proves to be efficient in practice as it mimics the effect of an index on predicates and is also easy to manage in a distributed Hadoop environment. However, some partitions can account for a large portion of the entire graph and cause a lot of I/O. Especially for selective queries, there is still a lot of unnecessary shuffling of data involved that gets discarded afterwards.
\subsection{Property Tables}
\label{subsec:PropertyTables}
Other representations try to reduce the number of joins needed for BGP evaluation. A typical approach in this direction are so-called \textit{property tables}~\cite{jena_2006} where all predicates (or properties) that tend to be used in combination are stored in one table, e.g.~all predicates used to describe a person.
Formally, a property table over an RDF graph $G$ for predicates $p_1, \ldots, p_n$ can be defined as:
\begin{tabbing}
$PT_{p_1, \ldots, p_n}[G] = \{ (s,o_1,\ldots,o_n) \mid$ \= $(s,p_1,o_1) \in G \wedge \ldots \wedge$ \\[0.5ex]
\> $(s,p_n,o_n) \in G \}$
\end{tabbing}
The columns (predicates) grouped together in a property table are either determined by a clustering algorithm or by type definitions in the dataset itself. The weakness of this approach is the existence of multi-valued predicates in RDF, e.g.~a user typically follows more than one other user. Such predicates are either modeled using additional auxiliary tables or by entry duplication~\cite{sempala_2014}. A property table $PT_{follows,likes}$ for example graph $G_1$ using a row duplication strategy for multi-valued predicates is given in Table~\ref{tab:propertyTable}.
\begin{table}[htb]
\caption{Property table for RDF graph $G_1$}
\label{tab:propertyTable}
\scriptsize
\begin{tabularx}{\columnwidth}{XXX}
\toprule
\textbf{s} & \textbf{follows}:string & \textbf{likes}:string\\\midrule
A & B & I$_1$ \\
A & B & I$_2$ \\
B & C & \\
B & D & \\
C & D & I$_2$ \\\bottomrule
\end{tabularx}
\end{table}
\begin{figure}[htb]
\centering
\includegraphics[width=1.0\columnwidth]{figures/PropertyTable_SQL.pdf}
\caption{SPARQL to SQL for $Q_1$ based on PT}
\label{fig:propertytable_sql}
\end{figure}
The biggest advantage of property tables compared to a triples table or VP approach is the reduction of subject-subject self-joins for star-shaped query patterns. For example, consider the first two triple patterns of query $Q_1$. They share the same variable on subject position and hence form a star pattern (cf.~Fig.~\ref{fig:querygraph}) that can be answered without the need for a join using a property table. Consequently, the SPARQL to SQL mapping for query $Q_1$ based on a property table representation needs only two joins instead of three compared to triples table and VP (see Fig.~\ref{fig:propertytable_sql}).
While star-shaped queries are first-class citizens in a property table approach, it neglects other query patterns. Especially for linear-shaped patterns, a property table has no real benefit compared to a simple triples table or can be even worse in practice.
\subsection{Centralized Systems}
Most early adopters used a centralized relational back-end to materialize RDF data using a giant \textit{triples table} or several \textit{property tables} (cf.~Sec.~\ref{sec:RDFMapping}), e.g.~\textit{Sesame}~\cite{broekstra_sesame_2002}, \textit{Jena}~\cite{carroll_jena_2004} and \textit{3store}~\cite{harris_3store_2003}. But also more recent state of the art systems like Virtuoso~\cite{erling_virtuoso_2010} and \textit{DB2RDF} (RDF support in DB2)~\cite{bornea_DB2RDF_2013} use a DBMS back-end.
In~\cite{abadi_vp_2007} Abadi et al.~proposed a \textit{vertically partitioned} approach using a two-column table for every unique predicate in an RDF dataset and describe an implementation of it in \cite{abadi_sw-store_2009} called \textit{SW-Store}. This approach also builds the basis of our ExtVP data layout in S2RDF that is explained in Sec.~\ref{sec:ExtVP}.
There also exists a bunch of centralized RDF systems that do not use a DBMS back-end but deploy their own RDF tailored storage solutions, e.g.~\cite{atre_BitMat_2010, harth_YARS_2005, rdf3x_2010, weiss_hexastore_2008, yuan_triplebit_2013, zou_gstore_2014}.
Most notably, \textit{RDF-3X}~\cite{rdf3x_2010} creates an exhaustive set of indexes for all RDF triple permutations and aggregated indexes for subsets, resulting in a total of 15 indexes stored in compressed clustered B+ trees.
\textit{Hexastore}~\cite{weiss_hexastore_2008} maintains six indexes for all triple permutations and can be seen as a combination of vertical partitioning \cite{abadi_vp_2007} and multiple indexing similar to~\cite{harth_YARS_2005}.
\textit{BitMat}~\cite{atre_BitMat_2010} uses a main-memory based bit-matrix structure to represent an RDF dataset. Each matrix corresponds to a slice along one dimension of a 3D bit-cube in which each cell is a bit representing the presence or absence of a unique RDF triple in the dataset.
\textit{TripleBit}~\cite{yuan_triplebit_2013} tries to address the scalability issues of other systems that rely on exhaustive indexes by designing a compact Triple Matrix that minimizes the number of indexes used in query evaluation and also reduces the size of intermediate results generated during query processing. Thus, it achieves comparable or better performance than other state of the art systems while using less storage and main memory.
\subsection{Distributed Systems}
In recent years, the ever-increasing size of RDF datasets has raised the need for distributed RDF storage and processing to overcome the inherent scalability limitations of centralized systems.
From a very general perspective, we can classify existing approaches to address this need in three broad categories:
\paragraph{(1) Standalone Approaches}
The first type of systems are standalone distributed RDF stores, i.e.~they are self-contained and dedicated for distributed RDF processing, e.g.~\cite{boncz_VirtuosoCluster_2014, gurajada_TriAD_2014, harris_4store_2009, harth_yars2_2007, Clustered_TDB_2009, wylot_DiploCloud_2015}.
\textit{Virtuoso Cluster}~\cite{boncz_VirtuosoCluster_2014}, \textit{4store}~\cite{harris_4store_2009}, \textit{YARS2}~\cite{harth_yars2_2007} and \textit{Clustered TDB}~\cite{Clustered_TDB_2009} are extensions of the centralized systems Virtuoso~\cite{erling_virtuoso_2010}, 3store~\cite{harris_3store_2003}, YARS~\cite{harth_YARS_2005} and Jena~\cite{carroll_jena_2004} for distributed RDF processing, respectively.
\textit{TriAD}~\cite{gurajada_TriAD_2014} uses an asynchronous Message Passing protocol for distributed join execution in combination with join-ahead pruning via RDF graph summarization. RDF triples are distributed across a cluster of nodes using a locality-based, horizontal partitioning and stored in six in-memory triple vectors, each corresponding to one permutation of triple elements similar to Hexastore~\cite{weiss_hexastore_2008}. The METIS graph partitioner is used to partition the input RDF data graph and construct a summary graph. However, graph partitioning is an expensive task and centralized partitioner such as METIS are known to be limited in scalability \cite{lee_SHAPE_2013}. Thus, the initial centralized RDF partitioning can become a bottleneck with increasing data size.
\paragraph{(2) Federation Approaches}
The second type of systems use a federation of classical centralized RDF stores deployed on all cluster nodes and build a communication and coordination layer on top that distributes the data and (sub)queries, e.g.~\cite{galarraga_Partout_2014, hammoud_DREAM_2015, hose_WARP_2013, huang_HadoopRDF3X_2011, lee_SHAPE_2013, wu_Semstore_2014}. They mainly differ in the partitioning strategy used to spread the data across cluster nodes which also impacts the way how queries are split and executed. The general idea is that as much processing as possible is done locally at every node and a global aggregation mechanism merges the partial results, if necessary.
One of the first approaches in this direction that inspired most of the following work was introduced by Huang et al.~\cite{huang_HadoopRDF3X_2011}. It leverages the fact that RDF uses a graph data model by applying a graph partitioning algorithm such that triples which are nearby in the graph are stored on the same machine. They use METIS to do the partitioning and an instance of RDF-3X is used on all cluster nodes to store the allocated partitions and execute (sub)queries. By allowing partition borders to overlap, an $n$-hop guarantee assures that for a given vertex all vertices within a distance of at most $n$ are stored in the same partition. Thus, query patterns with a diameter of at most $n$ can be answered locally. If not, queries are decomposed and MapReduce is used to aggregate partial results from all cluster nodes. However, an $n$-hop guarantee imposes a large duplication of data in a densely connected RDF graph that growth exponentially with $n$ and hence only small $n$ are feasible (best results reported for $n = 2$). Similar to \cite{gurajada_TriAD_2014}, the initial partitioning suffers from the same scalability issues due to the use of a centralized graph partitioner and also performance degrades significantly when queries exceed the $n$-hop guarantee and hence MapReduce must be used for result aggregation.
\textit{Partout}~\cite{galarraga_Partout_2014} also uses RDF-3X on every cluster node but partitions RDF data with respect to a query workload such that queries can be processed by a minimum number of nodes in the cluster. First, data is fragmented based on an horizontal partitioning of triples defined by constant values in the triple patterns of the query workload. Second, derived fragments are allocated to nodes in the cluster such that as much queries as possible can be executed locally while maintaining a load balance. However, the typical query workload has to be known in advance and can also lead to suboptimal partitions if the workload changes over time.
\textit{SemStore}~\cite{wu_Semstore_2014} uses so-called Rooted Sub-Graphs (RSG) to partition RDF data where each RSG is placed on a single node in the cluster. In contrast to other partitioning strategies, RSGs are more coarse-grained and enable the system to localize more complex queries. A k-means partitioning algorithm implemented in MapReduce is used to place RSGs across the cluster such that data redundancy is reduced and possibility to execute queries locally is maximized. TripleBit is used on every cluster node to store and query data partitions allocated to that node.
The concept of \textit{DREAM}~\cite{hammoud_DREAM_2015} differs from the other systems in the sense that queries are partitioned instead of data. They argue that the choice of partitioning algorithm largely impacts the volume of intermediate results and is likely to produce suboptimal solutions for arbitrary query workloads. Hence, DREAM does not partition the data itself but all nodes in the cluster store a copy of the whole dataset which enables it to completely avoid intermediate data shuffling but only small auxiliary data has to be exchanged between cluster nodes. Of course, this implies a large duplication of data that increases with cluster size. SPARQL queries are partitioned and assigned to nodes based on a cost model and RDF-3X is used on every cluster node to store the entire dataset and execute the subparts of a query. The main drawback of DREAM is that the resources of a single node in the cluster can become a bottleneck as the whole dataset must be loaded into RDF-3X on every node. Thus, in terms of data scalability, DREAM provides no benefit compared to a centralized execution.
\paragraph{(3) Approaches based on Cloud Infrastructures}
The third type of systems are built on top of existing distributed platforms for Big Data processing, e.g.~\cite{husain_HadoopRDF_2011, papailiou_H2RDF+_2013, punnoose_Rya_2012, rohloff_SHARD_2011, pigsparql_2013, sempala_2014, zeng_Trinity.RDF_2013, zhang_EAGRE_2013}.
Such platforms are also offered on a rental basis by leading Cloud providers, e.g.~\textit{Amazon Elastic Compute Cloud (EC2)}.
\textit{Hadoop} with its large surrounding ecosystem has become the most prominent and de facto industry standard for Big Data processing. The key concept is to have a common data pool (\textit{HDFS}) that can be accessed by various applications without the need for data duplication or movement.
\textit{SHARD}~\cite{rohloff_SHARD_2011} stores RDF data in HDFS grouped by subject and MapReduce is used for query processing using a so-called Clause-Iteration approach. A MapReduce job is created for every triple pattern of a query (called clause) which conceptually leads to a left-deep query plan.
\textit{PigSPARQL}~\cite{pigsparql_2013} also stores RDF directly in HDFS using a vertical partitioning schema. Instead of compiling SPARQL queries directly into MapReduce jobs, as done by SHARD, it uses \textit{Pig} as an intermediate layer. A query gets translated into Pig Latin, the programming language of Pig, which is then mapped to a corresponding sequence of MapReduce jobs. By using this two-level abstraction, PigSPARQL profits from sophisticated optimizations of Pig and runs on all platforms supported by Pig, including all versions of Hadoop.
Yet, as PigSPARQL and SHARD are both based on MapReduce for query execution, they suffer from relatively high query latencies.
\textit{Rya}~\cite{punnoose_Rya_2012} stores its data in \textit{Accumulo}, a variant of Google's BigTable which is essentially a sorted and column-oriented NoSQL key-value store on top of HDFS. They use three tables SPO, POS and OSP (names correspond to order of triple elements) where triples are completely stored in the Row ID part of the key which effectively corresponds to three clustered indexes. As these tables are sorted by Row ID, each triple pattern can be answered by a range scan over one of these tables. Queries are executed using an index nested loop join locally at the server. This can be a potential limiting factor for scalability as join processing itself is not distributed, especially for non-selective queries with large intermediate result sets.
\textit{H2RDF+}~\cite{papailiou_H2RDF+_2013} is conceptually related to Rya as it stores RDF data in \textit{HBase} which is also a variant of Google's BigTable on top of HDFS. It also stores triples completely in the row key but uses six tables for all possible triple permutations thus creates six clustered indexes. Additionally, it also maintains aggregated index statistics to estimate triple pattern selectivity as well as join output size and cost. Based on these estimations, the system adaptively decides whether queries are executed centralized over a single cluster node or distributed via MapReduce. H2RDF+ comes with implementations of merge and sort-merge joins both for MapReduce and local execution. By combining both approaches, H2RDF+ can answer selective queries very efficiently while being able to scale for non-selective queries that cannot be answered efficiently with centralized execution. However, distributed query execution can be orders of magnitude slower than centralized.
\textit{Sempala}~\cite{sempala_2014} is conceptually related to S2RDF as it is also a SPARQL-over-SQL approach based on Hadoop. It is built on top of \textit{Impala}, a massive parallel processing (MPP) SQL query engine, while data is stored in HDFS using the \textit{Parquet} columnar storage format. The data layout of Sempala consists of a single \textit{unified property table} (cf.~Sec.~\ref{subsec:PropertyTables}) such that star-shaped queries can be answered without the need for a join. Hence, in contrast to ExtVP, this layout is targeted on a specific query shape. Complex queries are decomposed into disjoint triple groups (star-shaped subpatterns) that are joined to build the final result. | {'timestamp': '2016-01-28T02:11:00', 'yymm': '1512', 'arxiv_id': '1512.07021', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.07021'} | arxiv |
\section*{HIGHLIGHTS}
\begin{enumerate}
\item New methodology for egocentric photo streams segmentation and characterization based on semantic information.
\item Ground truth consistency evaluation applying global and local consistency error metrics.
\item Method evaluation on an extended number of datasets.
\item Publication of a new egocentric dataset for event segmentation and of the ready-to-use SR-Clustering source code.
\item Extended evaluation on state of the art methods and exhaustive validation of the different blocks of our proposal.
\end{enumerate}
\end{document}
\section{Introduction}
\vspace*{-0.25cm}
\begin{figure}[ht!]
\centering
\includegraphics[width=35em,height=10em]{GENERAL.png}
\caption{Example of temporal segmentation of an egocentric sequence based on what the camera wearer sees. In addition to the segmentation, our method provides a set of semantic attributes that characterize each segment.}
\label{fig:segmentation}
\end{figure}
Among the advances in wearable technology during the last few years, wearable cameras specifically have gained more popularity \cite{bolanos2015towards}. These small light-weight devices allow to capture high quality images in a hands free fashion from the first-person point of view. Wearable video cameras such as GoPro and Looxcie, by having a relatively high frame rate ranging from 25 to 60 fps, are mostly used for recording the user activities for a few hours. Instead, wearable photo cameras, such as the Narrative Clip and SenseCam, capture only 2 or 3 fpm and are therefore mostly used for image acquisition during longer periods of time (e.g. a whole day).
The images collected by continuously recording the user's life, can be used for understanding the user's lifestyle and hence they are potentially beneficial for prevention of non-communicative diseases associated with unhealthy trends and risky profiles (such as obesity, depression, etc.). In addition, these images can be used as an important tool for prevention or hindrance of cognitive and functional decline in elderly people \cite{AJM-Wearablecameras}. However, egocentric photo streams generally appear in the form of long unstructured sequences of images, often with high degree of redundancy and abrupt appearance changes even in temporally adjacent frames, that harden the extraction of semantically meaningful content.
Temporal segmentation, the process of organizing unstructured data into homogeneous chapters, provides a large potential for extracting semantic information. Indeed, once the photo stream has been divided into a set of homogeneous and manageable segments, each segment can be represented by a small number of key-frames and indexed by semantic features, providing a basis for understanding the semantic structure of the event.
\textcolor{red}{State-of-the-art methods for temporal segmentation can be broadly classified into works with focus on what-the-camera-wearer-sees \cite{CastroHickson2015,Doherty:2008,talavera2015r-clustering} and on what-the-camera-wearer-does \cite{polegtemporal,PolegEP015}. As an example, from the what-camera-wearer-does perspective, the camera wearer spending time in a bar while sit, will be considered as a unique event (sitting). From the what-the-camera-wearer-sees perspective, the same situation will be considered as several separated events (waiting for the food, eating, and drinking beer with a friend who joins later). The distinction between the aforementioned points of view is crucial as it leads to different definitions of an event. In this respect, our proposed method fits in the what-the-camera-wearer-sees category.}
Early works on egocentric temporal segmentation \cite{Doherty:2008,kmean} focused on what the {\em camera wearer sees} (e.g. people, objects, foods, etc.). For this purpose, the authors used as image representation, low-level features to capture the basic characteristics of the environment around the user, such as color, texture or information acquired through different camera sensors.
More recently, the works in \cite{bolanos2015visual} and \cite{talavera2015r-clustering} have used Convolutional Neural Network (CNN) features extracted by using the AlexNet model \cite{NIPS2012_4824} trained on ImageNet as a fixed feature extractor for image representation.
Some other recent methods infer from the images what the {\em camera wearer does} (e.g. sitting, walking, running, etc.). Castro et al. \cite{CastroHickson2015} used CNN features together with metadata and color histogram \cite{CastroHickson2015}
Most of these methods use as image representation ego-motion \cite{egovideo,bolanos2014video,polegtemporal,PolegEP015}, which is closely \textcolor{red}{related to the user motion-based activity but cannot be reliably estimated in photo streams.}
The authors combined a CNN trained on egocentric data with a posterior Random Decision Forest in a late-fusion ensemble, obtaining promising results for a single user. However, this approach lack of generalization, since it requires to re-train the model for any new user, implying to manually annotate large amount of images. To the best of our knowledge, except the work of Castro et al. \cite{CastroHickson2015}, Doherty et al. \cite{Doherty:2008} and Tavalera et al. \cite{talavera2015r-clustering}, all other state-of-the-art methods have been designed for and tested on videos
In our previous work \cite{talavera2015r-clustering}, we proposed an unsupervised method, called \emph{R-Clustering}, \textcolor{red}{aiming to segment photo streams from the what-the-camera-wearer-see perspective}. The proposed methods relies on the combination of Agglomerative Clustering (AC), that usually has a high recall, but leads to temporal over-segmentation, with a statistically founded change detector, called ADWIN \cite{bifet2007learning}, which despite its high precision, usually leads to temporal under-segmentation. Both approaches are integrated in a {\em Graph-Cut (GC)} \cite{boykov2001fast} framework to obtain a trade-off between AC and ADWIN, which have complementary properties. The graph-cut relies on CNN-based features extracted using AlexNet, trained on ImageNet, as a fixed feature extractor in order to detect the segment boundaries.
In this paper, we extend our previous work by adding a semantic level to the image representation.
Due to the free motion of the camera and its low frame rate, abrupt changes are visible even among temporally adjacent images (see Fig. \ref{fig:segmentation} and Fig. \ref{fig:imagenVariabilidad.jpg}). Under these conditions motion and low-level features such as color or image layout are prone to fail for event representation, hence urges the need to incorporate higher-level semantic information.
Instead of representing images simply by their contextual CNN features, which capture the basic environment appearance, we detect segments as a set of temporally adjacent images with the same contextual representation in terms of semantic visual concepts. Nonetheless, not all the semantic concepts in an image are equally discriminant for environment classification: objects like trees and buildings can be more discriminant than objects like dogs or mobile phones, since the former characterizes a specific environment such as forest or street, whereas the latter can be found in many different environments. In this paper, we propose a method called Semantic Regularized Clustering (SR-Clustering), which takes into account semantic concepts in the image together with the global image context for event representation.
To the best of your knowledge, this is the first time that semantic concepts are used for image representation in egocentric videos and images.
With respect to our previous work published in \cite{talavera2015r-clustering}, we introduce the following contributions:
\begin{itemize}
\item Methodology for egocentric photo streams description based on semantic information.
\item Set of evaluation metrics applied to ground truth consistency estimation.
\item Evaluation on an extended number of datasets, including our own, which will be published with this work.
\item Exhaustive evaluation on a broader number of methods to compare with.
\end{itemize}
This manuscript is organized as follows: Section \ref{sec:approach} provides a description of the proposed photo stream segmentation approach discussing the semantic and contextual features, the clustering and the graph-cut model. Section \ref{sec:results} presents experimental results and, finally, Section \ref{sec:conclusions} summarizes the important outcomes of the proposed method providing some concluding remarks.
\section{SR-Clustering for Temporal Photo Stream Segmentation}
\label{sec:approach}
A visual overview of the proposed method is given in Fig. \ref{fig:r_clustering_scheme}. The input is a day long photo stream from which contextual and semantic features are extracted. An initial clustering is performed by AC and ADWIN. Later, GC is applied to look for a trade-off between the AC (represented by the bottom colored circles) and ADWIN (represented by the top colored circles) approaches. The binary term of the GC imposes smoothness and similarity of consecutive frames in terms of the CNN image features. The output of the proposed method is the segmented photo stream. \textcolor{red}{In this section}, we introduce the semantic and contextual features of SR-clustering and provide a detailed description of the segmentation approach.
\begin{figure}[ht!]
\centering
\includegraphics[width=\textwidth]{R-Clustering_General_v1.pdf}
\caption{General scheme of the Semantic Regularized Clustering (SR-Clustering) method.}
\label{fig:r_clustering_scheme}
\end{figure}
\subsection{Features}
We assume that two consecutive images belong to the same segment if they can be described by similar image features. When we refer to the features of an image, we usually consider low-level image features (e.g. color, texture, etc.) or a global representation of the environment (e.g. CNN features). However, the objects or concepts that semantically represent an event are also of high importance for the photo stream segmentation. Below, we detail the features that semantically describe the egocentric images.
\subsubsection{Semantic Features}
Given an image $I$, let us consider a tagging algorithm that returns a set of objects/tags/concepts detected in the images with their associated confidence value. \textcolor{red}{The confidence values of each concept} form a semantic feature vector to be used for the photo streams segmentation. Usually, the number of concepts detected for each sequence of images is large (often, some dozens). Additionally, redundancies in the detected concepts are quite often due to the presence of synonyms or semantically related words. To manage the semantic redundancy, we will rely on WordNet \cite{miller1995wordnet}, which is a lexical database that groups English words into sets of synonyms, providing additionally short definitions and word relations.
Given a day's lifelog, let us cluster the concepts by relying on their synset ID in WordNet to compute their similarity in meaning, and following, apply clustering (e.g. Spectral clustering) to obtain 100 clusters. As a result, we can semantically describe each image in terms of 100 concepts and their associated confidence scores.
Formally, we first construct a semantic similarity graph $\mathcal{G} = \{V, E, W\}$, where each vertex or node $v_i \in V$ is a concept, each edge $e_{ij} \in E$ represents a semantic relationship between two concepts, $v_i$ and $v_j$ and each weight $w_{ij} \in W$ represents the strength of the semantic relationship, $e_{ij}$. We compute each $w_{ij}$ by relying on the meanings and the associated similarity given by WordNet, between each appearing pair. To do so, we use the max-similarity between all the possible meanings $m_i^k$ and $m_j^r$ in $M_i$ and $M_j$ of the given pair of concepts $v_i$ and $v_j$:
\begin{equation*}
w_{ij} = \max_{m_i^k \in M_i, m_j^r \in M_j} sim(m_i^k, m_j^r).
\end{equation*}
To compute the Semantic Clustering, we use their similarity relationships in the spectral clustering algorithm to obtain 100 semantic concepts, $|C| = 100$.
In Fig. \ref{fig:tags_graph}, a simplified example of the result obtained after the clustering procedure is shown. For instance, in the purple cluster, similar concepts like 'writing', 'document', 'drawing', 'write', etc. are grouped in the same cluster, and 'writing' is chosen as the most representative term. For each cluster, we choose as its representative concept, the one with the highest sum of similarities with the rest of elements in the cluster.
\begin{figure}
\centering
\includegraphics[width=\textwidth]{tags_graph2.jpg}
\caption{Simplified graph obtained after calculating similarities of the concepts of a day's lifelog and clustering them. Each color corresponds to a different cluster, the edge width represents the magnitude of the similarity between concepts, and the nodes size represents the number of connections they have (the biggest node in each cluster is the representative one). We only showed a small subset of the 100 clusters. This graph was drawn using graph-tool (\url{http://graph-tool.skewed.de}).}
\label{fig:tags_graph}
\end{figure}
The semantic feature vector $f^s \in \mathbb{R}^{|C|}$ for image $I$ is a 100-dimensional array, such that each component $f^s(I)_j$ of the vector represents the confidence with which the j-th concept is detected in the image. The confidence value for the concept $j$, representing the cluster $C_j$, is obtained as the sum of the confidences $r_I$ of all the concepts included in $C_j$ that have also been detected on image $I$:
\begin{equation*}
f^s(I)_j = \sum_{c_k \in \{C_j\}} r_I(c_k)
\end{equation*}
where $C_{I}$ is the set of concepts detected on image $I$, $C_j$ is the set of concepts in cluster $j$, and $r_I(c_k)$ is the confidence associated to concept $c_k$ on image $I$. The final confidence values are normalized so that they are in the interval $[0,1]$.
\begin{figure}[ht!]
\centering
\includegraphics[width=\textwidth]{Estefania3_Top_30_classes_Smoothed_Filtered.jpg}
\caption{Example of the final semantic feature matrix obtained for an egocentric sequence. The top 30 concepts (rows) are shown for all the images in the sequence (columns). Additionally, the top row of the matrix shows the ground truth (GT) segmentation of the dataset.}
\label{fig:Estefania2_IMAGGA_Top30.jpg}
\end{figure}
Taking into account that the camera wearer can be continuously moving, even if in a single environment, the objects that can be appearing in temporally adjacent images may be different. To this end, we apply a Parzen Window Density Estimation method \cite{parzen1962estimation} to the matrix obtained by concatenating the semantic feature vectors along the sequence to obtain a smoothed and temporally coherent set of confidence values.
Additionally,
we discard the concepts with a low variability of confidence values along the sequence which correspond to non-discriminative concepts that can appear on any environment. The low variability of confidence value of a concept may correspond to constantly having high or low confidence value in most environments.
In Fig. \ref{fig:Estefania2_IMAGGA_Top30.jpg}, the matrix of concepts (semantic features) associated to an egocentric sequence is shown, displaying only the top 30 classes. Each column of the matrix corresponds to a frame and each row indicates the confidence with which the concept is detected in each frame. In the first row, the ground truth of the temporal segmentation is shown for comparison purposes. With this representation, repeated patterns along a set of continuous images correspond to the set of concepts that characterizes an event. For instance, the first frames of the sequence represent an indoor scene, characterized by the presence of people (see examples Fig. \ref{fig:tagspersceen}). The whole process is summarized in Fig. \ref{fig:semantic_features}.
\begin{figure}[ht!]
\centering
\includegraphics[width=1\textwidth]{tagspersceen.png}
\caption{Example of extracted tags on different segments. The first one corresponds to the period from 13.22 - 13.38 where the user is having lunch with colleagues, and the second, from 14.48 - 18.18, where he/she is working in the office with the laptop.}
\label{fig:tagspersceen}
\end{figure}
\begin{figure}[ht!]
\centering
\includegraphics[width=\textwidth]{R-Clustering_Semantic_Features_v5.pdf}
\caption{General scheme of the semantic feature extraction methodology.}
\label{fig:semantic_features}
\end{figure}
In order to consider the semantics of temporal segments, we used a concept detector based on the auto-tagging service developed by Imagga Technologies Ltd. Imagga's auto-tagging technology \footnote{\url{http://www.imagga.com/solutions/auto-tagging.html}} uses a combination of image recognition based on deep learning and CNNs using very large collections of human annotated photos. The advantage of Imagga's Auto Tagging API is that it can directly recognize over 2,700 different objects and in addition return more than 20,000 abstract concepts related to the analyzed images.
\subsubsection{Contextual Features}
In addition to the semantic features, we represent images with a feature vector extracted from a pre-trained CNN. The CNN model that we use for computing the images representation is the AlexNet, which is detailed in \cite{NIPS2012_4824}. The features are computed by removing the last layer corresponding to the classifier from the network. We used the deep learning framework Caffe \cite{Jia13caffe} in order to run the CNN. Due to the fact that the weights have been trained on the ImageNet database \cite{deng2009imagenet}, which is made of images containing single objects, we expect that the features extracted from images containing multiple objects will be representative of the environment. It is worth to remark that we did not use the weights obtained using a pre-trained CNN on the scenes from Places 205 database \cite{zhou2014learning}, since the Narrative camera's field of view is narrow, which means that mostly its field-of-view is very restricted to characterize the whole scene. Instead, we usually only see objects on the foreground. As detailed in \cite{talavera2015r-clustering}, to reduce the large variation distribution of the CNN features, which results problematic when computing distances between vectors, we used a signed root normalization to produce more uniformly distributed data \cite{ZhengWHT14}.
\subsection{Temporal Segmentation}
The SR-clustering for temporal segmentation is based on fusing the semantic and contextual features with the R-Clustering method described in \cite{talavera2015r-clustering}.
\subsubsection{Agglomerative Clustering}
After the concatenation of semantic and contextual features, the hierarchical Agglomerative Clustering (AC) method is applied following a bottom-up clustering procedure. In each iteration, the method merges the most similar pair of clusters based on the distances among the image features, updating the elements similarity matrix. This is done until exhausting all possible consistent combinations. The {\em cutoff} global parameter defines the consistency of the merged clusters. We use the Cosine Similarity between samples, which is suited for high-dimensional positive spaces \cite{Tan:2005:IDM:1095618}. The shortcoming of this method is that it tends to over-segment the photo streams.
\subsubsection{ADWIN}
To compensate the over-segmentation produced by AC, we proposed to model the egocentric sequence as a multi-dimensional data stream and to detect changes in the mean distribution through an adaptive learning method called ADWIN \cite{bifet2007learning}, which provides a rigorous statistical guarantee of performance in terms of false positive rate. The method, based on the Hoeffding's inequality \cite{Hoeffding1963}, tests recursively if the difference between the averages of two temporally adjacent (sub)windows of the data, say $W_1$ and $W_2$, is larger than a threshold. The value of the threshold takes into account if both sub-windows are {\em large enough} and {\em distinct enough} for a $k-$dimensional signal \cite{Drozdzal2014}, computed as:
\begin{equation*}
\epsilon_{cut} = k^{1/p}\sqrt{\frac{1}{2m}\ln\frac{4}{k\delta'}}
\end{equation*}
where $p$ indicates the $p-$norm, $\delta \in (0, 1)$ is a user defined confidence parameter, and $m$ is the harmonic mean between the lengths of $W_1$ and $W_2$. In other words, given a predetermined confidence, ADWIN statistically guarantees that it will find any major change in the data means.
Given a confidence value $\delta$, the higher the dimension $k$ is, the more samples $n$ the bound needs to reach assuming the same value of $\epsilon_{cut}$. The higher the norm used is, the less important the dimensionality $k$ is. Since we model the sequence as a high dimensional data stream, ADWIN is unable to predict changes involving a relatively small number of samples, which often characterizes \textcolor{red}{Low Temporal Resolution (LTR)} egocentric data, leading to under-segmentation. Moreover, since it considers only the mean change, it is able to detect changes due to other statistics such as the variance.
\subsubsection{Graph-Cuts regularization}
We use Graph-Cuts (GC) as a framework to integrate both of the previously described approaches, AC and ADWIN, to find a compromise between them that naturally leads to a temporally consistent result. GC is an energy-minimization technique that works by finding the minimum of an energy function usually composed of two terms: the {\em unary term} $U$, also called data term, that describes the relationship of the variables to a possible class and the {\em binary term} $V$, also called pairwise or regularization term, that describes the relationship between two neighboring samples (temporally close images) according to their feature similarity. The binary term smooths boundaries between similar frames, while the unary term keeps the cluster membership of each sequence frame according to its likelihood. In our problem, we defined the unary term as the sum of 2 parts ($U_{ac}(f_i)$ and $U_{adw}(f_i)$). Each of them expresses the likelihood of an image $I_i$ represented by the set of features $f_i$ to belong to segments coming from the corresponding previously applied segmentation methods. The energy function to be minimized is the following:
\begin{equation*}
E(f) = \sum_{i}^{n} \Bigg[ (1-\omega_1) U_{ac}(f_i) + \omega_1 U_{adw}(f_i) \Bigg] + \omega_2 \sum_{i}^{n} \Bigg [ \frac{1}{|N_i|} \sum_{j\in N_i} V_{i,j}(f_i,f_j) \Bigg ]
\end{equation*}
where $f_i = \left [ f^c(I_i), f^s(I_i) \right ],i=\lbrace1,...,n \rbrace$ are the set of contextual $f^c$ and semantic image features $f^s$ for the $i$-th image, $N_i$ is a set of temporal neighbors centered at $i$, and $\omega_1$ and $\omega_2$ ($\omega_1, \omega_2 \in [0,1]$) are the unary and the binary weighting terms, respectively. We can improve the segmentation outcome of GC by defining how much weight do we give to the likelihood of each unary term and balancing the trade-off between the unary and the pairwise energies, respectively. The minimization is achieved through the max-cut algorithm, leading to a temporal segmentation with similar frames having as large likelihood as possible to belong to the same segment, while maintaining segment boundaries in temporally neighboring images with high feature dissimilarity.
More precisely, the unary energy is composed of two terms representing, each of them, the likelihoods of each sample to belong to each of the clusters (or decisions) obtained either applying ADWIN ($T_{adw}$) or AC ($T_{ac}$) respectively:
\begin{equation*}
U_{ac}(f_i) = P_{ac}(f_i \in T_{ac}), \; \;
U_{adw}(f_i) = P_{adw}(f_i \in T_{adw})
\end{equation*}
The pair-wise energy is defined as:
\begin{equation*}
V_{i,j}(f_i, f_n) = e^{-\text{dist}(f_i, f_j)}
\end{equation*}
An illustration of this process is shown in Fig. \ref{fig:r_clustering_scheme}.
\section{Experiments and Validation}
\label{sec:results}
In this section, we discuss the datasets and the statistical evaluation measurements used to validate the proposed model and to compare it with the state-of-the-art methods. To sum up, we apply the following methodology for validation:
\begin{enumerate}
\item Three different datasets acquired by 3 different wearable cameras are used for validation.
\item The F-Measure is used as a statistical measure to compare the performance of different methods.
\item Two consistency measures to compare different manual segmentations is applied.
\item Comparison results of SR-Clustering with 3 state-of-the-art techniques is provided.
\item Robustness of the final proposal is proven by validating the different components of SR-Clustering.
\end{enumerate}
\subsection{Data}
To evaluate the performance of our method, we used 3 public datasets (EDUB-Seg, AIHS and Huji EgoSeg's sub dataset) acquired by three different wearable cameras (see Table \ref{datasets-table}).
\begin{table}[ht!]
\centering
\begin{tabular}{l|llllll}
\textbf{Dataset} & \multicolumn{1}{l}{\textbf{Camera}} & \multicolumn{1}{l}{\textbf{FR}} & \multicolumn{1}{l}{\textbf{SR}} & \multicolumn{1}{l}{\textbf{\#Us}} & \multicolumn{1}{l}{\textbf{\#Days}} & \textbf{\#Img} \\ \hline
EDUB & Narrative & 2 fpm & 2592x1944 & 7 & 20 & 18,735 \\
AIHS-subset & SenseCam & 3 fpm & 640x480 & 1 & 5 & 11,887 \\
Huji EgoSeg & GoPro Hero3+ & 30fps* & 1280x720 & 2 & 2 & 700
\end{tabular}
\caption{Table summarizing the main characteristics of the datasets used in this work: frame rate (FR), spatial resolution (SR), number of users (\#Us), number of days (\#Days), number of images (\#Img). The Huji EgoSeg dataset has been subsampled to 2 fpm as detailed in the main text.}
\label{datasets-table}
\end{table}
\textbf{EDUB-Seg}: \textcolor{red}{is a dataset acquired by people from our lab with the Narrative Clip, which takes a picture every 30 seconds. Our Narrative dataset, named EDUB-Seg (Egocentric Dataset of the University of Barcelona - Segmentation), contains a total of 18,735 images captured by 7 different users during overall 20 days. To ensure diversity, all users were wearing the camera in different contexts: while attending a conference, on holiday, during the weekend, and during the week. The EDUB-Seg dataset is an extension of the dataset used in our previous work \cite{talavera2015r-clustering}, that we call EDUB-Seg (Set1) to distinguish it from the newly added in this paper EDUB-Seg (Set2).}
The camera wearers, as well as all the researchers involved on this work, were required to sign an informed written consent containing set of moral principles \cite{wiles2008visual, kelly2013ethical}. Moreover, all researchers of the team have signed to do not publish any image identifying a person in a photo stream without his/her explicit permission, except unknown third parties.
\textbf{AIHS \textcolor{red}{subset}}: is a subset of the daily images from the database called \emph{All I Have Seen} (AIHS) \cite{NIPS}, recorded by the SenseCam camera that takes a picture every 20 seconds.\textcolor{red}{The original AIHS dataset \footnote{http://research.microsoft.com/en-us/um/people/jojic/aihs/} has no timestamp metadata. We manually divided the dataset in five days guided by the pictures the authors show in the website of their project and based on the daylight changes observed in the photo streams. The five days sum up a total of 11,887 images.}
Comparing both cameras (Narrative and SenseCam), we can remark their difference with respect to the cameras' lens (fish eye vs normal), and the quality of the images they record. Moreover, SenseCam acquires images with a larger field of view and significant deformation and blurring. We manually defined the GT for this dataset following the same criteria we used for the EDUB-Seg photo streams.
\textbf{Huji EgoSeg}: due to the lack of other publicly available LTR datasets for event segmentation, we also test our temporal segmentation method to the ones provided in the dataset Huji EgoSeg \cite{polegtemporal}. This dataset was acquired by the GoPro camera, which captures videos with a temporal resolution of 30fps. Considering the very significant difference in frame rate of this camera compared to Narrative (2 fpm) and SenseCam (3 fpm), we applied a sub-sampling of the data by just keeping 2 images per minute, \textcolor{red}{to make} it comparable to the other datasets. In this dataset, several short videos recorded by two different users are provided. Consequently, after sub-sampling all the videos, we merged the resulting images from all the short videos to construct a dataset per each user, which consists of a total number of 700 images. The images were merged following the numbering order that was provided by the authors to their videos. We also manually defined the GT for this dataset following the same used criteria for the EDUB-Seg dataset.
In summary, we evaluate the algorithms on \textcolor{red}{27 days with a total of 31,322 images recorded by 10 different users}. All datasets contain a mixture of highly variable indoor and outdoor scenes with a large variety of objects. We make public the EDUB-Seg dataset\footnote{\url{http://www.ub.edu/cvub/dataset/}}, together with our GT segmentations of the datasets Huji EgoSeg and AIHS \textcolor{red}{subset}. Additionally, we release the SR-Clustering ready-to-use complete code\footnote{\url{https://github.com/MarcBS/SR-Clustering}}.
\subsection{Experimental setup}
Following \cite{li2013daily}, we measured the performances of our method by using the F-Measure (FM) defined as follows:
\begin{equation*}
FM= 2\frac{RP}{R+P},
\end{equation*}
where $P$ is the precision defined as $(P=\frac{TP}{TP+FP})$ and $R$ is the recall, defined as $(R=\frac{TP}{TP+FN})$. $TP$, $FP$ and $FN$ are the number of true positives, false positives and false negatives of the detected segment boundaries of the photo stream. We define the FM, where we consider TPs the images that the model detects as boundaries of an event and that were close to the boundary image defined in the GT by the annotator (given a tolerance of 5 images \textcolor{red}{in both sides}). The FPs are the images detected as events delimiters, but that were not defined in the GT, and the FNs the lost boundaries by the model that are indicated in the GT. Lower FM values represent a wrong boundary detection while higher values indicate a good segmentation. Having the ideal maximum value of 1, where the segmentation correlates completely with the one defined by the user.
The annotation of temporal segmentations of photo streams is a very subjective task. The fact that different users usually do not perform the same when annotating, may lead to bias in the evaluation performance. The problem of the subjectivity when defining the ground truth was previously addressed in the context of image segmentation \cite{Martin01adatabase}. In \cite{Martin01adatabase}, the authors proposed two measures to compare different segmentations of the same image. These measures are used to validate if the performed segmentations by different users are consistent and thus, can be served as an objective benchmark for the evaluation of the segmentation performances. In Fig. \ref{fig:imagenVariabilidad.jpg}, we report a visual example that illustrates the urge of employing this measure for temporal segmentation of egocentric photo streams. For instance, the first segment in Fig. \ref{fig:imagenVariabilidad.jpg} is split in different segments when analyzed by different subjects although there is a degree of consistency among all segments.
\begin{figure}[ht!]
\centering
\includegraphics[width=\textwidth]{imagenVariabilidad} \caption{Different segmentation results obtained by different subjects. (a) shows a part of a day. (b), (c) and (d) are examples of the segmentation performed by three different persons. (c) and (d) are refinements of the segmentation performed by (b). All three results can be considered as being correct, due to the subjective intrinsic of the task. As a consequence, a segmentation consistency metric should not penalize different, yet consistent results of the segmentation.}
\label{fig:imagenVariabilidad.jpg}
\end{figure}
Inspired by this work, we re-define the local refinement error, between two temporal segments, as follows:
\begin{equation*}
E(S_A,S_B,I_i) = \frac{|R(S_A,I_i)\backslash R(S_B,I_i)|}{|R(S_A,I_i)|},
\label{eq:01}
\end{equation*}
\noindent where $\backslash$ denotes the set difference and, $S_A$ and $S_B$ are the two segmentations to be compared. $R(S_X,I_{i})$ is the set of images corresponding to the segment that contains the image $I_{i}$, when obtaining the segmentation boundaries $S_X$.
If one temporal segment is a proper subset of the other, then the images lie in one interval of refinement, which results in the local error of zero. However, if there is no subset relationship, the two regions overlap in an inconsistent manner that results in a non-zero local error.
Based on the definition of local refinement we provided above, two error measures are defined by combining the values of the local refinement error for the entire sequence. The first error measure is called Global Consistency Error (GCE) that forces all local refinements to be in the same direction (segments of segmentation A can be only local refinements of segments of segmentation B). The second error measure is the Local Consistency Error (LCE), which allows refinements in different directions in different parts of the sequence (some segments of segmentation A can be of local refinements of segments of segmentation B and vice verse). The two measures are defined as follows:
\begin{equation*}
GCE(S_A,S_B) = \frac{1}{n} min\{ \sum_{i}^n E(S_A,S_B,I_i),\sum_{i}^n E(S_B,S_A,I_i)\}
\label{eq:02}
\end{equation*}
\begin{equation*}
LCE(S_A,S_B) = \frac{1}{n} \sum_{i}^n min\{E(S_A,S_B,I_i),E(S_B,S_A,I_i)\}
\label{eq:03}
\end{equation*}
\noindent where $n$ is the number of images of the sequence, $S_A$ and $S_B$ are the two different temporal segmentations and $I_i$ indicates the i-th image of the sequence. The GCE and the LCE measures produce output values in the range $[0,1]$ where 0 means no error.
\begin{figure}[ht!]
\centering
\includegraphics[width=35em,height=13em]{GC_error_diff_IncludingUser.png}
\includegraphics[width=35em,height=13em]{GC_error_same_IncludingUser.png}
\caption{GCE (left) and LCE (right) normalized histograms with the error values distributions, showing their mean and variance. The first row graphs represent the distribution of errors comparing segmentations of different sequences while the second row graphs show the distribution of error when comparing segmentations of the same set, including the segmentation of the camera wearer.}
\label{fig:ErrorMeasures_includingUser}
\end{figure}
\begin{figure}[ht!]
\centering
\includegraphics[width=35em,height=13em]{Correlation_IncludingUser.png}
\caption{LCE vs GCE for pairs of segmentations of different sequences (left) and for pairs of segmentations of the same sequence (right). The differences w.r.t. the dashed line x=y show how GCE is a stricter measure than LCE. The red dot represents the mean of all the cloud of values, including the segmentation of the camera wearer.}
\label{fig:ErrorMeasuresCorr_includingUser}
\end{figure}
\begin{figure}[ht!]
\centering
\includegraphics[width=35em,height=13em]{GCE_LCE_DiffSets_otherUsers.png}
\includegraphics[width=35em,height=13em]{GCE_LCE_SameSets_otherUsers.png}
\caption{GCE (left) and LCE (right) normalized histograms with the error values distributions, showing their mean and variance. The first row graphs represent the distribution of the errors comparing segmentations of different sequences while the second row graphs show the distribution of the errors when comparing segmentations of the same set, excluding the segmentation of the camera wearer.}
\label{fig:ErrorMeasures_excludingUser}
\end{figure}
\begin{figure}[ht!]
\centering
\includegraphics[width=35em,height=13em]{Correlation_otherUsers.png}
\caption{LCE vs GCE for pairs of segmentations of different sequences (left) and for pairs of segmentations of the same sequence (right). The differences w.r.t. the dashed line x=y show how GCE is a stricter measure than LCE. The red dot represents the mean of all the cloud of values, excluding the segmentation of the camera wearer.}
\label{fig:ErrorMeasuresCorr_excludingUser}
\end{figure}
To verify that there is consistency among different people for the task of temporal segmentation, we asked three different subjects to segment each of the 20 sets of the EDUB-Seg dataset into events. The subjects were instructed to consider an \textit{event} as a semantically perceptual unit that can be inferred by visual features, without any prior knowledge of what the camera wearer is actually doing. No instructions were given to the subjects about the number of segments they should annotate. This process gave rise to 60 different segmentations. The number of all possible pairs of segmentations is 1800, 60 of which are pairs of segmentations of the same set. For each pair of segmentations, we computed GCE and LCE. First, we considered only pairs of segmentations of the same sequence and then, considered the rest of possible pairs of segmentations in the dataset. The first two graphics in Fig. \ref{fig:ErrorMeasures_includingUser} (first row) show the GCE (left) and LCE (right) when comparing each set segmentations with the segmentations applied on the rest of the sets. The two graphics in the second row show the distribution of the GCE (left) and LCE (right) error when analyzing different segments describing the same video. As expected, the distributions that compare the segmentations over the same photo stream have the center of mass to the left of the graph, which means that the mean error between the segmentations belonging to the same set is lower than the mean error between segmentations describing different sets. In Fig. \ref{fig:ErrorMeasuresCorr_includingUser} we compare, for each pair of segmentations, the measures produced by different datasets segmentations (left) and the measures produced by segmentations of the same dataset (right). In both cases, we plot LCE vs. GCE.
\textcolor{red}{As expected,} the average error between segmentations of the same photo stream (right) is lower than the average error between segmentations of different photo streams (left). \textcolor{red}{Moreover, as indicated by the shape of the distributions on the second row of Fig.\ref{fig:ErrorMeasuresCorr_includingUser} (right), the peak of the LCE is very close to zero. } Therefore, we conclude that given the task of segmenting an egocentric photo stream into events, different people tend to produce consistent and valid segmentation. Fig. \ref{fig:ErrorMeasures_excludingUser} and \ref{fig:ErrorMeasuresCorr_excludingUser} show segmentation comparisons of three different persons (not being the camera wearer) that were asked to temporally segment a photo stream and confirm our statement that different people tend to produce consistent segmentations.
Since our interpretation of events is biased by our personal experience, the segmentation done by the camera wearer could be very different by the segmentations done by third persons. To quantify this difference, in Fig. \ref{fig:ErrorMeasures_includingUser} and Fig. \ref{fig:ErrorMeasuresCorr_includingUser} we evaluated the LCE and the GCE including also the segmentation performed by the camera wearer. From this comparison, we can observe that the error mean does not vary but that the degree of local and global consistency is higher when the set of annotators does not include the camera wearer as it can be appreciated by the fact that the distributions are slightly shifted to the left and thinner. However, since this variation is of the order of $0.05\%$, we can conclude that event segmentation of egocentric photo streams can be objectively evaluated.
\begin{figure}[ht]
\centering
\includegraphics[width=1.0\linewidth]{Results.pdf}
\caption{Illustration of our SR-Clustering segmentation results from a subset of pictures from a Narrative set. Each line represents a different segment. Below each segment we show the top 8 found concepts (from left to right). Only a few pictures from each segment are shown.}
\label{fig:segmentation_results2}
\end{figure}
When comparing the different segmentation methods w.r.t. the obtained FM (see section \ref{sec:exp_results}), we applied a grid-search for choosing the best combination of hyper-parameters. The set of hyper-parameters tested are the following:
\begin{itemize}
\item AC linkage methods $\in$ \{\emph{ward, centroid, complete, weighted, single, median, average,}\}
\item AC cutoff $\in \{0.2,0.4,\dots,1.2\}$,
\item GraphCut unary weight $\omega_1$ and binary weight $\omega_2 \in \{0,0.1,0.2,\dots,1\}$,
\item AC-Color $t \in \{10,25,40,50,60,80,90,100\}$.
\end{itemize}
\subsection{Experimental results}\label{sec:exp_results}
In Table \ref{tab:results_summary}, we show the FM results obtained by different segmentation methods over different datasets.
The first two columns correspond to the datasets used in \cite{talavera2015r-clustering}: AIHS-subset and EDUB-Seg (Set1). The third column corresponds to the EDUB-Seg (Set2) introduced in this paper. Finally, the fourth column corresponds to the results on the whole EDUB-Seg.
The first part of the table (first three rows) presents comparisons to state-of-the-art methods. The second part of the table (next 4 rows), shows comparisons to different components of our proposed clustering method with and without semantic features. Finally, the third part of the table shows the results obtained using different variations of our method.
\begin{table}[!h]
\centering
\small
\bgroup
\def1.25{1.25}
\begin{tabular}{lrrrr}
& \hspace*{-3mm} AIHS \cite{NIPS} & EDUB-Seg Set1 & EDUB-Seg Set2 & EDUB-Seg \\ \hline
Motion \cite{bolanos2014video} & 0.66 & 0.34 & & \\
AC-Color \cite{grauman2015} & 0.60 & 0.37 & \textcolor{red}{0.54} & \textcolor{red}{0.50} \\
R-Clustering \cite{talavera2015r-clustering} & \textbf{0.79} & 0.55 & & \\ \hdashline
ADW & 0.31 & 0.32 & & \\
ADW-ImaggaD & 0.35 & 0.55 & \textcolor{red}{0.29} & \textcolor{red}{0.36} \\
AC & 0.68 & 0.45 & & \\
AC-ImaggaD & 0.72 & 0.53 & \textcolor{red}{0.64} & \textcolor{red}{0.61} \\ \hdashline
SR-Clustering-LSDA & 0.78 & 0.60 & \textcolor{red}{0.64} & \textcolor{red}{0.61} \\
SR-Clustering-NoD & 0.77 & 0.66 & \textcolor{red}{0.63} & \textcolor{red}{0.60} \\
\textbf{SR-Clustering} & 0.78 & \textbf{0.69} & \textbf{\textcolor{red}{0.69}} & \textbf{\textcolor{red}{0.66}}\\
\end{tabular}
\egroup
\caption{Average FM results of the state-of-the-art works on the egocentric datasets (first part of the table); for each of the components of our method (second part); and for each of the variations of our method (third part). The last line shows the results of our complete method. AC stands for Agglomerative Clustering, ADW for ADWIN and ImaggaD is our proposal for semantic features, where D stands for Density Estimation.}
\label{tab:results_summary}
\end{table}
In the first part of Table \ref{tab:results_summary}, we compare to state-of-the-art methods. The first method is the Motion-Based segmentation algorithm proposed by Bola\~nos et al. \cite{bolanos2014video}. As can be seen, the average results obtained are far below SR-Clustering. This can be explained by the type of features used by the method, which are more suited for applying a motion-based segmentation. This kind of segmentation is more oriented to recognize activities and thus, is not always fully aligned with the event segmentation labeling we consider (i.e. in an event where the user goes outside of a building, and then enters to the underground tunnels can be considered "in transit" by the Motion-Based segmentation, but be considered as three different events in our event segmentation). Furthermore, the obtained FM score on the Narrative datasets is lower than the SenseCam's for several reasons: Narrative has lower frame rate compared to Sensecam (AIHS dataset), which is a handicap when computing motion information, and a narrower field of view, which decreases the semantic information present in the image. We also evaluated the proposal of Lee and Grauman \cite{grauman2015} (best with $t=25$), where they apply an Agglomerative Clustering segmentation using LAB color histograms. In this case, we see that the algorithm is even far below the obtained results by AC, where the Agglomerative Clustering algorithm is used over contextual CNN features instead of colour histograms. The main reason for this performance difference comes from the high difference in features expressiveness, that supports the necessity of using a rich set of features for correctly segmenting highly variable egocentric data.
The last row of the first section of the table shows the results obtained by our previously published method \cite{talavera2015r-clustering}, where we were able to outperform the state-of-the-art of egocentric segmentation using contextual CNN features both on AIHS-subset and on EDUB-Seg Set1. Another possible method to compare with would be the one from Castro et al. \cite{CastroHickson2015}, although the authors do not provide their trained model for applying this comparison.
In the second part of Table \ref{tab:results_summary}, we compare the results obtained using only ADWIN or only AC with (ADW-ImaggaD, AC-ImaggaD) and without (ADW, AC) semantic features. One can see that the proposed semantic features, leads to an improved performance, indicating that these features are rich enough to provide improvements on egocentric photo stream segmentation.
Finally, on the third part of Table \ref{tab:results_summary}, we compared our segmentation methodology using different definitions for the semantic features. In the SR-Clustering-LSDA case, we used a simpler semantic features description, formed by using the weakly supervised concept extraction method proposed in \cite{hoffman2014lsda}, namely LSDA. In the last two lines, we tested the model using our proposed semantic methodology (Imagga's tags) either without Density Estimation, SR-Clustering-NoD or with the final Density Estimation (SR-Clustering), respectively.
Comparing the results of SR-Clustering and R-Clustering on the first two datasets (AIHS-subset and EDUB-Seg Set1), we can see that our new method is able to outperform the results adding 14 points of improvement to the FM score, while keeping nearly the same FM value on the SenseCam dataset. The improvement achieved using semantic information can be also corroborated, when comparing the FM scores obtained on the second half of EDUB-Seg dataset (Set2 on the 3rd column) and on the complete version of this data (see the last column of the Table).
\begin{table}[!h]
\centering
\bgroup
\def1.25{1}
\begin{tabular}{lrr}
& Huji EgoSeg \cite{polegtemporal} LTR \\ \hline
ADW-ImaggaD & 0.59\\
AC-ImaggaD & \textbf{0.88}\\ \hdashline
\textbf{SR-Clustering} & \textbf{0.88}\\
\end{tabular}
\egroup
\caption{Average FM score on each of the tested methods using our proposal of semantic features on the dataset presented in \cite{polegtemporal}.}
\label{tab:results_summary_peleg}
\end{table}
In Table \ref{tab:results_summary_peleg} we report the FM score obtained by applying our proposed method on the sub-sampled Huji EgoSeg dataset to be comparable to LTR cameras. Our proposed method achieves a high performance, being 0.88 of FM for both AC and SR-Clustering when using the proposed semantic features. The improvement of the results when using the GoPro camera with respect to Narrative or SenseCam can be explained by two key factors: 1) the difference in the field of view captured by GoPro (up to 170{$^{\circ}$}) compared to SenseCam (135{$^{\circ}$}) and Narrative (70{$^{\circ}$}), 2) the better image quality achieved by the head mounted camera
In addition to the FM score, we could not consider the GCE and LCE measures to compare the consistency of the automatic segmentations to the ground truth, since both methods lead to a number of segments much larger than the number of segments in the ground truth and therefore these measures would not descriptive enough.
This is due to the fact that any segmentation is a refinement of one segment for the entire sequence, and one image per segment is a refinement of any segmentation. Consequently, these two trivial segmentations, one segment for the entire sequence and one image per segment, achieve error zero for LCE and GCE.
However, we observed that on average, the number of segments obtained by the method of Lee and Grauman \cite{grauman2015} is about 4 times bigger than the number of segments we obtained for the SenseCam dataset and about 2 times bigger than for the Narrative datasets.
Indeed, we achieve an higher FM score with respect to the method of Lee and Grauman \cite{grauman2015}, since it produces a considerable over-segmentation.
\subsection{Discussion}
The experimental results detailed in section \ref{sec:exp_results} have shown the advantages of using semantic features for the temporal segmentation of egocentric photo streams.
Despite the common agreement about the inability of low-level features in providing understanding of the semantic structure present in complex events \cite{habibian2014recommendations}, and the need of semantic indexing and browsing systems, the use of high level features in the context of egocentric temporal segmentation and summarization has been very limited.
This is mainly due to the difficulty of dealing with the huge variability of object appearance and illumination conditions in egocentric images. In the works of Doherty et al. \cite{Doherty:2008} and Lee and Grauman \cite{grauman2015},
temporal segmentation is still based on low level features. In addition to the difficulty of reliably recognizing objects, the temporal segmentation of egocentric photo streams has to cope with the lack of temporal coherence, which in practice means that motion features cannot reliably be estimated. The work of Castro et al. \cite{CastroHickson2015} relies on the visual appearance of single images to predict the activity class of an image and on meta-data such as the day of the week and hour of the day to regularize over time. However, due to the huge variability in appearance and timing of daily activities, this approach cannot be easily generalized to different users, implying that for each new user re-training of the model and thus, labeling of thousand of images is required.
The method proposed in this paper offers the advantage of being needless of a cumbersome learning stage and offers a better generalization. The employed concept detector, has been proved to offer a rich vocabulary to describe the environment surrounding the user. This rich characterization is not only useful for better segmentation of sequences into meaningful and distinguishable events, but also serves as a basis for event classification or activity recognition among others.
For example, Aghaei et al. \cite{BOT,aghaei2015towards,aghaei2016whom} employed the temporal segmentation method in \cite{talavera2015r-clustering} to extract and select segments with trackable people to be processed. However, incorporating the semantic temporal segmentation proposed in this paper, would allow, for example, to classify events into social or non-social events. Moreover, using additional existing semantic features in a scene may be used to differentiate between different types of a social event ranging from a official meeting (including semantics such as laptop, paper, pen, etc.) to a friendly coffee break (coffee cup, cookies, etc.).
Moreover, the semantic temporal segmentation proposed in this paper is useful for indexing and browsing.
\section{Conclusions and future work}
\label{sec:conclusions}
This paper proposed an unsupervised approach for the temporal segmentation of egocentric photo streams that is able to partition a day's lifelog in segments sharing semantic attributes, hence providing a basis for semantic indexing and event recognition. The proposed approach first detects concepts for each image separately by employing a CNN approach and later, clusters the detected concepts in a semantic space, hence defining the vocabulary of concepts of a day. Semantic features are combined with global image features capturing more generic contextual information to increase their discriminative power. By relying on these semantic features, a GC technique is used to integrate a statistical bound produced by the concept drift method, ADWIN and the AC, two methods with complementary properties for temporal segmentation. We evaluated the performance of the proposed approach on different segmentation techniques and on 17 day sets acquired by three different wearable devices, and we showed the improvement of the proposed method with respect to the state-of-the-art. Additionally, we introduced two consistency measures to validate the consistency of the ground truth. Furthermore, we made publicly available our dataset EDUB-Seg, together with the ground truth annotation and the code. We demonstrated that the use of semantic information on egocentric data is crucial for the development of a high performance method.
Further research will be devoted to exploit the semantic information that characterizes the segments for event recognition, where social events are of special interest. Additionally, we are interested in using semantic attributes to describe the camera wearer context. Hence, opening new opportunities for development of systems that can take benefit from contextual awareness, including systems for stress monitoring and daily routine analysis.
\section*{Acknowledgments}
\vspace*{-0.25cm} This work was partially founded by TIN2012-38187-C03-01, SGR 1219 and grant to research project 20141510 to Maite Garolera (from Fundaci\'{o} Marat\'{o} TV3). The funders had no role in the study design, data collection and analysis, decision to publish, or preparation of the manuscript. M. Dimiccoli is supported by a \textit{Beatriu de Pin\'{o}s} grant (Marie-Curie COFUND action). P. Radeva is partly supported by an \textit{ICREA Academia'2014} grant.
\section*{References}
\bibliographystyle{plain}
{\footnotesize
| {'timestamp': '2016-10-18T02:10:22', 'yymm': '1512', 'arxiv_id': '1512.07143', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.07143'} | arxiv |
\section{Introduction}
\label{sec:Intro}
We present a new model of granulopoiesis, in which the production of neutrophils
is governed by a negative feedback loop between the neutrophils and
granulocyte colony stimulating factor (G-CSF). G-CSF is the principal cytokine
known to regulate neutrophil production and in our model it is used to moderate
differentiation of stem cells, apoptosis of proliferating neutrophil precursors,
the speed at which neutrophils mature and the rate that mature neutrophils are released
from the marrow reservoir. To facilitate this, we derive not only new functions
for the pharmacodynamic effects of G-CSF, but also a new model of the
G-CSF kinetics which incorporates cytokine binding and internalisation by
the neutrophils. We dispense with the mass action law assumption made in some previous
models and directly model the concentration of both circulating G-CSF and G-CSF bound
to neutrophils. This improved kinetic model furnishes us with G-CSF concentrations
which are considerably more accurate than our previous models so we are able
to use them to directly drive the pharmacodynamic effects and finally form a fully closed
cytokine-neutrophil feedback loop.
At homeostasis the dominant removal
mechanism for G-CSF is internalisation by neutrophils after it binds to
receptors on these cells \cite{Layton2006}.
This gives rise to a negative feedback mechanism on the G-CSF pharmacokinetics (PKs)
whereby large concentrations of neutrophils result
in G-CSF being removed from circulation, in turn leading to low concentrations of circulating G-CSF.
On the other hand if neutrophil concentrations are reduced then G-CSF is not cleared from circulation
as quickly and circulating concentrations increase as a result. The feedback loop is
completed by the pharmacodynamic (PD) effects of the G-CSF: elevated (depressed) G-CSF levels lead to increased (decreased) neutrophil production.
Due to this feedback, using the simple paradigm
that neutrophil concentration
is a cipher for the cytokine concentration (with one low when the other is high), it is possible to derive
granulopoiesis models without explicitly modelling the cytokines. This is particularly useful because it is not universally agreed where or how the multitude of identified cytokines all act.
The mathematical modelling of granulopoiesis has a long and rich history
\cite{Bernard2003,Brooks2012,Colijn:2,Craig2015,Foley:06,Foley:09,Hearn1998,kazarinoff79,kingsmith70,Schirm2014,schmitz88,schmitz90,scholz2005,shvitra83,wichlof88,Vainas2012,Vainstein2005,vonschulthess82} but one of the earliest and most complete treatments is that of Rubinow~\cite{Rubinow1975} which incorporates a number of features that we retain in our model, including active proliferation, maturation, a marrow reservoir and free exchange between the circulating and marginal blood neutrophil pools. Rubinow's
model, however, predates the discovery and characterisation of G-CSF and so it uses neutrophil concentrations as a cipher for the cytokine and its effects. Subsequent physiological models
have also all incorporated at least some elements of this cytokine paradigm in their
modelling. Some authors have been principally interested in neutrophil pathologies, including cyclical neutropenia, chronic myeloid leukemia, and myelosuppression during chemotherapy, while others have primarily studied the effects of G-CSF mimetics. Many models of cyclic neutropenia, including \cite{Colijn:2,Foley:06,Hearn1998,Lei:10} and \cite{Schmitz1996} acknowledge the role of G-CSF in neutrophil production and pathologies but rely on the cytokine paradigm to drive the pharmacodynamic responses. A number of modelling approaches have been proposed, including compartmental ODE models \cite{Schirm2014,Friberg2003,Quartino2012,GonzalezSales2012,Krzyzanski2010,Wang2001}, delay differential equations (DDEs) incorporating statistical distributions to model delays \cite{Vainstein2005,Vainas2012}, and DDEs derived from age-structured partial differential equation (PDE) models, like the one developed in this work \cite{Brooks2012,Craig2015,Foley:09}.
In recent years, synthetic forms of G-CSF have been developed and are administered
to patients for a variety of reasons, including to treat cyclical neutropenia or as an adjuvant during chemotherapy \cite{Dale2015,Dale2011,Molineux2012}.
However, the administration of exogenous G-CSF breaks the cytokine paradigm and it is possible
for neutrophil and G-CSF concentrations to both be elevated at the same time. This breakdown of the natural feedback relationship can cause physiological models that use the paradigm
to mischaracterise the elimination dynamics of G-CSF. For example, both \cite{Krzyzanski2010} and \cite{Craig2015} overestimate the renal clearance of G-CSF so much as
to essentially eliminate the contribution of neutrophil-mediated internalisation, even though they each
include this nonlinear clearance in their models.
If elevated neutrophil concentrations are used to drive the system dynamics on the assumption
that corresponding G-CSF concentrations are reduced when they are in fact elevated, the modelled effects will act in the opposite sense to the physiology. As a consequence, the model will either
develop instabilities and/or give a poor fit to observed dynamics.
The mischaracterisation of G-CSF elimination dynamics was the impetus for the current work.
Consequently, we will not use the neutrophil concentration as a cipher for the
G-CSF concentration, but will model both the G-CSF pharmacokinetics and pharmacodynamics (PK/PD) in detail.
For this, we develop a novel pharmacokinetic model of G-CSF which includes both unbound and bound blood concentrations.
The G-CSF concentrations given by this kinetic model are then used to drive the
pharmacodynamic effects of the cytokine, in a fully formed negative feedback loop.
We begin by summarising the granulopoiesis model in Section~\ref{sec:Model}. Its development is then extensively detailed in Section~\ref{sec:moddev}, beginning from the stem cells in Section~\ref{sec:HSCmodel}. The novel pharmacokinetic G-CSF model incorporating bound and unbound blood concentrations is motivated and developed in Section~\ref{sec:GCSFModel}. There we show how the hypothesis of an equilibrium between bound and unbound concentrations is not satisfied for G-CSF, necessitating the inclusion of more complex kinetics in its pharmacokinetic model. Next, the derivation of the DDE granulopoiesis model is given in Section~\ref{sec:PDEDerivation} and the pharmacodynamic model of G-CSF is developed in Section~\ref{sec:PDUpdates}. Models of the exogenous drugs considered in our study are detailed in Section~\ref{sec:exogcsf}. Having laid the foundations of our model, the various methods of parameter estimation and fitting used for our analyses are subsequently explained in Section~\ref{sec:ParEstim}. These approaches include model-specific constraints, as seen in Sections~\ref{sec:NeutConstr} and \ref{sec:KO}, while fitting procedures from published data are described in Sections~\ref{sec:GCSFParameters}, \ref{sec:NeutFit}, and \ref{sec:ChemoEstimation}. The resulting parameters are then summarized in Section~\ref{sec:ParVals}. Finally in Section \ref{sec:ModelEvaluation} we put our model to the acid test of {\it predicting (not fitting)} the population neutrophil response in a group of patients undergoing simultaneous chemotherapy and G-CSF administration \cite{Pfreundschuh2004b,Pfreundschuh2004a} and obtain excellent agreement between the model predicted behavior and the clinical data.
We conclude with a short discussion in Section~\ref{sec:Discussion}.
\section{Model Summary}
\label{sec:Model}
Here we define the variables and summarise the equations that define our granulopoiesis model. A detailed derivation is contained in Section~\ref{sec:moddev}.
Figure~\ref{fig:ModelSchematic} shows a schematic diagram describing the main elements of the hematopoietic system that we model.
\begin{figure}[t]
\centering
\begin{overpic}[scale=0.95]{UpdatedSchematicZoom3.pdf}
\put(13,90){{\color{NewGrey}$Q$}}
\put(29,91.5){{\color{NewGrey}$\beta(Q)$}}
\put(-5,68){{\color{NewGrey}$\tau_{N_{\!P}}$}}
\put(-5,48.5){{\color{NewGrey}$\tau_{N_{\!M\!}}$}}
\put(7,26){{\color{NewGrey}$\phi_{N_{\!R}}$}}
\put(12.5,36.5){{\color{NewGrey}$N_{\!R}$}}
\put(13,14.5){{\color{NewGrey}$N$}}
\put(9.5,6){{\color{NewGrey}$\gamma_{N}$}}
\put(22.5,26){{\color{Saddle}$G_2$}}
\put(21,5.5){{\color{Saddle}$k_{int}$}}
\put(55,26){{\color{Saddle}$G_1$}}
\put(49,6){{\color{Saddle}$k_{ren}$}}
\put(64,22){{\color{Saddle}\small{$G_{\!\textit{prod}}$}}}
\put(30,79.5){{\color{Saddle}\small{Differentiation}}}
\put(30,68.5){{\color{Saddle}\small{Proliferation}}}
\put(30,46.5){{\color{Saddle}\small{Maturation}}}
\put(-7,25.5){{\color{Saddle}\small{Release}}}
\put(37,30){{\color{Saddle}$k_{21}$}}
\put(37,21){{\color{Saddle}$k_{12}$}}
\end{overpic}
\caption{Schematic representation of the production of circulating neutrophils in the bone marrow and the interaction of the system with G-CSF. Hematopoietic stem cells (HSCs-$Q$) enter the neutrophil lineage, the other blood lines, or are removed from the HSC pool. Differentiated HSCs then undergo successive divisions during the proliferative phase. Cells then mature
before being stored in the marrow reservoir, or dying off during maturation. Neutrophils remain in the reservoir until they are removed randomly or enter the circulation, where they disappear rapidly from the blood.
Freely circulating G-CSF may bind to receptors on the neutrophils.
The concentration of bound G-CSF drives its pharmacodynamic effects. The concentration of
G-CSF bound to mature neutrophils, $G_2$, determines the rate of release from the marrow reservoir.
The concentration of G-CSF bound to neutrophil precursors, assumed proportional to $G_1$ the concentration
of freely circulating G-CSF, determines the rate of differentiation from the HSCs, the speed of maturation,
and the rate of proliferation. For all four effects, speed and rates increase with increasing G-CSF concentration.}
\label{fig:ModelSchematic}
\end{figure}
The hematopoietic stem cell (HSC), neutrophil and G-CSF model is a set of five differential equations
including constant and state-dependent delays.
Let $Q(t)$ be the concentration of HSCs at time $t$, $N_{\!R}(t)$ be the concentration of mature neutrophils in the marrow reservoir, and $N(t)$ be the concentration of the total blood neutrophil pool (TBNP) at time $t$ (which includes both circulating and marginated neutrophils).
Further, let $G_1(t)$ be the concentration of unbound, circulating G-CSF and $G_2(t)$ be the concentration of G-CSF bound to receptors on mature neutrophils (in the reservoir or in the blood neutrophil pool).
The production of neutrophils from the HSCs is modelled by
\begin{eqnarray}
\tfrac{d}{dt}Q(t) &=& -\bigl(\kappa(G_1(t)) +\kappa_\delta + \beta(Q(t))\bigr)Q(t) \notag \\
&&\mbox{}\qquad + A_Q(t)\beta\left(Q(t-\tau_Q)\right)Q(t-\tau_Q) \label{eq:HSCs} \\
\tfrac{d}{dt}N_{\!R}(t) &=& A_N(t) \kappa(G_1(t-\tau_N(t))) Q(t-\tau_N(t))
\frac{V_{\!N_{\!M\!}}(G_1(t))}{V_{\!N_{\!M\!}}(G_1(t-\tau_{N_{\!M\!}}(t)))} \notag \\
&&\mbox{}\qquad-\bigl (\gamma_{N_{\!R}} +\phi_{N_{\!R}}(G_1(t))\bigr )N_{\!R}(t) \label{eq:Reservoir} \\
\tfrac{d}{dt}N(t) &=& \phi_{N_{\!R}}(G_{BF}(t))N_{\!R}(t)-\gamma_N N(t), \label{eq:Neutrophils}
\end{eqnarray}
with the concentrations of G-CSF (unbound and bound to neutrophil G-CSF receptors) given by
\begin{align} \notag
\tfrac{d}{dt}G_{1\hspace{-0.1em}}(t) & = I_G(t)
+G_{\!\textit{prod}}-k_{ren}G_{1\hspace{-0.1em}}(t)\\ \label{eq:FreeGCSF}
& \mbox{}\qquad\quad-k_{12}([\NR(t)+N(t)] V-G_{2\hspace{-0.05em}}(t))G_{1\hspace{-0.1em}}(t)^{\Pow}\hspace{-0.1em}
+k_{21}G_{2\hspace{-0.05em}}(t) \\ \label{eq:BoundGCSF}
\tfrac{d}{dt}G_{2\hspace{-0.05em}}(t) & = -k_{int}G_{2\hspace{-0.05em}}(t)+k_{12}\bigl(\hspace{-0.05em}
[N_{\!R}(t) \hspace{-0.1em}+\hspace{-0.05em}N\hspace{-0.1em}(t)] V\hspace{-0.4em}-G_{2\hspace{-0.05em}}(t)\hspace{-0.1em}\bigr)G_{1\hspace{-0.1em}}(t)^{\Pow}\hspace{-0.3em}-k_{21}G_{2\hspace{-0.05em}}(t),
\end{align}
where $I_G(t)$ indicates input of exogenous G-CSF, which we assume is filgrastim (the most common bio-similar
exogenous form of G-CSF). Filgrastim has very similar PK/PD properties to endogenous G-CSF,
so we will not distinguish between the two types of G-CSF in our model.
The derivation of these equations is given in Section~\ref{sec:moddev}.
In Section~\ref{sec:PDEDerivation}, particular attention is paid to the
derivation of the state-dependent delay terms in \eqref{eq:Reservoir} from an age-structured partial differential equation (PDE) model
of the mitosis and maturation with variable aging rate of the neutrophil precursors.
The G-CSF equations \eqref{eq:FreeGCSF},\eqref{eq:BoundGCSF} are explained in detail in Section~\ref{sec:GCSFModel}.
In the stem cell equation \eqref{eq:HSCs}, as explained in Section~\ref{sec:HSCmodel}, we have
\begin{gather}
\label{eq:betaQ}
\beta(Q) = f_Q\frac{\theta_2^{s_2}}{\theta_2^{s_2} + Q^{s_2}},\\
\label{eq:AQ}
A_Q(t) = A_Q^* = 2e^{-\gamma_Q\tau_Q}.
\end{gather}
Only in the case of administration of chemotherapy is the stem cell amplification factor $A_Q(t)$ non-constant.
During chemotherapeutic treatment $A_Q(t)$ will be modified by replacing \eq{eq:AQ}
with \eqref{eq:HSCchemo} as discussed in Section~\ref{sec:exogcsf}.
Stem cells commit to differentiate to neutrophil precursors at a rate given by
\begin{equation} \label{eq:NewKappa}
\kappa(G_1) = \kappa^* + (\kappa^*-\kappa^\textit{min})\left[\frac{G_1^{s_1}-(G_1^*)^{s_1}}{G_1^{s_1}+(G_1^*)^{s_1}}\right].
\end{equation}
Here, and throughout, the superscript $^*$ denotes the homeostasis value of a quantity.
The rationale for using \eq{eq:NewKappa} to describe the pharmacodynamic effect of the G-CSF on the
differentiation of the HSCs, along with the other $G_1$-dependent functions
is explained in Section~\ref{sec:PDUpdates}.
After entering the neutrophil lineage, cells undergo mitosis at a variable rate ($\eta_{N_{\!P}}(G_1(t))$) given by
\begin{equation} \label{eq:etaNP}
\eta_{N_{\!P}}(G_1(t)) = \eta_{N_{\!P}}^* + (\eta_{N_{\!P}}^*-\eta_{N_{\!P}}^\textit{min})\frac{b_{N_{\!P}}}{G_1^*}
\left(\frac{G_1(t)-G_1^*}{G_1(t)+b_{N_{\!P}}}\right)
\end{equation}
for a proliferation time $\tau_{N_{\!P}}$, considered to be constant. Cells subsequently mature
at a variable aging rate given by
\begin{equation} \label{eq:Vn}
V_{\!N_{\!M\!}}(G_1(t)) = 1+(V_{max}-1)\frac{G_1(t)-G_1^*}{G_1(t)-G_1^*+b_V},
\end{equation}
until they reach age $a_{N_{\!M}}$ so the time $\tau_{N_{\!M\!}}(t)$ it takes for a neutrophil maturing at time $t$ to mature satisfies the
integral relationship
\begin{equation} \label{eq:tauNM1}
\int_{t-\tau_{N_{\!M\!}}(t)}^{t}V_{\!N_{\!M\!}}(G_1(s))ds = a_{N_{\!M}}.
\end{equation}
At homeostasis, $V_{\!N_{\!M\!}}(G_1^*)=1$, and thus $a_{N_{\!M}}$ is the homeostatic maturation time.
The total time it takes a neutrophil to be produced (from HSC differentiation
to release into the reservoir pool) is
\begin{equation}
\label{eq:tauN}
\tau_N (t)=\tau_{N_{\!P}}+\tau_{N_{\!M\!}}(t),
\end{equation}
and we can differentiate equation \eqref{eq:tauNM1} to obtain the following DDE for both $\tau_N$ and $\tau_{N_{\!M\!}}$
\begin{equation}
\label{eq:DerivTaus}
\tfrac{d}{dt}\tau_N(t)=\tfrac{d}{dt}\tau_{N_{\!M\!}}(t) = 1- \frac{V_{\!N_{\!M\!}}(G_1(t))}{V_{\!N_{\!M\!}}(G_1(t-\tau_{N_{\!M\!}}(t)))}.
\end{equation}
Maturing neutrophils are assumed to die at a constant rate given by $\gamma_{N_{\!M}}$. The amplification factor $A_N(t)$ between
differentiation from HSCs to maturation that appears in \eqref{eq:Reservoir} is then given by
\begin{equation} \label{eq:AN}
A_N(t)
= \exp \left[\int_{t-\tau_N(t)}^{t-\tau_{N_{\!M\!}}(t)} \eta_{N_{\!P}}(G_1(s)) d s-\gamma_{N_{\!M}}\tau_{N_{\!M\!}}(t)\right]
\end{equation}
as derived in Section~\ref{sec:PDEDerivation}.
Numerical implementation of the neutrophil amplification rate is obtained by differentiating the integral expressions in \eqref{eq:AN}
using Leibniz's Rule to obtain
\begin{align} \notag
\tfrac{d}{dt}A_{N\!}(t) = A_{N\!}(t)\Bigl[\bigl(1-\tfrac{d}{dt}\tau_{N_{\!M\!}}(t)\bigr)\bigl(\eta_{N_{\!P}}(G_1(t\!-\!\tau_{N_{\!M\!}}(t)))&-\eta_{N_{\!P}}(G_1(t\!-\!\tau_N(t)))\bigr)\\
& -\gamma_{N_{\!M}}\tfrac{d}{dt}\tau_{N_{\!M\!}}(t)\Bigr]. \label{eq:dANdt}
\end{align}
After maturation neutrophils are sequestered into the marrow neutrophil reservoir.
Mature neutrophils exit the reservoir either by dying with constant rate $\gamma_{N_{\!R}}$, or by being released into circulation with a rate $\phi_{N_{\!R}}$ depending on
the fraction $G_{BF}(t)$ of neutrophil receptors that are bound by G-CSF. We define
\begin{equation} \label{eq:GBF}
G_{BF}(t)=\frac{G_2(t)}{V[\NR(t)+N(t)]}\in[0,1], \qquad G_{BF}^*=\frac{G_2^*}{V[N_R^{*}+N^{*}]},
\end{equation}
and let
\begin{equation}
\label{eq:nu}
\phi_{N_{\!R}}(G_{BF}(t))=\phi_{N_{\!R}}^*+(\phi_{N_{\!R}}^\textit{max}-\phi_{N_{\!R}}^*)\frac{G_{BF}(t)-G_{BF}^*}{G_{BF}(t)-G_{BF}^*+b_G}.
\end{equation}
Neutrophils are removed from circulation with constant rate $\gamma_N$.
In equations \eq{eq:HSCs}--\eq{eq:BoundGCSF} we use units of $10^9$ cells per kilogram (of body mass) for
the reservoir and circulating neutrophils, and \unit{10^6cell/kg} for the stem cells. The scaling factors
ensure that computations are performed with numbers of similar magnitude which improves numerical stability.
Circulating and bound G-CSF concentrations are measured in standard units of nanograms per millilitre of blood.
The differing units for neutrophils and G-CSF
are only problematical in equations \eq{eq:FreeGCSF},\eq{eq:BoundGCSF} where quantities
in both units appear; see Section~\ref{sec:GCSFParameters} for the derivation of the conversion factor $V$.
Its also important to note that $N(t)$ measures the total blood neutrophil pool, including both the circulating and marginated neutrophils. To convert $N(t)$ to an absolute neutrophil count/circulating neutrophil numbers $N_C(t)$ (or \emph{vice versa}) there
is a conversion factor; see \eq{eq:ANC}.
\section{Model Development}
\label{sec:moddev}
Here we describe the development of our granulopoiesis model leading to the equations presented in Section~\ref{sec:Model}. The equation for the stem cells \eq{eq:HSCs} is described briefly
in Section~\ref{sec:HSCmodel}. The size of the mature neutrophil reservoir is described by \eq{eq:Reservoir}.
The first term on the right-hand side of this equation gives the rate that mature neutrophils enter the reservoir.
This term is derived from an age-structured PDE model described in Section~\ref{sec:PDEDerivation} below.
Neutrophils are assumed to leave the reservoir either by dying at rate $\gamma_{N_{\!R}}$ or by entering into
circulation at rate $\phi_{N_{\!R}}$, and are removed from circulation at a constant rate $\gamma_N$.
In Section~\ref{sec:GCSFModel} we describe our new G-CSF model \eq{eq:FreeGCSF},\eq{eq:BoundGCSF}
of the unbound freely circulating G-CSF ($G_1$), and the G-CSF bound to receptors
on the neutrophils ($G_2$). This model allows us to model the pharmacodynamic effects of the G-CSF
directly as detailed in Section~\ref{sec:PDUpdates}. Finally, Section~\ref{sec:exogcsf} outlines our models for the exogenous drugs we will consider in later sections.
\subsection{Stem Cells}
\label{sec:HSCmodel}
Equation \eq{eq:HSCs} for the stem cell dynamics was previously used in \cite{Mackey:01,Colijn:1,Colijn:2,PujoMenjouet2005,Foley:09,Lei:10,Brooks2012,Craig2015}. In particular, see \cite{Bernard2003} for a detailed derivation.
Here, we remove the dependence of $\gamma_Q$ upon G-CSF as the HSC population is relatively stable and infrequently dividing \cite{Riether2015,Durand2015} and, to our knowledge, no direct evidence of G-CSF's action upon HSC apoptosis currently exists.
Craig \cite{Craig2015} uses
\begin{equation} \label{eq:AQCraig}
A_Q(t) = 2 \exp\left[-\int_{t-\tau_Q}^{t}\hspace{-1em}\gamma_Q(s) ds\right],
\end{equation}
and in the absence of chemotherapy we take the apoptotic rate $\gamma_Q$ to be constant so this becomes \eqref{eq:AQ}.
\subsection{A physiologically constructed pharmacokinetic G-CSF model}
\label{sec:GCSFModel}
A new pharmacokinetic model of G-CSF, already stated in \eqref{eq:FreeGCSF},\eqref{eq:BoundGCSF}
is used to model the concentrations of both unbound and bound G-CSF.
We do not distinguish between endogenous and exogenous G-CSF in the model, which
constrains us to only consider biosimilar forms of exogenous G-CSF.
Accordingly, we focus on filgrastim, the most widely-available form of exogenous G-CSF. However, other less common forms of biosimilar exogenous G-CSF are available and include lenograstim and Nartograstim\textsuperscript{\textregistered} \cite{Molineux2012}.
The pegylated form of rhG-CSF has greatly reduced renal clearance
relative to endogenous G-CSF, which would require a different model,
so we will not consider it in this work.
In equations \eqref{eq:FreeGCSF},\eqref{eq:BoundGCSF}
$G_1$ is the concentration of freely circulating G-CSF and $G_2$ is the concentration
of G-CSF which is bound to receptors on the neutrophils. Since the bone marrow is well
perfused. G-CSF can bind to mature neutrophils in the marrow reservoir
as well as neutrophils in circulation. In the model $k_{ren}$ denotes the nonsaturable
removal rate of circulating G-CSF (mainly renal). $k_{int}$ denotes the removal rate
of bound-G-CSF, which we refer to as the effective internalisation rate. This term models
the removal of bound G-CSF both by internalisation after binding
and through the removal of the neutrophil itself from circulation (along with its bound
G-CSF molecules). $k_{12}$ is the rate of binding of free G-CSF to the neutrophils,
and $\Pow$ is the effective binding coefficient. The G-CSF receptor has a 2:2 stoichiometry in \textit{in vitro} studies \cite{Layton2006}, so a simple chemical reaction model would suggest $\Pow=2$. However, the number of ligands binding to a receptor only provides an upper bound on the corresponding Hill coefficient \cite{Santillan2008}. Accordingly, we use an effective binding coefficient $\Pow\in[1,2]$.
In this model the bound G-CSF
concentration is saturable, with $V [\NR(t)+N(t)]$ being the capacity of this
compartment. $G_2=V [\NR(t)+N(t)]$ would indicate that every receptor on every neutrophil
in the reservoir and circulation was bound to two G-CSF molecules. Thus the removal
rate of neutrophils by internalisation is saturable.
G-CSF also binds to immature neutrophils and precursors, which will be important for the
pharmacodynamics, but since these cells are fewer in number and/or have fewer receptors
than the mature neutrophils we neglect this effect on the pharmacokinetics.
Finally, $k_{21}$ is the rate of unbinding (transformation from bound G-CSF to circulating G-CSF),
and $I_G(t)$ denotes exogenous administration of G-CSF, discussed in Section~\ref{sec:exogcsf}.
If we were to assume that
there is no net transfer between the bound and circulating G-CSF then
letting $\tilde{N}(t)=[\NR(t)+N(t)]$, equations \eqref{eq:FreeGCSF},\eqref{eq:BoundGCSF} imply
\begin{equation} \label{eq:gcsfbal}
k_{12}(V \tilde{N}(t) -G_2)G_1^{\Pow}-k_{21}G_2\approx0.
\end{equation}
Rearranging \eq{eq:gcsfbal} we obtain
$$G_2(t)\approx\frac{[G_1(t)]^\Pow}{[G_1(t)]^\Pow+k_{21}/k_{12}}V\tilde{N}(t).$$
Now, adding \eq{eq:FreeGCSF} and \eq{eq:BoundGCSF}
$$\tfrac{d}{dt}(G_1+G_2)\approx I_G(t)+G_{\!\textit{prod}}-k_{ren}G_1-k_{int}G_2,$$
and assuming that $G_1\gg G_2$ and that $\tfrac{d}{dt}(G_1+G_2)\approx \tfrac{d}{dt}G_1$,
and finally replacing the $\approx$ by an equality
we have
\begin{equation} \label{eq:gcsf1eq}
\tfrac{d}{dt}G_1 = I_G(t)+G_{\!\textit{prod}}-k_{ren}G_1-k_{int}V\tilde{N}(t)\frac{[G_1(t)]^\Pow}{[G_1(t)]^\Pow+k_{21}/k_{12}}.
\end{equation}
Equations similar to \eq{eq:gcsf1eq} have been used to model G-CSF pharmacokinetics in many papers including \cite{Craig2015,Brooks2012,Foley:09,Krzyzanski2010,Krinner2013,Wang2001}, but usually
with $\tilde{N}(t)=N(t)$ the concentration of circulating neutrophils,
as opposed to $\tilde{N}(t)=[\NR(t)+N(t)]$ as \eqref{eq:FreeGCSF},\eqref{eq:BoundGCSF} suggest.
The usual derivation of \eq{eq:gcsf1eq} is from the law of mass action, but this is equivalent
to the assumption \eq{eq:gcsfbal} that the bound and circulating G-CSF are in quasi-equilibrium.
However, the equilibrium hypothesis \eq{eq:gcsfbal} cannot hold at homeostasis, since if
\eq{eq:gcsfbal} holds and $k_{int}>0$ then $\tfrac{d}{dt}G_2<0$ which is contradictory.
Clinical evidence \cite{Sarkar2003,Terashi1999}
suggests that at homeostasis, binding and internalisation is
the dominant removal mechanism for G-CSF, so not only does \eq{eq:gcsfbal} not hold but
the net transfer from unbound to bound G-CSF should be more than $0.5\timesG_{\!\textit{prod}}$.
Another important situation where \eq{eq:gcsfbal} will fail is during exogenous administration of G-CSF,
which will initially increase the concentration of unbound G-CSF (often by orders of magnitude).
\begin{figure}[t]
\begin{center}
\includegraphics[scale=1]{Fig2.eps}
\put(-305,191){\rotatebox[origin=c]{90}{log($G_1(t))$}}
\put(-20,-5){Days}
\end{center}
\caption{Data from Wang \cite{Wang2001} for G-CSF concentrations after a 750\unit{\mu g} 25 minute IV infusion and five different simulations: (i) the full neutrophil and G-CSF model \eq{eq:HSCs}--\eq{eq:BoundGCSF}
(ii) the G-CSF only model \eq{eq:UnboundGCSFsimp},\eq{eq:BoundGCSFsimp}, (iii) the reduced G-CSF model \eq{eq:gcsf1eq}
with $k_{int}=0$, (iv) the reduced G-CSF model \eq{eq:gcsf1eq} with $k_{int}=30$ and $\tilde{N}(t)=N(t)$ and
neutrophil concentrations taken from the Wang \cite{Wang2001} and (v) the full neutrophil model
\eq{eq:HSCs}--\eq{eq:Neutrophils} and the reduced G-CSF model \eq{eq:gcsf1eq} with $k_{int}=25$ and $\tilde{N}(t)=[\NR(t)+N(t)]$.
In ii) $N_{tot}=4.1457$ and $G_2^*$ and $G_{prod}$ are determined by Equations~\eqref{eq:G2Calculation} and \eqref{eq:GprodCalculation}, respectively. In (ii), (iv) and (v) $k_{ren}=4.12$ and
$G_{prod}$ is determined by \eqref{eq:gcsf1eq}.
All other parameters take values specified in the third columns of Tables~\ref{tab:PKParams} and \ref{tab:NeutrophilValues}.}
\label{fig:gcsffails}
\end{figure}
Figure~\ref{fig:gcsffails} illustrates some of the issues involved in modelling the kinetics of G-CSF.
This figure shows data from a 750 $\mu$g intravenous (IV) infusion digitised from Figure~6 of Wang \cite{Wang2001},
along with a number of simulations of the protocol using different G-CSF kinetic models.
The data in Figure~\ref{fig:gcsffails} seems to have at least two different slopes, suggesting that the
G-CSF time course could be approximated by the sum of two exponentials. This naturally leads
to two compartment pharmacokinetic models \cite{DiPiro2010}.
Such a two-compartment G-CSF model was previously considered by Kuwabara \cite{Kuwabara1994} for Nartograstim\textsuperscript{\textregistered}.
Consistent with general two-compartment models in pharmacology, the two compartments corresponded to the blood
and the tissues, and generic saturable and nonsaturable removal of the G-CSF both occurred from the blood compartment.
This differs from our model where elimination occurs from the two compartments (which instead represent unbound and bound G-CSF concentrations), both of which are subject to linear elimination. By contrast, in our model one compartment is saturable with nonsaturable elimination (the bound G-CSF), which corresponds to known G-CSF removal mechanisms. The assignment of elimination to the first or second compartments also has significant effects on the estimation of corresponding pharmacokinetic parameters so the mischaracterisation of these elimination dynamics could have significant effects on the model's predictions and behaviours \cite{Wu2015b}.
The circulating G-CSF concentration time course for a simulation of our full model \eq{eq:HSCs}--\eq{eq:BoundGCSF}
tracks the measured G-CSF data very closely in Figure~\ref{fig:gcsffails}.
It slightly overestimates the G-CSF, but it is important to note that
the data points are average values from a number of subjects and we will see in Section~\ref{sec:GCSFParameters}
that our G-CSF concentrations are well within the data range for several of administration protocols.
Also shown in Figure~\ref{fig:gcsffails} is a simulation of a simplified version of the G-CSF equations
\eq{eq:FreeGCSF},\eq{eq:BoundGCSF} where the time dependent neutrophil term $[\NR(t)+N(t)]$ is replaced by a constant
$N_{tot}$, so the G-CSF kinetic equations become independent of the neutrophil dynamics. The
resulting equations are stated as \eq{eq:UnboundGCSFsimp},\eq{eq:BoundGCSFsimp} in Section~\ref{sec:GCSFParameters}
where they are used to determine the pharmacokinetic parameters that appear in \eq{eq:FreeGCSF},\eq{eq:BoundGCSF}.
The constant $N_{tot}$ can be thought of as a time average of the term $[\NR(t)+N(t)]$.
As seen in Figure~\ref{fig:gcsffails}, this stand-alone
simplified G-CSF model gives G-CSF concentrations very close to those of the full model, which justifies
using it to determine the kinetic parameters.
Three different simulations of the single G-CSF equation \eq{eq:gcsf1eq} are also shown in Figure~\ref{fig:gcsffails}
to illustrate the difficulties in dealing with reduced models. One simulation has $k_{int}=0$ so that the elimination
of G-CSF is purely renal and it is clear that the nuances of the G-CSF kinetics are lost.
A simulation of \eq{eq:gcsf1eq} with $k_{int}>0$ and $\tilde{N}(t)=N(t)$ (with values for $N(t)$ taken from the
Wang data) gives even worse results than the purely renal elimination case. The problem with this model is that
for the first few hours while the neutrophil concentration is low, the elimination of the G-CSF is mainly renal
and the solution closely tracks the results from the purely renal elimination simulation. But as soon as the circulating
neutrophil concentrations get high enough the elimination of G-CSF by binding becomes dominant and quickly drives the
G-CSF concentration to very low levels. Similar results are seen if our full neutrophil model
\eq{eq:HSCs}--\eq{eq:Neutrophils} is coupled to \eq{eq:gcsf1eq} with $\tilde{N}(t)=[\NR(t)+N(t)]$.
The tendency of the internalisation term to quickly drive the G-CSF concentrations down, along with the
propensity for parameter fitting with linear scales resulted in several previous models using
versions of \eq{eq:gcsf1eq} to take kinetic parameters for which the elimination of G-CSF is
always renal dominated. This is seen both when the G-CSF kinetics is coupled to
physiological models as in \cite{Brooks2012,Craig2015} and when using
traditional empirical models as in \cite{Wang2001,Krzyzanski2010}, which consequently all
have elimination dynamics which are always renal dominated.
This is true in both the models of Craig~\cite{Craig2015}, which used \eq{eq:gcsf1eq}
with $\tilde{N}(t)=N(t)$, and Krzyzanski~\cite{Krzyzanski2010} which used an equation similar to
\eq{eq:gcsf1eq} but taking account of binding to all available receptors. In both,
elimination by internalisation is included in the mathematical models but occurs at an insignificant rate
compared to the renal elimination, contrary to the clinical understanding that elimination of G-CSF
by internalisation is the dominant removal mechanism at homeostasis.
From our numerical experiments it seems impossible to fit the single G-CSF equation \eq{eq:gcsf1eq} to data
when $\tilde{N}(t)$ is taken to be $N(t)$. The mature marrow neutrophil reservoir is an order of magnitude larger than the total blood neutrophil pool, and the receptors on the mature neutrophils need to be taken into account in the kinetics
as in \eqref{eq:FreeGCSF},\eqref{eq:BoundGCSF} to obtain a good fit to data. But taking account of all the receptors
is not sufficient to obtain a model that fits the physiology closely. This is evidenced by the very poor
fit obtained
in Figure~\ref{fig:gcsffails} when coupling our neutrophil model to the reduced G-CSF equation \eq{eq:gcsf1eq}
with $\tilde{N}(t)=[\NR(t)+N(t)]$, and also from models such as that of Krzyzanski~\cite{Krzyzanski2010} that take account
of the G-CSF receptors in marrow, but still obtain renal dominated kinetics.
The study of congenital diseases like cyclical neutropenia (CN)--an inherently oscillatory and dynamic disease--
and exogenous dosing regimens (such as during chemotherapy)
necessitate that the dynamics of G-CSF be well-characterised.
Hence we use the more realistic model \eqref{eq:FreeGCSF},\eqref{eq:BoundGCSF} for G-CSF pharmacokinetics
rather than the single equation reduction \eq{eq:gcsf1eq}.
\subsection{Modelling Granulopoiesis}
\label{sec:PDEDerivation}
The first term on the right hand side of \eq{eq:Reservoir} gives the rate that mature neutrophils enter the bone marrow reservoir at time $t$, and is obtained by modelling the differentiation of stem cells at time $t-\tau_N(t)$
through mitosis of neutrophil precursors to time $t-\tau_N(t)+\tau_{N_{\!P}}=t-\tau_{N_{\!M\!}}(t)$ followed by maturation of the cells
until time $t$. The time variation of $\tau_N(t)$ and $\tau_{N_{\!M\!}}(t)$ is solution dependent so this term involves state-dependent delays. Granulopoiesis models incorporating state-dependent delay have been employed before
in \cite{Foley:09,Foley:09b,Brooks2012}, but the derivation of those models was inaccurate and they missed the important
$V_{\!N_{\!M\!}}(G_1(t))/V_{\!N_{\!M\!}}(G_1(t-\tau_{N_{\!M\!}}(t)))$ term. Here we will show in detail how the
mitotic and maturation stages of the neutrophil precursors
can be modelled by age-structured PDE models, whose solution by the method of characteristics leads to the
state-dependent delay terms in \eq{eq:Reservoir}.
We do not model the cell-cycle process during mitosis, nor do we differentiate between the different maturation stages
of dividing cells (myeloblasts, promyelocytes, myelocytes). Rather, to simplify the modelling and the
resulting differential equations we model mitosis as an exponential process from the moment the HSC
commits to differentiate to the end of the mitosis. The proliferation rate $\eta_{N_{\!P}}$ is assumed to
be independent of which stage in mitosis the cell has reached.
There is evidence that the cytokine G-CSF affects the
differentiation of HSCs and the effective proliferation rate during mitosis, as
explained in \cite{Endele2014}, and so we allow both the differentiation rate $\kappa$ and
the proliferation rate $\eta_{N_{\!P}}$ to vary with $G_1$, the circulating G-CSF, as seen in
equations \eqref{eq:NewKappa},\eqref{eq:etaNP}, and explained in Section~\ref{sec:PDUpdates}.
We let $n_p(t,a)$ be the cell density as a function of time $t$ and age $a$ during proliferation.
We assume that cells age at a constant rate, $\dot{a}=1$, from age $0$ to age $\tau_{N_{\!P}}$, so $\tau_{N_{\!P}}$
is also the time period that cells spend in proliferation, and the proliferation rate is $\tau_{N_{\!P}}(G_1(t))$.
Then, differentiating,
$$\eta_{N_{\!P}}(G_1(t))n_p(t,a)=\frac{dn_p}{dt}
=\frac{\partial n_p}{\partial t}+\frac{da}{dt}\frac{\partial n_p}{\partial a}
=\frac{\partial n_p}{\partial t}+\frac{\partial n_p}{\partial a}$$
so the age-structured PDE model for proliferation is
\begin{equation} \label{eq:PDEProl}
\frac{\partial n_p}{\partial t}+\frac{\partial n_p}{\partial a}=\eta_{N_{\!P}}(G_1(t))n_p(t,a), \qquad t\geq0, \quad a\in[0,\tau_{N_{\!P}}],
\end{equation}
which, by the method of characteristics has solution
\begin{equation} \label{eq:Proliferation}
\mbox{}\hspace{-0.5em}n_p(t,a)=n_p(t-a,0)\exp\left[\int_{t-a}^t \hspace{-1em}\eta_{N_{\!P}}(G_1(s)) ds \right]\!, \; t\geq0, \; a\in[0,\min\{t,\tau_{N_{\!P}}\}].
\end{equation}
If $\tau_{N_{\!P}}\geq a>t>0$ the solution depends on the initial condition $n_p(0,a-t)$, but a similar expression applies. Here we have taken homeostasis as the initial condition throughout and so the solution in \eq{eq:Proliferation} is all that is required.
\begin{figure}[t]
\begin{center}
\includegraphics[scale=0.3]{VariableAge3.pdf}
\put(-206,15){$0$}
\put(-221,100){$a_{N_{\!M}}$}
\put(-30,8){$t$}
\put(-110,8){$t-\tau_{N_{\!M\!}}(t)$}
\put(-210,112){$a$}
\put(-90,15){\vector(1,0){63}}
\put(-27,15){\vector(-1,0){63}}
\caption{During maturation the aging rate is variable with $\dot{a}(t)=V_{\!N_{\!M\!}}(G_1(t))$,
so age is not trivially related to time, and the maturation time $\tau_{N_{\!M\!}}(t)$ is variable.} \label{fig:matpde}
\end{center}
\end{figure}
We model the maturing neutrophil precursors (metamyelocytes and bands) as a single homogeneous compartment.
There is evidence that G-CSF affects the time that cells spend in maturation \cite{Spiekermann1997,Basu2002} and the speed up in maturation has been
measured experimentally \cite{Price}. Since the exact mechanism by which G-CSF affects maturation time
is unknown, we will model this process by decoupling time from age and demanding that cells age by an amount $a_{N_{\!M}}$,
but allowing them to mature at a variable
aging rate $\dot{a}(t)=V_{\!N_{\!M\!}}(G_1(t))$ where $V_{\!N_{\!M\!}}(G_1)$ is a monotonically increasing function with
$V_{\!N_{\!M\!}}(0)>0$ and $\lim_{G_1\to\infty}V_{\!N_{\!M\!}}(G_1)=V_{max}<\infty$.
See Section~\ref{sec:PDUpdates} for further discussion
of the function $V_{\!N_{\!M\!}}(G_1)$.
We assume that the rate of cell death, $\gamma_{N_{\!M}}$, during maturation is constant independent of the concentration
of G-CSF.
We let $n_m(t,a)$ be the cell density as a function of time $t$ and age $a$ during maturation for
$t\geq0$ and $a\in[0,a_{N_{\!M}}]$.
Then the age-structured maturation model is
\begin{equation} \label{eq:PDEMat}
\frac{\partial n_m}{\partial t}+V_{\!N_{\!M\!}}(G_1(t))\frac{\partial n_m}{\partial a}=
\frac{\partial n_m}{\partial t}+\frac{da}{dt}\frac{\partial n_m}{\partial a}=
\frac{dn_m}{dt}=-\gamma_{N_{\!M}} n_m(t,a).
\end{equation}
The characteristics are defined by $\dot a=V_{\!N_{\!M\!}}(G_1(t))$, and along characteristics
for $t\geq\tau_{N_{\!M\!}}(t)$ we obtain
\begin{equation} \label{eq:Maturation}
n_m(t,a_{N_{\!M}})
= n_m(t-\tau_{N_{\!M\!}}(t),0)e^{-\gamma_{N_{\!M}}\tau_{N_{\!M\!}}(t)}.
\end{equation}
Age-structured PDE models have been used in hematopoiesis models many
times previously \cite{Lei:10,Foley:09,Colijn:2,Craig2015}, but special care needs to be taken to
interpret $n_m(t,a)$ when the maturation has variable velocity, or an incorrect
solution will be obtained.
Cells which mature at time $t$ enter maturation at time $t-\tau_{N_{\!M\!}}(t)$ and so differentiated from
HSCs at time $t-\tau_{N_{\!M\!}}(t)-\tau_{N_{\!P}}=t-\tau_N(t)$. The rate at which cells differentiate at time
$t-\tau_N(t)$ is $\kappa(G_1(t-\tau_N(t)))Q(t-\tau_N(t))$, and hence
$$n_p(t-\tau_N(t),0)=\kappa(G_1(t-\tau_N(t)))Q(t-\tau_N(t)).$$
Then by \eq{eq:Proliferation}
\begin{align} \notag
n_p(t-&\tau_{N_{\!M\!}}(t),a_{N_{\!M}})=n_p(t-\tau_N(t),0)\exp\left[\int_{t-a_{N_{\!M}}}^t \hspace{-0.7em}\eta_{N_{\!P}}(G_1(s)) ds \right]\\
&=\kappa(G_1(t-\tau_N(t)))Q(t-\tau_N(t))\exp\left[\int_{t-a_{N_{\!M}}}^t \hspace{-0.7em}\eta_{N_{\!P}}(G_1(s)) ds \right].
\label{eq:npa}
\end{align}
\begin{figure}[t]
\begin{center}
\begin{picture}(165,70)(-35,-20)
\put(10,0){\line(1,0){110}}
\put(80,-2){\line(0,1){2}}
\put(60,0){\circle*{3}}
\put(80,30){\circle*{3}}
\put(-10,45){age}
\put(10,0){\vector(0,1){50}}
\put(5,-5){$0$}
\put(40,-10){\vector(2,1){19}}
\put(60,0){\vector(2,3){19}}
\put(58,-10){$t$}
\put(73,-10){$t+\delta t$}
\put(110,-10){time}
\put(-43,27){$\delta t V_{\!N_{\!M\!}}(G_1(t))$}
\put(10,30){\line(-1,0){2}}
\put(-3,-17){$n_p(t,\tau_{N_{\!P}})$}
\end{picture}
\caption{Transition from proliferation to maturation.}
\end{center}
\end{figure}
To obtain the boundary condition for the maturation phase, note that $n_p(t,\tau_{N_{\!P}})$ is the rate
at which cells leave proliferation and enter maturation. Hence, to leading order,
$n_p(t,\tau_{N_{\!P}})\delta t$ cells enter maturation in the time interval $[t,t+\delta t]$.
Cells that enter maturation at time $t$ will already have age $V_{\!N_{\!M\!}}(G_1(t))\delta t$ by time
$t+\delta t$. Since $n_p(t,a)$ and $n_m(t,a)$ describe the density of cells in the
proliferation and maturation phases, to avoid the spontaneous creation or destruction of cells
at the transition between proliferation and maturation we require
$$\int_{0}^{V_{\!N_{\!M\!}}(G_1(t))\delta t}\hspace{-1.5em} n_m(t+\delta t,a)da-
\int_{t}^{t+\delta t}\hspace{-1.5em}n_p(t,\tau_{N_{\!P}})dt=\mathcal{O}(\delta t^2).$$
Then
\begin{align} \notag
V_{\!N_{\!M\!}}(G_1(t))n_m(t,0)
&=\lim_{\delta t\to 0}\frac{1}{\delta t}\int_{0}^{V_{\!N_{\!M\!}}(G_1(t))\delta t}\hspace{-1.5em} n_m(t+\delta t,a)da\\
&=\lim_{\delta t\to 0}\frac{1}{\delta t}\int_{t}^{t+\delta t}\hspace{-1.5em}n_p(t,\tau_{N_{\!P}})dt=n_p(t,\tau_{N_{\!P}}),
\label{eq:nnn}
\end{align}
and hence the boundary condition for the maturation compartment is
\begin{equation} \label{eq:MatBC}
n_m(t-\tau_{N_{\!M\!}}(t),0)=n_p(t-\tau_{N_{\!M\!}}(t),\tau_{N_{\!P}})/V_{\!N_{\!M\!}}(G_1(t-\tau_{N_{\!M\!}}(t))).
\end{equation}
Combining \eq{eq:Maturation}, \eq{eq:npa}, \eq{eq:MatBC} and \eq{eq:AN} we obtain
\begin{align} \notag
n_m(t,&a_{N_{\!M}}) = \frac{n_p(t-\tau_{N_{\!M\!}}(t),\tau_{N_{\!P}})}{V_{\!N_{\!M\!}}(G_1(t-\tau_{N_{\!M\!}}(t)))}e^{-\gamma_{N_{\!M}}\tau_{N_{\!M\!}}(t)}\\ \notag
&=\frac{\kappa(G_1(t-\tau_N(t))Q(t-\tau_N(t))}{V_{\!N_{\!M\!}}(G_1(t-\tau_{N_{\!M\!}}(t)))}
\exp\left[\int_{t-\tau_N(t)}^{t-\tau_{N_{\!M\!}}(t)}\hspace{-2em}\eta_{N_{\!P}}(G_1(s)) ds-\gamma_{N_{\!M}}\tau_{N_{\!M\!}}(t) \right]\\
&=\frac{\kappa(G_1(t-\tau_N(t)))Q(t-\tau_N(t))}{V_{\!N_{\!M\!}}(G_1(t-\tau_{N_{\!M\!}}(t)))} A_N(t). \label{eq:PDEmat2}
\end{align}
Again because of the variable aging-rate there is a correction factor to apply to $n_m(t,a_{N_{\!M}})$
to obtain the rate that cells leave maturation.
To calculate this rate notice that cells which reach age $a_{N_{\!M}}$ at time $t$
have age $a_{N_{\!M}}-V_{\!N_{\!M\!}}(G_1(t))\delta t+\mathcal{O}(\delta t^2)$ at time $t-\delta t$. Thus the number of
neutrophils that mature in the time interval $[t-\delta t,t]$ is
$$\int\limits_{a_{N_{\!M}}- V_{\!N_{\!M\!}}(G_1(t))\delta t}^{a_{N_{\!M}}}\hspace{-2.5em} n_m(t-\delta t,a)da+\mathcal{O}(\delta t^2)
=V_{\!N_{\!M\!}}(G_1(t)) n_m(t,a_{N_{\!M}})\delta t+\mathcal{O}(\delta t^2).$$
Hence, the rate that cells leave maturation is $V_{\!N_{\!M\!}}(G_1(t)) n_m(t,a_{N_{\!M}})$,
which using \eq{eq:PDEmat2} can be written as
\begin{equation} \label{eq:PDEmat3}
\kappa(G_1(t-\tau_N(t)))Q(t-\tau_N(t))A_N(t)\frac{V_{\!N_{\!M\!}}(G_1(t))}{V_{\!N_{\!M\!}}(G_1(t-\tau_{N_{\!M\!}}(t)))},
\end{equation}
which is the first term on the right-hand side of \eq{eq:Reservoir}. The correction factor
${V_{\!N_{\!M\!}}(G_1(t))}/{V_{\!N_{\!M\!}}(G_1(t-\tau_{N_{\!M\!}}(t)))}$ was omitted from the state-dependent DDE
models in \cite{Foley:09,Brooks2012}.
\subsection{G-CSF Pharmacodynamics}
\label{sec:PDUpdates}
G-CSF in concert with many other cytokines regulates important parts of granulopoiesis.
The precise mechanisms by which it does this are not fully understood (and would probably be
beyond the level of detail that we would want to model mathematically even if they were)
but it is known that G-CSF acts along several signalling pathways in complex processes which activate and generate secondary signals that regulate neutrophil production \cite{Greenbaum2011,Semerad2002,Ward1998}.
The initiation of signalling pathways and the transfer of the resulting signals responsible for the various effects of a given drug may be driven directly by receptor binding and/or the internalisation of the drug. Assuming the rate at which
a drug is internalised is proportional to its bound concentration, we do not need to distinguish between the different possible pathways and will use the concentration of the bound drug
to drive the pharmacodynamics and produce the effects in the body.
Many previous models applied the cytokine paradigm mentioned in the introduction to model cytokine effects directly from the circulating neutrophil concentrations. For example in \cite{Colijn:1,Colijn:2,Foley:09,Lei:10,Brooks2012,Craig2015}, the differentiation function was taken to be a monotonically decreasing function of the circulating neutrophil concentration. Some authors preferred instead to introduce simplified pharmacodynamic models using direct and indirect PD effects related to the concentration of unbound G-CSF \cite{Wang2001,Shochat2007} while other more detailed approaches have also been studied \cite{Scholz2012,Vainstein2005,Vainas2012}.
The cytokine paradigm breaks down when G-CSF is given exogenously. Immediate
responses of the hematopoietic system to G-CSF administration include releasing neutrophils from the marrow
reservoir into circulation, and increasing the maturation speed of neutrophils, so the circulating concentration
of neutrophils and the total number of neutrophils in the reservoir and circulation both increase, which results
in G-CSF and neutrophil concentrations being high concurrently.
Consequently we will use G-CSF concentrations
from \eq{eq:FreeGCSF},\eq{eq:BoundGCSF} to directly model the pharmacodynamic effects
of G-CSF
on the differentiation rate of HSCs $\kappa$, the effective proliferation
rate of neutrophil precursors in mitosis $\eta_{N_{\!P}}$, the aging rate of maturing neutrophils $V_{\!N_{\!M\!}}$,
and the release rate of neutrophils from the bone marrow reservoir $\phi_{N_{\!R}}$.
We use Hill and Michaelis-Menten functions to model the G-CSF dependency of these effects.
There is some disagreement in the literature over exactly which cytokines are important
in different parts of the process, and we may be assigning some effects to G-CSF that are actually
due to GM-CSF or one of the other myriad of cytokines that regulate granulopoiesis. If these other cytokines are
mostly in quasi-equilibrium with G-CSF, using G-CSF as a cipher for all the cytokines should produce
very similar effects without the extraordinary complexity that would be inherent in modelling
each one of the cytokines.
Mammalian studies \cite{Dale91,Bugl2012,Lui2013}
reveal that neutrophils are still produced even in the absence of G-CSF, presumably
because other cytokines are acting. Accordingly, we will construct our effects functions to
have non-zero activity even in the complete absence of G-CSF. Moreover, in Section~\ref{sec:KO} we
will consider the case of G-CSF knockout mathematically with our model to derive a parameter constraint
to reduce the number of unknown parameters.
Recall that the concentration of G-CSF bound to mature neutrophils satisfies the inequality
$G_2(t)\leq V[\NR(t)+N(t)]$ with equality only if every G-CSF receptor were bound to two G-CSF molecules.
We suppose that the rate that mature neutrophils are released from the marrow reservoir into circulation is dependent
on the fraction $G_{BF}(t)=G_2(t)/(V[\NR(t)+N(t)])$ of their receptors which are bound to G-CSF. The
rate is then given by the
Michaelis-Menten function $\phi_{N_{\!R}}(G_1)$ defined by \eqref{eq:nu}.
Letting
\begin{equation} \label{eq:ftransratio}
\phi_{N_{\!R}}^\textit{ratio}=\frac{\phi_{N_{\!R}}^\textit{max}}{\phi_{N_{\!R}}^*}>1,
\end{equation}
this function is also similar to the one used by
Shochat \cite{Shochat2007} that was adapted in Craig \cite{Craig2015} except that we use the
fraction of bound receptors
to drive the function.
At homeostasis \eq{eq:GBF} and \eq{eq:nu} imply that
$$\phi_{N_{\!R}}(G_{BF}^*)=\phi_{N_{\!R}}(G_2^*/[V(N^{*}+N_R^{*})])=\phi_{N_{\!R}}^*.$$
The parameter $b_G$ defines the half-effect concentration with
$$\phi_{N_{\!R}}(G_{BF}^*+b_G)=\frac12(\phi_{N_{\!R}}^*+\phi_{N_{\!R}}^\textit{max}),$$
while the condition
$\phi_{N_{\!R}}(0)>0$ implies the constraint
\begin{equation}
\label{eq:Constraint1}
b_G>\phi_{N_{\!R}}^\textit{ratio}G_{BF}^*=\frac{G_2^*\phi_{N_{\!R}}^\textit{ratio}}{V(N_R^{*}+N^{*})}.
\end{equation}
To model the effects of G-CSF on the differentiation, proliferation and maturation some care
must be taken. We posit that it is cytokine signalling that drives
these processes, and $G_2(t)$ denotes the concentration of bound G-CSF, which is proportional to the rate
that G-CSF is internalised. So it would be tempting
to use $G_2(t)$ to govern these processes, and indeed initially we tried this without
success. The problem is that $G_2(t)$ models the concentration of G-CSF bound to mature neutrophils
in the marrow reservoir and circulation. Through \eq{eq:FreeGCSF} and \eq{eq:BoundGCSF}
this gives a very good model of the removal of G-CSF from circulation because
although the neutrophil progenitor cells also have G-CSF receptors, these cells are relatively few
in number and have relatively few receptors, hence they can be ignored when modelling the
G-CSF kinetics. However, when modelling the pharmacodynamic effects of G-CSF it appears
to be crucial to take account of the binding of G-CSF to the neutrophil precursors, and it
is the freely circulating G-CSF which is available to bind to the G-CSF receptors on
the immature neutrophils and precursors. Consequently, we should use $G_1(t)$ to govern the cytokine
dependent differentiation, proliferation, and maturation.
Another way to see that it should be the circulating
G-CSF $G_1(t)$, and not the G-CSF bound to mature neutrophils $G_2(t)$ that should govern these processes is
as follows. If the concentration of mature neutrophils is decreased then the concentration of bound G-CSF
will also decrease because the number of receptors available to bind to will be decreased, but the concentration
of unbound G-CSF will increase because the rate the G-CSF is removed by internalisation is reduced. However, with a
reduced concentration of neutrophils, an elevated cytokine concentration is needed to
increase differentiation, proliferation and maturation speed.
We model the differentiation rate from HSCs to neutrophil precursors using the Hill function
\eq{eq:NewKappa}. Very little is known about how the differentiation rate changes in function of G-CSF, but we suppose that
it will not vary by orders of magnitude, since this would lead to instability in the HSC population,
while the HSC population is observed to be very stable in healthy subjects \cite{Riether2015}.
It is then convenient to assume that
the homeostatic rate is at the midpoint of the range of possible differentiation rates so
\begin{equation} \label{eq:KKK}
\kappa^*=\frac12(\kappa^\textit{min}+\kappa^\textit{max}).
\end{equation}
With this assumption \eq{eq:NewKappa} is a standard sigmoidal Hill function with minimum
differentiation rate $\kappa(0)=\kappa^\textit{min}$, and with $\kappa(G_1)$ increasing monotonically with $G_1$
and such that at homeostasis $\kappa(G_1^*)=\kappa^*$, while for large concentrations
$\lim_{G_1\to\infty}\kappa(G_1)=\kappa^*+(\kappa^*-\kappa^\textit{min})=\kappa^\textit{max}$.
To ensure that neutrophils are still produced in the complete absence of G-CSF we will require that
$\kappa^\textit{min}>0$.
G-CSF is believed to increase the effective rate of mitosis during proliferation by reducing apoptosis.
Thus we
use a monotonically increasing Michaelis-Menten function $\eta_{N_{\!P}}(G_1(t))$ defined by \eq{eq:etaNP} to describe the G-CSF dependent
effective proliferation rate (which measures the difference between actual proliferation and apoptosis).
This function looks a little different than the other Michaelis-Menten functions we will use, but this is simply because it has been
scaled to give the correct minimal and homeostasis effects with $\eta_{N_{\!P}}(0)=\eta_{N_{\!P}}^\textit{min}>0$
and $\eta_{N_{\!P}}(G_1^*)=\eta_{N_{\!P}}^*$, with $\eta_{N_{\!P}}(G_1)$ a monotonically increasing function of $G_1$.
Letting
$$\eta_{N_{\!P}}^\textit{max}=\lim_{G_1\to\infty}\eta_{N_{\!P}}(G_1)=\eta_{N_{\!P}}^*+\frac{b_{N_{\!P}}}{G_1^*}(\eta_{N_{\!P}}^*-\eta_{N_{\!P}}^\textit{min}),$$
we see that
$$\frac{b_{N_{\!P}}}{G_1^*}=\frac{\eta_{N_{\!P}}^\textit{max}-\eta_{N_{\!P}}^*}{\eta_{N_{\!P}}^*-\eta_{N_{\!P}}^\textit{min}},$$
so the parameter $b_{N_{\!P}}>0$ determines the relative position of $\eta_{N_{\!P}}^*\in[\eta_{N_{\!P}}^\textit{min},\eta_{N_{\!P}}^\textit{max}]$
with $\eta_{N_{\!P}}^*>(\eta_{N_{\!P}}^\textit{min}+\eta_{N_{\!P}}^\textit{max})/2$ when $b_{N_{\!P}}\in(0,G_1^*)$ and
$\eta_{N_{\!P}}^*<(\eta_{N_{\!P}}^\textit{min}+\eta_{N_{\!P}}^\textit{max})/2$ when $b_{N_{\!P}}>G_1^*$.
G-CSF is known to affect the time that neutrophils spend in maturation \cite{Spiekermann1997,Basu2002}, an acceleration in maturation that Price \cite{Price} measured experimentally, but the mechanism by which G-CSF
speeds up maturation is not well understood. We choose to model this process by decoupling
time from age and demanding that cells age by an amount $a_{N_{\!M}}$,
but allowing them to mature at a variable
aging rate $\dot{a}(t)=V_{\!N_{\!M\!}}(G_1(t))$ where $V_{\!N_{\!M\!}}(G_1)$ is a monotonically increasing Michaelis-Menten function
given in \eq{eq:Vn}.
This is similar to the form used in Craig \cite{Craig2015} which was adopted
from Foley~\cite{Foley:09}, and is also functionally equivalent to \eq{eq:nu}.
$b_V$ is the half effect parameter for the aging velocity with $V_{\!N_{\!M\!}}(G_1^*+b_V)=(1+V_{max})/2$.
We require that $V_{\!N_{\!M\!}}(0)>0$, which from \eq{eq:Vn} is equivalent to
\begin{equation} \label{eq:Constraint3}
b_V>G_1^* V_{max}.
\end{equation}
This constraint ensures that the aging velocity $V_{\!N_{\!M\!}}(G_1)$ is strictly positive for all $G_1\geq0$.
The function $V_{\!N_{\!M\!}}(G_1)$ also satisfies the homeostasis condition $V_{\!N_{\!M\!}}(G_1^*)=1$, so that at
homeostasis the aging rate is $1$. The aging rate saturates with $\lim_{G_1\to\infty}V_{\!N_{\!M\!}}(G_1)=V_{max}<\infty$.
Notice that, using \eq{eq:DerivTaus}
\begin{equation} \label{eq:VVfac}
\tfrac{d}{dt}(t-\tau_{N_{\!M\!}}(t))=1-\tfrac{d}{dt}\tau_{N_{\!M\!}}(t)=\frac{V_{\!N_{\!M\!}}(G_1(t))}{V_{\!N_{\!M\!}}(G_1(t-\tau_{N_{\!M\!}}(t)))},
\end{equation}
and positivity of $V_{\!N_{\!M\!}}(G_1)$ assures that $t-\tau_{N_{\!M\!}}(t)$, and similarly $t-\tau_N(t)$,
are monotonically increasing functions of $t$.
This is important in state-dependent DDE theory for existence and uniqueness of solutions.
Physiologically, it assures that cells which have exited proliferation or maturation never re-enter those
phases.
The responses of our new model and the model
of Craig~\cite{Craig2015} to exogenous administration of G-CSF are very different. With our new
model both differentiation and proliferation are increased with increased G-CSF so that after some time delay
the marrow reservoir gets replenished. In the previous model, the G-CSF triggered an immediate release of
neutrophils from the marrow reservoir into circulation and the resulting high circulating
neutrophil count would cause differentiation and proliferation to be decreased. This meant the the marrow reservoir would
suffer a double depletion with increased release into circulation combined with reduced production of new mature
neutrophils, which could lead to instabilities in the model that ought not to be occurring in the granulopoiesis
of healthy subjects.
Since the four functions \eq{eq:NewKappa},\eq{eq:etaNP},\eq{eq:Vn} and \eq{eq:nu}
describe the effects of G-CSF on granulopoiesis, rather than modelling
the processes that lead to the effects, the parameters in these functions do not correspond to physiological quantities that can be measured directly. Nevertheless these parameters can be determined by fitting the response of
the system to experimental data as described in Section~\ref{sec:NeutFit}.
\subsection{Modelling exogenous drug administration}
\label{sec:exogcsf}
As noted following \eqref{eq:FreeGCSF}, $I_G(t)$ denotes the input of exogenous G-CSF. The administration of rhG-CSF (in our case filgrastim) typically takes two forms: IV infusion (where the drug is given intravenously over a period of time) or subcutaneously (injection under the skin). In the former case, the drug passes directly into the bloodstream meaning the bioavailable fraction (the percentage of the administered dose that enters the blood) is 100\%. In this case, we express the single exogenous administration as
\begin{equation}
\label{eq:IVadmin}
I_G(t)= \begin{cases}
\frac{Do}{t_\textit{inf}V_d}, & t_0 \leq t\leq t_{inf} \\
0 & \textrm{otherwise},
\end{cases}
\end{equation}
where $Do$ is the administered dose, $t_0$ is the start of the infusion, $t_\textit{inf}$ is the time of infusion and $V_d$ is the volume of distribution.
The volume of distribution is a pharmacokinetic parameter which relates the hypothetical volume a drug would occupy to the concentration it is observed in the plasma.
It is typically calculated for a drug
by dividing the administered dose by the concentration in the blood immediately following an
administration for the simplest case of IV bolus administration (instantaneous administration into the blood).
Drugs given subcutaneously do not immediately reach the bloodstream. Instead, a certain proportion of the medication remains in the subcutaneous tissue pool before diffusing into the plasma. Some previous studies, notably \cite{Foley:09,Brooks2012} used an extra transition compartment to model the administered G-CSF concentration in the tissues before reaching the blood and allowed for the free exchange between this central (blood) compartment and the tissue compartment. Owing to the specifics of the pharmacokinetics of filgrastim, we will instead use the following direct input functions from \cite{Krzyzanski2010} and \cite{Craig2015} to model subcutaneous administration as
\begin{equation}
\label{eq:SCadmin}
I_G(t)=\begin{cases}
\frac{k_aDoF}{V_d}e^{k_a t}, & t \geq t_0\\
0 & t < t_0,
\end{cases}
\end{equation}
where $k_a$ is the constant of absorption, and $F$ is the bioavailable fraction (the fraction of non-metabolised dose which enters the system).
This direct form is preferred over the two compartment method previously employed in \cite{Foley:09,Brooks2012} because of the relatively small volume of distribution exhibited by filgrastim (the bio-similar exogenous form of G-CSF), which is to say that $V_d$ is less than the standard 70L measure of highly distributed drugs \cite{Craig2015} and that the drug does not have a strong tendency to redistribute into the tissues.
The pharmacokinetic model of the chemotherapeutic drug (Zalypsis\textsuperscript{\textregistered}) used in this paper is the same as in \cite{Craig2015}. Briefly, the concentration of chemotherapeutic drug in the system is modelled using a set of four ordinary differential equations which was determined to be suitable through population pharmacokinetic analysis \cite{PerezRuixo2012}. The PK model of Zalypsis\textsuperscript{\textregistered} is given by
\begin{gather} \notag
\tfrac{d}{dt}C_{p}(t)=I_C (t)+k_{fp}C_{\!f}(t)+k_{sl_{1}p}C_{sl_1}(t)-(k_{pf}+k_{psl_{1}}+k_{el_C})C_p(t)\\
\tfrac{d}{dt}C_f(t)=k_{pf}C_{p}(t)+k_{sl_{2}f}C_{sl_{2}}(t)-(k_{fp}+k_{fsl_{2}})C_{\!f}(t) \label{eq:ChemoModel1} \\
\tfrac{d}{dt}C_{sl_{1}}(t)=k_{psl_{1}}C_{p}(t)-k_{sl_{1}p}C_{sl_{1}}(t), \quad
\tfrac{d}{dt}C_{sl_{2}}(t)=k_{fsl_{2}}C_{\!f}(t)-k_{sl_{2}f}C_{sl_{2}}(t), \notag
\end{gather}
where $C_p$ is the concentration in the central (blood) compartment, $C_{\!f}$ is the concentration in the fast-exchange tissues, and $C_{sl_{1}}$ and $C_{sl_{2}}$ are the concentrations in the slow-exchange tissues, $k_{ij}$ are traditional rate constants between the $i^{th}$ and $j^{th}$ compartments ($i,j=p,f,sl_1,sl_2$), and $k_{el_C}$ is the rate of elimination from the central compartment.
We consider the chemotherapeutic drug to be administered by IV infusion, so $I_C(t)=Dose_{Zal}/\Delta_{t}$, where $Dose_{Zal}$ is the administered dose and $\Delta_t$ is the time of infusion.
In contrast to the pharmacodynamic effects of G-CSF, chemotherapy has negative effects on the neutrophil (and other blood) lineages. Chemotherapy (and radiotherapy) works by disrupting the cell-cycle of tumours \cite{Maholtra2003} but this interference also affects all cells which are dividing, including the neutrophil
progenitors. The cytotoxic side effects chemotherapeutic treatment has on the neutrophils is called myelosuppression and it is a leading cause of treatment adaptation and/or cessation for patients undergoing chemotherapy \cite{Craig2015}. Since chemotherapy's myelosuppressive action only affects
cells capable of division, we model the pharmacodynamic effects of chemotherapy on the HSCs, which rarely divide, and the neutrophil progenitors in the proliferative phase, which divide regularly
until they exit the mitotic phase.
Since the effects of chemotherapy on the HSCs are not clear, we model the antiproliferative effect as
a simple linear decrease
of the rate of apoptosis experienced by these cells by replacing $\gamma_Q$ in equation \eq{eq:AQCraig}
by $\gamma_Q+h_QC_p(t)$ where $C_p(t)$ is the concentration of the chemotherapeutic drug in the central blood compartment given by \eqref{eq:ChemoModel1}, and $h_Q$ is a factor to be determined
(as outlined in Section~\ref{sec:ChemoEstimation}). Then \eq{eq:AQCraig} gives
\begin{equation}
\label{eq:HSCchemo}
A_Q(t)=2e^{-\gamma_Q\tau_Q-h_Q\int_{t-\tau_Q}^t C_p(s)ds}.
\end{equation}
It is convenient to numerically implement \eq{eq:HSCchemo} as a differential equation,
and applying Leibniz's Rule to \eq{eq:HSCchemo},
similar to the derivation of \eqref{eq:dANdt}, we obtain
\begin{equation}
\label{eq:dAQdt}
\tfrac{d}{dt}A_Q(t)=(h_Q(C_p(t-\tau_Q)-C_p(t)))A_Q(t),
\end{equation}
and we replace \eq{eq:AQ} by \eq{eq:dAQdt} when chemotherapy is administered.
The second effect of chemotherapeutic drugs is to reduce the effective proliferation rate of the mitotic neutrophil progenitors. We model this by replacing $\eta_{N_{\!P}}$ of \eqref{eq:etaNP} by
\begin{equation}
\label{eq:etaNPchemo}
\eta_{N_{\!P}}^{chemo}(G_1(t),C_p(t))=\eta_{N_{\!P}}^\textit{inf}+\frac{\eta_{N_{\!P}}(G_1(t))-\eta_{N_{\!P}}^\textit{inf}}{1+(C_p(t)/EC_{50})^{s_c}},
\end{equation}
which is a modification of the model used in \cite{Craig2015}. Here $\eta_{N_{\!P}}^\textit{inf}$ corresponds to the effective proliferation rate in the presence of an infinite dose of the drug. We require $\eta_{N_{\!P}}^\textit{inf}<\eta_{N_{\!P}}^\textit{min}$ to ensure that effective proliferation is reduced, so $\eta_{N_{\!P}}^{chemo}(G_1(t),C_p(t))<\eta_{N_{\!P}}^{chemo}(G_1(t))$ whenever
$C_p(t)>0$. We will allow the possibility of $\eta_{N_{\!P}}^\textit{inf}<0$, which would correspond to negative
effective proliferation (more death than division in the mitotic phase) in the presence of very large
concentrations of the chemotherapeutic drug, though we note that because the drug is cleared from
circulation relatively quickly we will have $\eta_{N_{\!P}}^{chemo}(G_1(t),C_p(t))>0$ most of
the time even if $\eta_{N_{\!P}}^\textit{inf}<0$. If $\eta_{N_{\!P}}^\textit{inf}\in(0,\eta_{N_{\!P}}^\textit{min})$ then effective cell division is
reduced but never completely halted however large the concentration of the chemotherapeutic drug.
$EC_{50}$ is the concentration of chemotherapeutic drug which gives
the half-maximal effect, and $s_c$ is a Hill coefficient.
The parameters $h_Q$, $\eta_{N_{\!P}}^\textit{inf}$, $EC_{50}$, and $s_c$ will all be estimated using fitting techniques described in Section~\ref{sec:ChemoEstimation}.
\section{Parameter Estimation and Equation Constraints}
\label{sec:ParEstim}
In this section we show how our mathematical model imposes constraints on its own parameters to be self-consistent,
and how experimental data can be used to determine model parameters. We begin in Section~\ref{sec:NeutConstr}
by studying the model at homeostasis and deriving inequalities that the parameters must satisfy, as well
as showing how experimentally measured quantities can be used to directly determine some parameters in the model.
In Section~\ref{sec:GCSFParameters} we show how the G-CSF pharmacokinetic parameters can be determined using a
combination of model equation constraints and parameter fitting to experimental data
from single administrations of G-CSF. In Section~\ref{sec:KO}, G-CSF knockout is used to derive further parameter
constraints and relationships.
Finally in Section~\ref{sec:NeutFit} we show how the pharmacodynamic parameters in the neutrophil equations can
be determined by fitting the model to experimental data for the circulating neutrophil concentrations
after a single IV or subcutaneous administration of G-CSF.
\subsection{Neutrophil Steady-State Parameter Determination and Constraints}
\label{sec:NeutConstr}
At homeostasis let $Q^{*}$ be the stem cell concentration and
denote the sizes of the four neutrophil compartments at homeostasis by
$N_P^*$ (proliferation) , $N_M^*$ (maturation), $N_R^{*}$ (marrow reservoir), $N^{*}$ (total blood neutrophil pool),
and the average time that a cell spends in one of these stages at homeostasis by
$\tau_{N_{\!P}}$, $a_{N_{\!M}}$, $\tau_{N_{\!R}}^*$ and $\tau_{N_C}^*$, respectively. With the exception of $\tau_{N_{\!P}}$, all of
these quantities have been determined experimentally, but unfortunately only
$\tau_{N_{\!P}}$ and $a_{N_{\!M}}$ actually appear in our model.
In this section we show that our model imposes some constraints on
the values of these parameters, and also how the values of $\kappa^*$,
$N_P^*$, $N_M^*$, $N_R^{*}$, $N^{*}$, $a_{N_{\!M}}$, $\tau_{N_{\!R}}^*$ and $\tau_{N_C}^*$ can be used through the model
to determine values for the parameters
$\tau_{N_{\!P}}$, $\eta_{N_{\!P}}^*$, $\gamma_{N_{\!M}}$, $\gamma_{N_{\!R}}$, $\gamma_N$ and $\phi_{N_{\!R}}^*$ which do appear in the model
in Section~\ref{sec:Model}.
At homeostasis equations \eq{eq:HSCs}--\eq{eq:Neutrophils} become
\begin{gather} \label{eq:HSCHomeo}
0 = -\bigl(\kappa^* + \kappa_\delta + \beta(Q^{*})\bigr)Q^{*} + A_Q^*\beta(Q^{*})Q^{*},\\
\label{eq:NMatBal}
\kappaNhomeoQ^{*} A_N^*=(\phi_{N_{\!R}}^*+\gamma_{N_{\!R}})N_R^{*}, \\
\label{eq:Neutrohomeo}
\ftranshomeoN_R^{*}=\gamma_N N^{*} .
\end{gather}
Equation \eq{eq:HSCHomeo}
has the trivial solution $Q^{*} =0$ with other solutions given by
\begin{equation} \label{eq:Ksum}
\kappa^* + \kappa_\delta= (A_Q^*-1)\beta(Q^{*} )
\end{equation}
To the best of our knowledge, there is no experimental data to determine the
relative rates of differentiation to the three cell lines (erythrocytes, neutrophils, thrombocytes)
at homeostasis. In the absence of any evidence to the
contrary, we will assume that these are all equal. Since $\kappa^*$ denotes the differentiation
rate to the neutrophil line and $\kappa_\delta$ differentiation to erythrocyte and thrombocyte precursors
we obtain
\begin{equation} \label{eq:kappaVals}
\kappa^*=\tfrac12\kappa_\delta=\tfrac13(A_Q^*-1)\beta(Q^*).
\end{equation}
At homeostasis neutrophil precursors are assumed to enter the mitotic phase at rate $\kappaNhomeoQ^{*}$.
They then proliferate at a rate $\eta_{N_{\!P}}^*$ for a time $\tau_{N_{\!P}}$.
The total number of cells in the proliferative phase at homeostasis is thus
\begin{equation} \label{eq:NProlifTot}
N_P^*=\int_0^{\tau_{N_{\!P}}}\kappaNhomeoQ^{*} e^{\eta_{N_{\!P}}^* s}ds
=\kappaNhomeoQ^{*} \frac{e^{\eta_{N_{\!P}}^*\tau_{N_{\!P}}}-1}{\eta_{N_{\!P}}^*},
\end{equation}
and cells leave proliferation and enter maturation at a rate $R_P^*$
given by
\begin{equation} \label{eq:RPstar}
R_P^*=\kappaNhomeoQ^{*} e^{\eta_{N_{\!P}}^*\tau_{N_{\!P}}}.
\end{equation}
At homeostasis from \eq{eq:Vn} we have $V_{\!N_{\!M\!}}(G_2^*)=1$, and thus
from \eqref{eq:tauNM1}, the time spent in maturation at homeostasis is $a_{N_{\!M}}$.
The number of cells of age $s$ for $s\in[0,a_{N_{\!M}}]$ in the maturation phase
is then $\kappaNhomeoQ^{*}\exp(\eta_{N_{\!P}}^*\tau_{N_{\!P}}-\gamma_{N_{\!M}} s)$, and the total number
of cells in the maturation phase is
\begin{equation} \label{eq:NMatTot}
N_M^*=\int_0^{a_{N_{\!M}}}\kappaNhomeoQ^{*} e^{\eta_{N_{\!P}}^*\tau_{N_{\!P}}-\gamma_{N_{\!M}} s}ds
=\kappaNhomeoQ^{*} e^{\eta_{N_{\!P}}^*\tau_{N_{\!P}}}\frac{1-e^{-\gammaNMa_{N_{\!M}}}}{\gamma_{N_{\!M}}}.
\end{equation}
Writing
\begin{equation} \label{eq:ANstar}
A_N^* = \exp\bigl(\eta_{N_{\!P}}^*\tau_{N_{\!P}} - \gammaNMa_{N_{\!M}}\bigr),
\end{equation}
which corresponds to \eq{eq:AN} at homeostasis, we
can rewrite \eq{eq:NMatTot} as
\begin{equation} \label{eq:NMatTotANstar}
N_M^*=\kappaNhomeoQ^{*} A_N^*\frac{e^{\gammaNMa_{N_{\!M}}}-1}{\gamma_{N_{\!M}}}.
\end{equation}
Now the rate at which cells leave the maturation phase is
$$\kappaNhomeoQ^{*} e^{\eta_{N_{\!P}}^*\tau_{N_{\!P}}-\gammaNMa_{N_{\!M}}}
=\kappaNhomeoQ^{*} A_N^*.$$
The average time, $\tau_{N_C}^*$,
that neutrophils spend in circulation in the blood (in the total blood neutrophil pool)
has been measured a number of times. However, what is actually measured is the half removal time, $\tau_{1/2}$, which gives
$\gamma_N$, the removal rate from circulation by
\begin{equation} \label{eq:tauNC}
\gamma_N =\frac{1}{\tau_{N_C}^*}=\frac{\ln 2}{\tau_{1/2}}.
\end{equation}
Equation \eq{eq:Neutrohomeo} ensures that at homeostasis the rate neutrophils leave the reservoir and
enter circulation equals the rate at which they are removed from circulation.
From this we obtain
\begin{equation} \label{eq:ftransGstar}
\phi_{N_{\!R}}^*=\frac{\gamma_N N^{*} }{N_R^{*}}.
\end{equation}
The rate at which neutrophils exit the mature marrow reservoir
is given by
$(\phi_{N_{\!R}}^*+\gamma_{N_{\!R}})N_R^{*}$ where $\phi_{N_{\!R}}^*$ is the transition rate constant for cells
entering circulation and $\gamma_{N_{\!R}}$ is the random death rate. Thus the average time that cells spend in
the reservoir at homeostasis is
\begin{equation} \label{eq:tauNR}
\tau_{N_{\!R}}^*=\frac{1}{\phi_{N_{\!R}}^*+\gamma_{N_{\!R}}}.
\end{equation}
Hence the random death rate in the
reservoir, $\gamma_{N_{\!R}}\geq0$, is given by
\begin{equation} \label{eq:gammaNR}
\gamma_{N_{\!R}}=\frac{1}{\tau_{N_{\!R}}^*}-\phi_{N_{\!R}}^*,
\end{equation}
and we require that
\begin{equation} \label{eq:NdelConstr}
\tau_{N_{\!R}}^*\phi_{N_{\!R}}^*\leq 1
\end{equation}
to ensure that $\gamma_{N_{\!R}}\geq0$. That said, using \eq{eq:tauNC} and \eq{eq:ftransGstar},
we can rewrite \eq{eq:NdelConstr} as
\begin{equation} \label{eq:NdelRatConstr}
\frac{\tau_{N_{\!R}}^*}{\tau_{N_C}^*}\leq \frac{N_R^{*}}{N^{*} }.
\end{equation}
The apoptosis rate during the maturation phase, $\gamma_{N_{\!M}}\geq0$, is calculated
by eliminating $\kappaNhomeoQ^{*} A_N^*$ from
\eq{eq:NMatBal} and \eq{eq:NMatTotANstar}. Also making use of \eq{eq:gammaNR}, we obtain
\begin{equation} \label{eq:gammaNMeq}
F_M(\gamma_{N_{\!M}}):=N_R^{*}(e^{\gammaNMa_{N_{\!M}}}-1)-\gamma_{N_{\!M}}\tau_{N_{\!R}}^* N_M^*=0.
\end{equation}
It is easy to see that $F_M(0)=0$ and hence $\gamma_{N_{\!M}}=0$ is one solution of \eq{eq:gammaNMeq}.
Since $F_M''(\gamma)>0$ for all $\gamma\geq0$, if $F_M'(0)<0$
there is a unique $\gamma_{N_{\!M}}>0$ such that $F_M(\gamma_{N_{\!M}})=0$,
and no positive value of $\gamma$ such that $F_M(\gamma)=0$ if $F_M'(0)\geq0$.
Since cell death is known to occur in the maturation compartment (see \cite{Mackey:03}),
we should choose our parameters so that \eq{eq:gammaNMeq} admits a solution $\gamma_{N_{\!M}}>0$.
The condition
$F_M'(0)>0$ is equivalent to
\begin{equation} \label{eq:MatApopRatCond}
\frac{N_R^{*}}{N_M^*} < \frac{\tau_{N_{\!R}}^*}{a_{N_{\!M}}},
\end{equation}
and to include apoptosis in the maturation compartment
our parameters must be chosen to satisfy \eq{eq:MatApopRatCond}.
Equation \eq{eq:NdelRatConstr} can be interpreted as a lower bound on
$\tau_{N_{\!R}}^*$, and \eq{eq:MatApopRatCond} as an upper bound.
Eliminating $\tau_{N_{\!R}}^*$ from these two bounds we find that
the parameters must satisfy
\begin{equation} \label{eq:NdelConsist}
\frac{a_{N_{\!M}}}{\tau_{N_C}^*}<\frac{N_M^*}{N^{*} }
\end{equation}
for the constraints \eq{eq:NdelRatConstr} and \eq{eq:MatApopRatCond}
to be consistent. Then $\tau_{N_{\!R}}^*$ must satisfy
\begin{equation} \label{eq:tauNRstarConstr}
\tau_{N_{\!R}}^* \in \left( a_{N_{\!M}}\frac{N_R^{*}}{N_M^*} , \tau_{N_C}^*\frac{N_R^{*}}{N^{*}} \right)
\end{equation}
for
both \eq{eq:NdelRatConstr} and \eq{eq:MatApopRatCond} to be satisfied as strict inequalities.
All the quantities in \eq{eq:tauNRstarConstr} have been estimated experimentally. To be consistent with
our model the values must satisfy both \eq{eq:NdelConsist} and \eq{eq:tauNRstarConstr}.
In Section~\ref{sec:ParVals} we state parameters that satisfy these constraints.
With those parameters we take $\gamma_{N_{\!M}}>0$ to be the unique strictly positive solution to \eq{eq:gammaNMeq}.
Equation \eq{eq:NMatBal} ensures that the rate cells enter and leave the reservoir are
equal at homeostasis. Rearranging and using \eq{eq:ftransGstar}
we obtain
\begin{equation} \label{eq:ANstar2}
A_N^*=\frac{N_R^{*}}{\kappaNhomeoQ^{*}\tau_{N_{\!R}}^*},
\end{equation}
which determines $A_N^*$. Now from \eq{eq:ANstar} we have
\begin{equation} \label{eq:expetatau}
e^{\eta_{N_{\!P}}^*\tau_{N_{\!P}}}=A_N^*e^{\gammaNMa_{N_{\!M}}},
\end{equation}
which determines $e^{\eta_{N_{\!P}}^*\tau_{N_{\!P}}}$, and it remains to determine one of
$\eta_{N_{\!P}}^*$ or $\tau_{N_{\!P}}$ in order to be able to find the other. However \eq{eq:NProlifTot}
implies that
\begin{equation} \label{eq:etaNPval}
\eta_{N_{\!P}}^*
=\kappaNhomeoQ^{*} \frac{e^{\eta_{N_{\!P}}^*\tau_{N_{\!P}}}-1}{N_P^*}=\kappaNhomeoQ^{*} \frac{A_N^*e^{\gammaNMa_{N_{\!M}}}-1}{N_P^*}
\end{equation}
and now from \eq{eq:expetatau} we have
\begin{equation} \label{eq:tauNP2}
\tau_{N_{\!P}}=\frac{1}{\eta_{N_{\!P}}^*}\ln\bigl(A_N^*e^{\gammaNMa_{N_{\!M}}}\bigr).
\end{equation}
In Section~\ref{sec:ParVals} we use the equations of this section to determine parameter values for our model.
\subsection{Estimation of G-CSF Pharmacokinetic Parameters}
\label{sec:GCSFParameters}
Following \cite{Watari1989,Kawakami1990,Barreda2004,Krzyzanski2010} we take the homeostasis
concentration of the free circulating G-CSF to be
$G_1^*=0.025\unit{ng/mL}$.
The parameter $V$ in \eq{eq:BoundGCSF} is the same parameter $V$ as appears in \eq{eq:gcsf1eq}.
But $V$ is difficult to interpret directly from \eq{eq:gcsf1eq}, and although
published values are available, they vary widely
between sources. For the pharmacokinetic G-CSF model
\eq{eq:FreeGCSF},\eq{eq:BoundGCSF} the meaning of $V$ is clear; its simply the conversion factor
that converts a neutrophil concentration $N$ in units of $10^9$ cells per kilogram
of body mass, into the corresponding G-CSF concentration $VN$ in units of nanograms per millilitre
when every receptor on the neutrophils is bound.
To compute $V$, we first note that
the molecular mass of G-CSF is $18.8\unit{kDa}=18800\unit{g/mol}$ \cite{Krzyzanski2010}
or dividing by Avogadro's constant, the equivalent weight of G-CSF
is $G_{mw}=3.12\times 10^{-11}\unit{ng/molecule}$.
We take the number of receptors per neutrophil to be $R=600$, which is in the middle of the range that
Barreda \cite{Barreda2004} cites, though we note that both smaller and larger numbers can be found in the literature.
Then given $N$, the number of receptors per millilitre is
$$R\times\frac{70}{5000}\times10^9\times N,$$
where we assume body mass of $70\unit{kg}$ and $5000\unit{mL}$ of blood. Since two molecules
bind to each receptor the maximum concentration of bound G-CSF is
$$VN=2\times G_{mw}\times R\times \frac{70}{5000}\times10^9\times N
=0.525 N \unit{ng/mL}$$
and hence
\begin{equation} \label{eq:Vval}
V=0.525 \unit{(ng/mL)/(10^9 cells/kg)}.
\end{equation}
Values have been published for several of the other parameters in the G-CSF equations
\eq{eq:FreeGCSF},\eq{eq:BoundGCSF}, but these have been largely based on \textit{in vitro} experiments and/or
simpler G-CSF models using mixed-effects estimation techniques, and so are
not directly applicable to our model \cite{Krzyzanski2010,Wang2001,Scholz2012,Sarkar2003}.
At homeostasis, equations \eq{eq:FreeGCSF},\eq{eq:BoundGCSF} give
\begin{equation} \label{eq:Gtwohomeo}
G_2^*=\frac{(G_1^*)^\Pow}{(G_1^*)^\Pow+(k_{int}+k_{21})/k_{12}}V [\NRhomeo+\Nhomeo],
\end{equation}
and
\begin{align} \notag
G_{\!\textit{prod}} & = k_{ren}G_1^*+k_{int}G_2^* \\
& = k_{ren}G_1^*+k_{int}V [\NRhomeo+\Nhomeo]\frac{(G_1^*)^\Pow}{(G_1^*)^\Pow+(k_{int}+k_{21})/k_{12}}.
\label{eq:Gprod}
\end{align}
Once values of $k_{int}$, $k_{12}$, $k_{21}$,
$k_{ren}$ and $\Pow$ are determined as we describe below, \eq{eq:Gtwohomeo} and \eq{eq:Gprod}
determine values for $G_2^*$ and $G_{\!\textit{prod}}$.
The remaining parameters might be determined by simulating the full model with exogenous G-CSF administration
and fitting the response of the model to published data for such experiments. However, that would involve
also fitting the as yet undetermined pharmacodynamic parameters in equations \eq{eq:HSCs}--\eq{eq:nu}
which would create a very large optimisation problem, with the potential for interactions between the
pharmacokinetic and pharmacodynamic parameters to create a complicated functional with many local minima.
To avoid this, we prefer to determine the pharmacokinetic and pharmacodynamic parameters separately. Here we
determine the PK parameters by decoupling the G-CSF equations \eq{eq:FreeGCSF}-\eq{eq:BoundGCSF}
from the neutrophil dynamics.
There have been a number of studies tracking the response of the hematopoietic system to a single administration of exogenous G-CSF including Wang~\cite{Wang2001} and Krzyzanski~\cite{Krzyzanski2010}.
If data were available for circulating neutrophil and marrow reservoir neutrophil concentrations
as functions of time
it would be possible to treat equations \eq{eq:FreeGCSF}-\eq{eq:BoundGCSF} separately from the rest of the model
as a system of two ordinary differential equations with $[\NR(t)+N(t)]$ treated as a known non-autonomous forcing term determined by the data. But unfortunately it is not known how to directly measure either
marrow neutrophil reservoir or bound G-CSF concentrations, and such values are not reported
in the literature.
In the absence of marrow neutrophil data we will decouple the G-CSF kinetic equations
\eq{eq:FreeGCSF}-\eq{eq:BoundGCSF} from the rest of the model by replacing the time dependent term
$[\NR(t)+N(t)]$ by the constant $N_{tot}$ to obtain
\begin{align}\notag
\tfrac{d}{dt}G_{1\hspace{-0.1em}}(t) & = I_G(t)
+G_{\!\textit{prod}}-k_{ren}G_{1\hspace{-0.1em}}(t)\\ \label{eq:UnboundGCSFsimp}
& \mbox{}\qquad\quad-k_{12}(N_{tot} V-G_{2\hspace{-0.05em}}(t))G_{1\hspace{-0.1em}}(t)^{\Pow}
+k_{21}G_{2\hspace{-0.05em}}(t) \\ \label{eq:BoundGCSFsimp}
\tfrac{d}{dt}G_{2\hspace{-0.05em}}(t) & = -k_{int}G_{2\hspace{-0.05em}}(t)+k_{12}\bigl(N_{tot} V\hspace{-0.4em}-G_{2\hspace{-0.05em}}(t)\hspace{-0.1em}\bigr)G_{1\hspace{-0.1em}}(t)^{\Pow}-k_{21}G_{2\hspace{-0.05em}}(t).
\end{align}
In \eq{eq:UnboundGCSFsimp} and \eq{eq:BoundGCSFsimp} the constant
$N_{tot}$ represents the constant total number of neutrophils available for G-CSF binding,
and will be treated as an extra parameter to be determined during the fitting. It should
correspond approximately to an average value of $[\NR(t)+N(t)]$ across the time course of the data.
With data for bound G-CSF unavailable we are constrained to fit \eq{eq:UnboundGCSFsimp},\eq{eq:BoundGCSFsimp}
to data for the unbound G-CSF. To do this we use digitisations of
two sets of data from Wang~\cite{Wang2001} from a 750\unit{\mu g}
intravenous (IV) administration of G-CSF and from a subcutaneous (SC) administration of the same dose.
SC administrations necessarily include the absorption kinetics of a drug, as outlined in equation \eqref{eq:SCadmin},
whereas IV administrations reach the blood directly and can be modelled more simply as in \eqref{eq:IVadmin}.
For these reasons, both IV and SC data were used simultaneously during the fitting procedure to best characterise the
parameters. Rather than fitting directly to the data from Wang~\cite{Wang2001}, to obtain robust parameter fits
we took the G-CSF data from the SC and IV administrations and fit a spline through each to define functions
$G_{dat}^{SC}(t)$ and $G_{dat}^{IV}(t)$ over the time intervals $0\leq t\leq 2\unit{days}$ for which the data were taken. With postulated parameter values we then use the Matlab \cite{Mathworks} ordinary differential equation solver
\textit{ode45} to simulate \eq{eq:UnboundGCSFsimp},\eq{eq:BoundGCSFsimp} over the same time interval to define
functions $G_{1}^{SC}(t)$ and $G_{1}^{IV}(t)$. We measure the error between the simulated solutions
and the data using the $L^2$ function norm defined by
\begin{equation} \label{eq:L2}
\|G\|_2^2=\int_0^T \hspace{-0.5em}G(t)^2dt.
\end{equation}
For the IV data which varies over orders of magnitude, as seen in Figure~\ref{fig:gcsffails}, we use a log scale, while for the SC data a linear scale is appropriate. We define a combined error function for both simulations by
\begin{equation} \label{eq:PKErr}
\textit{Err} = \|\log(G_1^{IV})-\log(G_{dat}^{IV})\|_2^2 + \chi^{0.95}\|G_1^{SC}-G_{dat}^{SC}\|_2^2,
\end{equation}
where the scale factor $\chi$ defined by
\begin{equation} \label{eq:chi}
\chi=\frac{\max_{t\in[0,T]}\log(G_{dat}^{IV}(t))-\min_{t\in[0,T]}\log(G_{dat}^{IV}(t))}{\max_{t\in[0,T]}G_{dat}^{SC}(t)-\min_{t\in[0,T]}G_{dat}^{SC}(t)},
\end{equation}
effectively rescales the data so that both data sets have equal weight. (Since $\chi<1$ the power $0.95$ in \eq{eq:PKErr} works to give slightly more weight to the SC data).
Fitting was performed using the Matlab \cite{Mathworks} \textit{lsqcurvefit}
least squares solver, with the error function
$\textit{Err}$ evaluated numerically by sampling the functions at a thousand equally spaced points.
It is convenient to define the constant
\begin{equation} \label{eq:Nelim}
N_{elim}=1-\frac{k_{ren}G_1^*}{G_{prod}}
\end{equation}
where $N_{elim}$ is the fraction of G-CSF clearance performed through internalisation at homeostasis
(obtained in \eq{eq:Nelim} as one minus the fraction of renal clearance at homeostasis).
The estimation was performed for the G-CSF parameters: $k_{12}$, $k_{21}$, $\Pow$, $k_{int}$,
the neutrophil constant $N_{elim}$,
and the pharmacokinetic drug parameters $k_a$, and $F$. The elimination fraction $N_{elim}$ was
either fixed ($N_{elim}=0.6$ and $0.8$ in Table~\ref{tab:PKParams}) or fitted (the other
entries in Table~\ref{tab:PKParams}). At each step of the optimisation the candidate
$k_{12}$, $k_{21}$, $\Pow$, $k_{int}$ and $N_{elim}$ are used to determine the dependent parameters
$G_2^*$, $k_{ren}$, and $G_{prod}$, which from \eq{eq:UnboundGCSFsimp},\eq{eq:BoundGCSFsimp} and
\eq{eq:Nelim} are given by
\begin{align}
\label{eq:G2Calculation}
G_2^*&=VN_{tot}\frac{(G_1^*)^\Pow}{(G_1^*)^\Pow+(k_{21}+k_{int})/k_{12}}\\
\label{eq:krenCalculation}
k_{ren}&=\left(-1+\frac{1}{N_{elim}}\right)Vk_{int}(G_1^*)^{(\Pow-1)}\frac{N_{tot}}{(G_1^*)^\Pow+(k_{21}+k_{int})/k_{12}}\\
\label{eq:GprodCalculation}
G_{prod}&=k_{int}G_2^*+k_{ren}G_1^*.
\end{align}
\begin{table}[ht]
\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|}\hline
Name & Value 1 & Value 2 & Value 3 & Value 4 & Value 5 &Units \\ \hline
$N_{elim}$ & 0.097478 & 0.6 & 0.71678 & 0.8 & 0.87358 & $-$ \\ \hline
$k_{ren}$ & 1.3142 & 0.45064 & 0.2456 & 0.16139 & 0.094597 & days$^{-1}$\\
$k_{12}$ & 2.3004 & 2.2519 & 2.1342 & 2.2423 & 2.878 & days$^{-1}$\\
$k_{21}$ & 407.1641 & 198.2403 & 168.2588 & 184.8658 & 259.8087 & days$^{-1}$\\
$k_{int}$ & 394.5111 & 459.2721 & 275.2744 & 462.4209 & 632.0636 & days$^{-1}$\\
$\Pow$ & 1.7355 & 1.4418 & 1.4631 & 1.4608 & 1.4815 & $-$ \\
$N_{tot}$ & 3.9496 & 4.1767 & 4.1457 &4.2009 & 3.606 & $10^9$ cells/kg\\ \hline
\multicolumn{7}{|c|}{$Do=750\unit{\mu g}$, $V_d=2178.0$ \unit{mL}} \\ \hline
$F$ & 0.99752& 0.75 & 0.75 & 0.75 & 0.98271 & $-$\\
$k_a$ & 3.8154 & 5.2142 & 5.0574 & 5.143 & 4.1931 & days$^{-1}$\\
$Err$ & 0.16352 & 0.15716 & 0.17901 & 0.18543 & 0.21130 & $-$ \\ \hline
\multicolumn{7}{|c|}{$Do=300\unit{\mu g}$, $V_d=4754.7$ \unit{mL}} \\ \hline
$F$ & 1& 0.63361 & 0.62299 & 0.64466 & 0.71424 & $-$\\
$k_a$ & 6.3783 & 8.0804 & 8.0628 & 8.0236 & 7.4367 & days$^{-1}$\\ \hline
\multicolumn{7}{|c|}{$Do=375\unit{\mu g}$, $V_d= 2322.9$ \unit{mL}} \\ \hline
$F$ & 0.89831& 0.4801 & 0.48549 & 0.49964 & 0.57618 & $-$\\
$k_a$ & 4.18161 & 6.7326 & 6.6324 & 6.6133 & 6.1259 & days$^{-1}$\\
\hline
\end{tabular}
\end{center}
\caption{Pharmacokinetic parameter estimates from the simplified
G-CSF model \eq{eq:UnboundGCSFsimp},\eq{eq:BoundGCSFsimp} for different homeostasis
elimination fractions of $N_{elim}$. $Err$ is defined by \eq{eq:PKErr} for the $750\unit{\mu g}$ dose.
As described in the text, dose-dependent drug parameters were only recalculated for the lower doses.}
\label{tab:PKParams}
\end{table}%
\begin{figure}[ht]
\begin{subfigure}[b]{0.5\linewidth}
\begin{center}
\includegraphics[width=0.9\linewidth]{Wang750IV.eps}
\put(-159,88){\rotatebox[origin=c]{90}{\scriptsize$\log(G_1(t))$}}
\put(-20,-6){\scriptsize Days}
\end{center}
\caption{25 minute IV infusion}
\vspace{4ex}
\end{subfigure
\begin{subfigure}[b]{0.5\linewidth}
\begin{center}
\includegraphics[width=0.9\linewidth]{Wang750SC.eps}
\put(-159,95){\rotatebox[origin=c]{90}{\scriptsize$G_1(t)$}}
\put(-20,-6){\scriptsize Days}
\end{center}
\caption{Subcutaneous injection}
\vspace{4ex}
\end{subfigure}
\caption{G-CSF PK parameter fitting results of \eq{eq:UnboundGCSFsimp},\eq{eq:BoundGCSFsimp} with parameter values taken from Table~\ref{tab:PKParams} with $N_{elim}=0.80$. In both panels, a 750 $\mu$g dose is administered following the protocol described in Wang \cite{Wang2001}. Blue lines with data: digitised data median values, red solid lines: model solution with estimated parameters, black dashed lines: maximum and minimum values of the digitised data.}
\label{fig:GoodPKFits}
\end{figure}
\begin{figure}[ht]
\begin{subfigure}[b]{0.5\linewidth}
\begin{center}
\includegraphics[width=0.9\linewidth]{KrzyzanskiGCSFPKlin.eps}
\put(-161,95){\rotatebox[origin=c]{90}{\scriptsize$G_1(t)$}}
\put(-22,-6){\scriptsize Hours}
\end{center}
\caption{$5\unit{\mu g/kg}$ ($350\unit{\mu g}$ total) IV infusion}
\vspace{4ex}
\end{subfigure
\begin{subfigure}[b]{0.5\linewidth}
\begin{center}
\includegraphics[width=0.9\linewidth]{KrzyzanskiGCSFPKlog.eps}
\put(-159,87){\rotatebox[origin=c]{90}{\scriptsize$\log(G_1(t))$}}
\put(-22,-6){\scriptsize Hours}
\put(-100,20){\scriptsize$\log(G_1(t))$}
\end{center}
\caption{$5\unit{\mu g/kg}$ ($350\unit{\mu g}$ total) IV infusion}
\vspace{4ex}
\end{subfigure}
\begin{subfigure}[b]{0.5\linewidth}
\begin{center}
\includegraphics[width=0.9\linewidth]{WangGCSFPKsc.eps}
\put(-161,95){\rotatebox[origin=c]{90}{\scriptsize $G_1(t)$}}
\put(-22,-6){\scriptsize Hours}
\end{center}
\caption{$375\unit{\mu g}$ subcutaneous administration}
\end{subfigure
\begin{subfigure}[b]{0.5\linewidth}
\begin{center}
\includegraphics[width=0.9\linewidth]{NeutrophilsNtot.eps}
\put(-161,82){\rotatebox[origin=c]{90}{\scriptsize$N(t)+N_R(t) $}}
\put(-42,77){\scriptsize$N_{tot}$}
\put(-112,46){\scriptsize$N_R^{*}+N^{*}$}
\put(-22,-6){\scriptsize Hours}
\end{center}
\caption{$750\unit{\mu g}$ IV infusion}
\end{subfigure}
\caption{G-CSF pharmacokinetic parameter fitting results of \eq{eq:UnboundGCSFsimp},\eq{eq:BoundGCSFsimp} with parameter values taken from Table~\ref{tab:PKParams} with $N_{elim}=0.80$ compared for different administration types, doses, and datasets.
a) \& b) A simulation of \eq{eq:UnboundGCSFsimp},\eq{eq:BoundGCSFsimp}
is compared to data from \cite{Krzyzanski2010} in linear and log scales.
c) A simulation compared to data from \cite{Wang2001}. d) Neutrophil concentrations (blue line) of the full
neutrophil model \eq{eq:HSCs}-\eq{eq:nu} compared to the value of $N_{tot}$
and $N_R^*+N^*$.
For a to c: blue line with data: digitised data median values, red solid line: model solution from estimated parameters, black dashed lines--digitised data maximum and minimum values.
}
\label{fig:PKParameters}
\end{figure}
The following fitting procedure was employed. First parameters were fit from IV data for a 750\unit{\mu g} administration \cite{Wang2001} on the log scale to ensure that behaviour at both high and low concentrations were properly characterised. Next initial SC parameters were fit from 750\unit{\mu g} SC data in linear scale.
Using the parameters from these two fits as seed values, we next obtain final parameter values by fitting both log-concentration IV and linear SC data simultaneously using the norm defined in \eq{eq:PKErr}.
Finally, as the pharmacokinetic parameters related to the SC administration have been shown to be dose-dependent \cite{Scholz2012}, we re-estimate $F$ and $k_a$ for lower doses of $300\unit{\mu g}$
and $375\unit{\mu g}$ \cite{Krzyzanski2010,Wang2001}. Since $V_d$ is typically calculated by the ratio of the dose to the initial concentration in the blood for IV administrations \cite{DiPiro2010}, we have applied the same calculation here to scale the G-CSF prediction to the first measured data point. Accordingly, the volume of distribution was recalculated to fit the administered dose.
The resulting parameters are reported in Table~\ref{tab:PKParams}.
Figure~\ref{fig:GoodPKFits} compares the solutions from the fitting procedure of the simplified model \eq{eq:UnboundGCSFsimp} \eq{eq:BoundGCSFsimp}
for the parameter set with $N_{elim}=0.80$ from Table~\ref{tab:PKParams} to the Wang \cite{Wang2001} data
for $750\unit{\mu g}$ IV and SC doses in log and linear scales, respectively.
Figure~\ref{fig:PKParameters}(a-b) gives linear and log scale plots of the simulations of \eq{eq:UnboundGCSFsimp},\eq{eq:BoundGCSFsimp} with the $N_{elim}=0.80$ parameter set from Table~\ref{tab:PKParams}
for an IV administration
from Krzyzanski \cite{Krzyzanski2010}. In this case no fitting was performed; the Krzyzanski \cite{Krzyzanski2010}
protocol is simulated using parameters obtained from fitting to the Wang data, and a good fit to the data
is still obtained. Figure~\ref{fig:PKParameters}(c) shows another simulation for a slightly larger SC dose, with the
same G-CSF parameters (only the the dose-dependent drug parameters $k_a$ and $F$ were fit, as already noted), and we
again obtain good agreement with the data.
Figure~\ref{fig:PKParameters}(d) validates the use of the $N_{tot}$ simplification used for \eq{eq:UnboundGCSFsimp},\eq{eq:BoundGCSFsimp} by comparing $N_{tot}$ to $N_R(t)+N(t)$ from the solution of the full model \eq{eq:HSCs}-\eq{eq:nu} and to $N_R^{*}+N^{*}$. This demonstrates how $N_{tot}$ effectively averages $N_R(t)+N(t)$ over most of the simulation.
We characterize the parameter sets found for the simplified
G-CSF model \eq{eq:UnboundGCSFsimp},\eq{eq:BoundGCSFsimp}
by the fraction $N_{elim}$ of the G-CSF that is cleared by binding and internalisation at homeostasis.
For $0\leq N_{elim}<1/2$ the elimination is renal dominated at homeostasis, while for
$1/2< N_{elim}\leq1$ the pharmacokinetics are internalisation dominant. As already mentioned in Section~\ref{sec:GCSFModel},
from a clinical standpoint, it is believed that $N_{elim}>1/2$, while a number of previously published models including
\cite{Craig2015,Krzyzanski2010,Wang2001} have $N_{elim}$ close to zero.
When we included $N_{elim}$ as a parameter to be fit the results were very sensitive to the seed values
used to start the optimisation and had a tendency to produce parameter sets with very low or very high $N_{elim}$
(see the $N_{elim}=0.097$ and $N_{elim}=0.87358$ parameter sets in Table~\ref{tab:PKParams}), but we also found
a good fit with $N_{elim}=0.71678$ and were able to find good fits for any fixed value of $N_{elim}$, as seen in Figure~\ref{fig:GoodPKFits}
(see Table~\ref{tab:PKParams} for parameter
sets with $N_{elim}=0.6$ and $0.8$). Our results seem to indicate that there is at least a one parameter family of plausible parameter sets with each set characterised by the value of $N_{elim}$.
This arises
because we are fitting the simplified model \eq{eq:UnboundGCSFsimp},\eq{eq:BoundGCSFsimp} without any data for
the bound G-CSF concentrations. If the model \eq{eq:UnboundGCSFsimp},\eq{eq:BoundGCSFsimp} were linear then
parameter identifiability theory would require data from both components of the solution in order to identify unique
parameters in the model. Even though \eq{eq:UnboundGCSFsimp},\eq{eq:BoundGCSFsimp} is nonlinear, the lack of
any bound G-CSF data allows us to fit the unbound G-CSF concentrations with different parameter sets, which will
result in different solutions for the unmeasured bound G-CSF concentrations. In Section~\ref{sec:NeutFit} we will
see that different G-CSF kinetic parameter sets will result in
similar G-CSF responses, but markedly different neutrophil dynamics. The small differences in the reported
errors $Err$ in Table~\ref{tab:PKParams} are not sufficient alone to make a definitive judgement of
which is the optimal parameter set. In the following sections we will study the response
of the full system \eq{eq:HSCs}-\eq{eq:nu} not just to exogenous G-CSF but also chemotherapeutic treatment (both alone and with prophylactic exogenous G-CSF) which will lead us to conclude that the PK parameters from Table~\ref{tab:PKParams} with
$N_{elim}=0.80$ produce the best model responses to a variety of scenarios.
As seen in Table~\ref{tab:PKParams}, the estimates obtained for $N_{tot}$ are significantly larger than $[\NRhomeo+\Nhomeo]$.
However as Figure~\ref{fig:PKParameters}(d) shows for a 750\unit{\mu g} dose administered by a 25 minute IV infusion, $N_{tot}$ is an approximate average
for $[\NR(t)+N(t)]$ over the initial part of the simulation. This, along with the similarity between the results
given by \eq{eq:FreeGCSF}-\eq{eq:BoundGCSF} and the full model (as illustrated in Figure~\ref{fig:gcsffails})
gives us confidence not only in the simplified model \eq{eq:UnboundGCSFsimp}-\eq{eq:BoundGCSFsimp} for estimating the
G-CSF kinetic parameters, but also provides additional confirmation that the marrow reservoir
neutrophils $N_R(t)$ must be included along with the total blood neutrophil pool $N(t)$ in the full
kinetic G-CSF model \eq{eq:FreeGCSF}-\eq{eq:BoundGCSF} in order to reproduce the observed physiological
response.
\subsection{Parameter estimates from G-CSF knockout}
\label{sec:KO}
Several murine studies \cite{Bugl2012,Lui2013}
have looked at the effects of G-CSF knockout by producing mice lacking G-CSF receptors and measuring the differences in circulating neutrophil counts compared to wild type mice. The conclusion of these studies is that even in the case of
complete incapacity of the neutrophils to bind with G-CSF, neutrophil counts were still between 20 and 30\% of normal levels.
This is consistent with G-CSF not being the sole cytokine to regulate
neutrophil production.
Consequently we will ensure that our model produces reduced but non-zero circulating neutrophil concentrations
in the complete absence of G-CSF, and so in this section we consider the behaviour of the equations
defining neutrophil production when $G_1\equiv G_2\equiv0$. In that case the four G-CSF dependent functions take
values $\kappa(0)=\kappa^\textit{min}$, $\eta_{N_{\!P}}(0)=\eta_{N_{\!P}}^\textit{min}$, $V_{\!N_{\!M\!}}(0)\in(0,1)$ (by \eq{eq:Constraint3}), and
$\phi_{N_{\!R}}(0)\in(0,\phi_{N_{\!R}}^*)$ (by \eq{eq:Constraint1}).
We let $N_{ko}^*$ denote the total blood neutrophil pool under G-CSF knockout and define the ratio
\begin{equation} \label{eq:Cko}
C_{ko}=N_{ko}^*/N^{*}.
\end{equation}
Let $\theta=R_{Pko}/R_P^*$ be
the ratio of the rate of cells leaving proliferation in the absence of G-CSF to the rate of cells leaving proliferation at homeostasis.
Using \eq{eq:RPstar} and a similar calculation for $R_{Pko}$ we obtain
\begin{equation}
\label{eq:theta}
\theta=\frac{R_{Pko}}{R_P^*}=\frac{\kappa^\textit{min}Q^{*} e^{\tau_{N_{\!P}}\eta_{N_{\!P}}^\textit{min}}}{\kappaNhomeoQ^{*} e^{\tau_{N_{\!P}}\eta_{N_{\!P}}^*}}
=\frac{\kappa^\textit{min}}{\kappa^*}e^{\tau_{N_{\!P}}\eta_{N_{\!P}}^*(\mu-1)},
\end{equation}
where we also introduce the second auxiliary parameter
\begin{equation} \label{eq:mu}
\mu={\eta_{N_{\!P}}^\textit{min}}/{\eta_{N_{\!P}}^*}\leq 1,
\end{equation}
which measures the fractional reduction in the proliferation rate at knockout. In \eq{eq:theta} we have assumed that
the number of stem cells is unchanged at knockout. Since the differentiation rate to neutrophils will be decreased
from $\kappa^*$ to $\kappa^\textit{min}$ in the absence of G-CSF, the number of stem cells will actually increase, but
using \eq{eq:Ksum} and \eq{eq:betaQ} this increase can be calculated and is found to be less than $1\%$ for our
model parameters.
For given values of $\theta$, $\mu$ and $e^{\tau_{N_{\!P}}\eta_{N_{\!P}}^*}$ we will use \eq{eq:theta} to determine
the ratio $\kappa^\textit{min}/\kappa^*$.
Since $\kappa^\textit{min}\leq\kappa^*$ (see \eq{eq:KKK}), \eq{eq:theta} implies that
$\theta\leq e^{\tau_{N_{\!P}}\eta_{N_{\!P}}^*(\mu-1)}$. Rearranging this gives a lower bound for $\mu$, from which obtain
the constraint
\begin{equation} \label{eq:muinterval}
\mu \in \left(1+\frac{\ln(\theta)}{\tau_{N_{\!P}}\eta_{N_{\!P}}^*}, 1\right).
\end{equation}
Here $\mu=1$ corresponds to a constant
proliferation rate independent of G-CSF, with the reduced production of neutrophils at
knockout caused by a reduction of the differentiation rate $\kappa$. If $\mu$ is equal to its
lower bound then $\kappa$ is constant independent of G-CSF concentration, and the reduced production
of neutrophils is caused by the reduced effective proliferation rate $\eta_{N_{\!P}}$.
For intermediate values of $\mu$, both $\kappa^\textit{min}$ and $\eta_{N_{\!P}}^\textit{min}$ are reduced from their homeostasis values,
and $\mu$ acts as a tuning parameter to
weight the relative contribution of each mechanism with $\kappa^\textit{min}/\kappa^*$ a monotonically
decreasing function of $\mu={\eta_{N_{\!P}}^\textit{min}}/{\eta_{N_{\!P}}^*}$.
A value for $\theta$ can be computed by studying the dynamics in the absence of G-CSF after the proliferation stage.
Letting $N_{ko}^*$ and $N_{Rko}^*$ denote the number of neutrophils at knockout in the total blood pool and
in the marrow reservoir respectively, the rate that cells enter and leave circulation should be equal
implying that $\gamma_N N_{ko}^*=\phi_{N_{\!R}}(0)N_{Rko}^*$, or
\begin{equation} \label{eq:ReservoirKO}
N_{Rko}^* =\frac{1}{\phi_{N_{\!R}}(0)}\gamma_N N_{ko}^*.
\end{equation}
The rate $R_{Mko}$ that mature neutrophils are created at knockout is then equal to the rate that
neutrophils enter and leave the marrow reservoir, and hence
\begin{equation} \label{eq:KOCons2}
R_{Mko}=(\phi_{N_{\!R}}(0)+\gamma_{N_{\!R}})N_{Rko}^* = \gamma_N N_{ko}^* \left (1 + \frac{\gamma_{N_{\!R}}}{\phi_{N_{\!R}}(0)}\right).
\end{equation}
During G-CSF knockout, the maturation time is given by $a_{N_{\!M}}/V_{\!N_{\!M\!}}(0)$, during which cells die at a constant rate
$\gamma_{N_{\!M}}$ (which is not affected by G-CSF). Hence the rate $R_{Pko}$ that cells exit proliferation in the absence of G-CSF is related to $R_{Mko}$ by
$$R_{Pko}e^{-\gamma_{N_{\!M}}\frac{a_{N_{\!M}}}{V_{\!N_{\!M\!}}(0)}}=R_{Mko}.$$
Thus,
\begin{equation} \label{eq:KOCons5}
R_{Pko}=e^{\gamma_{N_{\!M}}\frac{a_{N_{\!M}}}{V_{\!N_{\!M\!}}(0)}}R_{Mko}=
\gamma_N N_{ko}^*\left (1+\frac{\gamma_{N_{\!R}}}{\phi_{N_{\!R}}(0)}\right )e^{\gamma_{N_{\!M}}\frac{a_{N_{\!M}}}{V_{\!N_{\!M\!}}(0)}}.
\end{equation}
A similar calculation yields $R_P^*$, the rate that cells leave proliferation at homeostasis (with G-CSF), as
\begin{equation}
\label{eq:ProlRateHomeo}
R_P^*=\gamma_N N^{*} \left (1+\frac{\gamma_{N_{\!R}}}{\phi_{N_{\!R}}^*}\right)e^{\gamma_{N_{\!M}} a_{N_{\!M}}}.
\end{equation}
Then
\begin{equation} \label{eq:thetaval}
\theta=\frac{R_{Pko}}{R_P^*}=
C_{ko}\frac{\phi_{N_{\!R}}(0)+\gamma_{N_{\!R}}}{\phi_{N_{\!R}}^*+\gamma_{N_{\!R}}}\exp\Bigl[a_{N_{\!M}}\gamma_{N_{\!M}}\Bigl(\frac{1}{V_{\!N_{\!M\!}}(0)}-1\Bigr)\Bigr],
\end{equation}
where $C_{ko}$ is defined by \eq{eq:Cko}.
\subsection{Estimating the Pharmacodynamic Parameters}
\label{sec:NeutFit}
We still require estimates for six parameters, $\mu$, $b_{N_{\!P}}$, $V_{max}$, $b_V$, $b_G$ and $\phi_{N_{\!R}}^\textit{max}$
in the functions defining the pharmacodynamic effects of G-CSF on the neutrophil production and mobilisation.
We digitised data from Wang~\cite{Wang2001} for average circulating neutrophil concentrations for three days following a
$375\unit{\mu g}$ and a $750\unit{\mu g}$ 25-minute IV infusion. The data also contained circulating G-CSF concentrations, but we did
not use the G-CSF concentrations for fitting. As in Section~\ref{sec:GCSFParameters}, instead of fitting directly to the
data points we used it to to define two continuous functions $N_{dat}^{375}(t)$ and $N_{dat}^{750}(t)$, one for each dose,
and fit the response of the full model \eq{eq:HSCs}-\eq{eq:nu} to these functions.
The fitting is difficult because no data is available for reservoir or stem cell concentrations, and the
circulating neutrophil concentrations are only measured for
three days after the infusion. Since the proliferation time for neutrophil precursors is about a week, this data cannot
be used to fit any stem cell parameters, as no cells that commit to differentiate to the neutrophil line after the infusion will
reach circulation during this time (which is why we do not re-estimate any stem cell parameters in the current work).
Although at homeostasis it also takes about a week for cells to traverse maturation and the marrow reservoir, these
processes are greatly sped up after G-CSF administration, and cells that are in proliferation at the time of the infusion can
reach circulation within a day, enabling us to estimate relevant parameters.
After three days the
neutrophil concentrations have not returned to their homeostatic values. If parameters are fit just using this short
interval of data, we found parameters which gave good fits to the circulating neutrophil concentrations over the first three
days, but for which the neutrophil concentrations then under went very large deviations from homeostasis values lasting months or more.
There is no evidence of a single G-CSF administration destabilising granulopoiesis \cite{Molineux2001}. Accordingly, we will require that the fit
parameters result in stable dynamics. We do this by adding artificial data points for $7 \leq t\leq 21\unit{days}$.
Accordingly we construct $N_{dat}^{375}(t)$ and $N_{dat}^{750}(t)$ over two disjoint time intervals as splines through the data points
for $t\in[0,3]$
and as constant functions $N_{dat}^{dose}(t)=N^{*}$ for $t\in[7,21]$.
Since we have no data for $t$ between $3$ and $7$ days describing how the neutrophils return to homeostasis, we do not define values
for $N_{dat}^{dose}(t)$ for this time interval.
For candidate parameter values, we then used Matlab's \cite{Mathworks} delay differential equation solver \textit{ddesd} to simulate \eqref{eq:HSCs}-\eqref{eq:nu} over the full 21-day time interval. This defined the functions $N^{375}(t)$ and $N^{750}(t)$, from which we were able to measure the error between the data and the simulated solutions using an
$L^2$ function norm similar to the one defined in \eqref{eq:L2}.
For the disjoint time intervals, we have two integrals to perform, and rescale them to carry equal weight and hence define
\begin{equation} \label{eq:L2Neutrophils}
\|N\|^2_2=\frac13\int_{0}^3N(t)^2dt+\frac{1}{14}\int_{7}^{21}N(t)^2dt,
\end{equation}
with corresponding fitting error
\begin{equation} \label{eq:NeutrophilError}
Err=\|N_{dat}^{375}(t)-N^{375}(t)\|_2^2+\|N_{dat}^{750}(t)-N^{750}(t)\|_2^2.
\end{equation}
Parameter estimation was performed using the \textit{fmincon} function in Matlab \cite{Mathworks}. As in the G-CSF fitting described in Section~\ref{sec:GCSFParameters}, the error was evaluated by sampling the functions at one thousand points (with $500$ in each
time interval because of the scaling in \eq{eq:L2Neutrophils}).
Instead of directly fitting the six parameters specified at the start of this section, we let $\tilde{b}_V=b_V/V_{max}$ and
fit to the six
parameters $\mu$, $b_{N_{\!P}}$, $V_{max}$, $\tilde{b}_V$, $\phi_{N_{\!R}}(0)$ and $\phi_{N_{\!R}}^\textit{ratio}$. This set of parameters is easier to
fit to because the constraints \eq{eq:Constraint1} and \eq{eq:Constraint3} then become simply $\phi_{N_{\!R}}(0)>0$ and $\tilde{b}_V>G_1^*$, while the original constraints both involve more than one of the unkown parameters.
From \eq{eq:nu},\eq{eq:ftransratio} and \eq{eq:theta}, at each step of the optimisation the six fitting parameters
define the remaining parameters via
\begin{equation}\label{eq:PDParamsDdet}
\begin{split}
&\eta_{N_{\!P}}^\textit{min}=\mu \, \eta_{N_{\!P}}^*, \qquad
\phi_{N_{\!R}}^\textit{max}=\phi_{N_{\!R}}^\textit{ratio}\phi_{N_{\!R}}^*, \qquad
b_V=\tilde{b}_V V_{max},\\
&\kappa^\textit{min}=\theta\kappa^* e^{(\tau_{N_{\!P}}\eta_{N_{\!P}}^*(1-\mu))},\qquad
b_G=G_{BF}^*\frac{\phi_{N_{\!R}}^\textit{max}-\phi_{N_{\!R}}(0)}{\phi_{N_{\!R}}^*-\phi_{N_{\!R}}(0)}.
\end{split}
\end{equation}
where $\theta$ itself is calculated from \eqref{eq:thetaval}. The Hill coefficient of \eqref{eq:NewKappa} was set to be $s_1=1.5$, midway within its plausible range of values, as explained in Section~\ref{sec:ParVals}.
The estimation of $\mu$ requires some caution as its lower bound in \eqref{eq:muinterval} changes at each iteration of the optimisation as $\theta$ varies, and we see from \eq{eq:thetaval} that $\theta$ itself depends on three of the
parameters to which we are fitting. Nonsensical results are obtained if the model is simulated with $\mu$ outside its bounds. Since the constraint is difficult to apply, to ensure that \eqref{eq:muinterval} is respected we use a penalty method.
Consequently, \eqref{eq:muinterval} is checked at each iteration of the optimisation
and if $\mu$ is outside of its bounds
$\mu$ is reset to the bound and after the simulation is computed $Err$ is multiplied by
the penalty factor
$e^{|\mu-\mu_{bound}|^{1/2}}$ which is larger than $1$ when $\mu\ne\mu_{bound}$. The error function thus
penalised cannot have a minimum with $\mu$ outside of its bounds, and so the
optimisation routine is forced to find values for $\mu$ within the permissible range.
A family of G-CSF kinetic parameter sets was reported in
Table~\ref{tab:PKParams} in Section~\ref{sec:GCSFParameters}.
Estimates for the pharmacodynamic parameters were performed for
every parameter set in Table~\ref{tab:PKParams}.
The resulting pharmacodynamic parameters are reported in Table~\ref{tab:NeutrophilValues}.
\begin{table}[ht]
\setlength{\tabcolsep}{2pt}
\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|c|}\hline
Name & Value 1 & Value 2 & Value 3 & Value 4 & Value 5 & Units \\ \hline
$N_{elim}^{simp}$ &0.097478 & 0.6 & 0.71678 & 0.8 & 0.87358 & $-$ \\ \hline
$N_{elim}$ &0.3631 & 0.4508 & 0.6204 & 0.7033& 0.8153 & $-$ \\ \hline
$\mu$ & 0.96381 & 0.86303& 0.85482 & 0.84458 & 0.90768 & $-$ \\
$b_{N_{\!P}}$ & 0.125 & 0.026182 & 0.025994 & 0.022868 & 0.024908 & \unit{ng/mL} \\
$V_{max}$ & 7.9932 & 7.9881 & 7.9697 & 7.867 & 7.994 & $-$\\
$\tilde{b}_V$ & 0.031250 &0.031251 & 0.031255 & 0.031283 & 0.031261 & \unit{ng/mL} \\
$\phi_{N_{\!R}}(0)$ & 0.072801 & 0.026753 & 0.023154 & 0.020056 & 0.049852 & \unit{days^{-1}} \\
$\phi_{N_{\!R}}^\textit{ratio}$ & 10.9606 & 11.7257 & 11.9442 & 11.3556 & 11.9706 & $-$\\ \hline
$\eta_{N_{\!P}}^\textit{min}$ & 1.6045 & 1.4367 & 1.4231 & 1.406 & 1.5111 & \unit{days^{-1}} \\
$\phi_{N_{\!R}}^\textit{max}$ & 3.9897 & 4.2682 & 4.3478 & 4.1335 & 4.3574 & \unit{days^{-1}}\\
$b_V$ & 0.24979 & 0.24964 & 0.24909 & 0.24611 & 0.2499 & \unit{ng/mL} \\
$b_G$ & 6.3999$\times 10^{-5}$ & 0.0002107 & 0.00019058 & 0.00018924 &0.00018725& $-$ \\
$\theta$ & 0.45978 & 0.18895 & 0.17099 & 0.15096 & 0.32529 & $-$ \\
$\kappa^\textit{min}$ &0.0052359 & 0.0073325 & 0.0073325 & 0.0073325 & 0.0073325 & days$^{-1}$ \\ \hline
$Err$ & 0.3482 & 0.3153 & 0.2928 & 0.2843 & 0.3762 & $-$ \\
\hline
\end{tabular}
\end{center}
\caption{Parameter estimation results for the pharmacodynamic parameters. $N_{elim}^{simp}$ refers to $N_{elim}$ value of the
corresponding kinetic parameters for the simplified G-CSF model given in Table~\ref{tab:PKParams}. $N_{elim}$
is the corresponding value for the full model, then stated are the six fit parameters, followed by the dependent
parameters. The approximation error to the data is found by integrating \eq{eq:Neutrophils} as in \eq{eq:NeutrophilError} and comparing to Wang's data \cite{Wang2001} for a 375 $\mu$g and 750 $\mu$g IV infusion of 25 minutes. }
\label{tab:NeutrophilValues}
\end{table}%
Since $G_2^*$ in the full model \eq{eq:HSCs}-\eq{eq:nu} is given by \eq{eq:Gtwohomeo} which differs from the
value given by \eq{eq:G2Calculation} for the simplified model \eq{eq:UnboundGCSFsimp},\eq{eq:BoundGCSFsimp},
the values of $G_{prod}$ and $N_{elim}$ derived for the two models will also be different.
In Table~\ref{tab:NeutrophilValues} the values from Section~\ref{sec:GCSFParameters} for the simplified model
are referred to as $N_{elim}^{simp}$, and we also state the corresponding value of $N_{elim}$ for the
full model from \eq{eq:Nelim} using \eq{eq:Gprod}.
It is important to note that if $\mu$ were close to $1$ and far from its lower bound, then
$\kappa^\textit{min}/\kappa^*\ll1$, and the wide variation in possible differentiation rates
could have potentially destabilising effects on the stem cells. However, for most of the investigated parameter sets (except for $N_{elim}^{simp}=0.097478$)
with the added `stabilising' data, $\mu$ was found to be essentially equal to its lower bound.
In this case $\kappa^{min}$ is almost equal to $\kappa^*$, and the rate of differentiation out of the stem cell
compartment is essentially constant and \eq{eq:NewKappa} is virtually independent of the influence of G-CSF. For the current model with the imposed stabilising data, this implies that any change in production is produced by variations in the effective proliferation rate of \eq{eq:etaNP}. Without the additional data points, we found parameter estimates where $\mu$ was far from its lower bound and $\kappa^{min}$ was similarly lower than $\kappa^*$ but these led to unstable dynamics. As seen in Sections~\ref{sec:ChemoEstimation} and \ref{sec:ModelEvaluation}, the parameter estimates obtained are shown to successfully reproduce protocols for chemotherapy-alone and chemotherapy with adjuvant G-CSF. Accordingly, differentiation from the hematopoietic stem cells is likely close to constant in reality but from our results, we cannot conclude that differentiation is independent of G-CSF.
\begin{figure}[tp]
\begin{subfigure}[b]{0.5\linewidth}
\begin{center}
\includegraphics[width=0.9\linewidth]{NeutrophilsNelim09.eps}
\put(-163,97){\rotatebox[origin=c]{90}{$N_C(t)$}}
\put(-19,-6){Days}
\put(-27,25){Days}
\end{center}
\caption{$N_{elim}^{simp}=0.097478$}
\label{fig:NeutrophilsNelim09}
\vspace{4ex}
\end{subfigure
\begin{subfigure}[b]{0.5\linewidth}
\begin{center}
\includegraphics[width=0.9\linewidth]{GCSFNelim09.eps}
\put(-160,95){\rotatebox[origin=c]{90}{$G_1(t)$}}
\put(-19,-6){Days}
\end{center}
\caption{$N_{elim}^{simp}=0.097478$}
\label{fig:GCSFNelim09}
\vspace{4ex}
\end{subfigure}
\begin{subfigure}[b]{0.5\linewidth}
\begin{center}
\includegraphics[width=0.9\linewidth]{NeutrophilsNelim80.eps}
\put(-162,97){\rotatebox[origin=c]{90}{$N_C(t)$}}
\put(-19,-6){Days}
\put(-27,25){Days}
\end{center}
\caption{$N_{elim}^{simp}=0.80$}
\label{fig:NeutrophilsNelim72}
\end{subfigure
\begin{subfigure}[b]{0.5\linewidth}
\begin{center}
\includegraphics[width=0.9\linewidth]{GCSFNelim80.eps}
\put(-160,95){\rotatebox[origin=c]{90}{$G_1(t)$}}
\put(-19,-6){Days}
\end{center}
\caption{$N_{elim}^{simp}=0.80$}
\label{fig:GCSFNelim72}
\end{subfigure}
\begin{subfigure}[b]{0.5\linewidth}
\begin{center}
\includegraphics[width=0.9\linewidth]{NeutrophilsNelim87.eps}
\put(-163,97){\rotatebox[origin=c]{90}{$N_C(t)$}}
\put(-19,-6){Days}
\put(-27,25){Days}
\end{center}
\caption{$N_{elim}^{simp}=0.87358$}
\label{fig:NeutrophilsNelim87}
\end{subfigure
\begin{subfigure}[b]{0.5\linewidth}
\begin{center}
\includegraphics[width=0.9\linewidth]{GCSFNelim87.eps}
\put(-163,95){\rotatebox[origin=c]{90}{$G_1(t)$}}
\put(-19,-6){Days}
\end{center}
\caption{$N_{elim}^{simp}=0.87358$}
\label{fig:GCSFNelim87}
\end{subfigure}
\caption{Simulations of the full model \eq{eq:HSCs}-\eq{eq:nu} for various parameter sets with
different $N_{elim}$ values. Left: Circulating neutrophil concentrations in \unit{10^9 cells/kg}
over 21 days, with the first three days shown as an inset. Right: The corresponding circulating G-CSF
concentrations.
Blue lines with data: digitised data from Figure~7 (neutrophil concentrations) and Figure~6 (G-CSF concentrations) of Wang~\cite{Wang2001}, red solid lines: model solution, black dashed lines: maximum and minimum digitised data values from Figure~7 and Figure~6 of \cite{Wang2001}, yellow dashed lines: respective homeostatic values.}
\label{fig:NeutrophilParameters}
\end{figure}
Figure~\ref{fig:NeutrophilParameters}, compares the resulting model solutions for three different values of $N_{elim}$, two of which are shown to be less optimal. Also included are the corresponding G-CSF predictions without any re-estimation from the values obtained in Section~\ref{sec:GCSFParameters}. For $N_{elim}=0.097478$, the G-CSF response is well predicted as seen in Figure~\ref{fig:GCSFNelim09} but because of the renal domination of these parameters, the cytokine paradigm fails in the endogenous-only case. Moreover, repeated administrations of exogenous G-CSF will not accumulate per clinical observations. The G-CSF response seems to be well characterised by the $N_{elim}^{simp}=0.87358$ parameters in Figure~\ref{fig:GCSFNelim87} however the dynamics of the neutrophil response in Figure~\ref{fig:NeutrophilsNelim87} do not stay within the data bounds, and so are not a good fit. Using $N_{elim}^{simp}=0.80$, both the neutrophil and G-CSF responses are successfully predicted in Figures~\ref{fig:NeutrophilsNelim72} and \ref{fig:GCSFNelim72}. The two sets with the lowest errors ($N_{elim}^{simp}=0.71678$ and $N_{elim}^{simp}=0.8$) were used to determine parameters relating to the pharmacodynamic effects of chemotherapy, which is discussed in Section~\ref{sec:ChemoEstimation}.
\subsection{Estimation of Chemotherapy Related Parameters}
\label{sec:ChemoEstimation}
To estimate parameters in \eqref{eq:HSCchemo} and \eqref{eq:etaNPchemo}, data from the results of the Phase I clinical trial of Zalypsis\textsuperscript{\textregistered} were digitised from Gonz\'alez-Sales \cite{GonzalezSales2012}. Unlike the data used for fitting in Sections~\ref{sec:GCSFParameters} and \ref{sec:NeutFit}, here the protocols differ from one subject to the next and are reported per patient. All dosing regimens were as stated \cite{GonzalezSales2012} with doses scaled by body surface area (BSA). Since the subjects were patients undergoing anti-cancer treatments, deviations from the prescribed protocols were frequent. Thus only subjects in the top row (A, B) and bottom row (D, E) of Figure~3 in \cite{GonzalezSales2012} were retained for our analyses.
As with the parameter estimation of the two previous sections, we define the function $N^{ch_{j}}_{dat}(t)$ from a spline fit to the data, where $j=A,B,D,E$ corresponds to each of the retained subjects. Likewise, the function $N^{ch_{j}}(t)$ was defined from the solution from the DDE solver \textit{ddesd} in Matlab \cite{Mathworks} for each patient. When the subject was administered two or more cycles of chemotherapy, we took time intervals corresponding to the first two cycles. Thus, the time spans differed for each subject-specific fitting procedure and were: $t_{span_{A}}=[0,43]$, $t_{span_{B}}=[0,41]$, $t_{span_{C}}=[0,47]$, and $t_{span_{D}}=[0,61]$. As explained in Section~\ref{sec:ParVals}, to account for each subject's baseline ANC, we adjust a scaling factor so our homeostasis $N^*$ value matches each individual's. We have previously shown the robustness of a similar model to pharmacokinetic interindividual and interoccasion variability which substantiates this adjustment and the use of average values in physiological models \cite{Craig2015b}. For each of the four patients, we define the integrals
\begin{equation}
\label{eq:L2chemo}
\frac{1}{| t_{span_{j}}|}\int_{\min(t_{span_{j}})}^{\max(t_{span_{j}})} N(t)^2dt,
\end{equation}
where $j=A,B,D,E$. To find average parameter values which fit to all four patients together, we further defined the average error in the $L^2$ function norm of \eq{eq:L2} between the simulated solutions and the data by
\begin{equation}
\label{eq:ChemoErr}
Err=\frac{1}{4}\sum_{j}\|N^{ch_{j}}(t)-N_{dat}^{ch_{j}(t)}\|_2^2.
\end{equation}
\begin{table}[!h]
\begin{center}
\begin{tabular}{|c|c|c|c|}\hline
Name & Value 1 & Value 2 & Units \\ \hline
$N_{elim}^{simp}$ & 0.71678 & 0.8 & $-$ \\
\hline
$N_{elim}$ & 0.6204 & 0.7033 & $-$ \\
\hline
$h_Q$ & 0.0071122 & 0.0079657 & $-$\\
$EC_{50}$ & 0.78235 & 0.72545 & ng/mL \\
$s_c$ & 0.90568 & 0.89816 & $-$ \\
$\eta_{N_{\!P}}^{inf}$ & 0 & 0 & days$^{-1}$\\
\hline
$Err$ & 0.17068 & 0.16965 & $-$\\
\hline
\end{tabular}
\end{center}
\caption{Results of the parameter estimation of chemotherapy effects values.}
\label{tab:ChemoValues}
\end{table}%
\begin{figure}[ht]
\begin{subfigure}[b]{0.5\linewidth}
\begin{center}
\includegraphics[width=0.9\linewidth]{ChemoFitFig1.eps}
\put(-163,100){\rotatebox[origin=c]{90}{$N_C(t)$}}
\put(-19,-6){Days}
\end{center}
\caption{Subject A}
\label{fig:ChemoParametersA}
\vspace{4ex}
\end{subfigure
\begin{subfigure}[b]{0.5\linewidth}
\begin{center}
\includegraphics[width=0.9\linewidth]{ChemoFitFig2.eps}
\put(-163,100){\rotatebox[origin=c]{90}{$N_C(t)$}}
\put(-19,-6){Days}
\end{center}
\caption{Subject B}
\label{fig:ChemoParametersB}
\vspace{4ex}
\end{subfigure}
\begin{subfigure}[b]{0.5\linewidth}
\begin{center}
\includegraphics[width=0.9\linewidth]{ChemoFitFig3.eps}
\put(-163,100){\rotatebox[origin=c]{90}{$N_C(t)$}}
\put(-19,-6){Days}
\end{center}
\caption{Subject D}
\label{fig:ChemoParametersC}
\end{subfigure
\begin{subfigure}[b]{0.5\linewidth}
\begin{center}
\includegraphics[width=0.9\linewidth]{ChemoFitFig4.eps}
\put(-163,100){\rotatebox[origin=c]{90}{$N_C(t)$}}
\put(-19,-6){Days}
\end{center}
\caption{Subject E}
\label{fig:ChemoParametersD}
\end{subfigure}
\caption{Results from the chemotherapy parameter fitting for $N_{elim}^{simp}=0.80$ parameters over two chemotherapy cycles. Model solutions were obtained using the parameters given in Table~\ref{tab:NeutrophilValues} and by simulating the full model \eq{eq:HSCs}-\eq{eq:nu}. Chemotherapeutic concentrations are obtained via \eq{eq:ChemoModel1} and \eq{eq:etaNPchemo}. Equation~\eq{eq:AQCraig} is replaced by \eq{eq:HSCchemo} and solved by using \eq{eq:dAQdt} Data and experimental protocols from Figure~3 of Gonz\`alez-Sales \cite{GonzalezSales2012}. Blue lines with data: digitised data, red solid lines: model solution.}
\label{fig:ChemoParameters}
\end{figure}
Parameters $h_Q$, $\eta_{N_{\!P}}^{inf}$, $s_c$, and $EC_{50}$ were then estimated using the \textit{lsqcurvefit} optimisation routine in Matlab \cite{Mathworks} and similarly averaged. These values are reported in Table~\ref{tab:ChemoValues} and the results of Figure~\ref{fig:ChemoParameters} were obtained from simulations using these parameters. For each of $h_Q$, $EC_{50}$, $s_c$, and $\eta_{N_{\!P}}^{inf}$, similar estimates were obtained for $N_{elim}^{simp}=0.71578$ and $N_{elim}^{simp}=0.8$, although the average error of $N_{elim}^{simp}=0.8$ is slightly smaller and was accordingly retained as optimal.
\clearpage
\section{Parameter Values}
\label{sec:ParVals}
Here we summarise the parameter values we use in the full model taken from experimental results and the fitting procedures described in Section~\ref{sec:ParEstim}. For the model to be self-consistent these parameters must be positive and satisfy the parameter constraints that we derived above, namely: \eq{eq:ftransratio}, \eq{eq:Constraint1},
\eq{eq:Constraint3}, \eq{eq:NdelConsist}, \eq{eq:tauNRstarConstr} and \eq{eq:muinterval}.
The main model parameters are stated in Table~\ref{tab:modelparams}.
For the stem cells we reuse parameter values for $Q^{*}$, $\gamma_Q$, $\tau_Q$,
$f_Q$, $s_2$ and $\beta(Q^{*})$ from previous modelling (sometimes rounding them to fewer significant figures).
The value of $\theta_2$ is obtained by evaluating \eq{eq:betaQ} at homeostasis and rearranging to
obtain
\begin{equation} \label{eq:theta2}
\theta_2=\left[\frac{(Q^{*})^{s_2}\beta(Q^{*})}{f_Q-\beta(Q^{*})}\right]^\frac{1}{s_2}.
\end{equation}
In Table~\ref{tab:modelparams} we quote a value of $\theta_2$ to five significant figures, but in our computations all parameters defined by formulae are evaluated to full machine precision. This ensures that
our differential equation model has a steady state exactly at the stated homeostasis values.
\begin{table}[ht!]
\noindent\mbox{}\hspace{-1cm}
\setlength{\tabcolsep}{2pt}
\begin{tabular}{|c|c|c|c|c|}
\hline
\!\!Name\!\! & Interpretation & Value & Units & Source \\ \hline
$\gamma_Q$ & HSC apoptosis rate & $0.1$ & \unit{days^{-1}} & \cite{Brooks2012,Craig2015} \\
$\tau_Q$ & Time for HSC re-entry & $2.8$ & \unit{days} & \!\cite{Mackey:01,Bernard2003,Lei:10,Craig2015}\! \\
$A_Q^*$ & HSC Amplification Factor & $1.5116^\dagger$ & $-$ & Eq.~\eq{eq:AQ} \\
$f_Q$ & Maximal HSC re-entry rate & $8$ & \unit{days^{-1}} & \cite{Bernard2003,Brooks2012,Craig2015} \\
$s_2$ & HSC re-entry Hill coefficient & $2$ & $-$ & \cite{Bernard2003,Brooks2012,Craig2015} \\
$\theta_2$ & Half-effect HSC concentration & $0.080863^\dagger$ & \unit{10^6 cells/kg} & Eq.~\eq{eq:theta2} \\ \hline
$\kappa_\delta$ & HSC differentiation rate to other lines & $0.014665^\dagger$ & \unit{days^{-1}} & Eq.~\eq{eq:kappaVals} \\
$\kappa^\textit{min}$ & HSC-neutrophil minimal differentiation rate & $0.0073325^\dagger$ & \unit{days^{-1}} & Eq.~\eq{eq:PDParamsDdet} \\
$\kappa^*$ & HSC-neutrophil homeo differentiation rate & \!\!$0.0073325^\dagger$\!\! & \unit{days^{-1}} & Eq.~\eq{eq:kappaVals}\\
$s_1$ & HSC-neutrophil differentiation Hill coefficient & $1.5$ & $-$ & Eq.~\eq{eq:s1} \\
\hline
$\eta_{N_{\!P}}^*$ & Neutrophil homeostasis effective proliferation rate & $1.6647^\dagger$ & \unit{days^{-1}} & Eq.~\eq{eq:etaNPval} \\
$b_{N_{\!P}}$ & Neutrophil proliferation M-M constant & $0.022868$ & \unit{ng/mL} & Fit Table~\ref{tab:NeutrophilValues} \\
$\eta_{N_{\!P}}^\textit{min}$ & Neutrophil minimal proliferation rate & $1.4060$ & \unit{days^{-1}} & Eq.~\eq{eq:PDParamsDdet} \\
$\tau_{N_{\!P}}$ & Neutrophil proliferation time & $7.3074^\dagger$ & \unit{days} & Eq.~\eq{eq:tauNP2} \\
\hline
$V_{max}$ & Maximal neutrophil maturation velocity & $7.8670$ & $-$ & Fit Table~\ref{tab:NeutrophilValues} \\
$b_V$ & maturation velocity half-effect concentration & $0.24611$ & \unit{ng/mL} & Eq.~\eq{eq:PDParamsDdet} \\
$a_{N_{\!M}}$ & Homeostasis neutrophil maturation time & $3.9$ & \unit{days} & \cite{Dancey1976,Hearn1998} \& \eq{eq:aNMtauNR} \\
$\gamma_{N_{\!M}}$ & Neutrophil death rate in maturation & $0.15769^\dagger$ & \unit{days^{-1}} & Eq. \eq{eq:gammaNMeq} \\
\hline
$\phi_{N_{\!R}}^*$ & Homeostasis Reservoir Release rate & $0.36400^\dagger$ & \unit{days^{-1}} & Eq. \eq{eq:ftransGstar} \\
$\phi_{N_{\!R}}^\textit{max}$ & Maximal Reservoir Release rate & $4.1335^\dagger$ & \unit{days^{-1}} & Eq.~\eq{eq:PDParamsDdet} \\
$b_G$ & Reservoir Release half-effect concentration & $1.8924\times10^{-4}$ & $-$ & Eq.~\eq{eq:PDParamsDdet} \\
$\gamma_{N_{\!R}}$ & Neutrophil death rate in reservoir & \!\!$0.0063661^\dagger$\!\! & \unit{days^{-1}} & Eq. \eq{eq:gammaNR} \\
\hline
$\gamma_N$ & Neutrophil Removal Rate from Circulation & $35/16$ & \unit{days^{-1}} & Eq. \eq{eq:tauNC} \\
\hline
$G_1^*$ & Homeostasis Free G-CSF Concentration & $0.025$ & \unit{ng/mL} & \cite{Watari1989,Kawakami1990,Barreda2004,Krzyzanski2010} \\
$G_{BF}^*$ & Homeostasis neutrophil receptor bound fraction & $1.5823\times10^{-5}$ & $-$ & Eq. \eq{eq:GBF} \\
$G_{\!\textit{prod}}$ & Endogenous G-CSF production rate & $0.014161^\dagger$ & \!\!\unit{ng/mL/day}\!\! & Eq. \eq{eq:Gprod}\\
$V$ & Bound G-CSF conversion factor & 0.525 & \!\!\unit{\frac{ng/mL}{10^9 cells/kg}}\!\! & Eq. \eq{eq:Vval}\\
$k_{ren}$ & G-CSF renal elimination rate & 0.16139 & \unit{days^{-1}} & \!\!Fit Table~\ref{tab:PKParams}\!\! \\
$k_{int}$ & G-CSF effective internalisation rate & 462.42 &
\unit{days^{-1}} & \!\!Fit Table~\ref{tab:PKParams}\!\! \\
$k_{12}$ & G-CSF Receptor binding coefficient & 2.2423 & {\tiny\unit{(ng/mL)^{-Pow}days^{-1}}} & \!\!Fit Table~\ref{tab:PKParams}\!\! \\
$k_{21}$ & G-CSF Receptor unbinding rate & 184.87 & \unit{days^{-1}} & \!\!Fit Table~\ref{tab:PKParams}\!\! \\
$\Pow$ & Effective G-CSF binding coefficient & 1.4608 & $-$ & \!\!Fit Table~\ref{tab:PKParams}\!\! \\
\hline
\end{tabular}
\caption{Model Parameters. $^\dagger$ -- these parameters are displayed to 5 significant figures here, but
the value is actually defined by the stated equation, and in simulations/computations we use the
stated formula to define the value to machine precision.}
\label{tab:modelparams}
\end{table}
\begin{table}[ht!]
\noindent\mbox{}\hspace{-2.25cm}
\setlength{\tabcolsep}{2pt}
\begin{tabular}{|c|c|c|c|c|}
\hline
Name & Interpretation & Value & Units & Source \\
\hline
$Q^{*}$ & HSC homeostasis concentration & $1.1$ & \unit{10^6 cells/kg} & \cite{Bernard2003,Lei:10,Craig2015} \\
$\beta(Q^{*})$ & HSC re-entry rate & $0.043$ & \unit{days^{-1}} & \cite{Mackey:01,Craig2015} \\
\hline
$N^{*}$ & Homeostasis Total Blood Neutrophil Pool & $0.22/0.585$ & \unit{10^9 cells/kg} & Eq.~\eq{eq:NhomeoVal} \\
$N_R^{*}$ & Homeostasis Neutrophil Reservoir Concentration & $2.26$ & \unit{10^9 cells/kg} & \cite{Dancey1976} \\
$N_P^*$ & Homeostasis Neutrophil Proliferation Concentration & $0.93$ & \unit{10^9 cells/kg} & Eq.~\eq{eq:NPNMVals} \\
$N_M^*$ & Homeostasis Neutrophil Maturation Concentration & $4.51$ & \unit{10^9 cells/kg} & Eq.~\eq{eq:NPNMVals} \\
\hline
$G_2^*$ & Homeostasis bound G-CSF concentration & $2.1899\times10^{-5}$ & \unit{ng/mL} & Eq.~\eq{eq:Gtwohomeo}\\ \hline
$\tau_{N_{\!R}}^*$ & Homoeostasis Neutrophil mean time in reservoir & $2.7$ & \unit{days} & \cite{Dancey1976,Hearn1998} \& \eq{eq:aNMtauNR} \\
$\tau_{N_C}^*$ & Homoeostasis Neutrophil mean time in circulation & $16/35$ & \unit{days} & \cite{Dancey1976} \\
$\tau_{1/2}$ & Circulating Neutrophil half-removal time & $7.6$ & \unit{hours} & \cite{Dancey1976} \\
\hline
$A_N^*$ & Homeostasis neutrophil proliferation+maturation amplification & $1.0378\times10^{5\dagger}$ & $-$ & Eq. \eq{eq:ANstar2} \\ \hline
$\tilde{b}_V$ & scaled maturation half-effect concentration & $0.031283$ & \unit{ng/mL} & Fit Table~\ref{tab:NeutrophilValues} \\ \hline
$\phi_{N_{\!R}}^\textit{ratio}$ & Ratio of maximal and homeostasis reservoir release rates & $11.356$ & $-$ & Fit Table~\ref{tab:NeutrophilValues} \\
$\phi_{N_{\!R}}(0)$ & Minimal reservoir release rate & $0.020056$ & \unit{days^{-1}} & Fit Table~\ref{tab:NeutrophilValues} \\ \hline
$\theta$ & Ratio of rate cells leave proliferation at knockout to homeostasis & $0.15096$ & $-$ & Eq.~\eq{eq:thetaval} \\
$C_{ko}$ & Knockout total blood neutrophil pool fraction & $0.25$ & $-$ & \cite{Bugl2012,Lui2013} \\
$\mu$ & Ratio of minimal and homeostasis proliferation rates & $0.84458$ & $-$ & Fit Table~\ref{tab:NeutrophilValues}\\ \hline
\end{tabular}
\caption{Auxiliary Parameters which are not in the model in Section~\ref{sec:Model}, but whose values are used to define other parameters. $^\dagger$ -- these parameters are displayed to 5 significant figures here, but
the value is actually defined by the stated equation, and in simulations/computations we use the
stated formula to define the value to machine precision.}
\label{tab:auxparams}
\end{table}
For the neutrophil parameters we mainly take experimental values from the work of Dancey~\cite{Dancey1976}
and use the formulae of Section~\ref{sec:NeutConstr} to determine the related model parameter values. However,
some choices and adjustments need to be made to ensure that the values are consistent with the model.
Dancey~\cite{Dancey1976} measured the circulating neutrophil pool to be $0.22\times\unit{10^9cells/kg}$
and the recovery rate to be $0.585$ from which we obtain the total blood neutrophil pool $N^{*}$ (including the
marginated pool) to be
\begin{equation} \label{eq:NhomeoVal}
N^{*}=\frac{0.22}{0.585}\approx 0.3761\times\unit{10^9cells/kg}.
\end{equation}
Since $N(t)$ measures the total blood neutrophil pool in units of \unit{10^9cells/kg} some care needs to
be taken when comparing to data, where absolute neutrophil counts (ANC) measure the circulating neutrophil
pool in units of
\unit{cell/\mu L}. Based on $70\unit{kg}$ of body mass and $5\unit{litres}$ of blood we have the default conversion
factor for healthy subjects of
\begin{equation} \label{eq:ANC}
ANC=0.585\times\frac{70}{5}\times1000\times N(t) = 8190\, N(t)\unit{cell/\mu L}.
\end{equation}
This gives a baseline homeostasis ANC of $8190N^{*}=3080\unit{cell/\mu L}$,
well within the accepted normal range of $1800-7000 \unit{cells/\mu L}$ \cite{Ryan2016}.
When comparing our model to data for individuals with different
baseline ANCs (as in Section~\ref{sec:ChemoEstimation}) we adjust the conversion factor \eq{eq:ANC}, but not the parameter values in our
model, so that $N^{*}$ gives the homeostasis ANC of the data.
Dancey~\cite{Dancey1976} measures the proliferation and maturation phases at homeostasis to
be $N_P^*=2.11\unit{\times10^9cells/kg}$ (mainly promyelocytes and myelocytes)
and $N_M^*=3.33\unit{\times10^9cells/kg}$ (metamyelocytes and bands). Using these numbers in the
calculations in Section~\ref{sec:NeutConstr} results in a proliferation time $\tau_{N_{\!P}}$ defined by
\eq{eq:tauNP2} of about $26$ days. In our model $\tau_{N_{\!P}}$ is the time from when the HSC first commits to
differentiate to the neutrophil line to the end of proliferation of the neutrophil
precursors. Although this time has never been definitively measured, $26$ days seems to be too long. This
is confirmed by the time to neutrophil replenishment in the blood after both allogenic and autologous stem cell transplantation \cite{Baiocchi1993,Cairo1992}, where circulating neutrophils are seen two weeks after the transplant.
We suspect that this overly long proliferation time results from the simplification in our model
of considering proliferation as a single homogenous process as detailed in Section~\ref{sec:PDEDerivation}.
\sloppy{To obtain a more realistic proliferation time of around a week, close to the $6.3 \unit{days}$
that Smith \cite{Smith2016} states, we keep the total of
$N_P^*+N_M^*=5.44\unit{\times10^9cells/kg}$ as found by Dancey~\cite{Dancey1976}, but redistribute cells between
proliferation and maturation and set}
\begin{equation} \label{eq:NPNMVals}
N_P^*=0.93\unit{\times10^9cells/kg}, \qquad N_M^*=4.51\unit{\times10^9cells/kg}.
\end{equation}
Dancey~\cite{Dancey1976} measured the half removal time of neutrophils from circulation to be $t_{1/2}=7.6\unit{hrs}$.
Accordingly, using \eq{eq:tauNC} and rounding, we set $\gamma_N=35/16=2.1875\unit{days^{-1}}$ and obtain
$\tau_{N_C}^*$ as the reciprocal of this. Then equation \eq{eq:MatApopRatCond} imposes the constraint that
$a_{N_{\!M}}<5.4823\unit{days}$. If we set $a_{N_{\!M}}=3.9\unit{days}$
close to the value of $3.8\unit{days}$
found by Hearn~\cite{Hearn1998}, then \eq{eq:tauNRstarConstr} imposes the constraint that
$\tau_{N_{\!R}}^*\in(1.9543,2.7472)$.
Hence we take
\begin{equation} \label{eq:aNMtauNR}
a_{N_{\!M}}=3.9\unit{days}, \qquad \tau_{N_{\!R}}^*=2.7\unit{days},
\end{equation}
so that both constraints are satisfied, and
$a_{N_{\!M}}+\tau_{N_{\!R}}^*=6.6\unit{days}$, the value given in \cite{Dancey1976}. The rest of the neutrophil homeostasis
parameters are calculated using the formulae of Section~\ref{sec:NeutConstr}, paying attention in \eq{eq:ANstar2} to
multiply $Q^{*}$ by $10^{-3}$ to convert it to the same units as $N_R^{*}$.
The G-CSF pharmacokinetic parameters are fit using the simplified G-CSF
model \eq{eq:UnboundGCSFsimp},\eq{eq:BoundGCSFsimp} as described in Section~\ref{sec:GCSFParameters}.
This produces multiple, but equally plausible, parameter sets but as described in subsequent sections not all of these result in good fits to data when we consider the neutrophil response of the full model \eq{eq:HSCs}-\eq{eq:nu}
to administrations of G-CSF or of chemotherapy. Consequently as stated in Section~\ref{sec:ChemoEstimation},
to obtain the best responses of the system to these scenarios we use the fourth
set of pharmacokinetic parameters from Table~\ref{tab:PKParams} which for the simplified G-CSF
model have $N_{elim}^{simp}=0.8$ to define $k_{ren}$, $k_{12}$, $k_{21}$, $k_{int}$ and $Pow$, as
well as the exogenous G-CSF parameters $V_d$, $F$, $k_a$ (where the last three are dose dependent).
Equations \eq{eq:Gtwohomeo}, \eq{eq:Gprod} and \eq{eq:Nelim} then define $G_2^*$, $G_{prod}$ and $N_{elim}=0.7033$
for the full model.
At G-CSF knockout, from \cite{Bugl2012,Lui2013} we have $C_{ko}\in[0.2, 0.3]$, so it is natural to set $C_{ko}=0.25$.
For the pharmacodynamic parameters, similar to $Pow$, arguments could be made for choosing $s_1=1$ or $s_1=2$,
but having fit $Pow$ and finding it close to $1.5$, we will simply set
\begin{equation} \label{eq:s1}
s_1=1.5
\end{equation}
to reduce the number of parameters that need to be fit by one. The remaining pharmacodynamic
parameters $\mu$, $b_{N_{\!P}}$, $V_{max}$, $\tilde{b}_V$, $\phi_{N_{\!R}}(0)$ and $\phi_{N_{\!R}}^{ratio}$ were
then fit as described in Section~\ref{sec:NeutFit}, with these parameters defining values of
the dependent parameters
$\eta_{N_{\!P}}^{min}$, $\phi_{N_{\!R}}^{max}$, $b_V$ and $b_G$ via \eq{eq:PDParamsDdet}. From Section~\ref{sec:KO} we also obtain values for $\theta$ from \eq{eq:thetaval}
and $\kappa^\textit{min}$ from \eq{eq:PDParamsDdet}. Each set of kinetic parameters from Table~\ref{tab:PKParams}
defines a different set of pharmacodynamic parameters as reported in Table~\ref{tab:NeutrophilValues},
but as noted already we prefer the parameter set for
$N_{elim}^{simp}=0.80$ which corresponds to $N_{elim}=0.7033$.
The full set of parameter values for our combined neutrophil and G-CSF model \eq{eq:HSCs}-\eq{eq:nu} are given in Table~\ref{tab:modelparams}, along with their units, interpretation and source.
Since some of these parameters are defined by equations involving auxiliary parameters that do not
explicitly appear in the full model we state these parameters and their source in Table~\ref{tab:auxparams}. Parameters related to the pharmacokinetics and pharmacodynamics of both of the exogenous drugs which have not previously been stated are given in Table~\ref{tab:exodrugs}.
\begin{table}[ht!]
\begin{center}
\setlength{\tabcolsep}{2pt}
\begin{tabular}{|c|c|c|c|c|}
\hline
Name & Interpretation & Value & Units & Source \\
\hline
\multicolumn{5}{|c|}{Filgrastim} \\ \hline
\multicolumn{5}{|c|}{300 \unit{mcg} dose} \\ \hline
$V_d$ & Volume of distribution & 4754.7 & \unit{mL} & Fit Table~\ref{tab:PKParams} \\
$F$ & Bioavailable fraction & 0.64466 & $-$ & Fit Table~\ref{tab:PKParams}\\
$k_a$ & Subcutaneous rate of absorption & 8.0236 & \unit{days^{-1}} & Fit Table~\ref{tab:PKParams}\\\hline
\multicolumn{5}{|c|}{375 \unit{mcg} dose} \\ \hline
$V_d$ & Volume of distribution & 2322.9 & \unit{mL} & Fit Table~\ref{tab:PKParams} \\
$F$ & Bioavailable fraction & 0.49964 & $-$ & Fit Table~\ref{tab:PKParams}\\
$k_a$ & Subcutaneous rate of absorption & 6.6133 & \unit{days^{-1}} & Fit Table~\ref{tab:PKParams}\\
\hline
\multicolumn{5}{|c|}{750 \unit{mcg} dose} \\ \hline
$V_d$ & Volume of distribution & 2178.0 & \unit{mL} & Fit Table~\ref{tab:PKParams} \\
$F$ & Bioavailable fraction & 0.75 & $-$ & Fit Table~\ref{tab:PKParams}\\
$k_a$ & Subcutaneous rate of absorption & 5.143 & \unit{days^{-1}} & Fit Table~\ref{tab:PKParams}\\
\hline
\multicolumn{5}{|c|}{Zalypsis\textsuperscript{\textregistered}} \\ \hline
$k_{fp}$ & Rate of exchange from compartment $f$ to $p$ & 18.222& \unit{days^{-1}} & \cite{PerezRuixo2012}\\
$k_{sl_{1}p}$ & Rate of exchange from compartment $sl_1$ to $p$ & 0.6990 & \unit{days^{-1}} & \cite{PerezRuixo2012}\\
$k_{pf}$ & Rate of exchange from compartment $p$ to $f$ & 90.2752 & \unit{days^{-1}} & \cite{PerezRuixo2012}\\
$k_{psl_{1}}$ & Rate of exchange from compartment $p$ to $sl_1$ & 8.2936 & \unit{days^{-1}} & \cite{PerezRuixo2012}\\
$k_{el_{C}}$ & Rate of elimination & 132.0734 & \unit{days^{-1}} & \cite{PerezRuixo2012}\\
$k_{sl_{2}f}$ & Rate of exchange from compartment $sl_2$ to $f$ & 62.5607 & \unit{days^{-1}} & \cite{PerezRuixo2012}\\
$k_{fsl_{2}}$ & Rate of exchange from compartment $f$ to $sl_2$ & 9.2296 & \unit{days^{-1}} & \cite{PerezRuixo2012}\\
BSA & Body surface area & 1.723 & \unit{m^2} & \cite{PerezRuixo2012}\\
$h_Q$ & Effect of chemotherapy on $Q(t)$ & 0.0079657 & $-$ & Fit Table~\ref{tab:ChemoValues} \\
$EC_{50}$ & Half-maximal effect of chemotherapy on $\eta_{N_{\!P}}$ & 0.75390 & $-$ & Fit Table~\ref{tab:ChemoValues} \\
$s_c$ & Chemotherapy effect Hill coefficient & 0.89816 & $-$ & Fit Table~\ref{tab:ChemoValues} \\
$\eta_{N_{\!P}}^{inf}$ & Proliferation rate with infinite chemotherapy dose & 0 & \unit{days^{-1}}& Fit Table~\ref{tab:ChemoValues}\\
\hline
\end{tabular}
\caption{Exogenous drug administration parameters determined by parameter fitting as explained in Sections~\ref{sec:GCSFParameters} and \ref{sec:ChemoEstimation}. For Zalpysis\textsuperscript{\textregistered}, $p$: plasma/central compartment, $f$: fast-exchange tissues, $sl_1$: first slow-exchange tissues, $sl_2$: second slow-exchange tissues.}
\label{tab:exodrugs}
\end{center}
\end{table}
\section{Model evaluation and functional responses}
\label{sec:ModelEvaluation}
\sloppy{Having estimated the G-CSF pharmacokinetic, homeostasis related, and chemotherapy pharmacodynamic parameters individually as described in Sections~\ref{sec:GCSFParameters}, \ref{sec:NeutFit}, and \ref{sec:ChemoEstimation}, a convincing evaluation of the ability of the model is to successfully predict data obtained during the concurrent administration of both exogenous drugs. For this, as in \cite{Craig2015}, we simulated the CHOP14 protocol described in \cite{Pfreundschuh2004a} and \cite{Pfreundschuh2004b} which includes the administration of both chemotherapy and exogenous G-CSF. Although the chemotherapeutic drug modelled in Section~\ref{sec:exogcsf} is not part of the combination therapy of the CHOP14 regimen, the cytotoxic effects of the anticancer drugs are presumed to be similar. To compare to the CHOP14 data published in \cite{Krinner2013}, we simulated a regimen of six cycles of 14-day periodic chemotherapeutic treatment with rhG-CSF treatment beginning four days after the administration of chemotherapy and continuing for ten administrations per cycle. As in \cite{Craig2015}, the simulated dose of 4 $\mu$g of Zalypsis\textsuperscript{\textregistered} was selected from the optimal regimens identified in \cite{GonzalezSales2012} and per the CHOP14 protocol outlined in \cite{Pfreundschuh2004a,Pfreundschuh2004b}, ten 300 $\mu$g doses of subcutaneous G-CSF were simulated per cycle. The lower dose of 300 $\mu$g was selected since we assumed an average weight of 70kg per patient throughout.}
\begin{figure}[ht]
\begin{center}
\includegraphics[scale=1]{CHOP14Comparison.eps}
\put(-325,210){\rotatebox[origin=c]{90}{$N_C(t)$}}
\put(-20,-7){Days}
\end{center}
\caption{Comparison of the predicted neutrophil response to the CHOP14 protocol \cite{Pfreundschuh2004a,Pfreundschuh2004b} for $N_{elim}^{simp}=0.80$. In this regimen, 4 $\mu$g of Zalypsis\textsuperscript{\textregistered} given by a 1 hour IV infusion is administered 14 days apart, beginning on day 0, for 6 cycles (84 days total). Per cycle, ten administrations of 300 $\mu$g subcutaneous doses of filgrastim are given beginning four days after the start of the chemotherapeutic cycle and continuing to day 13 post-chemotherapy. The simulation is compared to data from \cite{Krinner2013}, presented in quartiles. In pale green: the first quartile, in pale pink: median range, in pale blue: third quartile. Black line with sampling points: model prediction sampled every day at clinical sampling points, solid purple line: full model prediction.}
\label{fig:CHOP}
\end{figure}
\begin{figure}[ht]
\begin{subfigure}[b]{0.5\linewidth}
\begin{center}
\includegraphics[width=0.9\linewidth]{StemCellsCHOP.eps}
\put(-163,96){\rotatebox[origin=c]{90}{$Q(t)$}}
\put(-20,-7){Days}
\end{center}
\caption{}
\label{fig:OtherPopsCHOPA}
\vspace{4ex}
\end{subfigure
\begin{subfigure}[b]{0.5\linewidth}
\begin{center}
\includegraphics[width=0.9\linewidth]{ReservoirCHOP.eps}
\put(-163,94){\rotatebox[origin=c]{90}{$N_R(t)$}}
\put(-20,-7){Days}
\end{center}
\caption{}
\label{fig:OtherPopsCHOPB}
\vspace{4ex}
\end{subfigure}
\begin{subfigure}[b]{0.5\linewidth}
\begin{center}
\includegraphics[width=0.9\linewidth]{UnboundGCSFCHOP.eps}
\put(-163,93){\rotatebox[origin=c]{90}{$G_1(t)$}}
\put(-20,-7){Days}
\end{center}
\caption{}
\end{subfigure}
\begin{subfigure}[b]{0.5\linewidth}
\begin{center}
\includegraphics[width=0.9\linewidth]{BoundGCSFCHOP.eps}
\put(-163,93){\rotatebox[origin=c]{90}{$G_2(t)$}}
\put(-20,-7){Days}
\end{center}
\caption{}
\end{subfigure
\caption{Model responses to the CHOP14 protocol as described in Section~\ref{sec:ModelEvaluation}. In a) $Q(t)$ over the six CHOP cycles detailed above, b), c), and d) $N_R(t)$, $G_1(t)$, and $G_2(t)$ over three CHOP cycles.}
\label{fig:OtherPopsCHOP}
\end{figure}
\begin{figure}[ht!]
\begin{subfigure}[b]{0.5\linewidth}
\begin{center}
\includegraphics[width=0.9\linewidth]{kappaN.eps}
\put(-163,90){\rotatebox[origin=c]{90}{$\kappa(G_1)$}}
\put(-22,-8){$G_1$}
\end{center}
\caption{}
\label{fig:FunctionResponsesA}
\vspace{4ex}
\end{subfigure
\begin{subfigure}[b]{0.5\linewidth}
\begin{center}
\includegraphics[width=0.9\linewidth]{etaNP.eps}
\put(-163,85){\rotatebox[origin=c]{90}{$\eta_{N_{\!P}}(G_1)$}}
\put(-22,-8){$G_1$}
\end{center}
\caption{}
\label{fig:FunctionResponsesB}
\vspace{4ex}
\end{subfigure}
\begin{subfigure}[b]{0.5\linewidth}
\begin{center}
\includegraphics[width=0.933\linewidth]{etaNPchemo.eps}
\put(-171,70){\rotatebox[origin=c]{90}{$\eta_{N_{\!P}}^{chemo}(G_1^*,C_p)$}}
\put(-22,-8){$C_p$}
\end{center}
\caption{}
\label{fig:FunctionResponsesC}
\vspace{4ex}
\end{subfigure}
\begin{subfigure}[b]{0.5\linewidth}
\begin{center}
\includegraphics[width=0.9\linewidth]{Vn.eps}
\put(-163,85){\rotatebox[origin=c]{90}{$V_{\!N_{\!M\!}}(G_1)$}}
\put(-22,-8){$G_1$}
\end{center}
\caption{}
\label{fig:FunctionResponsesD}
\vspace{4ex}
\end{subfigure
\begin{subfigure}[b]{0.5\linewidth}
\begin{center}
\includegraphics[width=0.9\linewidth]{ftrans.eps}
\put(-163,88){\rotatebox[origin=c]{90}{$\phi_{N_{\!R}}(G_{BF})$ }}
\put(-87,2){$G_{BF}$}
\end{center}
\caption{}
\label{fig:FunctionResponsesE}
\end{subfigure}
\caption{Visualisation of the granulopoiesis model's mechanisms as functions of their variables (solid blue lines) with their respective homeostatic and half-effect values (purple triangles), when relevant. Red circles: homeostasis values. }
\label{fig:FunctionResponses}
\end{figure}
Figure~\ref{fig:CHOP} shows the result of the neutrophil response comparison of the model's prediction to the clinical data. Unlike experimental settings where information on the HSCs, the marrow neutrophils, and the bound G-CSF concentrations are unavailable, the model's solutions for $Q(t)$, $N_R(t)$, and $G_2(t)$ are easily obtainable and provide insight into not only the mechanisms responsible for myelosuppresion during chemotherapy, but also ways in which this toxicity might be avoided. In Figure~\ref{fig:OtherPopsCHOP}, the HSCs, neutrophils in the marrow reservoir, and bound and unbound G-CSF are all seen to converge to periodic responses. However, while the reduction in HSC concentrations is minimal (Figure~\ref{fig:OtherPopsCHOPA}) the neutrophil marrow reservoir is seen in Figure~\ref{fig:OtherPopsCHOPB} to become severely depleted. This depletion is caused by the delayed effects of the administration of chemotherapy but also the rapid transit of cells from the reservoir into the blood caused by the introduction of exogenous G-CSF four days post-chemotherapy (see Figure~\ref{fig:FunctionResponsesE} below). This in turn prevents ANC recoveries from depressed values, despite the administration of G-CSF. As in \cite{Vainstein2005} and \cite{Craig2015}, it is likely that delaying the beginning of prophylactic G-CSF support during chemotherapy would help to combat myelosuppresion, but this will is a future avenue of investigation.
It can also be illuminating to study how each of the model's functions correspond to the estimated parameters to obtain further insight on the mechanisms of granulopoiesis. Figure~\ref{fig:FunctionResponses} shows the functions $\kappa (G_1)$, $\eta_{N_{\!P}} (G_1)$, $\eta_{N_{\!P}}^{chemo}(G_1)$, $V_{\!N_{\!M\!}}(G_1)$, and $\phi_{N_{\!R}} (G_{BF})$ and identifies their respective homeostatic levels. We can see that $\phi_{N_{\!R}} (G_{BF}$) in Figure~\ref{fig:FunctionResponsesE}, has a homeostasis concentration $\phi_{N_{\!R}}(G_{BF}^*)$ very close to $\phi_{N_{\!R}}(0)$. This reflects the ability of the granulopoietic system to respond rapidly in the case of emergencies \cite{Rankin2010} but also supports the hypothesis that early prophylactic support with G-CSF during chemotherapy may hasten the emptying of the reservoir due to the responsiveness of $\phi_{N_{\!R}} (G_{BF}(t))$ in particular.
\section{Discussion}
\label{sec:Discussion}
Clinically relevant translational models in medicine must not only accurately depict different and independent treatment regimes \cite{Vainstein2005}, they must also be able to reconstruct homeostatic and pathological cases which may be intervention independent. The granulopoiesis model we have developed is physiologically-relevant and, perhaps most importantly, provides insight beyond that which is clinically measurable. The updated pharmacokinetic model of G-CSF, novel in that it explicitly accounts for unbound and bound concentrations, correctly accounts for G-CSF dynamics whereas previous one compartment models all resulted in renal dominated dynamics. The new pharmacokinetic model also further allows us to comment on the principle mechanisms driving the production of neutrophils. Although the relatively small number of neutrophil progenitors do not have a significant effect on G-CSF kinetics, our results suggest that differentiation, proliferation and maturation speed are driven primarily by signalling from G-CSF bound to neutrophil progenitors, and not from signalling of G-CSF bound to mature neutrophils. We can further characterise the principle processes governing myelosuppression during the concurrent administration of chemotherapy and prophylactic G-CSF, which we have determined lies in the simultaneous depletion of the marrow reservoir by high doses of exogenous G-CSF combined with fewer neutrophils reaching the reservoir due to the cytotoxicity of the anti-cancer drug.
The modelling reported here combines a number of original approaches to the conceptualisation of physiological, pharmacokinetic, and pharmacodynamics models and to the estimation of parameters and model verification. For example, traditional least squares estimation was redefined using functions which ensured robustness and allowed for comparisons of predictions to data over richly sampled intervals instead of at fewer data points. Moreover, the model's physiological realism served as a means of evaluating the suitability of optimised parameter values so we were not relying solely on goodness-of-fit, which can obfuscate the biological relevance of results \cite{vanderGraaf2011}. The inclusion of the detailed characterisations of physiological mechanisms in our model therefore serves as a litmus test of suitability in addition to providing intuition about the processes driving granulopoiesis.
The broader implications of the approaches outlined in this work extend into various domains. The derivation of a delay differential equation model with variable aging rate from an age-structured PDE, as described in Section~\ref{sec:PDEDerivation}, is mathematically significant and its intricate nature has previously led to previous modelling errors. As mentioned, the fitting procedures outlined in Sections~\ref{sec:GCSFParameters}, \ref{sec:NeutFit}, and \ref{sec:ChemoEstimation} motivate the development of more refined least squares methods and parameter estimation techniques. Additionally, the novel pharmacokinetic model of G-CSF has ramifications with respect to the usual approaches used by PK/PD modellers. The mischaracterisation of the elimination dynamics, despite the inclusion of internalisation terms, has led to models which contradict what is known of the physiology. While they can characterise certain clinical situations, like the single administration of exogenous G-CSF, they fail when applied to more complex scenarios. Without accounting for the entire process of neutrophil development or using physiological rationale for a model's parameters, one is unable to judge whether a model captures the complicated dynamics of granulopoiesis. In the model we have developed, we have ensured the accuracy of its predictions and the appropriateness of its parameters through careful construction. In turn, this rational approach has implications for the clinical practice where it can serve to optimise dosing regimens in oncological settings and also serve to pinpoint the origins of dynamical neutrophil disorders like cyclic neutropenia, ultimately contributing to the improvement of patient care and outcomes.
\section*{Acknowledgements}
ARH and MCM are grateful to the National Science and Engineering Research Council (NSERC), Canada for funding through the Discovery Grant program. MC wishes to thank NSERC for funding from the PGS-D program. We are grateful to Fahima Nekka, Jun Li, Jacques B\'elair, and David Dale for their insight and support.
\bibliographystyle{plain}
| {'timestamp': '2015-12-23T02:01:18', 'yymm': '1512', 'arxiv_id': '1512.06896', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06896'} | arxiv |
\section{Introduction}
The family of quasi-cyclic codes over finite fields is an important class of linear block codes, which is---in contrast to cyclic codes---known to be asymptotically good (see, e.g., Chen~\textit{et al.}~\cite{chen_results_1969}).
Several quasi-cyclic codes have the highest minimum Hamming distance for a given length and dimension (see, e.g., Gulliver and Bhargava~\cite{gulliver_best_1991} as well as Chen's and Grassl's databases~\cite{chen_database_2014,grassl_bounds_2007}). Many good LDPC codes are quasi-cyclic (see, e.g.,~\cite{butler_bounds_2013}) and the connection to convolutional codes was investigated among others in~\cite{solomon_connection_1979,esmaeili_link_1998,lally_algebraic_2006}.
Recent works of Barbier~\textit{et al.}~\cite{barbier_quasi-cyclic_2012, barbier_decoding_2013}, Lally and Fitzpatrick~\cite{lally_algebraic_2001, lally_quasicyclic_2003, lally_algebraic_2006}, Ling and Solé~\cite{ling_algebraic_2001, ling_algebraic_2003, ling_algebraic_2005}, Semenov and Trifonov~\cite{semenov_spectral_2012} and Güneri and Özbudak~\cite{guneri_bound_2012} discuss different aspects of the algebraic structure of quasi-cyclic codes. Although several of these works~\cite{barbier_quasi-cyclic_2012, barbier_decoding_2013,lally_algebraic_2001, lally_quasicyclic_2003, lally_algebraic_2006,ling_algebraic_2001, ling_algebraic_2003, ling_algebraic_2005, semenov_spectral_2012,guneri_bound_2012} propose new lower bounds on the minimum Hamming distance, their estimates are still far away from the real minimum distance, and therefore, it is an open issue to find better bounds and in addition to develop efficient algebraic decoding approaches.
The work of Wasan~\cite{wasan_quasi_1977} considers quasi-cyclic product codes while investigating the mathematical properties of the wider class of quasi-abelian codes. Some more results were published in a short note by Wasan and Dass~\cite{dass_note_1983}. Koshy proposed a so-called ``circle'' quasi-cyclic product code in~\cite{koshy_quasi-cyclic_1972}.
This work provides the generator matrix of an $\ensuremath{\ell_{A}} \ensuremath{\ell_{B}}$-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ based on the given reduced Gröbner basis (RGB) representation of Lally and Fitzpatrick~\cite{lally_algebraic_2001} of the $\ensuremath{\ell_{A}}$-quasi-cyclic row-code $\ensuremath{\mathcal{A}}$ and the $\ensuremath{\ell_{B}}$-quasi-cyclic column-code $\ensuremath{\mathcal{B}}$. This generalizes the results of Burton and Weldon~\cite{burton_cyclic_1965} and Lin and Weldon~\cite{lin_further_1970} for the generator polynomial of a cyclic product code (see also~\cite[Chapter 18]{macwilliams_theory_1988}). The generator matrix in Pre-RGB/POT form of an $\ensuremath{\ell_{A}} \ensuremath{\ell_{B}}$-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ is derived for two special cases: (i) for $\ensuremath{\ell_{A}}=2$ and $\ensuremath{\ell_{B}}=1$, and (ii) if the row-code $\ensuremath{\mathcal{A}}$ is a $1$-level $\ensuremath{\ell_{A}}$-quasi-cyclic code and $\ensuremath{\ell_{B}}=1$. We conjecture the basis of $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ for arbitrary $\ensuremath{\ell_{A}}$ and $\ensuremath{\ell_{B}}$.
We apply the spectral analysis of Semenov and Trifonov~\cite{semenov_spectral_2012} to the generator matrix in Pre-RGB/POT form of an $\QCCl$-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$, where $\ensuremath{\mathcal{A}}$ is an $\QCCl$-quasi-cyclic code and $\ensuremath{\mathcal{B}}$ is a cyclic code. Moreover, we propose a new lower bound $\ensuremath{d^{\ast}}$ on the minimum Hamming distance of a given $\QCCl$-quasi-cyclic code $\ensuremath{\mathcal{A}}$ via embedding $\ensuremath{\mathcal{A}}$ into an $\QCCl$-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$. This embedding approach provides an efficient syndrome-based algebraic decoding algorithm that guarantees to decode up to $\lfloor (\ensuremath{d^{\ast}}{-}1)/2 \rfloor$ $\QCCl$-phased burst errors.
The paper is structured as follows. We introduce basic notation, recall relevant parts of the Gröbner basis theory for quasi-cyclic codes of Lally and Fitzpatrick~\cite{lally_algebraic_2001} and the spectral analysis technique of Semenov and Trifonov~\cite{semenov_spectral_2012} in Section~\ref{sec_Preliminaries}. Section~\ref{sec_ProductQCCQCC} covers elementary properties of quasi-cyclic product codes and our main theorem (Thm.~\ref{theo_ProductCodeQCCQCCUnred}) on the (unreduced) basis of an $\ensuremath{\ell_{A}} \ensuremath{\ell_{B}}$-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$, in terms of the two given generator matrices in RGB/POT form of the $\ensuremath{\ell_{A}}$-quasi-cyclic row-code $\ensuremath{\mathcal{A}}$ and the $\ensuremath{\ell_{B}}$-quasi-cyclic column-code $\ensuremath{\mathcal{B}}$, is proven. The generator matrix of a quasi-cyclic product code is derived for two special cases. The first case is a $2$-quasi-cyclic product code of a $2$-quasi-cyclic and a cyclic code and its generator matrix in Pre-RGB/POT form is proposed in Thm.~\ref{theo_ProductCode2-QCCTimesCyclic}. Thm.~\ref{theo_OneLevelQC} gives the RGB form for the second case, i.e., an $\QCCl$-quasi-cyclic product code of a $1$-level $\QCCl$-quasi-cyclic and a cyclic code. The explicit expression of the generator matrix of $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ in Pre-RGB/POT form for arbitrary $\ensuremath{\ell_{A}}$ and $\ensuremath{\ell_{B}}$ is presumed in Conjecture~\ref{conj_ProductCodeQCCQCC}, which we verified through reducing the unreduced basis of several examples.
Although we could prove the RGB/POT form of the generator matrix of a quasi-cyclic product code only for the previously mentioned cases (Thm.~\ref{theo_ProductCode2-QCCTimesCyclic} and Thm.~\ref{theo_OneLevelQC}), we perform the spectral analysis for the instance of an $\QCCl$-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$, where $\ensuremath{\mathcal{A}}$ is an $\QCCl$-quasi-cyclic and $\ensuremath{\mathcal{B}}$ is a cyclic code in Section~\ref{sec_SpectralAnalysis} based on Conjecture~\ref{conj_ProductCodeQCCQCC}. The new lower bound $\ensuremath{d^{\ast}}$ is proposed in Section~\ref{subsec_BoundingDistance}. Section~\ref{sec_Decoding} contains our syndrome-based decoding algorithm with guaranteed $\QCCl$-phased burst error-correcting radius $\lfloor (\ensuremath{d^{\ast}}-1)/2 \rfloor$. We conclude the paper in Section~\ref{sec_conclusion}.
\section{Preliminaries} \label{sec_Preliminaries}
\subsection{Notation and Reduced Gröbner Basis (RGB)}
Let $\F{q}$ denote the finite field of order $q$, $\Fx{q}$ the polynomial ring over $\F{q}$ with indeterminate $X$, and $\F{q}^n$ the linear vector space over $\F{q}$ of dimension $n$. The entries of a vector $\vec{v} \in \F{q}^n$ are indexed from zero to $n{-}1$, i.e., $\vec{v} = (v_0 \ v_1 \ \cdots \ v_{n-1})$.
For two vectors $\vec{v}, \vec{w} \in \F{q}^n$, the scalar product $\sum_{i=0}^{n-1} v_i w_i$ is denoted by $\vec{v} \circ \vec{w}$. For two positive integers $a, b$ with $b > a$ the set of integers $\{a,a+1,\dots,b-1\}$ is denoted by $\interval{a,b}$ and we define the short-hand notation $\interval{b} \overset{\defi}{=} \interval{0,b}$. An $m \times n$ matrix $\mathbf{M} \in \F{q}^{m \times n}$ is denoted as $\mathbf{M} = (m_{i,j})_{i \in \interval{m}}^{j \in \interval{n}}$ or where the size follows from the context, we use the short-hand notation $(m_{i,j})$.
A linear $\LIN{\QCCl \cdot \QCCm}{\QCCk}{\QCCd}{q}$ code $\ensuremath{\mathcal{C}}$ of length $\QCCl \QCCm$, dimension $\QCCk$, and minimum Hamming distance $\QCCd$ over $\F{q}$ is $\QCCl$-quasi-cyclic if every cyclic shift by $\QCCl$ of a codeword is again a codeword of $\ensuremath{\mathcal{C}}$, more explicitly if:
\begin{align*}
(c_{0,0} \ \cdots \ c_{\QCCl-1,0} \ c_{0,1} \ \cdots \ c_{\QCCl-1,1} \ \cdots \ c_{0,\QCCm-1} & \ \cdots \ c_{\QCCl-1,\QCCm-1}) \in \ensuremath{\mathcal{C}} \Rightarrow \\
& (c_{0,\QCCm-1} \ \cdots \ c_{\QCCl-1,\QCCm-1} \ c_{0,0} \ \cdots \ c_{\QCCl-1,0} \ \cdots \ c_{0,\QCCm-2} \ \cdots \ c_{\QCCl-1,\QCCm-2}) \in \ensuremath{\mathcal{C}}.
\end{align*}
We can represent a codeword of an $\LIN{\QCCl \cdot \QCCm}{\QCCk}{\QCCd}{q}$ $\QCCl$-quasi-cyclic code $\ensuremath{\mathcal{C}}$ as $\mathbf{c}(X) = (c_0(X) \ c_1(X) \ \cdots \ c_{\QCCl-1}(X)) \in \Fx{q}^{\ell} $, where each entry is given by
\begin{equation} \label{eq_QCCComponents}
c_j(X) \overset{\defi}{=} \sum_{i=0}^{\QCCm-1} c_{j,i} X^{i}, \quad \forall j \in \interval{\QCCl}.
\end{equation}
Then, the defining property of the $\QCCl$-quasi-cyclic code $\ensuremath{\mathcal{C}}$ is that it is closed under multiplication by $X$ modulo $(X^{\QCCm}-1)$ in each entry.
\begin{lemma}[Codeword Representation: Vector to Univariate Polynomial] \label{lem_VectorToUnivariatePoly}
Let $(c_0(X) \ c_1(X) \ \cdots \ c_{\QCCl-1}(X))$ be a codeword of an $\LIN{\QCCl \cdot \QCCm}{\QCCk}{\QCCd}{q}$ $\QCCl$-quasi-cyclic code $\ensuremath{\mathcal{C}}$, where the entries are defined as in \eqref{eq_QCCComponents}. Then a codeword in $\ensuremath{\mathcal{C}}$, represented as one univariate polynomial of degree smaller than $\QCCl \QCCm$, is
\begin{equation} \label{eq_VectorToUnivariatePoly}
c(X) = \sum_{j=0}^{\QCCl-1} c_j(X^{\QCCl})X^j.
\end{equation}
\end{lemma}
\begin{proof}
Substituting~\eqref{eq_QCCComponents} into~\eqref{eq_VectorToUnivariatePoly} leads to:
\begin{align*}
c(X) & = \sum_{j=0}^{\QCCl-1} c_j(X^{\QCCl})X^j = \sum_{j=0}^{\QCCl-1} \sum_{i=0}^{\QCCm-1} c_{j,i} X^{i\QCCl+j}.
\end{align*}
\end{proof}
Lally and Fitzpatrick~\cite{lally_construction_1999, lally_algebraic_2001} showed that an $\QCCl$-quasi-cyclic code $\ensuremath{\mathcal{C}}$ can be viewed as an $R$-submodule of the algebra $R^{\QCCl}$, where $R = \Fx{q}/\langle X^{\QCCm}-1 \rangle$. The code $\ensuremath{\mathcal{C}}$ is the image of an $\Fx{q}$-submodule $\tilde{\ensuremath{\mathcal{C}}}$ of $\Fx{q}^{\QCCl}$ containing
\begin{equation*}
\ensuremath{\tilde{K}} = \left \langle (X^{\QCCm}-1)\mathbf{e}_j, j \in \interval{\QCCl} \right \rangle,
\end{equation*}
where $\mathbf{e}_j \in \Fx{q}^{\QCCl}$ is the standard basis vector with one in position $j$ and zero elsewhere under the natural homomorphism
\begin{equation} \label{eq_Homorphism}
\begin{split}
\phi: \; \Fx{q}^{\QCCl} & \rightarrow R^{\QCCl} \\
(c_0(X) \ \cdots \ c_{\QCCl-1}(X)) & \mapsto (c_0(X) + \langle X^{\QCCm}-1 \rangle \ \cdots \ c_{\QCCl-1}(X) +\langle X^{\QCCm}-1 \rangle ).
\end{split}
\end{equation}
The submodule has a generating set of the form $\{ \mathbf{u}_i, i \in \interval{z}, (X^{\QCCm}-1)\mathbf{e}_j, j \in \interval{\QCCl} \}$, where $\mathbf{u}_i \in \Fx{q}^{\QCCl}$ and $z \leq \QCCl$ (see, e.g.,~\cite[Chapter 5]{cox_using_1998} for further information) and can be represented as a matrix with entries in $\Fx{q}$:
\begin{equation} \label{eq_GeneratorWithBasis}
\mathbf{U}(X) =
\begin{pmatrix}
u_{0,0}(X) & u_{0,1}(X) & \cdots & u_{0,\QCCl-1}(X) \\
u_{1,0}(X) & u_{1,1}(X) & \cdots & u_{1,\QCCl-1}(X) \\
\vdots & \vdots & \ddots & \vdots \\
u_{z-1,0}(X) & u_{z-1,1}(X) & \cdots & u_{z-1,\QCCl-1}(X) \\
X^{\QCCm}-1 & & \\
& X^{\QCCm}-1 & \multicolumn{2}{c}{\bigzero} \\
\multicolumn{2}{c}{\bigzero} & \ddots \\
& & & X^{\QCCm}-1
\end{pmatrix}.
\end{equation}
Every matrix $\mathbf{U}(X)$ as in~\eqref{eq_GeneratorWithBasis} of an $\QCCl$-quasi-cyclic code $\ensuremath{\mathcal{C}}$ can be transformed to a reduced Gröbner basis (RGB) with respect to the position-over-term order (POT) in $\Fx{q}^{\QCCl}$ (as shown in~\cite{lally_construction_1999, lally_algebraic_2001}).
A basis in RGB/POT form can be represented by an upper-triangular $\ell \times \ell$ matrix with entries in $\Fx{q}$ as follows:
\begin{equation} \label{def_GroebBasisMatrix}
\mathbf{G}(X) =
\begin{pmatrix}
g_{0,0}(X) & g_{0,1}(X) & \cdots & g_{0,\QCCl-1}(X) \\
& g_{1,1}(X) & \cdots & g_{1,\QCCl-1}(X) \\
\multicolumn{2}{c}{\bigzero}& \ddots & \vdots \\
& & & g_{\QCCl-1,\QCCl-1}(X)
\end{pmatrix},
\end{equation}
where the following conditions must be fulfilled:\\
\begin{tabular}[htb]{lrcll}
C1: & $g_{i,j}(X)$ & $=$ & $0,$ & $\forall 0 \leq j < i < \QCCl$, \\
C2: & $\deg g_{j,i}(X)$ & $<$ & $ \deg g_{i,i}(X),$ & $ \forall j < i, i \in \interval{\QCCl}$,\\
C3: & $g_{i,i}(X)$ & $|$ & $ (X^{\QCCm}-1),$ & $\forall i \in \interval{\QCCl}$,\\
C4: & if $g_{i,i}(X)$ & $=$ & $X^{\QCCm}-1$ then \\
& $g_{i,j}(X)$ & $=$ & $0,$ & $ \forall j \in \interval{i+1, \QCCl}$.
\end{tabular}\\
We refer to these conditions as RGB/POT conditions C1--C4 throughout this paper and refer to the unreduced representation as in~\eqref{eq_GeneratorWithBasis} if necessary.
The rows of $\mathbf{G}(X)$ with $g_{i,i}(X) \neq X^{\QCCm}-1$ (i.e., the rows that do not map to zero under $\phi$ as in~\eqref{eq_Homorphism}) are called the reduced generating set of the quasi-cyclic code $\ensuremath{\mathcal{C}}$.
Let $k_j= \QCCm - \deg g_{j,j}(X)$ for all $j \in \interval{\QCCl}$. A codeword of $\ensuremath{\mathcal{C}}$ can be represented as $\mathbf{c}(X) = \mathbf{i}(X) \mathbf{G}(X)$, where $\vec{i}(X) = (i_0(X) \ i_1(X) \ \cdots \ i_{\QCCl-1}(X))$ and $\deg i_j(X) < k_j, \, \forall j \in \interval{\QCCl}$. The dimension of $\ensuremath{\mathcal{C}}$ is $\QCCk = \QCCm \QCCl - \sum_{j=0}^{\QCCl-1} \deg g_{j,j}(X)$.
For $\QCCl=1$, the generator matrix $\mathbf{G}(X)$ in RGB/POT form as in~\eqref{def_GroebBasisMatrix} becomes the well-known generator polynomial of a cyclic code of degree $\QCCm-\QCCk$. In this paper we consider the single-root case, i.e., $\gcd(\QCCm, \text{char}(\F{q}))=1$.
We recall the following definition (see \cite[Thm. 3.2]{lally_construction_1999}).
\begin{definition}[$\ensuremath{r}$-level Quasi-Cyclic Code {\cite[Thm. 3.2]{lally_construction_1999}}] \label{def_LevelQC}
We call an $\LIN{\QCCl \cdot \QCCm}{\QCCk}{\QCCd}{q}$ $\QCCl$-quasi-cyclic code $\ensuremath{\mathcal{C}}$ an $\ensuremath{r}$-level quasi-cyclic code if there is an index $\ensuremath{r} \in \interval{\QCCl}$ for which the RGB/POT matrix as defined in~\eqref{def_GroebBasisMatrix} is such that $g_{\ensuremath{r}-1,\ensuremath{r}-1}(X) \neq X^{\QCCm}-1$ and $g_{\ensuremath{r},\ensuremath{r}}(X) = \dots = g_{\QCCl-1,\QCCl-1}(X) = X^{\QCCm}-1$.
\end{definition}
Furthermore, the generator matrix in RGB/POT form of a $1$-level $\QCCl$-quasi-cyclic code as in Def.~\ref{def_LevelQC} is stated in the following corollary.
\begin{corollary}[$1$-level Quasi-Cyclic Code {\cite[Corollary 3.3]{lally_construction_1999}}] \label{cor_OneLevelQC}
The generator matrix in RGB/POT form of an $\LIN{\QCCl \cdot \QCCm}{\QCCk}{\QCCd}{q}$ $1$-level $\QCCl$-quasi-cyclic code $\ensuremath{\mathcal{C}}$ has the following form:
\begin{equation*}
\mathbf{G}(X) =
\begin{pmatrix}
g(X) & g(X) f_{1}(X) & \cdots & g(X)f_{\QCCl-1}(X)
\end{pmatrix},
\end{equation*}
where $g(X) \mid (X^{\QCCm}-1)$, $ \deg g(X) = \QCCm-\QCCk$, and $f_{1}(X), \dots, f_{\QCCl-1}(X) \in \Fx{q}$.
\end{corollary}
\subsection{Spectral Analysis of Quasi-Cyclic Codes} \label{Subsec_SpectralAnalysis}
Let $\mathbf{G}(X)$ be the upper-triangular generator matrix of a given $\LIN{\QCCl \cdot \QCCm}{\QCCk}{\QCCd}{q}$ $\QCCl$-quasi-cyclic code $\ensuremath{\mathcal{C}}$ in RGB/POT form as in~\eqref{def_GroebBasisMatrix}. Let $\alpha \in \F{q^{\QCCs}}$ be an \ith{\QCCm} root of unity.
An eigenvalue $\eigenvalue{i}$ of $\ensuremath{\mathcal{C}}$ is defined to be a root of $\det(\mathbf{G}(X))$, i.e., a root of $\prod_{j=0}^{\QCCl-1} g_{j,j}(X)$.
The \textit{algebraic} multiplicity of $\eigenvalue{i}$ is the largest integer $ \mult{i} $ such that
$(X-\eigenvalue{i})^{\mult{i}} \mid \det(\mathbf{G}(X)).$
Semenov and Trifonov~\cite{semenov_spectral_2012} defined the \textit{geometric} multiplicity of an eigenvalue $\eigenvalue{i}$ as the dimension of the right kernel of the matrix $\mathbf{G}(\eigenvalue{i})$, i.e., the dimension of the solution space of the homogeneous linear system of equations:
\begin{equation} \label{eq_eigenvectors}
\mathbf{G}(\eigenvalue{i}) \eigenvector = \textbf{0}.
\end{equation}
The solution space of~\eqref{eq_eigenvectors} is called the right kernel eigenspace and it is denoted by $\eigenspace[i]$. Furthermore, it was shown that, for a matrix $\mathbf{G}(X) \in \Fx{q}^{\QCCl \times \QCCl}$ in RGB/POT form, the algebraic multiplicity $\mult{i}$ of an eigenvalue $\eigenvalue{i}$ equals the geometric multiplicity~\cite[Lemma 1]{semenov_spectral_2012}.
\begin{definition}[Pre-RGB/POT Form] \label{def_PreRGBPOTForm}
A generator matrix $\bar{\mathbf{G}}(X)$ of $\ensuremath{\mathcal{C}}$ that satisfies RGB/POT Conditions C1, C3 and C4, but not C2, is called a matrix in Pre-RGB/POT form. More explicitly, the generator matrix has the following form:
\begin{equation} \label{eq_PRE-RGBPOTForm}
\bar{\mathbf{G}}(X) =
\begin{pmatrix}
g_{0,0}(X) & \bar{g}_{0,1}(X) & \cdots & \bar{g}_{0,\QCCl-1}(X) \\
& g_{1,1}(X) & \cdots & \bar{g}_{1,\QCCl-1}(X) \\
\multicolumn{2}{c}{\bigzero}& \ddots & \vdots \\
& & & g_{\QCCl-1,\QCCl-1}(X)
\end{pmatrix},
\end{equation}
where the entries of $\bar{\mathbf{G}}(X)$ that can be different from their counterparts in the RGB/POT form, are marked by a bar.
\end{definition}
\begin{lemma}[Equivalence of the Spectral Analysis of a Matrix in Pre-RGB/POT Form] \label{lem_EquivalenceSpectralAnalysis}
Let $\mathbf{G}(X)$ be an $\QCCl \times \QCCl$ generator matrix of an $\QCCl$-quasi-cyclic code $\ensuremath{\mathcal{C}}$ in RGB/POT form as in~\eqref{def_GroebBasisMatrix} and let $\bar{\mathbf{G}}(X)$ be a generator matrix of the same code in Pre-RGB/POT form as in Definition~\ref{def_PreRGBPOTForm}.
Let $\lambda_i$ be an eigenvalue of $\mathbf{G}(X)$. Then, the right kernels of $\mathbf{G}(\lambda_i)$ and $\bar{\mathbf{G}}(\lambda_i)$ are equal, i.e., the (algebraic and geometric) multiplicity and the corresponding eigenvalues are identical.
\end{lemma}
\begin{proof}
To reduce the matrix $\bar{\mathbf{G}}(X)$ to $\mathbf{G}(X)$ only linear transformations in $\Fx{q}$, i.e., linear combinations of rows are necessary and therefore the right kernels of $\mathbf{G}(\lambda_i)$ and $\bar{\mathbf{G}}(\lambda_i)$ are the same.
\end{proof}
Moreover, Semenov and Trifonov~\cite{semenov_spectral_2012} gave an explicit construction of the parity-check matrix of an $\LIN{\QCCl \cdot \QCCm}{\QCCk}{\QCCd}{q}$ $\QCCl$-quasi-cyclic code $\ensuremath{\mathcal{C}}$ and proved a BCH-like~\cite{bose_class_1960, hocquenghem_codes_1959} lower bound on the minimum Hamming distance $\QCCd$ (see Thm.~\ref{theo_SemenovTrifonovBound}) using the parity-check matrix and the so-called eigencode. We generalize their approach in Section~\ref{sec_SpectralAnalysis}, but do not explicitly need the parity-check matrix for the proof, though the eigencode is still needed.
\begin{definition}[Eigencode] \label{def_eigencode}
Let $\eigenspace{} \subseteq \F{q^{\QCCs}}^{\QCCl}$ be an eigenspace. Define the $\LIN{\ensuremath{n^{ec}}=\QCCl}{\ensuremath{k^{ec}}}{\ensuremath{d^{ec}}}{q}$ eigencode corresponding to $\eigenspace{}$ by
\begin{equation*}
\eigencode{\eigenspace{}} \overset{\defi}{=} \left \lbrace \vec{c} \in \F{q}^{\QCCl} \mid \forall \eigenvector \in \eigenspace : \vec{v} \circ \vec{c} = 0 \right\rbrace.
\end{equation*}
\end{definition}
If there exists an eigenvector $\eigenvector = (\eigenvector[0] \ \eigenvector[1] \ \cdots \ \eigenvector[\QCCl-1]) \in \eigenspace$ with entries $\eigenvector[0], \eigenvector[1], \dots, \eigenvector[\QCCl-1]$ that are linearly independent over $\F{q}$, then $\eigencode{\eigenspace{}} = \{ (0 \ 0 \ \cdots \ 0) \} $ and $\ensuremath{d^{ec}}$ is infinity.
To describe quasi-cyclic codes explicitly, we need to recall the following facts related to cyclic codes. A $q$-cyclotomic coset $\coset{i}$ is defined as:
\begin{equation} \label{eq_cyclotomiccoset}
\coset{i} \overset{\defi}{=} \Big\{ iq^j \mod \QCCm \, \vert \, j \in \interval{a} \Big\},
\end{equation}
where $a$ is the smallest positive integer such that $iq^{a} \equiv i \bmod \QCCm$.
The minimal polynomial in $\Fx{q}$ of the element $\alpha^i \in \F{q^{\QCCs}}$ is given by
\begin{equation} \label{eq_MinPoly}
\minpoly{\alpha^i} = \prod_{j \in \coset{i} } (X-\alpha^j).
\end{equation}
\section{Quasi-Cyclic Product Codes} \label{sec_ProductQCCQCC}
In this section we consider an $\ensuremath{\ell_{A}} \ensuremath{\ell_{B}}$-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$, where the symbol $\otimes$ stems from the fact that a generator matrix with entries in $\F{q}$ of $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ is the Kronecker product of the generator matrices (with entries in $\F{q}$) of $\ensuremath{\mathcal{A}}$ and $\ensuremath{\mathcal{B}}$ (see, e.g., \cite[Ch. 18. §2]{macwilliams_theory_1988}). In the following, let $\ensuremath{\mathcal{A}}$ be an $\LIN{\QCCan = \ensuremath{\ell_{A}} \cdot \QCCam}{\QCCak}{\QCCad}{q}$ $\ensuremath{\ell_{A}}$-quasi-cyclic code generated by the following matrix in RGB/POT form as defined in~\eqref{def_GroebBasisMatrix}:
\begin{equation} \label{eq_GroebMatrixCodeA}
\genmat[A] =
\begin{pmatrix}
\gen[A][0][0] & \gen[A][0][1] & \cdots & \gen[A][0][\ensuremath{\ell_{A}}-1]\\
& \gen[A][1][1] & \cdots & \gen[A][1][\ensuremath{\ell_{A}}-1] \\
\multicolumn{2}{c}{\bigzero}& \ddots & \vdots \\
& & & \gen[A][\ensuremath{\ell_{A}}-1][\ensuremath{\ell_{A}}-1]
\end{pmatrix},
\end{equation}
and let $\ensuremath{\mathcal{B}}$ be an $\LIN{\QCCbn = \ensuremath{\ell_{B}} \cdot \QCCbm}{\QCCbk}{\QCCbd}{q}$ $\ensuremath{\ell_{B}}$-quasi-cyclic code with generator matrix in RGB/POT form:
\begin{equation} \label{eq_GroebMatrixCodeB}
\genmat[B] =
\begin{pmatrix}
\gen[B][0][0] & \gen[B][0][1] & \cdots & \gen[B][0][\ensuremath{\ell_{B}}-1]\\
& \gen[B][1][1] & \cdots & \gen[B][1][\ensuremath{\ell_{B}}-1] \\
\multicolumn{2}{c}{\bigzero}& \ddots & \vdots \\
& & & \gen[B][\ensuremath{\ell_{B}}-1][\ensuremath{\ell_{B}}-1]
\end{pmatrix}.
\end{equation}
We assume throughout the paper that $\gcd(\QCCan, \CYCbn) = 1$. Let two integers $\ensuremath{a}$ and $\ensuremath{b}$ be such that
\begin{equation} \label{eq_BEzoutRel}
\ensuremath{a} \QCCan + \ensuremath{b} \CYCbn = 1.
\end{equation}
A codeword $c(X) \in \Fx{q}$ of the $\LIN{\QCCn = \ensuremath{\ell_{A}} \ensuremath{\ell_{B}} \cdot \QCCam \QCCbm}{\QCCk = \QCCak \QCCbk}{\QCCd = \QCCad \QCCbd}{q}$ product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ can then be obtained from the $\QCCbn \times \QCCan$ matrix $(m_{i,j})_{i \in \interval{\QCCbn}}^{j \in \interval{\QCCan}}$ representation, where each row is in $\ensuremath{\mathcal{A}}$ and each column is in $\ensuremath{\mathcal{B}}$, as follows:
\begin{equation} \label{eq_OneUnivariatePolyProduct}
c(X) \equiv \sum_{i=0}^{\QCCbn-1} \sum_{j=0}^{\QCCan-1} m_{i,j} X^{\map{i}{j}} \mod (X^{\QCCn}-1),
\end{equation}
where we give $\map{i}{j}$ in Lemma~\ref{lem_MappingToUnivariatePolyQCC}. This mapping was stated by Wasan in~\cite{wasan_quasi_1977} and generalizes the result of Burton and Weldon~\cite[Thm. I]{burton_cyclic_1965} for a cyclic product code to the case of an $\ensuremath{\ell_{A}} \ensuremath{\ell_{B}}$-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$.
\begin{lemma}[Mapping to a Univariate Polynomial~\cite{wasan_quasi_1977}] \label{lem_MappingToUnivariatePolyQCC}
Let $\ensuremath{\mathcal{A}}$ be an $\ensuremath{\ell_{A}}$-quasi-cyclic code of length $\QCCan$ and let $\ensuremath{\mathcal{B}}$ be an $\ensuremath{\ell_{B}}$-quasi-cyclic code of length $\QCCbn$. The product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ is an $\ensuremath{\ell_{A}} \ensuremath{\ell_{B}}$-quasi-cyclic code of length $\QCCn = \QCCan \QCCbn$ if $\gcd(\QCCan, \QCCbn) = 1$.
\end{lemma}
\begin{proof}
A codeword of the $\LIN{\QCCan \QCCbn}{\QCCak \QCCbk}{\QCCad \QCCbd}{q}$ product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ can be represented by an $\QCCbn \times \QCCan$ matrix $(m_{i,j})_{i \in \interval{\QCCbn}}^{j \in \interval{\QCCan}}$, where each row is a codeword of $\ensuremath{\mathcal{A}}$ and each column is a codeword of $\ensuremath{\mathcal{B}}$. The entries of the matrix $(m_{i,j})$ in the \ith{i} row and \ith{j} column are mapped to the coefficients of the codeword by:
\begin{equation} \label{def_MappingMatrixPolyQCCQCC}
\map{i}{j} \overset{\defi}{=} i \ensuremath{a} \QCCan \ensuremath{\ell_{A}} + j \ensuremath{b} \QCCbn \ensuremath{\ell_{B}} \mod \QCCn,
\end{equation}
where $i \in \interval{\QCCbn}$ and $j \in \interval{\QCCan}$.
In order to prove that the product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ is $\ensuremath{\ell_{A}} \ensuremath{\ell_{B}}$-quasi-cyclic it is sufficient to show that a shift by $\ensuremath{\ell_{A}} \ensuremath{\ell_{B}}$ of a codeword in $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ serialized to a univariate polynomial by~\eqref{def_MappingMatrixPolyQCCQCC} is again a codeword in $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$. This will be true if a shift by $\ensuremath{\ell_{A}}$ in every row and a shift by $\ensuremath{\ell_{B}}$ in every column correspond to an $\ensuremath{\ell_{A}} \ensuremath{\ell_{B}}$-quasi-cyclic shift of the univariate codeword obtained by~\eqref{def_MappingMatrixPolyQCCQCC}, which is indeed the case:
\begin{align*}
\map{i+\ensuremath{\ell_{B}}}{j+\ensuremath{\ell_{A}}} & \equiv (i+\ensuremath{\ell_{B}}) \ensuremath{a} \QCCan \ensuremath{\ell_{A}} + (j+\ensuremath{\ell_{A}}) \ensuremath{b} \QCCbn \ensuremath{\ell_{B}} \mod \QCCn \\
& \equiv i \ensuremath{a} \QCCan \ensuremath{\ell_{A}} + j \ensuremath{b} \QCCbn \ensuremath{\ell_{B}} + \ensuremath{\ell_{A}} \ensuremath{\ell_{B}} (\ensuremath{a} \QCCan + \ensuremath{b} \QCCbn) \mod \QCCn \\
& \equiv \map{i}{j} + \ensuremath{\ell_{A}} \ensuremath{\ell_{B}} \mod \QCCn.
\end{align*}
\end{proof}
Instead of representing a codeword in $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ as one univariate polynomial in $\Fx{q}$ as in~\eqref{eq_OneUnivariatePolyProduct}, we want to represent it as a vector of $\ensuremath{\ell_{A}} \ensuremath{\ell_{B}}$ univariate polynomials in $\Fx{q}$ (as in Lemma~\ref{lem_VectorToUnivariatePoly}) to obtain an explicit expression of the basis of the $\ensuremath{\ell_{A}} \ensuremath{\ell_{B}}$-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$.
\begin{lemma}[Mapping to $\ensuremath{\ell_{A}} \ensuremath{\ell_{B}}$ Univariate Polynomials] \label{lem_MappingUnivariateQCCQCC}
Let $\ensuremath{\mathcal{A}}$ be an $\ensuremath{\ell_{A}}$-quasi-cyclic code of length $\QCCan = \ensuremath{\ell_{A}} \QCCam $ and let $\ensuremath{\mathcal{B}}$ be an $\ensuremath{\ell_{B}}$-quasi-cyclic code of length $\QCCbn = \ensuremath{\ell_{B}} \QCCbm$. Let $\QCCl = \ensuremath{\ell_{A}} \ensuremath{\ell_{B}}$, $\QCCm = \QCCam \QCCbm$, and $\QCCn = \QCCan \QCCbn$. Let $(m_{i,j})_{i \in \interval{\QCCbn}}^{j \in \interval{\QCCan}}$ be a codeword of the $\QCCl$-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$, where each row is in $\ensuremath{\mathcal{A}}$ and each column is in $\ensuremath{\mathcal{B}}$.
Define $\QCCl$ univariate polynomials as:
\begin{equation} \label{eq_UnivariateFinalQCCQCC}
c_{g,h}(X) \equiv X^{\submap{g}{h}} \cdot \sum_{i=0}^{\QCCbm-1} \sum_{j=0}^{\QCCam-1} m_{i\ensuremath{\ell_{B}}+g,j\ensuremath{\ell_{A}}+h} X^{ \mapb{i}{j} } \mod (X^{\QCCm} - 1), \quad \forall g \in \interval{\ensuremath{\ell_{B}}}, h \in \interval{\ensuremath{\ell_{A}}},
\end{equation}
with
\begin{align}
\submap{g}{h} & = g(-\ensuremath{b}\QCCbm ) + h(-\ensuremath{a} \QCCam) \mod \QCCm, \label{eq_ShiftCodeword} \\
\mapb{i}{j} &= i \ensuremath{a} \QCCan + j \ensuremath{b} \QCCbn \mod \QCCm. \label{eq_MappingSubCodewordQCCQCC}
\end{align}
Then the codeword $c(X) \in \ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ corresponding to $(m_{i,j})_{i \in \interval{\QCCbn}}^{j \in \interval{\QCCan}}$ is given by:
\begin{equation} \label{eq_ProofMatrixToUnivariateFirst}
c(X) \equiv \sum_{g=0}^{\ensuremath{\ell_{B}}-1} \sum_{h=0}^{\ensuremath{\ell_{A}}-1} c_{g,h} (X^{\ensuremath{\ell_{A}} \ensuremath{\ell_{B}}}) X^{g\ensuremath{\ell_{A}} + h \ensuremath{\ell_{B}}} \mod (X^{\QCCn}-1).
\end{equation}
\end{lemma}
\begin{proof}
We have:
\begin{align}
y & \equiv \mapb{i}{j} + \submap{g}{h} \mod \QCCm. \nonumber \\
& \qquad \qquad \Leftrightarrow \nonumber \\
\ensuremath{\ell_{A}} \ensuremath{\ell_{B}} y & \equiv \ensuremath{\ell_{A}} \ensuremath{\ell_{B}} ( \mapb{i}{j}+ \submap{g}{h} ) \mod \QCCn . \label{eq_MovingFromBigToSmallMatrixQCCQCC}
\end{align}
With $\ensuremath{a} \QCCan-1 = -\ensuremath{b} \QCCbn = -\ensuremath{b} \QCCbm \ensuremath{\ell_{B}}$ and $\ensuremath{b} \QCCbn-1 = -\ensuremath{a} \QCCan = -\ensuremath{a} \QCCam \ensuremath{\ell_{A}}$, and using~\eqref{eq_ShiftCodeword}, we can rewrite~\eqref{eq_MovingFromBigToSmallMatrixQCCQCC} to:
\begin{align}
\ensuremath{\ell_{A}} \ensuremath{\ell_{B}} ( \mapb{i}{j} + \submap{g}{h} ) & \equiv \ensuremath{\ell_{A}} \ensuremath{\ell_{B}} \mapb{i}{j} + g \ensuremath{\ell_{A}} (- \ensuremath{b} \QCCbm \ensuremath{\ell_{B}} ) + h \ensuremath{\ell_{B}} ( -\ensuremath{a} \QCCam \ensuremath{\ell_{A}}) \mod \QCCn \nonumber \\
& \equiv \ensuremath{\ell_{A}} \ensuremath{\ell_{B}} \mapb{i}{j} + g \ensuremath{\ell_{A}} (\ensuremath{a} \QCCan - 1 ) + h \ensuremath{\ell_{B}} (\ensuremath{b} \QCCbn - 1) \mod \QCCn. \label{eq_SpreadedCodewordsQCCQCC}
\end{align}
With $\mapb{i}{j}$ as in~\eqref{eq_MappingSubCodewordQCCQCC} and $\map{i}{j}$ as in~\eqref{def_MappingMatrixPolyQCCQCC}, we get from~\eqref{eq_SpreadedCodewordsQCCQCC}:
\begin{align}
\ensuremath{\ell_{A}} \ensuremath{\ell_{B}} (i \ensuremath{a} \QCCan + j \ensuremath{b} \QCCbn) + g \ensuremath{\ell_{A}} (\ensuremath{a} \QCCan - 1 ) + h \ensuremath{\ell_{B}} (\ensuremath{b} \QCCbn - 1) & \equiv (i \ensuremath{\ell_{B}}+g) \ensuremath{a} \QCCan \ensuremath{\ell_{A}} + (j \ensuremath{\ell_{A}}+h) \ensuremath{b} \QCCbn \ensuremath{\ell_{B}} - g \ensuremath{\ell_{A}}- h \ensuremath{\ell_{B}} \mod \QCCn \nonumber \\
& \equiv \map{i \ensuremath{\ell_{B}}+g}{j\ensuremath{\ell_{A}}+h} - g \ensuremath{\ell_{A}}- h \ensuremath{\ell_{B}} \mod \QCCn. \label{eq_MappingToOneCodewordBack}
\end{align}
Inserting~\eqref{eq_UnivariateFinalQCCQCC} into~\eqref{eq_ProofMatrixToUnivariateFirst} and using the result \eqref{eq_MappingToOneCodewordBack} for the manipulations of the exponents leads to:
\begin{align}
c(X) & \equiv \sum_{g=0}^{\ensuremath{\ell_{B}}-1} \sum_{h=0}^{\ensuremath{\ell_{A}}-1} \sum_{i=0}^{\QCCbm-1} \sum_{j=0}^{\QCCam-1} m_{i\ensuremath{\ell_{B}}+g,j\ensuremath{\ell_{A}}+h} X^{\map{i\ensuremath{\ell_{B}}+g}{j\ensuremath{\ell_{A}}+h}} \mod (X^{\QCCn}-1). \label{eq_ProofMatrixToUnivariate}
\end{align}
With $i^{\prime}=i\ensuremath{\ell_{B}}+g$ and $j^{\prime} = j\ensuremath{\ell_{A}}+h$, we obtain from~\eqref{eq_ProofMatrixToUnivariate}:
\begin{align*}
c(X) & \equiv \sum_{i^{\prime}=0}^{\QCCbn-1} \sum_{j^{\prime}=0}^{\QCCan-1} m_{i^{\prime},j^{\prime}} X^{\map{i^{\prime}}{j^{\prime}}} \mod (X^{\QCCn}-1),
\end{align*}
which coincides with the expression as in~\eqref{eq_OneUnivariatePolyProduct}.
\end{proof}
The mapping $\mapb{i}{j}$ as in~\eqref{eq_MappingSubCodewordQCCQCC} of the $\QCCl$ submatrices $(m_{i\ensuremath{\ell_{B}},j\ensuremath{\ell_{A}}}), (m_{i\ensuremath{\ell_{B}},j\ensuremath{\ell_{A}}+1}), \dots, (m_{i\ensuremath{\ell_{B}}+\ensuremath{\ell_{B}}-1,j\ensuremath{\ell_{A}}+\ensuremath{\ell_{A}}-1}) \in \F{q}^{\QCCbm \times \QCCam}$ to the $\QCCl$ univariate polynomials $c_{0,0}(X), c_{0,1}(X), \dots, c_{\ensuremath{\ell_{B}}-1, \ensuremath{\ell_{A}}-1}(X) $ is the same as the one used to map the codeword of a cyclic product code of length $\QCCam \QCCbm$ from its matrix representation to the polynomial representation (see \cite[Thm. 1]{burton_cyclic_1965} and Fig.~\ref{fig_QCCvert}).
We illustrate the mapping of the matrix to the polynomial representation of a codeword of an $\QCCl$-quasi-cyclic product code as discussed in Lemma~\ref{lem_MappingToUnivariatePolyQCC} and Lemma~\ref{lem_MappingUnivariateQCCQCC} in the following example.
\begin{example}[$6$-Quasi-Cyclic Product Code] \label{ex_6QCCQCC}
Let $\ensuremath{\mathcal{A}}$ be a $2$-quasi-cyclic code of length $\QCCan = 2 \cdot 5 = 10$ and let $\ensuremath{\mathcal{B}}$ be a $3$-quasi-cyclic of length $\QCCbn= 3 \cdot 3 = 9$. Let $\ensuremath{a} = 1$ and $\ensuremath{b} = -1$, such that~\eqref{eq_BEzoutRel} holds. For the purpose of this illustration, the field size $q$ is irrelevant, but we assume that $\gcd(\QCCan,q) = \gcd(\QCCbn,q) = 1$.
Fig.~\ref{fig_QCCQCC} contains three different representations of a codeword of the $6$-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ of length $90$. The $9 \times 10$ matrix $(m_{i,j})_{i \in \interval{9}}^{j \in \interval{10}}$, where each row is a codeword in $\ensuremath{\mathcal{A}}$ and each column is a codeword in $\ensuremath{\mathcal{B}}$, is illustrated in Fig.~\ref{fig_QCCQCCfull}. The entries of $(m_{i,j})$ contain the indices of the coefficients if the matrix $(m_{i,j})$ is mapped to a univariate polynomial as given in~\eqref{eq_OneUnivariatePolyProduct}. The color of a code symbol indicates the membership of an entry when the codeword in $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ is represented as six univariate polynomials as stated in Lemma~\ref{lem_MappingUnivariateQCCQCC}. The corresponding six $3 \times 5$ submatrices $(m_{i3,j2})$, $(m_{i3+1,j2})$, $(m_{i3+2,j2})$, $(m_{i3,j2+1})$, $(m_{i3+1,j2+1})$, $(m_{i3+2,j2+1}) \in \F{q}^{3 \times 5}$ are depicted separately twice in Fig.~\ref{fig_QCCvertintermed} and in Fig.~\ref{fig_QCCvert}, respectively. Both figures contain different indices of the six univariate polynomials as outlined in the corresponding captions.
\newcommand{6mm}{6mm}
\newcommand{6.5mm}{6.5mm}
\begin{figure}[htb]
\centering
\subfigure[Illustration of $\map{i}{j}$ as in~\eqref{def_MappingMatrixPolyQCCQCC} for $\ensuremath{a}=1$, $\ensuremath{\ell_{A}} = 2$, $\QCCam = 5$ and $\ensuremath{b}=-1$, $\ensuremath{\ell_{B}}=3$, $\QCCbm=3$. The entry of the $(3\cdot 3) \times (2 \cdot 5)$ matrix $(m_{i,j}) \in \ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}} $ in the $\ith{i}$ row and the $\ith{j}$ column is the $\ith{\map{i}{j}}$ coefficient of the univariate polynomial of degree less than $90$ representing a codeword of $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$.]{\resizebox{.7\textwidth}{!}{\includegraphics{CyclicProductCodesFull.pdf}}\label{fig_QCCQCCfull}}\\
\subfigure[The three submatrices $(m_{i3,j2})$, $(m_{i3+1,j2})$, $(m_{i3+2,j2})$ on the left and the three submatrices $(m_{i3,j2+1})$, $(m_{i3+1,j2+1})$, $(m_{i3+2,j2+1})$ on the right (for $i \in \interval{3}$ and $j \in \interval{5}$) of the $9 \times 10$ matrix $(m_{i,j})$ as given in Fig.~\ref{fig_QCCQCCfull}. The entry of the $\ith{i}$ row and the $\ith{j}$ column of $(m_{i3+g,j2+h})$ is the value $\map{i3+g}{j2+h}$ for all $g \in \interval{3}$ and $h \in \interval{2}$.]{\tikzsetnextfilename{CyclicProductCodesVert1intermediate}\resizebox{.18\textwidth}{!}{\includegraphics{CyclicProductCodesVert1intermediate.pdf}}\resizebox{.18\textwidth}{!}{\includegraphics{CyclicProductCodesVert2intermediate.pdf}}\label{fig_QCCvertintermed}}\hfill
\subfigure[All six $3 \times 5$ submatrices as in Fig.~\ref{fig_QCCvertintermed}. Here, the entry of the $\ith{i}$ row and the $\ith{j}$ column of $(m_{i3+g,j2+h})$ is the value $\mapb{i}{j} + g 3 +h(-5) \bmod 15$ that is equivalent to $6(\map{i3+g}{j2+h}-g2-h3) \bmod 90$ according to~\eqref{eq_MappingToOneCodewordBack}. The entries are the coefficients of the six univariate polynomials $c_{0,0}(X)$, $c_{1,0}(X)$, $c_{2,0}(X)$ (left column) and $c_{0,1}(X)$, $c_{1,1}(X)$, $c_{2,1}(X)$ (right column) as in~\eqref{eq_UnivariateFinalQCCQCC}.]{\resizebox{.18\textwidth}{!}{\includegraphics{CyclicProductCodesVert1.pdf}}\resizebox{.18\textwidth}{!}{\includegraphics{CyclicProductCodesVert2.pdf}}\label{fig_QCCvert}
}
\caption{Illustration of $\map{i}{j}$ as in~\eqref{def_MappingMatrixPolyQCCQCC} and $\mapb{i}{j}$ as in~\eqref{eq_MappingSubCodewordQCCQCC} for a $6$-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ of length $6 \cdot 15$, where the row-code $\ensuremath{\mathcal{A}}$ is $2$-quasi-cyclic and has length $2 \cdot 5$ and the column-code $\ensuremath{\mathcal{B}}$ is $3$-quasi-cyclic and has length $3 \cdot 3$. The mapping $\map{i}{j}$ to one univariate polynomial is shown in Fig.~\ref{fig_QCCQCCfull}. The mapping $\mapb{i}{j}$ to six univariate polynomials is illustrated in Fig.~\ref{fig_QCCvertintermed} and Fig.~\ref{fig_QCCvert}.}
\label{fig_QCCQCC}
\end{figure}
We consider the entry in the $2^{\text{nd}}$ row and the $2^{\text{nd}}$ column of the full $9 \times 10$ matrix $(m_{i,j})_{i \in \interval{9}}^{j \in \interval{10}} \in \ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ shown in Fig.~\ref{fig_QCCQCCfull}. According to~\eqref{def_MappingMatrixPolyQCCQCC}, we have $\map{2}{2} = 76$, i.e., the coefficient of $X^{76}$ of the univariate polynomial $c(X) \in \ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ is $c_{76} = m_{2,2}$. The entry $m_{2,2}$ belongs to the $3 \times 5$ submatrix $(m_{i\ensuremath{\ell_{B}}+2,j\ensuremath{\ell_{A}}})_{i \in \interval{3}}^{j \in \interval{5}}$ (bottom leftmost submatrix in Fig.~\ref{fig_QCCvertintermed} and in Fig.~\ref{fig_QCCvert}, with parameters $g=2$ and $h=0$). The entry in the $\ith{0}$ row and the $1^{\text{st}}$ column of the submatrix $(m_{i\ensuremath{\ell_{B}}+2,j\ensuremath{\ell_{A}}})$ is the coefficient of $X^{12}$ of the polynomial $c_{2,0}(X)$, because $\submap{2}{0} + \mapb{0}{1} = 6 + 6 = 12$ according to~\eqref{eq_UnivariateFinalQCCQCC}. Via~\eqref{eq_ProofMatrixToUnivariateFirst}, it can be verified that the coefficient of $X^{12}$ of $c_{2,0}(X)$ is the coefficient of $X^{76}$ of $c(X) \in \ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$.
\end{example}
In the following theorem, we state a basis of the $\QCCl$-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ in terms of the two given generator matrices of $\ensuremath{\mathcal{A}}$ and $\ensuremath{\mathcal{B}}$ in RGB/POT form.
\begin{theorem}[Unreduced Basis of a Quasi-Cyclic Product Code] \label{theo_ProductCodeQCCQCCUnred}
Let $\ensuremath{\mathcal{A}}$ be an $\LIN{\ensuremath{\ell_{A}} \cdot \QCCam}{\QCCak}{\QCCad}{q}$ $\ensuremath{\ell_{A}}$-quasi-cyclic code with generator matrix $\genmat[A] \in \Fx{q}^{\ensuremath{\ell_{A}} \times \ensuremath{\ell_{A}}}$ as in~\eqref{eq_GroebMatrixCodeA}, let $\ensuremath{\mathcal{B}}$ be an $\LIN{\ensuremath{\ell_{B}} \cdot \QCCbm}{\QCCbk}{\QCCbd}{q}$ $\ensuremath{\ell_{B}}$-quasi-cyclic code with generator matrix $\genmat[B] \in \Fx{q}^{\ensuremath{\ell_{B}} \times \ensuremath{\ell_{B}}}$ as in~\eqref{eq_GroebMatrixCodeB}. Let $\QCCl = \ensuremath{\ell_{A}} \ensuremath{\ell_{B}}$ and $\QCCm = \QCCam \QCCbm$.
Let $\mathbf{c}(X) = (c_{0,0}(X) \ c_{1,0}(X) \ \cdots \ c_{\ensuremath{\ell_{B}}-1,0}(X) \ \cdots \ c_{\ensuremath{\ell_{B}}-1,\ensuremath{\ell_{A}}-1}(X) ) \in \Fx{q}^{\QCCl}$ be a codeword in $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$, where $c_{g,h}(X), \forall g \in \interval{\ensuremath{\ell_{B}}}, h \in \interval{\ensuremath{\ell_{A}}}$, is as defined in~\eqref{eq_UnivariateFinalQCCQCC}.
Then, a generator matrix in unreduced form with entries in $\Fx{q}$ of the $\QCCl$-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ is given by
\begin{equation} \label{eq_GenMatrixQCCQCCUnreduced}
\mathbf{U}(X) =
\begin{pmatrix}
\mathbf{U}^0(X) \\
\mathbf{U}^1(X)
\end{pmatrix},
\end{equation}
where
\begin{equation} \label{eq_UnReducedBasisPart1}
\begin{split}
& \mathbf{U}^0(X) =
\begin{pmatrix}
\genunred[0][0] & \genunred[0][1] & \cdots & \cdots & \genunred[0][\QCCl-1] \\
& \genunred[1][1] & \cdots & \cdots & \genunred[1][\QCCl-1] \\
& & \ddots & \vdots & \vdots \\
\multicolumn{3}{c}{\bigzero} & \genunred[\QCCl-2][\QCCl-2] & \genunred[\QCCl-2][\QCCl-1] \\
& & & & \genunred[\QCCl-1][\QCCl-1]
\end{pmatrix} \\
& \qquad \qquad \qquad \cdot \diag \left( 1, X^{\submap{1}{0}}, \dots, X^{\submap{\ensuremath{\ell_{B}}-1}{0}},\dots, X^{\submap{\ensuremath{\ell_{B}}-1}{\ensuremath{\ell_{A}}-1}} \right),
\end{split}
\end{equation}
and where
\begin{equation} \label{eq_ElementsProductCodeQCCQCCUnred}
\begin{split}
\genunred[g+h\ensuremath{\ell_{B}}][g^{\prime} + h^{\prime}\ensuremath{\ell_{B}}] & = \genarg{A}[h][h^{\prime}]{X^{\ensuremath{b} \QCCbn}} \genarg{B}[g][g^{\prime}]{X^{\ensuremath{a} \QCCan}} \mod (X^{\QCCm}-1), \\
& \qquad \qquad \qquad \forall g \in \interval{\ensuremath{\ell_{B}}}, h \in \interval{\ensuremath{\ell_{A}}},g^{\prime} \in \interval{g, \ensuremath{\ell_{B}}}, h^{\prime} \in \interval{h, \ensuremath{\ell_{A}}},
\end{split}
\end{equation}
and
\begin{equation*}
\mathbf{U}^1(X) = (X^{\QCCm}-1) \mathbf{I}_{\QCCl},
\end{equation*}
where $\mathbf{I}_{\QCCl}$ denotes the $\QCCl \times \QCCl$ identity matrix. The function $\submap{g}{h}$ is as defined in~\eqref{eq_ShiftCodeword}.
\end{theorem}
\begin{proof}
To get an explicit expression for the entries $\genunred[g+h\ensuremath{\ell_{B}}][g^{\prime} + h^{\prime}\ensuremath{\ell_{B}}]$ of the matrix $\mathbf{U}^0(X) \in \Fx{q}^{\QCCl \times \QCCl}$ as in~\eqref{eq_UnReducedBasisPart1}, we define a subcode of the product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ that is generated by one row of $\mathbf{U}^0(X)$ as given in~\eqref{eq_UnReducedBasisPart1}.
Let $\ensuremath{\mathcal{A}}^{(h)}$ denote a subcode of the given $\ensuremath{\ell_{A}}$-quasi-cyclic code $\ensuremath{\mathcal{A}}$ that is spanned by
\begin{align} \label{eq_SubCodeOfQCC}
\mathbf{a}^{(h)}(X) & \overset{\defi}{=} \big( 0 \ \cdots \ 0 \ \gen[A][h][h] \ \gen[A][h][h+1] \ \cdots \ \gen[A][h][\ensuremath{\ell_{A}}-1] \big), \quad \forall h \in \interval{\ensuremath{\ell_{A}}}.
\end{align}
Similarly, let $\ensuremath{\mathcal{B}}^{(g)}$ be a subcode of the given $\ensuremath{\ell_{B}}$-quasi-cyclic code $\ensuremath{\mathcal{B}}$ spanned by
\begin{align} \label{eq_SubCodeOfQCC}
\mathbf{b}^{(g)}(X) & \overset{\defi}{=} \big( 0 \ \cdots \ 0 \ \gen[B][g][g] \ \gen[B][g][g+1] \ \cdots \ \gen[B][g][\ensuremath{\ell_{B}}-1] \big), \quad \forall g \in \interval{\ensuremath{\ell_{B}}}.
\end{align}
Clearly, we have for the row-code $\ensuremath{\mathcal{A}}$ and the column-code $\ensuremath{\mathcal{B}}$ that:
\begin{equation} \label{eq_QCCSumOfSubCodes}
\ensuremath{\mathcal{A}} = \bigoplus_{h=0}^{\ensuremath{\ell_{A}}-1} \ensuremath{\mathcal{A}}^{(h)}, \qquad \ensuremath{\mathcal{B}} = \bigoplus_{g=0}^{\ensuremath{\ell_{B}}-1} \ensuremath{\mathcal{B}}^{(g)},
\end{equation}
and
\begin{equation} \label{eq_ProductQCCSumOfSubCodes}
\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}} = \bigoplus_{g,h} \left( \ensuremath{\mathcal{A}}^{(h)} \otimes \ensuremath{\mathcal{B}}^{(g)} \right).
\end{equation}
Let $k_{A,h} = \QCCam - \deg \gen[A][h][h]$. The subcode $\ensuremath{\mathcal{A}}^{(h)}$ is spanned by $\{X^{\alpha} \mathbf{a}^{(h)}(X): \alpha \in \interval{k_{A,h}}\}$. As in~\eqref{eq_VectorToUnivariatePoly}, a codeword of $\ensuremath{\mathcal{A}}^{(h)}$ is an $\F{q}$-linear combination of $a^{(h,\alpha)}(X) \overset{\defi}{=} \sum_{h^{\prime}=h}^{\ensuremath{\ell_{A}}-1} X^{h^{\prime}} a^{(\alpha)}_{h, h^{\prime}}(X^{\ensuremath{\ell_{A}}})$, where $a^{(\alpha)}_{h, h^{\prime}}(X) = X^{\alpha} \gen[A][h][h^{\prime}]$. More explicitly if $g_{h,h'}^A (X) = \sum_{u=0}^{\QCCam-1} g_{h,h',u}^A X^u$, we have:
\begin{align} \label{eq_SubCodeACW2}
a^{(h,\alpha)}(X) & = \sum_{h^{\prime}=h}^{\ensuremath{\ell_{A}}-1} X^{h^{\prime}} X^{\ensuremath{\ell_{A}} \alpha} \genarg{A}[h][h^{\prime}]{X^{\ensuremath{\ell_{A}}}} = \sum_{h^{\prime}=h}^{\ensuremath{\ell_{A}}-1} \sum_{u=0}^{\QCCam-1} \gencoeff{A}{h,h^{\prime},u} X^{h^{\prime} + \ensuremath{\ell_{A}} \alpha + \ensuremath{\ell_{A}} u }, \quad \forall h \in \interval{\ensuremath{\ell_{A}}}, \alpha \in \interval{k_{A,h}}.
\end{align}
Similarly, let $k_{B,g} = \QCCbm - \deg \gen[B][g][g]$. The subcode $\ensuremath{\mathcal{B}}^{(g)}$ is spanned by $\{X^{\beta} \mathbf{b}^{(g)}(X): \beta \in \interval{k_{B,g}}\}$ and therefore if $g_{g,g'}^B(X) = \sum_{v=0}^{\QCCbm-1} g_{g,g',v}^B X^v$, a codeword of $\ensuremath{\mathcal{B}}^{(g)}$ is an $\F{q}$-linear combination of
\begin{align} \label{eq_SubCodeACW2}
b^{(g,\beta)}(X) & \overset{\defi}{=} \sum_{g^{\prime}=g}^{\ensuremath{\ell_{B}}-1} X^{g^{\prime}} X^{\ensuremath{\ell_{B}} \beta} \genarg{B}[g][g^{\prime}]{X^{\ensuremath{\ell_{B}}}} = \sum_{g^{\prime}=g}^{\ensuremath{\ell_{B}}-1} \sum_{v=0}^{\QCCbm-1} \gencoeff{B}{g,g^{\prime},v} X^{g^{\prime} + \ensuremath{\ell_{B}} \beta + \ensuremath{\ell_{B}} v }, \quad \forall g \in \interval{\ensuremath{\ell_{B}}}, \beta \in \interval{k_{B,g}}.
\end{align}
By definition of the product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ as in~\eqref{eq_ProductQCCSumOfSubCodes}, in the product array of $X^{\alpha} \mathbf{a}^{(h)}(X) \otimes X^{\beta} \mathbf{b}^{(g)}(X)$, the $\ith{(i,j)}$ entry is
\begin{equation} \label{eq_SubcodeIndexes}
\gencoeff{A}{h,h^{\prime},u} \gencoeff{B}{g,g^{\prime},v},
\end{equation}
where
\begin{equation} \label{eq_IndexesWithinMatrix}
\begin{split}
i & = g^{\prime} + \ensuremath{\ell_{B}} \beta + \ensuremath{\ell_{B}} v,\\
j & = h^{\prime} + \ensuremath{\ell_{A}} \alpha + \ensuremath{\ell_{A}} u.
\end{split}
\end{equation}
By Lemma~\ref{lem_MappingToUnivariatePolyQCC}, the corresponding codeword in $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ is then an $\F{q}$-linear combination of
\begin{equation} \label{eq_MatrixEntriesCoeff}
\sum_{h^{\prime},g^{\prime},u,v} \gencoeff{A}{h,h^{\prime},u} \gencoeff{B}{g,g^{\prime},v} X^{\map{i}{j}}.
\end{equation}
With $\map{i}{j}$ as in~\eqref{def_MappingMatrixPolyQCCQCC}, and with $i,j$ as in~\eqref{eq_IndexesWithinMatrix}, we obtain from~\eqref{eq_MatrixEntriesCoeff}:
\begin{align}
\sum_{h^{\prime},g^{\prime},u,v} \gencoeff{A}{h,h^{\prime},u} \gencoeff{B}{g,g^{\prime},v} X^{\map{i}{j}} & = \sum_{h^{\prime},g^{\prime},u,v} \gencoeff{A}{h,h^{\prime},u} \gencoeff{B}{g,g^{\prime},v} X^{i \ensuremath{a} \QCCan \ensuremath{\ell_{A}} + j \ensuremath{b} \QCCbn \ensuremath{\ell_{B}}} \nonumber \\
& = \sum_{h^{\prime},g^{\prime},u,v} \gencoeff{A}{h,h^{\prime},u} \gencoeff{B}{g,g^{\prime},v} X^{g^{\prime} \ensuremath{a} \QCCan \ensuremath{\ell_{A}} + \beta \ensuremath{a} \QCCan \QCCl + v \ensuremath{a} \QCCan \QCCl } X^{h^{\prime} \ensuremath{b} \QCCbn \ensuremath{\ell_{B}} + \alpha \ensuremath{b} \QCCbn \QCCl + u \ensuremath{b} \QCCbn \QCCl} \nonumber \\
& = X^{\QCCl (\beta \ensuremath{a} \QCCan + \alpha \ensuremath{b} \QCCbn) } \sum_{h^{\prime},g^{\prime},u,v} \gencoeff{A}{h,h^{\prime},u} \gencoeff{B}{g,g^{\prime},v} X^{v \ensuremath{a} \QCCan \QCCl } X^{u \ensuremath{b} \QCCbn \QCCl} X^{g^{\prime} \ensuremath{a} \QCCan \ensuremath{\ell_{A}}} X^{h^{\prime} \ensuremath{b} \QCCbn \ensuremath{\ell_{B}}} \nonumber \\
& = X^{\QCCl (\beta \ensuremath{a} \QCCan + \alpha \ensuremath{b} \QCCbn) } \sum_{h^{\prime},g^{\prime}} \gencoeff{A}{h,h^{\prime}}(X^{\ensuremath{b} \QCCbn \QCCl}) \gencoeff{B}{g,g^{\prime}}(X^{\ensuremath{a} \QCCan \QCCl}) X^{g^{\prime} \ensuremath{a} \QCCan \ensuremath{\ell_{A}}} X^{h^{\prime} \ensuremath{b} \QCCbn \ensuremath{\ell_{B}}}. \label{eq_MatrixToPolyUnred}
\end{align}
With $\mapb{\beta}{\alpha}$ as defined in~\eqref{eq_MappingSubCodewordQCCQCC} and using~\eqref{eq_BEzoutRel}, we can reformulate~\eqref{eq_MatrixToPolyUnred} as follows:
\begin{align}
X^{\QCCl (\beta \ensuremath{a} \QCCan + \alpha \ensuremath{b} \QCCbn) } & \sum_{h^{\prime},g^{\prime}} \gencoeff{A}{h,h^{\prime}}(X^{\ensuremath{b} \QCCbn \QCCl}) \gencoeff{B}{g,g^{\prime}}(X^{\ensuremath{a} \QCCan \QCCl}) X^{g^{\prime} \ensuremath{a} \QCCan \ensuremath{\ell_{A}}} X^{h^{\prime} \ensuremath{b} \QCCbn \ensuremath{\ell_{B}}} \nonumber \\
& = X^{\QCCl \mapb{\beta}{\alpha}} \sum_{h^{\prime},g^{\prime}} \gencoeff{A}{h,h^{\prime}}(X^{\ensuremath{b} \QCCbn \QCCl}) \gencoeff{B}{g,g^{\prime}}(X^{\ensuremath{a} \QCCan \QCCl}) X^{g^{\prime} \ensuremath{\ell_{A}} + h^{\prime} \ensuremath{\ell_{B}}} X^{\ensuremath{\ell_{A}} \ensuremath{\ell_{B}} (- g^{\prime} \ensuremath{b} \QCCbm -h^{\prime} \ensuremath{a} \QCCam)} \nonumber \\
& = X^{\QCCl \mapb{\beta}{\alpha}} \sum_{h^{\prime},g^{\prime}} \gencoeff{A}{h,h^{\prime}}(X^{\ensuremath{b} \QCCbn \QCCl}) \gencoeff{B}{g,g^{\prime}}(X^{\ensuremath{a} \QCCan \QCCl}) X^{g^{\prime} \ensuremath{\ell_{A}} + h^{\prime} \ensuremath{\ell_{B}}} X^{\QCCl \submap{g^{\prime}}{h^{\prime}}}, \label{eq_StripeOfCodeword}
\end{align}
where $\submap{g^{\prime}}{h^{\prime}}$ is as in~\eqref{eq_ShiftCodeword}.
With~\eqref{eq_ProofMatrixToUnivariateFirst} of Lemma~\ref{lem_MappingUnivariateQCCQCC}, the $\ith{(g^{\prime},h^{\prime})}$ polynomial of the codeword $X^{\alpha} \mathbf{a}^{(h)}(X) \otimes X^{\beta} \mathbf{b}^{(g)}(X)$ in $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$, in the form of a vector of $\ensuremath{\ell_{A}} \ensuremath{\ell_{B}}$ univariate polynomials, is from~\eqref{eq_StripeOfCodeword}:
\begin{equation}
X^{\mapb{\beta}{\alpha}} \gencoeff{A}{h,h^{\prime}}(X^{\ensuremath{b} \QCCbn}) \gencoeff{B}{g,g^{\prime}}(X^{\ensuremath{a} \QCCan}) X^{\submap{g^{\prime}}{h^{\prime}}} = X^{\mapb{\beta}{\alpha}} u_{g + h \ensuremath{\ell_{B}}, g^{\prime} + h^{\prime}\ensuremath{\ell_{B}}}(X) X^{\submap{g^{\prime}}{h^{\prime}}}.
\end{equation}
Hence $X^{\alpha} \mathbf{a}^{(h)}(X) \otimes X^{\beta} \mathbf{b}^{(g)}(X) $ is given by
\begin{equation}
X^{\mapb{\beta}{\alpha}} \left(0 \ \cdots \ 0 \ u_{g + h \ensuremath{\ell_{B}}, g + h\ensuremath{\ell_{B}}}(X) \ \cdots \ u_{g + h \ensuremath{\ell_{B}}, \QCCl-1}(X)\right) \diag \left( 1,\dots, X^{\submap{\ensuremath{\ell_{B}}-1}{\ensuremath{\ell_{A}}-1}} \right), \quad \forall \alpha \in \interval{k_{A,h}}, \beta \in \interval{k_{B,g}},
\end{equation}
and therefore the subcode $\ensuremath{\mathcal{A}}^{(h)} \otimes \ensuremath{\mathcal{B}}^{(g)}$ is in the subspace generated by
$\left(0 \ \cdots \ 0 \ u_{g + h \ensuremath{\ell_{B}}, g + h\ensuremath{\ell_{B}}}(X) \ \cdots \ u_{g + h \ensuremath{\ell_{B}}, \QCCl-1}(X)\right) \cdot \diag \left( 1, X^{\submap{1}{0}}, \dots, X^{\submap{\ensuremath{\ell_{B}}-1}{\ensuremath{\ell_{A}}-1}} \right)$.
Furthermore, we know that
\begin{equation} \label{eq_BasisProductCode}
X^{\gamma} \left(0 \ \cdots \ 0 \ u_{g + h \ensuremath{\ell_{B}}, g + h\ensuremath{\ell_{B}}}(X) \ \cdots \ u_{g + h \ensuremath{\ell_{B}}, \QCCl-1}(X)\right) \cdot \diag \left( 1, X^{\submap{1}{0}}, \dots, X^{\submap{\ensuremath{\ell_{B}}-1}{\ensuremath{\ell_{A}}-1}} \right)
\end{equation}
equals $X^{\gamma} \mathbf{a}^{(h)}(X) \otimes X^{\gamma} \mathbf{b}^{(g)}(X) $, because $\mapb{\gamma}{\gamma} = \gamma \ensuremath{a} \QCCan + \gamma \ensuremath{b} \QCCbn = \gamma \bmod \QCCm$. Hence~\eqref{eq_BasisProductCode} spans $\ensuremath{\mathcal{A}}^{(h)} \otimes \ensuremath{\mathcal{B}}^{(g)}$ for all $\gamma$ and therefore the subcode $\ensuremath{\mathcal{A}}^{(h)} \otimes \ensuremath{\mathcal{B}}^{(g)}$ is the subspace generated by \eqref{eq_BasisProductCode}, for $\gamma \in [\QCCm)$.
\end{proof}
We consider the unreduced generating set of a $6$-quasi-cyclic product code in the following example according to Thm.~\ref{theo_ProductCodeQCCQCCUnred}.
\begin{example}[Unreduced Basis of a $6$-Quasi-Cyclic Product Code] \label{ex_QCCQCCProductb}
Let $\ensuremath{\mathcal{A}}$ be a $2$-quasi-cyclic code of length $\QCCan = 2\QCCam$ and let $\ensuremath{\mathcal{B}}$ be a $3$-quasi-cyclic code of length $\QCCbn = 3 \QCCbm$, where $\gcd(\QCCan, \QCCbn) = 1$. Let $\QCCm = \QCCam \QCCbm$. The generator matrices of $\ensuremath{\mathcal{A}}$ and $\ensuremath{\mathcal{B}}$ in RGB/POT form are
\begin{equation*}
\genmat[A] =
\begin{pmatrix}
\gen[A][0][0] & \gen[A][0][1] \\
0 & \gen[A][1][1]
\end{pmatrix}
\quad
\text{and}
\quad
\genmat[B] =
\begin{pmatrix}
\gen[B][0][0] & \gen[B][0][1] & \gen[B][0][2] \\
0 & \gen[B][1][1] & \gen[B][1][2] \\
0 & 0 & \gen[B][2][2]
\end{pmatrix}.
\end{equation*}
The unreduced basis $(\mathbf{U}^0(X) \ \mathbf{U}^1(X))^T$ of the $6$-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ as in~\eqref{eq_GenMatrixQCCQCCUnreduced} is:
\begin{align} \label{eq_ExampleGenMatrix6QCC}
\mathbf{U}^0(X) & =
\begin{pmatrix}
\genunred[0][0] & \genunred[0][1] & \genunred[0][2] & \genunred[0][3] & \genunred[0][4] & \genunred[0][5] \\
& \genunred[1][1] & \genunred[1][2] & 0 & \genunred[1][4] & \genunred[1][5] \\
& & \genunred[2][2] & 0 & 0 & \genunred[2][5] \\
& & & \genunred[3][3] & \genunred[3][4] & \genunred[3][5] \\
\multicolumn{3}{c}{\bigzero} & & \genunred[4][4] & \genunred[4][5] \\
& & & & & \genunred[5][5]
\end{pmatrix}\\
& \qquad \cdot \diag \left( 1, X^{\submap{1}{0}}, X^{\submap{2}{0}}, X^{\submap{0}{1}}, X^{\submap{1}{1}}, X^{\submap{2}{1}} \right), \nonumber
\end{align}
and $\mathbf{U}^1(X) = (X^{\QCCm}-1) \mathbf{I}_{6}$.
With $Y=X^{\ensuremath{b} \QCCbn}$, $Z=X^{\ensuremath{a} \QCCan}$, we can write~\eqref{eq_ExampleGenMatrix6QCC} explicitly
\begin{align*}
\mathbf{U}^0(X) =
& \begin{pmatrix}
\genarg{A}[0][0]{Y} \genarg{B}[0][0]{Z} & \genarg{A}[0][0]{Y} \genarg{B}[0][1]{Z} & \genarg{A}[0][0]{Y} \genarg{B}[0][2]{Z} & \genarg{A}[0][1]{Y} \genarg{B}[0][0]{Z} & \genarg{A}[0][1]{Y} \genarg{B}[0][1]{Z} & \genarg{A}[0][1]{Y} \genarg{B}[0][2]{Z} \\
0 & \genarg{A}[0][0]{Y} \genarg{B}[1][1]{Z} & \genarg{A}[0][0]{Y} \genarg{B}[1][2]{Z} & 0 & \genarg{A}[0][1]{Y} \genarg{B}[1][1]{Z} & \genarg{A}[0][1]{Y} \genarg{B}[1][2]{Z} \\
0 & 0 & \genarg{A}[0][0]{Y} \genarg{B}[2][2]{Z} & 0 & 0 & \genarg{A}[0][1]{Y} \genarg{B}[2][2]{Z} \\
0 & 0 & 0 & \genarg{A}[1][1]{Y} \genarg{B}[0][0]{Z} & \genarg{A}[1][1]{Y} \genarg{B}[0][1]{Z} & \genarg{A}[1][1]{Y} \genarg{B}[0][2]{Z} \\
0 & 0 & 0 & 0 & \genarg{A}[1][1]{Y} \genarg{B}[1][1]{Z} & \genarg{A}[1][1]{Y} \genarg{B}[1][2]{Z} \\
0 & 0 & 0 & 0 & 0 & \genarg{A}[1][1]{Y} \genarg{B}[2][2]{Z}
\end{pmatrix}\\
& \qquad \cdot \diag \left( 1, X^{\submap{1}{0}}, X^{\submap{2}{0}}, X^{\submap{0}{1}}, X^{\submap{1}{1}}, X^{\submap{2}{1}} \right),
\end{align*}
where each nonzero{} non-diagonal element is taken modulo $(X^{\QCCm}-1)$.
Note that the matrix $\mathbf{U}^0(X)$ in~\eqref{eq_ExampleGenMatrix6QCC} has a zero entry at the same position as the Kronecker product of $\genmat[A] \otimes \genmat[B]$.
\end{example}
In the following, we derive a reduced basis of a $2$-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$, where $\ensuremath{\ell_{A}}=2$ and $\ensuremath{\ell_{B}}=1$. As in Lemma~\ref{lem_EquivalenceSpectralAnalysis}, we denote the polynomials of the Pre-RGB/POT form that can be different from their counterparts in the RGB/POT form by a bar.
\begin{theorem}[Generator Matrix of a 2-Quasi-Cyclic Product Code in Pre-RGB/POT Form] \label{theo_ProductCode2-QCCTimesCyclic}
Let $\ensuremath{\mathcal{A}}$ be an $\LIN{ \QCCan = 2 \cdot \QCCam}{\QCCak}{\QCCad}{q}$ $2$-quasi-cyclic code with generator matrix $\genmat[A] \in \Fx{q}^{2 \times 2}$ as in~\eqref{eq_GroebMatrixCodeA} and let $\ensuremath{\mathcal{B}}$ be an $\LIN{\QCCbn = \QCCbm}{\QCCbk}{\QCCbd}{q}$ cyclic code with generator polynomial $\gen[B] \in \Fx{q}$. Let $\QCCm = \QCCam \QCCbm$. Then, a generator matrix in $\Fx{q}^{2 \times 2}$ in Pre-RGB/POT form as in~\eqref{eq_PRE-RGBPOTForm} of the $2$-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ is given by:
\begin{equation} \label{eq_GenMatrix2-QCCTimesCyclic}
\bar{\mathbf{G}}(X) =
\begin{pmatrix}
g_{0,0}(X) & \bar{g}_{0,1}(X) \\
0 & g_{1,1}(X) \\
\end{pmatrix} \cdot
\diag(1, X^{-\ensuremath{a} \QCCam}),
\end{equation}
where
\begin{align}
g_{0,0}(X) & = \gcd \left( X^{\QCCm}-1, \genarg{A}[0][0]{X^{\ensuremath{b} \QCCbn}} \genarg{B}{X^{\ensuremath{a} \QCCan}} \right), \nonumber \\
& = u_0(X)(X^{\QCCm}-1) + v_0(X) \genarg{A}[0][0]{X^{\ensuremath{b} \QCCbn}} \genarg{B}{X^{\ensuremath{a} \QCCan}} \label{eq_Bezout1},
\end{align}
for some polynomials $u_0(X), v_0(X) \in \Fx{q}$, and
\begin{align*}
g_{1,1}(X) & = \gcd \left( X^{\QCCm}-1, \genarg{A}[1][1]{X^{\ensuremath{b} \QCCbn}} \genarg{B}{X^{\ensuremath{a} \QCCan}} \right),\\
\bar{g}_{0,1}(X) & = v_0(X) \genarg{A}[0][1]{X^{\ensuremath{b} \QCCbn}} \genarg{B}{X^{\ensuremath{a} \QCCan}}.
\end{align*}
\end{theorem}
\begin{proof}
Let two polynomials $u_1(X), v_1(X) \in \Fx{q}$ be such that
\begin{align*}
g_{1,1}(X) & = \gcd \Big( X^{\QCCm}-1, g_{1,1}^{A}(X^{\ensuremath{b} \QCCbn}) g^{B}(X^{\ensuremath{a} \QCCan}) \Big) \nonumber \\
& = u_1(X)(X^{\QCCm}-1) + v_1(X) g_{1,1}^{A}(X^{\ensuremath{b} \QCCbn}) g^{B}(X^{\ensuremath{a} \QCCan}).
\end{align*}
Now, we transform the basis of the preimage directly. We denote a new Row $i$ by $\rowop{i}'$ and give the operation between two matrices. For ease of notation, we omit the term $\diag(1, X^{-\ensuremath{a} \QCCam})$.
From Thm.~\ref{theo_ProductCodeQCCQCCUnred}, we have:
\begin{align}
& \begin{pmatrix}
g_{0,0}^{A}(X^{\ensuremath{b} \QCCbn}) g^{B}(X^{\ensuremath{a} \QCCan}) & g_{0,1}^{A}(X^{\ensuremath{b} \QCCbn}) g^{B}(X^{\ensuremath{a} \QCCan}) \\
0 & g_{1,1}^{A}(X^{\ensuremath{b} \QCCbn}) g^{B}(X^{\ensuremath{a} \QCCan})\\
X^{\QCCm}-1 & 0 \\
0 & X^{\QCCm}-1
\end{pmatrix} \nonumber \\
& \quad \rowop{0}' \leftarrow \rowop{0} \cdot v_0+ \rowop{2} \cdot u_0 \nonumber \\
& \begin{pmatrix}
g_{0,0}(X) & v_0(X) g_{0,1}^{A}(X^{\ensuremath{b} \QCCbn}) g^{B}(X^{\ensuremath{a} \QCCan}) \\
g_{0,0}^{A}(X^{\ensuremath{b} \QCCbn }) g^{B}(X^{\ensuremath{a} \QCCan}) & g_{0,1}^{A}(X^{\ensuremath{b} \QCCbn}) g^{B}(X^{\ensuremath{a} \QCCan}) \\
0 & g_{1,1}^{A}(X^{ \ensuremath{b} \QCCbn}) g^{B}(X^{\ensuremath{a} \QCCan})\\
X^{\QCCm }-1 & 0 \\
0 & X^{\QCCm}-1
\end{pmatrix} \nonumber \\
& \quad \rowop{1}' \leftarrow \rowop{1} - \frac{g_{0,0}^{A}(X^{\ensuremath{b} \QCCbn}) g^{B}(X^{\ensuremath{a} \QCCan})}{g_{0,0}(X)} \cdot \rowop{0} \nonumber \\
& \quad \rowop{3}' \leftarrow \rowop{3} - \frac{X^{\QCCm}-1}{g_{0,0}(X)} \cdot \rowop{0} \nonumber \\
& \begin{pmatrix} \label{eq_RowRed3}
g_{0,0}(X) & v_0(X) g_{0,1}^{A}(X^{\ensuremath{b} \QCCbn }) g^{B}(X^{\ensuremath{a} \QCCan}) \\
0 & g_{0,1}^{A}(X^{\ensuremath{b} \QCCbn}) g^{B}(X^{\ensuremath{a} \QCCan}) \left( 1 - v_0(X)\frac{g_{0,0}^{A}(X^{\ensuremath{b} \QCCbn}) g^{B}(X^{\ensuremath{a} \QCCan})}{g_{0,0}(X)} \right) \\
0 & g_{1,1}^{A}(X^{\ensuremath{b} \QCCbn}) g^{B}(X^{\ensuremath{a} \QCCan})\\
0 & - \frac{X^{\QCCm}-1}{g_{0,0}(X)} v_0(X) g_{0,1}^{A}(X^{\ensuremath{b} \QCCbn}) g^{B}(X^{\ensuremath{a} \QCCan}) \\
0 & X^{\QCCm}-1
\end{pmatrix},
\end{align}
and with~\eqref{eq_Bezout1}, we can reformulate Row $\rowop{1}$ of the matrix in~\eqref{eq_RowRed3} to
\begin{align}
& \begin{pmatrix} \label{eq_RowRed4}
g_{0,0}(X) & v_0(X) g_{0,1}^{A}(X^{\ensuremath{b} \QCCbn }) g^{B}(X^{\ensuremath{a} \QCCan}) \\
0 & g_{0,1}^{A}(X^{\ensuremath{b} \QCCbn}) g^{B}(X^{\ensuremath{a} \QCCan}) u_0(X)\frac{X^{\QCCm}-1}{g_{0,0}(X)} \\
0 & g_{1,1}^{A}(X^{\ensuremath{b} \QCCbn}) g^{B}(X^{\ensuremath{a} \QCCan})\\
0 & - \frac{X^{\QCCm}-1}{g_{0,0}(X)} v_0(X) g_{0,1}^{A}(X^{\ensuremath{b} \QCCbn}) g^{B}(X^{\ensuremath{a} \QCCan}) \\
0 & X^{\QCCm}-1
\end{pmatrix}.
\end{align}
Using that $u_0(X)$ and $v_0(X)$ are relatively prime, we can merge $\rowop{1}$ and $\rowop{3}$ of the matrix in~\eqref{eq_RowRed4} to:
\begin{align}
& \begin{pmatrix}
g_{0,0}(X) & v_0(X) g_{0,1}^{A}(X^{\ensuremath{b} \QCCbn}) g^{B}(X^{\ensuremath{a} \QCCan}) \\
0 & g_{1,1}^{A}(X^{\ensuremath{b} \QCCbn}) g^{B}(X^{\ensuremath{a} \QCCan})\\
0 & \frac{X^{\QCCm}-1}{g_{0,0}(X)} g_{0,1}^{A}(X^{\ensuremath{b} \QCCbn }) g^{B}(X^{\ensuremath{a} \QCCan}) \\
0 & X^{\QCCm}-1
\end{pmatrix} \nonumber \\
& \quad \text{Merge } \rowop{1} \text{ and } \rowop{3} \text{, because } g_{1,1}(X) = \gcd \left( X^{\QCCm}-1, g_{1,1}^{A}(X^{\ensuremath{b} \QCCbn}) g^{B}(X^{\ensuremath{a} \QCCan})\right) \nonumber \\
& \begin{pmatrix} \label{eq_RowRed6}
g_{0,0}(X) & v_0(X) g_{0,1}^{A}(X^{\ensuremath{b} \QCCbn}) g^{B}(X^{\ensuremath{a} \QCCan}) \\
0 & \frac{X^{\QCCm}-1}{g_{0,0}(X)} g_{0,1}^{A}(X^{\ensuremath{b} \QCCbn}) g^{B}(X^{\ensuremath{a} \QCCan}) \\
0 & g_{1,1}(X)
\end{pmatrix}.
\end{align}
In the last step, we show that $g_{1,1}(X) \mid \frac{X^{\QCCm}-1}{g_{0,0}(X)} g_{0,1}^{A}(X^{\ensuremath{b} \QCCbn }) g^{B}(X^{\ensuremath{a} \QCCan})$ and therefore Row $\rowop{1}$ of the matrix as in~\eqref{eq_RowRed6} can be deleted.
From~\cite[Eq. (4)]{lally_algebraic_2001}, we know that for any generator matrix $\genmat[A] \in \Fx{q}^{2 \times 2}$ in RGB/POT form, there exists a matrix $\mathbf{A}(X) = (a_{i,j}^A(X))^{j \in \interval{2}}_{i \in \interval{2}} \in \Fx{q}^{2 \times 2}$ with $a_{1,0}^A(X)= 0$ such that
\begin{align} \label{eq_FromRGBPOTForA}
\mathbf{A}(X) \genmat[A] & = (X^{\QCCam}-1) \mathbf{I}_{2}.
\end{align}
We have
\begin{align}
g_{1,1}(X) & = \gcd \left( g_{1,1}^A(X^{\ensuremath{b} \QCCbn}) g^{B}(X^{\ensuremath{a} \QCCan}) ,X^{\QCCm}-1 \right) \nonumber \\
& = \lcm \left( \gcd \left( g_{1,1}^A(X^{\ensuremath{b} \QCCbn}),X^{\QCCm}-1 \right), \gcd \left( g^{B}(X^{\ensuremath{a} \QCCan}), X^{\QCCm}-1 \right) \right). \label{eq_FirstStepSubstitute}
\end{align}
From~\eqref{eq_FromRGBPOTForA}, we obtain $g_{1,1}^A(X^{\ensuremath{b} \QCCbn}) = -g_{0,1}^A(X^{\ensuremath{b} \QCCbn}) a_{0,0}^A(X^{\ensuremath{b} \QCCbn}) /a_{0,1}^A(X^{\ensuremath{b} \QCCbn}) $ and inserted in~\eqref{eq_FirstStepSubstitute} leads to:
\begin{align} \label{eq_ExpressionForG11}
g_{1,1}(X) & = \lcm \left( \gcd \left( \frac{g_{0,1}^A(X^{\ensuremath{b} \QCCbn}) a_{0,0}^A(X^{\ensuremath{b} \QCCbn}) }{a_{0,1}^A(X^{\ensuremath{b} \QCCbn})},X^{\QCCm}-1 \right) , \gcd \left( g^{B}(X^{\ensuremath{a} \QCCan}), X^{\QCCm}-1 \right) \right).
\end{align}
From~\eqref{eq_ExpressionForG11}, we can conclude that:
\begin{align}
g_{1,1}(X) & \mid \lcm \left( \gcd \left( g_{0,1}^A(X^{\ensuremath{b} \QCCbn}) a_{0,0}^A(X^{\ensuremath{b} \QCCbn}) ,X^{\QCCm}-1 \right) , \gcd \left( g^{B}(X^{\ensuremath{a} \QCCan}), X^{\QCCm}-1 \right) \right), \nonumber
\end{align}
which implies that
\begin{align}
g_{1,1}(X) & \mid g_{0,1}^A(X^{\ensuremath{b} \QCCbn}) \lcm \left( \gcd \left( a_{0,0}^A(X^{\ensuremath{b} \QCCbn}) ,X^{\QCCm}-1 \right) , \gcd \left( g^{B}(X^{\ensuremath{a} \QCCan}), X^{\QCCm}-1 \right) \right). \label{eq_BeforeSubsta00}
\end{align}
The polynomial $X^{\QCCam}-1$ has no repeated roots and we have $a_{0,0}^A(X) g_{0,0}^A(X) = X^{\QCCam}-1$. Clearly $a_{0,0}^A(X)$ and $g_{0,0}^A(X)$ are co-prime, i.e., $\exists u(X), v(X) \in \Fx{q}$, such that
\begin{align*}
u(X) a_{0,0}^A(X) + v(X) g_{0,0}^A(X) & = 1,
\end{align*}
implying that
\begin{align*}
u(X^{\ensuremath{b} \QCCbn}) a_{0,0}^A(X^{\ensuremath{b} \QCCbn}) + v(X^{\ensuremath{b} \QCCbn}) g_{0,0}^A(X^{\ensuremath{b} \QCCbn}) & = 1.
\end{align*}
Hence, the polynomials $a_{0,0}^A(X^{\ensuremath{b} \QCCbn})$ and $g_{0,0}^A(X^{\ensuremath{b} \QCCbn})$ are also relatively prime.
From $a_{0,0}^A(X^{\ensuremath{b} \QCCbn}) g_{0,0}^A(X^{\ensuremath{b} \QCCbn}) = X^{\ensuremath{b} \QCCm}-1 $, we can conclude that
\begin{align}
\gcd(a_{0,0}^A(X^{\ensuremath{b} \QCCbn}), X^{\QCCm}-1) \gcd(g_{0,0}^A(X^{\ensuremath{b} \QCCbn}), X^{\QCCm}-1) & = \gcd(X^{\QCCm \ensuremath{b}}-1, X^{\QCCm}-1) = X^{\QCCm}-1. \nonumber
\end{align}
Therefore
\begin{align}
\gcd(a_{0,0}^A(X^{\ensuremath{b} \QCCbn}), X^{\QCCm}-1) & = \frac{X^{\QCCm}-1}{\gcd(g_{0,0}^A(X^{\ensuremath{b} \QCCbn}), X^{\QCCm}-1)}. \label{eq_ExpressionForA00}
\end{align}
Inserting~\eqref{eq_ExpressionForA00} in~\eqref{eq_BeforeSubsta00} leads to:
\begin{align} \label{eq_BeforeExtendinga}
g_{1,1}(X) & \mid g_{0,1}^A(X^{\ensuremath{b} \QCCbn}) \lcm \left( \frac{X^{\QCCm}-1}{\gcd(g_{0,0}^A(X^{\ensuremath{b} \QCCbn}), X^{\QCCm}-1)} , \gcd \left( g^{B}(X^{\ensuremath{a} \QCCan}), X^{\QCCm}-1 \right) \right).
\end{align}
Note that
\begin{align}
& \gcd \left(g_{0,0}^A(X^{\ensuremath{b} \QCCbn}) g^B(X^{\ensuremath{a} \QCCan}), X^{\QCCm}-1 \right) \mid \gcd \left( g_{0,0}^A(X^{\ensuremath{b} \QCCbn}), X^{\QCCm}-1 \right) \gcd\left(g^B(X^{\ensuremath{a} \QCCan}), X^{\QCCm}-1 \right),
\end{align}
which is equivalent to
\begin{align}
& f(X) \gcd \left( g_{0,0}^A(X^{\ensuremath{b} \QCCbn}) g^B(X^{\ensuremath{a} \QCCan}), X^{\QCCm}-1 \right) = \gcd \left(g_{0,0}^A(X^{\ensuremath{b} \QCCbn}), X^{\QCCm}-1 \right) \gcd \left(g^B(X^{\ensuremath{a} \QCCan}), X^{\QCCm}-1 \right), \label{eq_MultipleForGCD}
\end{align}
for some $f(X) \in \Fx{q}$.
Extending the numerator and the denominator of the first lcm-term in~\eqref{eq_BeforeExtendinga} by $\gcd(g^B(X^{\ensuremath{a} \QCCan}), X^{\QCCm}-1)$ gives:
\begin{align} \label{eq_BeforeExtendingb}
g_{1,1}(X) & \mid g_{0,1}^A(X^{\ensuremath{b} \QCCbn}) \lcm \left( \frac{(X^{\QCCm}-1)\gcd(g^B(X^{\ensuremath{a} \QCCan}), X^{\QCCm}-1) }{ f(X) \gcd \left( g_{0,0}^A(X^{\ensuremath{b} \QCCbn}) g^B(X^{\ensuremath{a} \QCCan}), X^{\QCCm}-1 \right)} , \gcd \left( g^{B}(X^{\ensuremath{a} \QCCan}), X^{\QCCm}-1 \right) \right).
\end{align}
Multiplying the RHS of~\eqref{eq_BeforeExtendingb} by a polynomial in $\Fx{q}$ does not change the divisibility. We multiply with $f(X)$ as in~\eqref{eq_MultipleForGCD} and obtain:
\begin{align} \label{eq FullExtension}
g_{1,1}(X) & \mid g_{0,1}^A(X^{\ensuremath{b} \QCCbn}) \lcm \left( \frac{(X^{\QCCm}-1)\gcd(g^B(X^{\ensuremath{a} \QCCan}), X^{\QCCm}-1)}{ f(X) \gcd \left( g_{0,0}^A(X^{\ensuremath{b} \QCCbn}) g^B(X^{\ensuremath{a} \QCCan}), X^{\QCCm}-1 \right)} f(X) , \gcd \left( g^{B}(X^{\ensuremath{a} \QCCan}), X^{\QCCm}-1 \right) \right).
\end{align}
We can extract the obtained factors from~\eqref{eq FullExtension} and get:
\begin{align*}
g_{1,1}(X) & \mid g_{0,1}^A(X^{\ensuremath{b} \QCCbn}) \frac{X^{\QCCm}-1}{g_{0,0}(X)} \lcm \left( \gcd( g^{B}(X^{\ensuremath{a} \QCCan}), X^{\QCCm}-1 ), \gcd \left( g^{B}(X^{\ensuremath{a} \QCCan}), X^{\QCCm}-1 \right) \right),\\
& = g_{0,1}^A(X^{\ensuremath{b} \QCCbn}) \frac{X^{\QCCm}-1}{g_{0,0}(X)} \gcd \left( g^{B}(X^{\ensuremath{a} \QCCan}), X^{\QCCm}-1 \right),\\
g_{1,1}(X) & \mid g_{0,1}^A(X^{\ensuremath{b} \QCCbn}) \frac{X^{\QCCm}-1}{g_{0,0}(X)} g^{B}(X^{\ensuremath{a} \QCCan}).
\end{align*}
Therefore we can delete Row $\rowop{1}$ of the matrix as in~\eqref{eq_RowRed6} and obtain the matrix in Pre-RGB/POT form as in~\eqref{eq_GenMatrix2-QCCTimesCyclic}, where we omitted the term $\diag(1, X^{-\ensuremath{a} \QCCam})$ during the proof.
\end{proof}
We consider an example of the generator matrix of a binary $2$-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ in Pre-RGB/POT form, where the row-code $\ensuremath{\mathcal{A}}$ is $2$-quasi-cyclic and the column-code $\ensuremath{\mathcal{B}}$ is cyclic.
\begin{example}[Binary $2$-Quasi-Cyclic Product Code] \label{ex_BinaryQCCode}
Let $\alpha$ be a $21^{\text{st}}$ root of unity in $\F{2^{12}} \cong \Fx{2}/(X^{12} + X^7 + X^6 + X^5 + X^3 + X + 1)$.
Let $\ensuremath{\mathcal{A}}$ be a binary $\LIN{2 \cdot 21}{17}{8}{2}$ $2$-quasi-cyclic code with generator matrix in RGB/POT form:
\begin{equation*}
\genmat[A] =
\begin{pmatrix}
\gen[A][0][0] & \gen[A][0][1]\\
0 & \gen[A][1][1]
\end{pmatrix},
\end{equation*}
where
\begin{align*}
\gen[A][0][0] & = \minpoly{\alpha} \cdot \minpoly{\alpha^3} \cdot \minpoly{\alpha^7},\\
\gen[A][0][1] & = \gen[A][0][0] \cdot (X^2+1), \\
\gen[A][1][1] & = \gen[A][0][0] \cdot \minpoly{\alpha^9},
\end{align*}
where the minimal polynomial $\minpoly{\alpha^i}$ was defined in~\eqref{eq_MinPoly}.
The common roots $\alpha^i$ of $\gen[A][0][0], \gen[A][0][1]$ and $\gen[A][1][1]$, where $i \in \coset{1} \cup \coset{3} \cup \coset{7} = \{1,2,3,4,6,7,8,11,12,14,16\}$ are eigenvalues of $\genmat[A]$ with multiplicity two and the corresponding eigenvectors span the full space $\F{2^{12}}^2$ (see~\eqref{eq_cyclotomiccoset} for the definition of a cyclotomic coset \coset{i}).
Let $\beta$ be a $\ith{5}$ root of unity and let $\gen[B] = \minpoly{\beta^0} = X+1$ be the generator polynomial of the $\LIN{5}{4}{2}{2}$ cyclic code $\ensuremath{\mathcal{B}}$. Let $\ensuremath{a} = 3$ and $\ensuremath{b} = -25$ be such that~\eqref{eq_BEzoutRel} holds. Let $\gamma = \alpha \beta$ and we have
\begin{align*}
X^{105}-1 & = \prod_{i \in \substack{\{0,1,3,5,7,9,11,13,15,\\17,21,25,35,45,49\}}} \minpoly{\gamma^i}.
\end{align*}
According to Thm.~\ref{theo_ProductCode2-QCCTimesCyclic}, the generator matrix in Pre-RGB/POT form as defined in~\eqref{eq_PRE-RGBPOTForm} of the $\LIN{2 \cdot 105}{68}{16}{2}$ 2-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ is
\begin{equation*}
\bar{\mathbf{G}}(X) =
\begin{pmatrix}
\gen[0][0] & \genbar[0][1]\\
0 & \gen[1][1]
\end{pmatrix} \cdot \diag \left( 1, X^{-3 \cdot 21} \right),
\end{equation*}
where
\begin{align*}
\gen[0][0] & = \prod_{i \in \substack{\{0,1,3,5,7,9,11,\\15,21,25,35,45\}}} \minpoly{\gamma^i},\\
\genbar[0][1] & \equiv v_0(X) \genarg{A}[0][1]{X^{-25 \cdot 5}} \genarg{B}{X^{3 \cdot 42 }} \mod (X^{105}-1) \\
& \equiv (X^{39} + X^{38} + X^{36} + X^{35} + X^{32} + X^{30} + X^{25} + X^{24} + X^{22} + X^{20} + X^{18} + X^{17} + X^{12} + X^{11} + X^{10} + \\
& \qquad X^{6} + X^{3} + X^{2} + 1)(X^{95} + X^{91} + X^{76} + X^{71} + X^{70} + X^{55} + X^{51} + X^{50} + X^{46} + X^{31} + X^{30} + X^{25} + \\
& \qquad X^{21} + X^{11} + X^{10} + 1) \mod (X^{105}-1) \\
& \equiv X^{95} + X^{92} + X^{91} + X^{90} + X^{89} + X^{86} + X^{85} + X^{84} + X^{82} + X^{80} + X^{75} + X^{72} + X^{71} + X^{69} + X^{67} + \\
& \qquad X^{62} + X^{61} + X^{59} + X^{57} + X^{52} + X^{51} + X^{49} + X^{47} + X^{45} + X^{30} + X^{27} + X^{26} + X^{24} + X^{22} + X^{20} + \\
& \qquad X^{15} + X^{12} + X^{11} + X^{10} + X^{9} + X^{6} + X^{5} + X^{4} + X^{2} + 1 \mod (X^{105}-1),\\
\gen[1][1] & = \gen[0][0] \cdot \minpoly{\gamma^9},
\end{align*}
where $\deg \gen[1][1] = 77 $. Performing row-reduction on $\bar{\mathbf{G}}(X)$ leads to the RGB/POT form, where:
\begin{align*}
\gen[0][1] & = X^{75} + X^{72} + X^{71} + X^{69} + X^{67} + X^{62} + X^{61} + X^{59} + X^{57} + X^{55} + X^{40} + X^{37} + X^{36} + X^{35} + X^{34} + \\
& \qquad X^{31} + X^{30} + X^{29} + X^{27} + X^{25} + X^{20} + X^{17} + X^{16} + X^{14} + X^{12} + X^{10}.
\end{align*}
\end{example}
The following theorem gives the generator matrix in RGB/POT form (as defined in~\eqref{def_GroebBasisMatrix}) of an $\QCCl$-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$, where the row-code $\ensuremath{\mathcal{A}}$ is a $1$-level $\QCCl$-quasi-cyclic code and $\ensuremath{\mathcal{B}}$ is a cyclic code (see Definition~\ref{def_LevelQC} for the property $1$-level).
\begin{theorem}[Generator Matrix of a $1$-Level Quasi-Cyclic Product Code in RGB/POT Form] \label{theo_OneLevelQC}
Let $\ensuremath{\mathcal{A}}$ be an $\LIN{\QCCan = \QCCl \cdot \QCCam}{\QCCak}{\QCCad}{q}$ $1$-level $\QCCl$-quasi-cyclic code with generator matrix in RGB/POT form:
\begin{align*}
\genmat[A] & = \begin{pmatrix} \gen[A][0][0] & \hspace{.2cm} \gen[A][0][1] & \hspace{.55cm} \cdots & \hspace{.3cm} \gen[A][0][\QCCl-1]
\end{pmatrix} \nonumber \\
& = \begin{pmatrix}
\gen[A] & \gen[A] f_{1}^{A}(X) & \cdots & \gen[A] f_{\QCCl-1}^{A}(X)
\end{pmatrix} \label{eq_GenMatrixQCCOneLevel}
\end{align*}
as shown in Corollary~\ref{cor_OneLevelQC}. Let $\ensuremath{\mathcal{B}}$ be an $\LIN{\QCCbn=\QCCbm}{\QCCbk}{\QCCbd}{q}$ cyclic code with generator polynomial $\gen[B] \in \Fx{q}$. Let $\QCCm = \QCCam \QCCbm$. Then the generator matrix of the $1$-level $\QCCl$-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ in RGB/POT form is:
\begin{equation*}
\genmat =
\begin{pmatrix}
\gen & \gen f_{1}^{A}(X^{\ensuremath{b} \QCCbn}) & \cdots & \gen f_{\QCCl-1}^{A}(X^{\ensuremath{b} \QCCbn })
\end{pmatrix}
\cdot \diag \big( 1, X^{-\ensuremath{a} \QCCam}, X^{-2 \ensuremath{a} \QCCam}, \dots, X^{- (\QCCl-1) \ensuremath{a} \QCCam} \big),
\end{equation*}
where
\begin{equation*} \label{eq_GCDOneLevel}
\gen = \gcd \left( X^{\QCCm}-1, \genarg{A}{X^{\ensuremath{b} \QCCbn}} \genarg{B}{X^{\ensuremath{a} \QCCan}} \right) .
\end{equation*}
\end{theorem}
\begin{proof}
Let two polynomials $u(X), v(X) \in \Fx{q}$ be such that:
\begin{equation} \label{eq_BezoutProductDiagOneLevel}
\begin{split}
\gen & = u(X) (X^{\QCCm}-1) + v(X) \genarg{A}{X^{\ensuremath{b} \QCCbn}} \genarg{B}{X^{\ensuremath{a} \QCCan }}.
\end{split}
\end{equation}
We show how to reduce the basis representation to the RGB/POT form. As in the proof of Thm.~\ref{theo_ProductCode2-QCCTimesCyclic}, we denote a new Row $i$ by $\rowop{i}'$. For ease of notation, we omit the term $\diag(1, X^{-\ensuremath{a} \QCCam}, X^{-2 \ensuremath{a} \QCCam}, \dots ,X^{- (\QCCl-1) \ensuremath{a} \QCCam} )$.
According to Thm.~\ref{theo_ProductCodeQCCQCCUnred}, the unreduced basis of $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ is:
\begingroup
\begin{align}
& \begin{pmatrix}
\genarg{A}{X^{\ensuremath{b} \QCCbn}} \genarg{B}{X^{\ensuremath{a} \QCCan}} & \genarg{A}{X^{\ensuremath{b} \QCCbn}} f_{1}^{A}(X^{\ensuremath{b} \QCCbn}) \genarg{B}{X^{\ensuremath{a} \QCCan}} & \cdots & \genarg{A}{X^{\ensuremath{b} \QCCbn}} f_{\QCCl-1}^{A}(X^{\ensuremath{b} \QCCbn}) \genarg{B}{X^{\ensuremath{a} \QCCan}} \\
X^{\QCCm}-1 & \\
& X^{\QCCm}-1 & \multicolumn{2}{c}{\bigzero} \\
\multicolumn{2}{c}{\bigzero} & \ddots & \\
& & & X^{\QCCm}-1
\end{pmatrix} \label{eq_StartMatrix} \\[2ex]
& \rowop{0}' \leftarrow v(X)\rowop{0} + u(X) \rowop{1} + u(X) f_{1}^{A}(X^{\ensuremath{b} \QCCbn}) \rowop{2} + \dots + u(X) f_{\QCCl-1}^{A}(X^{\ensuremath{b} \QCCbn}) \rowop{\QCCl} \nonumber \\[2ex]
& \begin{pmatrix}
\gen & \gen f_{1}^{A}(X^{\ensuremath{b} \QCCbn}) & \cdots & \gen f_{\QCCl-1}^{A}(X^{\ensuremath{b} \QCCbn}) \\
\genarg{A}{X^{\ensuremath{b} \QCCbn}} \genarg{B}{X^{\ensuremath{a} \QCCan}} & \genarg{A}{X^{\ensuremath{b} \QCCbn}} f_{1}^{A}(X^{\ensuremath{b} \QCCbn}) \genarg{B}{X^{\ensuremath{a} \QCCan}} & \cdots & \genarg{A}{X^{\ensuremath{b} \QCCbn}} f_{\QCCl-1}^{A}(X^{\ensuremath{b} \QCCbn}) \genarg{B}{X^{\ensuremath{a} \QCCan}} \\
X^{\QCCm}-1 & \\
& X^{\QCCm }-1 & \multicolumn{2}{c}{\bigzero} \\
\multicolumn{2}{c}{\bigzero} & \ddots & \\
& & & X^{\QCCm}-1
\end{pmatrix}, \label{eq_MatrixFirstMerge}
\end{align}
where the $\ith{i}$ entry in the new Row $\rowop{0}$ in the matrix in~\eqref{eq_MatrixFirstMerge} from matrix in~\eqref{eq_StartMatrix} was obtained using:
\begin{align}
v(X) \genarg{A}{X^{\ensuremath{b} \QCCbn}} f_{i}^{A}(X^{\ensuremath{b} \QCCbn}) \genarg{B}{X^{\ensuremath{a} \QCCan}} + & u(X) f_{i}^{A}(X^{\ensuremath{b} \QCCbn}) (X^{\QCCm} -1) \nonumber \\
& = f_{i}^{A}(X^{\ensuremath{b} \QCCbn}) \big( v(X) \genarg{A}{X^{\ensuremath{b} \QCCbn}} \genarg{B}{X^{\ensuremath{a} \QCCan}} + u(X) (X^{\QCCm} - 1) \big). \label{eq_PreGCDForm}
\end{align}
Inserting~\eqref{eq_BezoutProductDiagOneLevel} into~\eqref{eq_PreGCDForm} gives:
\begin{align*}
f_{i}^{A}(X^{\ensuremath{b} \QCCbn}) \big( v(X) \genarg{A}{X^{\ensuremath{b} \QCCbn}} \genarg{B}{X^{\ensuremath{a} \QCCan}} + u(X) (X^{\QCCm}-1) \big) = f_{i}^{A}(X^{\ensuremath{b} \QCCbn}) \gen.
\end{align*}
Clearly, $\gen$ divides $\genarg{A}{X^{\ensuremath{b} \QCCbn}} \genarg{B}{X^{\ensuremath{a} \QCCan}}$ and it is easy to check that Row $\rowop{1}$ of the matrix in~\eqref{eq_MatrixFirstMerge} can be obtained from Row $\rowop{0}$ by multiplying by $\genarg{A}{X^{\ensuremath{b} \QCCbn}} \genarg{B}{X^{\ensuremath{a} \QCCan}}/\gen$.
Therefore, we can omit the linearly dependent Row $\rowop{1}$ in~\eqref{eq_MatrixFirstMerge} and the reduced basis in RGB/POT form is:
\begin{align*}
& \begin{pmatrix}
\gen \hspace*{.3cm} & \gen f_{1}^{A}(X^{\ensuremath{b} \QCCbn}) & \cdots & \gen f_{\QCCl-1}^{A}(X^{\ensuremath{b} \QCCbn})
\end{pmatrix},
\end{align*}
where we omitted the matrix $\diag (1, X^{-\ensuremath{a} \QCCam}, X^{-2 \ensuremath{a} \QCCam}, \dots, X^{- (\QCCl-1) \ensuremath{a} \QCCam})$ during the proof.
\endgroup
\end{proof}
We conjecture the (general form of the) generator matrix in Pre-RGB/POT form of an $\ensuremath{\ell_{A}} \ensuremath{\ell_{B}}$-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ in the following. We reduced the unreduced basis of several examples and could verify Conjecture~\ref{conj_ProductCodeQCCQCC}.
\begin{conjecture}[Generator Matrix of an $\ensuremath{\ell_{A}} \ensuremath{\ell_{B}}$-Quasi-Cyclic Product Code in Pre-RGB/POT Form] \label{conj_ProductCodeQCCQCC}
Let $\ensuremath{\mathcal{A}}$ be an $\LIN{\QCCan = \ensuremath{\ell_{A}} \cdot \QCCam}{\QCCak}{\QCCad}{q}$ $\ensuremath{\ell_{A}}$-quasi-cyclic code with generator matrix $\genmat[A] \in \Fx{q}^{\ensuremath{\ell_{A}} \times \ensuremath{\ell_{A}}}$ as in~\eqref{eq_GroebMatrixCodeA} and let $\ensuremath{\mathcal{B}}$ be an $\LIN{\QCCbn = \ensuremath{\ell_{B}} \cdot \QCCbm}{\QCCbk}{\QCCbd}{q}$ $\ensuremath{\ell_{B}}$-quasi-cyclic code with generator matrix $\genmat[B] \in \Fx{q}^{\ensuremath{\ell_{B}} \times \ensuremath{\ell_{B}}}$ as in~\eqref{eq_GroebMatrixCodeB}. Let $\QCCm = \QCCam \QCCbm$ and $\QCCl = \ensuremath{\ell_{A}} \ensuremath{\ell_{B}}$.
Then, a generator matrix in $\Fx{q}^{\QCCl \times \QCCl}$ in Pre-RGB/POT form of the $\LIN{\QCCn = \QCCl \cdot \QCCm}{\QCCak \QCCbk}{\QCCad \QCCbd}{q}$ $\QCCl$-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ is given by:
\begin{equation*} \label{eq_GenMatrixQCCQCC}
\begin{split}
\bar{\mathbf{G}}(X) & =
\begin{pmatrix}
g_{0,0}(X) & \bar{g}_{0,1}(X) & \cdots & \cdots & \bar{g}_{0,\QCCl-1}(X) \\
& g_{1,1}(X) & \cdots & \cdots & \bar{g}_{1,\QCCl-1}(X) \\
& & \ddots & \vdots & \vdots \\
\multicolumn{3}{c}{\bigzero} & g_{\QCCl-2,\QCCl-2}(X) & \bar{g}_{\QCCl-2,\QCCl-1}(X) \\
& & & & g_{\QCCl-1,\QCCl-1}(X)
\end{pmatrix} \\
& \qquad \qquad \cdot \diag \left( 1, X^{\submap{1}{0}}, \dots, X^{\submap{\ensuremath{\ell_{B}}-1}{0}},\dots, X^{\submap{\ensuremath{\ell_{B}}-1}{\ensuremath{\ell_{A}}-1}} \right),
\end{split}
\end{equation*}
where the $\QCCl$ diagonal entries are
\begin{align}
g_{g+h\ensuremath{\ell_{B}}, g+h\ensuremath{\ell_{B}}}(X) & = \gcd \Big( X^{\QCCm}-1, \genarg{A}[h][h]{X^{\ensuremath{b} \QCCbn}} \genarg{B}[g][g]{X^{\ensuremath{a} \QCCan}} \Big), \quad \forall g \in \interval{\ensuremath{\ell_{B}}}, \forall h \in \interval{\ensuremath{\ell_{A}}} \label{eq_DiagonalElementsProductCodeQCCQCC}.
\end{align}
Let the polynomials $u_{g,h}(X), v_{g,h}(X) \in \Fx{q}$ be such that:
\begin{equation*} \label{eq_BezoutProductDiag}
\begin{split}
\gen[g+h\ensuremath{\ell_{B}}][g+h\ensuremath{\ell_{B}}] & = u_{g,h}(X) (X^{\QCCm}-1) + v_{g,h}(X) \genarg{A}[h][h]{X^{\ensuremath{b} \QCCbn}} \genarg{B}[g][g]{X^{\ensuremath{a} \QCCan }}, \quad \forall g \in \interval{\ensuremath{\ell_{B}}}, \forall h \in \interval{\ensuremath{\ell_{A}}}.
\end{split}
\end{equation*}
Then the off-diagonal entries of the matrix $\bar{\mathbf{G}}(X)$ are given by
\begin{equation*} \label{eq_NonDiagonalElementsProductCodeQCCQCC}
\begin{split}
\bar{g}_{g+h\ensuremath{\ell_{B}},g^{\prime} + h^{\prime}\ensuremath{\ell_{B}}}(X) & = v_{g,h}(X) \genarg{A}[h][h^{\prime}]{X^{\ensuremath{b} \QCCbn}} \genarg{B}[g][g^{\prime}]{X^{\ensuremath{a} \QCCan}} \mod (X^{\QCCm}-1), \\
& \qquad \qquad \forall g \in \interval{\ensuremath{\ell_{B}}}, h \in \interval{\ensuremath{\ell_{A}}},g^{\prime} \in \interval{g+1, \ensuremath{\ell_{B}}}, h^{\prime} \in \interval{h+1, \ensuremath{\ell_{A}}}.
\end{split}
\end{equation*}
\end{conjecture}
Note that the expression of the diagonal terms in~\eqref{eq_DiagonalElementsProductCodeQCCQCC} is equivalent to the generator polynomial of a cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ where the cyclic row-code $\ensuremath{\mathcal{A}}$ is generated by $\genarg{A}[h][h]{X}$ and the generator polynomial of the cyclic column-code $\ensuremath{\mathcal{B}}$ is $\genarg{B}[g][g]{X}$.
\section{Spectral Analysis of a Quasi-Cyclic Product Code and Bounding The Minimum Hamming Distance} \label{sec_SpectralAnalysis}
\subsection{Spectral Analysis} \label{subsec_SpectralAnalysisProduct}
In this section, we apply the spectral techniques of Semenov and Trifonov~\cite{semenov_spectral_2012} to an $\QCCl$-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$, where $\ensuremath{\mathcal{A}}$ is an $\QCCl$-quasi-cyclic code and $\ensuremath{\mathcal{B}}$ is a cyclic code, and generalize the results for a cyclic product code as in~\cite[Thm. 4]{lin_further_1970}.
Furthermore, we bound the minimum Hamming distance of a given $\QCCl$-quasi-cyclic code $\ensuremath{\mathcal{A}}$ by embedding it into an $\QCCl$-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$. This method extends the approach of~\cite[Thm. 4]{zeh_generalizing_2013}, where a lower bound on the minimum Hamming distance of a given cyclic code was obtained through embedding it into a cyclic product code.
It turns out that the eigenvalues of maximal multiplicity $\QCCl$ of the $\QCCl$-quasi-cyclic code $\ensuremath{\mathcal{A}}$ and the zeros of $\ensuremath{\mathcal{B}}$ occur in the spectral analysis of the $\QCCl$-quasi-cyclic code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ with maximal multiplicity $\QCCl$. This is similar to the appearance of the zeros of two cyclic codes in the generator polynomial of their cyclic product code. The eigenvalues of multiplicity smaller than $\QCCl$ of $\ensuremath{\mathcal{A}}$ and the nonzero{}s of $\ensuremath{\mathcal{B}}$ are reflected in the spectral analysis of $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ in a manner similar to that of the nonzero{}s of two cyclic codes $\ensuremath{\mathcal{A}}$ and $\ensuremath{\mathcal{B}}$ in the case of a cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$. Therefore, they are treated separately in Lemma~\ref{lem_EigenvaluesMaxMulti} and in Lemma~\ref{lem_EigenvaluesSmallerThanMax}.
Throughout this section, let $\ensuremath{\mathcal{A}}$ be an $\LIN{\QCCan = \QCCl \cdot \QCCam}{\QCCak}{\QCCad}{q}$ $\QCCl$-quasi-cyclic code with generator matrix in RGB/POT form as in~\eqref{eq_GroebMatrixCodeA} and let $\ensuremath{\mathcal{B}}$ be an $\LIN{\QCCbn = \QCCbm}{\QCCbk}{\QCCbd}{q}$ cyclic code with generator polynomial $\gen[B]$. Let $\QCCm = \QCCam \QCCbm$. The product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ is an $\LIN{\QCCl \cdot \QCCm}{\QCCak \QCCbk}{\QCCad \QCCbd}{q}$ $\QCCl$-quasi-cyclic code with generator matrix in Pre-RGB/POT form as given in Conjecture~\ref{conj_ProductCodeQCCQCC}, i.e., their entries are:
\begin{align}
\gen[h][h] & = u_h(X) (X^{\QCCm}-1) + v_h(X) \genarg{A}[h][h]{X^{\ensuremath{b} \QCCbn}} \genarg{B}{X^{\ensuremath{a} \QCCan}}, & \forall h \in \interval{\QCCl} \label{eq_QCTimeCyclicDiag},\\
\bar{g}_{h,h^{\prime}}(X) & = v_h(X) \genarg{A}[h][h^{\prime}]{X^{\ensuremath{b} \QCCbn}} \genarg{B}{X^{\ensuremath{a} \QCCan}}, & \forall h \in \interval{\QCCl}, h^{\prime} \in \interval{h+1, \QCCl}. \label{eq_QCTimeCyclicNonDiag}
\end{align}
Furthermore, as in~\eqref{eq_BEzoutRel} let throughout this section two nonzero{} integers $\ensuremath{a}, \ensuremath{b}$ be such that $\ensuremath{a} \QCCan + \ensuremath{b} \QCCbn = 1$.
For a given set $A = \{a_0, a_1, \dots, a_{|A|-1}\}$, denote by $\shiftset{A}{z} \overset{\defi}{=} \{a_i+z \mid a_{i} \in A \}$.
\begin{lemma}[Eigenvalues Of Maximal Multiplicity] \label{lem_EigenvaluesMaxMulti}
Let $\ensuremath{\mathcal{A}}$ be an $\LIN{\QCCl \cdot \QCCam}{\QCCak}{\QCCad}{q}$ $\QCCl$-quasi-cyclic code with generator matrix $\genmat[A]$ in RGB/POT form. Let $\alpha$ be an element of order $\QCCam$ in $\F{q^{\QCCas}}$, $\ensuremath{\mathcal{B}}$ an $\LIN{\QCCbn = \QCCbm}{\QCCbk}{\QCCbd}{q}$ cyclic code, and $\beta$ an element of order $\QCCbm$ in $\F{q^{\QCCbs}}$. Define $\QCCs \overset{\defi}{=} \lcm(\QCCas, \QCCbs)$. Let $\gamma \overset{\defi}{=} \alpha \beta$ be in $\F{q^{\QCCs}}$.
Let the set $A^{(\QCCl)} \subseteq \interval{\QCCam}$ contain the exponents of all eigenvalues $\eigenvalue{z}^A = \alpha^{z}, \forall z \in A^{(\QCCl)}$ of $\ensuremath{\mathcal{A}}$ of (algebraic and geometric) multiplicity $\QCCl$. Let $B \subseteq \interval{\QCCbm}$ be the defining set of $\ensuremath{\mathcal{B}}$, i.e., the set of exponents of all roots of the generator polynomial $\gen[B] = \prod_{i \in B} (X-\beta^i)$ of $\ensuremath{\mathcal{B}}$. Then, the set:
\begin{equation*}
C^{(\QCCl)} = A^{(\QCCl)} \cup \shiftset{A^{(\QCCl)}}{\QCCam} \cup \shiftset{A^{(\QCCl)}}{2\QCCam} \cup \cdots \cup
\shiftset{A^{(\QCCl)}}{(\QCCbm-1)\QCCam} \cup
B \cup \shiftset{B}{\QCCbm} \cup \shiftset{B}{2\QCCbm} \cup \cdots \cup \shiftset{B}{(\QCCam-1)\QCCbm}
\end{equation*}
is the set of all the exponents of the eigenvalues $\eigenvalue{z} = \gamma^{z}$ for all $z \in C^{(\QCCl)}$ of the $\QCCl$-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ of maximal multiplicity $\QCCl$.
Furthermore, we have $|C^{(\QCCl)}| = |A^{(\QCCl)}| \QCCbm+ (\QCCbm - \QCCbk)\QCCam - |A^{(\QCCl)}| (\QCCbm - \QCCbk) = (\QCCbm - \QCCbk)\QCCam + |A^{(\QCCl)}| \QCCbk$.
\end{lemma}
\begin{proof}
For an eigenvalue $\eigenvalue{z}^A = \alpha^{z}, \forall z \in A^{(\QCCl)}$ of the $\QCCl$-quasi-cyclic code $\ensuremath{\mathcal{A}}$ of multiplicity $\QCCl$, all $\ell$ diagonal entries $\gen[A][h][h]$ of $\genmat[A]$ are divisible by $(X-\alpha^{z})$.
From Conjecture~\ref{conj_ProductCodeQCCQCC}, we can conclude that if $\alpha^{z}$ is a root of $\gen[A][h][h]$, then
\begin{equation} \label{eq_RootsMultiplication}
\gamma^{z}, \gamma^{z+ \QCCam}, \gamma^{z + 2\QCCam}, \dots, \gamma^{z + (\QCCbm-1) \QCCam}
\end{equation}
are $\QCCbm$ roots of $\genarg{A}[h][h]{X^{\ensuremath{b} \QCCbn}}$ and therefore of $\gen[][h][h]$ as in~\eqref{eq_QCTimeCyclicDiag}, because:
\begin{equation} \label{eq_MappingFromComponentToProductPre}
(\gamma^{z + i \QCCam})^{\ensuremath{b} \QCCbn} = \gamma^{z \ensuremath{b} \QCCbn} = \alpha^{z \ensuremath{b} \QCCbn} \beta^{z \ensuremath{b} \QCCbn} = \alpha^{z \ensuremath{b} \QCCbn},
\end{equation}
where in the first step we used the fact that the order of $\gamma$ is $\QCCam \QCCbn$.
The order of $\alpha$ is $\QCCam$ and with~\eqref{eq_BEzoutRel}, we obtain from~\eqref{eq_MappingFromComponentToProductPre}:
\begin{equation*}
\alpha^{z \ensuremath{b} \QCCbn} = \alpha^{z \ensuremath{b} \QCCbn} \alpha^{z \ensuremath{a} \QCCan} = \alpha^z.
\end{equation*}
The zeros of the generator polynomial $\gen[B]$ of $\ensuremath{\mathcal{B}}$ appear in the spectral analysis of the product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ similar to the eigenvalues of $\ensuremath{\mathcal{A}}$ with multiplicity $\QCCl$. A nonzero{} polynomial $\gen[][h][h], \forall h \in \interval{\QCCl}$ as given in~\eqref{eq_QCTimeCyclicDiag} has a zero at
\begin{equation*}
\gamma^{z}, \gamma^{z+\QCCbm}, \gamma^{z+2\QCCbm}, \dots, \gamma^{z+(\QCCam-1)\QCCbm},
\end{equation*}
if $\beta^{z}$ is a zero of $\gen[B]$. From~\cite[Thm. 3]{lin_further_1970}, we know that the polynomial $\gen[A][h][h]$ as in~\eqref{eq_QCTimeCyclicDiag} has a zero if and only if either the polynomial $\genarg{A}[h][h]{X^{\ensuremath{b} \QCCbn}}$ has a zero or the polynomial $\genarg{B}{X^{\ensuremath{a} \QCCan}}$ has a zero or both. Therefore, the polynomial $\prod_{h=0}^{\QCCl-1} \gen[][h][h]$ has a zero of multiplicity $\QCCl$ if and only if the polynomial $\prod_{h=0}^{\QCCl-1} \genarg{A}[h][h]{X^{\ensuremath{b} \QCCbn}}$ has a zero of multiplicity $\QCCl$ or the polynomial $\genarg{B}{X^{\ensuremath{a} \QCCan}}$ has a zero or both. The cardinality $|C^{(\QCCl)}|$ follows.
\end{proof}
The following lemma considers eigenvalues of the $\QCCl$-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ of multiplicity smaller than $\QCCl$ and their corresponding eigenvectors. Lemma~\ref{lem_EigenvaluesSmallerThanMax} applies also to eigenvalues of $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ of multiplicity $r=0$, which are non-eigenvalues.
\begin{lemma}[Eigenvalues Of Smaller Multiplicity and Their Eigenvectors] \label{lem_EigenvaluesSmallerThanMax}
Let the two codes $\ensuremath{\mathcal{A}}$ and $\ensuremath{\mathcal{B}}$ with parameters be given as in Lemma~\ref{lem_EigenvaluesMaxMulti}.
Let the set $A^{(r)} \subseteq \interval{\QCCam}$ contain the exponents of all eigenvalues $\eigenvalue{z}^{A} = \alpha^{z}, \forall z \in A^{(r)}$ of $\ensuremath{\mathcal{A}}$ of (algebraic and geometric) multiplicity $r \in \interval{\QCCl}$. Let $\eigenvector^{A}_{z, 0}, \eigenvector^{A}_{z, 1}, \dots, \eigenvector^{A}_{z, r-1} \in \F{q^{\QCCas}}^{\QCCl}$ be the corresponding $r$ eigenvectors of $\eigenvalue{z}^{A}$ as defined in~\eqref{eq_eigenvectors}, i.e., a basis of the right kernel of $\genmat[A][\eigenvalue{z}^{A}]$.
Let $B \subseteq \interval{\QCCbm}$ be the defining set of $\ensuremath{\mathcal{B}}$, i.e., the set of exponents of all roots of the generator polynomial $\gen[B] = \prod_{i \in B} (X-\beta^i)$ of $\ensuremath{\mathcal{B}}$.
Let $\gamma \overset{\defi}{=} \alpha \beta$ be in $\F{q^{\QCCs}}$. Then, the set:
\begin{equation*}
C^{(r)} = \left( A^{(r)} \cup \shiftset{A^{(r)}}{\QCCam} \cup \shiftset{A^{(r)}}{2\QCCam} \cup \cdots \cup \shiftset{A^{(r)}}{(\QCCbm-1)\QCCam} \right) \setminus \left( B \cup \shiftset{B}{\QCCbm} \cup \shiftset{B}{2\QCCbm} \cup \cdots \cup \shiftset{B}{(\QCCam-1)\QCCbm} \right)
\end{equation*}
is the set of all exponents of the eigenvalues $\lambda_{z} = \gamma^{z}$ for all $z \in C^{(r)}$ of the $\QCCl$-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ of multiplicity $r$.
The number of eigenvalues of $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ of multiplicity $r$ is $|C^{(r)}| = |A^{(r)}| \QCCbk$.
Furthermore, the corresponding eigenvectors $\eigenvector_{z, 0}, \eigenvector_{z, 1}, \dots, \eigenvector_{z, r-1}$ are:
\begin{equation*}
\eigenvector_{z, j} = \eigenvector^{A}_{z \bmod \QCCam , j}, \quad \forall z \in C^{(r)}, j \in \interval{r}.
\end{equation*}
\end{lemma}
\begin{proof}
The polynomial $\prod_{h=0}^{\QCCl-1} \gen[][h][h]$ has a zero $\gamma^z$ of multiplicity $r$ if and only if the polynomial $\prod_{h=0}^{\QCCl-1} \genarg{A}[h][h]{X^{\ensuremath{b} \QCCbn}}$ has a zero $\gamma^z$ of multiplicity $r$ (i.e., exactly $r$ polynomials $\genarg{A}[h][h]{X}$ have a zero at $\alpha^z$) and the polynomial $\genarg{B}{X^{\ensuremath{a} \QCCan}}$ is nonzero if evaluated at $\gamma^z$ (see~\cite[Thm. 3]{lin_further_1970}). The cardinality $|C^{(r)}|$ follows.
With $\gamma= \alpha \beta$ we obtain for~\eqref{eq_QCTimeCyclicDiag} and \eqref{eq_QCTimeCyclicNonDiag}, that
\begin{align*}
v_h(\gamma^z) \genarg{A}[h][h^{\prime}]{(\alpha \beta)^{z \ensuremath{b} \QCCbn}} \genarg{B}{(\alpha \beta)^{z \ensuremath{a} \QCCan}} & = v_h(\gamma^z) \genarg{A}[h][h^{\prime}]{\alpha^{z \ensuremath{b} \QCCbn}} \genarg{B}{\beta^{z \ensuremath{a} \QCCan}} \\
& = v_h(\gamma^z) \genarg{A}[h][h^{\prime}]{\alpha^{z}} \genarg{B}{\beta^{z}}, \qquad \qquad \forall h \in \interval{\QCCl}, h^{\prime} \in \interval{h,\QCCl}.
\end{align*}
This allows us to rewrite:
\begin{equation*}
\bar{\mathbf{G}}(\gamma^{z}) = \diag \left( v_0(\gamma^z), v_1(\gamma^z), \dots, v_{\QCCl-1}(\gamma^z) \right) \genmat[A][\alpha^{z}] \genarg{B}{\beta^{z}}.
\end{equation*}
The right kernel of $\genmat[A][\alpha^{z}]$ is therefore contained in the right kernel of $\bar{\mathbf{G}}(\gamma^{z})$. Since these two kernels have the same cardinalities, it follows that they must be equal.
\end{proof}
\begin{example}[Eigenvalues of a $2$-Quasi-Cyclic Product Code] \label{ex_BinaryQCCodeZeros}
Let the two codes $\ensuremath{\mathcal{A}}$ and $\ensuremath{\mathcal{B}}$ with generator matrix $\genmat[A] \in \Fx{2}^{2 \times 2}$ and generator polynomial $\gen[B] \in \Fx{2}$ be as in Example~\ref{ex_BinaryQCCode}.
Let $\xi$ denote a primitive element in $\F{2^{12}} \cong \Fx{2}/(X^{12} + X^7 + X^6 + X^5 + X^3 + X + 1)$, $\alpha=\xi^{195}$ be a $21^{\text{st}}$ root of unity, $\beta = \xi^{819}$ a \ith{5} root of unity and $\gamma = \alpha \beta = \xi^{1014}$ a \ith{105} root of unity in $\F{2^{12}}$.
Clearly, all eigenvalues $\eigenvalue{i}^A = \alpha^{i}$ for all $i \in A^{(2)} = \coset{1} \cup \coset{3} \cup \coset{7} = \{1,2,3,4,6,7,8,11,12,14,16\}$ are roots of $\gen[A][0][0]$ and $\gen[A][1][1]$, and have multiplicity two. The corresponding eigenvectors span the full space $\F{2^{12}}^2$. The defining set of $\ensuremath{\mathcal{B}}$ is $B=\{0 \}$.
According to Lemma~\ref{lem_EigenvaluesMaxMulti}, we have:
\begin{align*}
C^{(2)} & = A^{(2)} \cup \shiftset{A^{(2)}}{21} \cup \shiftset{A^{(2)}}{42} \cup \shiftset{A^{(2)}}{63} \cup \shiftset{A^{(2)}}{84} \cup B \cup \shiftset{B}{5} \cup \shiftset{B}{10} \cup \cdots \cup \shiftset{B}{100} \\
& = \{ 1,2,3,4,6,7,8,11,12,14,16\} \cup \{22,23,24,25,27,28,29,32,33,35,37 \} \cup \{43,\dots,58 \} \cup \{64,\dots, 79 \} \\
& \qquad \cup \{85,\dots,100 \} \cup \{ 0 \} \cup \{ 5 \} \cup \cdots \cup \{ 100 \} \\
& = \{0,1,2,3,4,5,6,7,8,10,11,12,13,15,16,\dots,102 \}
\end{align*}
as the set of exponents of all eigenvalues $\eigenvalue{i} = \gamma^i, \forall i \in C^{(2)}$ of (maximal) multiplicity two. We have
\begin{equation*}
|C^{(2)}| = 21 (5-4) + 11 \cdot 4 = 65.
\end{equation*}
The eigenvalues $\eigenvalue{i}^A = \alpha^{i}$ for all $i \in A^{(1)} = \coset{9} = \{9,15,18 \}$ have multiplicity one and the eigenvalues $\alpha^{i}$ for all $i \in A^{(0)} = \coset{0} \cup \coset{5} = \{0, 5, 10, 13, 17, 19, 20 \}$ have multiplicity zero. The two sets
\begin{align*}
C^{(1)} & = \big\{ 9, 18, 36, 39, 51, 57, 72, 78, 81, 93, 99, 102 \big\} \; \text{and}\\
C^{(0)} & = \big\{ 13, 17, 19, 21, 26, 31, 34, 38, 41, 42, 47, 52, 59, 61, 62, 63, 68, 73, 76, 82, 83, 84, 89, 94, 97, 101, 103, 104 \big\}
\end{align*}
contain the exponents of the eigenvalues of multiplicity one and zero respectively (according to Lemma~\ref{lem_EigenvaluesSmallerThanMax}).
We obtain:
\begin{align*}
|C^{(1)}| & = 3 \cdot 4 = 12 \quad \text{and} \\
|C^{(0)}| & = 7 \cdot 4 = 28.
\end{align*}
We explicitly calculate an eigenvector of multiplicity one. For $\eigenvalue{9}^A = \alpha^9$ we get:
\begin{equation*}
\genmat[A][\alpha^9] =
\begin{pmatrix}
\minpoly{\alpha^1}[\alpha^9] \minpoly{\alpha^3}[\alpha^9] \minpoly{\alpha^7}[\alpha^9] & \minpoly{\alpha^1}[\alpha^9] \minpoly{\alpha^3}[\alpha^9] \minpoly{\alpha^7}[\alpha^9] \cdot (1+\alpha^9+\alpha^{18}) \\
0 & 0
\end{pmatrix}
\end{equation*}
and a corresponding eigenvector is
\begin{equation} \label{ex_SpeficifEigenvector}
\eigenvector^{A}_{9,0} = \left( 1 \hspace{.4cm} \xi^{11} + \xi^{10} + \xi^8 + \xi^7 + \xi^6 + \xi^2 + \xi \right)^T,
\end{equation}
and according to Lemma~\ref{lem_EigenvaluesSmallerThanMax}, the $2$-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ has eigenvectors $\eigenvector_{9,0} = \eigenvector_{51,0} = \eigenvector_{72,0} = \eigenvector_{93,0} = \eigenvector^{A}_{9,0}$. The eigenvalue $\eigenvalue{30}$ is of multiplicity two, and the corresponding eigenvectors $\eigenvector_{30,0}$ and $\eigenvector_{30,1}$ span the space $\F{2^{12}}^2$.
\end{example}
\subsection{Bounding the Minimum Hamming Distance} \label{subsec_BoundingDistance}
In the following, we recall the BCH-like lower bound on the minimum Hamming distance of a quasi-cyclic code based on the spectral analysis of Semenov and Trifonov~\cite{semenov_spectral_2012}, because we use this fact subsequently.
\begin{theorem}[BCH-like Bound on the Minimum Hamming Distance of a Quasi-Cyclic Code~{\cite[Thm. 2]{semenov_spectral_2012}}] \label{theo_SemenovTrifonovBound}
Let $\ensuremath{\mathcal{C}}$ be an $\LIN{\QCCl \cdot \QCCm}{\QCCk}{\QCCd}{q}$ $\QCCl$-quasi-cyclic code, $\alpha$ an element of order $\QCCm$ in $\F{q^{\QCCs}}$, and let the set
\begin{equation*}
D \overset{\defi}{=} \big\{ \ensuremath{f}, \ensuremath{f} + \ensuremath{z}, \ensuremath{f} + 2\ensuremath{z}, \dots, \ensuremath{f} + (\ensuremath{\delta}-2)\ensuremath{z} \big\}\end{equation*}
for some integers $\ensuremath{f} \geq 0, \ensuremath{z} >0, \ensuremath{\delta} > 2 $ with $\gcd(\ensuremath{z}, \QCCm)=1$ be given. Let the eigenvalues $\lambda_i = \alpha^i, \forall i \in D$ and their corresponding eigenspaces $\eigenspace[i]$ for all $i \in D$ be given. Define the intersection of eigenspaces $\eigenspace \overset{\defi}{=} \cap_{i \in D} \eigenspace[i]$ and let $\eigencode{\eigenspace}$ be the corresponding eigencode as in Definition~\ref{def_eigencode} with distance $\ensuremath{d^{ec}}$. If
\begin{equation*}
\sum_{i=0}^{\infty} \mathbf{c}(\alpha^{\ensuremath{f} + i \ensuremath{z}}) \circ \eigenvector X^i \equiv 0 \mod X^{\ensuremath{\delta}-1}
\end{equation*}
holds for all $\mathbf{c}(X) = (c_0(X) \ c_1(X) \ \cdots \ c_{\QCCl-1}(X) ) \in \ensuremath{\mathcal{C}}$ and for all $\eigenvector = (\eigenvector[0] \ \eigenvector[1] \ \cdots \ \eigenvector[\QCCl-1]) \in \eigenspace$, then, $\QCCd \geq \min(\ensuremath{\delta}, \ensuremath{d^{ec}})$.
\end{theorem}
\begin{proof}
See proof of \cite[Thm. 2]{semenov_spectral_2012} or proof of~\cite[Thm. 1 for $\ensuremath{\nu} = 0$]{zeh_decoding_2014}.
\end{proof}
Similar to the embedding of a given cyclic code $\ensuremath{\mathcal{A}}$ into a cyclic product codes $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ as in~\cite[Thm. 4]{zeh_generalizing_2013}, we propose in the following theorem a new lower bound on the minimum Hamming distance of a given $\QCCl$-quasi-cyclic code $\ensuremath{\mathcal{A}}$ by embedding it into an $\QCCl$-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$.
\begin{theorem}[Generalized Semenov--Trifonov Bound] \label{theo_GeneralizedBCHBound}
Let $\ensuremath{\mathcal{A}}$ be an $\LIN{\QCCl \cdot \QCCam}{\QCCak}{\QCCad}{q}$ $\QCCl$-quasi-cyclic code, $\alpha$ an element of order $\QCCam$ in $\F{q^{\QCCas}}$, $\ensuremath{\mathcal{B}}$ an $\LIN{\QCCbn = \QCCbm}{\QCCbk}{\QCCbd}{q}$ cyclic code, and $\beta$ an element of order $\QCCbm$ in $\F{q^{\QCCbs}}$. Furthermore, let $\gcd(\QCCam, \QCCbm) = 1$.
Let the integers $\ensuremath{f_1} \geq 0, \ensuremath{f_2} \geq 0 , \ensuremath{z_1} > 0, \ensuremath{z_2} > 0, \ensuremath{\delta} >2$ with $\gcd(\ensuremath{z_1}, \QCCam)=1$, and $\gcd(\ensuremath{z_2}, \QCCbm)=1$ be given, such that:
\begin{equation} \label{eq_ZerosGeneralizedSTBound}
\sum_{i=0}^{\infty} \left( \mathbf{a}(\alpha^{\ensuremath{f_1} + i \ensuremath{z_1}}) \cdot b(\beta^{\ensuremath{f_2} + i \ensuremath{z_2}}) \right) \circ \eigenvector X^i \equiv 0 \mod X^{\ensuremath{\delta}-1}
\end{equation}
holds for all $\mathbf{a}(X) = (a_0(X) \ a_1(X) \ \cdots \ a_{\QCCl-1}(X) ) \in \ensuremath{\mathcal{A}}$, $b(X) \in \ensuremath{\mathcal{B}}$, and for all $\eigenvector = (\eigenvector[0] \ \eigenvector[1] \ \cdots \ \eigenvector[\QCCl-1]) \in \F{q^{\QCCas}}^{\QCCl} $ in the intersection of the eigenspaces
\begin{equation} \label{eq_EigenspaceGeneralizedBound}
\eigenspace \overset{\defi}{=} \cap_{j \in D} \eigenspace[j],
\end{equation}
where
\begin{equation} \label{eq_SetofEigenvaluesGeneralizedBound}
D = \Big\{ \ensuremath{f_1} + i \ensuremath{z_1} \, | \; b(\beta^{\ensuremath{f_2} + i \ensuremath{z_2}}) \neq 0, \quad \forall i \in \interval{\ensuremath{\delta}-1} \Big\}.
\end{equation}
Let the distance of the eigencode $\eigencode{\eigenspace}$ be $\ensuremath{d^{ec}}$.
Then:
\begin{equation} \label{eq_BoundOnTheDistance}
\QCCad \geq \ensuremath{d^{\ast}} \overset{\defi}{=} \left \lceil \frac{\min(\ensuremath{\delta}, \ensuremath{d^{ec}})}{\QCCbd} \right \rceil.
\end{equation}
\end{theorem}
\begin{proof}
Let $\gamma=\alpha \beta$. The sequence $\mathbf{a}(\alpha^{\ensuremath{f_1}}) b(\beta^{\ensuremath{f_2}})\circ \eigenvector, \mathbf{a}(\alpha^{\ensuremath{f_1} + \ensuremath{z_1}}) b(\beta^{\ensuremath{f_2} + \ensuremath{z_2}})\circ \eigenvector, \dots, \mathbf{a}(\alpha^{\ensuremath{f_1} + (\ensuremath{\delta}-2) \ensuremath{z_1}}) b(\beta^{\ensuremath{f_2} + (\ensuremath{\delta}-2) \ensuremath{z_2}})\circ \eigenvector$ of $\ensuremath{\delta}-1$ zeros corresponds to $\ensuremath{\delta}-1$ zeros $\mathbf{c}(\gamma^{\ensuremath{f} + i \ensuremath{z}}) \circ \eigenvector$ for all $i \in \interval{\ensuremath{\delta}-1}$, where $\mathbf{c}(X)$ is a codeword of the $\QCCl$-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ (see \cite[Prop. 1]{zeh_generalizing_2013} for the values of $\ensuremath{f}$ and $\ensuremath{z}$). Hence, the minimum Hamming distance $\QCCad \QCCbd$ of the product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ is at least $\min(\ensuremath{\delta}, \ensuremath{d^{ec}})$ due to the lower bound of Thm.~\ref{theo_SemenovTrifonovBound} on the minimum Hamming distance of $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$.
\end{proof}
Note that the zeros of the cyclic code $\ensuremath{\mathcal{B}}$ correspond to eigenvalues of multiplicity $\QCCl$ of the $\QCCl$-quasi-cyclic product code $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ and do not influence the intersection of the eigenspaces.
\begin{example}[Bound via Quasi-Cyclic Product Code] \label{ex_BinaryQCCodeBCHBound}
We consider the $\LIN{2 \cdot 21}{17}{8}{2}$ $2$-quasi-cyclic code $\ensuremath{\mathcal{A}}$ and the $\LIN{5}{4}{2}{2}$ cyclic single-parity check code $\ensuremath{\mathcal{B}}$ as in Example~\ref{ex_BinaryQCCodeZeros}.
For $\ensuremath{f_1} = 0, \ensuremath{z_1} = 1, \ensuremath{f_2} = 0, \ensuremath{z_2} = 1$, and the set
\begin{equation*}
D = \{1,2,3,4,6,7,8,9,11,12\},
\end{equation*}
Thm.~\ref{theo_GeneralizedBCHBound} holds for $\ensuremath{\delta}=14$ with $\ensuremath{d^{ec}} = \infty$ and therefore $\QCCad \geq \lceil 14/2 \rceil = 7$.
More explicitly, the sequence of length $\ensuremath{\delta}-1 = 13$ is:
\begin{align*}
\mathbf{a}(\alpha^{0}) b(\beta^{0}), \mathbf{a}(\alpha^{1}) b(\beta^{1}), \dots, \mathbf{a}(\alpha^{9}) b(\beta^{4}), \dots, \mathbf{a}(\alpha^{12}) b(\beta^{2}).
\end{align*}
The defining set $B = \{0\}$ of the associated cyclic code $\ensuremath{\mathcal{B}}$ of length $\QCCbn=5$ fill the ``gaps'' at position $0,5,10$. The eigenvalues of $\ensuremath{\mathcal{A}} \otimes \ensuremath{\mathcal{B}}$ that correspond to the product $\mathbf{a}(\alpha^{i}) b(\beta^{i}), \forall i \in \interval{13}$ have multiplicity two, except the one that relates to $\mathbf{a}(\alpha^{9}) b(\beta^{4})$.
The eigenspace $\eigenspace[9]$ of $\ensuremath{\mathcal{A}}$ has (geometric) multiplicity one and is generated by the eigenvector $\eigenvector_{9,0}^{A}$ as in~\eqref{ex_SpeficifEigenvector}. The two entries of $\eigenvector_{9,0}^{A}$ are linearly independent over $\F{2}$ and therefore $\ensuremath{d^{ec}} = \infty$.
The BCH-like bound as in Thm.~\ref{theo_SemenovTrifonovBound} for $\ensuremath{\mathcal{A}}$ states that the minimum Hamming distance of $\ensuremath{\mathcal{A}}$ is at least five. The Hartmann--Tzeng-like~\cite{hartmann_generalizations_1972} lower bound as shown in \cite{zeh_decoding_2014} gives six. Therefore Thm.~\ref{theo_GeneralizedBCHBound} gives an improvement over these two bounds in this case.
\end{example}
\section{Syndrome-Based Phased Burst Error Correction up to the New Bound} \label{sec_Decoding}
Let $\ensuremath{\mathcal{A}}$ be an $\LIN{\QCCl \cdot \QCCam}{\QCCak}{\QCCad}{q}$ $\QCCl$-quasi-cyclic code and let $\ensuremath{\mathcal{B}}$ be an $\LIN{\QCCbm}{\QCCbk}{\QCCbd}{q}$ cyclic code as in Thm.~\ref{theo_GeneralizedBCHBound}. Moreover, we assume throughout this section that there exists an eigenvector $(\eigenvector[0] \ \eigenvector[1] \ \cdots \ \eigenvector[\QCCl-1]) \in \F{q^{\QCCas}}^{\QCCl}$ in the intersection of the eigenspaces as in Thm.~\ref{theo_GeneralizedBCHBound} with entries $\eigenvector[0], \eigenvector[1],\dots,\eigenvector[\QCCl-1]$ that are linearly independent over $\F{q}$ and therefore $\QCCad \geq \ensuremath{d^{\ast}} = \left \lceil \ensuremath{\delta} / \QCCbd \right \rceil$.
Similar to our approach for cyclic codes~\cite{zeh_decoding_2012, zeh_new_2014}, we develop a syndrome-based decoding algorithm for a given $\QCCl$-quasi-cyclic code $\ensuremath{\mathcal{A}}$, which guarantees to correct up to $\lfloor (\ensuremath{d^{\ast}}-1)/2 \rfloor$ $\QCCl$-phased burst errors in $\F{q}$. We define syndromes, derive a key equation, and describe the algorithm with guaranteed burst error decoding radius.
After transmitting a codeword $(a_0(X) \ a_1(X) \ \cdots \ a_{\QCCl-1}(X)) \in \ensuremath{\mathcal{A}}$, let the received word be:
\begin{align*}
\mathbf{r}(X) & = \big( r_0(X) \ r_1(X) \ \cdots \ r_{\QCCl-1}(X) \big) = \big( a_0(X) + e_0(X) \ a_1(X) + e_1(X) \ \cdots \ a_{\QCCl-1}(X) + e_{\QCCl-1}(X) \big),
\end{align*}
where
\begin{equation*} \label{eq_errorword}
e_j(X) = \sum_{i \in \errorsup[j]} e_{j,i} X^i, \quad j \in \interval{\QCCl},
\end{equation*}
are $\QCCl$ error polynomials in $\Fx{q}$ of weight $\noerrors[j] \overset{\defi}{=} |\errorsup[j]|$ and degree less than $\QCCam$. An $\QCCl$-phased \textit{burst error} at position $i$ consists of at least one nonzero{} entry $e_{0,i}, e_{1,i}, \dots, e_{\QCCl-1,i} \in \F{q}$. The cardinality of the set:
\begin{equation*} \label{eq_ModError}
\errorsup \overset{\defi}{=} \bigcup_{j=0}^{\QCCl-1} \errorsup[j] \subseteq \interval{\QCCam}.
\end{equation*}
of $\QCCl$-phased burst errors is denoted by $\noerrors \overset{\defi}{=} |\errorsup|$.
\printalgo{\renewcommand{\algorithmcfname}{Algo}
\caption{\textsc{Decoding an $\LIN{\QCCl \cdot \QCCam}{\QCCak}{\QCCad \geq \ensuremath{d^{\ast}}}{q}$ $\QCCl$-Quasi-Cyclic Code up to $\lfloor (\ensuremath{d^{\ast}}-1)/2 \rfloor $ $\QCCl$-phased Burst Errors}}
\label{algo_DecodingAlgorithm}
\DontPrintSemicolon
\SetAlgoVlined
\LinesNumbered
\newcommand\mycommfont[1]{\footnotesize\ttfamily{#1}}
\SetCommentSty{mycommfont}
\SetKwInput{KwFake}{}
\SetKwInput{KwIn}{Input}
\SetKwInput{KwOut}{Output}
\SetKwInput{KwPre}{Preprocess}
\BlankLine
\KwIn{\textcolor{white}{\textbf{O}}Parameters $\QCCl,\QCCam,\QCCak,\QCCad, q$ of $\ensuremath{\mathcal{A}}$ and $\alpha \in \F{q^{\QCCas}}$\\
\textcolor{white}{\textbf{Output}: }Parameters $\CYCbn,\CYCbk,\CYCbd$ of $\ensuremath{\mathcal{B}}$, and a codeword $b(X) = \sum_{i \in \mathcal{W}} b_i X^i \in \ensuremath{\mathcal{B}} $ with $|\mathcal{W}| = \QCCbd$, and $\beta \in \F{q^{\QCCbs}}$\\
\textcolor{white}{\textbf{Output}: }Integers $\ensuremath{f_1} \geq 0, \ensuremath{f_2} \geq 0, \ensuremath{\delta} > 2$, and $ \ensuremath{z_1} > 0, \ensuremath{z_2} > 0$ with $\gcd(\ensuremath{z_1},\QCCam)=1$, and $\gcd(\ensuremath{z_2},\QCCbm)=1$ \\
\textcolor{white}{\textbf{Output}: }\hspace{0.2cm} as in Thm.~\ref{theo_GeneralizedBCHBound}, and an eigenvector $(\eigenvector[0] \ \eigenvector[1] \ \cdots \ \eigenvector[\QCCl-1]) \in \F{q^{\QCCas}}^{\QCCl}$ with $\F{q}$-linearly independent entries\\
\textcolor{white}{\textbf{Output}: }Received word $\mathbf{r}(X) = (r_0(X) \ r_1(X) \ \cdots \ r_{\QCCl-1}(X)) \in \Fx{q}^{\QCCl}$
}
\KwOut{Estimated codeword $ \mathbf{a}(X)=(a_0(X) \ a_1(X) \ \cdots \ a_{\QCCl-1}(X) ) \in \ensuremath{\mathcal{A}} $ or \textsc{Decoding Failure}}
\KwPre{\\
\hspace{1em}\textbf{for} all $i \in \interval{\QCCam}$: calculate $\gamma_i = \beta^{-j\ensuremath{z_2}} \alpha^{-i\ensuremath{z_1}} $, where $j \in \mathcal{W}$
}
\BlankLine
\BlankLine
Calculate syndrome polynomial $S(X)$ as in~\eqref{eq_DefSyndromes} \nllabel{algo_SyndCalc}
\BlankLine
Solving Key Equation $(\Lambda(X), \Omega(X))$ = \texttt{EEA$\big( S(X), X^{\ensuremath{\delta}-1} \big)$} \nllabel{algo_KeyEquation} \tcc*[r]{Extended Euclidean Algorithm}
\BlankLine
Find all $i \in \interval{\QCCam}$, where $\Lambda(\gamma_i)=0$, $ \rightarrow {\mathcal E}=\lbrace i_0,i_1,\dots,i_{\noerrors-1}\rbrace$ \nllabel{algo_RootFinding} \tcc*[r]{Chien-like Root-Finding}
\BlankLine
\If{$ \noerrors \CYCbd < \deg \Lambda(X)$}
{Declare \textsc{Decoding Failure}}
\Else{
Determine $e_{0,i_j}, e_{1, i_j}, \dots, e_{\QCCl-1, i_j} \in \F{q}, \quad \forall i_j \in \mathcal E$ \nllabel{algo_SmallErrorValues} \tcc*[r]{Error-Evaluation as in~\cite[Prop. 4]{zeh_new_2014}}
\BlankLine
$e_j(X) \leftarrow \sum_{i \in \mathcal{E}_j} e_{j,i} X^{i}, \quad \forall j \in \interval{\QCCl}$ \;
\BlankLine
$a_j(X) \leftarrow r_j(X) - e_j(X), \quad \forall j \in \interval{\QCCl}$\;}
}
Algorithm~\ref{algo_DecodingAlgorithm} is the decoding procedure for a given $\QCCl$-quasi-cyclic code $\ensuremath{\mathcal{A}}$ that is guaranteed to decode up to
\begin{equation*}
\tau \leq \left \lfloor \frac{\ensuremath{d^{\ast}}-1}{2} \right \rfloor.
\end{equation*}
$\QCCl$-phased burst errors. Let
\begin{equation*}
b(X) = \sum_{j \in \mathcal{W}} b_j X^j
\end{equation*}
be a codeword of weight $|\mathcal{W}| = \QCCbd$ of the associated $\LIN{\QCCbn}{\QCCbk}{\QCCbd}{q}$ cyclic code $\ensuremath{\mathcal{B}}$ with zeros in $\F{q^{\QCCbs}}$. Let $\ensuremath{f_1}, \ensuremath{f_2}, \ensuremath{z_1}, \ensuremath{z_2}, \ensuremath{\delta}$, and an eigenvector $\eigenvector = (\eigenvector[0] \ \eigenvector[1] \ \cdots \ \eigenvector[\QCCl-1]) \in \eigenspace \subseteq \F{q^{\QCCas}}^{\QCCl}$ be given as in Thm.~\ref{theo_GeneralizedBCHBound}, where the entries $\eigenvector[0], \eigenvector[1], \dots,\eigenvector[\QCCl-1]$ are linearly independent over $\F{q}$. Let $\QCCs = \lcm(\QCCas, \QCCbs)$. Define the following syndrome polynomial in $\Fx{q^{\QCCs}}$:
\begin{align}
S(X) & \overset{\defi}{\equiv} \sum_{i=0}^{\infty} \left( \sum_{j=0}^{\QCCl-1} r_j(\alpha^{\ensuremath{f_1} +i \ensuremath{z_1}}) b(\beta^{ \ensuremath{f_2} + i \ensuremath{z_2}}) \eigenvector[j] \right) X^i \mod X^{\ensuremath{\delta}-1} \nonumber \\
& \overset{\hphantom{\defi}}{=} \sum_{i=0}^{\ensuremath{\delta}-2} \left( \sum_{j=0}^{\QCCl-1} r_j(\alpha^{\ensuremath{f_1} +i \ensuremath{z_1}}) b(\beta^{ \ensuremath{f_2} + i \ensuremath{z_2}}) \eigenvector[j] \right) X^i. \label{eq_DefSyndromes}
\end{align}
From Thm.~\ref{theo_GeneralizedBCHBound} it follows that the syndrome polynomial $S(X)$ as defined in~\eqref{eq_DefSyndromes} is independent of a codeword in $\ensuremath{\mathcal{A}}$ and therefore the expression of~\eqref{eq_DefSyndromes} for the syndrome polynomial can be rewritten as:
\begin{equation} \label{eq_SyndError}
S(X) = \sum_{i=0}^{\ensuremath{\delta}-2} \left( \sum_{j=0}^{\QCCl-1} e_j(\alpha^{\ensuremath{f_1} +i \ensuremath{z_1}}) b(\beta^{ \ensuremath{f_2} + i \ensuremath{z_2}}) \eigenvector[j] \right) X^i.
\end{equation}
Define an error-locator polynomial in $\Fx{q^{\QCCs}}$:
\begin{equation} \label{eq_ELP}
\Lambda(X) \overset{\defi}{=} \sum_{i=0}^{\QCCbd \noerrors} \Lambda_i X^i \overset{\defi}{=} \prod_{i \in \errorsup} \prod_{j \in \mathcal{W}} \left(1-X\alpha^{\ensuremath{z_1} i}\beta^{\ensuremath{z_2} j} \right),
\end{equation}
which depends on the position of the burst error and on the nonzero lowest-weight codeword of the associated cyclic code $\ensuremath{\mathcal{B}}$.
For some $j \in \mathcal{W}$, define $\QCCam$ elements in $\F{q^\QCCs}$ as:
\begin{equation} \label{eq_RootOfELP}
\gamma_i \overset{\defi}{=} \beta^{-j \ensuremath{z_2}} \alpha^{-i \ensuremath{z_1}}, \quad \forall i \in \interval{\QCCam}.
\end{equation}
We pre-calculate the $\QCCam$ values as in~\eqref{eq_RootOfELP} to identify the roots of a given error-locator polynomial $\Lambda(X)$ as in~\eqref{eq_ELP} (see Line~\ref{algo_RootFinding} of Algorithm~\ref{algo_DecodingAlgorithm}).
Combining the syndrome definition as in~\eqref{eq_SyndError} and definition of the error-locator polynomial as in~\eqref{eq_ELP} gives, like in the classical case of cyclic codes, a \textit{Key Equation} of the following form:
\begin{equation} \label{eq_KeyEquation}
\Lambda(X) \cdot S(X) \equiv \Omega(X) \mod X^{\ensuremath{\delta}-1},
\end{equation}
where the degree of the so-called \textit{error-evaluator} polynomial $\Omega(X)$ is smaller than $\QCCbd \noerrors$.
Solving the Key Equation~\eqref{eq_KeyEquation} can be realized by shift-register synthesis or the Extended Euclidean Algorithm (EEA). We use the EEA in Line~\ref{algo_KeyEquation} of Algorithm~\ref{algo_DecodingAlgorithm} that returns the error-locator polynomial $\Lambda(X)$ and the error-evaluator polynomial $\Omega(X)$ given the syndrome polynomial $S(X)$ and the monomial $X^{\ensuremath{\delta}-1}$. Determining the error-values (Line~\ref{algo_SmallErrorValues} in Algorithm~\ref{algo_DecodingAlgorithm}) is straightforward (see, e.g.,~\cite[Prop. 4]{zeh_new_2014}).
Our syndrome-based decoding approach can be easily extended to the case of a $\kappa$-interleaved code, i.e., a code that consists of $\kappa$ vertically arranged $\QCCl$-quasi-cyclic codes. If errors occur, in addition to the $\QCCl$-phased arrangement within each vector in $\F{q}^{\QCCl \QCCam}$, as $\kappa$-phased burst errors in the interleaved code, we obtain overall $\kappa \QCCl$-phased burst errors in $\F{q}$. Then, the $\kappa$ Key Equations as in~\eqref{eq_KeyEquation} have a common error-locator polynomial, which allows collaborative decoding up to
\begin{equation*}
\left \lfloor \frac{\kappa}{\kappa+1} (\ensuremath{d^{\ast}}-1) \right \rfloor
\end{equation*}
$\kappa \QCCl$-phased burst errors with high probability (analyzed, e.g., in~\cite{krachkovsky_decoding_1997, krachkovsky_decoding_1998, schmidt_collaborative_2009}). In the case of $\kappa =2$, this gives for the binary 2-quasi-cyclic code of Example~\ref{ex_BinaryQCCodeBCHBound} a collaborative decoding radius of 4.
\section{Conclusion and Outlook} \label{sec_conclusion}
We have derived an unreduced basis of an $\ensuremath{\ell_{A}} \ensuremath{\ell_{B}}$-quasi-cyclic product code in terms of the given generator matrices in RGB/POT form of the $\ensuremath{\ell_{A}}$-quasi-cyclic row-code and the $\ensuremath{\ell_{B}}$-quasi-cyclic column-code. For two special cases, the generator matrix in Pre-RGB/POT form of the $\ensuremath{\ell_{A}} \ensuremath{\ell_{B}}$-quasi-cyclic product code was derived. The general expression for the reduced basis was conjectured.
Based on spectral analysis, a technique for bounding the minimum Hamming distance of a given $\QCCl$-quasi-cyclic code via embedding it into an $\QCCl$-quasi-cyclic product code was outlined, which outperforms existing known bounds in many cases. We have proposed an algebraic decoding algorithm with guaranteed $\QCCl$-phased burst error correction radius.
Beside the proof of Conjecture~\ref{conj_ProductCodeQCCQCC}, the investigation of concatenated quasi-cyclic codes (see~\cite{blokh_coding_1974} and~\cite{jensen_cyclic_1992}) is open future work.
Furthermore, an extension of the embedding technique to an interpolation-based list decoding algorithm (see \cite{zeh_improved_2015}) seems possible.
\printbibliography
\end{document}
| {'timestamp': '2015-12-22T02:24:08', 'yymm': '1512', 'arxiv_id': '1512.06690', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06690'} | arxiv |
\section{Introduction}
Consumer reviews are invaluable as a source of data to help people form opinions on a wide range of products. Beyond telling us whether a product is `good' or `bad', reviews tell us about a wide range of \emph{personal experiences}; these include objective descriptions of the products' properties, subjective qualitative assessments, as well as unique use- (or failure-) cases.
The value and diversity of these opinions raises two questions of interest to us: (1) How can we help users navigate massive volumes of consumer opinions in order to find those that are \emph{relevant} to their decision? And (2) how can we address specific \emph{queries} that a user wishes to answer in order to evaluate a product?
To help users answer specific queries, review websites like \emph{Amazon} offer community-Q/A systems that allow users to pose product-specific questions to other consumers.\footnote{E.g.~\texttt{amazon.com/ask/questions/asin/B00B71FJU2}} Our goal here is to respond to such queries automatically and on-demand. To achieve this we make the basic insight that our two goals above naturally complement each other: given a large volume of community-Q/A data (i.e., questions and answers), and a large volume of reviews, we can automatically \emph{learn} what makes a review relevant to a query.
We see several reasons why reviews might be a useful source of information to address product-related queries, especially compared to existing work that aims to solve Q/A-like tasks by building knowledge bases of facts about the entities in question:
\begin{itemize}
\item General question-answering is a challenging open problem. It is certainly hard to imagine that a query such as ``Will this baby seat fit in the overhead compartment of a 747?'' could be answered by building a knowledge-base using current techniques. However it is more plausible that some review of that product will contain information that is relevant to this query. By casting the problem as one of surfacing relevant opinions (rather than necessarily generating a conclusive answer), we can circumvent this difficulty, allowing us to handle complex and arbitrary queries.
\item Fundamentally, many of the questions users ask on review websites will be those that \emph{can't} be answered using knowledge bases derived from product specifications, but rather their questions will be concerned with subjective personal experiences. Reviews are a natural and rich source of data to address such queries.
\item Finally, the massive volume and range of opinions makes review systems difficult to navigate, especially if a user is interested in some niche aspect of a product. Thus a system that identifies opinions relevant to a specific query is of fundamental value in helping users to navigate such large corpora of reviews.
\end{itemize}
To make our objectives more concrete, we aim to formalize the problem in terms of the following goal:
\begin{quote}
\emph{Goal:} Given a query about a particular product, we want to determine how relevant each review of that product is to the query, where `relevance' is measured in terms of how helpful the review will be in terms of identifying the correct response.
\end{quote}
The type of system we produce to address this goal is demonstrated in Figure \ref{fig:examp}. Here we surface opinions that are identified as being `relevant' to the query, which can collectively vote (along with all other opinions, in proportion to their relevance) to determine the response to the query.
\begin{figure}[t]
\begin{framed}
\begin{center}
\textbf{Product:}~BRAVEN BRV-1 Wireless Bluetooth Speaker
\adjustbox{trim={.0\width} {.15\height} {0.\width} {.2\height},clip
{\includegraphics[width=0.5\linewidth]{FIG/speaker}}\\
\textbf{Query:}~``I want to use this with my iPad air while taking a jacuzzi bath. Will the volume be loud enough over the bath jets?''\\
\ \\
\begin{tabular}{m{0.78\linewidth}>{\centering\arraybackslash}m{0.07\linewidth}}
\parbox{\linewidth}{\centering customer opinions, ranked by relevance:} & vote:\\
\midrule
``The sound quality is great, especially for the size, and if you place the speaker on a hard surface it acts as a sound board, and the bass really kicks up.'' & yes\\
\\[-2mm]
``If you are looking for a water resistant blue tooth speaker you will be very pleased with this product.'' & yes\\
\\[-2mm]
``However if you are looking for something to throw a small party this just doesnt have the sound output.'' & no\\
\\[-2mm]
etc. & etc.\\
\end{tabular}
\ \\[3mm]
\textbf{Response:} Yes
\vspace{-3mm}
\end{center}
\end{framed}
\caption{An example of how our system, \modelname{}, is used. This is a real output produced by \modelname{}, given the customer query about the product above. We simultaneously learn which customer opinions are `relevant' to the query, as well as a prediction function that allows each opinion to `vote' on the response, in proportion to its relevance. These relevance and prediction functions are learned automatically from large corpora of training queries and reviews.\label{fig:examp}}
\end{figure}
This simple example demonstrates exactly the features that make our problem interesting and difficult: First, the query (`is this loud enough?') is inherently subjective, and depends on personal experience; it is hard to imagine that any fact-based knowledge repository could provide a satisfactory answer. Secondly, it is certainly a `long-tail' query---it would be hard to find relevant opinions among the (300+) reviews for this product, so a system to automatically retrieve them is valuable. Third, it is linguistically complex---few of the important words in the query appear among the most relevant reviews (e.g.~`jacuzzi bath'/`loud enough')---this means that existing solutions based on word-level similarity are unlikely to be effective. This reveals the need to learn a complex definition of `relevance' that is capable of accounting for subtle linguistic differences such as synonyms.
Finally, in the case of Figure \ref{fig:examp}, our model is able to respond to the query (in this instance correctly) with a binary answer. More importantly though, the opinions surfaced allow the user to determine the answer themselves---in this way we can extend our model to handle general open-ended queries, where the goal is not to answer the question \emph{per se}, but rather to surface relevant opinions that will help the questioner form their own conclusion.
It seems then that to address our goal we'll need a system with two components: (1) A \emph{relevance} function, to determine which reviews contain information relevant to a query, and (2) a prediction function, allowing relevant reviews to `vote' on the correct answer.
However as we stated, our main goal is \emph{not} to answer questions directly but rather to surface relevant opinions that will help the user answer the question themselves; thus it may seem as though this `voting' function is not required. Indeed, at \emph{test} time, only the relevance function is required---this is exactly the feature that shall allow our model to handle arbitrary, open-ended, and subjective queries. However the voting function is critical at \emph{training} time, so that with a large corpus of already-answered questions, we can simultaneously learn relevance and voting functions such that `relevant' reviews are those that vote for the correct answer.
The properties that we want above are captured by a classical machine learning framework known as \emph{mixtures of experts} \cite{moe}. Mixtures of experts are traditionally used when one wishes to combine a series of `weak learners'---there the goal is to simultaneously estimate (a) how `expert' each predictor is with respect to a particular input and (b) the parameters of the predictors themselves. This is an elegant framework as it allows learners to `focus' on inputs that they are good at classifying---it doesn't matter if they sometimes make incorrect predictions, so long as they correctly classify those instances where they are predicted to be experts.
In our setting, individual reviews or opinions are treated as experts that get to vote on the answer to each query; naturally some opinions will be unrelated to some queries, so we must also learn how relevant (i.e., expert) each opinion is with respect to each query. Our prediction (i.e., voting) function and relevance function are then learned simultaneously such that `relevant' opinions are precisely those that are likely to vote correctly. At test time, the relevance function can be used directly to surface relevant opinions.
We evaluate our model using a novel corpus of questions and answers from \emph{Amazon}. We consider both binary questions (such as the example in Figure \ref{fig:examp}), and open-ended questions, where reviews must vote amongst alternative answers. Quantitatively, we compare our technique to state-of-the-art methods for relevance ranking, and find that our learned definition of relevance is more capable of resolving queries compared to hand-crafted relevance measures.
Qualitatively, we evaluate our system by measuring whether human evaluators agree with the notion of `relevance' that we learn. This is especially important for open-ended queries, where it is infeasible to answer questions directly, but rather we want to surface opinions that are helpful to the user.
\subsection{Contributions}
We summarize our contributions as follows: First, we develop a new method, \modelname{}, that is able to uncover opinions that are relevant to product-related queries, and to learn this notion of relevance from training data of previously answered questions. Second, we collect a large corpus of 1.4 million answered questions and 13 million reviews on which to train the model. Ours is among the first works to combine community Q/A and review data in this way, and certainly the first to do it at the scale considered here. Third, we evaluate our system against state-of-the-art approaches for relevance ranking, where we demonstrate (a) the need to learn the notion of `relevance' from training data; (b) the need to handle heterogeneity between questions, reviews, and answers; and (c) the value of opinion data to answer product-related queries, as opposed to other data like product specifications.
Code and data is available on the first author's webpage.
\section{Related Work}
The most closely related branches of work to ours are (1) those that aim to mine and summarize opinions and facets from documents (especially from review corpora), and (2) those that study Q/A systems in general. To our knowledge our work is among the first at the interface between these two tasks, i.e., to use consumer reviews as a means of answering general queries about products, though we build upon ideas from several related areas.
\xhdr{Document summarization.} Perhaps most related to our goal of selecting relevant opinions among large corpora of reviews is the problem of \emph{multi-document summarization} \cite{mds,mds2}. Like ours, this task consists of finding relevant or `salient' parts of documents \cite{mds,chali} and intelligently combining them. Most related are approaches that apply document summarization techniques to `evaluative text' (i.e., reviews), in order to build an overview of opinions or product features \cite{mds_reviews,review_summ2,review_query3}. In contrast to our contribution, most of the above work is not `query-focused,' e.g.~the goal is to summarize product features or positive vs.~negative opinions, rather than to address specific queries, though we note a few exceptions below.
\xhdr{Relevance ranking.} A key component of the above line of work is to learn whether a document (or a phrase within a document) is relevant to a given query. `Relevance' can mean many things, from the `quality' of the text \cite{agichtein_quality}, to its lexical salience \cite{lexrank}, or its diversity compared to already-selected documents \cite{mds_reviews}. In query-focused settings, one needs a query-specific notion of relevance, i.e.,~to determine whether a document is relevant in the context of a given query. For this task, simple (yet effective) word-level similarity measures have been developed, such as Okapi BM25, a state-of-the-art TF-IDF-based relevance ranking measure \cite{bm25,bm25_plus}. A natural limitation one must overcome though is that queries and documents may be linguistically heterogeneous, so that word-level measures may fail \cite{chasm,qa_cikm14}. This can be addressed by making use of grammatical rules and phrase-level approaches (e.g.~ROUGE measures \cite{rouge}), or through probabilistic language models ranging from classical methods \cite{ponte} to recent approaches based on deep networks \cite{severyn,socher_qa}.
We discuss ranking measures more in Section \ref{sec:measures}.
\xhdr{Opinion mining.}
Studying consumer opinions, especially through rating and review datasets is a broad and varied topic. Review text has been used to augment `traditional' recommender systems by finding the aspects or facets that are relevant to people's opinions \cite{recsysJulian,wang2010,ganu} and, more related to our goal, to find `helpful' reviews \cite{bian2009learning,cdnm2} or experts on particular topics \cite{pal11}. There has also been work on generating summaries of product features \cite{huliu}, including work using multi-document summarization as mentioned above \cite{mds_reviews,review_summ2,review_query3}. This work is related in terms of the data used, and the need to learn some notion of `relevance,' though the goal is not typically to address general queries as we do here. We are aware of relatively little work that attempts to combine question-answering with opinion mining, though a few exceptions include \cite{nazi}, which answers certain types of queries on \emph{Amazon} data (e.g.~``find 100 books with over 200 5-star ratings''); or \citep{yuSubjective} which learns to distinguish `facts' from subjective opinions; or \cite{cheng_sigir15}, which tries to solve cold-start problems by finding opinion sentences of old products that will be relevant to new ones. Though in none of these cases is the goal to address general queries.
\xhdr{Q/A systems.} Many of the above ideas from multi-document summarization, relevance ranking, and topical expert-finding have been adapted to build state-of-the-art automated Q/A systems. First is `query-focused' summarization \cite{chali,query_focused}, which is similar to our task in that phrases must be selected among documents that match some query, though typically the relevance function is not learned from training data as it is here. Next (as mentioned above) is the notion that questions, answers, and documents are heterogeneous, meaning that simple bag-of-words type approaches may be insufficient to compare them \cite{chasm,qa_cikm14}, so that instead one must decompose questions \cite{random_walk} or model their syntax \cite{Moschitti07exploitingsyntactic}. Also relevant is the problem of identifying experts \cite{experts_qa,experts_qa2,jurczyk2007discovering,pal11b} or high-quality answers \cite{anderson}, or otherwise identifying instances where similar questions have already been answered elsewhere \cite{similarQ,murily}, though these differ from our paradigm in that the goal is to select among answers (or answerers), rather than to address the questions themselves.
Naturally also relevant is the large volume of Q/A work from the information retrieval community (e.g.~TREC Q/A\footnote{\url{http://trec.nist.gov/tracks.html}}); however note first that due to the data involved (in particular, subjective opinions) our approach is quite different from systems that build knowledge bases (e.g.~systems like Watson \cite{watson}), or generally systems whose task is to retrieve a list of objective facts that conclusively answer a query. Rather, our goal is to use Q/A data as a means of learning a `useful' relevance function, and as such our experiments mainly focus on state-of-the-art relevance ranking techniques.
\subsection{Key differences}
Though related to the above areas, our work is novel in a variety of ways. Our work is among the first at the interface of Q/A and opinion mining, and is novel in terms of the combination of data used, and in terms of scale. In contrast to the above work on summarization and relevance ranking, given a large volume of answered queries and a corpus of weakly relevant documents (i.e., reviews of the product being queried), our goal is to be as agnostic as possible to the definition of ``what makes an opinion relevant to a query?,'' and to learn this notion automatically from data. This also differentiates our work from traditional Q/A systems as our goal is not to answer queries directly (i.e., to output `facts' or factoids), but rather to learn a relevance function that will help users effectively navigate multiple subjective viewpoints and personal experiences. Critically, the availability of a large training corpus allows us to learn complex mappings between questions, reviews, and answers, while accounting for the heterogeneity between them.
\begin{table}[t]
\caption{Notation. \label{tab:notation}}
\begin{center}
\begin{tabular}{lp{0.67\linewidth}}
\toprule
Symbol & Description\\
\midrule
$q \in \mathcal Q$, $a \in \mathcal A$ & query and query set, answer and answer set\\
$y \in \mathcal Y$ & label set (for binary questions)\\
$r \in \mathcal R$ & review and review set\\
$s$ & relevance/scoring function\\
$v$ & prediction/voting function\\
$\delta$ & indicator function ($1$ iff the argument is true)\\
$\theta$, $\vartheta,A,B$ & terms in the bilinear relevance function\\
$\vartheta',X,Y$ & terms in the bilinear prediction function\\
$p(r|q)$ & relevance of a review $r$ to a query $q$\\
$p(y|r,q)$ & probability of selecting a positive answer to a query $q$ given a review $r$\\
$p(a > \bar{a} | r)$ & preference of answer $a$ over $\bar{a}$\\
\bottomrule
\end{tabular}
\end{center}
\end{table}
\section{Model preliminaries}
\label{sec:prelim}
Since our fundamental goal is to learn relevance functions so as to surface useful opinions in response to queries, we mainly build upon and compare to existing techniques for relevance ranking. We also briefly describe the mixture-of-experts framework (upon which we build our model) before we describe \modelname{} in Section \ref{sec:square}.
\subsection{Standard measures for relevance ranking}
\label{sec:measures}
We first describe a few standard measures for relevance ranking, given a query $q$ and a document $d$ (in our case, a question and a review), whose relevance to the query we want to determine.
\xhdr{Cosine similarity} is a simple similarity measure that operates on Bag-of-Words representations of a document and a query. Here the similarity is given by
\begin{equation}
\mathit{cos}(q,d) = \frac{q \cdot d}{\| q\| \| d \|},
\label{eq:cosine}
\end{equation}
i.e., the cosine of the angle between (the bag-of-words representations of) the query $q$ and a document $d$. This can be further refined by weighting the individual dimensions, i.e.,
\begin{equation}
\mathit{cos}_\vartheta(q,d) = \frac{(q \odot d) \cdot \theta}{\| q\| \| d \|},
\label{eq:cosineL}
\end{equation}
where $(q \odot d)$ is the Hadamard product.
\xhdr{Okapi BM25} is state-of-the-art among `TF-IDF-like' ranking functions and is regularly used for document retrieval tasks \citep{bm25,irbook}. TF-IDF-based ranking measures address a fundamental issue with measures like the cosine similarity (above) whereby common---but irrelevant---words can dominate the ranking function. This can be addressed by defining a ranking function that rewards words which appear many times in a selected document (high TF), but which are rare among other documents (high IDF). Okapi BM25 is a parameterized family of functions based on this idea:
\begin{equation}
\mathit{bm25}(q, d) = \sum_{i=1}^n \frac{\text{IDF}(q_i) \cdot f(q_i,d)\cdot(k_1 + 1)}{f(q_i,d) + k_1 \cdot (1 - b + b \cdot \frac{|d|}{\text{avgdl}})}.
\label{eq:bm25}
\end{equation}
Again $q$ and $d$ are the query and a document, and $f$ and $\text{IDF}$ are the term frequency (of a word $q_i$ in the query) and inverse document frequency as described above. `$\text{avgdl}$' is the average document length, and $b$ and $k_1$ are tunable parameters, which we set as described in \cite{irbook}. See \cite{bm25,irbook} for further detail.
Essentially, we treat BM25 as a state-of-the-art `off-the-shelf' document ranking measure that we can use for evaluation and benchmarking, and also as a feature for ranking in our own model.
\xhdr{Bilinear models.} While TF-IDF-like measures help to discover rare but important words, an issue that still remains is that of \emph{synonyms}, i.e., different words being used to refer to the same concept, and therefore being ignored by the similarity measure in question. This is especially an issue in our setting, where questions and reviews are only tangentially related and may draw from very different vocabularies \cite{chasm,qa_cikm14}---thus one needs to learn that a word used in (say) a question about whether a baby seat fits in overhead luggage is `related to' a review that describes its dimensions.
Bilinear models \cite{chuBilinear,bilinear0,bilinear} can help to address this issue by learning complex mappings between words in one corpus and words in another (or more generally between arbitrary feature spaces). Here compatibility between a query and a document is given by
\begin{equation}
qMd^T = \sum_{i,j} M_{ij} q_i d_j,
\end{equation}
where $M$ is a matrix whose entry $M_{ij}$ encodes the relationship between a term $q_i$ in the query and a term $d_j$ in the document (setting $M=I$ on normalized vectors recovers the cosine similarity). This is a highly flexible model, which even allows that the dimensions of the two feature spaces be different; in practice, since $M$ is very high-dimensional (in our application, the size of the vocabulary squared), we assume that it is low-rank, i.e., that it can be approximated by $M \sim AB^T$ where $A$ and $B$ are each rank $K$.\footnote{This is similar to the idea proposed by Factorization Machines \cite{rendle_fm}, allowing complex pairwise interactions to be handled by assuming that they have low-rank structure (i.e., they factorize).} Thus our similarity measure becomes
\begin{equation}
qAB^Td^T = (qA) \cdot (dB).
\end{equation}
This has an intuitive explanation, which is that $A$ and $B$ project terms from the query and the document into a low-dimensional space such that `similar' terms (such as synonyms) in the query and the document are projected nearby (and have a high inner product).
\subsection{Mixtures of Experts}
\label{sec:moe}
\emph{Mixtures of experts} (MoEs) are a classical way to combine the outputs of several classifiers (or `weak learners') by associating weighted confidence scores with each classifier \cite{moe}. In our setting `experts' shall be individual reviews, each of which lends support for or against a particular response to a query. The value of such a model is that relevance and classification parameters are learned \emph{simultaneously}, which allows individual learners to focus on classifying only those instances where they are considered `relevant,' without penalizing them for misclassification elsewhere. In the next section we show how this is useful in our setting, where only a tiny subset of reviews may be helpful in addressing a particular query.
Generally speaking, for a binary classification task, each expert outputs a probability associated with a positive label. The final classification output is then given by aggregating the predictions of the experts, in proportion to their confidence (or expertise). This can be expressed probabilistically as
\begin{equation}
p(y | X) = \sum_f \overbrace{p(f | X)}^{\mathclap{\text{confidence in $f$'s ability to classify $X$}}} \underbrace{p(y | f, X)}_{\mathclap{\text{$f$'s prediction}}}.
\label{eq:moe}
\end{equation}
Here our confidence in each expert, $p(f|X)$, is treated as a probability, which can be obtained from an arbitrary real-valued score $s(f,X)$ using a softmax function:
\begin{equation}
p(f | X) = \frac{\exp(s(f,X))}{\sum_{f'}\exp(s(f',X))}.
\end{equation}
Similarly for binary classification tasks the prediction of a particular expert can be obtained using a logistic function:
\begin{equation}
p(y | f, X) = \sigma(v(f,X)) = \frac{1}{1 + e^{-v(f,X)}}.
\label{eq:logistic}
\end{equation}
Here $s$ and $v$ are our `relevance' and `voting' functions respectively. To define an MoE model, we must now define (parameterized) functions $s(f,X)$ and $v(f,X)$, and tune their parameters to maximize the likelihood of the available training labels. We next describe how this formulation can be applied to queries and reviews, and describe our parameter learning strategy in Section \ref{sec:learning}.
\section{MOQA}
\label{sec:square}
We now present our model, \emph{\modelnamelong{}}, or \modelname{} for short. In the previous section we outlined the `Mixture of Experts' framework, which combines weak learners by aggregating their outputs with weighted confidence scores. Here, we show that such a model can be adapted to simultaneously identify relevant reviews, and combine them to answer complex queries, by treating reviews as experts that either support or oppose a particular response.
\subsection{Mixtures of Experts for review relevance ranking}
As described in Section \ref{sec:moe}, our MoE model is defined in terms of two parameterized functions: $s$, which determines whether a review (`expert') is relevant to the query, and $v$, which given the query \emph{and} a review makes a prediction (or vote). Our goal is that predictions are correct exactly for those reviews considered to be relevant. We first define our relevance function $s$ before defining our prediction functions for binary queries in Section \ref{sec:qbinary} and arbitrary queries in Section \ref{sec:qarbitrary}.
Our scoring function $s(r, q)$ defines the relevance of a review $r$ to a query $q$. In principle we could make use of any of the relevance measures from Section \ref{sec:measures} `as is,' but we want our scoring function to be \emph{parameterized} so that we can learn from training data what constitutes a `relevant' review. Thus we define a parameterized scoring function as follows:
\begin{equation}
s_{\Theta}(r,q) = \underbrace{\phi(r,q) \cdot \theta}_{{\text{pairwise similarity}\vphantom{ly}}} + \underbrace{\psi(q) M \psi(r)^T}_{\text{bilinear model}\vphantom{ly}}.
\label{eq:relevance}
\end{equation}
Here $\phi(r,q)$ is a feature vector that is made up of existing pairwise similarity measures. $\theta$ then weights these measures so as to determine how they should be combined in order to achieve the best ranking. Thus $\phi(r,q)$ allows us to straightforwardly make use of existing `off-the-shelf' similarity measures that are considered to be state-of-the-art. In our case we make use of BM25+ \cite{bm25_plus} and ROUGE-L \cite{rouge} (longest common subsequence) features, though we describe our experimental setup in more detail in Section \ref{sec:experiments}.
The second expression in \eq{eq:relevance} is a bilinear scoring function between features of the query ($\psi(q)$) and the review ($\psi(r)$). As features we us a simple bag-of-words representation of the two expressions with an $F = 5000$ word vocabulary. As we suggested previously, learning an $F \times F$ dimensional parameter $M$ is not tractable, so we approximate it by
\begin{equation}
M = \underbrace{(\psi(q) \odot \psi(r)) \cdot \vartheta}_{\text{diagonal term}} + \underbrace{\psi(q) AB^T \psi(r)^T}_{\text{low-rank term}}.
\label{eq:approxtransform}
\end{equation}
$\vartheta$ (the diagonal component of $M$) then accounts for simple term-to-term similarity, whereas $A$ and $B$ (the low-rank component of $M$) are projections that map $\psi(q)$ and $\psi(r)$ (respectively) into $K$-dimensional space ($K=5$ in our experiments) in order to account for linguistic differences (such as synonym use) between the two sources of text. Thus rather than fitting $F \times F$ parameters we need to fit only $(2K + 1)\cdot F$ parameters in order to approximate $M$.
To obtain the final relevance function, we optimize all parameters $\Theta = \lbrace \theta,\vartheta,A,B \rbrace$ using supervised learning, as described in the following section.
\subsection{Binary (i.e., yes/no) questions}
\label{sec:qbinary}
\label{sec:learning}
Dealing with binary (yes/no) questions is a relatively straightforward application of an MoE-type model, where each of the `experts' (i.e., reviews) must make a binary prediction as to whether the query is supported by the content of the review. This we also achieve using a bilinear scoring function:
\begin{equation}
v_{\Theta'}(q,r) = (\psi(q) \odot \psi(r)) \cdot \vartheta' + \psi(q) XY^T \psi(r)^T.
\label{eq:prediction}
\end{equation}
Note that this is different from the relevance function $s$ in \eq{eq:relevance} (though it has a similar form). The role of \eq{eq:prediction} above is to vote on a binary outcome; how much weight/relevance is given to this vote is determined by \eq{eq:relevance}. Positive/negative $v(q,r)$ corresponds to a vote in favor of a positive or negative answer (respectively).
\xhdr{Learning.}
Given a training set of questions with labeled yes/no answers (to be described in Section \ref{sec:expbinary}), our goal is to optimize the relevance parameters $\Theta = \lbrace \theta,\vartheta,A,B \rbrace$ and the prediction parameters $\Theta' = \lbrace \vartheta', X, Y \rbrace$ simultaneously so as to maximize the likelihood that the training answers will be given the correct labels. In other words, we want to define these functions such that reviews given high relevance scores are precisely those that help to predict the correct answer. Using the expression in \eq{eq:moe}, the likelihood function is given by
\begin{equation}
L_{\Theta,\Theta'}(\mathcal Y|\mathcal Q, \mathcal R) = \!\!\prod_{q \in \mathcal Q^{(\text{train})}_{\text{yes}}}\!\! p_{\Theta,\Theta'}(y | q) \!\!\prod_{q \in \mathcal Q^{(\text{train})}_{\text{no}}}\!\! (1 - p_{\Theta,\Theta'}(y|q)),
\label{eq:likelihood}
\end{equation}
where $\mathcal Q^{(\text{train})}_{\text{yes}}$ and $\mathcal Q^{(\text{train})}_{\text{no}}$ are training sets of questions with positive and negative answers, and $\mathcal Y$ and $\mathcal R$ are the label set and reviews respectively. $p(y|q)$ (the probability of selecting the answer `yes' given the query $q$) is given by
\begin{equation}
p_{\Theta,\Theta'}(y|q) = \sum_{r \in \mathcal R_{i(q)}} \biggl\lbrace \underbrace{\frac{e^{s_\Theta(q,r)}}{\sum_{r' \in \mathcal R_{i(q)}} e^{s_\Theta(q,r')}}}_{\text{relevance}} \underbrace{\frac{1}{1 + e^{-v_{\Theta'}(q,r)}}}_{\text{prediction}} \biggr\rbrace,
\label{eq:binarymodel}
\end{equation}
where $\mathcal R_{i(q)}$ is the set of reviews associated with the item referred to in the query $q$. We optimize the (log) likelihood of the parameters in \eq{eq:likelihood} using L-BFGS, a quasi-Newton method for non-linear optimization of problems with many variables. We added a simple $\ell_2$ regularizer to the model parameters, though did not run into issues of overfitting, as the number of parameters is far smaller than the number of samples available for training.
\subsection{Open-ended questions}
\label{sec:qarbitrary}
While binary queries already account for a substantial fraction of our dataset, and are a valuable testbed for quantitatively evaluating our method, we wish to extend our method to arbitrary open-ended questions, both to increase its coverage, and to do away with the need for labeled yes/no answers at training time.
Here our goal is to train a method that given a corpus of candidate answers (one of which is the `true' answer that a responder provided) will assign a higher score to the true answer than to all non-answers. Naturally in a live system one does not have access to such a corpus containing the correct answer, but recall that this is not required: rather, we use answers only at \emph{training} time to learn our relevance function, so that at test time we can surface relevant reviews \emph{without} needing candidate answers to be available.
Specifically, we want to train the model such that the true answer is given a higher rank than all non-answers, i.e., to train a ranking function to maximize the average Area Under the Curve (AUC):
\begin{equation}
\mathit{AUC}^{(\text{train})} = \frac{1}{|\mathcal Q^{(\text{train})}|}\sum_{q\in \mathcal Q^{(\text{train})}} \frac{1}{|\mathcal A|} \sum_{\bar{a} \in \mathcal A} \delta(a(q) > \bar{a}),
\end{equation}
where $a(q)$ is the `true' answer for the query $q$ ($\mathcal A$ is the answer set) and $\delta(a(q) > \bar{a})$ is an indicator counting whether this answer was preferred over a non-answer $\bar{a}$. In other words, the above simply counts the fraction of cases where the true answer was considered better than non-answers.
In practice, the AUC is (approximately) maximized by optimizing a pairwise ranking measure, where the true answer should be given a higher score than a (randomly chosen) non-answer, i.e., instead of optimizing $p_{\Theta,\Theta'}(y|q)$ from \eq{eq:binarymodel} we optimize
$$
p(a > \bar{a}|q) \sum_r \overbrace{p(r | q)}^{\mathclap{\text{relevance}}} \underbrace{p(a > \bar{a}|r)}_{\mathclap{\text{$a$ is a better answer than $\bar{a}$}}}.
$$
To do so we make use of the same relevance function $s$ and the same scoring function $v$ used in \eq{eq:prediction}, with two important differences: First, the scoring function takes a candidate answer (rather than the query) as a parameter (i.e., $v(a,r)$ rather than $v(q,r)$). This is because our goal is no longer to estimate a binary response to the query $q$, but rather to determine whether the answer $a$ is supported by the review $r$. Second, since we want to use this function to rank answers, we no longer care that $v(a,r)$ is maximized, but rather that $v(a,r)$ (for the \emph{true} answer) is higher than $v(\bar{a},r)$ for non-answers $\bar{a}$. This can be approximated by optimizing the logistic loss
\begin{equation}
p(a > \bar{a}|r) = \sigma(v(a,r) - v(\bar{a},r)) = \frac{1}{1 + e^{v(\bar{a},r) - v(a,r)}}.
\end{equation}
This will approximate the AUC if enough random non-answers are selected; optimizing pairwise ranking losses as a means of optimizing the AUC is standard practice in recommender systems that make use of implicit feedback \cite{bpr}.
Otherwise, training proceeds as before, with the two differences being that (1) $p(a > \bar{a}|r)$ replaces the prediction function in \eq{eq:binarymodel}, and (2) multiple non-answers must be sampled for training. In practice we use 10 epochs (i.e., we generate 10 random non-answers per query during each training iteration). On our largest dataset (\emph{electronics}), training requires around 4-6 hours on a standard desktop machine.
\section{Experiments}
\label{sec:experiments}
We evaluate \modelname{} in terms of three aspects: First for binary queries, we evaluate its ability to resolve them. Second, for open-ended queries, its ability to select the correct answer among alternatives. Finally we evaluate \modelname{} qualitatively, in terms of its ability to identify reviews that humans consider to be relevant to their query. We evaluate this on a large dataset of reviews and queries from \emph{Amazon}, as described below.
\subsection{Data}
We collected review and Q/A data from \emph{Amazon.com}. We started with a previous crawl from \cite{McAPanLes15}, which contains a snapshot of product reviews up to July 2014 (but which includes only review data). For each product in that dataset, we then collected all questions on its Q/A page, and the top-voted answer chosen by users. We also crawled descriptions of all products, in order to evaluate how description text compares to text from reviews. This results in a dataset of 1.4 million questions (and answers) on 191 thousand products, about which we have over 13 million customer reviews. We train separate models for each top-level category (electronics, automotive, etc.). Statistics for the 8 largest categories (on which we report results) are shown in Table \ref{tab:data}.
\begin{table}
\caption{Dataset Statistics.\label{tab:data}}
\renewcommand{\tabcolsep}{2pt}
\begin{center}
\begin{tabular}{lrrr}
\toprule
Dataset & \parbox{0.21\linewidth}{\centering questions\\ (w/ answers)}\hspace{-2.5mm} & \ \ \ \ products & reviews\\
\midrule
electronics & 314,263 & 39,371 & 4,314,858 \\
home and kitchen & 184,439 & 24,501 & 2,012,777 \\
sports and outdoors & 146,891 & 19,332 & 1,013,196 \\
tools and home impr. & 101,088 & 13,397 & 752,947 \\
automotive & 89,923 & 12,536 & 395,872 \\
cell phones & 85,865 & 10,407 & 1,534,094 \\
health and personal care & 80,496 & 10,860 & 1,162,587 \\
patio lawn and garden & 59,595 & 7,986 & 451,473 \\
\midrule
total & 1,447,173 & 191,185 & 13,498,681 \\
\bottomrule
\end{tabular}
\end{center}
\renewcommand{\tabcolsep}{6pt}
\end{table}
\subsection{Labeling yes/no answers}
\label{sec:expbinary}
Although the above data is already sufficient for addressing open-ended questions, for binary questions we must first obtain additional labels for training. Here we need to identify whether each question in our dataset is a yes/no question, and if so, whether it has a yes/no answer. In spite of this need for additional labels, addressing yes/no questions is valuable as it gives us a simple and objective way to evaluate our system.
We began by manually labeling one thousand questions to identify those which were binary, and those which had binary answers (note that these are not equivalent concepts, as some yes/no questions may be answered ambiguously). We found that 56.1\% of questions are binary, and that 76.5\% of these had conclusive binary answers. Of those questions with yes/no answers, slightly over half (62.4\%) had positive (i.e., `yes') answers.
Note that the purpose of this small, manually labeled sample is not to train \modelname{} but rather to evaluate simple techniques for automatically labeling yes/no questions and answers. This is much easier than our overall task, since we are \emph{given} the answer and simply want to determine whether it was positive or negative, for which simple NLP techniques suffice.
To identify whether a question is binary, a recent approach developed by \emph{Google} proved to be effective \cite{yesno}. This approach consists of a series of complex grammatical rules which are used to form regular expressions, which essentially identify occurrences of `be', modal, and auxiliary verbs. Among our labeled data these rules identified yes/no questions with 97\% precision at 82\% recall.
Note that in this setting we are perfectly happy to sacrifice some recall for the sake of precision---what we want is a sufficiently large sample of labeled yes/no questions to train \modelname{}, but we are willing to discard ambiguous cases in order to do so.
Next we want to label \emph{answers} as being yes/no. Ultimately we trained a simple bag-of-unigrams SVM, plus an additional feature based on the first word only (which is often simply `yes' or `no').
Again, since we are willing to sacrifice recall for precision, we discarded test instances that were close to the decision hyperplane. By keeping only the 50\% of instances about which the classifier was the most confident, we obtained 98\% classification accuracy on held-out data.
Finally we consider a question only if \emph{both} of the above tests pass, i.e., the question is identified as being binary \emph{and} the answer is classified as yes/no with high confidence. Ultimately through the above process we obtained 309,419 questions that we were able to label with high confidence, which can be used to train the binary version of \modelname{} in Section \ref{sec:expyesno}.
\subsection{Baselines}
\label{sec:baselines}
We compare \modelname{} against the following baselines:
\begin{description}
\item[rand] ranks and classifies all instances randomly. By definition this has 50\% accuracy (on average) for both of the tasks we consider. Recall also that for yes/no questions around 62\% are answered affirmatively, roughly reflecting the performance of `always yes' classification.
\item[Cosine similarity (c).] The relevance of a review to a query is determined by their cosine similarity, as in \eq{eq:cosine}.
\item[Okapi-BM25+ (o).] BM25 is a state-of-the-art TF-IDF-based relevance measure that is commonly used in retrieval applications \cite{bm25,irbook}. Here we use a recent extension of BM25 known as BM25+ \citep{bm25_plus}, which includes an additional term ($\delta \sum_{i=1}^n \text{IDF}(q_i)$) in the above expression in order to lower-bound the normalization by document length.
\item[ROUGE-L (r).] Review relevance is determined by ROUGE metrics, which are commonly used to measure similarity in document summarization tasks \cite{rouge}. Here we use ROUGE-L (longest common subsequence) scores.
\item[Learning vs.~non learning (-L).] The above measures (c), (o), and (r) can be applied `off the shelf,' i.e., without using a training set. We analyze the effect of applying maximum-likelihood training (as in eq.~\ref{eq:likelihood}) to tune their parameters (c-L, o-L, etc.).
\item[\emph{Mdqa}] is the same as \modelname{}, except that reviews are replaced by product descriptions.
\end{description}
The above baselines are designed to assess (1) the efficacy of existing state-of-the-art `off-the-shelf' relevance measures for the ranking tasks we consider (c, o, and r); (2) the benefit of using a training set to optimize the relevance and scoring functions (c-L, o-L, etc.); (3) the effectiveness of reviews as a source of data versus other potential knowledge bases (\emph{Mdqa}); and finally (4) the influence of the bilinear term and the performance of \modelname{} itself.
For the baselines above we use a linear scoring function in the predictor ($v_{\Theta'}(q,r) = (\psi(q) \odot \psi(r)) \cdot \vartheta'$), though for \emph{Mdqa} and \modelname{} we also include the bilinear term as in \eq{eq:prediction}. Recall that our model already includes the cosine similarity, ROUGE score, and BM25+ measures as features, so that comparison between the baseline `cro-L' (i.e., all of the above measures weighted by maximum likelihood) and \modelname{} essentially assesses the value of using bilinear models for relevance ranking.
For all methods, we split reviews at the level of \emph{sentences}, which we found to be more convenient when surfacing results via an interface, as we do in our qualitative evaluation. We found that this also led to slightly (but consistently) better performance than using complete reviews---while reviews contain more information, sentences are much better targeted to specific product details.
\subsection{Quantitative evaluation}
\subsubsection{Yes/no questions}
\label{sec:expyesno}
We first evaluate our method in terms of its ability to correctly classify held-out yes/no questions, using the binary groundtruth described above. Here we want to measure the classification accuracy (w.r.t.~a query set $\mathcal Q$):
\begin{multline*}
\text{accuracy}(\mathcal Q) =\\
\frac{1}{|\mathcal Q|} \sum_{q \in \mathcal Q} \underbrace{\delta(q \in \mathcal Q_{\text{yes}})\delta(p(y|q)\! >\! \frac{1}{2})}_{\text{true positives}} + \underbrace{\delta(q \in \mathcal Q_{\text{no}})\delta(p(y_q)\! <\! \frac{1}{2})}_{\text{true negatives}},
\end{multline*}
i.e., the fraction of queries that were given the correct binary label.
We found this to be an incredibly difficult measure to perform well on (for any method), largely due to the fact that some fraction of queries are simply not addressed among the reviews available. Fortunately, since we are training probabilistic classifiers, we can also associate a \emph{confidence} with each classification (i.e., its distance from the decision boundary, $|\frac{1}{2} - p(y|q)|$). Our hope is that a good model will assign high confidence scores to exactly those queries that can be (correctly) addressed. To evaluate algorithms as a function of confidence, we consider the accuracy@k:
\begin{equation}
\text{A@k} = \text{accuracy}\biggl(\underbrace{\argmax_{\mathcal Q' \in \mathcal{P}_k(\mathcal Q)}\sum_{q \in \mathcal Q'} |\frac{1}{2} - p(y|q)|}_{k \text{\ most confidence predictions}}\biggr),
\end{equation}
Where $\mathcal{P}_k(\mathcal Q)$ is the set of $k$-sized subsets of $\mathcal Q$.
Table \ref{tab:yn} shows the performance of \modelname{} and baselines, in terms of the accuracy@50\% (i.e., for the 50\% of predictions about which each algorithms is most confident). Note that only methods with learning (-L) are shown as non-learning approaches are not applicable here (since there is no good way to determine parameters for a binary decision function in eq.~\ref{eq:binarymodel} \emph{without} learning). Here \modelname{} is substantially more accurate than alternatives, especially on larger datasets (where more data is available to learn a meaningful bilinear map). Among the baselines {ro-L} (ROUGE+Okapi BM25+ with learned weights) was the second strongest, with additional similarity-based features (cro-L) helping only slightly.
\begin{table}
\caption{Performance of \modelname{} against baselines in terms of the accuracy@50\%; only learning (i.e., -L) baselines are shown as non-learning baselines are not applicable to this task. \label{tab:yn}}
\begin{center}
\renewcommand{\tabcolsep}{2.5pt}
\begin{tabular}{lcccc|c}
\toprule
& \parbox{0.035\textwidth}{\centering rand\vphantom{Lq}}
& \parbox{0.05\textwidth}{\centering {ro-L}\vphantom{Lq}}
& \parbox{0.05\textwidth}{\centering {cro-L}\vphantom{Lq}}
& \parbox{0.05\textwidth}{\centering \emph{Moqa}\vphantom{Lq}}
& \parbox{0.065\textwidth}{\centering \small red.~in error\\ vs.~cro\nobreakdash-L}\\
\midrule
electronics & 50\% & 78.9\% & 79.7\% & \textbf{82.6\%} & \hphantom{0}3.7\% \\
home and kitchen & 50\% & 70.3\% & 64.6\% & \textbf{73.6\%} & 13.9\% \\
sports and outdoors & 50\% & 71.9\% & 72.8\% & \textbf{74.1\%} & \hphantom{0}1.8\% \\
tools and home impr. & 50\% & 70.7\% & 69.0\% & \textbf{73.2\%} & \hphantom{0}6.1\% \\
automotive & 50\% & 74.8\% & 76.6\% & \textbf{78.4\%} & \hphantom{0}2.3\% \\
cell phones & 50\% & 74.6\% & 76.3\% & \textbf{79.4\%} & \hphantom{0}4.1\% \\
health and pers.~care & 50\% & 61.7\% & 75.5\% & \textbf{76.2\%} & \hphantom{0}0.9\% \\
patio lawn and garden & 50\% & 74.6\% & 75.4\% & \textbf{76.8\%} & \hphantom{0}1.8\% \\
\midrule
average & 50\% & 72.2\% & 73.7\% & \textbf{76.8\%} & \hphantom{0}4.3\% \\
\bottomrule
\end{tabular}
\end{center}
\renewcommand{\tabcolsep}{6pt}
\end{table}
Figure \ref{fig:prec} shows the full spectrum of accuracy as a function of confidence on `electronics' queries, i.e., it shows how performance degrades as confidence decreases (other categories yielded similar results). Indeed we find that for all methods performance degrades for low-confidence queries. Nevertheless \modelname{} remains more accurate than alternatives across the full confidence spectrum, and for queries about which it is most confident obtains an accuracy of around 90\%, far exceeding the performance of any baseline. Figure \ref{fig:prec} also shows the performance of \emph{Mdqa}, as we discuss below.
\begin{figure}[t]
\begin{center}
\hspace{-.275in}
\includegraphics{FIG/prec}
\end{center}
\caption{Accuracy as a function of confidence. \modelname{} correctly assigns high confidence to those queries it is able to accurately resolve.\label{fig:prec}}
\end{figure}
\subsubsection{Open-ended questions}
In Table \ref{tab:openended} we show the performance of \modelname{} against baselines for open-ended queries on our largest datasets. Cosine similarity (c) was the strongest non-learning baseline, slightly outperforming the ROUGE score (r) and BM25+ (o, not shown for brevity). Learning improved all baselines, with the strongest being ROUGE and BM25+ combined (ro-L), over which adding weighted cosine similarity did not further improve performance (cro-L), much as we found with binary queries above. \modelname{} was strictly dominant on all datasets, reducing the error over the strongest baseline by 50.6\% on average.
\begin{table*}
\caption{Performance of \modelname{} against baselines (a key is shown at right for baselines from Section \ref{sec:baselines}). Reported numbers are average AUC (i.e., the models' ability to assign the highest possible rank to the correct answer); higher is better.\label{tab:openended}}
\renewcommand{\tabcolsep}{3pt}
\begin{tabular}{lccccccc|cc}
\toprule
Dataset\vphantom{Lq}
& \parbox{0.03\textwidth}{\centering rand\vphantom{Lq}}
& \parbox{0.05\textwidth}{\centering c\vphantom{Lq}}
& \parbox{0.05\textwidth}{\centering r\vphantom{Lq}}
& \parbox{0.05\textwidth}{\centering {ro-L}\vphantom{Lq}}
& \parbox{0.05\textwidth}{\centering {cro-L}\vphantom{Lq}}
& \parbox{0.05\textwidth}{\centering \emph{Mdqa}\vphantom{Lq}}
& \parbox{0.05\textwidth}{\centering \emph{Moqa}\vphantom{Lq}}
& \parbox{0.07\textwidth}{\centering \small red.~in error\\ vs.~cro\nobreakdash-L}
& \parbox{0.07\textwidth}{\centering \small red.~in error\\ vs.~\emph{Mdqa}}\\
\midrule
electronics & 0.5 & 0.633 & 0.626 & 0.886 & 0.855 & 0.865 & \textbf{0.912} & 65.6\% & 54.5\% \\
home and kitchen & 0.5 & 0.643 & 0.635 & 0.850 & 0.840 & 0.863 & \textbf{0.907} & 73.5\% & 48.1\% \\
sports and outdoors & 0.5 & 0.653 & 0.645 & 0.848 & 0.845 & 0.860 & \textbf{0.885} & 35.1\% & 22.5\% \\
tools and home impr. & 0.5 & 0.638 & 0.632 & 0.860 & 0.817 & 0.834 & \textbf{0.884} & 58.8\% & 43.7\% \\
automotive & 0.5 & 0.648 & 0.640 & 0.810 & 0.821 & 0.825 & \textbf{0.863} & 30.4\% & 27.7\% \\
cell phones & 0.5 & 0.624 & 0.617 & 0.768 & 0.797 & 0.844 & \textbf{0.886} & 78.7\% & 37.5\% \\
health and personal care & 0.5 & 0.632 & 0.625 & 0.818 & 0.817 & 0.842 & \textbf{0.880} & 52.7\% & 31.9\% \\
patio lawn and garden & 0.5 & 0.634 & 0.628 & 0.835 & 0.833 & 0.796 & \textbf{0.848} & 10.2\% & 34.4\% \\
\midrule
average & 0.5 & 0.638 & 0.631 & 0.834 & 0.828 & 0.841 & \textbf{0.883} & 50.6\% & 37.5\% \\
\bottomrule
\renewcommand{\tabcolsep}{6pt}
\end{tabular}\
\begin{tabular}{c|l}
\vphantom{Lq} rand & random\\
\vphantom{Lq} c & cosine similarity\\
\vphantom{Lq} r & ROUGE measures\\
\vphantom{Lq} o & Okapi BM25+\\
\vphantom{Lq} -L & ML parameters\\
\vphantom{Lq}\emph{Moqa} & our method\\
\vphantom{Lq}\emph{Mdqa} & w/ descriptions
\end{tabular}
\end{table*}
\subsubsection{Reviews versus product descriptions}
\label{sec:descriptions}
We also want to evaluate whether review text is a better source of data than other sources, such as product descriptions or specifications. To test this we collected description/specification text for each of the products in our catalogue. From here, we simply interchange reviews with descriptions (recall that both models operate at the level of sentences). We find that while \modelname{} with descriptions (i.e., \emph{Mdqa}) performs well (on par with the strongest baselines), it is still substantially outperformed when we use review text. Here \modelname{} yields a 37.5\% reduction in error over \emph{Mdqa} in Table \ref{tab:openended}; similarly in Figure \ref{fig:prec}, for binary queries \emph{Mdqa} is on par with the strongest baseline but substantially outperformed by \modelname{} (again other datasets are similar and not shown for brevity).
Partly, reviews perform better because we want to answer subjective queries that depend on personal experiences, for which reviews are simply a more appropriate source of data. But other than that, reviews are simply more abundant---we have on the order of 100 times as many reviews as descriptions (products with active Q/A pages tend to be reasonably popular ones); thus it is partly the sheer volume and diversity of reviews available that makes them effective as a means of answering questions.
We discuss these findings in more detail in Section \ref{sec:discussion}.
\subsection{Qualitative evaluation}
Finally, we evaluate \modelname{} qualitatively through a user study. Although we have shown \modelname{} to be effective at correctly resolving binary queries, and at maximizing the AUC to select a correct answer among alternatives, what remains to be seen is whether the relevance functions that we learned to do so are aligned with what humans consider to be `relevant.' Evaluating this aspect is especially important because in a live system our approach would presumably not be used to answer queries directly (which we have shown to be very difficult, and in general still an open problem), but rather to surface relevant reviews that will help the user to evaluate the product themselves.
Here we use the relevance functions $s_\Theta(q,r)$ that we learned in the previous section (i.e., from Table \ref{tab:openended}) to compare which definition of `relevance' is best aligned with real users' evaluations---note that the voting function $v$ is not required at this stage.
We performed our evaluation using \emph{Amazon's Mechanical Turk}, using `master workers' to evaluate 100 queries from each of our five largest datasets, as well as one smaller dataset (\emph{baby}) to assess whether our method still performs well when less data is available for training. Workers were presented with a product's title, image, and a randomly selected query (binary or otherwise). We then presented them the top-ranked result from our method, as well as the top-ranked result using Okapi-BM25+/ROUGE measures (with tuned parameters, i.e., ro-L from Table \ref{tab:openended}); this represents a state-of-the-art `off-the-shelf' relevance ranking benchmark, with parameters tuned following best practices; it is also the most competitive baseline from Table \ref{tab:openended}. Results were shown to evaluators in a random order without labels, from which they had to select whichever they considered to be the most relevant.\footnote{We also showed a randomly selected result, and gave users the option to select \emph{no} result. We discarded cases with overlaps.} We also asked workers whether they considered a question to be `subjective' or not, in order to evaluate whether the subjectivity of the question impacts performance.
A screenshot of our interface is shown in Figure \ref{fig:interface}.
\begin{figure}[t]
\begin{center}
\fbox{\includegraphics[width=0.8\linewidth]{FIG/interface}}
\end{center}
\caption{A screenshot of our interface for user evaluation.\label{fig:interface}}
\end{figure}
Results of this evaluation are shown in Figure \ref{fig:user_study}. On average, \modelname{} was preferred in 73.1\% of instances across the six datasets we considered. This is a significant improvement; improvements were similar across datasets (between 66.2\% on Sports and Outdoors and 77.6\% on Baby), and for both subjective and objective queries (62.9\% vs.~74.1\%). Ultimately \modelname{} consistently outperforms our strongest baseline in terms of subjective performance, though relative performance seems to be about the same for objective and subjective queries, and across datasets.
\begin{figure}[t]
\begin{center}
\includegraphics{FIG/user_study}
\end{center}
\caption{User study. Bars indicate the fraction of times that opinions surfaced by \modelname{} are preferred over those of the strongest baseline (a tuned combination of BM25+ and the ROUGE score, ro-L from Section \ref{sec:baselines}). \label{fig:user_study}}
\end{figure}
\subsubsection{Examples}
Finally, a few examples of the output produced by \modelname{} are shown in Figure \ref{fig:examps}. Note that none of these examples were available at training time, and only the question (along with the product being queried) are provided as input. These examples demonstrate a few features of \modelname{} and the data in question: First is the wide variety of products, questions, and opinions that are reflected in the data; this linguistic variability demonstrates the need for a model that \emph{learns} the notion of relevance from data. Second, the questions themselves (like the example from Figure \ref{fig:examp}) are quite different from those that could be answered through knowledge bases; even those that seem objective (e.g. ``how long does this stay hot?'') are met with a variety of responses representing different (and sometimes contradictory) experiences; thus reviews are the perfect source of data to capture this variety of views. Third is the heterogeneity between queries and opinions; words like ``girl'' and ``tall'' are identified as being relevant to ``daughter'' and ``medium,'' demonstrating the need for a flexible model that is capable of learning complicated semantics in general, and synonyms in particular.
Also note that while our bilinear model has many thousands of parameters, at test time relevance can be computed extremely efficiently, since in \eq{eq:approxtransform} we can project all reviews via $B$ in advance. Thus computing relevance takes only $O(K + |q| + |r|)$ (i.e., the number of projected dimensions plus the number of words in the query and review); in practice this allows us to answer queries in a few milliseconds, even for products with thousands of reviews.
\begin{figure*}[ht]
\begin{center}
\small
\begin{tabular}{p{0.82\linewidth}m{0.13\linewidth}}
\multicolumn{2}{c}{Binary model:}\\
\toprule
\parbox{\linewidth}
\textbf{Product:} Schwinn Searcher Bike (26-Inch, Silver) (\texttt{amazon.com/dp/B007CKH61C})\\
\textbf{Question:} ``Is this bike a medium? My daughter is 5'8''.''\\[-1mm]
\textbf{Ranked opinions and votes:} ``The seat was just a tad tall for my girl so we actually sawed a bit off of the seat pole so that it would sit a little lower.'' (yes, .698); ``The seat height and handlebars are easily adjustable.'' (yes, .771); ``This is a great bike for a tall person.'' (yes, .711)\\[-1mm]
\textbf{Response:} Yes (.722)\\
\textbf{Actual answer (labeled as `yes'):} My wife is 5'5'' and the seat is set pretty low, I think a female 5'8'' would fit well with the seat raised.
} & {\centering \includegraphics[width=\linewidth]{FIG/bike}}\\
\midrule
\parbox{\linewidth}
\textbf{Product:}~Davis \& Sanford EXPLORERV Vista Explorer 60" Tripod (\texttt{amazon.com/dp/B000V7AF8E})\\
\textbf{Question:}~``Is this tripod better then the AmazonBasics 60-Inch Lightweight Tripod with Bag one?''\\[-1mm]
\textbf{Ranked opinions and votes:} ``However, if you are looking for a steady tripod, this product is not the product that you are looking for'' (no, .295); ``If you need a tripod for a camera or camcorder and are on a tight budget, this is the one for you.'' (yes, .901); ``This would probably work as a door stop at a gas station, but for any camera or spotting scope work I'd rather just lean over the hood of my pickup.'' (no, .463);\\[-1mm]
\textbf{Response:} Yes (.863)\\
\textbf{Actual answer (labeled as `yes'):} The 10 year warranty makes it much better and yes they do honor the warranty. I was sent a replacement when my failed.
} & \parbox{\linewidth}{\centering \includegraphics[width=0.75\linewidth]{FIG/tripod}}\\
\bottomrule
\\
\multicolumn{2}{c}{Open-ended model:}\\
\toprule
\parbox{\linewidth}
\textbf{Product:}~Mommy's Helper Kid Keeper (\texttt{amazon.com/dp/B00081L2SU})\\
\textbf{Question:}~``I have a big two year old (30 lbs) who is very active and pretty strong. Will this harness fit him? Will there be any room to grow?''\\[-1mm]
\textbf{Ranked opinions:} ``So if you have big babies, this may not fit very long.''; ``They fit my boys okay for now, but I was really hoping they would fit around their torso for longer.''; ``I have a very active almost three year old who is huge.''\\[-1mm]
\textbf{Actual answer:} One of my two year olds is 36lbs and 36in tall. It fits him. I would like for there to be more room to grow, but it should fit for a while.
} & \parbox{\linewidth}{\centering \includegraphics[width=0.8\linewidth]{FIG/leash}}\\
\midrule
\parbox{\linewidth}
\textbf{Product:}~Thermos 16 Oz Stainless Steel (\texttt{amazon.com/dp/B00FKPGEBO})\\
\textbf{Question:}~``how many hours does it keep hot and cold ?''\\[-1mm]
\textbf{Ranked opinions:} ``Does keep the coffee very hot for several hours.''; ``Keeps hot Beverages hot for a long time.''; ``I bought this to replace an aging one which was nearly identical to it on the outside, but which kept hot liquids hot for over 6 hours.''; ``Simple, sleek design, keeps the coffee hot for hours, and that's all I need.''; ``I tested it by placing boiling hot water in it and it did not keep it hot for 10 hrs.''; ``Overall, I found that it kept the water hot for about 3-4 hrs.''; \\[-1mm]
\textbf{Actual answer:} It doesn't, I returned the one I purchased.
} & \parbox{\linewidth}{\centering \includegraphics[width=0.5\linewidth]{FIG/thermos}}\\
\bottomrule
\end{tabular}
\end{center}
\normalsize
\caption{Examples of opinions recommended by \modelname{}. The top two examples are generated by the binary model, the bottom two by the open-ended model. Note that none of these examples were available at training time, and only the question is provided as input (the true answer and its label are shown for comparison). Opinions are shown in decreasing order of relevance. Note in the second example that \emph{all} opinions get to vote in proportion to their relevance; in this case the many positive votes among less-relevant opinions outweigh the negative votes above, ultimately yielding a strong `yes' vote.\label{fig:examps}}
\end{figure*}
\section{Discussion and Future Work}
\label{sec:discussion}
Surprisingly, performance for open-ended queries (Table \ref{tab:openended}) appears to be better than performance for binary queries (Table \ref{tab:yn}), both compared to random classification and to our strongest baseline, against our intuition that the latter task might be more difficult. There are a few reasons for this: One is simply that the task of differentiating the true answer from a (randomly selected) non-answer is `easier' than resolving a binary query; this explains why outperforming a random baseline is easier, but does not explain the higher relative improvement against baselines. For the latter, note that the main difference between our method and the strongest baseline is the use of a bilinear model; while a highly flexible model, it has far more parameters than baselines, meaning that a large dataset is required for training. Thus what we are seeing may simply be the benefit of having substantially more data available for training when considering open-ended questions.
Also surprising is that in our user study we obtained roughly equal performance on subjective vs.~objective queries. Partly this may be because subjective queries are simply `more difficult' to address, so that there is less separation between methods, though this would require a larger labeled dataset of subjective vs.~objective queries to evaluate quantitatively. In fact, contrary to expectation only around 20\% of queries were labeled as being `subjective' by workers. However the full story seems more complicated---queries such as ``how long does this stay hot?''~(Figure \ref{fig:examps}) are certainly labeled as being `objective' by human evaluators, though the variety of responses shows a more nuanced situation. Really, a large fraction of seemingly objective queries are met with contradictory answers representing different user experiences, which is exactly the class of questions that our method is designed to address.
\subsection{Future work}
We see several potential ways to extend \modelname{}.
First, while we have made extensive use of reviews, there is a wealth of additional information available on review websites that could potentially be used to address queries. One is rating information, which could improve performance on certain evaluative queries (though to an extent we already capture this information as our model is expressive enough to learn the polarity of sentiment words). Another is user information---the identity of the questioner and the reviewer could be used to learn better relevance models, both in terms of whether their opinions are aligned, or even to identify topical experts, as has been done with previous Q/A systems \cite{experts_qa,experts_qa2,jurczyk2007discovering,pal11b,anderson}.
In categories like electronics, a large fraction of queries are related to compatibility (e.g.~``will this product work with X?''). Addressing compatibility-related queries with user reviews is another promising avenue of future work---again, the massive number of potential product combinations means that large volumes of user reviews are potentially an ideal source of data to address such questions.
Although our system can already address such queries to some extent, ideally a model of compatibility-related queries would make use of additional information, for instance reviews of \emph{both} products being queried, or the fact that compatibility relationships tend to be symmetric, or even co-purchasing statistics as in \cite{McAPanLes15}.
Finally, since we are dealing with queries that are often subjective, we would like to handle the possibility that they may have multiple and potentially inconsistent answers. Currently we have selected the top-voted answer to each question as an `authoritative' response to be used at training time. But handling multiple, inconsistent answers could be valuable in several ways, for instance to automatically identify whether a question is subjective or contentious, or otherwise to generate relevance rankings that support a spectrum of subjective viewpoints.
\section{Conclusion}
We presented \modelname{}, a system that automatically responds to product-related queries by surfacing relevant consumer opinions. We achieved this by observing that a large corpus of previously-answered questions can be used to \emph{learn} the notion of relevance, in the sense that `relevant' opinions are those for which an accurate predictor can be trained to select the correct answer as a function of the question and the opinion. We cast this as a mixture-of-experts learning problem, where each opinion corresponds to an `expert' that gets to vote on the correct response, in proportion to its relevance. These relevance and voting functions are learned automatically and evaluated on a large training corpus of questions, answers, and reviews from \emph{Amazon}.
The main findings of our evaluation were as follows: First, reviews proved particularly effective as a source of data for answering product-related queries, outperforming other sources of text like product specifications; this demonstrates the value of \emph{personal experiences} in addressing users' queries. Second, we demonstrated the need to handle heterogeneity between various text sources (i.e., questions, reviews, and answers); our large corpus of training data allowed us to train a flexible bilinear model that it capable of automatically accounting for linguistic differences between text sources, outperforming hand-crafted word- and phrase-level relevance measures. Finally, we showed that \modelname{} is quantitatively able to address both binary and open-ended questions, and qualitatively that human evaluators prefer our learned notion of `relevance' over hand-crafted relevance measures.
\bibliographystyle{abbrv}
| {'timestamp': '2015-12-23T02:00:33', 'yymm': '1512', 'arxiv_id': '1512.06863', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06863'} | arxiv |
\section{Multimodal Deep Learning Library}
MDL, Multimodal Deep Learning Library, is a deep learning framework that supports multiple models, and this document explains its philosophy and functionality. MDL runs on Linux, Mac, and Unix platforms. It depends on OpenCV.
\subsection{Modules}
MDL supports the following deep learning models:
\begin{itemize}
\item Restricted Boltzmann Machine
\item Deep Neural Network
\item Deep Belief Network
\item Denoising Autoencoder
\item Deep Boltzmann Machine
\item Bimodal Model
\end{itemize}
It also provides interfaces for reading MNIST, CIFAR, and AVLetters data sets. Multiple options in learning and visualization interfaces are also provided.
\subsection{Document Content}
Chapter 2 introduces three graphical models. Chapters 3 to 7 give descriptions of each deep learning model. Chapter 8 introduces multimodal deep learning. Chapter 9 describes library architecture. Chapter 10 shows testing results.
\section{Network Survey}
This chapter includes a brief description of three graphical models that are mentioned in this document and a summary of deep learning models of MDL.
\subsection{Neural Network}
The Neural Network is a directed graph that consists of multiple layers of neurons, which is also known as units. Each pair of adjacent layers is connected, but there is no connection within each layer. The first layer is the input, called the visible layer $v$. Above the visible layer are multiple hidden layers $\{h_1, h_2,..., h_n\}$. The output of the last hidden layer forms the output layer $o$.\\
\\
In hidden layers, neurons in layer $h_{i}$ receive input from the previous layer, $h_{i - 1}$ or $v$, and the output of $h_i$ is the input to the next layer, $h_{i+1}$ or $o$. The value transmitted between layers is called activation or emission. The activation is computed as:\begin{gather}
a^{(k)}_i = f((\sum_{j=1}^{n_{k-1}}a^{(k-1)}_jw^{k}_{ij})+b^{(k)}_i)=f(z^{(k)}_i)
\end{gather}
where $f$ is the activation function that defines a non-linear form of the output. A typical activation function is the sigmoid function. $z^{(k)}_i$ is the total input of the unit $i$ in layer $k$. It is computed as the weighted sum of the activations of the previous layer. The weight $w^{k}_{ij}$ and the bias $b^k_i$ are specified by the model.\\
\\
In forward propagation, activations are computed layer by layer. Training of the neural network uses backpropagation, which is a supervised learning algorithm. It calculates the error based on the network output and the training label, then uses this error to compute the gradients of error with respect to the weights and biases. The weights and biases are then updated by gradient descent.
\subsection{Markov Random Field}
The Markov Random Field, also called the Markov Network, is an undirected graphical model in which each node is independent of the other nodes given all the nodes connected to it. It defines the distribution of the variables in the graph.\\
\\
The Markov Random Field uses energy to decribe the distribution over the graph\begin{equation}
P(u) = \frac{1}{Z} e^{-E(u)},
\end{equation}
where $Z$ is a partition function defined by \begin{equation}
Z = \sum_{u} e^{-E(u)}.
\end{equation}
$E$ is the energy specified by the model, and $u$ is the set of states of all the nodes:\begin{equation}
u=\{v_1, v_2,...,v_n \}
\end{equation}
where $v_i$ is the state of node $i$.
\subsection{Belief Network}
The Belief Network, which is also called the Bayesian Network, is a directed acyclic graph for probabilistic reasoning. It defines the conditional dependencies of the model by associating each node $X$ with a conditional probability $P(X|Pa(X))$, where $Pa(X)$ denotes the parents of $X$. Here are two of its conditional independence properties:\\
\\
1. Each node is conditionally independent of its non-descendants given its parents.\\
2. Each node is conditionally independent of all other nodes given its Markov blanket, which consists of its parents, children, and children's parents.\\
\\
The inference of Belief Network is to compute the posterior probability distribution\begin{equation}
P(H|V) = \frac{P(H, V)}{\sum_H P(H,V)},
\end{equation}
where $H$ is the set of the query variables, and $V$ is the set of the evidence variables. Approximate inference involves sampling to compute posteriors. The Sigmoid Belief Network \cite{saul1996mean} is a type of the Belief Network such that \begin{equation}
P(X_i=1|Pa(X_i)) = \sigma(\sum_{X_j\in Pa(X_i)} W_{ji} X_j + b_i)
\end{equation}
where $W_{ji}$ is the weight assigned to the edge from $X_j$ to $X_i$, and $\sigma$ is the sigmoid function.
\subsection{Deep Learning Models}
There are many models in deep learning \cite{deeptutorial}. Below are included in MDL.\\
\\
The Restricted Boltzmann Machine is a type of Markov Random Field and is trained in an unsupervised fashion. It is the building block for other models and could be used for classification by adding a classifier on top of it.\\
\\
The Deep Neural Network is a neural network with multiple layers. Each layer is initialized by pretraing a Restricted Boltzmann Machine. Then fine tuning would refine the parameters of the model.\\
\\
The Deep Belief Network is a hybrid of the Restricted Boltzmann Machine and the Sigmoid Belief Network. It is a generative model but not a feedforward neural network nor a multilayer perceptron even though its training is similar to the Deep Neural Network.\\
\\
The Denoising Autoencoder is a type of neural network that has a symmetric structure. It could reconstruct the input data and if properly trained could denoise the input data. However, unlike neural networks, it could be trained with an unsupervised method.\\
\\
The Deep Boltzmann Machine is another type of Markov Random Field. It is pretrained by stacking Restricted Boltzmann Machines with adjusted weights and biases as an approximation to undirected graphs. Its fine tuning uses a method called mean field inference.
\section{Restricted Boltzmann Machine}
\subsection{Logic of the Restricted Boltzmann Machine}
\begin{figure}[h]
\centering
\includegraphics[height=1.5in]{RBM.png}
\caption{Restricted Boltzmann Machine} \label{fig:side:a}
\end{figure}
The Restricted Boltzmann Machine (RBM) \cite{larochelle2008classification, le2008representational, salakhutdinov2007restricted} is a Markov Random Field consisting of one hidden layer and one visible layer. It is an undirected bipartite graph in which connections are between the hidden layer and the visible layer. Each unit $x$ is a stochastic binary unit such that\begin{equation}
state(x)=\begin{cases}1,~~~~p\\
0,~~~~1-p
\end{cases}
\end{equation}
where probability $p$ is defined by the model. Figure 3.1 shows a RBM with four hidden units and six visible units.\\
\\
As a Markov Random Field, a Restricted Boltzmann Machine defines the distribution over the visible layer $v$ and the hidden layer $h$ as \begin{equation}
P(v,h) = \frac{1}{Z} e^{-E(v,h)},\label{eq:3}
\end{equation}
where $Z$ is the partition function defined as \begin{equation}
Z = \sum_{v, h} e^{-E(v,h)}.
\end{equation}
Its energy $E(v,h)$ is defined by \begin{equation}\label{eq:1}
E(v,h) = -\sum_i b^v_i v_i - \sum_j b^h_j h_j -\sum_i \sum_j v_i w_{i,j} h_j,
\end{equation}
where $b^v_i$ is the bias of the \emph{i}th visible unit and $b^h_j$ is the bias of the \emph{j}th hidden unit.\\
\\
Given the conditional independence property of the Markov Random Field, the distribution of one layer given the other layer could be factorized as
\begin{gather}
P(h|v)=\prod_j P(h_j|v) \label{eq:2}\\
P(v|h)=\prod_i P(v_i|h).
\end{gather}
Plug equation \eqref{eq:1} into equation \eqref{eq:3}: \begin{equation} \label{eq:5}
P(h|v)=\frac{P(h,v)}{\sum_{h'} P(h',v)}=\frac{exp(\sum_i b^v_i v_i + \sum_j b^h_j h_j +\sum_i \sum_j v_i w_{i,j} h_j)}{\sum_{h'} exp(\sum_i b^v_i v_i + \sum_j b^{h'}_j h'_j +\sum_i \sum_j v_i w_{i,j} h'_j)}.
\end{equation}
It is easy to show that \begin{equation}\label{eq:4}
\frac{exp(\sum_i b^v_i v_i + \sum_j b^h_j h_j +\sum_i \sum_j v_i w_{i,j} h_j)}{\sum_{h'} exp(\sum_i b^v_i v_i + \sum_j b^{h'}_j h'_j +\sum_i \sum_j v_i w_{i,j} h'_j)}=\prod_{j}\frac{exp(b^h_j + \sum_{i=1}^m W_{i,j} v_i )}{1+exp(b^h_j + \sum_{i=1}^m w_{i,j} v_i )}.
\end{equation}
By combining equation \eqref{eq:2}, \eqref{eq:5}, and \eqref{eq:4}, we have
\begin{equation}
P(h_j=1|v) = \sigma \left(b^h_j + \sum_{i=1}^{N_v} W_{i,j} v_i \right),
\end{equation}
where $\sigma$ is a sigmoid function\begin{equation}
\sigma(t) = \frac{1} {1 + exp(-t)}.
\end{equation}
Similarly,
\begin{equation}
P(v_i=1|h) = \sigma \left(b^v_i + \sum_{j=1}^{N_h} W_{i,j} h_j \right).
\end{equation}
\\
A Restricted Boltzmann Machine maximizes the likelihood $P(x)$ of the input data $x$, which is\begin{align}
P(x) = \sum_h P(x,h) = \sum_h \frac{1}{Z}e^{-E(h, x)}=\frac{1}{Z}e^{-F(x)},
\end{align}
where $F(x)$ is called Free Energy such that \begin{equation}
F(x) = - \sum_{i=1}^{n_v} b^v_ix_i-\sum_{j=1}^{n_h}\log(1+ exp(b^h_j+\sum_{k=1}^{n_v} W_{kj}x_k)).
\end{equation}
\\
In training, maximizing the likelihood of the training data is achieved by minimizing the negative log-likelihood of the training data. Because the direct solution is intractable, gradient descent is used, in which the weights $\{W_{ij}\}$, the biases of the hidden units $\{b^h_j\}$, and the biases of the visible units $\{b^v_i\}$ are updated. The gradient is approximated by an algorithm called Contrastive Divergence.\\
\\
The activation of the hidden layer is
\begin{equation}
a^h =\sigma(v * W + b^h),
\end{equation}
where $\sigma$ is performed in an element-wise fashion. The set of the hidden states, $\{h_j\}$, is expressed as a row vector $h$, the set of the hidden biases, $\{b^h_{j}\}$, is expressed as a row vector $b^ h$, and the set of the weights, $\{W_{ij}\}$, is expressed as a matrix $W$ which represents the weight from the visible layer to the hidden layer.\\
\\
The Restricted Boltzmann Machine has tied weights such that
\begin{equation}
a^v = \sigma(h * W^{T} + b^v).
\end{equation}
In training, the state of the visible layer is initialized as the training data.
\subsection{Training of the Restricted Boltzmann Machine}
In the training of Restricted Boltzmann Machine, the weights and the biases of the hidden and the visible layers are updated by gradient descent. Instead of stochastic gradient descent, in which each update is based on each data sample, batch learning is used. In batch learning, each update is based on a batch of training data. There are several epochs in training. Each epoch goes through the training data once.\\
\\
For instance, if the input data has 10,000 samples and the number of batches is 200, then there will be 200 updates in each epoch. For each update, gradients will be based on 50 samples. If the number of epochs is 10, commonly there should be a total of 2000 updates in the training process. If the gradients computed are trivial, this process may stop earlier.\\
\\
The gradients of weights are given by Contrastive Divergence as: \begin{equation}\label{eq:7}
\nabla W_{ij} = \langle v_i * h_j\rangle_{recon} - \langle v_i * h_j\rangle_{data},
\end{equation}
where the angle brackets are expectations under the distribution specified by the
subscript. The expectations here are estimated by data sample mean, therefore
\begin{equation}
\nabla W_{ij} = \sum_{k = 1} ^ {m}((v_i * h_j)_{recon_k} - (v_i * h_j)_{data_k}) / m,
\end{equation}
where $m$ is the size of each data batch.\\
\\
States of the visible layer and the hidden layer form a sample in Gibbs sampling, in which the first sample gives states with the subscript ``data" in equation \eqref{eq:7} and the second sample gives states with the subscript ``recon" in equation \eqref{eq:7}. Contrastive Divergence states that one step of Gibbs sampling, which computes the first and the second sample, approximates the descent with high accuracy. In RBM, Gibbs sampling works in the following manner:\\
\\
In Gibbs sampling, each sample $X = (x_1, \dots, x_n)$ is made from a joint distribution $\left.p(x_1, \dots, x_n)\right.$ by sampling each component variable from its posterior. Specifically, in the (\emph{i} + 1)th sample $X^{(i+1)} = (x_1^{(i+1)}, \dots, x_n^{(i+1)})$, $x_j^{(i+1)}$ is sampled from \begin{equation}
p(X_j|x_1^{(i+1)},\dots,x_{j-1}^{(i+1)},x_{j+1}^{(i)},\dots,x_n^{(i)}),
\end{equation}
in which the latest sampled component variables are used to compute posterior. Sampling each component variable $x_j$ once forms a sample.\\
\\
Each unit of RBM is a stochastic binary unit and its state is either 0 or 1. To sample $h_j$ from \begin{equation}
P(h_j=1|v) = \sigma \left(b_j + \sum_{i=1}^m W_{i,j} v_i \right),
\end{equation}
we can simply compute $a_j = \sigma \left(b_j + \sum_{i=1}^m W_{i,j} v_i \right)$. If $a_j$ is larger than a random sample from standard uniform distribution, state of $h_j$ is 1, otherwise 0. This method works because the probability that a random sample $u$ from standard uniform distribution is smaller than $a_j$ is $a_j$: \begin{equation}
P(u < a_j) = F_{\text{uniform}}(a_j) = a_j.
\end{equation}
So we have \begin{equation}
P(h_j=1|v) = P(u < a_j).
\end{equation}
Thus we could sample by testing if $u < a_j$, since it has probability $a_j$. Each unit has two possible states. If $u < a_j$ fails, the state is 0.\\
\\
In training, we first use the training data to compute the hidden layer posterior with \begin{equation}
P(h_j=1|v) = \sigma \left(b_j + \sum_{i=1}^m W_{i,j} v_i \right).
\end{equation}
The hidden layer states and the training data form the first sample. Then Gibbs sampling is used to compute the second sample.\\
\\
The gradient of the visible bias is \begin{equation}
\nabla b^v_{i} = \langle v_i\rangle_{recon} - \langle v_i\rangle_{data},
\end{equation}
and the gradient of the hidden bias is \begin{equation}
\nabla b^h_{j} = \langle h_j\rangle_{recon} - \langle h_j\rangle_{data}
\end{equation}
\subsection{Tricks in the Training}
\textbf{Dropout}\\
Dropout \cite{hinton2010practical} is a method to prevent neural networks from overfitting by randomly blocking emissions from a portion of neurons. It is similar to adding noise. In RBM training, a mask is generated and put on the hidden layer.\\
\\
For instance, suppose the hidden states are \begin{equation}
h = \{h_1, h_2, ..., h_n\}
\end{equation}
and the dropout rate is $r$. Then a mask $m$ is generated by
\begin{eqnarray}
m_i=\begin{cases}
1,~~~~u_i > r\\
0,~~~~u_i \leq r
\end{cases}
\end{eqnarray}
where $u_i$ is a sample from standard uniform distribution, and $i\in \{1, 2, ..., n\}$. The emission of hidden layer would be \begin{equation}
\tilde{h} = h.* m
\end{equation}
where $.*$ denotes element-wise multiplication of two vectors. $\tilde{h}$, instead of $h$, is used to calculate visible states.\\
\\
\textbf{Learning Rate Annealing}\\
There are multiple methods to adapt the learning rate in gradient descent. If the learning rate is trivial, updates may tend to get stuck in local minima and waste computation. If it is too large, the updates may bound around minima and could not go deeper. In annealing, learning rate decay adjusts the learning rate for better updates.\\
\\
Suppose $\alpha$ is the learning rate. In exponential decay, the annealed rate is\begin{equation}
\alpha_a = \alpha * e^{-kt},
\end{equation}
where $t$ is the index of the current epoch, $k$ is a customized coefficient. In divide decay, the annealed rate is\begin{equation}
\alpha_a = \alpha / (1 + kt).
\end{equation}
A more common method is step decay:\begin{equation}
\alpha_a = \alpha * 0.5^{\lfloor{t / 5}\rfloor{}}.
\end{equation}
where learning rate is reduced by half every five epochs. The coefficients in the decay method should be tuned in testings.\\
\\
\textbf{Momentum}\\
With momentum $\rho$, the update step is \begin{equation}
\Delta_{t+1} W = \rho * \Delta_t W - r\nabla W.
\end{equation}
The update value is a portion of previous update value minus the gradient. Thus, if the gradient is in the same direction of the previous update, the update value will become larger. If the gradient is in the different direction, the variance of the updates will decrease. In this way, time to converge is reduced.\\
\\
Momentum is often applied with annealing so that steps of updates will not be too large. A feasible scheme is \begin{eqnarray}
\rho=\begin{cases}
0.5,~~~~t < 5\\
0.9,~~~~t \geq 5
\end{cases}
\end{eqnarray}
where $t$ is the index of the current epoch.\\
\\
\textbf{Weight Decay}\\
In weight decay, a penalty term is added to the gradient as a regularizer. $L_1$ penalty $p_1$ is \begin{equation}
p_1 = k \times \sum_{i,j} |W_{ij}|.
\end{equation}
$L_1$ penalty causes many weights to become zero and a few weights to become large. $L_2$ penalty $p_2$ is \begin{equation}
p_2 = k \times \sum_{i,j} W_{ij}^2.
\end{equation}
$L_2$ penalty causes weights to become more even and smaller. The coefficient $k$ is customized, sometimes 0.5 would work. Penalty must be, as well as the gradient, multiplied by the learning rate so that annealing will not change the model trained.
\subsection{Classifier of the Restricted Boltzmann Machine}
A classifier based on RBM could be built by training a classifier layer with the softmax function on top of the hidden layer. The softmax function takes a vector $a = \{a_1, a_2,..., a_q\}$ as input, and outputs a vector $c = \{c_1, c_2,..., c_q\}$ with the same dimension, where\begin{equation}
c_i = \frac{e^{a_i}}{\sum_{k=1}^q e^{a_k}}.
\end{equation}
\\
One-of-$K$ scheme is used to present the class distribution. If there are $K$ classes in the training data, then the label of a sample in class $i$ is expressed as a vector of length $K$ with only the $i$th element as 1, the others as 0. For instance, if the training data has five classes, a sample in the fourth class has the label\begin{equation*}
\{0,0,0,1,0\}.
\end{equation*}
\\
For training data in $K$ classes, there are $K$ neurons in the classifier layer. For each data sample, the softmax activation emits a vector of length $K$. The index of the maximum element in this emission is the label. The elements of the softmax activation sum to 1 and the activation is the prediction distribution:\begin{equation}
c_i = P\{\text{The sample is in class i}\}.
\end{equation}
\\
The input of the softmax function is of $K$-dimension whereas there may be hundreds of units in the hidden layer. So the projection from the hidden layer to the classifier should be learned. If the hidden layer has $n_h$ units and the training data is in $K$ classes, the weight of this projection should be a matrix of dimension $n_h\times K$.\\
\\
Backpropagation with the combination of cross entropy loss and softmax function is used to update this weight. Using $t$ to represent the labels and $c$ to represent the prediction distribution, the cross entropy loss is \begin{equation}
L = -\sum_{i = 0}^K t_i log(c_i).
\end{equation}
\\
By chain rule:\begin{equation}
\frac{\partial L}{\partial W_{ij}} = \sum_{p=1}^K \frac{\partial L}{\partial c_p} \frac{\partial c_p}{\partial W_{ij}}
\end{equation}
and \begin{equation}
\frac{\partial c_p}{\partial W_{ij}}= \sum_{q=1}^K \frac{\partial c_p}{\partial z_q} \frac{\partial z_q}{\partial W_{ij}}
\end{equation}
where $c$ is the output of softmax activation and $z$ is its input. That is to say, \begin{equation}
c_i = \frac{exp(z_i)}{\sum_{p=1}^K exp(z_p)}.
\end{equation} Furthermore\begin{equation}
\frac{\partial L}{\partial c_p} = -\frac{t_p}{c_p}
\end{equation}
\begin{equation}
\frac{\partial c_p}{\partial z_q} = \begin{cases}
c_p(1-c_p)~~~~~~\text{if } p = q
\\
-c_p\times c_q~~~~~~~~\text{if } p \neq q
\end{cases}
\end{equation}
\begin{equation}
\frac{\partial z_q}{\partial W_{ij}} = \begin{cases}
a^h_i~~~~~~\text{if } q = j
\\
0~~~~~~~~\text{if } q \neq j
\end{cases}
\end{equation}
where $a^h_i$ is the activation of the hidden layer. Based on the above equations, for the combination of the cross entropy loss and the softmax activation \begin{equation}
\frac{\partial L}{\partial W_{ij}} = a_i^h(c_j - t_j).
\end{equation}
Expressed in row vectors it is \begin{equation}
\nabla W = (a^h)^T\times (c - t),
\end{equation}
where $(a^h)^T$ is the transpose of row vector $a^h$. This gradient is used in batch learning.
\subsection{Implementation of the Restricted Boltzmann Machine}
Class rbm is implemented in the header file rbm.hpp. Here is a selected list of its methods:\\
\\
I. void \textbf{dropout}(double i)\\
-Set dropout rate as input i.\\
\\
II. void \textbf{doubleTrain}(dataInBatch $\&$trainingSet, int numEpoch, int inLayer, ActivationType at = sigmoid$\_$t, LossType lt = MSE, GDType gd = SGD, int numGibbs = 1)\\
-Train an RBM layer in Deep Boltzmann Machine, which is an undirected graph. This part will be explained in DBM section.\\
\\
III. void \textbf{singleTrainBinary}(dataInBatch $\&$trainingSet, int numEpoch, ActivationType at = sigmoid$\_$t, LossType lt = MSE, GDType gd = SGD, int numGibbs = 1);\\
-Train an RBM layer with binary units in Deep Belief Networks and RBM.\\
\\
IV. void \textbf{singleTrainLinear}(dataInBatch $\&$trainingSet, int numEpoch, ActivationType at= sigmoid$\_$t, LossType lt = MSE, GDType gd = SGD, int numGibbs = 1);\\
-Train an RBM layer with linear units.\\
\\
V. void \textbf{singleClassifie}r(dataInBatch $\&$modelOut, dataInBatch $\&$labelSet, int numEpoch, GDType gd = SGD);\\
-Build a classifier layer for RBM.\\
\\
The model could be tested by running runRBM.cpp. First train a RBM with one hidden layer:\\
\\
RBM rbm(784, 500, 0);\\
rbm.dropout(0.2);\\
rbm.singleTrainBinary(trainingData, 6);\\
dataInBatch modelOut = rbm.g$\_$activation(trainingData);\\
\\
The hidden layer has 500 units, and the index of the RBM is 0. The dropout rate is 0.2. After training, stack the classifier layer with the softmax function on top of it:\\
\\
RBM classifier(500, 10, 0);\\
classifier.singleClassifier(modelOut, trainingLabel, 6);\\
classificationError e = classifyRBM(rbm, classifier, testingData, testingLabel, sigmoid$\_$t);\\
\\
MNIST dataset has ten classes, so there are ten units in the classifier layer.
\subsection{Summary}
RBM is the foundation for several multi-layer models. It is crucial that this component is correctly implemented and fully understood. The classifier may be trained with the hidden layer at the same time. Separating these two processes facilitates checking problems in the implementation.
\section{Deep Neural Network}
\subsection{Pretraining of the Deep Neural Network}
\begin{figure}[h]
\centering
\includegraphics[height=3.2in]{DNN.png}
\caption{Deep Neural Network} \label{fig:side:a}
\end{figure}
A Deep Neural Network (DNN) \cite{becker1992self} is a neural network with multiple hidden layers. In neural networks, initialization of weights could significantly affect the training results. Pretraining, in which multiple Restricted Boltzmann Machines are trained to initialize parameters of each DNN layer, provides weight initialization that saves training time. Backpropagation is a time-consuming process. With pretraining, the time consumed by backpropagation could be significantly reduced. Figure 4.1 shows a DNN with two hidden layers.\\
\\
Below shows steps to build a Deep Neural Network for classification:\\
\\
I. Set the architecture of the model, specifically the size of the visible layer and the hidden layers, \(n_0, n_1, n_2, ..., n_N\). $n_0$ is the input dimension and input forms a visible layer. $n_N$ equals to the number of classes in training data.\\
\\
II. Pretrain hidden layers:\\
for $i = 1\text{ to }N $:\\
\indent 1. Train an RBM with the following settings:\\
\begin{gather*}
n_h^{(i)}=n_i\\
n_v^{(i)}=n_{i-1}\\
d_i=a_{i-1}\\
\end{gather*}
\indent where
\begin{gather*}
n_h^{(i)} = \text{Dimension of hidden layer of RBM trained for layer }i,\\
n_v^{(i)} = \text{Dimension of visible layer of RBM trained for layer }i,\\
d_i = \text{Input of RBM trained for layer i},\\
a_{i-1} = \text{Activation of the }(i-1)\text{th DNN layer}.
\end{gather*}
\indent 2. Set \begin{gather*}
W_i = W_{RBM},\\
b_i = b^h_{RBM},\\
a_i = a_{RBM}.
\end{gather*}
\indent RBM is used to initialize weights and biases of each DNN layer.\\
end for.\\
\\
III. Fine Tuning:\\
Use backpropagation to refine the weights and the biases of each layer. In backpropagation, one epoch goes through training data once. A dozen of epochs may suffice.\\
\\
Classification with Deep Neural Network is similar to RBM. The last layer, which uses softmax activation, gives the prediction distribution.
\subsection{Fine Tuning of the Deep Neural Network}
Fine tuning uses backpropagation:\\
\\
I. Perform a pass through all the layers. Compute total inputs of each layer $\{z^{(1)},..., z^{(N)}\}$ and activations of each layer $\{a^{(1)},..., a^{(N)}\}$. $a^{(i)}$ is the row vector that represents the activation of layer $i$. \\
\\
II. For the last layer, compute $\delta_i^{(N)}$ as
\begin{equation}
\delta_i^{(N)} = \frac{\partial L}{\partial z^{(N)}_i}
\end{equation}
where $L$ is the classification error. A row vector $\delta^{(N)}$ is computed. \\
\\
III. For $l$ = $N-1, ...,1$, compute
\begin{align}
\delta^{(l)} = \left(\delta ~ (W^{(l)})^T \right) \bullet g'(z^{(l)})
\end{align}
where $g$ is the activation function.\\
\\
IV. Compute the gradients in each layer. For $l$ = $N, ..., 1$, compute
\begin{align}
\nabla_{W^{(l)}} L &= (a^{(l-1)})^T~\delta^{(l)}, \\
\nabla_{b^{(l)}} L &= \delta^{(l)}.
\end{align}
where $a^{(0)}$ is the training data.\\
\\
V. Update the weights and biases of each layer using gradient descent.\\
\\
In fine tuning, the training data is repeatedly used to refine the model parameters.
\subsection{Implementation of Deep Neural Network}
Class dnn is implemented in the header file dnn.hpp. Class RBMlayer provides interfaces to store architecture information. Here is a selected list of methods of class dnn:\\
\\
I. void \textbf{addLayer}(RBMlayer $\&$l)\\
Add a layer to the current model. This object of class RBMlayer should store information of layer size, weight, bias, etc.\\
\\
II. void \textbf{setLayer}(std::vector$<$size$\_$t$>$ rbmSize)\\
Object of class dnn could automatically initialize random weights and biases of each layer by inputting a vector of layer sizes.\\
\\
III. void \textbf{train}(dataInBatch $\&$trainingData, size$\_$t rbmEpoch, LossType l = MSE, ActivationType a = sigmoid$\_$t)\\
This method trains all the layers without classifier. The structure of dnn should be initialized before calling this method. \\
\\
IV. void \textbf{classifier}(dataInBatch $\&$trainingData, dataInBatch $\&$trainingLabel, size$\_$t rbmEpoch, int preTrainOpt, LossType l = MSE, ActivationType a = sigmoid$\_$t)\\
Build a Deep Neural Network with a classifier layer. This function contains pretraining option preTrainOpt. If preTrainOpt=1, pretrain each layer by training RBMs, else randomly initialize layer parameters without pretraining.\\
\\
V. void \textbf{fineTuning}(dataInBatch $\&$label, dataInBatch $\&$inputSet, LossType l)\\
Fine tuning step that uses backpropagation.\\
\\
VI. classificationError \textbf{classify}(dataInBatch $\&$testingSet, dataInBatch $\&$testinglabel);\\
Perform Classification. The result is stored in the format classficationError.
\subsection{Summary}
The training of the Deep Neural Network consists of two steps: pretraining by stacking multiple RBMs, and fine tuning with backpropagation. Pretraining significantly reduces time spent on backpropagation.
\section{Deep Belief Network}
\subsection{Logic of the Deep Belief Network}
\begin{figure}[h]
\centering
\includegraphics[height=2.8in]{DBN.png}
\caption{Deep Belief Network} \label{fig:side:a}
\end{figure}
A Deep Belief Network (DBN) is a hybrid of a Restricted Boltzmann Machine and a Sigmoid Belief Network. A Deep Belief Network maximizes the likelihood $P(x)$ of the input $x$. Figure 5.1 shows a DBN.\\
\\
For a Deep Belief Network with $N$ hidden layers, the distribution over the visible layer (input data) and hidden layers is\begin{equation}
P(v, h_1, ..., h_N) = P(v| h_1) \times\left(\prod_{k=1}^{N-2} P(h_k| h_{k+1}))\right)\times P(h_{N-1},h_N).
\end{equation}
To prove this, by chain rule we can write\begin{equation}
P(v, h_1, ..., h_N) = P(v| h_1, ..., h_N) \times\left(\prod_{k=1}^{N-2} P(h_k| h_{k+1},..., h_{N}))\right)\times P(h_{N-1},h_N).
\end{equation}
Additionally, each node is independent of its ancestors given its parent. So these hold:\begin{gather}
P(v| h_1, ..., h_N) = P(v|h_1),\\
P(h_k| h_{k+1},..., h_{N}) = P(h_k| h_{k+1}).
\end{gather}
Then we have \begin{equation}
P(v, h_1, ..., h_N) = P(v| h_1) \times\left(\prod_{k=1}^{N-2} P(h_k| h_{k+1}))\right)\times P(h_{N-1},h_N),
\end{equation}
where $P(v| h_1) \times\left(\prod_{k=1}^{N-2} P(h_k| h_{k+1}))\right)$ is the distribution over the Sigmoid Belief Network and $P(h_{N-1},h_N)$ is the distribution over Restricted Boltzmann Machine.\\
\\
For classification there should be a layer $y$ on top of the last hidden layer. With layer $y$ that represents prediction distribution, the distribution over the Deep Belief Network is
\begin{equation}
P(v, h_1, ..., h_N, y) = P(v| h_1) \times\left(\prod_{k=1}^{N-2} P(h_k| h_{k+1}))\right)\times P(h_{N-1},h_N, y).
\end{equation}
where $P(h_{N-1},h_N, y)$ is the distribution over a RBM which has labels $y$ and the state $h_{N-1}$ as the input. In the pretraining of the Deep Belief Network, RBMs are stacked. In fine tuning, Up-Down algorithm is used.
\subsection{Training of the Deep Belief Network}
In training, the Deep Belief Network should maximize the likelihood of the training data. With the concavity of the logarithm function, the lower bound of the log likelihood of the training data $x$ could be found:\begin{equation}\label{eq:10}
\log P(x)=\log\left(\sum_h Q(h|x)\frac{P(x,h)}{Q(h|x)}\right)\geq \sum_h Q(h|x)\log\frac{P(x,h)}{Q(h|x)},
\end{equation}
and
\begin{equation}\label{eq:8}
\sum_h Q(h|x)\log\frac{P(x,h)}{Q(h|x)}= \sum_h Q(h|x)\log P(x, h)-\sum_h Q(h|x)\log Q(h|x),
\end{equation}
where $Q(h|x)$ is an approximation to the true probability $P(h|x)$ of the model.\\
\\
If $Q(h|x) = P(h|x)$, the right-hand side of \eqref{eq:8} could be written as \begin{equation}\label{eq:11}
\begin{split}
&\sum_h P(h|x)(\log P(h|x) + \log P(x))-\sum_h P(h|x)\log P(h|x)\\
& = \sum_h P(h|x)\log P(x) =\log P(x)\sum_h P(h|x) =\log P(x).
\end{split}
\end{equation}
Combining equation \eqref{eq:11}, \eqref{eq:8} with \eqref{eq:10}, we could find that when $Q(h|x) = P(h|x)$, the lower bound is tight.\\
\\
Moreover, the more different $Q(h|x)$ is from $P(h|x)$, the less tight the bound is. The lower bound of \eqref{eq:10} could be expressed as \begin{equation}
\log P(x) - KL(Q(h|x)||P(h|x)).
\end{equation}
If the approximation $Q(h|x)$ becomes closer to the true posterior $P(h|x)$, their KL divergence will be smaller, and the bound will be higher. Unlike the true posterior, the approximation could be factorized as \begin{equation}
Q(h|x)=\prod_{i=1}^{n_h} Q(h_i|x).
\end{equation}
\\
Consequently, in training the goal is to find approximation $Q(h|x)$ with high accuracy and at the same time maximizes the bound. This could be done by stacking pretrained RBMs. The lower bound of \eqref{eq:10} could be factorized as
\begin{equation}\label{eq:9}
\sum_h Q(h|x)\log\frac{P(x,h)}{Q(h|x)}= \sum_h Q(h|x)(\log P(x|h) + \log P(h))-\sum_h Q(h|x)\log Q(h|x)
\end{equation}
In the right-hand side of equation \eqref{eq:9}, $Q(h|x)$ and $P(x|h)$ are given by the first pretrained RBM. Therefore, to maximize the lower bound is to maximize \begin{equation}
\sum_h Q(h|x)\log P(h).
\end{equation}
Since the RBM maximizes the likelihood of the input data, staking another RBM on top of the first hidden layer maximizes the lower bound. Moreover, \begin{equation}
P(h) = \sum_{h^{(2)}}P(h, h^{(2)}),
\end{equation}
where $h^{(2)}$ is computed by the second pretrained RBM. The second RBM takes sample made from $Q(h|x)$ as input. But it could be trained independently since its parameters do not depend on the parameters of the first pretrained RBM. This is why greedy layer-wise pretraining works.\\
\\
In fine tuning, Up-Down algorithm \cite{hinton2006fast} is used. It is a combination of Contrastive Divergence and Wake-Sleep algorithm \cite{hinton1995wake}. Wake-Sleep algorithm is used in the learning of the Sigmoid Belief Network.
\subsection{Classification of the Deep Belief Network}
In training of the Restricted Boltzmann Machine, dropout is used to alleviate overfitting. This method reminds us that RBM could predict missing values.\\
\\
In a deep belief network, each approximation $Q(h_{k+1}|h_k)$ could be computed based on states $h_k$ and model parameters. In a deep belief network with classifier, the top RBM takes labels and hidden layer $h_{N-1}$ to compute states of the last hidden layer $h_N$, which is illustrated in Figure 5.2.\\
\\
Suppose $l$ is the set of units that represents the prediction distribution. In classification, we can fill $l$ with zeros, compute approximation $Q(h_N|l, h_{N-1})$, and then use the states $h_N$ sampled from $Q(h_N|l, h_{N-1})$ to compute the prediction distribution $l$ with $P(l, h_{N-1}| h_N)$.
\begin{figure}[h]
\centering
\includegraphics[height=5.0in]{DBNclass.png}
\caption{Top RBM of DBN with classifier} \label{fig:side:a}
\end{figure}
\subsection{Implementation of the Deep Belief Network}
Class dbn is in the header file dbn.hpp. Here is a selected list of its methods:\\
\\
I. void \textbf{addLayer}(RBMlayer $\&$l)\\
Add a layer to the current model. This object of class RBMlayer should store information of layer size, weight, bias, etc. It could also be modified after added to the model.\\
\\
II. void \textbf{setLayer}(std::vector$<$size$\_$t$>$ rbmSize)\\
Object of class dnn could automatically initialize random weights and biases of each layer by inputting a vector of layer sizes.\\
\\
III. void \textbf{train}(dataInBatch $\&$trainingData, size$\_$t rbmEpoch, LossType l = MSE, ActivationType a = sigmoid$\_$t)\\
This method trains a dbn without classifier. The architecture of dbn should be initialized before calling this method. \\
\\
IV. void \textbf{classifier}(dataInBatch $\&$trainingData, dataInBatch $\&$trainingLabel, size$\_$t rbmEpoch, LossType l = MSE, ActivationType a = sigmoid$\_$t)\\
This method trains a dbn with classifier. The architecture of dbn should be initialized before calling this method.\\
\\
V. void \textbf{fineTuning}(dataInBatch $\&$dataSet, dataInBatch $\&$labelSet, int epoch)\\
The fine tuning uses Up-Down algorithm.\\
\\
VI. classificationError \textbf{classify}(dataInBatch $\&$testingSet, dataInBatch $\&$testinglabel);\\
Perform Classification.
\subsection{Summary}
It is easy to confuse the Deep Belief Network with the Deep Neural Network. Both of them stack RBMs in the pretraining. However, because their principles and structures are distinct, their fine tunining and classification methods are different.
\section{Denoising Autoencoder}
\subsection{Training of the Autoencoder}
\begin{figure}[h]
\centering
\includegraphics[height=3.2in]{AE.png}
\caption{Autoencoder} \label{fig:side:a}
\end{figure}
Autoencoder(AE) \cite{hinton2006reducing} is a type of neural network forming a directed graph. Its symmetricity requires that in an autoencoder with $(N + 1)$ layers (including visible layer and output layer), the dimension of each layer is constrained by \begin{gather}
n_i = n_{N - i}~~~~\text{for }0\leq i\leq N
\end{gather}
where $n_i$ is the dimension of the $i$th layer, and $n_0$ is the input dimension. Since the output layer and the visible layer are of the same dimension, it is expected that autoencoders could reconstruct the input data. Thus, the training of autoencoders is unsupervised learning because input data is used as labels in fine tuning, and reconstruction errors could be used to access the model. Autoencoders could also be used to construct classifiers by adding a classifier layer on top of it. Figure 6.1 shows an Autoencoder.\\
\\
Below is how to construct an autoencoder:\\
I. Set the architecture of the model, specifically the size of each layer, \(n_0, n_1, n_2, ..., n_N\).\\
\\
II. Pretraining:\\
for $i = 1\text{ to }N/2$:\\
\indent 1. Train an RBM with the following settings:\\
\begin{gather*}
n_h^{(i)}=n_i\\
n_v^{(i)}=n_{i-1}\\
d_i=a_{i-1}
\end{gather*}
\indent where
\begin{gather*}
n_h^{(i)} = \text{Dimension of hidden layer of RBM trained for layer }i,\\
n_v^{(i)} = \text{Dimension of visible layer of RBM trained for layer }i,\\
d_i = \text{Input of RBM trained for layer i},\\
a_{i-1} = \text{Activations of the }(i-1)\text{th layer of autoencoder},
\end{gather*}
\indent 2. Initialize parameters of the current layer
\begin{gather*}
W_i = W_{RBM},\\
b_i = b^h_{RBM},\\
a_i = a_{RBM}.
\end{gather*}
\indent The parameters of trained RBM are used to initialize the parameters of the layer.\\
end for.\\
\\
for $i = N/2+1\text{ to }N$:\\
\indent Initialize parameters \begin{gather*}
W_i = W_{N - i}^{T},\\
b_i = b_{N-i}.
\end{gather*}
end for.\\
\\
III. Fine Tuning:\\
Backpropagation with Mean Squared Error. The error is computed based on the reconstruction and the training data.
\subsection{Fine tuning of the Autoencoder}
Fine tuning of Autoencoder uses backpropagation, which is:\\
\\
I. Perform a forward propagation through all layers that computes layer inputs $\{z^{(1)},..., z^{(N)}\}$ and activations $\{a^{(1)},..., a^{(N)}\}$. $a^{(i)}$ is a row vector representing the activation of layer $i$. \\
\\
II. For the last layer, compute $\delta_i^{(N)}$ as
\begin{equation}
\delta_i^{(N)} = \frac{\partial L}{\partial z^{(N)}_i}
\end{equation}
where $L$ is the reconstruction error. This step computes a row vector $\delta^{(N)}$. \\
\\
III. For $l$ = $N-1, ..., 1$, compute
\begin{align}
\delta^{(l)} = \left(\delta^{(l+1)} ~ (W^{(l)})^T \right) \bullet g'(z^{(l)})
\end{align}
where $g$ is the activation function and here $g'$ is performed in an element-wise fashion.\\
\\
IV. Compute the gradients in each layer. For $l$ = $N, ..., 1$, compute
\begin{align}
\nabla_{W^{(l)}} L &= (a^{(l-1)})^T~\delta^{(l)}, \\
\nabla_{b^{(l)}} L &= \delta^{(l)}.
\end{align}
where $a^{(0)}$ is the input data of the autoencoder.\\
\\
V. Update the weights and biases of each layer with gradient descent.\\
\\
The reconstruction error of Autoencodr is \begin{equation}
L = \frac{1}{2}\sum_{i=1}^{n_N}(a^{(N)}_i - a^{(0)}_i)^2
\end{equation}
where \begin{gather*}
n_{N} = \text{Dimension of the output/reconstruction},\\
a^{(N)}_{i} = \text{Activation of the }i\text{th unit in the output layer},\\
a^{(0)}_{i} = \text{Activation of the }i\text{th unit in the visible layer}.
\end{gather*}
Backpropagation involves computing $\{\delta^{(i)}\}$, which is based on the derivatives of activation function and error function. Here is how to compute these two values:\\
\\
For sigmoid activation:
\begin{equation}
g'(t) = \frac{\partial{(1+e^{-t})^{-1}}}{\partial{t}} = \frac{1}{1+e^{-t}}\frac{e^{-t}}{1+e^{-t}}.
\end{equation}
That is to say\begin{equation}
g'(z_i) = \frac{1}{1+e^{-z_i}}(1-\frac{1}{1+e^{-z_i}})=a_i(1-a_i).
\end{equation}
For $\delta_i^{(N)}$, by chain rule,\begin{equation}
\delta_i^{(N)} = \frac{\partial L}{\partial z^{(N)}_i}=\sum_{p=1}^{n_N} \frac{\partial L}{\partial a^{(N)}_p} \frac{\partial a^{(N)}_p}{\partial z^{(N)}_i} = \frac{\partial L}{\partial a^{(N)}_i} \frac{\partial a^{(N)}_i}{\partial z^{(N)}_i} = (a^{(N)}_i-a^{(0)}_i)\times a^{(N)}_i(1-a^{(N)}_i).
\end{equation}
\subsection{Denoising Autoencoder}
The Denoising Autoencoder reconstructs the corrupted data, and could predict missing values. By adding noises to corrupt the training data, we could transform the Autoencoders to the Denoising Autoencoders. Here is how to make this transformation:\\
\\
Firstly a denoise rate $r$ is chosen, and the mask is made as follows:\begin{equation}
m_i=\begin{cases}
1,~~~~\text{if }U_i > r\\
0,~~~~\text{otherwise}\\
\end{cases}
~~1\leq i\leq n_N\\
\end{equation}
where $U_i$ is the $i$th sample from standard uniform distribution, $n_N$ is the size of the last layer, which is also the dimension of input data.\\
\\
Secondly compute the corrupted input data\begin{equation}
a^{(c)} = a^{(0)}\cdot m = \sum_{i=1}^{n_N} a^{(0)}_im_i
\end{equation}\\
\\
Finally use $a^{(c)}$ as the training data to compute the reconstruction and still use the uncorrupted data $a^{(0)}$ as labels in fine tuning. In reconstruction, fine tuning makes more improvements in the Denoising Autoencoder than in the Autoencoder, and is crucial to the Denoising Autoencoder.
\subsection{Implementation of the Denoising Autoencoder}
The implementation of DAE is in the header file autoencoder.hpp.\\
\\
I. void \textbf{addLayer}(RBMlayer $\&$l)\\
Add a layer to current DAE. This object of class RBMlayer should store information of layer size, weight, bias, etc. It could also be modified after added to DAE.\\
\\
II. void \textbf{setLayer}(std::vector$<$size$\_$t$>$ rbmSize)\\
Object of class AutoEncoder could automatically initialize random weights and biases of each layer by inputting a vector of layer sizes.\\
\\
III. void \textbf{train}(dataInBatch $\&$trainingData, size$\_$t rbmEpoch, LossType l = MSE, ActivationType a = sigmoid$\_$t)\\
This method trains all the layers without classifier. The structure of this AutoEncoder object should be initialized before calling this method. \\
\\
IV. void \textbf{reconstruct}(dataInBatch $\&$testingData)\\
This method gives the reconstruction of testingData. It should be called only after the model has been trained.\\
\\
V. dataInBatch \textbf{g$\_$reconstruction}()\\
Get the reconstruction.\\
\\
VI. void \textbf{fineTuning}(dataInBatch $\&$originSet, dataInBatch $\&$inputSet, LossType l)\\
Use backpropagation. Unlike DBN, argument LossType should be MSE instead of CrossEntropy.\\
\\
VI. void \textbf{denoise}(double dr)\\
Set the denoise rate as dr. When model is in training, it will detect if denoise rate is set. So if this method is called before training, the Denoising Autoencoder will be trained automatically. Otherwise the Autoencoder will be trained.
\subsection{Summary}
In pretraining, parameters of half of the layers are acquired by stacking RBMs. The parameters of the other half are given by the symmetric architecture. Fine tuning is crucial to the Denoising Autoencoder because it uses uncorrupted data to modify the model trained with corrupted data. The performance of the Denoising Autoencoder is straightforward to assess because one could observe the reconstructed images.
\section{Deep Boltzmann Machine}
\subsection{Logic of the Deep Boltzmann Machine}
\begin{figure}[h]
\centering
\includegraphics[height=2.8in]{DBM.png}
\caption{Deep Boltzmann Machine} \label{fig:side:a}
\end{figure}
A Deep Boltzmann Machine(DBM) \cite{salakhutdinov2009deep} is a Markov Random Field with multiple layers. Connections exist only between adjacent layers. Intuitively, it could incorporate top-down feedback when computing bottom-up approximations. Figure 7.1 shows a DBM.\\
\\
The energy function of a Deep Boltzmann Machine with $N$ hidden layers is\begin{equation}
E(v, h^{(1)},..h^{(N)})=-v^{T}W^{(1)}h^{(1)} -(h^{(1)})^TW^{(2)}h^{(2)}-...- (h^{(N-1)})^TW^{(N)}h^{(N)}
\end{equation}
where $W^{(i)}$ is the weight from the previous layer to the $i$th hidden layer.\\
\\
A Deep Boltzmann Machine maximizes the likelihood of the input data. The gradient of its log likelihood is \begin{equation}
\frac{\partial \log P(v)}{\partial W^{(i)}} = \langle h^{(i-1)}(h^{(i)})^T\rangle_{data} - \langle h^{(i-1)}(h^{(i)})^T\rangle_{model}.
\end{equation}
\subsection{Pretraining of the Deep Boltzmann Machine}
Because the Deep Boltzmann Machine is an undirected model, the last hidden layer receives input from the previous adjacent layer, and the other hidden layers receive inputs from both directions. So when training Restricted Boltzmann Machines, the weights and biases need to be adjusted for better approximations. The pretraining process is as follows:\\
\\
I. Set the architecture of the model, specifically the size of each layer, \(n_0, n_1, n_2, ..., n_N\). $n_0$ is the dimension of the training data.\\
\\
II. Pretrain the first hidden layer:\\
Train an RBM, in which the weight from the visible layer $v$ to the hidden layer $h_1$ is $2W_1$ and the weight from $h_1$ to $v$ is $W_1^{T}$. $W_1$ is the weight of the first DBM hidden layer.\\
\\
III. Pretrain intermediate hidden layers:\\
for $i = 2\text{ to }N - 1$:\\
\indent 1. Train an RBM with the following settings:\\
\begin{gather*}
n_h^{(i)}=n_i\\
n_v^{(i)}=n_{i-1}\\
d_i=a_{i-1}\\
\end{gather*}
\indent where
\begin{gather*}
n_h^{(i)} = \text{Dimension of hidden layer of RBM trained for layer }i,\\
n_v^{(i)} = \text{Dimension of visible layer of RBM trained for layer }i,\\
d_i = \text{Input of RBM trained for layer i},\\
a_{i-1} = \text{Activation of the }(i-1)\text{th layer}.
\end{gather*}
\indent 2. Set \begin{gather*}
W_i = W_{RBM} / 2,\\
b_i = b^h_{RBM} / 2,\\
a_i = a_{RBM}.
\end{gather*}
\indent Weights and biases are adjusted here for better approximations.\\
\\
IV. Pretrain the last hidden layer:\\
Train an RBM, in which the weight from the hidden layer $h_{N-1}$ to the hidden layer $h_N$ is $W_N$ and the weight from $h_{N}$ to $h_{N-1}$ is $2W_N^{T}$. $W_N$ is the weight of the last hidden layer of DBM.
\subsection{Mean Field Inference}
The mean field inference \cite{salakhutdinov2010efficient
} of the Deep Boltzmann Machine involves iterative updates of the approximations $Q$. It is performed after pretraining. The algorithm is as follows:\\
\\
\noindent \textbf{Algorithm} Mean Field Inference\\
Initialize $M$ samples $\{\tilde{v}_{0,1},\tilde{h}_{0,1}\}$,...,$\{\tilde{v}_{0,M},\tilde{h}_{0,M}\}$with the pretrained model. Each sample consists of states of the visible layer and all the hidden layers.\\
\noindent \textbf{for} $t = 0$ to $T$ (number of iterations) \textbf{do}\\
\indent 1. \textbf{Variational Inference:}\\
\indent \textbf{for} each data sample \textbf{v}$_n,n=1$ to $D$ \textbf{do}\\
\indent\indent Perform a bottom-up pass with
\begin{gather*}
\nu_j^1 = \sigma\Big( \sum_{i=1}^{n_0} 2W_{ij}^1v_i \Big),\\
\nu_k^2 = \sigma\Big( \sum_{j=1}^{n_1} 2W_{jk}^2\nu_j^1\Big),\\
\cdots\\
\nu_p^{N-1} = \sigma\Big( \sum_{l=1}^{n_{N-2}} 2W_{lp}^{N-1}\nu_l^{N-2} \Big),\\
\nu_q^{N} = \sigma\Big( \sum_{p=1}^{n_{N-1}} W_{pq}^{N}\nu_p^{N-1} \Big),
\end{gather*}
\indent\indent where $\{W_{ij}\}$ is the set of pretrained weights.\\
\indent\indent Set $\mathbold{\mu}=\mathbold{\nu}$ and run the mean-field updates with:
\begin{gather*}
\mu_j^1 \leftarrow \sigma\Big(\sum_{i=1}^{n_0} W_{ij}^1v_i + \sum_{k=1}^{n_2}W_{jk}^2\mu_k^2 \Big),\\
\cdots\\
\mu_j^{N-1} \leftarrow \sigma\Big(\sum_{i=1}^{n_{N-2}} W_{ij}^{N-1}\mu_i^{N-2} + \sum_{k=1}^{n_N}W_{jk}^N\mu_k^N \Big),\\
\mu_j^{N} \leftarrow \sigma\Big(\sum_{i=1}^{n_{N-1}} W_{ij}^{N}\mu_i^{N-1} \Big).
\end{gather*}
\indent\indent Set $\mathbold{\mu}_n = \mathbold{\mu}$. \par
\textbf{end for}\\
\\
\indent 2. \textbf{Stochastic Approximation:}\\
\indent \textbf{for} each sample $m=1$ to $M$ \textbf{do}\par
\indent\indent Running one step Gibbs sampling. Get $(\tilde{v}_{t+1,m},\tilde{h}_{t+1,m})$ from $(\tilde{v}_{t,m},\tilde{h}_{t,m})$\\
\textbf{end for}\\
\\
\indent 3. Parameter Update:\\
\indent $W^1_{t+1} = W^1_t + \alpha_t\Big(\frac{1}{D}\sum_{n=1}^D \mathbf{v}_n(\mathbold{\mu}_n^1)^T- \frac{1}{M}\sum_{m=1}^M \tilde{\mathbf{v}}_{t+1,m}(\tilde{\mathbf{h}}_{t+1,m}^1)^T\Big)$\\
\indent $W^2_{t+1} = W^2_t + \alpha_t\Big(\frac{1}{D}\sum_{n=1}^D \mathbold{\mu}_n^1(\mathbold{\mu}_n^2)^T- \frac{1}{M}\sum_{m=1}^M \tilde{\mathbf{h}}_{t+1,m}^1(\tilde{\mathbf{h}}_{t+1,m}^2)^T\Big)$\\
\indent$\cdots$ \\
\indent $W^{n_N}_{t+1} = W^{n_N}_t + \alpha_t\Big(\frac{1}{D}\sum_{n=1}^D \mathbold{\mu}_n^{n_{N-1}}(\mathbold{\mu}_n^{n_N})^T- \frac{1}{M}\sum_{m=1}^M \tilde{\mathbf{h}}_{t+1,m}^{n_{N-1}}(\tilde{\mathbf{h}}_{t+1,m}^{n_N})^T\Big)$\\
\indent Decrease $\alpha_t$.\\
\noindent \textbf{end for}\\
\\
To facilitate computation, $M$ may be chosen as the number of batches.\\
\subsection{Implementation of the Deep Boltzmann Machine}
The implementation of DBM is in the header file dbm.hpp.\\
\\
I. void \textbf{addLayer}(RBMlayer $\&$l)\\
Add a layer to current DBM. This object of class RBMlayer should store information of layer size, weight, bias, etc. It could also be modified after added to DBM.\\
\\
II. void \textbf{setLayer}(std::vector$<$size$\_$t$>$ rbmSize)\\
Object of class DBM could automatically initialize random weights and biases of each layer by inputting a vector of layer sizes.\\
\\
III. void \textbf{train}(dataInBatch $\&$Data, dataInBatch $\&$label, size$\_$t rbmEpoch, LossType l = MSE, ActivationType a = sigmoid$\_$t)\\
This method trains DBM as classifier.\\
\\
IV. void \textbf{fineTuning}(dataInBatch $\&$data, dataInBatch $\&$label)\\
Fine tuning with mean field inference.\\
\\
V. void \textbf{classify}(dataInBatch $\&$data, dataInBatch $\&$label)\\
Classify the data with DBM. Tesing label is used to compute classification error rate.
\subsection{Summary}
In DBM, each layer receives input from all its adjacent layers. Its training is more complicated than other models.
\section{Multimodal Learning Model}
\begin{figure*}[!t]
\centering
\subfigure[Bimodal Deep Belief Network] {\includegraphics[height=1.2in]{modalPrediction1.png}}
\subfigure[Modal Reconstruction Network] {\includegraphics[height=1.8in]{modalPrediction2.png}}
\caption{Modal Prediction}
\label{fig5}
\end{figure*}
\begin{figure}[h]
\centering
\includegraphics[height=2.2in]{DBMmodals.png}
\caption{MRF Multimodal Learning Model} \label{fig:side:a}
\end{figure}
It is possible to make a low-dimension representation of two modals by building a Bimodal Deep Belief Network \cite{ngiam2011multimodal} as in Figure 8.2(a), in which blue nodes represent data from one modal and green nodes represent data from the other modal. In this process, the recognition weights that are used in bottom-up computation and the generative weights that are used in top-down pass should be learned. If the model is trained with tied weights, half of the memory space could be saved since transposing the weight matrix would transform recognition weights to generative weights. The weights of this model could be used to reconstruct data of two modals as in Figure 8.2(b).\\
\\
Another option is to build a Markov Random Field multimodal learning model \cite{srivastava2012multimodal} by combining two Deep Boltzmann Machines. Figure 8.3 shows such a model. This model is built by first building two DBMs, of which each is trained on data of one modal, then training an RBM on top of these two DBMs.\\
\\
Prediction of data from one modal given data from the other modal could be done by first training a Bimodal Autoencoder in Figure 8.4(a) and then using the modal prediction network in Figure(b) to predict data from two modals. Bimodal Autoencoder should be trained using training data with noises so that it could better predict missing values.
\begin{figure*}[!t]
\centering
\subfigure[Bimodal Autoencoder] {\includegraphics[height=1.8in]{aemodal.png}}
\subfigure[Modal Prediction Network] {\includegraphics[height=1.8in]{prediction.png}}
\caption{Modal Prediction}
\label{fig5}
\end{figure*}
\section{Library Structure}
\subsection{Data Reading}
\subsubsection{MNIST}
MNIST \cite{lecun1998gradient} is a selected set of samples from NIST data set. It has one training data set, one training label set, one testing data set, and one testing label set. The training set has 60,000 samples and the testing set has 10,000 samples. Each sample data is a 28$\times$28 grey image which is a handwritten integer between 0 and 9. It has 10 classes, so the label is between 0 (inclusive) and 9 (inclusive).\\
\\
The data is stored in big-endian format. The content of data should be read as unsigned characters. Header file readMNIST.hpp provides functions to read this data set.\\
\\
I. cv::Mat \textbf{imread$\_$mnist$\_$image}(const char* path)\\
Read data of MNIST. Each row is a sample.\\
\\
II. cv::Mat \textbf{imread$\_$mnist$\_$label}(const char* path)\\
Read labels of MNIST. Each row is a number indicating the class of that sample.
\subsubsection{CIFAR}
The CIFAR-10 data set \cite{krizhevsky2009learning} consists of 60000 32x32 colour images in 10 classes, with 6000 images per class. There are 5 batches of training images and 1 batch of test images, and each consists of 10000 images.\\
\\
In CIFAR-10 data set, each sample consists of a number indicating its class and the values of the image pixels. The following function in the header file readCIFAR.hpp reads them to four OpenCV matrices:\\
\\
void \textbf{imread$\_$cifar}(Mat $\&$trainingData, Mat $\&$trainingLabel, Mat $\&$testingData, Mat $\&$testingLabel)\\
\\
Each row of the read OpenCV matrices consists of the label and the data of a sample.
\subsubsection{AvLetters}
AvLetters \cite{matthews2002extraction} is the data set recording audio data and video data of different people uttering letters. The dimension of the audio data is 26 and the dimension of the video data is 60$\times$80. The data is stored in single-precision big-endian format. Each file is the data of a person uttering a certain letter. For instance, the file A1$\_$Anya.mfcc contains the audio data of the person named Anya uttering letter "A". \\
\\
The following function in the header file readAvLetters.hpp reads audio data:\\
\\
cv::Mat \textbf{imread$\_$avletters$\_$mfcc}(const char* path)\\
\\
The output is an OpenCV matrix, of which each row contains data of a sample. The original video data is in MATLAB file format. The header file readMat.hpp contains the function\\
\\
cv::Mat \textbf{matRead}(const char* fileName, const char* variableName, const char* saveName).\\
\\
It reads the mat file and at the same time saves it as binary file named as the argument "saveName". This header file uses the MATLAB/c++ interface provided by MATLAB and requires an environment setting, which is contained as comments in the header file. There are some problems running the libraries in this interface together with OpenCV. It would be better to transform all MATLAB files to binary files before training models and then read the transformed binary files. The header file readDat.hpp provides the function to read the transformed binary files:\\
\\
cv::Mat \textbf{readBinary}(const char* file, int rowSize, int colSize)\\
\\
The output is an OpenCV matrix, of which each row contains data of a sample.
\subsubsection{Data Processing}
Header file processData.hpp stores functions processing data.\\
\\
data \textbf{oneOfK}(indexLabel l, int labelDim)\\
Transfer index label to one-of-k expression.\\
\\
dataInBatch \textbf{corruptImage}(dataInBatch input, double denoiseRate)\\
Give corrupted data in batches.\\
\\
std::vector$<$dataInBatch$>$ \textbf{dataProcess}(dataCollection$\&$ reading, int numBatch)\\
Build data batches.\\
\\
dataCollection \textbf{shuffleByRow}(dataCollection$\&$ m)\\
Shuffle the data\\
\\
cv::Mat \textbf{denoiseMask}(size$\_$t rowSize, size$\_$t colSize, double rate)\\
Generate a mask to corrupt data
\subsection{Computation and Utilities}
\textbf{activation.hpp} includes multiple activation functions, such as sigmoid, tanh, relu, leaky$\_$relu, softmax. Each activation function is paired with a function that computes its derivatives to facilitate computation in backpropagation.\\
\\
\textbf{gd.hpp} includes functions for adaptive gradient descent and stochastic gradient descent, as well as a function to anneal the learning rate in which three types of annealing methods are provided.\\
\\
\textbf{inference.hpp} includes the mean field inference implementation used by DBM.\\
\\
\textbf{loss.hpp} includes computation of loss functions. MSE, absolute loss, cross entropy, and binary loss are provided together with the functions to compute their derivatives.\\
\\
\textbf{matrix.hpp} includes some OpenCV matrix manipulation functions.\\
\\
\textbf{loadData.hpp} contains functions to test data loading by visualization.\\
\\
\textbf{visualization.hpp} contains functions of visualization.\\
\subsection{Modules}
Table 1 shows the files that contain modules.
\begin{table}[h]
\centering
\begin{tabular}{|c|c|c|c|c|c|}
\hline
Model & RBM & DNN & DBN & DAE/AE & DBM\\
\hline
Header(.hpp) & rbm &dnn & dbn & autoencoder & dbm\\
\hline
Main(.cpp) & runRBM & runDNN & runDBN & runDAE &runDBM\\
\hline
\end{tabular}
\caption{Files that contain modules}
\end{table}
\section{Performance}
\subsection{Restricted Boltzmann Machine}
Run runRBM.cpp to test the Restricted Boltzmann Machine module. It performs classification on MNIST data set, which has 60,000 training samples and 10,000 testing samples. The hidden layer has 500 units. The classification error rate is 0.0707 (Classification accuracy 92.93$\%$). Multiple deep learning libraries give similar results.
\subsection{Deep Neural Network}
Run runDNN.cpp to test the Deep Neural Network module. It performs classification on MNIST using a DNN with layers of size $(28\times 28)$-500-300-200-10. Without fine tuning, the classification error rate is 0.093 (Classification accuracy 90.7$\%$). With fine tuning, the classification error rate is 0.0288 (Classification accuracy 97.12$\%$). Hinton, Salakhutdinov (2006) claim that DNN with layers of size $(28\times 28)$-500-500-2000-10 could achieve the error rate of 1.2 $\%$. For comparison, a DNN with the same architecture was built and the error rate could achieve $0.0182$. The source codes of the paper use Conjugate Gradient, which is not implemented in MDL. Also, learning is much more sensitive to the learning rate in the $(28\times 28)$-500-500-2000-10 architecture than in the $(28\times 28)$-500-300-200-10 architecture. So finding a better learning rate may also improve the performance.
\subsection{Denoising Autoencoder}
Run runDAE.cpp to test the Denoisinig Autoencoder module. It performs reconstruction of MNIST using a Denoising Autoencoder and an Autoencoder, each with layers of size $(28\times 28)$-500-300-500-$(28\times 28)$. Figure 10.1(a) contains the testing data with noises and the reconstruction given by the Denoising Autoencoder. Figure 10.1(b) contains the testing data without noises and the reconstruction given by the Autoencoder.\\
\\
Fine tuninig reduces more reconstruction error in the Denoising Autoencoder than in the Autoencoder. The reconstruction MSE of the Denoising Autoencoder are: Average error without fine tuning is 6686.69; Average error after fine tuning is 3256.34. The reconstruction MSE of the Autoencoder are: Average error without fine tuning is 4463.24; Average error after fine tuning is 3182.69. With sufficient fine tuning, the reconstruction given by the Denoising Autoencoder is similar to the reconstruction given by the Autoencoder. The visualization is comparable to the published results.\\
\begin{figure*}[!t]
\centering
\subfigure[Denoising Autoencoder] {\includegraphics[height=3.5in]{ae3.png}}
\subfigure[Autoencoder] {\includegraphics[height=3.5in]{ae2.png}}
\caption{Reconstruction of DAE and AE on MNIST}
\label{fig5}
\end{figure*}
\begin{figure}[h]
\centering
\includegraphics[height=1.3in]{avletterRec.png}
\caption{Denoising Avletter audio data} \label{fig:side:a}
\end{figure}
Run runDAE$\_$letter.cpp to test the Denoising Autoencoder module with AvLetters data set. Training data consists of the audio data of a person pronouncing the letter ``A" to the letter ``G". Testing data consists of the audio data of the person pronouncing ``H" and ``I". Figure 10.2 shows the result of denosing the testing data.
\subsection{Deep Belief Network}
Run runDBN.cpp to test the Deep Belief Network module. It performs classification on MNIST using DBN with layers of size $(28\times 28)$-500-300-10. The classification error rate on MNIST without fine tuning is 0.0883 (Classification accuracy 91.17$\%$). With the fine tuning using Up-down algorithm, the classification error rate could be reduced to 0.0695 (Classification accuracy 93.05$\%$). Hinton, Osindero $\&$ Teh, (2006) claim that the classification error rate could be as low as 1.25$\%$. Factors such as learning rate decay and gradient descent method could affect the result.
\subsection{Deep Boltzmann Machine}
Run runDBM.cpp to test the Deep Boltzmann Machine module. It performs classification on MNIST using DBM with layers of size $(28\times 28)$-500-500-10. The classification error rate on MNIST without fine tuning is 0.0937 (Classification accuracy 90.63$\%$). Mean Field inference improves the accuracy to 93.47$\%$. Salakhutdinov, Hinton (2009) claim that the classification error rate could be as low as 0.95$\%$. Its source codes use Conjugate Gradient optimization, which is not implemented in this library. This possibly causes the difference.
\subsection{Modal Prediction}
Run modal$\_$prediction.cpp to test the bimodal autoencoder module on AvLetters data set. The training data is the audio and the video data of the letters ``A" to ``G". The audio data of the letters ``H" and ``I" is used to predict the video data of the letters ``H" and ``I". The reconstruction error rate is 10.46$\%$.
\addcontentsline{toc}{section}{References}
\nocite{*}
\bibliographystyle{plain}
| {'timestamp': '2016-04-13T02:13:53', 'yymm': '1512', 'arxiv_id': '1512.06927', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06927'} | arxiv |
\section{Introduction}
Owing to the popularity of smart mobile devices, the mobile data traffic is growing rapidly. Meanwhile, the provision of the types of wireless services is also experiencing a fundamental shift from the traditional connection-centric communications, such as phone calls, e-mails, and web browsing, to the emerging content-centric communications, such as video streaming, push media, mobile applications download/updates, and mobile TV \cite{Cisco2015}. A central feature of these emerging services is that a same copy of content may be needed by multiple mobile users, referred to as \emph{content diversity} \cite{LiuHui-WCM14} or \emph{content reuse} \cite{Femtocaching-mag13}. Two enabling techniques to exploit such content diversity are multicasting and caching. Compared with point-to-point unicast transmission, point-to-multipoint multicast transmission provides an efficient capacity-offloading approach for common content delivery to multiple subscribers on a same resource block\cite{eMBMS, multicast06}. Caching, on the other hand, brings contents closer to users by pre-fetching the contents during the off-peak time and hence can greatly reduce the network congestion and improve the user-perceived experience \cite{Femtocaching-mag13, content_caching, proactive_caching}. In this paper, we propose a content-centric transmission design based on cloud radio access network (cloud RAN) architectures for efficient content delivery by integrating both multicasting and caching.
Cloud RAN is a promising network architecture to boost network capacity and energy efficiency \cite{CRAN_mag}. In a cloud RAN, the base stations (BSs) are all connected to a central processor (CP) via digital backhaul links, thus enabling joint data processing and precoding across multiple BSs \cite{cooperative_jsac}. However, performing full joint processing requires not only signalling overhead but also payload data sharing among all the BSs, resulting in tremendous burden on backhaul links.
To alleviate the backhaul capacity requirement in cloud RAN architecture, one way is to associate each user with a cluster of BSs so that each user is cooperatively served by the given cluster of BSs through joint precoding. With BS clustering, each user's data only needs to be distributed to its serving BSs from CP rather than all the BSs, thus the overall backhaul load can be greatly reduced. Dynamic BS clustering and the associated sparse beamforming have been developed in \cite{ZQLuo_jsac, Tony_trans, WeiYu_globecom, WeiYu_access, smooth_trans, JunZhang_trans}.
These previous works present a user-centric view on the BS clustering and beamforming, regardless of the content diversity. In practice, however, the mobile users normally send requests in a non-uniform manner, following certain content popularity distribution, e.g., the Zipf distribution \cite{zipf_distribution}. Popular contents are likely to be requested by multiple users.
To exploit such content popularity, we propose a content-centric BS clustering and multicast beamforming in this paper. We first group all the scheduled users according to their requested contents. In specific, the users who request a same content form one group. Then we use multicast transmission to deliver each requested content to the corresponding user group. The users from the same multicast group receive a common content sent by a cluster of BSs. The BS clustering is designed with respect to each requested content. The BS clusters for different contents may overlap. Compared with traditional unicast transmission in user-centric BS clustering, multicast transmission in the considered content-centric BS clustering can improve energy and spectral efficiency, thus providing efficient content delivery in wireless networks.
In addition to multicasting, we incorporate caching in the considered cloud RAN architecture to facilitate content-centric communications. Wireless caching has been recently proposed as a promising way of reducing peak traffic and backhaul load, especially for video content delivery. Due to the content reuse feature of video streaming, i.e., many users are likely to request the same video content, caching some of the popular contents at the local BSs during the off-peak time \cite{Femtocaching_trans} or pushing them at user devices directly through broadcasting \cite{wang-chen-liu14, CoMPcloud_SCVT15} can help improve the network throughput and user-perceived quality of experience.
In the considered cache-enabled cloud RAN, each BS is equipped with a local cache. If the content requested by a user group is already cached in its serving BS, the serving BS will transmit the content directly. Otherwise, the serving BS needs to fetch the content via the backhaul links from the CP. Compared with non-cache cooperative networks, cache-enabled cloud RAN can fundamentally reduce the backhaul cost and support more flexible BS clustering. A similar wireless caching network has been considered in \cite{JunZhang_pimrc}, but it is based on a user-centric transmission design.
In this paper, we investigate the joint design of content-centric BS clustering and multicast beamforming in the considered cache-enabled cloud RAN to improve the network performance as well as to reduce backhaul cost. There are two important issues to address in this paper. The first one is \textbf{how to optimize the content-centric BS clustering}.
In the traditional user-centric BS clustering without cache \cite{WeiYu_access, JunZhang_trans}, each user is most likely to be served by a cluster of BSs which are nearby and have good channel conditions. While in the proposed content-centric BS clustering, there are multiple users receiving a same content. Since the users are geographically separated from each other, the BS clustering becomes more involved. Moreover, after introducing cache at each BS, the BS clustering needs to be adaptive to the caching state as well. Therefore, the BS clustering in the considered network must be both channel-aware and cache-aware.
To address this issue, we formulate an optimization problem with the objective of minimizing the total network cost subject to the quality-of-service (QoS) constraint for each muticast group. The total network cost is modeled by the weighted sum of backhaul cost and transmit power cost, where the backhaul cost is counted by the accumulated data rate transferred from the CP to all the BSs through the backhaul links. This problem is a mixed-integer nonlinear programming (MINLP) problem. Through theoretical analysis, we show that all the BSs which cache the content requested by a multicast group can be included in the BS cluster of this content without loss of optimality, regardless of their channel conditions. This finding can be used to reduce the search space for the global optimal solution of the joint content-centric BS clustering and multicast beamforming problem.
To make the problem more tractable, we reformulate an equivalent sparse multicast beamforming design problem. Solving the equivalent problem is, however, still challenging due to both the nonconvex QoS constraints and the nonconvex discontinuous $\ell_0$-norm in the objective. In sparse signal processing, one approach to handle the $\ell_0$-norm minimization problem is to approximate the $\ell_0$-norm with its weighted $\ell_1$-norm \cite{Boyd_reweighted_l1} and update the weighting factors iteratively. Another approach is to approximate the $\ell_0$-norm with smooth functions \cite{smooth_trans}, where the authors use Gaussian family functions. The smooth function method is a better approximation to the $\ell_0$-norm but its performance highly depends on the smoothness factor. In this paper, we adopt the smoothed $\ell_0$-norm approximation and compare the performance of three smooth functions: logarithmic function, exponential function, and arctangent function. The approximated problem is then transformed into the difference of convex (DC) programming problems. Two specific forms of DC programming are obtained. One has DC objective and convex constraints by using semi-definite relaxation (SDR) approach, and the other is a general one with DC forms in both objective and constraints. The convex-concave procedure (CCP) \cite{yuille2003cccp, smola2005kernel, lipp2014variations} based algorithms are then proposed to find effective solutions of the original problem.
Note that the proposed CCP-based algorithms can also be used to solve the traditional multi-group multicast beamforming problems formulated in \cite{Luo_MultlGroup_multicast}.
The second issue is \textbf{how would different caching strategies affect the overall performance of the cache-enabled cloud RAN}. In order to increase cache hit rate, i.e., the probability that a requested content can be accessed at the local cache of its delivering BSs, caching strategies should be designed carefully. It is noted in \cite{molisch2014caching} that when BSs are sparsely deployed such that each user can only be connected to one BS, each BS should cache the most popular contents, otherwise when BSs are densely deployed such that each user can be served by multiple BSs, the optimal caching strategy is highly complex.
Notice that the cache placement and content delivery phases happen on different timescales: cache placement in general is in a much larger timescale (e.g., on a daily or hourly basis) while content delivery is in a much shorter timescale \cite{Femtocaching_trans, molisch2014caching}.
In \cite{Mixed-timescale}, the authors studied the mixed-timescale precoding and cache control in MIMO interference network. But the caching strategy in each transmitter is the same. In addition, the precoding is limited to two modes only, i.e., each user is either served by all the BSs simultaneously or served by one of the BSs only.
In this work, although the content placement is assumed to be given in the formulated content-centric sparse multicast beamforming problem, we shall briefly address the caching strategy problem through simulation. We consider three heuristic caching strategies, popularity-aware caching, probabilistic caching, and random caching. Numerical results have demonstrated interesting insights into the performance of these caching strategies together with the proposed sparse beamforming algorithms.
The rest of the paper is organized as follows. Section \ref{section:Network Model} introduces the network model and assumptions. Section \ref{section:Problem Formulation and Analysis} provides the formulations of content-centric BS clustering and multicast beamforming problem and the equivalent sparse beamforming problem. The CCP based algorithms are presented in Section \ref{section:CCP based Algorithm Design}. Comprehensive simulation results are provided in Section \ref{section:Simulation Results}. Finally, we conclude the paper in Section \ref{section:Conclusion}.
\emph{Notations}: Boldface lower-case and upper-case letters denote vectors and matrices respectively. Calligraphy letters denotes sets. $\mathbb{R}$ and $\mathbb{C}$ denote the real and complex domains, respectively. $\mathbb{E}(\cdot)$ denotes the expectation of a random variable. $\mathcal{CN}(\mu,\sigma^2)$ represents a complex Gaussian distribution with mean $\mu$ and variance $\sigma^2$. The conjugate transpose and $\ell_p$-norm of a vector are denoted as $(\cdot)^H$ and $\lVert \cdot \rVert_p$ respectively. $\mathbf{1}_M$ and $\mathbf{0}_M$ denote the $M$-long all-ones and $M$-long all-zeros vectors respectively. The inner product between matrices $\mathbf{X}$ and $\mathbf{Y}$ is defined as $\left\langle \mathbf{X}, \mathbf{Y}\right\rangle = \text{Tr}(\mathbf{X}^H\mathbf{Y})$. For a square matrix $\mathbf{S}_{M \times M}$, $\mathbf{S}\succeq \mathbf{0}$ means that $\mathbf{S}$ is positive semi-definite. The real part of a complex number $x$ is denoted by $\mathfrak{R}\{x\}$.
\section{Network Model and Assumptions} \label{section:Network Model}
\subsection{System Model}
Consider the downlink transmission of a cache-enabled cloud RAN with $N$ multiple-antenna BSs and $K$ single-antenna mobile users. Each BS is connected to the CP via a limited-capacity backhaul link. The CP can access a database that contains a total number of $F$ contents with equal size. Let ${\cal N}=\{1, 2, \ldots, N\}$ denote the set of BSs, where each BS is equipped with $L$ transmit antennas and has a local cache with finite storage size. At the beginning of a transmission time interval, each user submits a content request according to certain demand probabilities. Users requesting the same content are grouped together and served using multicast transmission. The transmission time interval is assumed to contain enough number of transmission frames for the system to complete the content delivery. Let the total number of multicast groups be denoted as $M$ ($1\le M \le \min\{K, F\})$ and the set of users in each group $m$ be denoted as $\mathcal{G}_m$, for $m=1, \ldots, M$. We assume that each user can request at most one content at a time, thus we have $\mathcal{G}_i \bigcup \mathcal{G}_j = \emptyset, i \neq j $ and $\sum_{m=1}^M \lvert \mathcal{G}_m \rvert \le K$.
We consider the dynamic content-centric BS clustering and multicast beamforming on a transmission frame basis. The channel remains constant within each transmission frame but varies from one frame to another.
Each multicast group $m$ is served by a cluster of BSs cooperatively during each frame, denoted as $\mathcal{Q}_m$, where $\mathcal{Q}_m \subseteq \mathcal{N}$ and they may overlap with each other. Each BS in a cluster acquires the requested contents either from its local cache or from the database in the CP through the backhaul. During each transmission frame, the BS clusters $\{\mathcal{Q}_m \}_{m=1}^M$ are dynamically optimized by the CP.
An example is shown in Fig.~\ref{fig:systemmodel}, where three mutlicast groups are formed and the instantaneous BS clusters serving the three groups are $\mathcal{Q}_1 = \{ 1,2 \}$, $\mathcal{Q}_2 = \{ 2 \}$, and $\mathcal{Q}_3 = \{ 1,2,3 \}$, respectively.
Define a binary BS clustering matrix $\mathbf{S} \in \{0,1\}^{M \times N} $, where $s_{m,n} = 1$ indicates that the $n$-th BS belongs to the serving cluster for the $m$-th multicast group and 0 otherwise. That is, $s_{m,n} = 1$ if $n \in \mathcal{Q}_m$ and $s_{m,n} = 0$ if $n \notin \mathcal{Q}_m$.
Denote the aggregate network-wide beamforming vector of group $m$ from all BSs as $\mathbf{w}_{m} = [\mathbf{w}_{m,1}^H,\mathbf{w}_{m,2}^H,\cdots, \mathbf{w}_{m,N}^H ]^H \in \mathbb{C}^{NL\times 1}$, where $\mathbf{w}_{m,n} \in \mathbb{C}^{L\times 1}$ is the beamforming vector for group $m$ from BS $n$.
Note that $\mathbf{w}_{m,n}=\mathbf{0}$ if $n \notin \mathcal{Q}_m$. Therefore, for each group $m$, the network-wide beamformer $\mathbf{w}_{m}$ can have a sparse structure. The received signal at user $k$ from group $\mathcal{G}_m$ can be written as
\begin{equation}
y_{k} = \mathbf{h}_k^H \mathbf{w}_m x_m + \sum_{j \neq m}^M \mathbf{h}_k^H \mathbf{w}_j x_j + n_k,~\forall k \in \mathcal{G}_m
\end{equation}
where $\mathbf{h}_k \in \mathbb{C}^{NL\times 1}$ is the network-wide channel vector from all the BSs to user $k$, $x_m \in \mathbb{C}$ is the data symbol of the content requested by group $m$ with $\mathbb{E} \left[ \lvert x_m\rvert^2 \right] = 1$, and $n_k \sim \mathcal{CN}(0,\sigma_k^2)$ is the additive white Gaussian noise at user $k$.
The received SINR for user $k\in \mathcal{G}_m$ is expressed as
\begin{equation}
\text{SINR}_{k} = \frac {\lvert \mathbf{h}_k^H \mathbf{w}_m \rvert^2} {\sum_{j \neq m}^M \lvert \mathbf{h}_k^H \mathbf{w}_j \rvert^2 + \sigma_k^2}, ~\forall k \in \mathcal{G}_m.
\end{equation}
We define the target SINR vector as $\bm{\gamma} = [\gamma_1,\gamma_2,\cdots,\gamma_M]$ with each element $\gamma_m$ being the minimum received SINR required by the users in group $m$. In this paper, we consider the fixed rate transmission as in \cite{WeiYu_globecom}, where the transmission rate for group $m$ is set as $R_m= B \log_2(1+\gamma_m)$, where $B$ is the total available channel bandwidth. Thus, to successfully decode the message, for any user $k \in \mathcal{G}_m$, its target SINR should satisfy $\text{SINR}_k \geq \gamma_m$.
\subsection{Cache Model}
Let $\mathcal{F}=\{1,2,\cdots,F\}$ represent the database of $F$ contents, each with normalized size of $1$. The local storage size of BS $n$ is denoted as $Y_n$ ($Y_n < F$), which represents the maximum number of contents it can cache.
We define a binary cache placement matrix $\mathbf{C} \in \{0,1\}^{F \times N}$, where $c_{f,n} = 1$ indicates that the $f$-th content is cached in the $n$-th BS and 0 otherwise. Due to limited cache size, $\sum_{f=1}^F c_{f,n} \le Y_n$.
As noted before, cache placement happens in a much larger timescale than scheduling and transmission. Hence we assume that the cache placement matrix $\mathbf{C}$ is given and fixed according to certain caching strategy, and focus on the optimization of content-centric dynamic BS clustering and multicast beamforming at the given caching design. Similar assumptions have been made in the previous literature, e.g. \cite{JunZhang_pimrc}.
\begin{figure}[t]
\begin{centering}
\includegraphics[scale=.35]{symtemmodel.eps}
\caption{\small{An example of cache-enabled cloud RAN downlink.}}\label{fig:systemmodel}
\end{centering}
\end{figure}
\subsection{Cost Model}
The total network cost for the considered network architecture consists of both the backhaul cost and the transmission power. Let $f_m$ denote the content requested by users in group $m$.
For each BS $n \in \mathcal{Q}_m$, if content $f_m$ has been cached in its local storage, it can access the content directly without costing backhaul. Otherwise, it needs to fetch this content from the CP via the backhaul link. Since the data rate of fetching a content from the CP needs to be as large as the content-delivery rate $R_m$, we model the backhaul cost as the transmission rate of the corresponding multicast group. Thus, the total backhaul cost of the network can be expressed as:
\begin{equation}
C_B = \sum_{m=1}^M \sum_{n=1}^N s_{m,n} (1-{c}_{f_m,n}) R_m. \label{eqn:backhaul cost}
\end{equation}
The total transmission power cost at all the BSs is defined as:
\begin{equation}
C_P = \sum_{m=1}^M \sum_{n=1}^N \lVert \mathbf{w}_{m,n} \rVert_2^2. \label{eqn:power cost}
\end{equation}
As a result, the total network cost can be modeled as:
\begin{equation}
C_N = C_B + \eta C_P, \label{eqn:network cost}
\end{equation}
where $\eta > 0$ is a weighting parameter between backhaul cost and transmission power. In practice, $\eta$ can be regarded as the pricing factor to trade power for backhaul capacity.
\section{Problem Formulation and Analysis} \label{section:Problem Formulation and Analysis}
In this section, we formulate an optimization problem of minimizing the total network cost by jointly designing the content-centric BS clustering and multicast beamforming. In the considered network architecture, all the channel state information (CSI) and user requests are assumed to be available at the CP for joint processing. The cache placement is also given as assumed in the previous section.
\subsection{Joint content-centric BS clustering and multicast beamforming} \label{sec:P0}
The goal is to optimize the BS clustering and multicast beamforming at each transmission frame so as to minimize the total network cost. This is formulated as:
\begin{subequations}
\begin{align}
\mathcal{P}_0:~\mathop{\text{minimize}}_{\{\mathbf{w}_{m,n}\}, \{s_{m,n}\}} \quad &\sum_{m=1}^M \sum_{n=1}^N s_{m,n} (1-{c}_{f_m,n}) R_m + \eta \sum_{m=1}^M \sum_{n=1}^N \lVert \mathbf{w}_{m,n} \rVert_2^2 \label{eqn:network-cost-obj}\\
\text{subject to} \quad &\text{SINR}_{k} \geq \gamma_m,~\forall k \in \mathcal{G}_m, \forall m \label{eqn:SINR-constraint} \\
& s_{m,n} \in \{0,1\},~\forall m,n \label{eqn:binary-constraint} \\
& (1 - s_{m,n}) \mathbf{w}_{m,n} = \mathbf{0},~\forall m,n \label{eqn:relationship-constraint}
\end{align} \label{eqn:network-cost-minimization-problem}
\end{subequations}
Constraint \eqref{eqn:SINR-constraint} is the minimum required SINR constraint, and constraint \eqref{eqn:relationship-constraint} indicates that if BS $n \notin \mathcal{Q}_m$, i.e., $s_{m,n}=0$, the corresponding beamformer $\mathbf{w}_{m,n}$ must be zero. Note that per-BS or per-antenna peak power constraints may be imposed in practice as in \cite{peak-power-14}. However, such peak power constraints are convex and hence will not change the nature of the formulated problem in this work as well as the algorithm design. As such we have omitted the peak power constraints and focus on the study of backhaul-power tradeoff in the total network cost.
Problem $\mathcal{P}_0$ is combinatorial in nature. A brute-force approach to find the global optimum BS clusters is exhaustive search. In particular, there are $2^{MN}$ possible BS clustering matrices $\{ \mathbf{S}\}$. For each given BS clustering matrix $\mathbf{S}$, the backhaul cost $C_B$ becomes a constant and problem $\mathcal{P}_0$ reduces to the following power minimization problem with partially coordinated transmission:
\begin{subequations}
\begin{align}
\mathcal{P}(\mathcal{Z}_{\mathbf{S}}):~\mathop{\text{minimize}}_{ \{ \mathbf{w}_{m,n}\}} \quad & \sum_{m=1}^M \sum_{n=1}^N \lVert \mathbf{w}_{m,n} \rVert_2^2 \\
\text{subject to} \quad & \eqref{eqn:SINR-constraint} \nonumber \\
& \mathbf{w}_{m,n} = \mathbf{0},~\forall (m,n) \in \mathcal{Z}_{\mathbf{S}}. \label{eqn:clustering-constraint}
\end{align} \label{eqn:beamforming-problem}
\end{subequations}
where $\mathcal{Z}_{\mathbf{S}} = \{(m,n) | s_{m,n}=0 \}$ is the set of inactive BS-content associations.
Problem $\mathcal{P}(\mathcal{Z}_{\mathbf{S}})$ is similar to the QoS multi-group multicast beamforming problems \cite{Luo_MultlGroup_multicast, ZhengZheng_mulitcell_multicast} and is a nonconvex quadratically constrained quadratic programming (QCQP) problem. Unlike traditional unicast beamforming problem where the nonconvex SINR constraints can be transformed to a second-order cone programming (SOCP) problem and hence solved efficiently, the multicast beamforming problem is NP-hard in general. The authors in \cite{Luo_MultlGroup_multicast} developed semi-definite relaxation (SDR) method with randomization to obtain a good sub-optimal solution.
Once $\mathcal{P}(\mathcal{Z}_{\mathbf{S}})$ is solved for all possible BS clustering matrices $\mathbf{S}$'s, the one with the minimum objective is then selected to be the global optimal solution. Note that problem $\mathcal{P}_0$ can be infeasible if the SINR requirements $\{\gamma_m \}$ are too stringent or the channels of users in different multicast groups are highly correlated. In general, determining the feasibility of an NP-hard problem is as difficult as solving the problem itself. In \cite{ZhengZheng_mulitcell_multicast}, a necessary condition for the QoS-based multi-cell multicast beamforming problem to be feasible is given. In this work we only discuss $\mathcal{P}_0$ when it is feasible.
The following proposition reveals some insights on BS clustering in cached-enabled networks.
\begin{proposition}
If the content $f_m$ requested by a multicast group $m$ has been cached in BS $n$, i.e., ${c}_{f_m,n} = 1$, then without loss of optimality, one can set $s_{m,n} = 1$ in problem $\mathcal{P}_0$. \label{Proposition-P1}
\end{proposition}
\begin{proof} See Appendix A.
\end{proof}
Proposition \ref{Proposition-P1} indicates that if a certain BS caches the requested content already, then adding this BS to the existing cluster of this content regardless of its channel conditions will not cause extra backhaul cost but can potentially reduce the total transmit power because of higher degrees of freedom for cooperative transmission. This proposition however does not mean BS $n$ must serve group $m$ with strictly positive power if $c_{f_m,n}=1$.
Depending on the actual channel realizations, it is possible that the optimized beamformer $\mathbf{w}_{m,n}=\mathbf{0}$ even when $s_{m,n}=1$ according to the problem formulation in $\mathcal{P}_0$.
Proposition \ref{Proposition-P1} can be used to reduce the exhaustive search space for global optimal BS clustering. In the extreme case when all the requested contents are cached in every BS, then the original joint BS clustering and multicast beamforming problem $\mathcal{P}_0$ reduces to the multicast beamforming problem with full cooperation, where $s_{m,n}=1, \forall m, n$.
In the general case when there exists a requested content which is not cached anywhere (except the CP), the search space for global optimal BS clustering is in the order of $2^{N}$. When the number of BSs, $N$, is very large in the considered cloud RAN architecture, the complexity can still be prohibitively high.
The above proposition holds for user-centric design as well \cite{usercentric_ICCC15}. Based on Proposition \ref{Proposition-P1}, we have developed a cache-aware greedy BS clustering algorithm, which is an extension of the greedy algorithm in \cite{usercentric_ICCC15} from unicast transmission to multicast transmission. The details are omitted due to page limit. The algorithm starts with full BS cooperation, then successively deactivates one BS from the serving cluster of a requested content based on greedy search. The BSs to be deactivated for each content only comes from the set of BSs which do not cache the content. Similar greedy algorithms without cache for user-centric BS clustering are proposed in \cite{JunZhang_trans}. Nevertheless, the number of iterations in such greedy algorithms in the worst case still grows quadratically with $MN$ and in each iteration it needs to solve a non-convex QCQP problem.
\subsection{Sparse multicast beamforming}
In this subsection, we formulate a sparse multicast beamforming (SBF) problem which is equivalent to the original problem $\mathcal{P}_0$ but more tractable. It is clear that the BS cluster matrix $\mathbf{S}$ can be specified with the knowledge of the beamformers $\mathbf{w}_{m,n}$'s. Specifically, when $\mathbf{w}_{m,n} = \mathbf{0}$, we have:
\begin{equation}
s_{m,n} =
\begin{cases}
0, &\text{if}~c_{f_m,n}=0, \\
0~\text{or}~1, &\text{if}~c_{f_m,n}=1. \\
\end{cases}
\end{equation}
Otherwise when $\mathbf{w}_{m,n} \ne \mathbf{0}$, we have $s_{m,n} = 1$ from constraint \eqref{eqn:relationship-constraint}. Thus, without loss of optimality, $s_{m,n}$ can be replaced by the $\ell_0$-norm\footnote{The $\ell_0$-norm denotes the number of nonzero elements of a vector. It reduces to the indicator function in the scalar case.} of $\lVert \mathbf{w}_{m,n} \rVert_2^2$:
\begin{equation}
s_{m,n} = \big \| \lVert \mathbf{w}_{m,n} \rVert_2^2 \big \|_0. \label{eqn:l0-norm}
\end{equation}
By substituting \eqref{eqn:l0-norm} into the network cost in the objective \eqref{eqn:network-cost-obj}, $\mathcal{P}_0$ can be transformed into the following equivalent problem:
\begin{subequations}
\begin{align}
\mathcal{P}_{\text{SBF}}:~\mathop{\text{minimize}}_{ \{ \mathbf{w}_{m,n} \}} \quad &\sum_{m=1}^M \sum_{n=1}^N \big \| \lVert \mathbf{w}_{m,n} \rVert_2^2 \big \|_0 (1-{c}_{f_m,n}) R_m + \eta \sum_{m=1}^M \sum_{n=1}^N \lVert \mathbf{w}_{m,n} \rVert_2^2 \label{eqn:P_SBF} \\
\text{subject to} \quad & \eqref{eqn:SINR-constraint}. \nonumber
\end{align}
\end{subequations}
Problem $\mathcal{P}_{\text{SBF}}$ is a sparse multicast beamforming problem with sparsity from the $\ell_0$-norm in the objective. This problem takes the dynamic content-centric BS clustering into account inexplicitly. Through solving this problem, a sparse beamformer for each content can be found whose nonzero entries correspond to the active serving BSs. Solving the equivalent problem $\mathcal{P}_{\text{SBF}}$ is still challenging due to the nonconvex QoS constraints and the nonconvex discontinuous $\ell_0$-norm in the objective.
\section{CCP based Sparse Multicast Beamformer Design} \label{section:CCP based Algorithm Design}
In this section, we first review some basics of the convex-concave procedure (CCP), a powerful heuristic method to find local optimal solutions to the general form of DC programming problems. After that, we show that problem $\mathcal{P}_{\text{SBF}}$ can be converted to DC programs after replacing $\ell_0$-norm with concave smooth functions and applying other techniques. Then two CCP-based algorithms are proposed to find effective solutions of $\mathcal{P}_{\text{SBF}}$.
\subsection{Basics of DC Programming and CCP} \label{subsection:Basics DC CCP}
DC programming deals with the optimization problems of functions with each represented as a difference of two convex functions. A general form of DC programming problems is written as follows:
\begin{subequations}
\begin{align}
\mathop{\text{minimize}}_{ x \in \mathbb{R}^n } \quad & g_0(x) - h_0(x) \nonumber \\
\text{subject to} \quad &g_i(x) - h_i(x) \leq 0, ~i=1,2,\dots,m. \nonumber
\end{align}
\end{subequations}
where $g_i$ and $h_i$ for $i=0,1,\dots,m,$ are all convex functions. A DC program is not convex unless the functions $h_i$ are affine, and is difficult to solve in general.
The convex-concave procedure is a heuristic algorithm to find a local optimal solution of DC programs. Its main idea is to convexify the problem by replacing the concave part in the DC functions, which is $h_i, i = 0,1,\dots,m$, by their first order Taylor expansions, then solve a sequence of convex problems successively. Specifically, it starts with an initial feasible point $x_0$, i.e., $g_i(x_0) - h_i(x_0) \le 0$, for $i=1,\ldots, m$. In each iteration $t$, it solves the following convex subproblem:
\begin{subequations}
\begin{align}
\mathop{\text{minimize}}_{ x \in \mathbb{R}^n} \quad & g_0(x) - \nabla h_0(x^{(t)})^T x \nonumber \\
\text{subject to} \quad &g_i(x) - \left [h_i(x^{(t)}) + \nabla h_i(x^{(t)})^T (x-x^{(t)}) \right ]\leq 0, ~i=1,2,\dots,m, \nonumber
\end{align}
\end{subequations}
where $x^{(t)}$ is the optimal solution obtained from the previous iteration.
The original CCP is proposed in \cite{yuille2003cccp} dealing with unconstrained or linearly constrained problems. It is then extended in \cite{smola2005kernel} to handle the general form of DC programming with DC constraints. Some other variations and extensions have been made in \cite{lipp2014variations} recently. In particular, it is shown explicitly in \cite{lipp2014variations} that the optimal solution of each iteration $x^{(t)}$ is always a feasible point of the original DC program. The convergence proof of CCP to critical points of the original problem for the differentiable case can be found in \cite{lanckriet2009convergence} and \cite{lipp2014variations}.
We would like to point out that CCP falls in the category of majorization-minimization (MM) algorithms for a particular choice of the majorization function. On the other hand, CCP can also be derived from the DC algorithm (DCA), a primal-dual subdifferential method for solving DC programs where the objective can be a difference of proper lower semi-continuous convex functions. In this paper, for differential convex functions, we prefer CCP formulation as it is a purely primal description of the problem. In \cite{multicast-sla-2014}, a successive linear approximation (SLA) has been proposed to solve the single-group multicast beamforming problem, which can be seen as a special case of CCP. In \cite{rank-two-cccp}, the authors propose a convex inner approximation technique to tackle the max-min fairness beamforming problem in multicast relay networks, which also belongs to the class of CCP.
To the best of our knowledge, this work is the first to apply CCP to solve multi-group multicast beamforming problems.
\subsection{Smoothed $\ell_0$-norm Approximation}
To solve the sparse multicast beamforming problem $P_{\text{SBF}}$, we approximate the discontinuous $\ell_0$-norm in the objective with a continuous smooth function, denoted as $f(x)$. Specifically, we consider three frequently used smooth concave functions: logarithmic function, exponential function, and arctangent function \cite{rinaldi2010concave}, defined as
\begin{equation} \label{eqn:smooth-funtion}
f_{\theta}(x) =
\begin{cases}
\frac {\log \left ( \frac {x} {\theta} + 1 \right )} {\log(\frac{1}{\theta} + 1)}, &\text{for log-function} \\
1-\exp(-\frac{x } {\theta} ), & \text{for exp-function} \\
\arctan \left ( { \frac {x } {\theta} } \right ), &\text{for arctan-function}
\end{cases}
\end{equation}
where $\theta > 0$ is a parameter controling the smoothness of approximation. A larger $\theta$ leads to smoother function but worse approximation and vice versa. The effectiveness of these smooth functions has been demonstrated for sparse signal recovery \cite{rinaldi2010concave} and feature selection in SVM (Support Vector Machine) \cite{le2015dc}.
With the above smoothed $\ell_0$-norm, the problem $P_{\rm SBF}$ can be approximated as:
\begin{subequations} \label{problem_appx}
\begin{align}
\mathcal{P}_{1}:~\mathop{\text{minimize}}_{ \{ \mathbf{w}_{m,n} \}} \quad &\sum_{m=1}^M \sum_{n=1}^N \alpha_{m,n} f_{\theta} \left( \lVert \mathbf{w}_{m,n} \rVert_2^2 \right ) + \eta \sum_{m=1}^M \sum_{n=1}^N\lVert \mathbf{w}_{m,n} \rVert_2^2 \\
\text{subject to} \quad &\eqref{eqn:SINR-constraint}. \nonumber
\end{align}
\end{subequations}
where $\alpha_{m,n} \triangleq (1-c_{f_m,n}) R_m$, $\forall m, n$. Note that the smooth function $f_{\theta} \left( \lVert \mathbf{w}_{m,n} \rVert_2^2 \right )$ is concave in $\lVert \mathbf{w}_{m,n} \rVert_2^2$, but not concave in $\mathbf{w}_{m,n} $. In the following two subsections, we introduce two different techniques to convert problem $\mathcal{P}_{1}$ into DC programming problems, and then solve it using CCP-based algorithms.
\subsection{SDR-based CCP Algorithm} \label{subsection:SDR-based CCP Algorithm}
To convert $\mathcal{P}_{1}$ into a DC program, we take the SDR approach in this subsection. Define two sets of matrices $ \{\mathbf{W}_m \in \mathbb{C}^{NL\times NL} \}_{m=1}^M $ and $\{\mathbf{H}_k \in \mathbb{C}^{NL\times NL}\}_{k=1}^K $ as
\begin{equation}
\mathbf{W}_m = \mathbf{w}_{m}\mathbf{w}_{m}^H,~\forall m \quad \text{and} \quad \mathbf{H}_k = \mathbf{h}_{k} \mathbf{h}_{k}^H,~\forall k.
\end{equation}
We further define a set of selection matrices $\{\mathbf{J}_n\}_{n=1}^N$, where each $\mathbf{J}_n \in \{0,1\}^{NL\times NL}$ is a diagonal matrix defined as
\begin{equation}
\mathbf{J}_n = \text{diag} \left ( \left[ \mathbf{0}_{(n-1)L}^H, \mathbf{1}_{L}^H, \mathbf{0}_{(N-n)L}^H \right ] \right ),~\forall n.
\end{equation}
Therefore, we can rewrite $\lVert \mathbf{w}_{m,n} \rVert_2^2$ as
\begin{equation} \label{eqn:normtr}
\lVert \mathbf{w}_{m,n} \rVert^2_2 = \text{Tr} ( \mathbf{W}_{m} \mathbf{J}_n ),~\forall m,n.
\end{equation}
By removing the rank constraint ${\rm rank}\{\mathbf{W}_m\}=1$, problem $\mathcal{P}_{1}$ can be relaxed as
\begin{subequations}
\begin{align}
\mathcal{P}_{2}:~\mathop{\text{minimize}}_{ \{ \mathbf{W}_m \}} \quad &\sum_{m=1}^M\sum_{n=1}^N\alpha_{m,n}f_{\theta}(\text{Tr} \left ( \mathbf{W}_m\mathbf{J}_n\right )) + \eta \sum_{m=1}^M \text{Tr} \left ( \mathbf{W}_{m} \right ) \label{eqn:Psdr-obj}\\
\text{subject to} \quad &\frac{ \text{Tr} ( \mathbf{W}_{m} \mathbf{H}_{k} ) } {\sum_{j \neq m}^M \text{Tr} ( \mathbf{W}_{j} \mathbf{H}_{k} ) + \sigma_k^2} \geq \gamma_{m},~\forall k \in \mathcal{G}_m,~\forall m \label{eqn:SDR-QoS-constraint} \\
&\mathbf{W}_{m} \succeq \mathbf{0},~\forall m \label{eqn:semidefinite-constraint}
\end{align}
\end{subequations}
Clearly the SINR constraint \eqref{eqn:SDR-QoS-constraint} becomes affine. In addition, observing \eqref{eqn:Psdr-obj} closely, we find that the objective can be rewritten as the difference of two functions $g$ and $h$, defined as
\begin{equation}
g - h = \eta \sum_{m=1}^M \text{Tr} \left( \mathbf{W}_{m} \right)
- \left[-\sum_{m=1}^M\sum_{n=1}^N\alpha_{m,n}f_{\theta}(\text{Tr} \left ( \mathbf{W}_m\mathbf{J}_n\right ))\right].
\end{equation}
Recall that the smooth function $f_{\theta}(x)$ \eqref{eqn:smooth-funtion} is chosen to be concave, thus, $h$ is a convex function of $\{\mathbf{W}_m\}$. On the other hand, $g$ is affine. Then the objective of problem $\mathcal{P}_{2}$ can be expressed as a difference of convex functions. Therefore, $\mathcal{P}_{2}$ is a DC program with DC objective and convex constraints. The CCP reviewed in Section \ref{subsection:Basics DC CCP} can be readily applied with the objective function to be convexified only. The subproblem in each iteration is an SDP problem and can be solved using a generic SDP solver. The details are omitted.
If the resulting solution $\{\mathbf{W}_m\}$ after solving problem $\mathcal{P}_{2}$ is already rank-one, the optimal network-wide beamformer $\mathbf{w}^*_{m}$ of problem $\mathcal{P}_{\text{SBF}}$ can be obtained by applying eigen-value decomposition (EVD). Otherwise, the randomization and scaling method \cite{Luo_MultlGroup_multicast, ZhengZheng_mulitcell_multicast} is used to generate a suboptimal solution. In general, the SDR method can demonstrate good performance for small number of users, where the percentage of rank-one solution is high. However, as the number of users or antennas becomes very large, the probability of rank-one solution is very small, and the randomization-based solution can be far from optimal \cite{Luo_MultlGroup_multicast}. Furthermore, by adopting the SDR method, the number of variables is roughly squared (from $MNL$ to $M(NL)^2$), which is not computationally efficient.
\subsection{Generalized CCP algorithm} \label{subsection:Generalized CCP algorithm}
In this subsection we convert $\mathcal{P}_1$ into a general form of DC programs with DC forms in both objective and constraints without any relaxation.
The nonconvex SINR constraints \eqref{eqn:SINR-constraint} in $\mathcal{P}_1$ can be rewritten as
\begin{equation}
\gamma_m \left (\sum_{j \neq m}^M \lvert \mathbf{h}_k^H \mathbf{w}_j \rvert^2 + \sigma_k^2 \right ) - \lvert \mathbf{h}_k^H \mathbf{w}_m \rvert^2 \leq 0, ~\forall k \in \mathcal{G}_m. \label{eqn:DC-SINR-constraint}
\end{equation}
Clearly, the left hand side of \eqref{eqn:DC-SINR-constraint} is a DC function. By introducing auxiliary variables $\{ t_{m,n} \in \mathbb{R} \}_{n=1,\dots, N}^{m=1,\dots, M}$ and noticing that the smooth function $f_{\theta}(x)$ is strictly monotone increasing, problem $\mathcal{P}_{1}$ can be transformed into the following problem as
\begin{subequations}
\begin{align}
\mathcal{P}_{3}:~\mathop{\text{minimize}}_{ \{ \mathbf{w}_{m,n} \}, \{ t_{m,n} \}} \quad & \sum_{m=1}^M \sum_{n=1}^N \alpha_{m,n} f_{\theta} \left( t_{m,n} \right ) + \eta \sum_{m=1}^M \sum_{n=1}^N t_{m,n} \label{eqn:P3-obj}\\
\text{subject to} \quad &\lVert \mathbf{w}_{m,n} \rVert_2^2 - t_{m,n} \leq 0,~\forall m,n, \label{eqn:equality-constraint}\\
& \gamma_m \left (\sum_{j \neq m}^M \lvert \mathbf{h}_k^H \mathbf{w}_j \rvert^2 + \sigma_k^2 \right ) - \lvert \mathbf{h}_k^H \mathbf{w}_m \rvert^2 \leq 0, ~\forall k \in \mathcal{G}_m. \label{eqn:DC-SINR-constraint2}
\end{align}
\end{subequations}
Here, the introduction of auxiliary variables $\{ t_{m,n} \}$ is crucial. The objective \eqref{eqn:P3-obj} now becomes the difference of two convex functions expressed as:
\begin{equation}
g-h = \eta \sum_{m=1}^M \sum_{n=1}^N t_{m,n} - \left (- \sum_{m=1}^M \sum_{n=1}^N \alpha_{m,n} f_{\theta} \left( t_{m,n} \right ) \right ).
\end{equation}
The new constraints \eqref{eqn:equality-constraint} are convex.
It can be observed that problem $\mathcal{P}_{3}$ falls into a general form of DC programming problems since both the objective and the constraints are DC functions. Hence, the general CCP algorithm reviewed in Section \ref{subsection:Basics DC CCP} can be readily applied to obtain a local optimal solution of $\mathcal{P}_{3}$.
In specific, the subproblem in the $i$th iteration of the CCP takes the following form:
\begin{subequations}
\begin{align}
\mathop{\text{minimize}}_{ \{ \mathbf{w}_{m,n} \}, \{ t_{m,n} \}} \quad & \sum_{m=1}^M \sum_{n=1}^N \left ( \eta + \alpha_{m,n} \nabla f_{\theta} \left( t_{m,n}^{(i)} \right ) \right ) t_{m,n} \\
\text{subject to} \quad &\lVert \mathbf{w}_{m,n} \rVert_2^2 - t_{m,n} \leq 0,~\forall m,n \\
& \gamma_m \left (\sum_{j \neq m}^M \lvert \mathbf{h}_k^H \mathbf{w}_j \rvert^2 + \sigma_k^2 \right) - \left( 2 \mathfrak{R} \left \{ (\mathbf{w}_m^{(i)} )^H \mathbf{h}_k \mathbf{h}_k^H \mathbf{w}_m \right \}- \lvert \mathbf{h}_k^H \mathbf{w}_m^{(i)} \rvert^2 \right) \leq 0, ~\forall k \in \mathcal{G}_m
\end{align}
\end{subequations}
which is a convex QCQP problem.
\textbf{Remark 1}: By comparing with the DC transformation from $\mathcal{P}_{1}$ to $\mathcal{P}_{2}$, the DC transformation from $\mathcal{P}_{1}$ to $\mathcal{P}_{3}$ differs in two major aspects. First, the optimal solution of $\mathcal{P}_{3}$ must satisfy $\lVert \mathbf{w}^*_{m,n} \rVert_2^2 = t_{m,n}^*$ (this can be easily proved by contradiction) and thus the transformation from $\mathcal{P}_{1}$ to $\mathcal{P}_{3}$ does not incur any loss of optimality. On the other hand, the transformation from $\mathcal{P}_{1}$ to $\mathcal{P}_{2}$ is a relaxed one due to the removal of rank-one constraints. Second, while the number of variables in $\mathcal{P}_{2}$ (i.e., $M(NL)^2$) is roughly squared of that in $\mathcal{P}_{1}$ (i.e., $MNL$), the number of variables in $\mathcal{P}_{3}$ (i.e., $MN(L+1)$) almost keeps the same as that in $\mathcal{P}_1$. In the simulation section, we shall compare the performance and complexity of the two methods in greater details.
\subsection{Discussions and Algorithm Outlines} \label{sec-discussion-algorithm}
In this subsection we first provide some discussions on the initialization of the above CCP-based sparse beamforming algorithms and the updating rule of the smoothness parameter $\theta$ in \eqref{eqn:smooth-funtion}. Then we summarize our proposed algorithms formally.
\subsubsection{Initialization}
As stated in Section \ref{subsection:Basics DC CCP}, the CCP algorithm needs a feasible starting point. Unlike the single-group multicast beamforming problems \cite{multicast06, multicast-sla-2014, rank-two-cccp}, where any starting point after simple scaling can be feasible, the starting point for our problem needs to be chosen carefully. In this paper, we propose to find a feasible starting point through solving the following power minimization problem with full BS cooperation:
\begin{subequations}
\begin{align}
\mathcal{P}_{\text{INI}}:~\mathop{\text{minimize}}_{ \{ \mathbf{W}_m \}} \quad & \sum_{m=1}^M \text{Tr} \left ( \mathbf{W}_{m} \right )\\
\text{subject to} \quad &\frac{ \text{Tr} ( \mathbf{W}_{m} \mathbf{H}_{k} ) } {\sum_{j \neq m}^M \text{Tr} ( \mathbf{W}_{j} \mathbf{H}_{k} ) + \sigma_k^2} \geq \gamma_{m},~\forall k \in \mathcal{G}_m,~\forall m \\
&\mathbf{W}_{m} \succeq \mathbf{0},~\forall m
\end{align}
\end{subequations}
The optimal solution $\{\mathbf{W}_m\}$ of $\mathcal{P}_{\text{INI}}$ can be used directly as a feasible starting point for the SDR-based CCP algorithm in Section \ref{subsection:SDR-based CCP Algorithm}. For the generalized CCP algorithm in Section \ref{subsection:Generalized CCP algorithm}, if $\{\mathbf{W}_m\}$ are all rank-one, then the feasible beamformers $\{\mathbf{w}_{m} \}$ can be obtained by applying EVD on $\{\mathbf{W}_m\}$. Otherwise, randomization and scaling are needed. Note that if the SDP problem $\mathcal{P}_{\text{INI}}$ turns out to be infeasible, then the original problem $\mathcal{P}_{0}$ is infeasible and both algorithms will terminate\footnote{However, even if $\mathcal{P}_{\text{INI}}$ is feasible, it does not necessarily guarantee that $\mathcal{P}_0$ is feasible.}.
The need for an initial feasible point can be removed with a penalty CCP algorithm proposed in \cite{lipp2014variations}. But the penalty algorithm is not a descent algorithm and the convergence may not be a feasible point of the original problem. The algorithm needs to be performed many times, each with a different starting point until a feasible point is obtained. This increases the overall complexity significantly.
\subsubsection{Updating Rule of $\theta$}
The performance of the smoothed $\ell_0$-norm approximation $f_{\theta}(x)$ depends on the smoothness factor $\theta$. Intuitively, when $x$ is large, $\theta$ should be large so that the approximation algorithm can explore the entire parameter space; when $x$ is small, $\theta$ should be small so that $f_{\theta}(x)$ has behavior close to $\ell_0$-norm. In our conference paper \cite{contentcentric_Globecom15}, we proposed a novel $\theta$ updating rule that achieves the above effect automatically using a sequence of $\theta$ that depends on the specific $x$ in each iteration. More specifically, $\theta$ is set to be the one that maximizes the gradient of the approximation function. It is shown in \cite{contentcentric_Globecom15} that with such updating rule, the three smooth functions in \eqref{eqn:smooth-funtion} perform almost identically.
In this work, we propose to implement an annealing design of $\theta$. We begin with a large value of $\theta$, solve $\mathcal{P}_{2}$ using SDR-CCP algorithm (or $\mathcal{P}_{3}$ using generalized CCP algorithm), then decrease $\theta$ by a given factor $\beta$ (i.e., $\theta \gets \beta \theta$) and solve $\mathcal{P}_{2}$ (or $\mathcal{P}_{3}$) again with the initial point given by the solution from the previous iteration. This scheme is then iterated until $\theta$ is sufficiently small.
\subsubsection{Algorithm Outlines}
In summary, the two proposed algorithms are outlined in Alg.~\ref{alg:SDR-CCP} and Alg.~\ref{alg:G-CCP}, respectively. Besides the differences mentioned in Remark 1, from Alg.~\ref{alg:SDR-CCP} and Alg.~\ref{alg:G-CCP} one can note that the SDP-CCP algorithm and the G-CCP algorithm also differ in randomization and scaling. In specific, the randomization and scaling in SDR-CCP is performed in the last step of Alg.~\ref{alg:SDR-CCP} and needs to be done many times in order to get a good approximate solution if $\{\mathbf{W}_m^{*}\}$ do not have rank one; however, the randomization and scaling in G-CCP is performed at the initialization step of Alg.~\ref{alg:G-CCP} and can be finished as soon as a feasible point $\{\mathbf{w}_m^{(0)}\}$ is found.
\textbf{Remark 2}: In the extreme case when $\eta\to+\infty$, the original problem $\mathcal{P}_0$ \eqref{eqn:network-cost-minimization-problem} or $\mathcal{P}_{SBF}$ \eqref{eqn:P_SBF} reduces to the total power minimization problem of multi-group multicast beamforming in a fully cooperative network subject to QoS constraints. In this case, the SDR-CCP algorithm (Alg.~1) reduces to the traditional SDR method \cite{Luo_MultlGroup_multicast} without invoking CCP. However, the G-CCP algorithm (Alg.~2) still stands as it is except there is no need to update the smoothness factor $\theta$. Thus we can claim that our proposed G-CCP based sparse muticast beamforming algorithm is general and can be used to solve the traditional multi-group multicast beamforming problem \cite{Luo_MultlGroup_multicast, ZhengZheng_mulitcell_multicast} as special cases.
\begin{algorithm}[h]
\caption{(SDR-CCP) SDR-CCP Based Sparse Multicast Beamforming Algorithm} \label{alg:SDR-CCP}
\begin{algorithmic}[0]
\STATE \textbf{Initialization:}
\begin{enumerate}
\item Find a feasible starting point $\{\mathbf{W}_m^{(0)}\}$ by solving $\cal{P}_{\rm INI}$.
\item Set the smoothness factor $\theta=\theta_0$, decaying factor $0< \beta < 1$ and small constant $\epsilon$.
\end{enumerate}
\STATE \textbf{Repeat}
\begin{enumerate}
\item Solve $\mathcal{P}_{2}$ using CCP at the starting point $\{\mathbf{W}_m^{(0)}\}$ and denote the solution as $\{\mathbf{W}_m^{*}\}$
\item Update $\theta \gets \beta\theta$ and $\{\mathbf{W}_m^{(0)}\} \gets \{\mathbf{W}_m^{*}\}$
\end{enumerate}
\STATE \textbf{Until} $\theta < \epsilon$.
\STATE \textbf{If} ${\rm rank}(\mathbf{W}_m^{*}) = 1$, $\forall m$, apply EVD on $\{\mathbf{W}_m^{*}\}$ to obtain the final solution $\{ \mathbf{w}_m^{*} \}$ .
\STATE \textbf{Else}, apply Gaussian randomization and scaling to obtain the approximate solution $\{ \mathbf{w}_m^{*} \}$
\end{algorithmic}
\end{algorithm}
\begin{algorithm}[h]
\caption{(G-CCP) Generalized CCP Based Sparse Multicast Beamforming Algorithm} \label{alg:G-CCP}
\begin{algorithmic}[0]
\STATE \textbf{Initialization:}
\begin{enumerate}
\item Solve $\cal{P}_{\rm INI}$ and denote the solution as $\{\mathbf{W}_m^{(0)}\}$.
\item If ${\rm rank}(\mathbf{W}_m^{(0)}) = 1$, $\forall m$, apply EVD to obtain a feasible point $\{ \mathbf{w}_m^{(0)} \}$.
\item Else, apply Gaussian randomization and scaling to obtain a feasible point $\{ \mathbf{w}_m^{(0)} \}$.
\item Set the smoothness factor $\theta=\theta_0$, decaying factor $0< \beta < 1$, and small constant $\epsilon$.
\end{enumerate}
\STATE \textbf{Repeat}
\begin{enumerate}
\item Solve $\cal{P}_{\rm 3}$ using CCP at the starting point $\{\mathbf{w}_m^{(0)}\}$ and denote the solution as $\{\mathbf{w}_m^{*}\}$
\item Update $\theta \gets \beta\theta$ and $\{\mathbf{w}_m^{(0)}\} \gets \{\mathbf{w}_m^{*}\}$
\end{enumerate}
\STATE \textbf{Until} $\theta < \epsilon$.
\STATE \textbf{Output} solution $\{\mathbf{w}_m^{*}\}$
\end{algorithmic}
\end{algorithm}
\begin{figure}[t]
\begin{centering}
\includegraphics[scale=.40]{location.eps}
\caption{\small{Simulation scenario with 7 BSs, 30 mobile users randomly distributed.}}\label{fig:location}
\end{centering}
\end{figure}
\section{Simulation Results} \label{section:Simulation Results}
In this section, we provide comprehensive simulations to illustrate the performance of the proposed content-centric sparse beamforming algorithms.
We consider a hexagonal multicell cloud RAN network, where each BS is located at the center of a hexagonal-type cell as illustrated in Fig.~\ref{fig:location}. There are $N=7$ BSs in total and each BS has $L=4$ antennas. The distance between adjacent BSs is set to $500$m. The mobile users are uniformly and independently distributed in the network, excluding an inner circle of $50$m around each BS. All BSs are assumed to have equal cache size of $Y$ (e.g., $Y_n = Y,~\forall n$). The transmit antenna power gain at each BS is $10$dBi. The available channel bandwidth is $10$MHz. The distance-dependent pathloss is modeled as $PL(\text{dB}) = 148.1 + 37.6 \text{log}_{10}(d)$, where $d$ is the distance in kilometers. The log-normal shadowing parameter is assumed to be $8$dB. The small-scale fading is the normalized Rayleigh fading. The noise power spectral density $\sigma_k^2$ for all users is set to be $-172$dBm/Hz. The SINR target for each multicast group is $\gamma_m=10$dB, $\forall m$.
In the proposed updating rule of smoothness factor $\theta$, it generally requires the initial $\theta_0$ to be large enough so that the smooth function $f_\theta(x)$ can explore the entire parameter space during the iterations. In our simulation, we set $\theta_0 = \max\{\text{Tr} (\mathbf{W}^{(0)}_m\mathbf{J}_n ), \forall m, n\}$ for Alg.~\ref{alg:SDR-CCP} and $\theta_0 = \max\{\|\mathbf{w}_{m,n}^{(0)} \|_2^2, \forall m, n\}$ Alg.~\ref{alg:G-CCP}, respectively, where $\mathbf{W}^{(0)}_m$ is the optimal solution of $\mathcal{P}_{\text{INI}}$ and $\mathbf{w}_{m,n}^{(0)}$ is obtained from $\mathbf{W}^{(0)}_m$ by EVD (Gaussian randomization and scaling is applied if necessary). Our empirical results have shown that such $\theta_0$ is large enough so that further increasing it will not bring additional gain. For the decaying factor $\beta$, a larger $\beta$ can lead to more accurate result and hence better performance but the convergence speed can be slow; a smaller $\beta$ can speed up the convergence but the algorithm is more likely to get a suboptimal solution. In our simulation, we empirically choose $\beta=0.1$, which can strike a good balance between the convergence speed and the performance. The small constant $\epsilon$ is set to be $10^{-6}$.
In each simulation trial we consider $K=30$ active users and each user submits a content request independently to a database of $F=100$ contents. Each simulated result is obtained by averaging over $100$ independent simulation trials, unless stated otherwise. In each trial we only generate one set of user locations, channel realizations, and user requests for simulation simplicity. We assume the following two different content popularity distributions: 1) \emph{Unequal popularity}: among the $100$ contents, one content belongs to trending news with request probability $0.5$, and the other $99$ contents share the rest $0.5$ of the request probability following a Zipf distribution with skewness parameter $\alpha$. In general, large $\alpha$ means more user requests are concentrated on fewer popular contents. 2) \emph{Equal popularity}: all the $100$ contents are requested with equal probabilities. In our simulation the defaulted setting is the unequal popularity with $\alpha=1$. Each BS caches $Y=10$ contents if not specified otherwise.
The following three heuristic caching strategies are considered:
\begin{itemize}
\item \emph{Popularity-aware Caching (PopC):} Each BS caches the most popular contents until its storage is full. In such caching scheme, the cached contents in all the BSs are the same if their cache sizes are the same. This strategy can bring significant opportunity for full cooperation when the content popularity distribution is highly non-uniform. On the other hand, if the popularity is equally distributed, the cache hit rate can be very low and may cause large backhaul burden.
\item \emph{Random Caching (RanC):} Each BS caches the contents randomly with equal probabilities regardless of their popularity distribution.
\item \emph{Probabilistic Caching (ProC):} Each BS caches a content randomly with probability depending on the content popularity, and the more popular the content is, the more likely it will be cached in each BS. This caching strategy can strike a good balance between cache hit rate and cooperative transmission gain.
\end{itemize}
\subsection{Comparison between SDR-CCP and Generalized CCP algorithms}
We first demonstrate the convergence behavior of the proposed two CCP based algorithms denoted as SDR-CCP and G-CCP, in Fig.~\ref{fig:convergence_behavior_SDR-CCP} and Fig.~\ref{fig:convergence_behavior_G-CCP}, respectively. For illustration purpose, the smoothness factor in all smooth functions is fixed at $\theta=0.01$. Popularity-aware caching is adopted. It can be seen clearly that both SDR-CCP and G-CCP converge within less than $10$ iterations for all the considered cases.
In Fig.~\ref{fig:SDR_DC_atan}, we plot the backhaul-power tradeoff curves achieved by the proposed two algorithms. The tradeoff curves are obtained by controlling the weight parameter $\eta$ between the backhaul cost and the transmit power cost. When $\eta\to 0$ (e.g., $\eta = 10^{-6}$), the total network cost only takes backhaul capacity into account. When $\eta\to+\infty$, the total network cost only counts the transmit power and the optimization problem reduces to the transmit power minimization problem $\mathcal{P}(\mathcal{Z}_{\mathbf{S}})$ with $s_{m,n} = 1,~\forall m,n$. Without loss of generality, we take the arctangent smooth function for example. It is observed that the G-CCP algorithm provides a better backhaul-power tradeoff than the SDR-CCP algorithm. In particular, at the same backhaul cost, G-CCP can achieve $1 \sim 5$ dB lower power cost than SDR-CCP. In the extreme case with transmit power minimization (i.e., $\eta\to+\infty$), our proposed problem $\mathcal{P}_0$ reduces to the multi-group QoS multicast beamforming problem in \cite{Luo_MultlGroup_multicast} and, correspondingly, the SDR-CCP based algorithm reduces to the SDR method in \cite{Luo_MultlGroup_multicast}. It is seen that the proposed G-CCP algorithm still outperforms the SDR method in \cite{Luo_MultlGroup_multicast} by saving $0.5$dB power cost.
We also compare the simulation running time of the two CCP-based algorithms in Table~\ref{tab:complexity-eta}. The simulation is based on MATLAB R2012a and carried out on a Windows x64 machine with 3.2 GHz CPU and 4 GB RAM. We adopt the CVX package with SDPT3 solver in \cite{cvx} to solve the convex subproblem in each iteration of CCP. It is seen from Table~\ref{tab:complexity-eta} that the running time of G-CCP is around $46\% \sim 56 \% $ of the SDR-CCP algorithm in general. In the extreme case when $\eta \to+\infty$, the running time of G-CCP is only $33\%$ that of SDR-CCP. The complexity reduction of G-CCP is contributed by two facts. First, the problem size of $\mathcal{P}_3$ in G-CCP is smaller than that of ${\mathcal P}_2$ in SDR-CCP, as noted in Remark 1. Second, G-CCP requires less number of randomization and scaling steps as noted in Section~\ref{sec-discussion-algorithm}.
From the above comparison, it can be concluded that the G-CCP based algorithm is superior to the SDR-CCP algorithm in both performance and computational complexity. Therefore, in the rest of our simulation, we only use the G-CCP algorithm.
\begin{figure}[!htb]
\begin{centering}
\includegraphics[scale=.60]{convergence_behavior_SDR-CCP.eps}
\caption{\small{Convergence behavior of the SDR-CCP based algorithm with $\theta = 0.01$.}}\label{fig:convergence_behavior_SDR-CCP}
\end{centering}
\end{figure}
\begin{figure}[!htb]
\begin{centering}
\includegraphics[scale=.60]{convergence_behavior_G-CCP.eps}
\caption{\small{Convergence behavior of the general CCP based algorithm with $\theta = 0.01$.}}\label{fig:convergence_behavior_G-CCP}
\end{centering}
\end{figure}
\begin{figure}[!htb]
\begin{centering}
\includegraphics[scale=.60]{SDR_DC_atan.eps}
\caption{\small{Backhaul-power tradeoff comparison between SDR-CCP and G-CCP.}}\label{fig:SDR_DC_atan}
\end{centering}
\end{figure}
\begin{table}[!htb]
\caption{Comparison of running times (second) of SDR-CCP and G-CCP algorithms.} \label{tab:complexity-eta}
\centering
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|}
\hline
$\eta$ & $10^{-6}$ & $10^{-3}$ & 0.01 & 0.1 & 0.3 & 1 & 5 & 10 & 30 & $+\infty$ \\
\hline
SDR-CCP (sec) & 909.24 & 781.02 & 705.90 & 650.14 & 642.48 & 620.15 & 582.01 & 558.53 & 482.48 & 247.97 \\
\hline
G-CCP (sec) & 510.87& 416.66 & 365.84 & 327.06 & 320.32 & 307.66 & 270.43 & 255.65 & 222.24 & 81.95 \\
\hline
\end{tabular}
\end{table}
\subsection{Comparison of Different Smooth Functions}
In Fig. \ref{fig:smooth-function}, we compare the performance of the three smooth functions with popularity-aware caching.
Each result is obtained by averaging over $200$ independent simulation trials.
It is seen that the three functions have similar performance for a wide range of $\eta$. In the extreme case when $\eta\to 0$, the arctangent function can achieve slightly lower backhaul cost than the other two functions. Thus, in the rest of our simulation, only the arctangent function is adopted.
\begin{figure}[!htb]
\begin{centering}
\includegraphics[scale=.45]{SmothFunction.eps}
\caption{\small{Performance comparison of different smooth functions}}\label{fig:smooth-function}
\end{centering}
\end{figure}
\subsection{Effects of Caching}
\begin{figure}[!htb]
\begin{centering}
\includegraphics[scale=.60]{alpha1.eps}
\caption{\small{Performance comparison of different caching strategies for unequal content popularity with $\alpha=1$.}}\label{fig:alpha1}
\end{centering}
\end{figure}
\begin{figure}[!htb]
\begin{centering}
\includegraphics[scale=.60]{alpha2_3.eps}
\caption{\small{Performance comparison of different caching strategies for unequal content popularity with $\alpha=2$.}}\label{fig:alpha2}
\end{centering}
\end{figure}
\begin{figure}[!htb]
\begin{centering}
\includegraphics[scale=.60]{alpha0.eps}
\caption{\small{Performance comparison of different caching strategies for equal content popularity.}}\label{fig:alpha0}
\end{centering}
\end{figure}
In Fig.~\ref{fig:alpha1}, we compare the performance of different caching strategies for unequal content popularity with skewness factor $\alpha=1$. Both $K=30$ and $K=7$ users are considered and the cache size is $Y=10$.
It is seen that compared with the network without cache, the cache-enabled network with a reasonably designed cache can dramatically reduce the backhaul cost, hence improving the backhaul-power tradeoff.
Next we focus on the comparison between the popularity-aware caching (PopC) and the probabilistic caching (ProC) under both unequal content popularity in Figs~\ref{fig:alpha1}-\ref{fig:alpha2} and equal content popularity in Fig.~\ref{fig:alpha0}. The simulation setting in Fig.~\ref{fig:alpha2} is the same as Fig.~\ref{fig:alpha1} except the skewness factor $\alpha=2$. The results for equal content popularity in Fig.~\ref{fig:alpha0} are obtained at $K=20$ and $K=7$ users with cache size $Y=10$ and $Y=20$.
From Fig.~\ref{fig:alpha1} and Fig.~\ref{fig:alpha2} with unequal content popularity, it can be generally observed that PopC outperforms ProC for a wide range of the backhaul-power tradeoff parameter $\eta$ in the total network cost, except the limiting case $\eta\to 0$. Intuitively, since PopC places the same and most popular contents in each BS, it can enjoy the maximum transmit cooperation gain if the network is not extremely concerned with the backhaul cost. However, if the backhaul cost is the primary concern of the network (i.e., $\eta\to 0$), then ProC performs better than PopC. In specific, the achievable minimum backhaul cost of ProC is only around $50\%$-$60\%$ of that of PopC with $K=7$ users. This is because when the user number is small, each content can be served by only a small number of BSs cooperatively to meet their SINR targets and hence it is more likely to find the requested contents in the local cache of all the serving BSs when ProC is adopted.
From Fig.~\ref{fig:alpha0} with equal content popularity, it is interestingly observed that when $K=20$, PopC and ProC (ProC is equivalent to RanC in this case) perform almost the same in the entire backhaul-power tradeoff curve, in sharp contrary to the common belief that ProC may outperform PopC because of large cache hit rate. This observation is because when the user number is large, each content should be better served by a large number of BSs cooperatively to meet their SINR targets, and hence the benefits of randomness in ProC may vanish since all the serving BSs need to access the requested content either from its local cache or from the CP via backhaul. On the other hand, when $K=7$, ProC still shows advantage over PopC by a significant reduction of achievable minimum backhaul cost as expected.
The above observations indicate that the design of more advanced caching strategies for network performance optimization should not only take into account the content popularity, but also the user density as well as the optimization objective.
Nevertheless, from \Cref{fig:alpha1,fig:alpha2,fig:alpha0}, one can see that the minimum transmit power cost of the network is the same for all caching strategies, since it is only determined by the target SINR constraint of each multicast group ($10$dB in the simulation).
\subsection{Multicast versus Unicast}
In Fig.~\ref{fig:multicast_unicast}, we compare the performance of multicast transmission and unicast transmission at different number of active users. Here, unequal content popularity with skewness factor $\alpha=1$ is assumed and the popularity-aware caching with cache size $10$ is applied. In unicast transmission, we design different beamformers for different users regardless of their requested contents. Note that if a BS serves multiple users requesting for a same content that it does not cache, the central processor only needs to distribute to the BS one copy of the content at the maximum requested data rate. This is to ensure a fair comparison on the backhaul cost. The iterative reweighted $\ell_1$-norm based sparse unicast beamforming algorithm proposed in \cite{usercentric_ICCC15} is adopted. Such comparison between multicast transmission and unicast transmission is essentially a comparison between the proposed content-centric design and the traditional user-centric design.
It is seen from Fig.~\ref{fig:multicast_unicast} that when there are $K=30$ active users in the network, the unicast transmission (user-centric design) performs very poorly. This is mainly because there are only $N\times L=28$ transmit antennas in total in the considered cloud RAN and hence there is not enough spatial dimension to construct $30$ beamformers for unicast transmission. On the other hand, the proposed multicast transmission (content-centric design) performs well since it exploits the content popularity among different users and needs to design fewer beamformer.
When the number of active users decreases, it is observed that the backhaul-power tradeoff for unicast transmission is improved, but it is still considerably inferior to multicast transmission. In the extreme case when only power cost is concerned ($\eta \to +\infty$), it is seen that unicast transmission requires $3$ dB higher power than multicast transmission when there are $K=20$ active users. A question one may ask is whether multicast transmission still outperforms unicast transmission in the special scenario where the users requesting a same content happen to be located in geographically disjoint areas covered by different BSs. We note that such scenario belongs to the special case where the network-wide user channel vectors are orthogonal and hence unicast beamforming and multicast beamforming are equivalent.
The above observations demonstrate significant advantage of the proposed content-centric transmission design over the conventional user-centric transmission design for the considered content request model.
\begin{figure}[!htb]
\begin{centering}
\includegraphics[scale=.60]{multicast_unicast.eps}
\caption{\small{Performance comparison between multicast transmission and unicast transmission.}}\label{fig:multicast_unicast}
\end{centering}
\end{figure}
\subsection{Effectiveness of Smooth Approximation}
In this subsection we validate the effectiveness of the proposed smooth approximation. The ``global optimal'' solution (subject to the rank-1 condition) obtained by exhaustive search as mentioned in Section \ref{sec:P0} is considered as a benchmark. The cache-aware greedy BS clustering algorithm extended from \cite{usercentric_ICCC15} is also compared. Due to the significantly high computational complexity of the exhaustive search, we are only able to conduct the simulation in a small network with $N=3$ BS each having $L=3$ antennas, $K=6$ users, and $F=4$ files. The content popularity distributions are $\{ 0.48, 0.24, 0.16, 0.12\}$ and each BS only caches the $2$ most popular contents. The performance comparison is depicted in Fig.~\ref{fig:exhaust}. Here, the G-CCP algorithm with arctangent smooth function is simulated and each result is obtained by averaging over $200$ independent simulation trials.
\begin{figure}[h]
\begin{centering}
\includegraphics[scale=.45]{algorithmssmallscale.eps}
\caption{\small{Comparison between smooth approximation, greedy algorithm, and exhaustive search in a small network with $N=3$ BS, $K=6$ users, and $F=4$ files. }}\label{fig:exhaust}
\end{centering}
\end{figure}
From Fig.~\ref{fig:exhaust}, we observe that the performance of the smooth-function based sparse beamforming algorithm is very close to the global optimal solution, except having slightly higher minimum backhaul cost at $\eta\to 0$. This confirms the accuracy of the proposed smooth approximation at least in the considered small network. It is also observed that the greedy algorithm performs almost identically with the exhaustive search in the given scenario.
Note that when the number of base stations or users increases, the number of non-convex QCQP problems to solve in the exhaustive search and the greedy algorithm grows exponentially and quadratically, respectively, in general. However, these system parameters have no direct impact on the number of convex QCQP problems to solve in the proposed G-CCP algorithm.
\subsection{Effect of Peak Power Constraints}
Finally, we show the effect of the realistic per-antenna or per-BS peak power constraints as mentioned in Section III-A. We use the same simulation setting in Fig.~\ref{fig:alpha1} but with PopC, $K=30$ users, and one channel realization only for simplicity. The per-antenna peak power is set as 35dBm and 40dBm. The per-BS peak power is set to be $L$ (each BS has $L$ antennas) times of per-antenna peak power. It is observed from Fig.~\ref{fig:powerconstraned} that when $\eta$ is small (i.e., the backhaul has more weight), imposing peak power constraints suffers additional backhaul cost. More stringent peak power constraints result in higher minimum achievable backhaul cost. This is because the peak power constraints reduce the freedom to trade the total power for backhaul. It is also seen that when $\eta$ is large (i.e., the total transmit power has more weight), the given peak power constraints are mostly inactive and hence have little impact on the performance.
\begin{figure}[h]
\begin{centering}
\includegraphics[scale=.45]{powerconstraned.eps}
\caption{\small{Performance comparison under per-antenna constraints, per-BS constraints and no power constraint. }}\label{fig:powerconstraned}
\end{centering}
\end{figure}
\section{Conclusion} \label{section:Conclusion}
This paper investigates the joint design of content-centric BS clustering and multicast beamforming design in the cache-enabled cloud RAN for wireless content delivery. We first formulated an MINLP problem with the objective of minimizing the total network cost, modeled by the weighted sum of backhaul cost and transmit power cost, subject to the QoS constraint for each multicast group. %
Based on such problem formulation we have proved that all the BSs which cache the content requested by a multicast group can be always included in the BS cluster of this content, regardless of their channel conditions.
To make the problem more tractable, we reformulated the equivalent sparse beamforming design problem which takes the dynamic BS clustering inexplicitly. By adopting the smoothed $\ell_0$-norm approximation, we then converted the sparse beamforming problem into two forms of DC programs.
The first form has DC objective and convex constraints by using SDR approach and SDR-based CCP algorithm is introduced to find the local optimal solution.
The second DC program is in the general form with DC expressions in both objective and constraints, and is solved using the generalized CCP algorithm. Simulation results showed that the generalized-CCP based sparse beamforming algorithm outperforms the SDR-CCP based algorithm in both transmission power efficiency and computation efficiency. We also compared three heuristic caching strategies by simulation in the cache-enabled cloud RAN, random caching, popularity-aware caching, and probabilistic caching. It is shown that popularity-aware caching in general provides the best tradeoff curves between backhaul cost and transmit power cost. But in the extreme case where only backhaul cost is considered in the total network cost, the probabilistic caching outperforms the popularity-aware caching when user density is low. Last but not least, simulation results demonstrated that the proposed content-centric transmission (i.e. content-centric BS clustering and multicast beamforming) offers significant reduction in total network cost than the conventional user-centric design (i.e. user-centric BS clustering and unicast beamforming) under the considered content-request model.
This work can be viewed as an initial attempt from the physical layer toward the design of content-centric wireless networks. There are many interesting directions to pursue based on this work. For instance, the problem formulation in this work assumes that the content placement is given and fixed. As observed by simulation, the performance of the considered heuristic caching strategies depends on not only the content popularity,
but also the user density as well as the network optimization objective. As such, it is of particular importance to investigate the globally optimal caching strategy through the joint design of mixed timescale cache placement/replacement and content delivery. In addition, the proposed sparse multicast beamforming algorithms are centralized and may be difficult to implement in very large networks. To be more practical in cloud RAN architectures with large number of users, low-complexity or distributed implementation of these algorithms is greatly desired.
\section*{Appendix A: Proof of Proposition \ref{Proposition-P1} }
Assume that the content requested by user group $m^\ast$ is already cached in BS $n^\ast$, i.e., $c_{f_{m^\ast},n^\ast}=1$. Consider an arbitrary BS clustering matrix $\mathbf{S}'$ with $ s'_{m^\ast,n^\ast} = 0$. The minimum total network cost incurred by the given $\mathbf{S}'$ is denoted as $C'_N = C'_B + \eta C'_P$, where $C_B'$ is determined by \eqref{eqn:backhaul cost} with the summation term $s_{m^\ast,n^\ast}(1-c_{f_{m^\ast}, n^\ast})R_{m^\ast}$ being zero, and $C'_P$ is the optimal solution of the following power minimization problem at given $\mathbf{S}'$
\begin{subequations}
\begin{align}
\mathcal{P}(\mathcal{Z}_{\mathbf{S}'}): ~C'_P=\mathop{\text{minimize}}_{ \{ \mathbf{w}_{m,n}\} } \quad & \sum_{m=1}^M \sum_{n=1}^N \lVert \mathbf{w}_{m,n} \rVert_2^2 \\
\text{subject to} \quad &\eqref{eqn:SINR-constraint} \nonumber \\
& \mathbf{w}_{m,n} = 0,~\forall (m,n) \in \mathcal{Z}_{\mathbf{S}'} \label{eqn:P1-cluster}
\end{align} \label{eqn:power-minimization-P1}
\end{subequations}
Here, $\mathcal{Z}_{\mathbf{S}'}$ is the set of inactive BS-content associations at given $\mathbf{S}'$, i.e., $\mathcal{Z}_{\mathbf{S}'} = \{ (m,n)| [\mathbf{S}']_{m,n}=0\}$. Obviously we have $(m^\ast,n^\ast) \in \mathcal{Z}_{\mathbf{S}'}$.
Now, define a new BS clustering matrix $\mathbf{S}''$ which only differs from $\mathbf{S}'$ at the $(m^\ast,n^\ast)$-th element, i.e., $s''_{m^\ast,n^\ast}=1$. Then the minimum total network cost incurred by $\mathbf{S}''$ can be written as $C''_N = C''_B + \eta C''_P$. Here, $C''_B$ is also determined by \eqref{eqn:backhaul cost} with the summation term $s_{m^\ast,n^\ast}(1-c_{f_{m^\ast}, n^\ast})R_{m^\ast}$ being zero again due to $c_{f_{m^\ast}, n^\ast}=1$ and hence one has $C''_B=C'_B$. $C''_P$ is the optimal solution of the following power minimization problem at given $\mathbf{S}''$
\begin{subequations}
\begin{align}
\mathcal{P}(\mathcal{Z}_{\mathbf{S}''}):~C''_P=\mathop{\text{minimize}}_{ \{ \mathbf{w}_{m,n}\} } \quad & \sum_{m=1}^M \sum_{n=1}^N \lVert \mathbf{w}_{m,n} \rVert_2^2 \\
\text{subject to} \quad &\eqref{eqn:SINR-constraint} \nonumber \\
& \mathbf{w}_{m,n} = 0,~\forall (m,n) \in \mathcal{Z}_{\mathbf{S}''} \label{eqn:P2-cluster}
\end{align} \label{eqn:power-minimization-P2}
\end{subequations}
By definition, the set of inactive BS-content association at $\mathbf{S}''$ satisfies:
\begin{equation}
\mathcal{Z}_{\mathbf{S}''} = \mathcal{Z}_{\mathbf{S}'} \backslash (m^\ast,n^\ast). \label{eqn:cluster_set}
\end{equation}
By observing $\mathcal{P}(\mathcal{Z}_{\mathbf{S}'})$ and $\mathcal{P}(\mathcal{Z}_{\mathbf{S}''})$ closely, it is clear that the feasible set of $\mathcal{P}(\mathcal{Z}_{\mathbf{S}'})$ is only a subset of that of $\mathcal{P}(\mathcal{Z}_{\mathbf{S}''})$ due to \eqref{eqn:cluster_set}. Therefore, we have $C'_P \geq C''_P$. Together with $C'_B = C''_B$, we obtain that the two total network costs satisfy $C'_N \geq C''_N$.
This means that, for any BS clustering matrix $\mathbf{S}'$ with $s'_{m^\ast,n^\ast} = 0$, we can always find another BS clustering matrix $\mathbf{S}''$ with $s''_{m^\ast,n^\ast} = 1$ such that it can achieve a total network cost no larger than that of $\mathbf{S}'$. Therefore, without loss of optimality, one can set $s_{m^\ast,n^\ast} = 1$ in $\mathcal{P}_0$.
\bibliographystyle{IEEEtran}
| {'timestamp': '2016-06-07T02:13:33', 'yymm': '1512', 'arxiv_id': '1512.06938', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06938'} | arxiv |
\section{Introduction}
\label{sec:introduction}
Given a 2D image, we would like to understand the scene it captures. This involves identifying the objects present in the scene and their spatial extent. This can be done purely in 2D by solving the semantic image segmentation problem (labeling every pixel of the image as belonging to a certain class). However, this is not very informative if say we want to drive an autonomous car without hitting other cars on the road. To a certain extent, true scene understanding requires us to reason about the 3D object shape and scene layout.
In this paper, we present a small step toward solving this extremely challenging problem. Given a single image, such as that shown in the left of Figure \ref{fig:sample-result}, we concentrate on the problem of segmenting the car (car vs. background) and estimating its 3D pose. Instead of treating 2D segmentation and 3D pose estimation as individual problems, we develop new CRF models for solving both tasks. Our first contribution is to introduce new CRF potentials for semantic segmentation that depend on a 3D object category model. In particular, we use the 3D wireframe model introduced in \cite{Yoruk:3DRR13}, which generalizes 2D HOG features \cite{Dalal:CVPR05} to 3D. Specifically, the wireframe model is a collection of 3D points, edges, and surface normals that, when rotated, translated, and projected, resemble a 2D HOG template. Given a wireframe model, we construct two top-down categorization potentials, called respectively the shape and volume costs, which measure how well:
\begin{enumerate}[topsep=2pt,itemsep=-1ex,partopsep=1ex,parsep=1ex]
\item The projected wireframe model matches the HOG features inside the segment corresponding to the object.
\item The projection of the volume occupied by the wireframe model matches the area occupied by the object in the image (and similarly for the background).
\end{enumerate}
\begin{figure}
\centering
\includegraphics[width=0.35\columnwidth]{f/pose-det-5}
\includegraphics[width=0.35\columnwidth]{f/seg_det_5}
\caption{3D model superimposed in image and 2D segmentation.}
\label{fig:sample-result}
\centering
\includegraphics[width=0.7\linewidth,clip=true,trim=40 60 0 0]{f/wireframe}
\caption{Wireframe model of the class car (taken from \cite{Yoruk:3DRR13}). A single edge primitive consists of the point location (in green), edge direction (in black) and two surface normals (in red and blue).}
\label{fig:models-wireframe}
\vspace{-4mm}
\end{figure}
Notice that both costs depend on the 2D segmentation and the 3D object pose. Therefore, the joint 2D segmentation and 3D object pose estimation tasks require the minimization of this energy (properly augmented with standard bottom-up segmentation costs). The energy minimization problem is a challenging mixed continuous and discrete optimization problem, where the energy is non-convex and non-smooth with respect to the pose variables. Our second contribution is to propose an algorithm for solving this problem. In particular, when the object pose is fixed, we show that the top-down costs can be decomposed into standard unary and pairwise terms allowing for efficient image segmentation. Conversely, when the segmentation is fixed, we show that the pose estimation problem, while non-convex and non-smooth, can be efficiently solved using a Branch and Bound (B\&B) algorithm. In particular, we exploit the geometry of the pose space to derive efficiently computable bounds for the shape and volume costs. While the joint segmentation and pose estimation problem could, in principle, proceed in an alternating minimization manner, a key challenge is that B\&B does not produce an exact pose estimate, but rather an optimal pose cell. Therefore, if one chooses an arbitrary pose in the optimal cell, the cost function is not guaranteed to decrease and alternating minimization might fail. We address this issue through a simple pose cell refinement procedure, which guarantees a decrease of the cost. Figure \ref{fig:sample-result} shows the output of our method for one image, where the 3D model is superimposed in the image to visualize its pose. Our experiments on a car dataset will show how segmentation information can be used to improve pose estimation and vice versa.
\section{Related Work}
\label{sec:related-work}
3D pose estimation and image segmentation are very old problems, which have been studied in great detail. We thus restrict our review to the most relevant literature.
The CRF model for image segmentation proposed in \cite{Shotton:CVPR08, ShottonJ2006-ECCV} is defined on a pixel graph and uses costs based on shape, texture, color, location and edge cues.
\cite{Ladicky:ICCV09, Russell:ECCV10} extended the CRF approach to include long-range interactions between non-adjacent nodes in the graph by using costs defined over larger cliques and in a hierarchical manner.
\cite{Fulkerson:ICCV09} extended the CRF approach to a superpixel graph, where an energy consisting of unary and pairwise potentials captures appearance over superpixel neighbourhoods and local interactions between adjacent superpixels.
\cite{Singaraju:CVPR11,Jain:ECCV12} also introduced new top-down costs based on the bag-of-features classifier \cite{Csurka:ECCV04}, which captures interactions between all regions of an image that have the same label.
However, while the top-down costs described above involve large cliques, they are not truly global in the sense that they do not reason at the object or image level (much larger cliques). New top-down costs based on 2D object models can be used instead like in \cite{Yao:CVPR12, Ladicky:ECCV10-detector, Singaraju:ACCV12, Fidler:CVPR13, Dong:ECCV14, Lazebnik:CVPR13}. All these works use the output of object detectors like Deformable Part Models (DPM) \cite{Felzenszwalb:CVPR08,voc-release5} or Exemplar SVM \cite{Malisiewicz:ICCV11} as part of the energy function. Some \cite{Gould:NIPS09, Dong:ECCV14,Singaraju:ACCV12, Yao:CVPR12} also use 2D shape priors to capture object information. These capture longer interactions between different parts of the image and reason at the object level. However, the object models/shape priors used are 2D and hence viewpoint-dependent.
3D object models have been used for fine pose estimation and have shown to improve 2D detection also significantly. They are mainly of three kinds: obtained by combining 2D object detectors \cite{Schneiderman:CVPR04, Thomas:CVPR06}, extending 2D object detectors to 3D \cite{Savarese-FeiFei:ICCV07, Savarese-FeiFei:ECCV08} or explicit 3D representations \cite{Hu-Zhu:CVPR10, Liebelt-Schmid:CVPR10,Yoruk:3DRR13}. However very few algorithms, like level-set based methods \cite{Sandhu:CVPR09, Dambreville:ECCV08}, use 3D object models for image segmentation. 3D models are very commonly used for segmenting 3D point clouds (robotics) and medical images. But our approach differs from these in that we formulate both pose estimation and image segmentation as energy minimization problems rather than geometric, registration based problems.
\section{CRF Models for 3D Pose Estimation and 2D Image Segmentation}
\label{sec:models}
A CRF-based approach to image segmentation involves defining a graph $\mathcal{G} = (\mathcal{V},\mathcal{E})$ over the image and an energy on the graph. The image segmentation is then obtained as the labelling that minimizes the energy. We often define $\mathcal{V}$ as the set of all superpixels in the image and $\mathcal{E}$ indicates an edge between two superpixels that share a boundary. A standard energy function defined on this graph is given by
\begin{equation}
\!\! E^{u+p}(X;I) \!=\! w_1 \!\sum_{i \in \mathcal{V}} \phi_i(x_i;I) + w_2 \!\!\sum_{(i,j) \in \mathcal{E}} \!\!\psi_{ij}(x_i,x_j;I).\!\!
\label{eqn:u+p}
\end{equation}
The unary term $\phi_i(x_i;I)$ captures the likelihood of a superpixel being assigned a class label, \ie, $\phi_i(x_i;I)$ is the cost of assigning label $x_i$ to superpixel $i$. These are usually appearance based and are often the score of a classifier applied to features extracted from the superpixel. Hence, they predict the class label of a superpixel without using any additional information. The pairwise term $\psi_{ij}(x_i,x_j;I)$ is a smoothing term, which penalizes assigning different labels to two adjacent superpixels that have a similar appearance.
The main disadvantage of using $E^{u+p}$ for segmentation is that the unary and pairwise terms are local in nature as they capture only the interactions between adjacent superpixels. To capture higher order information and long-range interactions between different parts of an object, we often need top-down object categorization costs. In \S \ref{sec:shape-cost} and \S\ref{sec:volume-cost}, we present two new top-down costs that capture such long range interactions using 3D object models. The first one is a \emph{shape cost} that measures how well the projection of the object's 3D shape matches its 2D appearance, and the second is a \emph{volume cost} that measures how well the projection of the object's 3D volume matches its 2D segmentation. Before presenting these new top-down costs, we need to discuss the 3D object model used to construct them.
\subsection{The Wireframe Model}
\label{sec:models-wireframe}
The 3D wireframe model (shown in Figure \ref{fig:models-wireframe}) was introduced in \cite{Yoruk:3DRR13} for the tasks of 2D object detection and 3D pose estimation. The model is a generalization of the 2D HOG features \cite{Dalal:CVPR05} to 3D in which the object is represented as a set of 3D edge primitives $\mathcal{M} = \left \{ p^m, e^m, n_1^m, n_2^m \right \}_{m=1}^M$, where $p^m$ is the location of the primitive in 3D in an object coordinate system, $e^m$ is the 3D edge direction at that point, and $n_1^m$ and $n_2^m$ are the two surface normals at point $p^m$. In \cite{Yoruk:3DRR13}, a car wireframe model was learned from car blueprints in 4 canonical directions (top, front, back and side). Given the model, the car's 3D pose in an image is estimated by maximizing a score that measures how well the projection of the model at a given pose matches the extracted 2D HOG features. The maximization is done using B\&B
More specifically, the score $f(T,z;I)$ for estimating the pose $T$ (rotation and translation of the object with respect to the camera) of an object of class $z$ in image $I$ is given by
\begin{align}
\label{eqn:original-det-cost}
f^{det}(T,z;I) = \sum_{m=1}^{M_z} \nu(p^m_z, n_{1_z}^m,n_{2_z}^m|T) \mathcal{H}(r^m(T,z)).
\end{align}
Here, $M_z$ is the total number of primitives in a model for class $z$. $\nu(p^m_z, n_{1_z}^m,n_{2_z}^m|T)\in\{0,1\}$ measures whether the 3D primitive is visible or not. A primitive is considered visible in the image if at least one of its surface normals is opposite to the viewing direction. $\mathcal{H}$ are normalized quantized HOG features \cite{Yoruk:3DRR13} extracted from image $I$, where $r^m(T,z) = (u(p^m_z|T), v(p^m_z|T), w(p^m_z, e^m_z|T))$ is the index of the HOG bin to which the $m$-th primitive is projected under pose $T$. The spatial index $(u,v)$ depends only on the 3D location $p_z^m$ but the orientation index $w$ depends also on the 3D edge direction $e_z^m$. The score simply projects each 3D edge primitive onto the image and adds the HOG score at the projected location if that primitive is visible.
\subsection{Shape Cost}
\label{sec:shape-cost}
We extend the wireframe model to use segmentation information. We do this by defining a {\it shape score} that is identical to the matching score defined in Eqn.~\eqref{eqn:original-det-cost}, except that now we use only HOG features extracted from regions in the image that belong to the desired class. Let $s^m(T,z)$ be the index of the superpixel containing the projected location of the $m$-th 3D primitive of model $z$ under pose $T$. Note that $r$ and $s$ are related such that, if $r = (u,v,w)$, then $s$ is the superpixel containing $(u, v)$. The shape score is defined as
\begin{equation}
\!\!
f^{seg}(X,T,z;I) = \sum_{m=1}^{M_z} \bar{\mathcal{H}}(r^m(T,z)) \delta(x_{s^m(T,z)}=z),
\label{eqn:modified-det-cost}
\end{equation}
where we write $\bar{\mathcal{H}} = \nu \mathcal{H}$ from Eqn.~\eqref{eqn:original-det-cost} to simplify notation and the $\delta$-Dirac term takes the segmentation into account.
The shape score in Eqn.~\eqref{eqn:modified-det-cost} is combined with the standard CRF energy defined in Eqn.~\eqref{eqn:u+p} to get the {\bf shape model}
\begin{align}
E^{shape}(X,T,z;I) = E^{u+p}(X) - w_3 f^{seg} (X,T,z).
\label{eqn:shape-model}
\end{align}
The additional shape cost (negative of shape score) aims to minimize the energy with a higher matching score between the edges in the model and those in the image.
\subsection{Volume Cost}
\label{sec:volume-cost}
The shape cost measures how well the 3D edges of the wireframe model match 2D HOG features. However, it is often not enough to just match the edges/boundaries and we also need to match the interior regions. This can be done by measuring the compatibility of the segmentation $X$ with the 2D segmentation induced by the 3D volume corresponding to the pose of the object. For example, we can measure the area of their intersection, $|X \cap \pi(T,z)|$, where $\pi(T,z)$ is a hull of the projection of the wireframe model of class $z$ at pose $T$.\footnote{In what follows we simply use $\pi$ to indicate $\pi(T,z)$ for easy reading.} Notice, however, that the intersection alone is not a good metric as it can be maximized by either assigning all superpixels to the foreground, or choosing the object's pose arbitrarily close to the camera so that the 3D model projects to the whole image.
To address this issue, we also include the term $|X^c \cap \pi^c|$, which measures the area of the intersection for the background. The {\bf volume model} is then:
\begin{align}
E^{volume}(X,T,z;I) &= E^{u+p}(X) - w_3 f^{seg} (X,T,z) \nonumber \\
& - w_4 |X \cap \pi| - w_5 |X^c \cap \pi^c|.
\label{eqn:volume-model}
\end{align}
where we call both $|X \cap \pi|$ and $|X^c \cap \pi^c|$, as the volume cost.
As an alternative to the sum of the intersections, we could have used the intersection over union metric. However, the sum of the intersections is easier to optimize, as we will see.
\section{Pose Estimation and Image Segmentation}
\label{sec:inference}
Given the model and its parameters, we would like to estimate the image segmentation $X$ and 3D pose $T$. This is equivalent to solving the following optimization problem
\vspace{-1mm}
\begin{equation}
(\hat{X},\hat{T}) = \operatorname*{argmin}_{X,T} E(X,T,z;I),
\label{eqn:joint-inference}
\end{equation}
where we do not solve for $z$ as we restrict ourselves to cars. In principle, this is a challenging mixed continuous and discrete optimization problem, where the energy is non-convex and non-smooth with respect the pose variables. Nonetheless, we show that this problem can be tackled using alternating minimization, where we estimate 3D pose given current segmentation, and then estimate segmentation given 3D pose till we reach convergence, \ie,
\begin{align}
T^{n+1} &= \operatorname*{argmin}_T E(X^n, T, z; I) \label{eqn:pose-given-seg} \\
X^{n+1} &= \operatorname*{argmin}_X E(X,T^{n+1},z;I). \label{eqn:seg-given-pose}
\end{align}
We now discuss how to solve each sub-problem
for the two models (shape model and volume model).
\subsection{Segmentation Given Pose}
\label{sec:inference-seg_given_pose}
The approach we use to solve Eqn.~\eqref{eqn:seg-given-pose} is to reformulate the energy into standard unary and pairwise terms, so that we can minimize it efficiently using graph cuts \cite{Boykov:PAMI01,Boykov:PAMI04}. More specifically, we show that the shape cost and volume costs can be decomposed into standard unary and pairwise terms.
\myparagraph{Shape cost} Let $r=(u,v,w)$ denote an arbitrary HOG bin, where $(u,v)$ denotes the pixel coordinates and $w$ is the orientation bin. Let $s$ be the superpixel corresponding to pixel $(u,v)$ and recall that $r^m(T,z)$ is the HOG bin associated with the $m$-th primitive projected under pose $T$.
We can rewrite Eqn.~\eqref{eqn:modified-det-cost} in terms of
$(u,v,w)$ to get Eqn.~\eqref{eqn:fseg-decomp1}.
Summing over $m$ and $w$ first, we get Eqn.~\eqref{eqn:fseg-decomp2} and then the sum over all pixels in the image is rewritten using superpixels \{$S_i$\}. Since, we assign the same label to all pixels inside a superpixel, we replace the $\delta(x_{s}=z)$ term with $\delta(x_i=z)$ for the i-th superpixel. This shows that $f^{seg}$ for a given pose $T$ can be written down as a
unary term as per Eqn.~\eqref{eqn:fseg-decomp-final}.
\vspace{-1mm}
\begin{align}
&\!\!\!
f^{seg}(X,T,z;I) = \sum_{m=1}^{M_z} \bar{\mathcal{H}}(r^m(T,z)) \delta(x_{s^m(T,z)}=z) \nonumber \\
&\!\!\! = \!\sum_{m=1}^{M_z} \!\sum_{u,v,w} \!\! \bar{\mathcal{H}}(u,v,w) \delta((u,v,w) \!=\! r^m(T,z)) \delta(x_{s} \!=\! z) \!\!\label{eqn:fseg-decomp1}\\
&\!\!\! =\! \sum_{u,v} \mathcal{H}_1(u,v) \delta(x_{s}=z) \label{eqn:fseg-decomp2} \\
&\!\!\! =\! \sum_{i \in \mathcal{V}} \sum_{(u,v) \in S_i} \!\!\! \mathcal{H}_1 (u,v) \delta(x_{s} \!=\! z)
\!=\! \sum_{i \in \mathcal{V}} \mathcal{H}_2 (i) \delta(x_i \!=\! z).\!\!\! \label{eqn:fseg-decomp-final}
\end{align}
\myparagraph{Volume cost} For the volume cost, we have the terms $| X \cap \pi|$ and $|X^c \cap \pi^c|$. These are easily decomposed into pairwise terms between $X$ and $z$ as per the following equations:
\vspace{-2mm}
\begin{align}
|X \cap \pi(T,z)| &= \sum_{i \in \mathcal{V}} |S_i \cap \pi(T,z)| \delta(x_i = z), \label{eqn:acc1-decomp} \\
|X^c \cap \pi^c(T,z)| &= \sum_{i \in \mathcal{V}} |S_i \cap \pi^c(T,z)| \delta(x_i \neq z). \label{eqn:acc2-decomp}
\end{align}
\subsection{Pose Given Segmentation}
\label{sec:inference-pose_given_seg}
As we will show below, we can reformulate the pose-given-segmentation sub-problem in Eqn.~\eqref{eqn:pose-given-seg} as a maximization problem of the form: $\hat{T} = \operatorname*{argmax}_{T \in \mathbb{T}} f(T,X,z;I)$ with corresponding score $f$. This is a highly non-convex problem with a large search space. Prior work \cite{Yoruk:3DRR13} used a B\&B strategy to address the pose estimation without any segmentation information, which involves maximizing $f = f^{det}$ in Eqn.~\eqref{eqn:original-det-cost}. More generally, B\&B algorithms have been used extensively in the computer vision literature \cite {Lampert:PAMI09, Kokkinos:NIPS11, Schwing:ECCV12, Sun:AISTATS12} to obtain the global maxima of non-convex problems in an efficient manner. The key idea behind B\&B methods is to start with the whole search space and successively refine it while maintaining a priority queue of candidate solutions till the desired resolution is achieved. Each solution corresponds to a region in the search space, which we refer to as a pose cell. The queue is maintained using the upper bound of the score in each cell. This works because a pose cell containing the global maxima is expected to have a higher upper-bound compared to other cells. We refer the reader to \cite{Yoruk:3DRR13} for more details on how B\&B is applied to the pose estimation task without any segmentation information. The key takeaway for us is that we can find the global maxima efficiently as long as we can find an upper bound $\bar{f}$ for any given pose cell $\mathbb{T}$ in the search space. This corresponds to Eqn.~\eqref{eqn:upper-bound}. In our case, the pose $T$ consists of the azimuth $a$, the elevation $b$, the camera-tilt $c$, the depth $d$ and a 2D translation in the image plane $(u,v)$. A corresponding pose cell $\mathbb{T}$ is then of the form $\mathbb{T} = [a_1,a_2] \times [b_1,b_2] \times [c_1,c_2] \times [d_1,d_2] \times [u_1,u_2] \times [v_1,v_2]$.
\begin{equation}
\!\!\!\bar{f} \geq \max_{T \in \mathbb{T}} f(T) =\!\! \max_{(a,b,c,d,u,v) \in \mathbb{T}} f(T\!=\!(a,b,c,d,u,v)).\! \!
\label{eqn:upper-bound}
\end{equation}
\begin{figure}[b]
\centering
\begin{subfigure}[b]{0.45\linewidth}
\includegraphics[width=\linewidth]{f/ub1_1}
\caption{$X$}
\label{fig:ub1_seg}
\end{subfigure}
~
\begin{subfigure}[b]{0.45\linewidth}
\includegraphics[width=\linewidth]{f/ub1_2}
\caption{combined mask}
\label{fig:ub1_mask}
\end{subfigure}
\caption{Computing upper bound of $|X \cap \pi(T)|$.}
\label{fig:ub1}
\end{figure}
\myparagraph{Shape model}
Solving Eqn.~\eqref{eqn:pose-given-seg} for the shape model is equivalent to solving the following problem:
\begin{align}
\hat{T} &= \operatorname*{argmin}_T E^{shape}(X,T,z; I) \nonumber \\
&= \operatorname*{argmin}_T E^{u+p}(X;I) - w_3 f^{seg} (X,T,Z) \nonumber \\
&= \operatorname*{argmax}_T f^{seg}(X,T,Z). \label{eqn:shape-pose-given-seg}
\end{align}
This problem is identical to the one solved in \cite{Yoruk:3DRR13} except that now we have the HOG features extracted only from the foreground because of the $\delta(x_{s^m(T)}=z)$ term in Eqn.~\eqref{eqn:modified-det-cost}.
\myparagraph{Volume model}
Solving Eqn.~\eqref{eqn:pose-given-seg} for the volume model gives us Eqn.~\eqref{eqn:volume-pose-given-seg} where $\lambda_1 = \frac{w_4}{w_3}$ and $\lambda_2= \frac{w_5}{w_3}$.
\begin{align}
\hat{T} &= \operatorname*{argmin}_T E^{volume}(X,T,z; I) \nonumber \\
&= \operatorname*{argmin}_T E^{u+p}(X;I) - w_3 f^{seg}(X,T,z) \nonumber \\
& \hspace{4em}- w_4 |X \cap \pi(T,z)| - w_5 |X^c \cap \pi^c(T,z)| \nonumber \\
&= \operatorname*{argmax}_T f^{seg}(X,T,Z) + \lambda_1 |X \cap \pi(T,z)| \nonumber \\
&\hspace{4em} + \lambda_2 |X^c \cap \pi^c(T,z)| \label{eqn:volume-pose-given-seg}
\end{align}
We can define the upper bound $\bar{f^{vol}}$ as the sum of bounds over each of the three terms individually, \ie,
\begin{align}
\bar{f^{vol}} & \geq \max_{T \in \mathbb{T}} f^{seg}(T) + \lambda_1 \max_{T \in \mathbb{T}} |X \cap \pi(T)| \nonumber \\
&+ \lambda_2 \max_{T \in \mathbb{T}} |X^c \cap \pi^c(T)|.
\end{align}
We now discuss how to find bounds for each term.
\mysubparagraph{First term}
The first term is identical to the one in the shape model and its upper bound is computed the same way.
\mysubparagraph{Second term}
Given a cell $\mathbb{T} = [a_1,a_2] \times [b_1,b_2] \times [c_1,c_2] \times [d_1,d_2] \times [u_1,u_2] \times [v_1,v_2]$, we want to find an upper bound for the overlap $|X \cap \pi(T)|$ between the segmentation, $X$, and the projection of the car, $\pi(T)$. Higher overlap is obtained if the projected car is bigger, so we choose the parameters $(\hat{a},\hat{b},\hat{c},\hat{d})$ to maximize the projection of the car. The car is bigger when viewed from the side, so we choose $\hat{a}=0$, $-180$ or $180$ if it lies in $[a_1, a_2]$, or else $\hat{a} = a_1, a_2$, whichever is closest to $0$, $-180$ or $180$. A larger car is observed also from a higher elevation, so we choose $\hat{b} = \max(b_1,b_2)$. A bigger car is observed also when it is closer to the camera, so we choose $\hat{d}=\min(d_1,d_2)$. The camera tilt $c$ does not affect car size and is chosen as $\hat{c}=\min(c_1,c_2)$. Once, we obtain $(\hat{a},\hat{b},\hat{c},\hat{d})$, we project it onto the image at $(u,v) = [(u_1,v_1), (u_1,v_2), (u_2,v_1), (u_2,v_2)]$ to get four masks. These are combined together to get Figure \ref{fig:ub1_mask}. The green rectangle bounds the spatial extent in which the projection might lie in pose cell $\mathbb{T}$.
Now, the problem is to find a bound of the overlap allowing all possible projections inside the green rectangle. This is the same as finding an overlap between the rectangle and the circle in Figure \ref{fig:ub_comp}, where the circle is allowed to lie anywhere inside the green boundary. Let $s_1$ be the number of pixels in the rectangle inside the boundary (shown in orange color) and $s_2$ be the number of pixels in the circle. An upper bound on the intersection $|orange \cap blue|$ is obtained as the minimum of these two numbers. This is depicted in the two rectangles with orange and blue bars indicating the number of foreground pixels of each figure inside the green boundary. We use the green rectangle and the segmentation $X$ (Figure \ref{fig:ub1_seg}) to get score $s_1$.
Choosing $(u,v)=(0,0)$ and projecting onto the image gives us a mask of the largest projected car. $s_2$ is the number of foreground pixels in this mask. The desired bound on $|X \cap \pi(T)|$ is $\min(s_1,s_2)$.
\begin{figure}[h]
\centering
\begin{subfigure}[b]{0.45\linewidth}
\includegraphics[width=\linewidth]{f/ub_comp_1}
\end{subfigure}
~
\begin{subfigure}[b]{0.45\linewidth}
\includegraphics[width=\linewidth]{f/ub_comp_2}
\end{subfigure}
\caption{Bound computation (best seen in color).}
\label{fig:ub_comp}
\end{figure}
\vspace{-3mm}
\mysubparagraph{Third term}
Note that an upper bound for this term can be obtained from a lower bound for the union term $|X \cup \pi(T)|$:
\begin{align}
\max_{T \in \mathbb{T}} |X^c \cap \pi^c(T)| &= \max_{T \in \mathbb{T}} \left ( |I| - |X \cup \pi(T)| \right ) \nonumber \\
&= |I| - \min_{T \in \mathbb{T}} |X \cup \pi(T)|.
\end{align}
To minimize the union between $X$ and $\pi(T)$ we need the smallest possible projection of the car. This is obtained by choosing the parameter $\tilde{a} = -90,90$ if it lies in $[a_1,a_2]$ or choosing from $a_1,a_2$ whichever is closest to one of $-90,90$. $\tilde{b}=\min(b_1,b_2)$, $\tilde{c}=\min(c_1,c_2)$ and $\tilde{d}=\max(d_1,d_2)$ are chosen to get the smallest projection. A similar procedure to the one described for the intersection term is followed (shown in Figure \ref{fig:ub2}). The difference now is that we want to minimize the union. Let $s_3$ be the number of foreground pixels outside the green rectangle, $s_4$ be the number of foreground pixels inside the blue rectangle in segmentation $X$, and $s_5$ be the number of foreground pixels in the projected model at $(\tilde{a},\tilde{b},\tilde{c},\tilde{d},0,0)$. The smallest union is obtained when one lies completely inside the other and is given by $\max(s_4, s_5)$ to give the lower bound on the union as $s_3 + \max(s_4,s_5)$. The corresponding upper bound on $|X^c \cup \pi^c(T)|$ is $|I| - [s_3 + \max(s_4,s_5)]$.
\vspace{-2mm}
\begin{figure}[h]
\centering
\begin{subfigure}[b]{0.45\linewidth}
\includegraphics[width=\linewidth]{f/ub2_1}
\caption{X}
\label{fig:ub2_seg}
\end{subfigure}
~
\begin{subfigure}[b]{0.45\linewidth}
\includegraphics[width=\linewidth]{f/ub2_2}
\caption{combined mask}
\label{fig:ub2_mask}
\end{subfigure}
\caption{Computing lower bound of $|X \cup \pi(T)|$.}
\label{fig:ub2}
\end{figure}
\vspace{-4mm}
\myparagraph{Bound Analysis} The upper bounds discussed here are based on the simple inequalities $|A \cap B| \leq \min(|A|,|B|)$ and $|A \cup B| \geq \max(|A|,|B|)$. For an empirical analysis of how tight these bounds actually are (short answer: pretty tight), we refer the reader to supplementary material.
\section{Learning the model parameters}
\label{sec:learning}
We need to learn the parameters of the energy functions $E^{shape}$ and $E^{volume}$. In our case, the energy functions are linear in their parameters $w$, \ie, $E^{shape} = w_{shape}^T \Psi^{shape}$ and $E^{volume} = w_{volume}^T \Psi^{volume}$. We follow the max-margin approach to learn the parameters as:
\vspace{-2mm}
\begin{align}
\label{eqn:learning}
& w = \operatorname*{argmin}_{w\geq 0} \frac{\lambda}{2}\|w\|_2^2 + \frac{1}{N} \sum_{i=1}^N \xi_i ~~\text{s.t.} ~~ \forall (i, X_i, T_i), \nonumber \\
& E(X_i,T_i) - E(X_i^*,T_i^*) \geq \Delta(X_i,X_i^*,T_i,T_i^*) - \xi_i.\!
\end{align}
Here, $X_i^*$ and $T_i^*$ are the ground truth segmentation and ground truth pose of image $i$ respectively, $X_i$ is any possible segmentation and $T_i$ is any possible pose. The optimization problem in Eqn.~\eqref{eqn:learning} is similar to the Structural SVM problem \cite{Tsochantaridis:JMLR05, Joachims:JMLR09} and we solve it using the Block Coordinate Frank Wolfe algorithm \cite{Julien:JMLR13}. The only difference from the standard Structural SVM problem is that we need non-negative weights. This is to keep the energy function sub-modular (for efficient inference using graph cuts). Non-negativity is enforced by adding a thresholding step in the algorithm described in \cite{Julien:JMLR13}. Now, since the number of constrains in Eqn.~\eqref{eqn:learning} is exponentially large, it is customary to solve the problem by adding one constraint at a time. We find the most violated constraint by solving a loss-augmented inference problem which is identical to the optimization problems shown in \S\ref{sec:inference-seg_given_pose} except that we now have additional unary terms introduced by the loss function $\Delta(X,X^*,T,T^*)=\Delta_1(X,X^*)+\Delta_2(T,T^*)$. We use the standard hamming loss for the segmentations and azimuth error loss ($\frac{\min( |a-a^*| ,360^\circ-|a-a^*| )}{360^\circ}$) for the pose.
\section{Results}
\label{sec:results}
We report results on three sets of experiments to demonstrate the power of our proposed models:
\begin{enumerate}[topsep=2pt,itemsep=-1ex,partopsep=1ex,parsep=1ex]
\item Estimate segmentation given ground truth pose.
\item Estimate pose given ground truth segmentation.
\item Estimate both pose and segmentation using the alternating minimization (AM) procedure in Eqns.~\eqref{eqn:pose-given-seg}-\eqref{eqn:seg-given-pose}.
\end{enumerate}
The first two sets of experiments aim to verify our hypothesis: knowledge of segmentation can help improve pose estimation and knowledge of pose can help improve segmentation, while the third one applies our models to data without any ground truth information and evaluates performance.
\myparagraph{Datasets}
\label{sec:results-dataset}
We fix object class label $z$ to the class `car'. Therefore, the problem is to segment the image into car regions (foreground) and non-car regions (background).
We use the Pascal VOC dataset, which has annotations for both image segmentations and 3D fine pose. Pose annotations for Pascal VOC2011 images were provided as part of the Pascal 3D+ dataset \cite{Xiang:WACV14}. Image segmentations were obtained from the Semantic Boundary dataset \cite{Hariharan:ICCV2011}, which annotated all Pascal VOC2012 trainval images. We use the splits recommended for the Pascal VOC2011 challenge and use the val data for testing. Restricting ourselves to just car images that have one car, we have 670 images in total with 504 images for training and 166 images for testing. We also test the pose estimation given ground-truth segmentation experiments on 480 car images of the 3DObject dataset \cite{Savarese-FeiFei:ICCV07}.
\myparagraph{Object model} We use the car wireframe model $\mathcal{M}$ from \cite{Yoruk:3DRR13}, which was trained using 10 blueprints of sedan cars.
\myparagraph{Projection} We use alpha-shapes with the circumradius as the $95^{th}$ percentile of the edges in the Delaunay triangulation to generate $\pi(T)$. This is closer to how a car looks compared to a convex-hull, which discards the car's shape.
\myparagraph{Superpixel Graph} Superpixels were generated by the Quickshift algorithm \cite{ComaniciuD2002-PAMI, Vedaldi:ECCV08-qs} using the VL-feat library \cite{vedaldi:vlfeat}.
\myparagraph{Bottom-up potentials} The unaries $\phi_i(x_i;I)$ are learnt using Textonboost \cite{Shotton:IJCV09} (code provided by densecrf \cite{Krahenbuhl:NIPS11}). We do not use the DPM detector output, as recommended, to generate purely bottom up unaries. A standard pairwise potential of the form $\psi_{ij}(x_i,x_j;I) = \frac{L_{ij}}{1+\gamma \|I_i - I_j\|} \delta(x_i \neq x_j)$ is used. Here, $L_{ij}$ is the length of the common boundary between superpixels $i$ and $j$. $I_i$ and $I_j$ are the mean intensities of the superpixels in the LUV color space.
\subsection{Segmentation Given Ground Truth Pose}
\label{sec:results-seg_given_gt_pose}
We assume we know the ground truth 3D pose and estimate the segmentation using our two models. We compare with some standard baselines generated using the Joint Categorization and Segmentation framework \cite{Singaraju:CVPR11} with their unary+pairwise and unary+pairwise+linear-top-down models. These baselines are all image-based as they do not include any kind of 3D pose information. We also report some results from the Pascal 3D+ dataset paper \cite{Xiang:WACV14} for comparison. \cite{Xiang:WACV14} used CAD models of 10 kinds of cars to annotate the 3D pose of cars in the image. They reprojected the CAD model onto the image at the annotated pose and generated a segmentation. This is an upper bound on the best segmentation performance we can achieve (shown in red in Table~\ref{table:seg-given-gt-pose}). For the Viewpoint DPM (VDPM-16) results, they fixed the depth, elevation, camera-tilt and image-translation parameters to their ground truth values and estimated the azimuth using a variation of DPMs. Then, they projected the CAD model at the estimated pose to generate a segmentation. We generate one more baseline by projecting the wireframe model of \cite{Yoruk:3DRR13} onto the image using the ground truth pose and generate a candidate segmentation.
\myparagraph{Learning} Model weights are learnt using Eqn.~\eqref{eqn:learning} with constraints $E(X_i,T_i^*)-E(X_i^*,T_i^*) \geq \Delta_1(X_i,X_i^*)-\xi_i$.
\begin{table}[h]
\centering
\begin{tabular}{|@{\,}c@{\,}|@{\,\,}c@{\,\,}|@{\,\,}c@{\,\,}|@{\,\,}c@{\,\,}|}
\hline
Method & Bg. & Cars & Mean \\
\hline
Unary \cite{Singaraju:CVPR11} & 87.53 & 51.51 & 69.52 \\
Unary+Pairwise \cite{Singaraju:CVPR11}& 89.17 & 54.60 & 71.88 \\
U+P+Linear-Top-down \cite{Singaraju:CVPR11}& 88.05 & 54.54 & 71.29 \\
\hline
Projected CAD Model \cite{Xiang:WACV14} & - & {\color{red}67.30} & - \\
VDPM-16 \cite{Xiang:WACV14} & - & 51.9 & - \\
Projected Wireframe Model \cite{Yoruk:3DRR13} & 91.04 & 61.90 & 76.47 \\
\hline
Shape model (ours) & 89.96 & 59.08 & 74.52 \\
Volume model (ours) & {\bf 91.46} & {\bf 64.60} & {\bf 78.03} \\
\hline
\end{tabular}
\caption{Segmentation results (Intersection over Union - I/U score) for segmentation-given-ground-truth-pose experiments. The best results are in bold. See text for more details.}
\label{table:seg-given-gt-pose}
\end{table}
As can be seen in Table~\ref{table:seg-given-gt-pose}, using only image information we get upto 54.60 I/U score for the foreground (class cars). Projecting the wireframe model onto the image and not using any image information gives us pretty good results (61.90 I/U score). However, the best results are obtained for the volume model at 64.60 I/U score by combining both the bottom-up information contained in unary and pairwise terms and the top-down information contained in the 3D object models. This experiment also demonstrates that while the shape model does better than pure bottom-up models, it needs the volume cost to compete with the projection baselines. Overall, our result of 64.60 I/U is the closest to the best possible achievable segmentation obtained by projecting the true 3D model with the true 3D pose.
\subsection{Pose Given Ground Truth Segmentation}
\label{sec:results-pose_given_gt_seg}
In this set of experiments, we estimate the 3D pose of the object present in the image given the ground truth segmentation. We use the parameter ranges for the pose parameters as mentioned in Table~\ref{table:pose-ranges}. Elevation and depth are measured from the center of mass of the car model. Image-plane translation $(u,v)$ is in degrees assuming the width of the image corresponds to a field of view of $55^\circ$.
\myparagraph{Learning} Model weights are learnt using Eqn.~\eqref{eqn:learning} with constraints $E(X_i^*,T_i)-E(X_i^*,T_i^*) \geq \Delta_2(T_i,T_i^*)-\xi_i$.
\begin{table}[h]
\centering
\begin{tabular}{|c|c|c|}
\hline
Parameter & Range & Resolution \\
\hline
Azimuth & $[-180^{\circ}, 180^{\circ}]$ & $5.62^{\circ}$ \\
Elevation & [0.0m, 3.0m] & 0.75 m \\
Camera-Tilt & $[0^{\circ}, 0^{\circ}]$ & 0 \\
Depth & [4m, 50m] & 1.44m \\
Image-Trans & $[-27.5^\circ,27.5^\circ]$ & $3.44^\circ$ \\
\hline
\end{tabular}
\caption{\label{table:pose-ranges}Parameter ranges and highest resolution passed to the branch and bound algorithm for pose estimation}
\end{table}
We also do a pre-processing step in some experiments (indicated by -DPM) to restrict the pose ranges based on the output of a `car' DPM detector trained on ImageNet data. Given detected bounding box, we check over ranges of depth to restrict the search to only those depths where the projected model has some overlap with the bounding box ($>0.5$ intersection over union score). We also restrict the search over image translations $(u,v)$ to be $\pm5^\circ$ around the center of the detected bounding box.
Figure \ref{fig:pose-given-gtseg-voc2011} shows 2D object detection results of the 3D pose estimation task, where the model is projected onto the image at estimated 3D pose to get a 2D bounding box detection. We show detection accuracy (percentage of images where the car was detected correctly) and average precision score for different models and detection thresholds (I/U score between detected and ground-truth bounding boxes).
As can be seen in Figure \ref{fig:pose-given-gtseg-voc2011:acc}, the pose estimation task done without any segmentation (yellow) gives the worst results. Performance slightly improves if we use the shape model (green). A noticeable improvement is observed when we restrict the pose search-space using the output of a DPM for both the no-segmentation (blue) and shape models (violet). However, the best performance is observed by the volume model, both without any restriction in pose-space (cyan) and with restricted pose-space (pink). The DPM output is shown in red. Observe that DPM performs worse at the typical 0.5 I/U threshold, and better at higher thresholds. Similar trends are observed in Figure~\ref{fig:pose-given-gtseg-voc2011:ap}. Overall, using a simple 3D model and well-designed scores, we achieve a performance on par with a highly specialized 2D detection system trained on lots of images.
In Figure \ref{fig:pose-given-gtseg-3dobject}, we test the shape and volume models on the 3Dobject dataset. The best performance is observed for the volume model with comparable performance for the shape and no-seg models.
\begin{figure}
\centering
\begin{subfigure}[b]{0.48\linewidth}
\includegraphics[width=\linewidth]{f/pose_given_gtseg_acc_voc2011}
\caption{Detection accuracy}
\label{fig:pose-given-gtseg-voc2011:acc}
\end{subfigure}
~
\begin{subfigure}[b]{0.48\linewidth}
\includegraphics[width=\linewidth]{f/pose_given_gtseg_ap_voc2011}
\caption{Average Precision}
\label{fig:pose-given-gtseg-voc2011:ap}
\end{subfigure}
\caption{Evaluation of pose estimation given ground-truth segmentation using 2D object detection metrics}
\label{fig:pose-given-gtseg-voc2011}
\smallskip
\centering
\begin{subfigure}[b]{0.48\linewidth}
\includegraphics[width=\linewidth]{f/pose_given_gtseg_acc_3dobject}
\caption{Detection Accuracy}
\label{fig:pose-given-gtseg-3dobject:acc}
\end{subfigure}
~
\begin{subfigure}[b]{0.48\linewidth}
\includegraphics[width=\linewidth]{f/pose_given_gtseg_ap_3dobject}
\caption{Average Precision}
\label{fig:pose-given-gtseg-3dobject:ap}
\end{subfigure}
\caption{Object detection results for 3Dobject dataset. Weights for the volume model are same as learnt from VOC data}
\label{fig:pose-given-gtseg-3dobject}
\end{figure}
The 3Dobject dataset has 480 car images, with 10 cars shown at 8 azimuths, 2 elevations and 3 depths each. Performance of 3D pose estimation can be evaluated by computing the azimuth classification accuracy (into 8 discrete labels/directions). As can be seen in Table~\ref{table:pose-given-gtseg-3dobject}, the volume model performs the best. For the case of VOC data where we have fine 3D pose annotations, we compute oriented detection accuracy, which is similar to standard object-detection metrics, except that we call a detection valid if it has significant I/U overlap ($>0.5$) with the ground-truth bounding box and an azimuth error (estimated azimuth - ground-truth azimuth) below a threshold ($20^\circ$). As can be seen from Table~\ref{table:pose-given-gtseg-voc2011:oriented}, similar trends are observed as in the object detection results.
\begin{table}[h]
\centering
\begin{tabular}{|c|c|c|c|}
\hline
Model & No-Seg & Shape & Volume \\
\hline
Accuracy & 78.13 & 85.42 & 91.67 \\
\hline
\end{tabular}
\caption{Classification accuracy for azimuth on 3Dobject dataset}
\label{table:pose-given-gtseg-3dobject}
\medskip
\centering
\begin{tabular}{|c|c||c|c|}
\hline
Method & Accuracy & Method & Accuracy \\
\hline
No-Seg & 11.45 & No-Seg-DPM & 19.28 \\
Shape & 13.86 & Shape-DPM & 23.49 \\
Volume & 27.11 & Volume-DPM & 28.31 \\
\hline
\end{tabular}
\caption{Oriented detection accuracy for pose estimation experiments on VOC2011 data using ground-truth segmentation}
\label{table:pose-given-gtseg-voc2011:oriented}
\end{table}
\subsection{Joint Segmentation and Pose Estimation Using Alternating Minimization}
\label{sec:results-joint_pose_and_seg}
We now present the results of pose estimation and segmentation using the AM procedure in Eqns.~\eqref{eqn:pose-given-seg}-\eqref{eqn:seg-given-pose}. We initialize $X^0$ as the output of the Unary+Pairwise problem (purely bottom-up segmentation) and $T^0$ as the output of the No-Segmentation-DPM problem (3D pose estimation without any ground-truth segmentation with pose search-space restricted by DPM output). At every step of the AM procedure we require that $E(X^{n+1},T^{n+1}) \leq E(X^n,T^n)$. Note that we require point estimates of pose $T^n$ whereas B\&B gives us a pose cell. This difficulty is overcome by maintaing a best pose estimate during the B\&B procedure. This is given as $(\hat{X}=\operatorname*{argmin}_X E(X,\hat{T}), \hat{T})$ where $\hat{T}$ is the center of the pose cell being evaluated in the B\&B queue. We refine the pose search-space till we obtain $E(\hat{X},\hat{T}) < \tau E(X^n,T^n)$ for some suitably chosen threshold parameter $\tau$. The AM procedure is said to converge when segmentation doesn't change, \ie $\frac{|X^n \cap X^{n+1}|}{|X^n \cup X^{n+1}|} > 0.98$.
\begin{table}[h]
\centering
\begin{tabular}{|@{\;}c@{\;}|c|c|c|c|@{\;}c@{\;}|}
\hline
Method & \multicolumn{3}{|c|}{Segmentation} & \multicolumn{2}{|c|}{Detection} \\
\hline
& Bg. & Cars & Mean & Obj. & Oriented \\
\hline
B1-Shape & {\bf 89.17} & {\bf 54.60} & {\bf 71.88} & 45.78 & 18.67 \\
B1-Volume & 89.17 & 54.60 & 71.88 & 43.98 & 10.24 \\
\hline
B2 -Shape & 87.97 & 54.19 & 71.08 & 53.01 & 19.28 \\
B2 -Volume & 83.52 & 45.06 & 64.29 & 53.01 & 19.28 \\
\hline
AM-Shape & 87.69 & 54.29 & 70.99 & 53.01 & 21.69 \\
AM-Volume & 86.42 & 50.75 & 68.58 & {\bf 56.02} & {\bf 22.29} \\
\hline
\end{tabular}
\caption{Segmentation results (I/U score) and pose estimation results (object detection accuracy and oriented object detection accuracy) for the joint experiments}
\label{table:joint-results}
\end{table}
We compare our results with two baselines, $B1: (X,T)=(X^0, \operatorname*{argmin}_T E(X^0,T))$ and $B2: (X,T) = (\operatorname*{argmin}_X E(X,T^0),T^0)$. These are essentially the AM procedure stopped after 1 iteration. As can be seen in Table~\ref{table:joint-results}, for the Shape model, the AM procedure leads to similar segmentation and detection results but marginally better oriented detections. There is trade-off in the volume model, where it loses some segmentation accuracy for better pose estimation. This is to be expected as we are trying to describe complex images in the VOC data with significant intra-class shape variation, occlusion and truncation using a simple sedan car model.
\begin{figure}
\centering
\begin{subfigure}[b]{0.45\linewidth}
\includegraphics[width=\linewidth]{f/image.png}
\caption{Image}
\end{subfigure}
~
\begin{subfigure}[b]{0.45\linewidth}
\includegraphics[width=\linewidth]{f/gt_seg.png}
\caption{GT Segmentation}
\end{subfigure}
\begin{subfigure}[b]{0.45\linewidth}
\includegraphics[width=\linewidth]{f/seg_given_gt_pose_det}
\caption{Segmentation using GT pose under shape model}
\end{subfigure}
~
\begin{subfigure}[b]{0.45\linewidth}
\includegraphics[width=\linewidth]{f/seg_given_gt_pose_acc}
\caption{Segmentation using GT pose under volume model}
\end{subfigure}
\begin{subfigure}[b]{0.45\linewidth}
\includegraphics[width=\linewidth]{f/joint_det_dpm_marcc_5}
\caption{Segmentation after 5 iterations of AM under shape model}
\end{subfigure}
~
\begin{subfigure}[b]{0.45\linewidth}
\includegraphics[width=\linewidth]{f/joint_acc_dpm_marcc_5}
\caption{Segmentation after 8 iterations of AM under volume model}
\end{subfigure}
\begin{subfigure}[b]{0.45\linewidth}
\includegraphics[width=\linewidth]{f/pose_det_dpm_2.png}
\caption{Pose using GT segmentation under shape model}
\end{subfigure}
~
\begin{subfigure}[b]{0.45\linewidth}
\includegraphics[width=\linewidth]{f/pose_acc_dpm.png}
\caption{Pose using GT segmentation under volume model}
\end{subfigure}
\begin{subfigure}[b]{0.45\linewidth}
\includegraphics[width=\linewidth]{f/joint_det_dpm_marcc_5-pose}
\caption{Pose estimate after 5 iterations of AM under shape model}
\end{subfigure}
~
\begin{subfigure}[b]{0.45\linewidth}
\includegraphics[width=\linewidth]{f/joint_acc_dpm_marcc_5-pose}
\caption{Pose estimate after 8 iterations of AM under volume model}
\end{subfigure}
\caption{The output of various experiments for one image}
\vspace{-6mm}
\end{figure}
\section{Conclusion}
We introduced two new top-down costs based on 3D object models that capture the consistency between 3D shape and 2D appearance, and 3D volume and 2D segmentation. We demonstrated that these costs can be decomposed into standard unary and pairwise terms for inference using graph-cuts. We also computed upper-bounds for these costs allowing efficient pose estimation using branch-and-bound algorithms. We demonstrated good performance on estimating segmentation given ground truth pose and estimating pose given ground truth segmentation. We also observed slight improvement in 3D pose estimation when solving for both pose and segmentation. However, this comes at the cost of reduced accuracy in segmentation.
Arguably this is because of the use of a simple rigid model for sedans, which is not able to capture the intra-class variability. Nonetheless, the overall results are quite promising, and will only improve with the availability of better 3D models.
\myparagraph{Acknowledgement} This work was supported by NSF grant 1527340.
{\small
\bibliographystyle{ieee}
| {'timestamp': '2016-06-20T02:09:06', 'yymm': '1512', 'arxiv_id': '1512.06790', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06790'} | arxiv |
\section{Introduction\label{sec:Introduction}}
Let $\mathbb{M}\subset\mathbb{R}^{n}$ be a $k$-dimensional smooth \emph{submanifold} of $\mathbb{R}^{n}$ with finite diameter and volume, and with nonzero \emph{reach}.\footnote{Reach measures the regularity of a manifold. This, as well as more specific requirements on $\mathbb{M}$, are described in Section \ref{sec:Necessary-Concepts}.} Consider also $\Phi_{l,u}:\mathbb{R}^{n} \rightarrow \mathbb{R}^{m}$ that acts as a \emph{bi-Lipschitz} map on $\mathbb{M}$ in the sense that
\begin{equation}
l\cdot\|x-y\|_{2}\le\left||\Phi_{l,u}(x)-\Phi_{l,u}(y)\right\Vert _{2}\le u\cdot\|x-y\|_{2},\qquad\forall x,y\in\mathbb{M},\label{eq:iso}
\end{equation}
for some $0<l\le1\le u<\infty$. In particular, when $l,u\approx1$, then $\Phi_{l,u}(\cdot)$ is a \emph{near-isometry} on $\mathbb{M}$, in that it barely distorts the pairwise Euclidean distances between points on $\mathbb{M}$.\footnote{The deviation $\max[u-1,1-l]$ (if positive) is commonly referred to as the \emph{isometry constant} of the map $\Phi_{l,u}(\cdot)$ on $\mathbb{M}$.} Such maps naturally arise in a variety of applications in data sciences, often involving dimensionality reduction \cite{broomhead2001whitney,donoho2006compressed,candes2008restricted,clarkson2008tighter,hegde2008random,eftekhari2015new,hegde2015numax}; we will expand on this remark in Section \ref{sec:Motivation}. Let us point out that we only assume the map $\Phi_{l,u}(\cdot)$ to be bi-Lipschitz on $\mathbb{M}$, not on the entire domain $\mathbb{R}^{n}$. This is a subtle but crucial detail which will be significant, for example, in applications where $\Phi_{l,u}$ is linear and where $m < n$. In such applications $\Phi_{l,u}(\cdot)$ will have a nullspace and map many vectors to $0$, but for~\eqref{eq:iso} to be satisfied with $l > 0$ no vector of the form $x-y$ with $x, y \in \mathbb{M}$, $x \neq y$ can be in the nullspace of $\Phi_{l,u}(\cdot)$.
The setup above naturally raises the following question: What happens to $\mathbb{M}$ under the bi-Lipschitz map $\Phi_{l,u}(\cdot)$? It is in fact trivially verified that $\Phi_{l,u}(\mathbb{M})\subset\mathbb{R}^{m}$ is itself a smooth submanifold of $\mathbb{R}^{m}$, where $\Phi_{l,u}(\mathbb{M})$ is the image of $\mathbb{M}$ under $\Phi_{l,u}(\cdot)$. This allows us to define our inquiry more precisely:
\begin{itemize}
\item \textbf{Question:} How do key characteristics of $\Phi_{l,u}(\mathbb{M})$---namely dimension, diameter, volume, and reach---relate to those of $\mathbb{M}$?
\end{itemize}
When $l,u\approx1$, we will verify that
\begin{align*}
\dim\left(\Phi_{l,u}(\mathbb{M})\right) & =\dim\left(\mathbb{M}\right), \\
\mbox{diam}\left(\Phi_{l,u}(\mathbb{M})\right)&\approx\mbox{diam}\left(\mathbb{M}\right), \\
\mbox{vol}_{k}\left(\Phi_{l,u}(\mathbb{M})\right)&\approx\mbox{vol}_{k}\left(\mathbb{M}\right),
\end{align*}
as formalized in Proposition \ref{lem:easy}. However, for reach---an important attribute of the manifold---the story is somewhat different as additional restrictions must be imposed on $\Phi_{l,u}(\cdot)$ for reach to be approximately preserved. We briefly outline this peculiar case next and defer the details to Section~\ref{sec:Main-Results}.
Reach, as a measure of regularity of a submanifold of Euclidean space, can be traced back to the pioneering works in \emph{geometric measure theory}~\cite{federer1959curvature}. More recently, the concept of reach has proved indispensable in the role that manifold models play in signal processing and machine learning~\cite{niyogi,baraniuk2009random,hegde2008random,yap2013stable,iwen2013approximation,verma2012,davenport2007sfc}. As elaborated later in Proposition \ref{lem:exact iso}, reach is actually preserved under an \emph{exact isometry}, i.e., $\mbox{rch}(\Phi_{1,1}(\mathbb{M}))=\mbox{rch}(\mathbb{M})$. However, there is generally no relation between $\mbox{rch}(\Phi_{l,u}(\mathbb{M}))$ and $\mbox{rch}(\mathbb{M})$ when $l<1<u$, and we provide a concrete example in Proposition \ref{fact:In-general,-reach} to demonstrate this. This example involves a nonlinear choice of $\Phi_{l,u}(\cdot)$. Interestingly, however, if we limit ourselves to the class of {\em linear} maps, reach is nearly preserved. Specifically, we can lower bound $\mbox{rch}\left(\Phi_{l,u}(\mathbb{M})\right)$ in terms of $\mbox{rch}(\mathbb{M})$ when $\Phi_{l,u}(\cdot)$ is a linear near-isometry; we formalize this claim in Theorem~\ref{thm:(Near-Isometry) rch preserved}.
Before attending to the details, however, we present the necessary background in Section~\ref{sec:Necessary-Concepts} to make this paper self-contained. Then, Section~\ref{sec:Main-Results} makes precise the claims we outlined above, with further discussion and context for these results appearing in Section~\ref{sec:discussion}. In Section~\ref{sec:Motivation}, revisiting the applications of nearly-isometric maps in data sciences, we show how the (seemingly abstract) Question above naturally arises in modern signal processing and machine learning, and we discuss the implications of our results in these contexts. We defer all proofs to the appendices.
\section{Necessary Concepts\label{sec:Necessary-Concepts}}
Let $\mathbb{M}\subset\mathbb{R}^{n}$ be a smooth, bounded, and boundary-less $k$-dimensional submanifold of $\mathbb{R}^{n}$. More formally, $\mathbb{M}$ satisfies the following. Any point $x\in\mathbb{M}$ belongs to some \emph{neighborhood} $\mathbb{U}_{x}\subseteq\mathbb{M}$ that is \emph{diffeomorphic}\footnote{A diffeomorphism is a smooth and bijective map with a smooth inverse.} to $\mathbb{R}^{k}$, and the transition between adjacent neighborhoods is smooth \cite{morgan1998riemannian,lee2009manifolds}.\footnote{By smooth transition we mean the following: If $\phi_{x}:\mathbb{U}_{x}\rightarrow\mathbb{R}^{k}$ and $\phi_{x'}:\mathbb{U}_{x'}\rightarrow\mathbb{R}^{k}$ are, respectively, the diffeomorphisms corresponding to the neighborhoods $\mathbb{U}_{x}$ and $\mathbb{U}_{x'}$ on the manifold $\mathbb{M}$ and $\mathbb{U}_{x}\cap\mathbb{U}_{x'}\ne\emptyset$, then the composition $(\phi_{x}\circ\phi_{x'}^{-1})(\cdot)$ must be smooth (wherever defined).}
To every point $x\in\mathbb{M}$, we assign a \emph{tangent subspace} $\mathbb{T}_{x}\mathbb{M}\subset\mathbb{R}^{n}$ comprised of the directions of all smooth curves on $\mathbb{M}$ that pass through $x$:
\begin{align*}
&\mathbb{T}_{x}\mathbb{M}:= \\
&~~~\mbox{span}\left[\left\{ \frac{d\gamma}{dt}(0)\,|\,\gamma:[-1,1]\rightarrow\mathbb{M}\mbox{ is a smooth curve and }\gamma(0)=x\in\mathbb{M}\right\} \right].
\end{align*}
At any $x\in\mathbb{M}$, we note that $\mathbb{T}_{x}\mathbb{M}$ is a $k$-dimensional linear subspace of $\mathbb{R}^{n}$. The \emph{tangent bundle} of $\mathbb{M}$ is the collection of all tangent subspaces:
\[
\mathbb{T}\mathbb{M}:=\bigcup_{x\in\mathbb{M}}\{x\}\times\mathbb{T}_{x}\mathbb{M}.
\]
The \emph{normal subspace} $\mathbb{N}_{x}\mathbb{M}$ is the orthogonal complement of $\mathbb{T}_{x}\mathbb{M}$ with respect to $\mathbb{R}^{n}$ so that
\[
\mathbb{R}^{n}=\mathbb{T}_{x}\mathbb{M}\oplus\mathbb{N}_{x}\mathbb{M},
\]
(with $\oplus$ standing for direct sum). Thus, at any $x\in\mathbb{M}$, $\mathbb{N}_{x}\mathbb{M}$ is an $(n-k)$-dimensional linear subspace of $\mathbb{R}^{n}$. The \emph{normal bundle} of $\mathbb{M}$ is the collection of all normal subspaces:
\[
\mathbb{N}\mathbb{M}:=\bigcup_{x\in\mathbb{M}}\{x\}\times\mathbb{N}_{x}\mathbb{M}.
\]
For $r>0$, we also let $\mathbb{N}^r\mathbb{M}\subset\mathbb{N}\mathbb{M}$ denote the \emph{open normal bundle} of $\mathbb{M}$ of radius $r$ comprised of all normal vectors of length less than $r$. For example, when $\mathbb{M}$ is the unit circle in $\mathbb{R}^{2}$ and $r\in(0,1)$, $\mathbb{N}^r\mathbb{M}$ may be identified with a disc of width $2r$ (around the circle); see Figure~\ref{fig:circle}.
\begin{figure}[t]
\begin{center}
\includegraphics[width=50mm]{circle.pdf}
\end{center}
\vspace*{-5mm} \caption{\small\sl \label{fig:circle} The reach of the unit circle (in bold) is equal to $1$, as the open normal bundle of radius $r$ (shaded) is embedded in $\mathbb{R}^{2}$ for any $r<1$. Moreover, any point in $\mathbb{R}^{2}$ whose distance from the unit circle is less than $1$ has a unique nearest point on the unit circle.
}
\end{figure}
The reach of $\mathbb{M}$ \cite{federer1959curvature}, denoted by $\mbox{rch}(\mathbb{M})$ throughout, is a geometric attribute that captures valuable local and global properties of a manifold (that we will highlight shortly).
\begin{definition}\label{def:rch}
\textbf{{(Reach)}} For a smooth submanifold $\mathbb{M}\subset\mathbb{R}^{n}$, the reach of $\mathbb{M}$ (denoted by $\mbox{rch}(\mathbb{M})$) is the
largest number having the following property: the open normal bundle of $\mathbb{M}$ of radius $r$ is embedded in $\mathbb{R}^{n}$ for all $r<\mbox{rch}(\mathbb{M})$.
\end{definition}
For example, the reach of a circle of radius $\rho$ is simply $\rho$ itself. This fact is generalized by the following result, which may be of its own independent interest.
\begin{proposition}
\label{lem:ellipsoidreach}\textbf{\emph{(Reach of an ellipsoid)}}
Let $\mathbb{M}$ be an $(n-1)$-dimensional ellipsoid in $\mathbb{R}^n$ with principal axes $r_1 \ge r_2 \ge \cdots \ge r_n > 0$. Then
\[
\mbox{rch}(\mathbb{M}) = \frac{r_n^2}{r_1}.
\]
\end{proposition}
By definition, any point in $\mathbb{R}^{n}$ within the distance $\mbox{rch}(\mathbb{M})$ of $\mathbb{M}$ has a unique nearest point on $\mathbb{M}$. The role of reach can be summarized in two key properties (see the Toolbox in \cite{eftekhari2015new} for more details). The first property concerns local regularity of $\mathbb{M}$: the curvature of any unit-speed {\em geodesic curve}\footnote{Loosely speaking, a geodesic curve between a pair of points on $\mathbb{M}$ is a curve on $\mathbb{M}$ that locally minimizes the distances \cite{lee2009manifolds}. For example, an arc on a circle is a geodesic curve between its end points. Note that the geodesic curve between two points is not necessarily unique.} on $\mathbb{M}$ is bounded by $(\mbox{rch}(\mathbb{M}))^{-1}$. \label{p:curv rch} The second property concerns global regularity: at long \emph{geodesic distances},\footnote{The geodesic distance between a pair of points on $\mathbb{M}$ is the length of the shortest geodesic curve connecting those two points \cite{lee2009manifolds}.} the reach controls how close the manifold may curve back upon itself. For example, supposing $x,y\in\mathbb{M}$ with geodesic distance $d_{\mathbb{M}}(x,y)$, we have that
\[
d_{\mathbb{M}}(x,y)>\mbox{rch}(\mathbb{M})\Longrightarrow\|x-y\|_{2}>\frac{\mbox{rch}(\mathbb{M})}{2}.
\]
\section{Results\label{sec:Main-Results}}
Let $\mathbb{M}\subset\mathbb{R}^{n}$ be a smooth, bounded, and boundary-less $k$-dimensional submanifold of $\mathbb{R}^{n}$. We let $\mbox{diam}(\mathbb{M})$, $\mbox{vol}_{k}(\mathbb{M})$, and $\mbox{rch}(\mathbb{M})>0$ denote, respectively, the diameter, $k$-dimensional volume, and reach of $\mathbb{M}$. For $0<l\le1\le u<\infty$ and for $m \ge k$, let $\Phi_{l,u}:\mathbb{R}^{n}\rightarrow\mathbb{R}^{m}$ be a smooth bi-Lipschitz map on $\mathbb{M}$ so that
\begin{equation}
l\cdot\|x-y\|_{2}\le\|\Phi_{l,u}(x)-\Phi_{l,u}(y)\|_{2}\le u\cdot\|x-y\|_{2},\qquad\forall x,y\in\mathbb{M}.\label{eq:near iso}
\end{equation}
Some basic properties of $\Phi_{l,u}(\mathbb{M})$, the image of $\mathbb{M}$ under $\Phi_{l,u}(\cdot)$, are collected below and proved in Appendix~\ref{sec:Proof-of-Lemma easy}. One key insight used in the proof is the following: Under $\Phi_{l,u}(\cdot)$, a tangent vector $v\in\mathbb{T}_x\mathbb{M}$ is mapped to a tangent vector at $\Phi_{l,u}(x)$. To be precise, $v\rightarrow D\Phi_{l,u}(x) \cdot v$, where $D\Phi_{l,u}(x)\in\mathbb{R}^{m\times n}$ is the derivative of $\Phi_{l,u}(\cdot)$ at $x$. Moreover, $ D\Phi_{l,u}(x)$ acts as a near-isometry on $\mathbb{T}_{x}\mathbb{M}$ if $\Phi_{l,u}(\cdot)$ is itself a near-isometry on $\mathbb{M}$.
\begin{proposition}
\label{lem:easy}\textbf{\emph{(Basic properties)}} Let the manifold $\mathbb{M}$ and map $\Phi_{l,u}(\cdot)$ be as specified above. Then, $\Phi_{l,u}(\mathbb{M})$ is itself a smooth, bounded, and boundary-less $k$-dimensional submanifold of $\mathbb{R}^{m}$. Moreover, it holds that
\[
l\cdot \mbox{diam}(\mathbb{M}) \le \mbox{diam}\left( \Phi_{l,u}(\mathbb{M}) \right) \le u\cdot \mbox{diam}(\mathbb{M}),
\]
\[
l^{k}\cdot\mbox{vol}_{k}(\mathbb{M})\le\mbox{vol}_{k}\left(\Phi_{l,u}\left(\mathbb{M}\right)\right)\le u^{k}\cdot\mbox{vol}_{k}(\mathbb{M}).
\]
\end{proposition}
Further discussion of this result appears in Section \ref{sec:discussion}.
Before we study how a nearly isometric map affects the reach of a smooth manifold, some results are in order to build intuition and form insight to the problem. The next result, proved in Appendix~\ref{sec:Proof-of-Lemma key exact iso}, states that (not surprisingly) the tangent structure of the manifold remains entirely intact under an exact isometry on $\mathbb{M}$, i.e., when $l=u=1$. The key insight used in the proof is that the angle between any pair of tangent vectors in $\mathbb{M}$ is preserved in $\Phi_{l,u}(\mathbb{M})$ if $\Phi_{l,u}(\cdot)$ is an exact isometry on $\mathbb{M}$.
\begin{proposition}
\label{lem:key exact iso}\textbf{\emph{(Tangent bundle under exact isometry)}}
For the manifold $\mathbb{M}$ specified earlier, take $p,q\in\mathbb{M}$. When $l=u=1$, it holds that
\[
\angle\left[\mathbb{T}_{\Phi_{l,u}(p)}\Phi_{l,u}\left(\mathbb{M}\right),\mathbb{T}_{\Phi_{l,u}(q)}\Phi_{l,u}\left(\mathbb{M}\right)\right]=\angle\left[\mathbb{T}_{p}\mathbb{M},\mathbb{T}_{q}\mathbb{M}\right],
\]
with $\angle[\mathbb{A},\mathbb{B}]$ standing for the angle between the subspaces $\mathbb{A}$ and $\mathbb{B}$.\footnote{\label{p:angle}Angle between subspaces generalizes the notion of angle between lines. The (largest principle) angle between the two subspaces $\mathbb{A}$ and $\mathbb{B}$ is defined such that $\cos(\angle[\mathbb{A},\mathbb{B}]):= \min_a\max_b \cos(\angle [a,b])$, where the optimization is over all vectors $a\in\mathbb{A}$ and $b\in\mathbb{B}$.
See \cite{horn1994topics} for more details.}
\end{proposition}
To extend Proposition \ref{lem:key exact iso} to a general bi-Lipschitz map on $\mathbb{M}$ with $l\le1\le h$, we restrict ourselves to linear maps. The next result is proved in Appendix \ref{sec:Proof-of-Lemma key near iso}.
\begin{proposition}
\label{lem:key near iso}\textbf{\emph{(Tangent bundle under linear near-isometry)}}
With the manifold $\mathbb{M}$ as before, take $p,q\in\mathbb{M}$. If the map $\Phi_{l,u}:\mathbb{R}^{n}\rightarrow\mathbb{R}^{m}$ is linear on $\mathbb{R}^{n}$ and bi-Lipschitz on $\mathbb{M}$ (i.e., satisfies~(\ref{eq:near iso})), then
\begin{align*}
&\left|\cos\left(\angle[\mathbb{T}_{\Phi_{l,u}(p)}\Phi_{l,u}\left(\mathbb{M}\right),\mathbb{T}_{\Phi_{l,u}\left(q\right)}\Phi_{l,u}\left(\mathbb{M}\right)]\right)-\cos\left(\angle\left[\mathbb{T}_{p}\mathbb{M},\mathbb{T}_{q}\mathbb{M}\right]\right)\right|
\\
& \qquad \le \frac{25}{4l^2} \cdot \frac{\|p-q\|_2^2}{ \mbox{rch}(\mathbb{M})^2} \cdot \left(\max(\|\Phi_{l,u}\|^2,u^2)+1 \right)^2 + \frac{18\max\left(\Delta_{l,u},\sqrt{\Delta_{l,u}}\right)}{l^2},
\end{align*}
where $\Delta_{l,u}:=\max\left[1-l^{2},u^{2}-1\right]$ and $\|\Phi_{l,u}\|$ is the spectral norm of the matrix representation of the linear operator $\Phi_{l,u}(\cdot)$.
\end{proposition}
In words, the angles between tangent spaces on the manifold remain \emph{nearly} unchanged under a linear near-isometry ($l,u\approx1$), for sufficiently close points on the manifold (those within a distance of approximately ${\|\Phi_{l,u}\|^{-2} \mbox{rch}(\mathbb{M})}$). The proof of this fact involves sampling two additional points from the manifold, one near $p$ and one near $q$, controlling the distances between all four of these points under the bi-Lipschitz map $\Phi_{l,u}$, and relating these distances to the angles between the tangent spaces at $p$ and $q$.
Finally, what can be said about $\mbox{rch}(\Phi_{l,u}(\mathbb{M}))$? The next result, proved in Appendix \ref{sec:proof of exact iso}, deals with the special case of an exact isometry.
\begin{proposition}
\label{lem:exact iso}\textbf{\emph{(Reach under exact isometry)}}
Consider the manifold $\mathbb{M}$ as before, and take $l=u=1$. Then,
\[
\mbox{rch}\left(\Phi_{l,u}\left(\mathbb{M}\right)\right)=\mbox{rch}\left(\mathbb{M}\right).
\]
\end{proposition}
We note that Proposition~\ref{lem:exact iso} does not require $\Phi_{1,1}:\mathbb{R}^{n} \rightarrow \mathbb{R}^{m}$ to be linear, nor does it place any restriction on $m$ (aside from the requirement---assumed throughout this section---that $m \ge k$). The key insight here is that $\Phi_{1,1}(\cdot)$ preserves not only pairwise distances on $\mathbb{M}$, but also the angles between pairs of tangent spaces of $\mathbb{M}$ (see Proposition~\ref{lem:key exact iso}). This in turn guarantees that $\Phi_{1,1}(\mathbb{M})$ is as regular as $\mathbb{M}$ itself (as recorded in the above proposition).
What about the case $l<1$ or $u>1$, where $\Phi_{l,u}(\cdot)$ is not an exact isometry on $\mathbb{M}$? In full generality, there is no relation between $\mbox{rch}(\Phi_{l,u}(\mathbb{M}))$ and $\mbox{rch}(\mathbb{M})$. This is demonstrated in Appendix~\ref{sec:Proof-of-Proposition in general} where, by adding a smooth ``cusp'' of width $2\delta$ to a line segment in $\mathbb{R}^2$, we explicitly construct a manifold $\mathbb{M}$ and a near-isometric map $\Phi_{l,u}(\cdot)$ on $\mathbb{M}$ such that $\mbox{rch}(\Phi_{l,u}(\mathbb{M}))\le \frac{\delta}{\sqrt{2}}\ll\infty=\mbox{rch}(\mathbb{M})$.
\begin{proposition}
\textbf{\label{fact:In-general,-reach}\emph{(Negative result)}}
In general, reach is not preserved under a bi-Lipschitz mapping.
\end{proposition}
When $\Phi_{l,u}(\cdot)$ is linear, however, we can lower bound $\mbox{rch}\left(\Phi_{l,u}(\mathbb{M})\right)$ in terms of $\mbox{rch}(\mathbb{M})$; the following theorem is proved in Appendix~\ref{sec:Proof-of-Theorem linear Phi}.
\begin{theorem}
\textbf{\label{thm:(Near-Isometry) rch preserved}\emph{(Reach under linear near-isometry)}}
Consider the manifold $\mathbb{M}$ specified earlier. Suppose $m \le n$, and suppose $\Phi_{l,u}(\cdot)$ to be a rank-$m$ linear map from $\mathbb{R}^{n}$ to $\mathbb{R}^{m}$ with its $m$ nonzero singular values in the interval $[\sigma_{\min},\sigma_{\max}]\subset (0,\infty)$. Then, if $m=n$, it holds that
\[
\mbox{rch}\left(\Phi_{l,u}(\mathbb{M})\right) \ge \frac{\sigma_{\min}^2}{\sigma_{\max}}\cdot\mbox{rch}(\mathbb{M}),
\]
whereas, if $m<n$, it holds that
\[
\mbox{rch}\left(\Phi_{l,u}(\mathbb{M})\right) \ge \frac{\sigma_{\min}^2l^2}{\sigma_{\max}^3}\cdot\mbox{rch}(\mathbb{M}).
\]
\end{theorem}
We note that Theorem~\ref{thm:(Near-Isometry) rch preserved} does require $\Phi_{l,u}:\mathbb{R}^{n} \rightarrow \mathbb{R}^{m}$ to be linear, and it also requires that $m \le n$ (in addition to the requirement that $m \ge k$). The proof, without any loss of generality, models the linear map $\Phi_{l,u}(\cdot)$ as an orthogonal projection followed by stretching in $\mathbb{R}^m$ along different coordinates, and then records how the reach changes in each of these two steps. In the first step, we use Definition \ref{def:rch} to directly quantify the rather involved effect of orthogonal projection on the reach. On the other hand, qualitatively speaking, modestly scaling an object along different coordinates will not substantially distort its geometry, and we will solidify this notion in the second step of the proof. Combining the two steps proves Theorem \ref{thm:(Near-Isometry) rch preserved}.
\section{Discussion}
\label{sec:discussion}
Manifold embeddings have a rich history in differential topology and geometry. The following discussion might help put our results in the proper context. First, the (strong) Whitney embedding theorem~\cite{whitney1936differentiable} states that any $k$-dimensional smooth manifold $\mathbb{M}$ (not necessarily originating as a submanifold of any Euclidean space) can be smoothly embedded into $\mathbb{R}^{2k}$.\footnote{In this context, a smooth embedding is simply a diffeomorphism.} In contrast, the type of bi-Lipschitz map $\Phi_{l,u}:\mathbb{R}^n\rightarrow\mathbb{R}^m$ that we consider in this paper can be interpreted as \emph{stably} embedding $\mathbb{M}$ (which does originate as a submanifold of $\mathbb{R}^n$) into $\mathbb{R}^m$. In particular, stability in this sense refers to the preservation of extrinsic, Euclidean distances as formalized in~\eqref{eq:iso}. As noted in~\cite{baraniuk2009random}, this type of embedding can also imply the preservation of intrinsic, geodesic distances. The celebrated Nash embedding theorem~\cite{nash1956imbedding} also concerns the embedding of manifolds in Euclidean space, but with an exact isometry. However, isometry in this context refers only to the preservation of intrinsic, geodesic distances.
In Section~\ref{sec:Motivation}, we discuss how certain randomized constructions have been used to construct linear mappings $\Phi_{l,u}:\mathbb{R}^n\rightarrow\mathbb{R}^m$ that satisfy~\eqref{eq:iso} with $m$ as small as possible. Deterministic linear constructions, adapted to the structure of the manifold $\mathbb{M}$ have also been proposed~\cite{broomhead2001whitney,hegde2015numax} to satisfy~\eqref{eq:iso}. Other manifold learning algorithms such as ISOMAP~\cite{tenenbaum2000global}, however, typically involve nonlinear maps designed to preserve only intrinsic, geodesic distances.
Regarding the implications of bi-Lipschitz mappings that we have derived in this paper, let us begin by discussing the assumptions made in Proposition~\ref{lem:easy}. First, it is worth noting that the dimension of a manifold is actually invariant under any homeomorphism.\footnote{A homeomorphism is a continuous and bijective map with a continuous inverse.} One might also consider replacing the bi-Lipschitz map in Proposition \ref{lem:easy} with a ``locally'' bi-Lipschitz map, one that barely distorts the angle between any pair of tangent vectors anchored at the same point on $\mathbb{M}$. It is not difficult to verify that the dimension of $\mathbb{M}$ remains invariant under a locally bi-Lipschitz map and that such a map only modestly changes the volume. The diameter and reach, however, might change drastically under a locally bi-Lipschitz map. One example is rolling a thin and very long strip of paper along its length (as one would roll up a carpet); this transformation does not distort the angle between any pair of tangent vectors (at the same point) but can arbitrarily reduce the diameter and reach. On the other hand, it is possible to construct an operator that maps such a manifold to itself while significantly distorting the tangent vectors (one could envision placing one's palm on a rubber sheet, and twisting). In this case, the diameter, volume, and reach would all remain the same. However, depending on the conditioning of the Jacobian at a point on the sheet, a pair of tangent vectors at that point could map to vectors with a significantly different angle between them.
Regarding Proposition \ref{lem:key near iso}, we believe that there may be some room for improvement. While this result confirms that the angles between tangent spaces are better preserved as the isometry of the bi-Lipschitz map tightens (i.e., as $\Delta_{l,u} \rightarrow 0$), for a fixed $p$ and $q$, the right hand side of the bound does not go to zero. We do believe that some dependence on $\|p-q\|_2^2$ is natural: for points farther away, the isometry constant must be tighter in order to preserve the angles between the respective tangent spaces. However, it may be possible to derive a bound on the right hand side that scales with the product of $\|p-q\|_2^2$ and $\Delta_{l,u}$, rather than their sum.
Finally, let us explore the tightness of the bounds in Theorem~\ref{thm:(Near-Isometry) rch preserved} using some toy examples. For instance, consider $\mathbb{M}$ to be the unit circle in $\mathbb{R}^2$, and let $\Phi_{l,u}:\mathbb{R}^2\rightarrow\mathbb{R}^2$ be the linear map specified by the matrix
$$
\Phi_{l,u} = \left[
\begin{array}{cc}
3 & 0\\
0 & \frac{1}{2}
\end{array}
\right].
$$
Then $\sigma_{\min} = 1/2$, $\sigma_{max} = 3$, and $l=1/2$, $u=3$. Here, $\Phi_{l,u}(\mathbb{M})$ is an ellipse with principal axes $r_1 = 3$ and $r_2 = 1/2$. Thus, by Proposition \ref{lem:ellipsoidreach}, $\mbox{rch}(\Phi_{l,u}(\mathbb{M}))={r_2^2}/{r_1} =1/12$, which precisely matches the lower bound in Theorem \ref{thm:(Near-Isometry) rch preserved}.
As another example, suppose that $\mathbb{M}$ is the unit circle along the plane in $\mathbb{R}^3$ that passes through $e_1=[1,0,0]^T$ and makes an angle $\theta$ with $e_2=[0,1,0]^T$. Let $\Phi_{l,u}:\mathbb{R}^3\rightarrow\mathbb{R}^2$ be the linear map specified by the matrix
$$
\Phi_{l,u} = \left[
\begin{array}{ccc}
1 & 0 & 0\\
0 & 1 & 0
\end{array}
\right].
$$
Then, one can verify that $\sigma_{\min}=\sigma_{\max}=1$, and that $l=\cos\theta$, $u=1$. In this case, $\Phi_{l,u}(\mathbb{M})$ is an ellipse with principal axes $r_1=1$ and $r_2=\cos \theta=l$. The reach of this ellipse is given by Proposition \ref{lem:ellipsoidreach}: $\mbox{rch}(\Phi_{l,u}(\mathbb{M}))={r_2^2}/{r_1}=l^2$, which exactly matches the lower bound in Theorem \ref{thm:(Near-Isometry) rch preserved}.\footnote{Note the lower bounds in Theorem \ref{thm:(Near-Isometry) rch preserved} scale linearly if $\Phi_{l,u}(\cdot)$ were to be scaled. As a result, the same conclusion holds true if we replace the map $\Phi_{l,u}(\cdot)$ in this example with, say, $2\Phi_{l,u}(\cdot)$. }
However, it is not difficult to construct an example where the bound in Theorem \ref{thm:(Near-Isometry) rch preserved} is \emph{not} tight. Again suppose that $\mathbb{M}$ is the unit circle along the plane in $\mathbb{R}^3$ that passes through $e_1=[1,0,0]^T$ and makes an angle $\theta$ with $e_2=[0,1,0]^T$. Now, let $\Phi_{l,u}:\mathbb{R}^3\rightarrow\mathbb{R}^2$ be the linear map specified by the matrix
$$
\Phi_{l,u} = \left[
\begin{array}{ccc}
2 & 0 & 0\\
0 & 1 & 0
\end{array}
\right].
$$
Then, one can verify that $\sigma_{\min}=1$, $\sigma_{\max}=2$, and that $l=\cos\theta$, $u=2$. In this case, $\Phi_{l,u}(\mathbb{M})$ is an ellipse with principal axes $r_1=2$ and $r_2=\cos \theta=l$. The reach of this ellipse is given by Proposition \ref{lem:ellipsoidreach}: $\mbox{rch}(\Phi_{l,u}(\mathbb{M}))={r_2^2}/{r_1}=\cos^2\theta/2$, which is larger than what Theorem \ref{thm:(Near-Isometry) rch preserved} predicts, namely
\begin{equation*}
\frac{\sigma_{\min}^2l^2}{\sigma_{\max}^3}= \frac{\cos^2\theta}{8}.
\end{equation*}
This appears to be an artifact of the proof technique which, when $m<n$, decomposes $\Phi_{l,u}(\cdot)$ into two bi-Lipschitz maps with isometry constants of $\frac{l}{\sigma_{\max}}\le \frac{u}{\sigma_{\min}}$ and $\sigma_{\min}\le \sigma_{\max}$, respectively.
\section{Applications in Dimensionality Reduction\label{sec:Motivation}}
We conclude by noting that the Question posed in Section~\ref{sec:Introduction} is strongly motivated by recent advances in signal processing and machine learning. The Information Age has carried with it the burden of acquiring, storing, processing, and communicating increasingly higher dimensional signals and data sets. Fortunately, in many cases, the information contained within a high-dimensional signal or data set actually obeys some sort of concise, low-dimensional model~\cite{cande2008introduction,eftekhari2015new}. Of particular interest to us here is the common scenario where the data lives on a $k$-dimensional submanifold $\mathbb{M}\subset\mathbb{R}^{n}$ (and typically $k\ll n$)~\cite{clarkson2008tighter,eftekhari2015new}.
The low dimension of the manifold model motivates the use of \emph{compressive measurements} for simplifying the data acquisition process. Rather than designing a (possibly very expensive) sensor to measure a signal $x\in\mathbb{R}^{n}$, for example, it often suffices to design a sensor that can measure a much shorter vector $\chi=\Phi_{l,u}x\in\mathbb{R}^{m}$, where $\Phi_{l,u}\in\mathbb{R}^{m\times n}$ is a linear measurement operator that acts as a near-isometry on $\mathbb{M}$ (see (\ref{eq:iso})), and where typically $m \ll n$. Data inference tasks (e.g., classification or parameter estimation) can be performed---both reliably and inexpensively---in the measurement space $\mathbb{R}^{m}$ (since $m\ll n$) \cite{hegde2008random}. In fact, it is even possible to reconstruct the original signal $x$ given only $\chi=\Phi_{l,u}x$ (and the knowledge of $\mathbb{M}$ and $\Phi_{l,u}$)~\cite{shah2011iterative,iwen2013approximation}.
In this context, two important cases are worth mentioning in regards to Theorem~\ref{thm:(Near-Isometry) rch preserved}. First, consider the case where the manifold $\mathbb{M}$ is concentrated in or around an $m$-dimensional subspace of $\mathbb{R}^{n}$, and suppose $\Phi_{l,u}$ is chosen as an orthogonal projection onto an orthogonal basis for that subspace. Such optimal projections are the topic of classical Principal Component Analysis (PCA). In this case, the $m$ nonzero singular values of $\Phi$ will exactly equal $1$, and if $l \approx 1$, Theorem~\ref{thm:(Near-Isometry) rch preserved} guarantees a lower bound on $\mbox{rch}\left(\Phi_{l,u}(\mathbb{M})\right)$ that is approximately equal to $\mbox{rch}(\mathbb{M})$.
As a second case, suppose $\Phi$ is generated randomly as an $m \times n$ matrix with $m < n$. Such matrices are commonly used as tool for dimensionality reduction in the field of Compressive Sensing~\cite{donoho2006compressed,candes2008restricted,cande2008introduction}. Consider, in particular, the situation where $\Phi$ is populated with independent and identically distributed Gaussian random variables, each with zero mean and variance $1/m$. In this situation, it is known that assuming
\begin{equation}
m\gtrsim\frac{k}{\Delta_{l,u}}\log\left[\frac{\left(\mbox{vol}_{k}(\mathbb{M})\right)^{\frac{1}{k}}}{\mbox{rch}(\mathbb{M})}\right],\label{eq:RIP}
\end{equation}
then with high probability (\ref{eq:iso}) will hold~\cite{eftekhari2015new} (see also~\cite{clarkson2008tighter}).\footnote{We have somewhat simplified the right hand side above for clarity, hence the sign $\gtrsim$. Exact details may be found in \cite{eftekhari2015new}.} In this case, one may indeed achieve a near-isometric embedding of the manifold with $l \approx u \approx 1$ and guarantee that the reach of the manifold does not collapse. However, the singular values of $\Phi$ will cluster around $\sqrt{n/m}$. Consequently, the lower bound on $\mbox{rch}\left(\Phi_{l,u}(\mathbb{M})\right)$ will be lower than in the first case: around $\sqrt{m/n} \cdot \mbox{rch}(\mathbb{M})$.
\bibliographystyle{plain}
\section{Introduction\label{sec:Introduction}}
Let $\mathbb{M}\subset\mathbb{R}^{n}$ be a $k$-dimensional smooth \emph{submanifold} of $\mathbb{R}^{n}$ with finite diameter and volume, and with nonzero \emph{reach}.\footnote{Reach measures the regularity of a manifold. This, as well as more specific requirements on $\mathbb{M}$, are described in Section \ref{sec:Necessary-Concepts}.} Consider also $\Phi_{l,u}:\mathbb{R}^{n} \rightarrow \mathbb{R}^{m}$ that acts as a \emph{bi-Lipschitz} map on $\mathbb{M}$ in the sense that
\begin{equation}
l\cdot\|x-y\|_{2}\le\left||\Phi_{l,u}(x)-\Phi_{l,u}(y)\right\Vert _{2}\le u\cdot\|x-y\|_{2},\qquad\forall x,y\in\mathbb{M},\label{eq:iso}
\end{equation}
for some $0<l\le1\le u<\infty$. In particular, when $l,u\approx1$, then $\Phi_{l,u}(\cdot)$ is a \emph{near-isometry} on $\mathbb{M}$, in that it barely distorts the pairwise Euclidean distances between points on $\mathbb{M}$.\footnote{The deviation $\max[u-1,1-l]$ (if positive) is commonly referred to as the \emph{isometry constant} of the map $\Phi_{l,u}(\cdot)$ on $\mathbb{M}$.} Such maps naturally arise in a variety of applications in data sciences, often involving dimensionality reduction \cite{broomhead2001whitney,donoho2006compressed,candes2008restricted,clarkson2008tighter,hegde2008random,eftekhari2015new,hegde2015numax}; we will expand on this remark in Section \ref{sec:Motivation}. Let us point out that we only assume the map $\Phi_{l,u}(\cdot)$ to be bi-Lipschitz on $\mathbb{M}$, not on the entire domain $\mathbb{R}^{n}$. This is a subtle but crucial detail which will be significant, for example, in applications where $\Phi_{l,u}$ is linear and where $m < n$. In such applications $\Phi_{l,u}(\cdot)$ will have a nullspace and map many vectors to $0$, but for~\eqref{eq:iso} to be satisfied with $l > 0$ no vector of the form $x-y$ with $x, y \in \mathbb{M}$, $x \neq y$ can be in the nullspace of $\Phi_{l,u}(\cdot)$.
The setup above naturally raises the following question: What happens to $\mathbb{M}$ under the bi-Lipschitz map $\Phi_{l,u}(\cdot)$? It is in fact trivially verified that $\Phi_{l,u}(\mathbb{M})\subset\mathbb{R}^{m}$ is itself a smooth submanifold of $\mathbb{R}^{m}$, where $\Phi_{l,u}(\mathbb{M})$ is the image of $\mathbb{M}$ under $\Phi_{l,u}(\cdot)$. This allows us to define our inquiry more precisely:
\begin{itemize}
\item \textbf{Question:} How do key characteristics of $\Phi_{l,u}(\mathbb{M})$---namely dimension, diameter, volume, and reach---relate to those of $\mathbb{M}$?
\end{itemize}
When $l,u\approx1$, we will verify that
\begin{align*}
\dim\left(\Phi_{l,u}(\mathbb{M})\right) & =\dim\left(\mathbb{M}\right), \\
\mbox{diam}\left(\Phi_{l,u}(\mathbb{M})\right)&\approx\mbox{diam}\left(\mathbb{M}\right), \\
\mbox{vol}_{k}\left(\Phi_{l,u}(\mathbb{M})\right)&\approx\mbox{vol}_{k}\left(\mathbb{M}\right),
\end{align*}
as formalized in Proposition \ref{lem:easy}. However, for reach---an important attribute of the manifold---the story is somewhat different as additional restrictions must be imposed on $\Phi_{l,u}(\cdot)$ for reach to be approximately preserved. We briefly outline this peculiar case next and defer the details to Section~\ref{sec:Main-Results}.
Reach, as a measure of regularity of a submanifold of Euclidean space, can be traced back to the pioneering works in \emph{geometric measure theory}~\cite{federer1959curvature}. More recently, the concept of reach has proved indispensable in the role that manifold models play in signal processing and machine learning~\cite{niyogi,baraniuk2009random,hegde2008random,yap2013stable,iwen2013approximation,verma2012,davenport2007sfc}. As elaborated later in Proposition \ref{lem:exact iso}, reach is actually preserved under an \emph{exact isometry}, i.e., $\mbox{rch}(\Phi_{1,1}(\mathbb{M}))=\mbox{rch}(\mathbb{M})$. However, there is generally no relation between $\mbox{rch}(\Phi_{l,u}(\mathbb{M}))$ and $\mbox{rch}(\mathbb{M})$ when $l<1<u$, and we provide a concrete example in Proposition \ref{fact:In-general,-reach} to demonstrate this. This example involves a nonlinear choice of $\Phi_{l,u}(\cdot)$. Interestingly, however, if we limit ourselves to the class of {\em linear} maps, reach is nearly preserved. Specifically, we can lower bound $\mbox{rch}\left(\Phi_{l,u}(\mathbb{M})\right)$ in terms of $\mbox{rch}(\mathbb{M})$ when $\Phi_{l,u}(\cdot)$ is a linear near-isometry; we formalize this claim in Theorem~\ref{thm:(Near-Isometry) rch preserved}.
Before attending to the details, however, we present the necessary background in Section~\ref{sec:Necessary-Concepts} to make this paper self-contained. Then, Section~\ref{sec:Main-Results} makes precise the claims we outlined above, with further discussion and context for these results appearing in Section~\ref{sec:discussion}. In Section~\ref{sec:Motivation}, revisiting the applications of nearly-isometric maps in data sciences, we show how the (seemingly abstract) Question above naturally arises in modern signal processing and machine learning, and we discuss the implications of our results in these contexts. We defer all proofs to the appendices.
\section{Necessary Concepts\label{sec:Necessary-Concepts}}
Let $\mathbb{M}\subset\mathbb{R}^{n}$ be a smooth, bounded, and boundary-less $k$-dimensional submanifold of $\mathbb{R}^{n}$. More formally, $\mathbb{M}$ satisfies the following. Any point $x\in\mathbb{M}$ belongs to some \emph{neighborhood} $\mathbb{U}_{x}\subseteq\mathbb{M}$ that is \emph{diffeomorphic}\footnote{A diffeomorphism is a smooth and bijective map with a smooth inverse.} to $\mathbb{R}^{k}$, and the transition between adjacent neighborhoods is smooth \cite{morgan1998riemannian,lee2009manifolds}.\footnote{By smooth transition we mean the following: If $\phi_{x}:\mathbb{U}_{x}\rightarrow\mathbb{R}^{k}$ and $\phi_{x'}:\mathbb{U}_{x'}\rightarrow\mathbb{R}^{k}$ are, respectively, the diffeomorphisms corresponding to the neighborhoods $\mathbb{U}_{x}$ and $\mathbb{U}_{x'}$ on the manifold $\mathbb{M}$ and $\mathbb{U}_{x}\cap\mathbb{U}_{x'}\ne\emptyset$, then the composition $(\phi_{x}\circ\phi_{x'}^{-1})(\cdot)$ must be smooth (wherever defined).}
To every point $x\in\mathbb{M}$, we assign a \emph{tangent subspace} $\mathbb{T}_{x}\mathbb{M}\subset\mathbb{R}^{n}$ comprised of the directions of all smooth curves on $\mathbb{M}$ that pass through $x$:
\begin{align*}
&\mathbb{T}_{x}\mathbb{M}:= \\
&~~~\mbox{span}\left[\left\{ \frac{d\gamma}{dt}(0)\,|\,\gamma:[-1,1]\rightarrow\mathbb{M}\mbox{ is a smooth curve and }\gamma(0)=x\in\mathbb{M}\right\} \right].
\end{align*}
At any $x\in\mathbb{M}$, we note that $\mathbb{T}_{x}\mathbb{M}$ is a $k$-dimensional linear subspace of $\mathbb{R}^{n}$. The \emph{tangent bundle} of $\mathbb{M}$ is the collection of all tangent subspaces:
\[
\mathbb{T}\mathbb{M}:=\bigcup_{x\in\mathbb{M}}\{x\}\times\mathbb{T}_{x}\mathbb{M}.
\]
The \emph{normal subspace} $\mathbb{N}_{x}\mathbb{M}$ is the orthogonal complement of $\mathbb{T}_{x}\mathbb{M}$ with respect to $\mathbb{R}^{n}$ so that
\[
\mathbb{R}^{n}=\mathbb{T}_{x}\mathbb{M}\oplus\mathbb{N}_{x}\mathbb{M},
\]
(with $\oplus$ standing for direct sum). Thus, at any $x\in\mathbb{M}$, $\mathbb{N}_{x}\mathbb{M}$ is an $(n-k)$-dimensional linear subspace of $\mathbb{R}^{n}$. The \emph{normal bundle} of $\mathbb{M}$ is the collection of all normal subspaces:
\[
\mathbb{N}\mathbb{M}:=\bigcup_{x\in\mathbb{M}}\{x\}\times\mathbb{N}_{x}\mathbb{M}.
\]
For $r>0$, we also let $\mathbb{N}^r\mathbb{M}\subset\mathbb{N}\mathbb{M}$ denote the \emph{open normal bundle} of $\mathbb{M}$ of radius $r$ comprised of all normal vectors of length less than $r$. For example, when $\mathbb{M}$ is the unit circle in $\mathbb{R}^{2}$ and $r\in(0,1)$, $\mathbb{N}^r\mathbb{M}$ may be identified with a disc of width $2r$ (around the circle); see Figure~\ref{fig:circle}.
\begin{figure}[t]
\begin{center}
\includegraphics[width=50mm]{circle.pdf}
\end{center}
\vspace*{-5mm} \caption{\small\sl \label{fig:circle} The reach of the unit circle (in bold) is equal to $1$, as the open normal bundle of radius $r$ (shaded) is embedded in $\mathbb{R}^{2}$ for any $r<1$. Moreover, any point in $\mathbb{R}^{2}$ whose distance from the unit circle is less than $1$ has a unique nearest point on the unit circle.
}
\end{figure}
The reach of $\mathbb{M}$ \cite{federer1959curvature}, denoted by $\mbox{rch}(\mathbb{M})$ throughout, is a geometric attribute that captures valuable local and global properties of a manifold (that we will highlight shortly).
\begin{definition}\label{def:rch}
\textbf{{(Reach)}} For a smooth submanifold $\mathbb{M}\subset\mathbb{R}^{n}$, the reach of $\mathbb{M}$ (denoted by $\mbox{rch}(\mathbb{M})$) is the
largest number having the following property: the open normal bundle of $\mathbb{M}$ of radius $r$ is embedded in $\mathbb{R}^{n}$ for all $r<\mbox{rch}(\mathbb{M})$.
\end{definition}
For example, the reach of a circle of radius $\rho$ is simply $\rho$ itself. This fact is generalized by the following result, which may be of its own independent interest.
\begin{proposition}
\label{lem:ellipsoidreach}\textbf{\emph{(Reach of an ellipsoid)}}
Let $\mathbb{M}$ be an $(n-1)$-dimensional ellipsoid in $\mathbb{R}^n$ with principal axes $r_1 \ge r_2 \ge \cdots \ge r_n > 0$. Then
\[
\mbox{rch}(\mathbb{M}) = \frac{r_n^2}{r_1}.
\]
\end{proposition}
By definition, any point in $\mathbb{R}^{n}$ within the distance $\mbox{rch}(\mathbb{M})$ of $\mathbb{M}$ has a unique nearest point on $\mathbb{M}$. The role of reach can be summarized in two key properties (see the Toolbox in \cite{eftekhari2015new} for more details). The first property concerns local regularity of $\mathbb{M}$: the curvature of any unit-speed {\em geodesic curve}\footnote{Loosely speaking, a geodesic curve between a pair of points on $\mathbb{M}$ is a curve on $\mathbb{M}$ that locally minimizes the distances \cite{lee2009manifolds}. For example, an arc on a circle is a geodesic curve between its end points. Note that the geodesic curve between two points is not necessarily unique.} on $\mathbb{M}$ is bounded by $(\mbox{rch}(\mathbb{M}))^{-1}$. \label{p:curv rch} The second property concerns global regularity: at long \emph{geodesic distances},\footnote{The geodesic distance between a pair of points on $\mathbb{M}$ is the length of the shortest geodesic curve connecting those two points \cite{lee2009manifolds}.} the reach controls how close the manifold may curve back upon itself. For example, supposing $x,y\in\mathbb{M}$ with geodesic distance $d_{\mathbb{M}}(x,y)$, we have that
\[
d_{\mathbb{M}}(x,y)>\mbox{rch}(\mathbb{M})\Longrightarrow\|x-y\|_{2}>\frac{\mbox{rch}(\mathbb{M})}{2}.
\]
\section{Results\label{sec:Main-Results}}
Let $\mathbb{M}\subset\mathbb{R}^{n}$ be a smooth, bounded, and boundary-less $k$-dimensional submanifold of $\mathbb{R}^{n}$. We let $\mbox{diam}(\mathbb{M})$, $\mbox{vol}_{k}(\mathbb{M})$, and $\mbox{rch}(\mathbb{M})>0$ denote, respectively, the diameter, $k$-dimensional volume, and reach of $\mathbb{M}$. For $0<l\le1\le u<\infty$ and for $m \ge k$, let $\Phi_{l,u}:\mathbb{R}^{n}\rightarrow\mathbb{R}^{m}$ be a smooth bi-Lipschitz map on $\mathbb{M}$ so that
\begin{equation}
l\cdot\|x-y\|_{2}\le\|\Phi_{l,u}(x)-\Phi_{l,u}(y)\|_{2}\le u\cdot\|x-y\|_{2},\qquad\forall x,y\in\mathbb{M}.\label{eq:near iso}
\end{equation}
Some basic properties of $\Phi_{l,u}(\mathbb{M})$, the image of $\mathbb{M}$ under $\Phi_{l,u}(\cdot)$, are collected below and proved in Appendix~\ref{sec:Proof-of-Lemma easy}. One key insight used in the proof is the following: Under $\Phi_{l,u}(\cdot)$, a tangent vector $v\in\mathbb{T}_x\mathbb{M}$ is mapped to a tangent vector at $\Phi_{l,u}(x)$. To be precise, $v\rightarrow D\Phi_{l,u}(x) \cdot v$, where $D\Phi_{l,u}(x)\in\mathbb{R}^{m\times n}$ is the derivative of $\Phi_{l,u}(\cdot)$ at $x$. Moreover, $ D\Phi_{l,u}(x)$ acts as a near-isometry on $\mathbb{T}_{x}\mathbb{M}$ if $\Phi_{l,u}(\cdot)$ is itself a near-isometry on $\mathbb{M}$.
\begin{proposition}
\label{lem:easy}\textbf{\emph{(Basic properties)}} Let the manifold $\mathbb{M}$ and map $\Phi_{l,u}(\cdot)$ be as specified above. Then, $\Phi_{l,u}(\mathbb{M})$ is itself a smooth, bounded, and boundary-less $k$-dimensional submanifold of $\mathbb{R}^{m}$. Moreover, it holds that
\[
l\cdot \mbox{diam}(\mathbb{M}) \le \mbox{diam}\left( \Phi_{l,u}(\mathbb{M}) \right) \le u\cdot \mbox{diam}(\mathbb{M}),
\]
\[
l^{k}\cdot\mbox{vol}_{k}(\mathbb{M})\le\mbox{vol}_{k}\left(\Phi_{l,u}\left(\mathbb{M}\right)\right)\le u^{k}\cdot\mbox{vol}_{k}(\mathbb{M}).
\]
\end{proposition}
Further discussion of this result appears in Section \ref{sec:discussion}.
Before we study how a nearly isometric map affects the reach of a smooth manifold, some results are in order to build intuition and form insight to the problem. The next result, proved in Appendix~\ref{sec:Proof-of-Lemma key exact iso}, states that (not surprisingly) the tangent structure of the manifold remains entirely intact under an exact isometry on $\mathbb{M}$, i.e., when $l=u=1$. The key insight used in the proof is that the angle between any pair of tangent vectors in $\mathbb{M}$ is preserved in $\Phi_{l,u}(\mathbb{M})$ if $\Phi_{l,u}(\cdot)$ is an exact isometry on $\mathbb{M}$.
\begin{proposition}
\label{lem:key exact iso}\textbf{\emph{(Tangent bundle under exact isometry)}}
For the manifold $\mathbb{M}$ specified earlier, take $p,q\in\mathbb{M}$. When $l=u=1$, it holds that
\[
\angle\left[\mathbb{T}_{\Phi_{l,u}(p)}\Phi_{l,u}\left(\mathbb{M}\right),\mathbb{T}_{\Phi_{l,u}(q)}\Phi_{l,u}\left(\mathbb{M}\right)\right]=\angle\left[\mathbb{T}_{p}\mathbb{M},\mathbb{T}_{q}\mathbb{M}\right],
\]
with $\angle[\mathbb{A},\mathbb{B}]$ standing for the angle between the subspaces $\mathbb{A}$ and $\mathbb{B}$.\footnote{\label{p:angle}Angle between subspaces generalizes the notion of angle between lines. The (largest principle) angle between the two subspaces $\mathbb{A}$ and $\mathbb{B}$ is defined such that $\cos(\angle[\mathbb{A},\mathbb{B}]):= \min_a\max_b \cos(\angle [a,b])$, where the optimization is over all vectors $a\in\mathbb{A}$ and $b\in\mathbb{B}$.
See \cite{horn1994topics} for more details.}
\end{proposition}
To extend Proposition \ref{lem:key exact iso} to a general bi-Lipschitz map on $\mathbb{M}$ with $l\le1\le h$, we restrict ourselves to linear maps. The next result is proved in Appendix \ref{sec:Proof-of-Lemma key near iso}.
\begin{proposition}
\label{lem:key near iso}\textbf{\emph{(Tangent bundle under linear near-isometry)}}
With the manifold $\mathbb{M}$ as before, take $p,q\in\mathbb{M}$. If the map $\Phi_{l,u}:\mathbb{R}^{n}\rightarrow\mathbb{R}^{m}$ is linear on $\mathbb{R}^{n}$ and bi-Lipschitz on $\mathbb{M}$ (i.e., satisfies~(\ref{eq:near iso})), then
\begin{align*}
&\left|\cos\left(\angle[\mathbb{T}_{\Phi_{l,u}(p)}\Phi_{l,u}\left(\mathbb{M}\right),\mathbb{T}_{\Phi_{l,u}\left(q\right)}\Phi_{l,u}\left(\mathbb{M}\right)]\right)-\cos\left(\angle\left[\mathbb{T}_{p}\mathbb{M},\mathbb{T}_{q}\mathbb{M}\right]\right)\right|
\\
& \qquad \le \frac{25}{4l^2} \cdot \frac{\|p-q\|_2^2}{ \mbox{rch}(\mathbb{M})^2} \cdot \left(\max(\|\Phi_{l,u}\|^2,u^2)+1 \right)^2 + \frac{18\max\left(\Delta_{l,u},\sqrt{\Delta_{l,u}}\right)}{l^2},
\end{align*}
where $\Delta_{l,u}:=\max\left[1-l^{2},u^{2}-1\right]$ and $\|\Phi_{l,u}\|$ is the spectral norm of the matrix representation of the linear operator $\Phi_{l,u}(\cdot)$.
\end{proposition}
In words, the angles between tangent spaces on the manifold remain \emph{nearly} unchanged under a linear near-isometry ($l,u\approx1$), for sufficiently close points on the manifold (those within a distance of approximately ${\|\Phi_{l,u}\|^{-2} \mbox{rch}(\mathbb{M})}$). The proof of this fact involves sampling two additional points from the manifold, one near $p$ and one near $q$, controlling the distances between all four of these points under the bi-Lipschitz map $\Phi_{l,u}$, and relating these distances to the angles between the tangent spaces at $p$ and $q$.
Finally, what can be said about $\mbox{rch}(\Phi_{l,u}(\mathbb{M}))$? The next result, proved in Appendix \ref{sec:proof of exact iso}, deals with the special case of an exact isometry.
\begin{proposition}
\label{lem:exact iso}\textbf{\emph{(Reach under exact isometry)}}
Consider the manifold $\mathbb{M}$ as before, and take $l=u=1$. Then,
\[
\mbox{rch}\left(\Phi_{l,u}\left(\mathbb{M}\right)\right)=\mbox{rch}\left(\mathbb{M}\right).
\]
\end{proposition}
We note that Proposition~\ref{lem:exact iso} does not require $\Phi_{1,1}:\mathbb{R}^{n} \rightarrow \mathbb{R}^{m}$ to be linear, nor does it place any restriction on $m$ (aside from the requirement---assumed throughout this section---that $m \ge k$). The key insight here is that $\Phi_{1,1}(\cdot)$ preserves not only pairwise distances on $\mathbb{M}$, but also the angles between pairs of tangent spaces of $\mathbb{M}$ (see Proposition~\ref{lem:key exact iso}). This in turn guarantees that $\Phi_{1,1}(\mathbb{M})$ is as regular as $\mathbb{M}$ itself (as recorded in the above proposition).
What about the case $l<1$ or $u>1$, where $\Phi_{l,u}(\cdot)$ is not an exact isometry on $\mathbb{M}$? In full generality, there is no relation between $\mbox{rch}(\Phi_{l,u}(\mathbb{M}))$ and $\mbox{rch}(\mathbb{M})$. This is demonstrated in Appendix~\ref{sec:Proof-of-Proposition in general} where, by adding a smooth ``cusp'' of width $2\delta$ to a line segment in $\mathbb{R}^2$, we explicitly construct a manifold $\mathbb{M}$ and a near-isometric map $\Phi_{l,u}(\cdot)$ on $\mathbb{M}$ such that $\mbox{rch}(\Phi_{l,u}(\mathbb{M}))\le \frac{\delta}{\sqrt{2}}\ll\infty=\mbox{rch}(\mathbb{M})$.
\begin{proposition}
\textbf{\label{fact:In-general,-reach}\emph{(Negative result)}}
In general, reach is not preserved under a bi-Lipschitz mapping.
\end{proposition}
When $\Phi_{l,u}(\cdot)$ is linear, however, we can lower bound $\mbox{rch}\left(\Phi_{l,u}(\mathbb{M})\right)$ in terms of $\mbox{rch}(\mathbb{M})$; the following theorem is proved in Appendix~\ref{sec:Proof-of-Theorem linear Phi}.
\begin{theorem}
\textbf{\label{thm:(Near-Isometry) rch preserved}\emph{(Reach under linear near-isometry)}}
Consider the manifold $\mathbb{M}$ specified earlier. Suppose $m \le n$, and suppose $\Phi_{l,u}(\cdot)$ to be a rank-$m$ linear map from $\mathbb{R}^{n}$ to $\mathbb{R}^{m}$ with its $m$ nonzero singular values in the interval $[\sigma_{\min},\sigma_{\max}]\subset (0,\infty)$. Then, if $m=n$, it holds that
\[
\mbox{rch}\left(\Phi_{l,u}(\mathbb{M})\right) \ge \frac{\sigma_{\min}^2}{\sigma_{\max}}\cdot\mbox{rch}(\mathbb{M}),
\]
whereas, if $m<n$, it holds that
\[
\mbox{rch}\left(\Phi_{l,u}(\mathbb{M})\right) \ge \frac{\sigma_{\min}^2l^2}{\sigma_{\max}^3}\cdot\mbox{rch}(\mathbb{M}).
\]
\end{theorem}
We note that Theorem~\ref{thm:(Near-Isometry) rch preserved} does require $\Phi_{l,u}:\mathbb{R}^{n} \rightarrow \mathbb{R}^{m}$ to be linear, and it also requires that $m \le n$ (in addition to the requirement that $m \ge k$). The proof, without any loss of generality, models the linear map $\Phi_{l,u}(\cdot)$ as an orthogonal projection followed by stretching in $\mathbb{R}^m$ along different coordinates, and then records how the reach changes in each of these two steps. In the first step, we use Definition \ref{def:rch} to directly quantify the rather involved effect of orthogonal projection on the reach. On the other hand, qualitatively speaking, modestly scaling an object along different coordinates will not substantially distort its geometry, and we will solidify this notion in the second step of the proof. Combining the two steps proves Theorem \ref{thm:(Near-Isometry) rch preserved}.
\section{Discussion}
\label{sec:discussion}
Manifold embeddings have a rich history in differential topology and geometry. The following discussion might help put our results in the proper context. First, the (strong) Whitney embedding theorem~\cite{whitney1936differentiable} states that any $k$-dimensional smooth manifold $\mathbb{M}$ (not necessarily originating as a submanifold of any Euclidean space) can be smoothly embedded into $\mathbb{R}^{2k}$.\footnote{In this context, a smooth embedding is simply a diffeomorphism.} In contrast, the type of bi-Lipschitz map $\Phi_{l,u}:\mathbb{R}^n\rightarrow\mathbb{R}^m$ that we consider in this paper can be interpreted as \emph{stably} embedding $\mathbb{M}$ (which does originate as a submanifold of $\mathbb{R}^n$) into $\mathbb{R}^m$. In particular, stability in this sense refers to the preservation of extrinsic, Euclidean distances as formalized in~\eqref{eq:iso}. As noted in~\cite{baraniuk2009random}, this type of embedding can also imply the preservation of intrinsic, geodesic distances. The celebrated Nash embedding theorem~\cite{nash1956imbedding} also concerns the embedding of manifolds in Euclidean space, but with an exact isometry. However, isometry in this context refers only to the preservation of intrinsic, geodesic distances.
In Section~\ref{sec:Motivation}, we discuss how certain randomized constructions have been used to construct linear mappings $\Phi_{l,u}:\mathbb{R}^n\rightarrow\mathbb{R}^m$ that satisfy~\eqref{eq:iso} with $m$ as small as possible. Deterministic linear constructions, adapted to the structure of the manifold $\mathbb{M}$ have also been proposed~\cite{broomhead2001whitney,hegde2015numax} to satisfy~\eqref{eq:iso}. Other manifold learning algorithms such as ISOMAP~\cite{tenenbaum2000global}, however, typically involve nonlinear maps designed to preserve only intrinsic, geodesic distances.
Regarding the implications of bi-Lipschitz mappings that we have derived in this paper, let us begin by discussing the assumptions made in Proposition~\ref{lem:easy}. First, it is worth noting that the dimension of a manifold is actually invariant under any homeomorphism.\footnote{A homeomorphism is a continuous and bijective map with a continuous inverse.} One might also consider replacing the bi-Lipschitz map in Proposition \ref{lem:easy} with a ``locally'' bi-Lipschitz map, one that barely distorts the angle between any pair of tangent vectors anchored at the same point on $\mathbb{M}$. It is not difficult to verify that the dimension of $\mathbb{M}$ remains invariant under a locally bi-Lipschitz map and that such a map only modestly changes the volume. The diameter and reach, however, might change drastically under a locally bi-Lipschitz map. One example is rolling a thin and very long strip of paper along its length (as one would roll up a carpet); this transformation does not distort the angle between any pair of tangent vectors (at the same point) but can arbitrarily reduce the diameter and reach. On the other hand, it is possible to construct an operator that maps such a manifold to itself while significantly distorting the tangent vectors (one could envision placing one's palm on a rubber sheet, and twisting). In this case, the diameter, volume, and reach would all remain the same. However, depending on the conditioning of the Jacobian at a point on the sheet, a pair of tangent vectors at that point could map to vectors with a significantly different angle between them.
Regarding Proposition \ref{lem:key near iso}, we believe that there may be some room for improvement. While this result confirms that the angles between tangent spaces are better preserved as the isometry of the bi-Lipschitz map tightens (i.e., as $\Delta_{l,u} \rightarrow 0$), for a fixed $p$ and $q$, the right hand side of the bound does not go to zero. We do believe that some dependence on $\|p-q\|_2^2$ is natural: for points farther away, the isometry constant must be tighter in order to preserve the angles between the respective tangent spaces. However, it may be possible to derive a bound on the right hand side that scales with the product of $\|p-q\|_2^2$ and $\Delta_{l,u}$, rather than their sum.
Finally, let us explore the tightness of the bounds in Theorem~\ref{thm:(Near-Isometry) rch preserved} using some toy examples. For instance, consider $\mathbb{M}$ to be the unit circle in $\mathbb{R}^2$, and let $\Phi_{l,u}:\mathbb{R}^2\rightarrow\mathbb{R}^2$ be the linear map specified by the matrix
$$
\Phi_{l,u} = \left[
\begin{array}{cc}
3 & 0\\
0 & \frac{1}{2}
\end{array}
\right].
$$
Then $\sigma_{\min} = 1/2$, $\sigma_{max} = 3$, and $l=1/2$, $u=3$. Here, $\Phi_{l,u}(\mathbb{M})$ is an ellipse with principal axes $r_1 = 3$ and $r_2 = 1/2$. Thus, by Proposition \ref{lem:ellipsoidreach}, $\mbox{rch}(\Phi_{l,u}(\mathbb{M}))={r_2^2}/{r_1} =1/12$, which precisely matches the lower bound in Theorem \ref{thm:(Near-Isometry) rch preserved}.
As another example, suppose that $\mathbb{M}$ is the unit circle along the plane in $\mathbb{R}^3$ that passes through $e_1=[1,0,0]^T$ and makes an angle $\theta$ with $e_2=[0,1,0]^T$. Let $\Phi_{l,u}:\mathbb{R}^3\rightarrow\mathbb{R}^2$ be the linear map specified by the matrix
$$
\Phi_{l,u} = \left[
\begin{array}{ccc}
1 & 0 & 0\\
0 & 1 & 0
\end{array}
\right].
$$
Then, one can verify that $\sigma_{\min}=\sigma_{\max}=1$, and that $l=\cos\theta$, $u=1$. In this case, $\Phi_{l,u}(\mathbb{M})$ is an ellipse with principal axes $r_1=1$ and $r_2=\cos \theta=l$. The reach of this ellipse is given by Proposition \ref{lem:ellipsoidreach}: $\mbox{rch}(\Phi_{l,u}(\mathbb{M}))={r_2^2}/{r_1}=l^2$, which exactly matches the lower bound in Theorem \ref{thm:(Near-Isometry) rch preserved}.\footnote{Note the lower bounds in Theorem \ref{thm:(Near-Isometry) rch preserved} scale linearly if $\Phi_{l,u}(\cdot)$ were to be scaled. As a result, the same conclusion holds true if we replace the map $\Phi_{l,u}(\cdot)$ in this example with, say, $2\Phi_{l,u}(\cdot)$. }
However, it is not difficult to construct an example where the bound in Theorem \ref{thm:(Near-Isometry) rch preserved} is \emph{not} tight. Again suppose that $\mathbb{M}$ is the unit circle along the plane in $\mathbb{R}^3$ that passes through $e_1=[1,0,0]^T$ and makes an angle $\theta$ with $e_2=[0,1,0]^T$. Now, let $\Phi_{l,u}:\mathbb{R}^3\rightarrow\mathbb{R}^2$ be the linear map specified by the matrix
$$
\Phi_{l,u} = \left[
\begin{array}{ccc}
2 & 0 & 0\\
0 & 1 & 0
\end{array}
\right].
$$
Then, one can verify that $\sigma_{\min}=1$, $\sigma_{\max}=2$, and that $l=\cos\theta$, $u=2$. In this case, $\Phi_{l,u}(\mathbb{M})$ is an ellipse with principal axes $r_1=2$ and $r_2=\cos \theta=l$. The reach of this ellipse is given by Proposition \ref{lem:ellipsoidreach}: $\mbox{rch}(\Phi_{l,u}(\mathbb{M}))={r_2^2}/{r_1}=\cos^2\theta/2$, which is larger than what Theorem \ref{thm:(Near-Isometry) rch preserved} predicts, namely
\begin{equation*}
\frac{\sigma_{\min}^2l^2}{\sigma_{\max}^3}= \frac{\cos^2\theta}{8}.
\end{equation*}
This appears to be an artifact of the proof technique which, when $m<n$, decomposes $\Phi_{l,u}(\cdot)$ into two bi-Lipschitz maps with isometry constants of $\frac{l}{\sigma_{\max}}\le \frac{u}{\sigma_{\min}}$ and $\sigma_{\min}\le \sigma_{\max}$, respectively.
\section{Applications in Dimensionality Reduction\label{sec:Motivation}}
We conclude by noting that the Question posed in Section~\ref{sec:Introduction} is strongly motivated by recent advances in signal processing and machine learning. The Information Age has carried with it the burden of acquiring, storing, processing, and communicating increasingly higher dimensional signals and data sets. Fortunately, in many cases, the information contained within a high-dimensional signal or data set actually obeys some sort of concise, low-dimensional model~\cite{cande2008introduction,eftekhari2015new}. Of particular interest to us here is the common scenario where the data lives on a $k$-dimensional submanifold $\mathbb{M}\subset\mathbb{R}^{n}$ (and typically $k\ll n$)~\cite{clarkson2008tighter,eftekhari2015new}.
The low dimension of the manifold model motivates the use of \emph{compressive measurements} for simplifying the data acquisition process. Rather than designing a (possibly very expensive) sensor to measure a signal $x\in\mathbb{R}^{n}$, for example, it often suffices to design a sensor that can measure a much shorter vector $\chi=\Phi_{l,u}x\in\mathbb{R}^{m}$, where $\Phi_{l,u}\in\mathbb{R}^{m\times n}$ is a linear measurement operator that acts as a near-isometry on $\mathbb{M}$ (see (\ref{eq:iso})), and where typically $m \ll n$. Data inference tasks (e.g., classification or parameter estimation) can be performed---both reliably and inexpensively---in the measurement space $\mathbb{R}^{m}$ (since $m\ll n$) \cite{hegde2008random}. In fact, it is even possible to reconstruct the original signal $x$ given only $\chi=\Phi_{l,u}x$ (and the knowledge of $\mathbb{M}$ and $\Phi_{l,u}$)~\cite{shah2011iterative,iwen2013approximation}.
In this context, two important cases are worth mentioning in regards to Theorem~\ref{thm:(Near-Isometry) rch preserved}. First, consider the case where the manifold $\mathbb{M}$ is concentrated in or around an $m$-dimensional subspace of $\mathbb{R}^{n}$, and suppose $\Phi_{l,u}$ is chosen as an orthogonal projection onto an orthogonal basis for that subspace. Such optimal projections are the topic of classical Principal Component Analysis (PCA). In this case, the $m$ nonzero singular values of $\Phi$ will exactly equal $1$, and if $l \approx 1$, Theorem~\ref{thm:(Near-Isometry) rch preserved} guarantees a lower bound on $\mbox{rch}\left(\Phi_{l,u}(\mathbb{M})\right)$ that is approximately equal to $\mbox{rch}(\mathbb{M})$.
As a second case, suppose $\Phi$ is generated randomly as an $m \times n$ matrix with $m < n$. Such matrices are commonly used as tool for dimensionality reduction in the field of Compressive Sensing~\cite{donoho2006compressed,candes2008restricted,cande2008introduction}. Consider, in particular, the situation where $\Phi$ is populated with independent and identically distributed Gaussian random variables, each with zero mean and variance $1/m$. In this situation, it is known that assuming
\begin{equation}
m\gtrsim\frac{k}{\Delta_{l,u}}\log\left[\frac{\left(\mbox{vol}_{k}(\mathbb{M})\right)^{\frac{1}{k}}}{\mbox{rch}(\mathbb{M})}\right],\label{eq:RIP}
\end{equation}
then with high probability (\ref{eq:iso}) will hold~\cite{eftekhari2015new} (see also~\cite{clarkson2008tighter}).\footnote{We have somewhat simplified the right hand side above for clarity, hence the sign $\gtrsim$. Exact details may be found in \cite{eftekhari2015new}.} In this case, one may indeed achieve a near-isometric embedding of the manifold with $l \approx u \approx 1$ and guarantee that the reach of the manifold does not collapse. However, the singular values of $\Phi$ will cluster around $\sqrt{n/m}$. Consequently, the lower bound on $\mbox{rch}\left(\Phi_{l,u}(\mathbb{M})\right)$ will be lower than in the first case: around $\sqrt{m/n} \cdot \mbox{rch}(\mathbb{M})$.
\bibliographystyle{plain}
| {'timestamp': '2016-11-23T02:01:22', 'yymm': '1512', 'arxiv_id': '1512.06906', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06906'} | arxiv |
\section{Introduction}
The past few years have seen a large increase in the interest for
modelling dynamic interactions between individuals.
Continuous-time information on interactions is often available,
as e.g. email exchanges between employees in a company
~\citep{Enron} or
face-to-face contacts between individuals measured by sensors~\citep{Stehle}, but most models use discrete time.
Commonly, data are aggregated
on predefined
time intervals to obtain a sequence of snapshots of random graphs. Besides the
loss of information induced by aggregation,
the specific choice of the time intervals has a direct impact on the results, most often overlooked.
Thus, developing continuous-time models
-- either called \emph{longitudinal
networks, interaction event data, link streams} or \emph{temporal
networks} -- is an important research issue.
Statistical methods for longitudinal networks form a huge corpus, especially in social sciences and we are not exhaustive here,
see~\cite{Holme_review} for a more complete review.
It is natural to model temporal event data by stochastic point processes.
An important line of research involves
continuous-time Markov processes with seminal works on dyad-independent
models \citep{Wasserman_80a,Wasserman_80b}
or the so-called stochastic actor
oriented models~\citep[e.g.][]{Snijders_vDuijn,snijders2010}.
In these works interactions last during some time.
In contrast, here we focus on instantaneous interactions identified with time points.
Furthermore, we are concerned with modelling dependencies
between interactions of pairs of individuals.
The analysis of event data is an old area in statistics~\citep[see e.g.][]{Andersen_book}.
Generally, the number of interactions of all pairs $(i,j)$ of individuals up to time $t$ are modelled by a multivariate counting process $N(t)=(N_{i,j}(t))_{(i,j)}$.
\cite{Butts_08} considers time-stamped interactions
marked by a label representing a behavioural event.
His model is an instance of Cox's multiplicative hazard
model with time-dependent covariates and constant baseline function.
In the same vein, \cite{Vu_etal11} propose a regression-based modelling of the intensity of non recurrent interaction
events. They consider two different frameworks: Cox's multiplicative and Aalen's additive hazard rates.
\cite{Perry_Wolfe_JRSSB} propose another variant of Cox's multiplicative intensity model for recurrent interaction events
where the baseline function is specific to each individual.
In the above mentioned works a set of statistics is chosen by the user
that potentially modulate the interactions.
As in any regression framework, the choice of these statistics raises some
issues: increasing their number
may lead
to a high-dimensional problem, and interpretation of the results might
be blurred by their possible correlations.
The approaches by~\citeauthor{Butts_08}, \citeauthor{Vu_etal11}, \citeauthor{Perry_Wolfe_JRSSB} and others are based on conditional Poisson
processes characterized by random intensities, also known as doubly
stochastic Poisson processes or Cox processes.
An instance of the conditional Poisson process is the Hawkes
process, which is a collection of point processes with some background
rate, where each event adds a nonnegative impulse to the intensity of
all other processes.
Introducing reciprocating Hawkes to parameterize edges \cite{Blundel2012} extend the Infinite Relational Model making all events co-dependent over time.
\cite{Cho_etal14} develop a model for spatial-temporal networks with
missing information, based on Hawkes processes for temporal dynamics
combined with a Gaussian mixture for the spatial dynamics.
Similarly,~\cite{Linderman14} combine temporal Hawkes processes with latent distance models for implicit networks that are not directly observed.
We also mention the existence of models associating point processes with single nodes rather than
pairs, see e.g.~\cite{Fox2016} and the references therein.
Clustering individuals based on interaction data is a well-established technique to take into account the
intrinsic heterogeneity and summarize information.
For discrete-time sequences of graphs, recent
approaches propose generalizations of the stochastic block model to a dynamic
context~\citep{Yang_etal_ML11,Xu_Hero_IEEE,Corneli,Matias_Miele}. Stochastic
block models posit that all individuals belong to
one out of finitely many groups and given these groups all pairs of interactions are
independent. We stress that stochastic block models induce
more general clusterings than community detection
algorithms.
Indeed, clusters are not necessarily characterized by intense within-group interaction and low interaction frequency towards other groups.
Another attempt to use stochastic block models
for interaction events
appears in~\cite{DuBois_Aistat} generalizing
the approach of~\cite{Butts_08} by adding discrete latent variables on the individuals.
We introduce a semiparametric stochastic block model for recurrent interaction events in continuous time, to which we refer as the Poisson process stochastic block model.
Interactions are modelled by conditional inhomogeneous
Poisson processes, whose intensities only depend on the latent groups of the interacting individuals.
In contrast to many other works, we do not rely on a parametric model where intensities are modulated by predefined network statistics, but intensities are modelled and estimated in a nonparametric way.
The model parameters are shown to be identifiable.
Our estimation and clustering approach is a semiparametric version of the variational expectation-maximization algorithm, where the maximization step is replaced by nonparametric estimators of the intensities.
Semiparametric generalizations of the classical
expectation-maximization algorithm have been proposed in many
different contexts; see
e.g. \cite{Bohning,Bordes,Robin_kerfdr} for semiparametric mixtures or \cite{Dannemann} for a semiparametric hidden Markov
model. However, we are not aware of other attempts to incorporate
nonparametric estimates in a variational approximation algorithm.
We propose two different estimations of the nonparametric part of the
model: a histogram approach using \cite{patricia} where the partition size
is adaptively chosen and a kernel estimator based on~\cite{Ramlau}.
With the histogram approach, an integrated classification likelihood
criterion is proposed to select the number of latent groups.
Synthetic experiments and the analysis of two datasets illustrate the strengths and weaknesses of our approach.
The R code is available in the R package \texttt{ppsbm}.
\section{A semiparametric Poisson process stochastic block model}
\subsection{Model}
\label{sec:notation}
We consider the pairwise interactions of $n$ individuals during some time interval $[0,T]$.
For notational convenience we restrict our attention to
directed interactions without self-interactions.
The undirected case and self-interactions are handled similarly.
The set of all pairs of individuals (i.e. the set of all possible dyads in the graph) is denoted
$$
\mathcal R=\{(i,j) : i,j=1,\dots,n;\ i\neq j\},
$$
whose cardinality is $r=n(n-1)$.
We observe the interactions during the time interval $[0,T]$, that is
$$
\mathcal O=\left\{(t_m,i_m,j_m),m=1,\dots,M\right\},
$$
where
$(t_m,i_m,j_m)\in[0,T]\times \mathcal R$ corresponds to the event that
a (directed) interaction from the $i_m$th individual
to the $j_m$th individual occurs at time $t_m$. The total (random) number of events
is $M$.
We assume that $0<t_1<\dots< t_M<T$, i.e. there is at most one event at a time.
Every individual is assumed to belong to one out of $Q$ groups and the relation between two individuals, that is
the way they interact with another, is driven by their group
membership. Let $Z_1,\dots,Z_n$ be independent and identically
distributed (latent) random variables taking values in $\{1,\dots,Q\}$
with non zero probabilities $ \text{pr}(Z_1=q) =\pi_q\ (q=1,\dots,Q)$.
For the moment, $Q$ is considered to be fixed and known.
When no confusion occurs, we also use the notation $Z_i=(Z^{i,1},\dots,Z^{i,Q})$ with $Z^{i,q}\in\{0,1\}$ such that $Z_i$ has multinomial distribution $\mathcal M(1,\pi)$ with $\pi=(\pi_1,\dots,\pi_Q)$.
For every pair $(i,j)\in\mathcal R$ the interactions of individual $i$ to
$j$ conditional on the latent groups $Z_1,\dots,Z_n$ are modelled by a conditional inhomogeneous Poisson
process $N_{i,j}(\cdot)$ on $[0,T]$ with intensity depending only on $Z_i$ and $Z_j$.
For $ q, l=1,\dots, Q$ and $(i,j)\in\mathcal R$ the conditional intensity of $N_{i,j}(\cdot)$ given that $Z_i=q$
and $Z_j=l$ is $\alpha^{(q,l)}(\cdot)$ with corresponding cumulative intensity
$$
A^{(q,l)} (t)= \int_0^t \alpha^{(q,l)}(u)du, \quad (0\le t \le T).
$$
The set of observations $\mathcal O$ is a realization of the multivariate counting process
$\{N_{i,j}(\cdot)\}_{(i,j)\in \mathcal{R}} $ with conditional intensity process $\{\alpha^{(Z_i,Z_j)}(\cdot)\}_{(i,j)\in
\mathcal{R}} $.
The process $N_{i,j}$ is not a Poisson process, but a counting process with intensity $\sum_{q=1}^Q\sum_{l=1}^Q\pi_q\pi_l
\alpha^{(q,l)}$.
We denote $\theta =(\pi,\alpha)$ the infinite-dimensional parameter of
our model and $\text{pr}_\theta$ the Poisson process stochastic block model distribution of the multivariate
counting process $\{N_{i,j}(\cdot)\}_{(i,j)\in \mathcal{R}}$. An
extension of this model that specifically accounts for sparse interactions
processes is given in the Supplementary Material.
\subsection{Identifiability}
\label{sec:ident}
Identifiability of the parameter $\theta$ corresponds to
injectivity of the mapping $\theta \mapsto \text{pr}_\theta$ and may be obtained
at best up to label switching, as defined below.
We denote $\mathfrak{S}_Q$ the set of permutations of $\{1,\dots, Q\}$.
\begin{definition}[Identifiability up to label switching]
The parameter $\theta=(\pi, \alpha)$ of a Poisson process stochastic block model is identifiable on $[0,T]$ up to label switching if
for all $\theta$ and $\tilde\theta$ such that $\text{pr}_\theta =
\text{pr}_{\tilde \theta}$ there exists a permutation $\sigma \in \mathfrak{S}_Q$ such that
\begin{equation*}
\pi_q =\tilde \pi_{\sigma(q)} , \quad
\alpha^{(q,l)} = \tilde \alpha^{(\sigma(q),\sigma(l))} \text{ almost
everywhere on } [0,T], \quad (q, l=1,\dots, Q).
\end{equation*}
\end{definition}
Identifiability (up to label switching) is ensured in the very general setting where the intensities $\alpha^{(q,l)}$
are not equal almost everywhere, that is, they may be identical on at most subsets of $[0,T]$.
\begin{assumption}
\label{hyp:ident}
In the directed setup (resp. undirected), the set of intensities
$\{\alpha^{(q,l)}\}_{q, l=1,\dots, Q}$ contains exactly $Q^2$ (resp. $Q(Q+1)/2$) distinct functions.
\end{assumption}
\begin{proposition}
\label{prop:ident}
Under Assumption~\ref{hyp:ident}, the parameter
$\theta=(\pi,\alpha)$ is identifiable on $[0,T]$ up to label
switching from the Poisson process stochastic block model
distribution $\text{pr}_\theta$, as soon as $n\ge 3$.
\end{proposition}
Assumption~\ref{hyp:ident} is similar to the hypothesis from Theorem 12 in~\cite{AMR_JSPI} that to our knowledge is the only
identifiability result for weighted stochastic block models.
The question whether the necessary condition that any two rows (or any two columns) of the parameter matrix
$\alpha$ are distinct is a sufficient condition for identifiability is not yet answered
even in the simpler binary case.
In the binary stochastic block model, the results in~\cite{AMR_AoS,AMR_JSPI}
establish \emph{generic} identifiability, which
means identifiability except on a subset of parameters with Lebesgue measure zero, without specifying this subset. For the directed and binary
stochastic block model,~\cite{Celisse_etal} establish identifiability under the assumption that the product vector $\alpha \pi$ (or
$\pi^\intercal \alpha$) has distinct coordinates. This condition is slightly stronger than requiring any two rows of
the parameter matrix to be distinct. Another identifiability result appears in~\cite{bickel2011}
for some specific block models. These last two approaches are dedicated to the binary setup and cannot be generalized to the continuous case.
Proposition \ref{prop:ident} does not cover the undirected affiliation
case, where only two intensities $\alpha^{\text{in}}$ and
$\alpha^{\text{out}}$ are considered such that $\alpha^{(q,q)}=\alpha^\text{in}$ and
$\alpha^{(q,l)}=\alpha^\text{out}\ (q,l=1,\dots, Q;\ q\neq l)$.
\begin{proposition}
\label{prop:ident_affil}
If the intensities $\alpha^\text{in}$ and
$\alpha^\text{out}$ are distinct functions on $[0,T]$, then both
$\alpha^\text{in}$ and $\alpha^\text{out}$ are identifiable on
$[0,T]$ from the undirected affiliation Poisson process stochastic block model distribution $\text{pr}_\theta$ when $n\ge 3$.
Moreover, for $n\ge
\max\{Q, 3\}$, the proportions $\pi_1,\dots, \pi_Q$ are also
identifiable up to a permutation.
\end{proposition}
\subsection{Additional notation}
\label{sec:proc_notation}
We introduce some quantities that are relevant in the following. Denote
\begin{align}
Y^{(q,l)}_{\mathcal Z} &= \sum_{(i,j)\in\mathcal R}Z^{i,q}Z^{j,l} , \quad (q, l=1,\dots, Q), \label{Yql}\\
N_{\mathcal{Z}}^{(q,l)} &=\sum_{(i,j)\in\mathcal R} Z^{i,q}Z^{j,l} N_{i,j}, \quad (q, l=1,\dots, Q), \label{eq:N_Z}\\
Z_{m}^{(q,l)} &= Z^{i_m,q}Z^{j_m,l}, \quad (q, l=1,\dots, Q;\ m=1,\dots,M). \label{eq:Zmql}
\end{align}
These are the (latent) number of dyads $(i,j)\in \mathcal{R}$ with
latent groups $(q,l)$, the (latent) counting process of
interactions between individuals in groups $(q,l)$ and the
(latent) binary indicator of observation $(t_m,i_m,j_m)$ belonging
to groups $(q,l)$, respectively.
As these quantities are unobserved, our work relies on proxies based on approximations of the latent group variables $Z^{i,q}$. Denote
\begin{equation}
\label{eq:tau_class}
\mathcal T=\left\{\tau=(\tau^{i,q})_{i=1,\dots,n,q=1,\dots,Q} :
\tau^{i,q}\ge 0, \sum_{q=1}^Q\tau^{i,q}=1, \quad (i=1,\dots,n;\ q=1,\dots,Q) \right\}.
\end{equation}
While the variables $Z^{i,q}$ are indicators, their counterparts
$\tau^{i,q}$ are weights representing the probability that node $i$ belongs to group $q$.
Now, for every $\tau\in\mathcal T$, replacing all latent variables
$Z^{i,q}$ in \eqref{Yql}--\eqref{eq:Zmql} by $\tau^{i,q}$, we define
$Y^{(q,l)}$, $N^{(q,l)}$ and $\tau_{m}^{(q,l)}$ which are estimators of
$Y^{(q,l)}_{\mathcal Z}$, $N_{\mathcal{Z}}^{(q,l)}$ and $Z_{m}^{(q,l)}$, respectively.
\section{Semiparametric estimation procedure}
\label{sec:method}
\subsection{A variational semiparametric expectation-maximization algorithm}
\label{sec:SPVEM}
The complete-data likelihood of observations $\mathcal O$ and latent variables $\mathcal Z=(Z_1,\dots,Z_n)$ is
\[
\mathcal L (\mathcal O,\mathcal Z \mid \theta)
=\exp\left\{-\sum_{(i,j)\in\mathcal
R} A^{(Z_i,Z_j)}(T)
\right\}\prod_{m=1}^M\alpha^{(Z_{i_m},Z_{j_m})}(t_m) \prod_{i=1}^n\prod_{q=1}^Q\pi_q^{Z^{i,q}}.
\]
The likelihood of the observed data $\mathcal L(\mathcal O\mid\theta)$ is
obtained by summing the above over the set of all
possible configurations of the latent variables $\mathcal Z$. This set is huge and thus the likelihood $\mathcal L(\mathcal O\mid\theta)$ is intractable for direct maximization. Hence, an
expectation-maximization algorithm~\citep{DempsterLR} is
used, which is an iterative procedure especially adapted to cope with
latent variables. It consists of an \texttt{E}-step and
an \texttt{M}-step that are iterated until convergence.
In our model two issues arise. First, as already observed for the standard stochastic block model~\citep{Daudin_etal08}, the \texttt{E}-step
requires the computation of the conditional distribution of
$\mathcal Z$ given the observations $\mathcal O$, which is not tractable.
Therefore, we use a variational approximation~\citep{Jordan_etal} of the latent variables' conditional distribution to perform the \texttt{E}-step.
We refer to~\cite{MR_review} for a presentation and a discussion on the variational approximation in stochastic block models.
Second, part of our parameter is infinite dimensional so that the
\texttt{M}-step is partly replaced by a nonparametric estimation procedure, giving rise to a semiparametric
algorithm.
\subsection{Variational \texttt{E}-step}
The standard \texttt{E}-step consists in computing the expectation of the complete-data log-likelihood given the observations at some current parameter value $\theta$.
This requires the knowledge of the conditional latent variables
distribution $\text{pr}_\theta(\mathcal Z\mid\mathcal O)$, which is not
tractable because the $Z_i$'s are not conditionally independent.
We thus perform a variational approximation of $\text{pr}_\theta(\mathcal
Z\mid\mathcal O)$ by a simpler distribution. Using the class of
parameters $\mathcal{T}$ defined by~\eqref{eq:tau_class} we consider
the family of factorized distributions on $\mathcal Z$ given $\mathcal O$ defined as
\begin{align*
\text{pr}_\tau\{\mathcal Z=(q_1,\dots,q_n)\mid\mathcal O\}
&=\prod_{i=1}^n\text{pr}_\tau(Z_i=q_i\mid\mathcal O)
=\prod_{i=1}^n \tau^{i,q_i} ,\quad (q_1,\dots,q_n) \in\{1,\dots,Q\}^n,
\end{align*}
with corresponding expectation $E_\tau(\cdot\mid\mathcal O)$. Denoting
$\KL{\cdot}{\cdot}$ the Kullback-Leibler divergence, we search for
the parameter $\hat \tau\in\mathcal T$ that yields the best
approximation $\text{pr}_\tau(\cdot\mid\mathcal O)$ of
$\text{pr}_\theta(\cdot\mid\mathcal O)$ through
\begin{align}\label{eq:hat_tau}
\hat\tau = \mathop{\text{\rm Argmin}}_{\tau\in\mathcal T}\KL { \text{pr}_\tau(\cdot\mid
\mathcal{O}) } { \text{pr}_{\theta}(\cdot\mid \mathcal{O}) }.
\end{align}
Let $\mathcal{H}(\cdot)$ be the entropy of a
distribution. It can be seen that $\hat\tau $ maximizes with respect to
$\tau$ the quantity
\begin{align*}
J(\theta,\tau) & = E_\tau\left\{ \log\mathcal L(\mathcal O,\mathcal
Z\mid\theta)\mid\mathcal O\right\}
+\mathcal{H}\{\text{pr}_\tau(\cdot\mid
\mathcal{O})\} \\
&= -\sum_{q=1}^Q\sum_{l=1}^Q Y^{(q,l)} A^{(q,l)}(T) +
\sum_{q=1}^Q\sum_{l=1}^Q \sum_{m=1}^M\tau_{m}^{(q,l)}
\log\left\{ \alpha^{(q,l)}(t_m)\right\} +
\sum_{i=1}^n\sum_{q=1}^Q{\tau^{i,q}}\log
\left(\frac{\pi_q}{\tau^{i,q}} \right).
\end{align*}
The solution $\hat \tau$ satisfies a fixed point equation, which in practice
is found by successively updating the
variational parameters $\tau^{i,q}$ via the following Equation~\eqref{eq_vstep_pi_q_fixed_point} until convergence.
\begin{proposition}
\label{prop:E_step}
The solution $\hat \tau$ to the minimization problem~\eqref{eq:hat_tau} satisfies the fixed point equation
\begin{equation}
\label{eq_vstep_pi_q_fixed_point}
\hat \tau^{i,q}\propto \pi_q \exp\{D_{iq}(\hat \tau, \alpha)\}, \quad
(i=1,\dots,n;\ q=1,\dots,Q),
\end{equation}
where $\propto$ means `proportional to', ${{\mbox{$\mathds{1}$}}}_A$ denotes the
indicator function of set $A$ and
\begin{align*}
D_{iq}(\tau,\alpha)& = -\sum_{l=1}^Q \sum_{\substack{j=1\\
j\neq i}}^n \tau^{j,l}
\left\{A^{(q,l)}(T)+A^{(l,q)}(T)\right\}
\\
&\quad+\sum_{l=1}^Q\sum_{m=1}^M \left[ {{\mbox{$\mathds{1}$}}}_{\{i_m=i\}}\tau^{j_m,l}
\log\left\{\alpha^{(q,l)}(t_m)\right\}+{{\mbox{$\mathds{1}$}}}_{\{j_m=i\}}\tau^{i_m,l}\log\left\{\alpha^{(l,q)}(t_m)\right\}
\right] .
\end{align*}
\end{proposition}
\subsection{Nonparametric \texttt{M}-step: general description}
In a parametric context the \texttt{M}-step consists in the maximization of $J(\theta,\tau)$
with respect to $\theta=(\pi,\alpha)$.
Considering only the finite-dimensional part $\pi$ of the parameter, the maximizer $\hat
\pi$ is
\begin{equation}\label{eq_mstep_pi_q}
\hat \pi_q=\frac{\sum_{i=1}^n\tau^{i,q}}{\sum_{q=1}^Q\sum_{i=1}^n\tau^{i,q}}
=\frac1n{\sum_{i=1}^n\tau^{i,q}}, \quad (q=1,\dots,Q).
\end{equation}
Concerning the infinite-dimensional parameter $\alpha$, we replace the
maximization of $J(\pi,\alpha,\tau)$ with respect to $\alpha$ by a
nonparametric estimation step.
If the process $N_{\mathcal{Z}}^{(q,l)}$ defined by~\eqref{eq:N_Z} was observed, the estimation of $\alpha^{(q,l)}$ would be straightforward.
Now the criterion $J$ depends on $\alpha$ through the quantity
$E_\tau (\log \mathcal L(\mathcal O,\mathcal Z \mid \theta) \mid
\mathcal O)$, that corresponds to the log-likelihood in
a setup where we observe the weighted cumulative process
$N^{(q,l)}$ (see Section~\ref{sec:proc_notation}). Intensities may be easily estimated in this direct observation setup.
We develop two different approaches for updating $\alpha$: a histogram and a kernel method.
\subsection{Histogram-based \texttt{M}-step}
\label{sec:histo}
In this part the intensities $\alpha^{(q,l)}$ are estimated by piecewise constant functions and we propose a
data-driven choice of the partition of the time interval $[0,T]$. The
procedure is based on a least-squares penalized criterion following the work
of~\cite{patricia}. Here $(q,l)$ is fixed and for reasons of computational efficiency we focus on regular dyadic partitions that form
embedded sets of partitions.
For some given $d_{\max}$, consider all regular dyadic partitions of $[0,T]$ into $2^d$ intervals
\[
\mathcal{E}_d = \left\{ E_{k} =\Big[(k-1)\frac T {2^d} ; k \frac T{2^d}
\Big) : k =1,\dots, 2^d\right\}, \quad (d= 0,\dots,d_{\max}).
\]
For any interval $E$ included in $[0,T]$, the estimated mean number of observed interactions $(t_m,i_m,j_m)$ between individuals with latent groups $(q,l)$ and occurring in $E$ is
\begin{align*}
N^{(q,l)}(E)= \int_E dN^{(q,l)}(s) =
\sum_{m=1}^M\tau^{i_m,q}\tau^{j_m,l}{{\mbox{$\mathds{1}$}}}_{E}(t_m) .
\end{align*}
The total number of dyads $r$ is an upper bound for $Y^{(q,l)}$, so we
define a least-squares contrast (relatively to the
counting process $N^{(q,l)}$) for all $f \in
\mathbb{L}^2([0,T],dt)$ by
\begin{equation*}
\gamma^{(q,l)}(f)=-\frac{2}{r} \int_0^T f(t) dN^{(q,l)}(t) +\frac{Y^{(q,l)}}{r} \int_0^T f^2(t) dt .
\end{equation*}
The projection estimator of
$\alpha^{(q,l)}$ on the set $S_d$ of piecewise constant functions
on $\mathcal{E}_d$ is
\begin{equation*}
\hat{\alpha}_d ^{(q,l)}=\mathop{\text{\rm Argmin}}_{f \in S_d} \gamma^{(q,l)}(f)=
\frac1{Y^{(q,l)}}
\sum_{E\in \mathcal{E}_d}\frac{N^{(q,l)}(E)}{| E| }{{\mbox{$\mathds{1}$}}}_{E}(\cdot),
\end{equation*}
where $|E|$ is the length of interval $E$, here equal to $T2^{-d}$.
Now, adaptive estimation consists in choosing the best estimator among the
collection $\{ \hat{\alpha}_d^{(q,l)} : d=0,\dots, d_{\max} \}$.
So we introduce an estimator of the partition through $\hat d^{(q,l)} $
minimizing a penalized least-squares criterion of the form
\begin{equation*}
crit^{(q,l)}(d)=\gamma^{(q,l)}(\hat{\alpha}_d^{(q,l)})+pen^{(q,l)}(d),
\end{equation*}
for
some penalty function $pen^{(q,l)} : \{0,\dots ,d_{\max}\}\rightarrow
\mathbb{R}^{+}$ that penalizes large partitions.
We choose the penalty function as
\begin{equation*}
pen^{(q,l)}(d)=\frac{2^{d+1}}{r} C \qquad\text{
with }\quad
C=\frac{ 2^{d_{\max}}}{T Y^{(q,l)}} \sup_{E\in \mathcal{E}_{d_{\max}}}
N^{(q,l)} (E) .
\end{equation*}
Finally, the penalized least-squares criterion simplifies to
\begin{equation*}
\hat d^{(q,l)} = \mathop{\text{\rm Argmin}}_{ d =0,\dots, d_{\max}} 2^d\Big\{-
\sum_{E\in \mathcal{E}_d}N^{(q,l)}(E)^2
+ 2^{d_{\max} +1}
\sup_{E'\in \mathcal{E}_{d_{\max}}} N^{(q,l)} \left(E'\right) \Big \}.
\end{equation*}
The selected partition size $\hat d=\hat d^{(q,l)} $ may be specific to the groups $(q,l)$.
Finally, the adaptive estimator of intensity
$\alpha^{(q,l)}$ is
\begin{equation}
\hat {\alpha}^{(q,l)}_{\text{hist}} (t) = \hat \alpha_{\hat d}^{(q,l)}(t)
=\frac{2^{\hat d }}{T Y^{(q,l)}}
\sum_{E\in \mathcal{E}_{\hat d}}N^{(q,l)} (E) {{\mbox{$\mathds{1}$}}}_{E }(t) ,
\label{eq:mstep_histo}
\end{equation}
where $0\le t\le T ; q,l=1,\dots,Q$.
\cite{patricia} develops her approach in the Aalen multiplicative
intensity model, which is slightly different from our
context. Moreover, our setup does not satisfy the assumptions of
Theorem 1 in that reference as the number of jumps of the processes $N_{i,j}$
is not bounded by a known value (we have recurrent events).
Nevertheless, in our simulations this procedure correctly estimates the intensities $\alpha^{(q,l)}$ (see Section~\ref{sec:simus}).
We refer to~\cite{Birge_Baraud} for a theoretical study of an adaptive nonparametric estimation of the intensity of a
Poisson process.
\cite{patricia} also studies other penalized least-squares estimators (for e.g. using Fourier
bases), which might be used here similarly.
\subsection{Kernel-based \texttt{M}-step}
Kernel methods are suited to estimate smooth functions.
If the variational parameters $\tau^{i,q}$ are good approximations of the latent variables $Z^{i,q}$, then the intensity of process $N^{(q,l)}$ (Section~\ref{sec:proc_notation}) is approximately
$Y^{(q,l)}\alpha^{(q,l)}$, where $Y^{(q,l)}$ is the variational mean number of
dyads with latent groups $(q,l)$.
Following~\cite{Ramlau} and considering a nonnegative kernel function $K$ with
support within $[-1,1]$ together with some bandwidth $b>0$, the intensity $\alpha^{(q,l)}$ is estimated by
\begin{align}\label{eq_mstep__kernel_lamb_ql}
\hat{\alpha}_{\text{ker}}^{(q,l)}(t)
&=\frac{1}{b Y^{(q,l)} } \int_0^T K\Big(\frac{t-u}{b}\Big)dN^{(q,l)}(u)
=\frac{1}{b Y^{(q,l)}} \sum_{m=1}^M\tau_{m}^{(q,l)} K\Big(\frac{t-t_m}{b} \Big),
\end{align}
if $Y^{(q,l)}>0$ and $\hat{\alpha}_{\text{ker}}^{(q,l)}(t)=0$ otherwise,
where $\tau_{m}^{(q,l)}$ is defined in Section~\ref{sec:proc_notation}.
The bandwidth $b$ could be chosen adaptively from the data following the procedure proposed
by~\cite{gregoire}. Kernel methods are not always suited to infer a function on a
bounded interval as boundary effects may deteriorate their quality. However, it is out of the scope of this work to
investigate refinements of this kind.
\subsection{Algorithm's full description}
\label{sec:vem}
The implementation of the algorithm raises two issues:
convergence and initialization. As our algorithm is an iterative
procedure, one has to test for convergence. A stopping criterion can
be defined based on criterion $J(\theta,\tau)$.
Concerning initialization the algorithm is run several times with
different starting values, which are chosen by some
k-means method combined with perturbation techniques
(see the Supplementary Material for details).
Algorithm~\ref{algo:vem} provides a full description of the procedure.
\begin{algorithm}[!h]
\caption{Semiparametric variational expectation-maximization algorithm}
\label{algo:vem}
\vspace*{-12pt}
\begin{tabbing}
\enspace $s \leftarrow 0$ \\
\enspace Initialize $\tau^{[0]}$ \\
\enspace \lWhile{convergence is not attained}{ \\
\qquad Update $\pi^{[s+1]}$ via Equation~\eqref{eq_mstep_pi_q} with $\tau=\tau^{[s]}$ \\
\qquad Update $\alpha^{[s+1]}$ via either Equation~\eqref{eq:mstep_histo} (histogram method) or~\eqref{eq_mstep__kernel_lamb_ql} (kernel method) with $\tau=\tau^{[s]}$ \\
\qquad Update $\tau^{[s+1]}$ via the fixed point Equation~\eqref{eq_vstep_pi_q_fixed_point} using $(\pi,\alpha)=(\pi^{[s+1]},\alpha^{[s+1]})$\\
\qquad Evaluate the stopping criterion\\
\qquad $s\leftarrow s+1$ }\\
\enspace Output $(\tau^{[s]},\pi^{[s]},\alpha^{[s]})$
\end{tabbing}
\end{algorithm}
\subsection{Model selection with respect to $Q$}
\label{sec:ICL}
We propose an integrated classification likelihood criterion that performs data-driven model
selection for the number of groups $Q$. Roughly, this criterion is based on the complete-data
variational log-likelihood penalized by the number of parameters. It has been introduced in the mixture context in~\cite{BCG00}
and adapted to the stochastic block model in~\cite{Daudin_etal08}.
The issue here is that our model contains a nonparametric part, so
that the parameter is infinite dimensional. However in the case of
histogram estimators, once the partition is selected, there is only a
finite number of parameters to estimate. This number can be used to build our integrated classification likelihood criterion.
For any $Q$ let $\hat \theta(Q)$ be the estimated parameter and $\hat
\tau(Q)$ the corresponding group probabilities obtained by our algorithm run with $Q$ groups.
The parameter $\hat
\theta(Q)$ has two components: the first one $\hat \pi(Q)$ is a vector of dimension
$Q-1$, while the second has dimension
$\sum_{q, l=1,\dots, Q} \exp( \hat d^{(q,l)} \log 2)$.
In the adaptation of the integrated classification likelihood criterion to the stochastic block model these
components are treated differently: the first one, that concerns the $n$ individuals is penalized by a $\log(n)/2$ term, while the second one
concerning the dyads is penalized by a $\log(r)/2$ term. We refer to~\cite{Daudin_etal08} for more details.
In our case the integrated classification likelihood criterion is
\begin{equation*}
\textsc{icl} (Q) = \log \mathbb{P}_{\hat \theta(Q)}\{ \mathcal{O},\hat
\tau(Q)\} -\frac 1 2 (Q-1)\log n - \frac 1 2 \log r
\sum_{q=1}^Q\sum_{l=1}^Q2^{ \hat d^{(q,l)}}.
\end{equation*}
After fixing an upper bound $Q_{\max}$ we select the number of groups
\begin{equation}
\label{eq:ICLmax}
\hat Q = \mathop{\text{\rm Argmax}}_{ Q=1,\dots, Q_{\max}} \textsc{icl}(Q).
\end{equation}
\section{Synthetic experiments}
\label{sec:simus}
We generate data using the undirected Poisson process stochastic block
model in the following two scenarios.
\begin{enumerate}
\item To evaluate the classification performance, we consider the
affiliation model with $Q=2$ groups, equal probabilities $\pi_q=1/2$ and a number of individuals $n$ in $\{10,30\}$.
The intensities are sinusoids
with varying shifting parameter $\varphi$ set to
$\alpha^{\text{in}}(\cdot)=10 \{1+\sin(2\pi \cdot )\}$ and $\alpha^{\text{out}}(\cdot )=
10 [1+\sin\{2\pi (\cdot +\varphi) ]$ with $\varphi \in \{0.01, 0.05, 0.1, 0.2, 0.5\}$.
Clustering is more difficult for small values of $\varphi$.
\item To evaluate the intensity estimators, we choose $Q=3$ groups
with equal probabilities $\pi_q=1/3$ and six intensity functions
that have different shapes and amplitudes (see continuous curves in Figure~\ref{estimated_intensities_Q3_n50}).
The number of individuals $n$ varies in $\{20,50\}$.
\end{enumerate}
For every parameter setting, our algorithm is applied to
$1000$ simulated datasets. The histogram estimator
is used with regular dyadic partitions and $d_{\max}=3$, while the kernel estimator uses the Epanechnikov kernel.
\begin{figure}[t]
\centering
\includegraphics[width=\textwidth]{boxplot_scen1_n10_n30}
\caption{Boxplots of the adjusted rand index in synthetic
experiments from Scenario 1 for histogram (gray)
and kernel (white) estimators. The $x$-axis shows different values of
$\varphi$ in $ \{0.01, 0.05, 0.1, 0.2, 0.5\}$. Left panel: $n= 10$, right panel: $n=30$.}
\label{boxplot_affiliation}
\end{figure}
To assess the clustering performance, we use the adjusted rand index~\citep{HA1985} that evaluates the
agreement between the estimated and the true latent structure.
For two classifications that are identical (up to label switching), this index equals $1$, otherwise the adjusted rand index is smaller than $1$ and negative values are possible.
Figure~\ref{boxplot_affiliation} shows the boxplots of the adjusted rand index obtained
with the histogram and the kernel versions of our method in Scenario 1.
For small values of the shifting parameter ($\varphi \in \{0.01,0.05\}$), the
intensities are so close that classification is very difficult,
especially when $n=10$ is small. The classification improves when
the shift between the intensities and/or the number of observations increase, achieving (almost) perfect
classification for larger values of $\varphi$ and/or $n$.
Concerning the recovery of the intensities in Scenario 2, we define the risk measuring the distance between the
true intensity $\alpha^{(q,l)}$ and its estimate $\hat{\alpha}^{(q,l)}$ as
\begin{equation*}
\textsc{Risk}(q,l)=\| \hat{\alpha}^{(q,l)} - \alpha^{(q,l)} \|_2= \Big[\int_0^T \{
\hat{\alpha}^{(q,l)}(t) - \alpha^{(q,l)}(t) \}^2 dt \Big]^{1/2}.
\end{equation*}
Table~\ref{risk_Q3_n50} reports mean values and standard deviations of the risk when $n=50$ (The results
for $n=20$ are given in the Supplementary Material).
Our histogram and kernel estimators are compared to their `oracle' equivalents obtained using the knowledge of the true
groups. The table also reports the mean number of events with latent groups $(q,l)$.
As expected, when the true intensity is piecewise-constant, the histogram version of
our method outperforms the
kernel estimator. Conversely, when the true intensity is smooth, the kernel
estimator is more appropriate to recover the shape of the intensity.
Both estimators exhibit good performances with respect to the oracles versions.
\begin{table}
\centering
\def~{\hphantom{0}}
\caption{Mean number of events and risks with standard deviations (sd) in Scenario 2 with $n=50$.
Histogram (Hist) and kernel (Ker) estimators are compared with their oracle counterparts (Or.Hist, Or.Ker).
All values associated with the risks are multiplied by 100.
}
{
\begin{tabular}{lccccc}
Groups $(q,l)$ & Nb.events & Hist (sd) & Or.Hist (sd) & Ker (sd) & Or.Ker (sd) \\
\\
$(1,1)$& 543 & 31 (32)& 20 (18) & 81 (51) & 63 (12) \\
$(1,2)$ & 949 & 44 (17) & 81 (4) & 172 (57) & 156 (7) \\
$(1,3)$ & 545 & 46 (16) & 38 (6) & 53 (88) & 21 (6) \\
$(2,2)$ & 212 & 69 (10) & 70 (9) & 50 (56) & 35 (11)\\
$(2,3)$ & 844 & 187 (6) & 185 (2) & 125 (56) & 106 (11) \\
$(3,3)$ & 298 & 83 (13) & 81 (13) & 64 (53) & 43 (12)
\end{tabular}
}
\label{risk_Q3_n50}
\end{table}
\begin{figure}[t]
\centering
\includegraphics{fig_intensities_Q3_n50}
\caption{Intensities in synthetic experiments from Scenario 2 with
$n= 50$. Each panel displays for a pair of groups $(q,l)$ (given in the $x$-label) with
$q,l=1,\dots, 3; q\le l $ the true intensity
(continuous), histogram (dashed) and kernel (dotted) estimates for one simulated dataset picked at random.}
\label{estimated_intensities_Q3_n50}
\end{figure}
Finally, we use Scenario 2 to illustrate the performance of the integrated classification likelihood criterion to select the number $Q$ of latent groups from the data. For each of the 1000 simulated datasets,
the maximizer $\hat Q$ of the integrated classification likelihood
criterion defined in~\eqref{eq:ICLmax} with $Q_{\max}=10$ is computed.
For $n=20$ the correct number of groups is
recovered in $74\%$ of the cases (remaining cases select values in $\{2,4\}$). Moreover, for datasets where the criterion does not select the
correct number $Q$, the adjusted rand index of the classification
obtained with 3 groups is rather low
indicating that the algorithm has failed in the classification task and probably only a local maximum of the criterion $J$ has been found.
For $n=50$ our procedure selects the correct number of groups in $99.9\%$ of the cases.
\section{Datasets}
\label{sec:real_data}
\subsection{London cycles dataset}
We use the cycle hire usage data from the bike sharing system
of the city of London from 2012 to 2015~\citep{bikes}.
We focus on two randomly chosen weekdays, 1st (day1) and 2nd (day2) February 2012.
Data consist in pairs of stations associated with a single
hiring/journey (departure station, ending station) and corresponding time stamp (hire time with second precision).
The datasets have been pre-processed to remove journeys that either correspond to loops, last less than 1 minute or more than 3 hours or do not have an ending station (lost or stolen bikes).
The datasets contain $n_1=415$ and $n_2=417$ stations on day 1 and day 2 with $M_1=17, 631$ and $M_2= 16, 333$ hire
events respectively. With more than $\num{17e4}$ oriented pairs of stations the number of processes $N_{i,j}$ is huge, but only a
very small fraction -- around 7\% -- of these processes are non null (i.e. contain at least one hiring event between
these stations).
Indeed bike sharing systems are mostly used for short trips and stations far from another are unlikely to be connected.
Data correspond to origin/destination flows and are analysed in a directed setup with the histogram version of our
algorithm on a regular dyadic partitions with maximum size 32 ($d_{\max} =5$).
The integrated classification likelihood criterion achieves its maximum with $\hat Q=6$ latent groups for both
datasets. Geographic locations of the bike stations and the clusters are represented on a city map (thanks to the
OpenStreetMap project), see Figure~\ref{fig:cycles_day1} for day 1. Clusters for day 2 are similar thus we focus on day
1. Our procedure globally recovers geographic clusters, as interacting stations
are expected to be geographically close. A closer look at the clusters then
reveals more information.
While all but one clusters contain between 17 and 202 stations, cluster number 4 (dark blue crosses in
Figure~\ref{fig:cycles_day1}) consists of only two bike stations.
They are located at Kings Cross railway and Waterloo railway stations and are among the stations with the highest
activities (for both departures and arrivals) in comparison to all other stations.
These stations appear to be `outgoing' stations in the morning with much more departures than arrivals around 8a.m. and
`incoming' stations at the end of the day, with more arrivals than departures between 5p.m and 7p.m. The bike
stations close to the two other main railway stations in London (Victoria and Liverpool Street stations) do not exhibit
the same pattern and are clustered differently despite having a large number of hiring events.
This cluster is thus created from the similarity of the temporal profiles of these two stations rather than their total
amount of interactions.
Moreover it mostly interacts with cluster number 5 shown in light blue diamond in Figure~\ref{fig:cycles_day1} which roughly
corresponds to the City of London neighbourhood. It is thus characterized
by stations used by people living in the suburbs and working in the city center.
\begin{figure}[h]
\centering
\includegraphics[width=\textwidth]{clusters_day1_q6}
\caption{London bike sharing system: Geographic positions of the stations
and clustering into six clusters (represented by different colors and symbols) for day 1. }
\label{fig:cycles_day1}
\end{figure}
We compare our method with the discrete-time approach developed in \cite{Matias_Miele} where individuals are allowed to change groups during time. We applied the corresponding \texttt{dynsbm} R package
on the London bikes dataset aggregated into $T=24$ snapshots of one hour long, but no similar result came out of this:
their model selection criterion chooses 4 groups.
The clusters with $Q=4$ groups in fact drop to only 1 nonempty group
between midnight to 3am, 2 groups between 3am and 7am and 3 groups between 10pm and midnight. Globally there is one
very large group (containing from 168 to all stations, with mean number 285), one medium size group (from 0 to 148
stations, mean value 93) and 2 small groups (from 0 to 62 and 64 stations, mean values 14 and 22). Our small peculiar
cluster is not detected by the \texttt{dynsbm} method.
To conclude this section we mention that the same dataset is analysed in~\cite{Guigoures}
with a different perspective. \cite{velib} use a completely different approach, relying on Poisson mixture
models on a similar dataset of origin/destination flows (bike sharing system in Paris). Their approach does not take into account the network structure of the
data (where e.g. two flows from the same station are related). As a consequence, clusters are obtained on pairs of
stations from which interpretation is completely different and in a way less natural.
\subsection{Enron dataset}
\label{sec:Enron}
\begin{figure}[t]
\centering
\includegraphics[width=0.8\textwidth]{Enron_intens}
\caption{Enron: intensity estimates for pair of groups $(q,1)$ for $q\in\{1,\dots,4\}$ and bootstrap confidence interval with confidence level 90\% (lightgrey) and 80\% (drakgrey).}
\label{fig:enron_4intens}
\end{figure}
The Enron corpus contains emails exchanges
among people working at Enron, mostly in the senior management, covering the period of the affair that led to the bankruptcy of the company~\citep{Enron}.
From the data provided by the \cite{enron_data} we extracted $21, 267$ emails exchanged among 147 persons between 27 April, 2000 and 14 June, 2002, for which the sender, the recipient and the time when the email was sent are known. For most persons their position in the company is known: one out of four are employees, all other positions involve responsibility and we summarize them as {\it managers}.
We applied our algorithm using the directed model and the histogram approach with regular dyadic partitions of maximal size $256$ ($d_{\max}=8$). For every fixed number of groups $Q\in\{2,\dots,20\}$ the algorithm identifies one large group always containing the same individuals. One may consider this group to have the standard behaviour at the company. For varying values of $Q$ the differences in the clustering only concern the remaining individuals with non standard behaviour. The integrated classification likelihood criterion does not provide a reasonably small enough number of groups that could be used for interpretation. We thus choose to analyse the data with $Q=4$ clusters.
The group with the standard behaviour (group 1) contains 127 people both employees and managers. The second largest group (group 4) contains almost exclusively managers, and group 2 is composed of employees.
The standard behaviour (group 1) consists in little sending activity, but receiving mails from all other groups. The members of group 3 have the most intense email exchange. The specific manager and employee groups (groups 2 and 4) are quite similar
and indeed at $Q=3$ both groups are merged together.
For a number of pairs of groups communication is relatively constant over time, but for others the activity evolves a lot over time, as for instance for emails sent to members of group~1 (Figure~\ref{fig:enron_4intens}).
The intra-group intensity of group 1 is increasing with a peak in October 2001, which coincides with the beginning of the investigations related to the scandal. In contrast, the managers of group 4 communicate more intensely with group 1 during the first half of the observation time than during the last half. More details are provided in the Supplementary Material.
The bootstrap confidence intervals in Figure \ref{fig:enron_4intens} are obtained via parametric bootstrap. In general, confidence intervals for large groups are very satisfactory, but this does not hold for small groups. Indeed, here some of the estimated probabilities $\hat \pi_k$ of group membership are very small (two are lower than 3\%), so bootstrap samples tend to have empty groups. Evidently, this has a devastating effect on the associated bootstrap intervals.
\cite{rastelli} analyse the same dataset with a discrete-time model where individuals are allowed to change
groups over time. They also obtain that most individuals are gathered in one group, which are rather inactive but receive
some emails, and observe a specific behaviour of some groups of employees and managers.
However, there is a difference in interpretation of results in the two models. In Rastelli's model groups may be identified with specific tasks like sending newsletters for example and individuals may execute this task during a while and then change activity. In contrast, our model identifies groups of individuals with a similar behaviour over the entire observation period. Our approach thus is natural for the analysis of the temporal evolution of the activity of a fixed group of persons.
Finally, we carried out a comparison with a classical stochastic block model. Indeed, taking $d_{\max}=0$ in our approach amounts to forget the timestamps of the emails, as the algorithm then only considers email counts over the whole observation period and our method boils down to a classical stochastic block model with Poisson emission distribution and mean parameter $A^{(q,l)} (T)$~\cite[see for instance][]{Mariadassou_10}.
Comparing the classification at $Q=4$ to the one obtained with our continuous-time approach, the adjusted rand index
equals $0.798$ indicating that the clusterings are different. Indeed, both models identify roughly the same large group with standard behaviour, but huge differences appear in the classification of the non standard individuals.
This illustrates that our approach does effectively take into account the temporal distribution of the events to cluster the individuals. And the higher value of the complete log-likelihood in the Poisson process stochastic block model indicates that the solution is indeed an improvement to the classical model.
\section*{Acknowledgment}
{ We would like to thank Agathe Guilloux for pointing
out valuable references, Nathalie Eisenbaum for her help on doubly stochastic counting processes and Pierre Latouche
for sharing information on datasets. The computations were partly performed at the institute for computing and data
sciences at University Pierre and Marie Curie.}
\section*{Supplementary Material}
Supplementary material available online at Biometrika includes a complementary version of the model that specifically accounts
for sparse datasets, the
proofs of all theoretical results, technical details on the methods
and algorithm, some supporting results for the analysis of the two datasets explored here, as well as the study of a third dataset.
A zip file containing the computer code in R and the analysis of the datasets is available at \url{http://cmatias.perso.math.cnrs.fr/Docs/ppsbm_files.tgz}
| {'timestamp': '2017-07-26T02:10:31', 'yymm': '1512', 'arxiv_id': '1512.07075', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.07075'} | arxiv |
\section{Introduction}
The French company Electricit\'e de France (EDF) looks for assessing and optimizing its strategic investments decisions for its electricity power plants by using probabilistic and optimization methods of ``cost of maintenance strategies''.
In order to quantify the technical and economic impact of a candidate maintenance strategy, some economic indicators are evaluated by Monte Carlo simulations using the VME software developed by EDF R\&D (Lonchamp and Fessart \cite{lonchamptfressart:2013}).
The major output result of the Monte Carlo simulation process from VME is the probability distribution of the Net Present Value (NPV) associated with the maintenance strategy.
From this distribution, some indicators, such as the mean NPV, the standard deviation of NPV or the regret investment probability ($\mathbb{P}(NPV < 0)$), can easily be derived.
Once these indicators have been obtained, one is interested in optimizing the strategy, for instance by determining the optimal investments dates leading to the highest mean NPV and the lowest regret investment probability.
Due to the discrete nature of the events to be optimized, the optimization method is actually based on genetic algorithms.
However, during the optimization process, one of the main issues is the computational cost of the stochastic simulator to optimize (here VME), which leads to methods requiring a minimal number of simulator runs (Dellino and Meloni \cite{delmel15}).
Optimization algorithms require often several thousands of simulator runs and, in some cases, are no more applicable.
The solution investigated in this paper is a first attempt to break this computational cost by the way of using a metamodel instead of the simulator within the mathematical optimization algorithm.
From a first set of simulator runs (called the learning sample and coming from a specific design of experiments), a metamodel consists in approximating the simulator outputs by a mathematical model (Fang et al. \cite{fanli06}). This metamodel can then be used to predict the simulator outputs for other input configurations, that can be served for instance for optimization issues (Forrester et al. \cite{forsob08}), safety assessment (de Rocquigny et al. \cite{derdev08}) or sensitivity analysis (Iooss and Lema\^{\i}tre \cite{ioolem15}).
Many metamodeling techniques are available in the computer experiments literature (Fang et al. \cite{fanli06}).
Formally, the function $G$ representing the computer model is defined as
\begin{equation}\label{eq:detmodel}
\begin{array}{rccl}
G :& E & \rightarrow & \mathbb{R} \\
&x &\mapsto & G(x)
\end{array}
\end{equation}
where $E \subset \mathbb{R}^d$ ($d\in \mathbb{N}\setminus \{0\}$) is the space of the input variables of the computer model.
Metamodeling consists in the construction of a statistical estimator $\widehat{G}$ from an initial sample of $G$ values corresponding to a learning set $\chi$ with $\chi \subset E$ and $\# \chi < \infty$ (with $\#$ the cardinal operator).
In this paper, we will use the Gaussian process (also called Kriging) metamodel (Sacks et al. \cite{sacwel89}) which has been shown relevant in many applicative studies (for example Marrel et al. \cite{marioo08}).
Moreover, this metamodel is the base ingredient of the efficient global Optimization (EGO) algorithm (Jones et al. \cite{jonsch98}), which allows to perform powerful optimization of CPU-time expensive deterministic computer code (Eq. (\ref{eq:detmodel})) as shown in Forrester et al. \cite{forsob08}.
However, all these conventional methods are not suitable in our applicative context because of the stochastic nature of the VME simulator: the output of interest is not a single scalar variable but a full probability density function (or a cumulative distribution function, or a quantile function).
The computer code $G$ is therefore stochastic:
\begin{equation}
\begin{array}{rccl}
G \, : \,& E\times\Omega & \rightarrow & \mathbb{R} \\
& (x,\omega) & \mapsto & G(x,\omega)
\end{array}
\end{equation}
where $\Omega$ denotes the probability space.
In the framework of robust design, robust optimization and sensitivity analysis, previous works with stochastic simulators consist mainly in approximating the mean and variance of the stochastic output (Bursztyn and Steinberg \cite{burste06}, Kleijnen \cite{kle15}, Ankenman et al. \cite{anknel10}, Marrel et al. \cite{marioo12}, Dellino and Meloni \cite{delmel15}).
Other specific characteristics of the distribution of the random variable $G(x,\cdot)$ (as a quantile) can also be modeled to obtain, in some cases, more efficient algorithms (Picheny et al. \cite{picgin13}).
In the following, $G(x)$, for any $x \in E$, denotes the output random variable $G(x,\cdot)$.
In this paper, as first proposed by Reich et al. \cite{reikal12} (who used a simple Gaussian mixture model), we are interested in a metamodel which predicts the full distribution of the random variable $G(x)$, $\forall x \in E$.
We first focus on the output probability density functions of $G$ (\emph{i.e.} the densities of $G(x)$ for any input $x \in E$) as they are a natural way to model a random distribution.
Therefore we define the following deterministic function $f$:
\begin{equation}
\begin{array}{rccl}
f \, : \,& E & \rightarrow & \mathcal{F} \\
& x & \mapsto & f_x \quad \text{density of the r.v. $G(x)$} \\
\end{array}
\end{equation}
with $\mathcal{F}$ the family of probability density functions:
\begin{equation} \mathcal{F} = \left\{ g \in L^1(\mathbb{R}), \; \text{positive, measurable}, \int_{ \mathbb{R} } g = 1 \right\} . \end{equation}
A first idea is to estimate the function $f$ over the input set $E$.
For a point $x \in E$, building $f_x$ with a kernel method requires a large number $N_{\mbox{\scriptsize MC}}$ of realizations of $G(x)$.
A recent work (Moutoussamy et al. \cite{mounan14}) has proposed kernel-regression based algorithms to build an estimator $\widehat{f}$ of the output densities, under the constraint that each call to $f$ is CPU-time expensive.
Their result stands as the starting point for the work presented in this paper.
The next section presents the optimization industrial issues and our application case.
In the third section, we re-define the functions of interest as the output quantile functions of $G$ as they come with less constraints.
We propose to use the Gaussian process metamodel and we develop an algorithm to emulate the quantile function instead of the probability density function.
In the fourth section, this framework is used to develop a new quantile optimization algorithm, called Quantile Function Expected Improvement criterion and inspired from the EGO algorithm.
The normality assumptions set for the metamodel imply that the function to maximize, a given level of quantile, is also the realization of a Gaussian process.
In the following applicative section, this adaptive design method allows to obtain an ``optimal'' solution using a small number of VME simulator runs.
Finally, a conclusion synthesizes the main results of this paper.
\section{Maintenance investments planning issues and the VME tool}\label{sec:VME}
\subsection{Engineering asset management}
Asset management processes, focused on realizing values from physical industrial assets, have been developed for years.
However, for the last one or two decades, these methods have been going from qualitative or semi-qualitative ones to quantitative management methods that are developed in the field of Engineering Assets Management (EAM).
As a matter of fact, with budget issues becoming more and more constrained, the idea is not anymore to justify investments for the assets (maintenance, replacement, spare parts purchases \ldots) but to optimize the entire portfolio of investments made by a company or an organization.
The value of an asset may be captured in its Life Cycle Cost (LCC) that monetizes all the events that may impact an asset throughout its useful life in all its dimensions (reliability, maintenance, supply chain \ldots).
The investments that are made for these assets (for example preventive replacements or spare part purchases) are then valorized by the variation of the LCC created by these changes in the asset management strategy.
This variation is made of positive impacts (usually avoided losses due to avoided failures or stock shortages) and negative ones (investments costs).
If the cash-flows used to calculate the LCC are discounted to take into account the time value of money, the value of an investment is then equivalent to a Net Present Value (NPV) as described in Figure \ref{fig:NPV}.
\begin{figure}[!ht]
\begin{center}
\includegraphics[width=0.8\textwidth]{NPV.pdf}
\caption{Net Present Value of an investment in Engineering Asset Management.}
\label{fig:NPV}
\end{center}
\end{figure}
EAM is then about evaluating and optimizing the value of the asset management strategies in order to support investments decision making.
\subsection{VME case study}
As some of the cash-flows generated by the asset depend on stochastic events (failures dates depending on the probabilistic reliability), the NPV of an investment is also a stochastic variable that needs to be assessed.
One of the tools developed by EDF to do so is a tool called VME that uses Monte Carlo simulation to evaluate various risk indicators needed to support decision making.
The algorithm of VME consists in replicating the event model shown in Figure \ref{fig:VME} with randomized failure dates for both a reference strategy and the strategy to be evaluated in order to get a good approximation of the NPV probabilistic distribution.
Usually, the NPV takes some values in dollars or euros; for confidentiality reasons, no real cost is given in this paper and a fictive monetary unit is used.
One replication of the Monte-Carlo simulation consists in creating random dates for failures (according to reliability input data) and propagating them to the occurrence of the various events in the model (maintenance task, spare part purchase or further failure).
The delay between these events may be deterministic (delay between the purchase of a spare and its delivery) or probabilistic (time to failure after maintenance), but both of them are defined by input parameters.
Each event of the model generates cash flows (depending on input data such as the cost of a component, the value of one day of forced outage, \ldots) that pile up to constitute the Life Cycle Cost of the assets under one asset management strategy.
The result of one replication is then the NPV that is the difference of the two correlated life-cycle costs of the current strategy and the assessed new strategy.
This evaluation is replicated in order to obtain a good estimation of the probabilistic distribution of the NPV.
\begin{figure}[!ht]
\begin{center}
\includegraphics[width=0.8\textwidth]{VME.pdf}
\caption{Event model used in VME.}
\label{fig:VME}
\end{center}
\end{figure}
The test-case used in this paper is made of four systems installed on different plants, all these systems being identical (same reliability law) and using the same spare parts stock.
The goal is to find the best replacement dates (in year) of these systems as it is wanted to prevent any failure event while replacements cannot be carried out too often.
When to purchase a new spare part also needs to be taken into account to secure the availability of the plants fleet (see Lonchamp and Fessart \cite{lonchamptfressart:2012} for more details).
This is given by the date (in year) of recovering a new system.
Therefore the whole strategy relies on these five dates which are taken as inputs for VME.
These dates can take different values (only discrete and integer values), which are described in Table \ref{tab:VMEinput}, and which have to be optimized.
\begin{table}
\center
\begin{tabular}{cccc}
\hline
Input & Name & min & max \\
System replacement date for plant $1$ & $x_1$ & 41 & 50 \\
System replacement date for plant $2$ & $x_2$ & 41 & 50 \\
System replacement date for plant $3$ & $x_3$ & 41 & 50 \\
System replacement date for plant $4$ & $x_4$ & 41 & 50 \\
System recovering date & $x_5$ & 11 & 20 \\
\hline
\end{tabular}
\caption{Minimal and maximal values (in years) of the five inputs used in the VME model.}
\label{tab:VMEinput}
\end{table}
These five dates are the deterministic events displayed in Figure \ref{fig:VME} in green.
The random events, that make the NPV random, are the dates of failure of the plants.
They are illustrated in Figure \ref{fig:VME} in red.
For a given set of five dates, VME computes a possible NPV based on a realization of the date of failure, randomly generated, regarding the different steps of the event model.
This input space of dates is denoted $E$ and regroups the possible years for replacements and the supply:
\begin{equation} E=\left(\bigotimes _{i=1}^4 \left\lbrace 41,42,...,50 \right\rbrace \right) \times \left\lbrace 11,12,...,20 \right\rbrace . \end{equation}
$E$ is therefore a discrete set ($\# E = 10^5 $ ).
We have
\begin{equation} \label{eq:densmodel}
\begin{array}{rccl}
G \, : \,& E\times\Omega & \rightarrow & \mathbb{R} \\
& (x,\omega)=(x_1,x_2,x_3,x_4,x_5,\omega) & \mapsto & \text{NPV}(x,\omega) , \\
\\
f \, : \,& E & \rightarrow & \mathcal{F} \\
& x=(x_1,x_2,x_3,x_4,x_5) & \mapsto & f_x \quad \text{(density of NPV}(x)) .\\
\end{array}
\end{equation}
Figure \ref{Opt_dens} provides examples of the output density of VME.
The $10$ input values inside $E$ have been randomly chosen.
It shows that there is a small variability between the curves.
\begin{figure}[!ht]
\begin{center}
\includegraphics[width=8cm,height=6cm]{plot0.pdf}
\caption{$10$ output probability densities of the VME code (randomly sampled). In abscissa, the values of NPV are given using a fictive monetary unit.}
\label{Opt_dens}
\end{center}
\end{figure}
The optimization process consists in finding the point of $E$ which gives the ``maximal NPV'' value.
As NPV$(x)$ is a random variable, we have to summarize its distribution by a deterministic operator $H$, for example:
\begin{equation}
H(g)=\ee(Z) \;,\; Z\sim g\;,\; \forall g \in \mathcal{F}
\end{equation}
or
\begin{equation}
H(g)=q_Z(p)\;,\; Z\sim g\;,\; \forall g \in \mathcal{F}
\end{equation}
with $q_Z(p)$ the $p$-quantile ($0< p < 1$) of $g$.
Our VME-optimization problem turns then to the determination of
\begin{equation} x^* := \argmax_{x \in E} H(f_x) . \end{equation}
However, several difficulties occur:
\begin{itemize}
\item VME is a CPU-time costly simulator and the size of the set $E$ is large.
Computing $(f_x)_{x \in E}$, needing $N_{\mbox{\scriptsize MC}} \times \# E$ simulator calls (where $N_{\mbox{\scriptsize MC}}$ is worth several thousands), is therefore impossible.
Our solution is to restrict the VME calls to a learning set $\chi \subset E$ (with $\# \chi = 200$ in our application case), randomly chosen inside $E$.
We will then have $(f_x)_{x \in \chi}$.
\item
Our metamodel, that we will denote $\left(\hat{\hat{f_x}}\right)_{x \in E} $, cannot be computed on $E$ due to its large size.
A new set $E$ is therefore defined, with $\#E = 2000$.
In this work, we limit our study to this restricted space (also denoted $E$ for simplicity) instead of the full space.
Other work will be performed in the future to extend our methodology to the study on the full space.
\end{itemize}
\section{Gaussian process regression metamodel of a stochastic simulator}
\subsection{Basics on the Gaussian process regression model}
The Gaussian process regression model is introduced here in the framework of deterministic scalar computer codes, following closely the explanations of Marrel et al. \cite{marioo08}.
The aim of a metamodel is to build a mathematical approximation of a computer code denoted by $G(x) \in \mathbb{R}$, $x = (x_1,\ldots,x_d) \in E \subset \mathbb{R}^d$ from $n$ of its evaluations.
These evaluations are performed from an experimental design set denoted in this work by $\chi = ( x^{(1)},\ldots,x^{(n)})$ where $x^{(i)} \in E$, $i=1,\dots,n$.
The simulations on $\chi$ are denoted by $y_n = (y^{(1)},\ldots,y^{(n)})$ with $y^{(i)} = G(x^{(i)})$, $i=1,\dots,n$.
Gaussian process regression models (Sacks et al. \cite{sacwel89}), also called Kriging models (Stein \cite{ste99}), suppose that the simulator response $G(x)$ is a realization of a Gaussian random process $Y$ of the following form:
\begin{equation}\label{Gpmodel}
Y ( x ) = h ( x ) + Z ( x) ,
\end{equation}
where $h ( x ) $ is a deterministic function and $Z ( x)$ is a centered Gaussian process.
$h(x)$ gives the mean approximation of the computer code. In this work, $h(x)$ is considered to be a one-degree polynomial model:
\begin{displaymath} h ( x ) = \beta_0 + \sum_{j = 1}^d \beta_j x_j \;, \end{displaymath}
where $\beta = [ \beta_0, \beta_1,\ldots, \beta_d ]^t $ is a regression parameter vector.
The stochastic part $Z(x)$ allows to model the non-linearities that $h(x)$ does not take into account. Furthermore, the random process $Z(x)$ is considered stationary with a covariance of the following form:
$$\mbox{Cov} ( Z ( x ), Z ( u ) ) = \sigma^2 K_{\theta} ( x - u ),$$
where $\sigma^2$ is the variance of $Z(x)$, $K_{\theta}$ is a correlation function and $\theta \in \mathbb{R}^d$ is a vector of hyperparameters.
This structure allows to provide interpolation and spatial correlation properties.
Several parametric families of correlation functions can be chosen (Stein \cite{ste99}).
Now let us suppose that we want to predict the output of $G(x)$ at a new point $x^{\Delta} = (x^{\Delta}_1,\ldots,x^{\Delta}_d) \in E$. The predictive distribution for $G(x^{\Delta})$ is obtained by conditioning $ Y ( x ^{\ast}) $ by the known values $y_n$ of $Y(x)$ on $\chi$ (we use the notation $Y_n = Y(\chi) = (Y(x^{(1)}),\dots,Y(x^{(n)}))$. Classical results on Gaussian processes imply that this distribution is Gaussian:
\begin{equation}\label{pred_dist}
[ Y(x^{\Delta})|Y_n=y_n] = \mathcal{N}\left(\displaystyle \ee [ Y(x^{\Delta})|Y_n=y_n], \mbox{Var}[ Y(x^{\Delta})|Y_n] \right).
\end{equation}
Finally, the metamodel is given by the mean of the predictive distribution (also called kriging mean):
\begin{equation}\label{eq_esperance}
\displaystyle \ee [ Y(x^{\Delta})|Y_n=y_n] = h(x^{\Delta}) + k(x^{\Delta}) ^t \mbox{\boldmath $\Sigma$}_n^{-1} (Y_n - h(\chi))
\end{equation}
with
\begin{displaymath}
\begin{array}{lll}
k(x^{\Delta}) & = &[\mbox{Cov}(Y(x^{(1)}),Y(x^{\Delta})), \ldots, \mbox{Cov}(Y(x^{(n)}),Y(x^{\Delta})) ] ^t \\
& = & \sigma^2 [ K_{\theta} (x^{(1)},x^{\Delta}), \ldots, K_{\theta} (x^{(n)},x^{\Delta}) ) ]^t
\end{array}
\end{displaymath}
and
\begin{displaymath} \mbox{\boldmath $\Sigma$}_n = \sigma^2 \left( K_{\theta} \left( x^{(i)} - x^{(j)} \right) \right)_{i,j = 1\ldots n} \;. \end{displaymath}
Furthermore, the accuracy of the metamodel can be evaluated by the predictive mean squared error given by
\begin{equation}\label{eq_variance}
\displaystyle MSE(x^{\Delta}) = \mbox{Var}[ Y(x^{\Delta})|Y_n] = \sigma^2 - k(x^{\Delta}) ^t \mbox{\boldmath $\Sigma$}_n^{-1} k(x^{\Delta}) \;
\end{equation}
The conditional mean \eqref{eq_esperance} is used as a predictor and its mean squared error (MSE) \eqref{eq_variance} -- also called kriging variance -- is a local indicator of the prediction accuracy.
More generally, Gaussian process regression model defines a Gaussian predictive distribution for the output variables at any arbitrary set of new points.
This property can be used for uncertainty and sensitivity analysis (see for instance Le Gratiet et al. \cite{legcan14}).
Regression and correlation parameters $\beta = (\beta_0, \beta_1,\dots,\beta_d)$, $\sigma^2$ and $\theta$ are generally estimated with a maximum likelihood procedure (Fang et al. \cite{fanli06}). The maximum likelihood estimates of $\beta$ and $\sigma^2$ are given by the following closed form expressions:
\begin{displaymath}
\hat \beta = \left( h(\chi)^t \mbox{\boldmath $\Sigma$}_n^{-1} h(\chi)\right)^{-1} h(\chi)^t \mbox{\boldmath $\Sigma$}_n^{-1}y_n,
\end{displaymath}
\begin{displaymath}
\hat \sigma^2 = \frac{\left(y_n - h(\chi)\hat \beta \right)^t \mbox{\boldmath $\Sigma$}_n^{-1} \left(y_n - h(\chi)\hat \beta \right)}{n-(d+1)}.
\end{displaymath}
However, such expression does not exist for the estimate of $\theta$ and it has to be evaluated by solving the following problem (see for instance Marrel et al. \cite{marioo08}):
\begin{displaymath}
\hat \theta = \mathrm{argmin}_\theta \left[ \log(\mathrm{det}(\mbox{\boldmath $\Sigma$}_n)) + n \log(\hat \sigma^2) \right].
\end{displaymath}
In practice, we have to rely on the estimators $\hat{h}$, $\hat{\beta}$ and $\hat{\theta}$.
Therefore we introduce some extra variability in the computation of the Kriging mean and the variance.
For instance, this harms the normality distribution of $[ Y(x^{\Delta})|Y_n=y_n]$.
In \cite{zhu06} and \cite{zimmerman06}, the authors offer an accurate computation of the kriging variance based on a correction term.
\subsection{Emulation of the simulator quantile function}
\subsubsection{General principles}
In our VME-optimization problem, we are especially interested by several quantiles (for example at the order $1\%$, $5\%$, $50\%$, $95\%$, $99\%$) rather than statistical moments.
In Moutoussamy et al. \cite{mounan14} and Browne \cite{bro14}, quantile prediction with a density-based emulator has shown some deficiencies.
Mainly, both the positivity and integral constraints make it impossible to apply the following approach to output densities.
Therefore, instead of studying Eq. (\ref{eq:densmodel}), we turn our modeling problem to
\begin{equation}
\begin{array}{rccl}
G \, : \,& E\times \Omega & \rightarrow & \mathbb{R} \\
& (x,\omega) = (x_1,x_2,x_3,x_4,x_5,\omega) & \mapsto & \text{NPV}(x,\omega) , \\
\\
Q \, : \,& E & \rightarrow & \mathcal{Q} \\
& x & \mapsto & Q_x \quad \text{quantile function of NPV$(x)$}
\end{array}
\end{equation}
where $\mathcal{Q}$ is the space of increasing functions defined on $]0,1[$, with values in $[a,b]$ (which is the support of the NPV output).
For $x \in E$, a quantile function is defined by
\begin{equation}
\forall p \in ]0,1[, \;\; Q_x(p) = t \in [a,b] \quad \mbox{such that} \quad \int_a^t f_x(\varepsilon)d\varepsilon=p .
\end{equation}
For the same points as in Figure \ref{Opt_dens}, Figure \ref{plot5} shows the $10$ quantile function outputs $Q$ which present a rather low variability.
\begin{figure}[!ht]
\begin{center}
\includegraphics[width=8cm,height=6cm]{plot5.pdf}
\caption{The $10$ quantile functions $Q$ of the VME code associated with the $10$ VME pdf given in Figure \ref{Opt_dens}.} \label{plot5}
\end{center}
\end{figure}
We consider the learning set $\chi$ ($n=\#\chi$) and $N_{\mbox{\scriptsize MC}} \times n$ $G$-simulator calls in order to obtain $\left( \tilde{Q}_x^{N_{\mbox{\tiny MC}}} \right)_{x \in \chi}$, the empirical quantile functions of $\left( \mbox{NPV}(x) \right)_{x \in \chi}$.
In this work, we will use $N_{\mbox{\scriptsize MC}} = 10^4$, which is sufficiently large to obtain a precise estimator of $Q_x$ with $\tilde{Q}_x^{N_{\mbox{\tiny MC}}}$.
Therefore, we neglect this Monte Carlo error.
In the following, we simplify the notations by replacing $\tilde{Q}_x^{N_{\mbox{\tiny MC}}}$ by $Q_x$.
The approach we adopt is similar to the one used in metamodeling a functional output of a deterministic simulator (Bayarri et al., \cite{bayber07}, Marrel et. al. \cite{marioo11}).
The first step consists in finding a low-dimensional functional basis in order to reduce the output dimension by projection, while the second step consists in emulating the coefficients of the basis functions.
However, in our case, due to the nature of the functional outputs (quantile functions), some particularities will arise.
\subsubsection{Projection of $Q_x$ by the Modified Magic Points (MMP) algorithm}
Adapted from the Magic Points algorithm (Maday et al. \cite{madngu07}) for probability density functions, the MMP algorithm has been proposed in Moutoussamy et al. \cite{mounan14}.
It is a greedy algorithm that builds an interpolator (as a linear combination of basis functions) for a set of functions. Its principle is to iteratively pick a basis function in the learning sample output set and projecting the set of functions on the picked functions.
Its advantage over a more classical projection method (such as Fourier basis systems) is that it sequentially builds an optimal basis for this precise projection.
The first step of the algorithm consists in selecting in the learning sample output set the functions which are the most correlated with the other ones. This function constitutes the first element of the functional basis.
Then, at each step $j \in \{2, \ldots , k\}$ of the building procedure, the element of the learning sample output set that maximizes the $ L^2$ distance between itself and the interpolator --- using the previous $j-1$ basis functions --- is added to the functional basis.
The total number $k$ of functions is chosen with respect to a convergence criterion.
Mathematical details about this criterion are not provided in the present paper.
In this paper, we apply the MMP algorithm on quantile functions.
Therefore, any quantile function $\left( Q_x \right)_{x \in \chi}$ is expressed as follows:
\begin{displaymath} \hat{Q}_x = \sum_{j=1}^k \psi_j(x) R_j \;,\; \forall x \in \chi ,
\end{displaymath}
where $R=\left( R_1,...,R_k \right)$ are the quantile basis functions determined by MMP and $\psi=(\psi_1,\ldots,\psi_k)$ are the coefficients obtained by the projection of $Q_x$ on $R$.
In order to ensure the monotonic increase of $\hat{Q}_x$, we can restrict the coefficients to the following constrained space:
\begin{displaymath}
C = \left\lbrace \psi \in \mathbb{R}^k, \quad \psi_1,...,\psi_k \geq 0 \right\rbrace .
\end{displaymath}
However, this restriction is sufficient but not necessary. That is why this constraint is not considered in Section \ref{optim_problem}. Indeed, it allows to preserve usefull properties of Gaussian process metamodels (such as any linear combinations of Gaussian process metamodels is Gaussian) for the optimization procedure. In practice, the monotonicity is verified afterwards.
\subsubsection{Gaussian process metamodeling of the basis coefficients}\label{sec:metamodelcoef}
The estimation of the coefficients $\psi(x) = (\psi_1(x), \ldots, \psi_k(x))$ ($x \in E$) is performed with $k$ independent Gaussian process metamodels.
According to \eqref{pred_dist}, each $\psi_j(x)$, $j=1,\dots,k$, can be modeled by a Gaussian process of the following form:
\begin{equation}\label{meta_psi}
\psi_j(x) \sim \mathcal{N}\left( \hat{\psi}_j(x), MSE_j(x) \right) \;,\; \forall j \in \{1,...,k\} \;,\; \forall x \in E
\end{equation}
where $\hat{\psi}_j(x)$ is the kriging mean \eqref{eq_esperance} and $MSE_j(x)$ the kriging variance \eqref{eq_variance} obtained from the $n$ observations ${\psi}_j(\chi)$.
Finally, the following metamodel can be used for ${\hat{Q}}_x$:
\begin{equation}\label{eq:metamodel}
\hat{\hat{Q}}_x = \sum_{j=1}^k \hat{\psi}_j(x)R_j \;,\; \forall x \in E ,
\end{equation}
However, we have to ensure that $\hat{\psi}_j \in C$ $(j=1\ldots k$).
The logarithmic transformation can then be used:
\begin{displaymath}
\begin{array}{rccl}
{\cal T}_1 \, : \,& C & \rightarrow & \mathbb{R}^k \\
& \psi & \mapsto & \left(\log(\psi_1+1),...,\log(\psi_k+1) \right)
\end{array}
\end{displaymath}
and its inverse transformation:
\begin{displaymath}
\begin{array}{rccl}
{\cal T}_2 \, : \,& \mathbb{R}^k & \rightarrow & C \\
& \phi & \mapsto & \left(\exp(\phi_1)-1,...,\exp(\phi_k)-1 \right).
\end{array}
\end{displaymath}
Then supposing that $\phi(x) := {\cal T}_1(\psi(x)) \;,\; \forall x \in E$, is a Gaussian process realization with $k$ independent margins, it can be estimated
by:
\begin{displaymath}
\hat{\phi}(x) = \ee[\phi(x) \mid \phi(\chi) = {\cal T}_1(\psi(\chi)) ] \;,\; \forall x \in E ,
\end{displaymath}
with $\psi(\chi)$ the learning sample output.
The following biased estimates of ${\psi}(x)$ can then be considered:
\begin{displaymath}
\hat{\psi}(x) = {\cal T}_2 (\hat{\phi}(x)) \;,\; \forall x \in E ,
\end{displaymath}
and (\ref{eq:metamodel}) can be applied as our metamodel predictor of the quantile function. However, the positivity constraint is not necessary and in our application the monotonicity is respected without considering it. Therefore, these transformations have not be used in our work.
\subsection{Numerical tests on a toy function}
\subsubsection{Presentation }
In order to test the efficiency of the estimator $\hat{\hat{Q}}$, we first substitute the industrial stochastic simulator VME by the following toy function $G$:
\begin{equation}
G(x) = \sin \left( x_1+U_1 \right) + \cos \left( x_2+U_2 \right) +x_3 \times U_3 ,
\label{eq:defG}
\end{equation}
with $x=(x_1,x_2,x_3) \in \left\lbrace 0.1; 0.2 ; ... ; 1 \right\rbrace^3$, $U_1 \sim \mathcal{N}(0,1)$, $U_2 \sim Exp(1)$ and $U_3 \sim \mathcal{U}([-0.5,0.5])$, which are all independent.
$G(x)$ is a real random variable and we have $\# E=10^3$.
The goal is to estimate the output quantile functions:
$$
\begin{array}{rccl}
Q : \,& E & \rightarrow & \mathcal{Q} \\
& x & \mapsto & Q_x \quad \text{quantile function of $G(x)$} .
\end{array}
$$
As $G$ is a simple simulator and the input set $E$ has a low dimension ($d=3$), we can afford to compute $N_{\mbox{\scriptsize MC}}=10^4$ runs of $G(x)$ for each input $x \in E$.
Hence we can easily deduce all the output quantile functions $\left( Q_x \right)_{x \in E}$.
We display in Figure \ref{fig:Gquant_functions} the output quantile functions $\left( Q_x \right)$ for 10 different $x \in E$.
\begin{figure}[!ht]
\begin{center}
\includegraphics[width=8cm,height=6cm]{quantG_output.pdf}
\caption{$10$ ouput quantile functions of the simulator $G$ (randomly sampled).}
\label{fig:Gquant_functions}
\end{center}
\end{figure}
\subsubsection{Applications to the MMP algorithm}
At present, we proceed at the first step for our estimator $\hat{\hat{Q}}$ by using the MMP algorithm.
We randomly pick the learning set $\chi \subset E$ such that $\# \chi = 150$.
As a result of the MMP algorithm, we get a basis of functions, $\left( R_1,...,R_k \right)$, extracted from the output quantile functions, $\left( Q_x \right)_{x \in E}$, as well as the MMP-projections of the output quantile functions on $\chi$:
$$
\forall x \in \chi\;, \quad \hat{Q}_x = \sum_{j=1}^k \psi_j(x) R_j.
$$
In the example, we set $k=4$.
Since the metamodel of the stochastic simulator is based on the estimation of the MMP-projection $\hat{Q}$, it is necessary to verify its relevance.
This is why we compute the following MMP error rate:
\begin{equation*}
err1 = \frac{1}{\# \chi} \: \sum_{x \in \chi} \: \frac{\parallel Q_x - \hat{Q}_x \parallel_{L^2} }{\parallel Q_x \parallel_{L^2} } = 0.09 \%.
\end{equation*}
This result shows that the MMP projection is very close to the real output quantile functions: if $\hat{\hat{Q}}$ is a good estimator of $\hat{Q}$, then it is a good estimator of $Q$.
It is important to recall that the basis $\left( R_1,...,R_k \right)$ depends on the choice of $\chi$, and so does $\hat{Q}$.
It probably approximates $Q$ better on $\chi$ than on the whole input set $E$.
Therefore it is natural to wonder whether the approximation $\hat{Q}$ is still relevant on $E$.
Since we could compute all the output quantile functions $\left( Q_x \right)_{x \in E}$, we could go further and compute
\begin{equation*}
err2 = \frac{1}{\# E} \: \sum_{x \in E} \: \frac{\parallel Q_x - \hat{Q}_x \parallel_{L^2} }{\parallel Q_x \parallel_{L^2} } = 0.13 \%.
\end{equation*}
From this result, we infer that even though the approximation is a little less correct on $E$, it is still efficient.
\subsubsection{Applications to the Gaussian process regression}\label{sec:applGP}
We now have the MMP projections $\left( \hat{Q}_x \right)_{x\in \chi}$, as well as the coefficients $\left( \psi_1(x),...,\psi_k(x) \right)_{x \in \chi}$.
The Gaussian process regression in this model consists in assuming that the $k$ coordinates $\left( \psi_1(x),...,\psi_k(x) \right)_{x \in E}$ are the realizations of $k$ independent Gaussian processes whose values on $\chi$ are already known.
From Eq. (\ref{eq:metamodel}), we have the expression of the metamodel:
$$
\forall x \in E\;, \quad \hat{\hat{Q}}_x = \sum_{j=1}^k \hat{\psi}_j(x) R_j .
$$
We verify the efficiency of the metamodel by computing the following error:
\begin{equation*}
err3 = \frac{1}{\# E} \: \sum_{x \in E} \: \frac{\parallel Q_x - \hat{\hat{Q}}_x \parallel_{L^2} }{\parallel Q_x \parallel_{L^2} } = 1.42 \%.
\end{equation*}
We conclude from this result, that the metamodel provides a good approximation for the output quantile functions of the simulator $G$ as runs were performed only on $\chi$.
We display in Figure \ref{fig:Gmetamodele} the output quantile function $Q_x$ for a point $x \in E$, with its successive approximations $\hat{Q}_x$ and $\hat{\hat{Q}}_x$.
\begin{figure}[!ht]
\begin{center}
\includegraphics[width=8cm,height=6cm]{G_QX_estimation.pdf}
\caption{For a point $x\in E$, $Q_x$ is in black points, $\hat{Q}_x$ in red line and $\hat{\hat{Q}}_x$ in red dotted line.}
\label{fig:Gmetamodele}
\end{center}
\end{figure}
Figure \ref{fig:Gmetamodele} confirms that, for this point $x\in E$ randomly picked, the MMP projection is really close to the initial quantile function.
As for $\hat{Q}_x$, the error is larger but the whole distribution of $G(x)$ is well estimated.
\section{Application to an optimization problem} \label{optim_problem}
\subsection{Direct optimization on the metamodel}
A first solution would be to apply our quantile function metamodel with a quantile-based objective function:
\begin{equation}
\begin{array}{rccl}
H \, : \,& \mathcal{Q} & \rightarrow & \mathbb{R} \\
& q & \mapsto & q(p) \\
\end{array}
\end{equation}
with $p\in ]0,1[$.
We look for:
\begin{equation} x^* := \argmax_{x \in E} Q_x(p) \end{equation}
but have only access to:
\begin{equation} \tilde{x}^* := \argmax_{x \in E} \hat{\hat{Q}}_x(p) . \end{equation}
We also study the relative error of $H(\hat{\hat{Q}})$ on $E$ by computing:
\begin{equation}
err = \frac{1}{\max_{x \in E} \left( Q_x(p) \right) -\min_{x \in E} \left( Q_x(p) \right) } \times \left( \sum_{x \in E} \mid Q_x(p) - \hat{\hat{Q}}_x(p) \mid \right) .
\end{equation}
As an example for $p=0.5$ (median estimation), with the toy-function $G$ introduced in (\ref{eq:defG}), we find
\begin{equation*}
\begin{array}{lcr}
\max_{x \in E} ( Q_x(p) ) =0.82, & \max_{x \in E} ( \hat{\hat{Q}}_x(p) )=0.42, & err = 5.4\% .
\end{array}
\end{equation*}
As the estimated maximum value ($0.42$) has a large error with respect to the value of the exact solution ($0.82$), we strongly suspect that the quantile function metamodel cannot be directly applied to solve the optimization problem.
In the next section, we will also see that this strategy does not work either on the VME application.
We then propose an adaptive algorithm which consists in sequentially adding simulation points in order to capture interesting quantile functions to be added in our functional basis.
\subsection{QFEI: an adaptive optimization algorithm }
After the choice of $\chi$, $E$ and the families $\left( Q_x \right)_{x \in \chi}$, $( \hat{Q}_x)_{x \in \chi}$ and $( \hat{\hat{Q}}_x)_{x \in E}$, our new algorithm will propose to perform new interesting (for our specific problem) calls to the VME simulator on $E$ (outside of $\chi$).
With the Gaussian process metamodel, which provides a predictor and its uncertainty bounds, this is a classical approach used for example in black-box optimization problem (Jones et al. \cite{jonsch98}) and rare event estimation (Bect et al. \cite{becgin12}).
The goal is to provide some algorithms which mix global space exploration and local optimization.
Our algorithm is based on the so-called EGO (Efficient Global Optimization) algorithm (Jones et al. \cite{jonsch98}) which uses the Expected Improvement (EI) criterion to maximize a deterministic simulator.
Our case is different as we want to maximize:
\begin{equation}
\begin{array}{rccl}
H \, : \,& E & \rightarrow & \mathbb{R} \\
& x & \mapsto & Q_x(p) \quad \mbox{$p$-quantile of NPV$(x)$} ,
\end{array}
\end{equation}
\emph{ie} the $p$-quantile function, for $p \in ]0,1[$, of the stochastic simulator.
We will then propose a new algorithm called the QFEI (for Quantile Function Expected Improvement) algorithm.
As previously, we use a restricted set $E$ with $\#E=5000$ ($E$ is a random sample in the full set), the initial learning set $\chi \subset E$ with $\# \chi=200$ (initial design of experiment), $\left( Q_x \right)_{x \in \chi}$, $( \hat{Q}_x)_{x \in \chi}$ and $( \hat{\hat{Q}}_x)_{x \in E}$.
We denote the current learning set by $D$ (the initial learning set increased with additional points coming from QFEI).
The Gaussianity on the components of $\psi$ is needed for the EGO algorithm, that is why we do not perform the logarithmic transformation presented in Section \ref{sec:metamodelcoef}.
In our case, it has not implied negative consequences.
We apply the Gaussian process metamodeling on the $k$ independent components $\psi_1,...,\psi_k$ (see Equation \eqref{meta_psi}).
As $\hat{Q}_x(p) = \sum_{j=1}^k \psi_j(x) R_j(p) $, we have
\begin{equation}
\hat{Q}_x(p) \sim \mathcal{N} \left( \hat{\hat{Q}}_x(p), \sum_{j=1}^k R_j(p)^2 MSE_j(x) \right) \;,\; \forall x \in E.
\end{equation}
Then $\hat{Q}_{x}(p)$ is a realization of the underlying Gaussian process $U_{x}=\sum_{j=1}^k \psi_j (x) R_j(p)$ with
\begin{equation}
\begin{array}{lll}
U_D & := \left( U_x \right) _{x \in D} &,\\
\hat{U}_{x} & := \ee[U_{x} \mid U_D], &\forall x \in E ,\\
\sigma_{U|D}^2(x) & := \mbox{Var}[U_{x} \mid U_D], &\forall x \in E .
\end{array} \end{equation}
The conditional mean and variance of $U_x$ are directly obtained from the $k$ Gaussian process metamodels of the $\psi$ coefficients \eqref{meta_psi}.
At present, we propose to use the following improvement random function:
\begin{equation}
\begin{array}{rccl}
I \, : \,& E & \rightarrow & \mathbb{R} \\
& x & \mapsto & \left(U_x-\max\left(U_D \right)\right)^+ ,
\end{array}
\end{equation}
where $\left( x \mapsto \left(x\right)^+ = x. \mathbf{1}_{x > 0} \right)$ is the positive part function.
In our adaptive design, finding a new point consists in solving:
\begin{equation} x_{new} := \argmax_{x \in E} \ee[I(x)] . \end{equation}
Added points are those which have more chance to improve the current optimum.
The expectation of the improvement function writes (the simple proof is given in Browne \cite{bro14}):
\begin{equation}
\quad \ee[I(x)]=\sigma_{U|D}(x) \left( u(x) \phi(u(x)) + \varphi(u(x)) \right) \;,\; \forall x \in E ,\quad \mbox{with} \quad u(x)= \frac{\hat{U}_x-\max(U_D)}{\sigma_{U|D}(x)}
\end{equation}
where $\varphi$ and $\phi$ correspond respectively to the density and distribution functions of the reduced centered Gaussian law.
In practice, several iterations of this algorithm are performed, allowing to complete the experimental design $D$.
At each iteration, a new projection functional basis is computed and the $k$ Gaussian process metamodels are re-estimated.
The stopping criterion of the QFEI algorithm can be a maximal number of iterations or a stabilization criterion on the obtained solutions.
No guarantee on convergence of the algorithm can be given.
In conclusion, this algorithm provides the following estimation of the optimal point $x^*$:
\begin{equation}\label{eq:QFEI_sol}
\hat{x}^* := \argmax_{x \in D}(U_D) .
\end{equation}
\subsection{Validation of the QFEI algorithm on the toy function}
We get back to the toy-function $G$ introduced in (\ref{eq:defG}).
The goal is to determine $x^* \in E$ such that:
$$
x^* = \underset{x \in E}{\argmax} \; Q_x(p)
$$
with $p=0.4$.
In other words, we try to find the input $x \in E$ whose output distribution has the highest 40\%-quantile.
In this very case, we have:
$$
x^* = \left( 1, 0,1 , 0.5 \right) \quad \mbox{with} \quad Q_{x^*}(p)= 0.884.
$$
We have also computed
\begin{equation*}
\frac{1}{\# E} \sum_{x \in E} Q_x(p)=-0.277, \quad \mbox{Var} \left[ \left(Q_x(p)\right)_{x \in E} \right] = 0.071 .
\end{equation*}
Let us first remember that we set an efficient metamodel $\hat{\hat{Q}}$ for $Q$ in the section \ref{sec:applGP}.
Indeed, we had $err3=1.42 \%$.
As before, we test the natural way to get an estimation for $x^*$, by determining
$$
\tilde{x}^* = \underset{x \in E}{\argmax} \hat{\hat{Q}}_x(p).
$$
Unfortunately, still in our previous example, we get
$$
\tilde{x}^* = \left( 0.9, 0,2, 0.8 \right)
$$
which is far from being satisfying.
Besides, when we compute the real output distribution for $\tilde{x}^*$, we have
$$
Q_{\tilde{x}^*}(p) = 0.739 .
$$
Therefore only relying on $\hat{\hat{Q}}$ to estimate $x^*$ would lead to an important error.
This is due to the high smoothness of the function $x \longrightarrow Q_x(p)$: even a small error in the estimator $Q_{\cdot}(p)$ completely upsets the order of the family $\left( Q_x(p) \right)_{x \in E}$.
At present, we use the QFEI algorithm (Eq. (\ref{eq:QFEI_sol})) in order to estimate $x^*$ by $\hat{x}^* $, with $20$ iterations.
At the end of the experiments, the design $D$ is the learning set $\chi$ to which we have consecutively added $20$ points of $E$.
With QFEI, we finally get
$$
\hat{x}^* = \left( 1, 0,1 , 0.2 \right) \quad \mbox{with} \quad Q_{\hat{x}^*}(p)= 0.878.
$$
It is important to mention that $\hat{x}^*$ has the second highest output 40\%-quantile.
Overall we tested the whole procedure $30$ times with, in each case, a new learning set $\chi$.
In the $30$ trials, we made sure that the maximizer $x^*$ was not already in $\chi$.
In $22$ cases, we obtain $\hat{x}^*=x^*$, which is the best result that we could expect.
For the remaining $8$ times, we obtain $\hat{x}^* = \left( 1, 0,1 , 0.2 \right)$.
We can conclude that the QFEI algorithm is really efficient for this optimization problem.
%
\section{Application to the VME case study}
We return to our VME application (cf Section \ref{sec:VME}).
For the projection of $Q_x$ by the Modified Magic Points (MMP) algorithm, the choice $k=5$ has shown sufficient approximation capabilities.
For one example of quantile function output, a small relative $L^2$-error ($0.2\%$) between the observed quantile function and the projected quantile function is obtained.
Figure \ref{plot6} confirms also the relevance of the MMP method.
\begin{figure}[!ht]
\begin{center}
\includegraphics[width=8cm,height=6cm]{plot6.pdf}
\caption{For one point $x \in \chi$, $\hat{Q}_x$ (red line) and $Q_x$ (black points).} \label{plot6}
\end{center}
\end{figure}
We build the Gaussian process metamodel on the set $E$ (with the choice $k=5$).
For one example of quantile function output, a small relative $L^2$-error ($2.8\%$) between the observed quantile function and the emulated quantile function is obtained.
Figure \ref{plot7} confirms also the relevance of the metamodeling method.
\begin{figure}[!ht]
\begin{center}
\includegraphics[width=8cm,height=6cm]{plot7.pdf}
\caption{For one point $x \in \chi$, $\hat{\hat{Q}}_x$ (red line) and $Q_x$ (black points).}\label{plot7}
\end{center}
\end{figure}
As for the toy function, our optimization exercise is to determine $x^* \in E$ such that
$$
x^* = \underset{x \in E}{\argmax} \; Q_x(p)
$$
with $p=0.5$.
We first try to directly apply an optimization algorithm on the previously obtained metamodel.
As an example, for $p=0.5$ (median estimation), we find:
\begin{equation}
\begin{array}{lcr}
\max_{x \in E} ( Q_x(p) ) =0.82, & \max_{x \in E} ( \hat{\hat{Q}}_x(p) )=0.42, & err = 5.4\% .
\end{array}
\end{equation}
If we define $y= \argmax_{x \in E} [\hat{\hat{Q}}_x(p)]$ the best point from the metamodel, we obtain $Q_y(p)=0.29$ while $\max_{x\in \chi}Q_x(p)=0.35$.
The exploration of $E$ by our metamodel does not bring any information.
We have observed the same result by repeating the experiments $100$ times (changing the initial design each time).
It means that the punctual errors on the quantile function metamodel are too large for this optimization algorithm.
In fact, the basis functions $R_1,...,R_5$ that the MMP algorithm has chosen on $\chi$ are not able to represent the extreme parts of the quantile functions of $E$.
As a conclusion of this test, the quantile function metamodel cannot be directly applied to solve the optimization problem.
We now apply the QFEI algorithm.
In our application case, we have performed all the simulations in order to know $\left( Q_x \right) _{x \in E}$, therefore the solution $x^*$.
Our first objective is to test our proposed algorithm for $p=0.4$ which has the following solution:
\begin{equation} \left\lbrace
\begin{array}{ll}
x^* & = \left( 41,47,48,45,18 \right) \\
Q_{x^*}(p) & = -1.72 .
\end{array}
\right. \end{equation}
We have also computed
\begin{equation} \frac{1}{\# E} \sum_{x \in E} Q_x(p)=-3.15, \quad \mbox{Var} \left( \left(Q_x(p)\right)_{x \in E} \right)=0.59 . \end{equation}
We start with $D := \chi$ and we obtain
\begin{equation} \max_{x \in \chi} \left( Q_x \right) = -1.95 . \end{equation}
After $50$ iterations of the QFEI algorithm, we obtain:
\begin{equation} \left\lbrace
\begin{array}{ll}
\hat{x}^* & = \left( 41,47,45,46,19 \right) \\
Q_{\hat{x}^*}(p) & = -1.74 .
\end{array}
\right. \end{equation}
We observe that $\hat{x}^*$ and $Q_{\hat{x}^*}(p)$ are close to $x^*$ and $\simeq Q_{x^*}(p)$.
This is a first confirmation of the relevance of our method.
With respect to the initial design solution, the QFEI has allowed to obtain a strong improvement of the proposed solution.
$50$ repetitions of this experiment (changing the initial design) has also proved the robustness of QFEI.
The obtained solution is always one of the five best points on $E$.
QFEI algorithm seems promising but a lot of tests remain to perform and will be pursued in future works: changing $p$ (in particular testing extremal cases), increasing the size of $E$, increasing the dimension $d$ of the inputs, \ldots
\section{Conclusion}
In this paper, we have proposed to build a metamodel of a stochastic simulator using the following key points:
\begin{enumerate}
\item Emulation of the quantile function which proves better efficiency for our problem than the emulation of the probability density function;
\item Decomposition of the quantile function in a sum of the quantile functions coming from the learning sample outputs;
\item Selection of the most representative quantile functions of this decomposition using an adaptive choice algorithm (called the MMP algorithm) in order to have a small number of terms in the decomposition;
\item Emulation of each coefficient of this decomposition by a Gaussian process metamodel, by taking into account constraints ensuring that a quantile function is built.
\end{enumerate}
The metamodel is then used to treat a simple optimization strategy maintenance problem using a stochastic simulator (VME), in order to optimize an output (NPV) quantile.
Using the Gaussian process metamodel framework and extending the EI criterion to quantile function, the adaptive QFEI algorithm has been proposed.
In our example, it allows to obtain an ``optimal'' solution using a small number of VME simulator runs.
This work is just a first attempt and needs to be continued in several directions:
\begin{itemize}
\item Consideration of a variable $N_{\mbox{\scriptsize MC}}$ whose decrease could help to fight against the computational cost of the stochastic simulator,
\item Improvement of the initial learning sample choice by replacing the random sample by a space filling design (Fang et al. \cite{fanli06}),
\item Algorithmic improvements to counter the cost of the metamodel evaluations and to increase the size of the study set $E$,
\item Multi-objective optimization (several quantiles to be optimized) in order to take advantage of our powerful quantile function emulator,
\item Including the estimation error induced in practice by $\hat{h}$, $\hat{\beta}$ and $\hat{\theta}$ to define a more precise version of the QFEI algorithm,
\item Application to more complex real cases,
\item Consideration of a robust optimization problem where environmental input variables of the simulator has not to be optimized but just create an additional uncertainty on the output.
\end{itemize}
| {'timestamp': '2016-05-04T02:11:42', 'yymm': '1512', 'arxiv_id': '1512.07060', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.07060'} | arxiv |
\section{Introduction}
Most clustering algorithms seek to detect disjoint clouds of data. However, in high-dimensional statistics, data can become very sparse, and these types of methods have trouble dealing with noise. In fact, a completely new approach to the geometry of clustering has recently made headway in the analysis of high-dimensional data sets. Called subspace clustering, this approach assumes that data come from subspaces offset at angles, rather than from clouds offset by gaps, the so called Union of Subspaces (UOS) model \cite{Vidal1,tsc,Park2014_GSC}. Applications have included detection of tightly correlated gene clusters in genomics \cite{KiWi}, patient-specific seizure detection from EEG data \cite{DuttaEEGSC}, and image segmentation \cite{Yang:EECS-2006-195}.
All subspace clustering methods must embed data in $\mathbb{R}^n$. However, in some of the high-dimensional data sets where subspace clustering has been applied, the initial structure of the data is not a vector but rather a matrix or tensor (multi-way array). Examples include the auditory temporal modulation features in \cite{Panagakis:2014kx}, the image patches in \cite{Yang:EECS-2006-195}, and raw EEG data under the ``sliding-window approach'' \cite{DuttaEEGSC}. We seek to develop a clustering method that incorporates the geometric innovation of subspace clustering without vectorizing these higher-order arrays. To do this, we formulate an algebraic generative model for the data, along with methods for inference.
\textbf{The Subspace Clustering Problem and a Multilinear Variant} - Mathematically, the subspace clustering problem is described as follows. Given a set of points ${x}_n$, $n=1...N$, suppose each point is an element of one of the $K$ subspaces. The problem is to decide membership for each of the $N$ points. For simplicity, we treat $K$ as known.
In order to take advantage of patterns in two-way data, we modify the assumptions of the subspace clustering problem. Rather than modeling the data as a union of subspaces, we assume they come from a union of \emph{tensor products} of subspaces \cite{Hackbusch_book}. Given subspaces $\mathcal{U} \subset \mathbb{R}^n$ and $\mathcal{V} \subset \mathbb{R}^m$, suppose the columns of $\textbf{U}$ form a basis of $\mc{U}$ and likewise for $\textbf{V}$ and $\mathcal{V}$. The tensor product $\mathcal{U} \otimes \mathcal{V}$ is the set $\{\textbf{A}|\textbf{A}=\textbf{UYV}^T\}$, where $\textbf{Y}$ is a dim($\mc{U}$)$\times$ dim($\mc{V}$) matrix. In other words, this is a set of matrices with (column/row) space confined to ($\mathcal{U}$/$\mathcal{V}$). We refer to this model as the union of multilinear subspaces (UOMS) model and we call this the multilinear subspace clustering (MSC) problem. \textbf{\emph{Note that while $\mathcal{U} \otimes \mathcal{V}$ is a \emph{tensor-subspace} of the tensor space $\mathbb{R}^{n} \otimes \mathbb{R}^{m}$, not all subspaces of the tensor space is a tensor subspace \cite{Hackbusch_book}. Therefore we are assuming a tensor-subspace structure on the clusters under the UOMS model.}}
The difference between the generative models for UOS and UOMS is clarified in Algorithms \ref{alg:UOS}, \ref{alg:UOMS}.
\begin{algorithm}
\caption{UOS Data Generation: $N$ points, $K$ clusters of latent dimension $d$ and ambient dimension $D$}
\label{alg:UOS}
Given $\{\textbf{U}_1, ..., \textbf{U}_K\} \in \mathbb{R}^{D\times d}$,\\
Repeat $N$ times:\\
Draw $k$ from $\{1, ..., K\}$ \\
Draw a random length-$d$ vector $y_n$\\
Compute datum $\V{x}_n=\textbf{U}_k\V{y}_n$
\end{algorithm}
\vspace{-5mm}
\begin{algorithm}
\caption{UOMS Data Generation: $N$ points, $K$ clusters of latent dimension $d_v d_u$ and ambient dimension $D_v D_u$}
\label{alg:UOMS}
Given $\{\textbf{U}_1, ..., \textbf{U}_K\} \in \mathbb{R}^{D_u\times d_u}, \{\textbf{V}_1, ... , \textbf{V}_K\} \in \mathbb{R}^{D_v\times d_v}$\\
Repeat $N$ times:\\
Draw $k$ from $\{1, ..., K\}$ \\
Draw a random $d_u$ by $d_v$ matrix $\textbf{Y}_n$\\
Compute datum $\textbf{A}_n=\textbf{U}_k\textbf{Y}_n\textbf{V}_k^T$
\end{algorithm}
\vspace{-3mm}
\textbf{Relation of UOMS to existing subspace models} - Note that the UOS model with single subspace (one cluster) is related to the Principal Component Analysis (PCA). Similarly the UOMS with one cluster is closely related to separable covariance models \cite{hoff2011} and also 2D-PCA\cite{2DPCA}. Further in \cite{hoff2011}, extensions of this idea to 3-D, 4-D,... data is shown to be equivalent to HOSVD and Tucker decompositions \cite{Kolda:2009vn} that have been useful for dimensionality reduction for image ensembles \cite{Vasilescu_2003}. Further such multilinear subspace models have been used in machine learning \cite{HeCN05_NIPS,MPCA_2006}. In this paper we study an extension of these models by considering a \emph{union} of such structured subspaces.
\vspace{0pt}
\begin{algorithm}
\caption{Thresholded Subspace Clustering (TSC)}
\label{tscAlg}
\begin{algorithmic}
\item \textbf{Input}
\State $\textbf{X} \in \mathbb{R}^{D \times N}$ holding data vectors $\V{x}_i$, number of clusters $K$, thershold ($1 \le q \le N$)
\item \textbf{Procedure}
\State Normalize $\V{x}_i$, Compute adjacency matrix $C = |X^\top X|$
\State Set all but q highest values of each row of C to zero
\State $\textbf{C}_{i,j} = \exp\left(-2*\cos^{-1}(\textbf{C}_{ij})\right)$
\State Perform normalized spectral clustering on $\textbf{C}$
\item \textbf{Output}
\State A vector in $\mathbb{R}^N$ with clustering labels for all $\V{x}_i$
\end{algorithmic}
\end{algorithm}
\vspace{-5mm}
\vspace{-5pt}
\begin{algorithm}
\caption{Sparse Subspace Clustering (SSC)}
\label{sscAlg}
\begin{algorithmic}
\item \textbf{Input}
\State $\textbf{X} \in \mathbb{R}^{D \times N}$ holding data vectors $\V{x}_i$, $\lambda_1, \lambda_2 \geq 0$
\State the number of clusters $K$
\item \textbf{Procedure}
\State Solve $\arg\min_{\textbf{C},\textbf{E}} \| \textbf{X} - \textbf{X}\textbf{C} - \textbf{E}\|_{F}^{2} + \lambda_1 ||\textbf{C}||_1 + \lambda_2\|\textbf{E}\|_{1}$ s.t. $\textbf{C}_{ii} = 0$
\State Form $\textbf{W} = |\textbf{C}| + |\textbf{C}|^\top$
\State Apply spectral clustering on $\textbf{W}$
\item \textbf{Output}
\State A vector in $\mathbb{R}^N$ with clustering labels for all $\V{x}_i$
\end{algorithmic}
\end{algorithm}
\textbf{Clustering under the UOS model} - There are many algorithms exploiting the UOS model for clustering, but we focus on two general methods that form an affinity matrix among data points followed by spectral clustering \cite{Luxburg:2007dq}. The first, called Thresholded Subspace Clustering (TSC), is introduced in \cite{tsc}. This provably reliable and robust subspace clustering algorithm involves constructing a weighted graph where nodes represent the data points and edges represent the connectivity of any two points. The inner product between the data points is used as the edge weight with the idea that points in the same subspace will generally have a higher inner product than points in different subspaces. The symmetric adjacency matrix for the graph is then thresholded, setting all but the $q$ highest weights in each row to zero, in order to filter out noise.
The second method, called Sparse Subspace Clustering (SSC) \cite{ssc} involves expressing each point as a linear combination of the other points in the dataset. The algorithm finds the sparsest possible linear representation of each data point in terms of other data points -- achieved by minimizing the $\ell_{1}$-norm -- with the idea that the points used will come from the same subspace as the point in question. A weighted graph is then formed with an adjacency matrix found using the sparse representations of each point. Both the TSC and SSC algorithms, taken from \cite{tsc} and \cite{ssc} respectively, are detailed in Algorithms \ref{tscAlg} and \ref{sscAlg}.
\vspace{-5mm}
\section{Clustering under the UOMS model}
\vspace{-3mm}
In the case of two-way data, our data points would be a collection of $N$ matrices $\textbf{A}_n \in \mathbb{R}^{D_U \times D_V}$ such that the columns come from a union of subspaces $\mathcal{U}_1 \cup \hdots \cup \mathcal{U}_K$ and the rows come from a union of subspaces $\mathcal{V}_1 \cup \hdots \cup \mathcal{V}_K$. To take advantage of this fact and find these $\mathcal{U}_i$ and $\mathcal{V}_i$ subspaces, one method would be to cluster all $D_{\mathcal{V}}N$ columns and all $D_{\mathcal{U}}N$ rows separately; however, this is an expensive solution. Instead, we randomly select a single column and a single row from each matrix and cluster these. We stack the random columns side by side to form a $D_{\mathcal{U}} \times N$ matrix $X_{cols}$ and transpose and stack our random rows side by side to form a $D_{\mathcal{V}} \times N$ matrix $\textbf{X}_{rows}$. The $i$th column of each of these matrices comes from the $i$th ($i=1,...,N$) data matrix $\textbf{A}_i$. We then perform a clustering algorithm on $\textbf{X}_{rows}$ and $\textbf{X}_{cols}$ separately, but pause after obtaining the symmetric adjacency matrix C in each case. We repeat this process for $T$ trials, ending up with $2T$ adjacency matrices, which we then combine in one of a few possible ways.
Possible combination methods are detailed subsequetly. Combining these adjacency matrices can be thought of as condensing multiple graph realizations to obtain a single weighted graph representing our clustering problem. Once we have our condensed graph, we perform spectral clustering on it to achieve the segmentation of our original points. Algorithm \ref{mscAlg} outlines the steps described above.
\vspace{-2mm}
\begin{algorithm}
\caption{Multilinear Subspace Clustering (MSC)}
\label{mscAlg}
\begin{algorithmic}
\item \textbf{Input:}
\State Data $\textbf{A}_1,...,\textbf{A}_N \in \mathbb{R}^{D_c \times D_r}$, number of clusters $K$
\State Clustering Method (TSC or SSC), number of trials $T$
\item \textbf{Procedure:}
\State \textbf{For} $T$ trials
\State \hspace{\algorithmicindent} form $\textbf{X}_{cols} \in \mathbb{R}^{D_c \times N}$ with $i$-th column randomly selected from $\textbf{A}_i$
\State \hspace{\algorithmicindent} form $\textbf{X}_{rows} \in \mathbb{R}^{D_r \times N}$ with $i$-th column randomly selected from $\textbf{A}_i^\top$
\State \hspace{\algorithmicindent} Run clustering (TSC or SSC) on $\textbf{X}_{cols}$ and $\textbf{X}_{rows}$ to get $\textbf{C}_{cols} \in \mathbb{R}^{N \times N}$ and $\textbf{C}_{rows} \in \mathbb{R}^{N \times N}$
\State \textbf{End For}
\State Combine all $\textbf{C}_{cols}$ and $\textbf{C}_{rows}$ into a single adjacency matrix $\textbf{C} \in \mathbb{R}^{N \times N}$
\State Perform spectral clustering on $\textbf{C}$
\item \textbf{Output:}
\State A vector in $\mathbb{R}^N$ with clustering labels for all $\textbf{A}_i$
\end{algorithmic}
\end{algorithm}
\textbf{Combining the Graph Realizations} - We now discuss several (heuristic) methods for combining the adjacency matrices obtained at each iteration of MSC.
\begin{enumerate}
\setlength\itemsep{-3pt}
\item \textbf{Addition}: One simple method is to add the $2T$ adjacency matrices together.
\item \textbf{Thresholding}: Add the matrices together followed by thresholding, setting all but the $q$ highest edges per row to zero. A possible choice of threshold for this method would be the average number of data points per cluster -- if this number is known -- minus one (to count out the point itself).
\item \textbf{Filtering by Quantile}: A "quantile" method involves choosing a parameter $l$ and taking the $l$-th highest weight at each edge out of all the adjacency matrices. The choice of $l$ poses an obstacle, as there is not a given value that will be optimal for all graphs.
\item \textbf{Projection}: Project each individual adjacency matrix's columns onto its leading $K$ singular vectors (corresponding to largest singular values) before adding the instances. However, the fact that each matrix is projected onto its leading singular vectors before sharing any information with other graph realizations could lead to loss of quality.
\end{enumerate}
\textbf{Remark} - These methods are by no means exhaustive. In particular, the problem of combining various graph realizations for the same problem instance by itself is an interesting avenue of research.
\textbf{Algorithmic Complexity} -
For $N$ data points of dimension $D$, TSC has algorithmic complexity $\mc{O}(DN^2)$. Therefore, if we are comparing TSC on vectorized 2-way data against MSC using TSC on the same data in matrix form, the MSC data points will be matrices of size $D_c \times D_r$ where $D=D_cD_r$. At each iteration of MSC, we form the matrices of size $D_c \times N$ and $D_r \times N$ for the column space and row space respectively. Since we then perform TSC on these matrices, the algorithmic complexity at each iteration will be $\mathcal{O}(D_cN^2 + D_rN^2)$ or approximately $\mc{O}(\sqrt{D}N^2)$ when $D_c \approx D_r$. For the projection method, which is the computationally most expensive, when $K << N$, using randomized SVD a computational cost of ${\cal O}(N^2 \log K)$ \cite{Halko_2011} is incurred. Therefore, for T iterations of MSC, we have $\mc{O}(T\sqrt{D}N^2)$ compared to $\mc{O}(DN^2)$ for TSC. Therefore if we can pick a number of trials T such that $T \ll \sqrt{D}$, MSC will be cheaper. This obviously leads to a possible conclusion that MSC will be a better choice for large data while TSC will be more realistic for data of smaller dimensions. The computational complexity of the SSC algorithm is ${\cal O}(DN^3)$, which for large $D$ and $N$ becomes more prohibitive compared to TSC as well as MSC.
\vspace{-3mm}
\section{Numerical Results}
\subsection{Yale Face Database}
We first test our Multilinear Subspace Clustering algorithm on images of faces with fixed pose and expression under different illumination conditions from the Yale Face Database B. These images are of size $192 \times 168$ pixels and we use 64 images each of 37 different people. The parameters that we vary are the number of trials $T$ and the method of combining graph realizations. Over numbers of clusters ranging from 2 to 10, we compare results to those obtained in \cite{tsc} and \cite{ssc} using TSC and SSC. We measure success based on a clustering error that measures the fraction of misclassified points and is defined in \cite{tsc}.
\subsection{Results of Different Methods for Combining Graphs}
We first test the various methods of condensing our graph that we detailed in section 2. We set $T = 15$ as a constant number of trials and find the clustering error for 2, 5, and 10 clusters using all four methods. The results, depicted in Table 1, show that the method of projecting the columns of the adjacency matrices onto their leading eigenvectors before adding them produces the smallest clustering error by far. Therefore we use this method for future results shown in this paper.
\begin{table}
\centering
\caption{The clustering error for our four methods for condensing the graph obtained in MSC.}
\label{tab:1}
\begin{tabular}{|c|c|c|c|c|}
\hline
\multicolumn{2}{|c|}{\multirow{2}{*}{\% MSC Clustering Errors}} & \multicolumn{3}{c|}{Number of Clusters} \\ \cline{3-5}
\multicolumn{2}{|c|}{} & 2 & 5 & 10 \\ \hline
\multirow{4}{*}{Method} & addition & 12.21 & 44.16 & 48.96 \\ \cline{2-5}
& projection & 4.06 & 20.19 & 38.70 \\ \cline{2-5}
& quantile & 20.75 & 47.37 & 45.52 \\ \cline{2-5}
& threshold & 11.13 & 35.52 & 46.15 \\ \hline
\end{tabular}
\end{table}
\subsection{Varying the Number of Trials}
Using the project-first method of combining our graph realizations, we next test the effect of varying the number of trials used for MSC. The goal is to find a number independent of the number of data points that is small enough such that MSC remains as efficient as possible (based on the discussion on computational complexity) while minimizing the clustering error. From Table \ref{tab:2} We note that the clustering error begins to plateau at 100 - 200 trials. We are randomly selecting columns and rows from each matrix, so ideally we get a different fiber at each iteration. Setting the number of trials to be more than the number of fibers does not make sense if we do not want to use a fiber more than once. In the following subsection, when we discuss MSC using SSC, we use 100 trials, as it seems to be where increasing the trials begins to have less effect on performance.
\begin{table}
\centering
\caption{The MSC using TSC clustering error data}
\label{tab:2}
\label{varyNumTrialsTab}
\begin{tabular}{|c|c|c|c|c|}
\hline
\multicolumn{2}{|c|}{\multirow{2}{*}{\% MSC Clustering Errors}{\begin{tabular}[c]{@{}c@{}}\\ \end{tabular}}} & \multicolumn{3}{c|}{Number of Clusters} \\ \cline{3-5}
\multicolumn{2}{|c|}{} & 2 & 5 & 10 \\ \hline
\multirow{7}{*}{Number of Trials} & 10 & 5.50 & 22.61 & 43.85 \\ \cline{2-5}
& 20 & 4.44 & 19.01 & 40.73 \\ \cline{2-5}
& 50 & 3.37 & 15.68 & 38.28 \\ \cline{2-5}
& 100 & 2.65 & 14.43 & 36.82 \\ \cline{2-5}
& 200 & 2.32 & 13.73 & 34.95 \\ \cline{2-5}
\hline
\end{tabular}
\end{table}
\subsection{Varying the SSC Parameters}
The SSC code taken from \cite{ssc} requires parameter that were previously optimized for vectorized data. We therefore vary three of these inputs to achieve the best results. The first two parameters allow for the algorithm to reject outliers and allow for affine subspaces respectively. If the outlier parameter is "true", the SSC code will dismiss outlying entries, and if the affine parameter is "true", the code will broaden its scope to include affine subspaces. The numerical results can be seen in Table \ref{MSCwSSC:outlier_affine}. Interestingly, the best results come from allowing outlier rejection but disallowing affine subspaces.
\textbf{Note}: This is slightly counterintuitive for MSC, as SSC is being run on a matrix of single fibers, not on an entire data point at each iteration. Therefore, one might think that since many of the fibers will have no connection to each other, random fibers would get thrown out as outliers, when really we would want to get rid of entire outlying data points, not single fibers. This is an important avenue for future research.
\begin{table}
\centering
\caption{MSC using SSC}
\label{MSCwSSC:outlier_affine}
\begin{tabular}{|c|c|c|c|c|c|}
\hline
\multicolumn{3}{|c|}{\multirow{2}{*}{\% MSC CE}{\begin{tabular}[c]{@{}c@{}}\end{tabular}}} & \multicolumn{3}{c|}{Number of Clusters} \\ \cline{4-6}
\multicolumn{3}{|c|}{} & 2 & 5 & 10 \\ \hline
\multirow{4}{*}{Constraints} & \begin{tabular}[c]{@{}c@{}}Outliers\\ ON\end{tabular} & \begin{tabular}[c]{@{}c@{}}Affine\\ ON\end{tabular} & 10.02 & 58.17 & 70.26 \\ \cline{2-6}
& \begin{tabular}[c]{@{}c@{}}Outliers\\ ON\end{tabular} & \begin{tabular}[c]{@{}c@{}}Affine\\ OFF\end{tabular} & 2.71 & 21.22 & 40.68 \\ \cline{2-6}
& \begin{tabular}[c]{@{}c@{}}Outliers\\ OFF\end{tabular} & \begin{tabular}[c]{@{}c@{}}Affine\\ ON\end{tabular} & 25.57 & 59.51 & 68.80 \\ \cline{2-6}
& \begin{tabular}[c]{@{}c@{}}Outliers\\ OFF\end{tabular} & \begin{tabular}[c]{@{}c@{}}Affine\\ OFF\end{tabular} & 25.57 & 59.51 & 68.80 \\ \hline
\end{tabular}
\end{table}
\textbf{Overall Performance Comparisons} - We first compare the use of TSC on vectorized data to MSC using TSC at each iteration (on data in matrix form). The average clustering errors for TSC given in \cite{tsc} are (without preprocessing) 12.42\%, 29.17\%, 39.84\% for 2,5, and 10 clusters respectively. The full set of data from varying the number of MSC trials can be seen in Table 2, but for 100 trials, the number at which the decrease in error begins to plateau, we obtain average clustering errors of 2.65\%, 14.43\%, and 36.82\% for 100 trials for 2, 5, and 10 clusters respectively on the same data. Lowering the number of trials we use to 50 and even 20, we still obtain better clustering errors using MSC for low numbers of clusters and comparable clustering errors for 10 clusters.
Because each face datum is so large, we cannot compare the SSC algorithm to MSC using SSC. Vectorizing the data yields points of dimension $192*168=32256$, which is far too large to use the SSC algorithm from \cite{ssc}, given the optimization problem of constructing a sparse representation for each point. This therefore is an immediate advantage for MSC, as SSC is impractical for any very large data. We do report clustering errors for MSC using SSC at each iteration, as can be seen in the previous subsection. The optimized results are, for 2, 5, and 10 clusters respectively, 2.31\%, 15.43\%, and 36.67\%, which are comparable to those obtained from MSC using TSC on the same data. The results from each algorithm are shown in Table \ref{YaleClusteringErrorsTable}.
\begin{table}
\centering
\caption{The clustering errors for each algorithm on the Yale Faces dataset using 2, 5, and 10 clusters}
\label{YaleClusteringErrorsTable}
\begin{tabular}{|c|c|c|c|c|}
\hline
\multicolumn{2}{|c|}{\multirow{2}{*}{\% Clustering Errors}} & \multicolumn{3}{c|}{Number of Clusters} \\ \cline{3-5}
\multicolumn{2}{|c|}{} & 2 & 5 & 10 \\ \hline
\multirow{4}{*}{Algorithm} & TSC & 12.42 & 29.17 & 39.84 \\ \cline{2-5}
& MSC using TSC & 2.65 & 14.43 & 36.82 \\ \cline{2-5}
& SSC & \multicolumn{3}{c|}{timed out} \\ \cline{2-5}
& MSC using SSC & 2.31 & 15.43 & 36.67 \\ \hline
\end{tabular}
\end{table}
\vspace{-3mm}
\subsection{Olivetti Face Database}
We look at results of the algorithms on the Olivetti Faces data, found at \cite{olivetti}. It includes $400$ images of size $64 \times 64$ pixels, $10$ each of $40$ different subjects. For each test, we perform and average results from $100$ runs, each of which chooses a random set of subjects and takes all $10$ images from each. The results are shown in Table \ref{OlivettiClusteringErrorsTable}.
\begin{table}
\centering
\caption{The clustering errors for each algorithm on the Olivetti Faces dataset using 2, 5, and 10 clusters}
\label{OlivettiClusteringErrorsTable}
\begin{tabular}{|c|c|c|c|c|}
\hline
\multicolumn{2}{|c|}{\multirow{2}{*}{\% Clustering Errors}} & \multicolumn{3}{c|}{\# Clusters} \\ \cline{3-5}
\multicolumn{2}{|c|}{} & 2 & 5 & 10 \\ \hline
\multirow{4}{*}{Algorithm} & TSC & 7.70 & 23.78 & 25.01 \\ \cline{2-5}
& MSC using TSC & 4.40 & 14.04 & 20.79 \\ \cline{2-5}
& SSC & 2.90 & 9.72 & 18.10 \\ \cline{2-5}
& MSC using SSC & 2.30 & 10.70 & 16.28 \\ \hline
\end{tabular}
\end{table}
\vspace{-2mm}
\section{Conclusions and Future work}
In this paper we presented a new model, namely the UOMS model and presented an algorithm unsupervised clustering under this model. We showed that the resulting algorithm is competitive with existing methods while being computationally more efficient. For future work, we will investigate how to deal with the outliers when we are drawing rows and columns from the data and not the entire data itself. Another important avenue is to develop a systematic method with provable guarantees for combining various graph realizations. As is well known, subspace clustering performance depends on the distribution of the data. Therefore, if the relative importance of different instances can be characterized one may perform a weighted graph combination. We will also extend this method for automatic clustering of 3-D data sets such as action videos.
\newpage
\bibliographystyle{IEEEbib.bst}
| {'timestamp': '2015-12-22T02:24:59', 'yymm': '1512', 'arxiv_id': '1512.06730', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06730'} | arxiv |
\section{Discussion}
We have introduced an algorithm that explicitly models {\it reporting bias} --- the discrepancy between what exists and what people mention --- for image labeling. By introducing a latent variable to capture ``what is in an image'' separate from ``what is labeled in an image'', we leverage {\it human-centric} annotations of images to their full potential, inferring visual concepts present in an image separately from the visual concepts worth mentioning. We demonstrate performance improvements over previous work on several tasks, including image classification and image captioning. Further, the proposed model is highly interpretable, capturing which concepts may be included or excluded based on the context and dependencies across visual concepts. Initial inspection of the model's predictions suggests consistency with psycholinguistic research on object description, with typical properties noticed but not mentioned.
The algorithm and techniques discussed here pave the way for new deep learning methods that decouple human performance from algorithmic understanding, modeling both jointly in a network that can be trained end-to-end. Future work may explore different methods to incorporate constraints on the latent variables, or to estimate their posteriors (such as with EM). Finally, to fully exploit the enormous amounts of data which exist ``in the wild'', algorithms that explicitly handle noisy data are essential.
{\small
\par \noindent \textbf{Acknowledgments:}
We thank Jacob Devlin, Lucy Vanderwende, Frank Ferraro, Sean Bell, Abhinav Shrivastava, and Saurabh Gupta for helpful discussions. Devi Parikh and Dhruv Batra for their suggestions and organizing the fun `snack times'.
}
\section{Experiments}
\label{sec:experiments}
\vspace{-0.08in}
\begin{figure}
\centering
\includegraphics[width=0.45\textwidth]{SML.pdf}
\vspace{-0.08in}
\caption{We use the MS COCO dataset to display the objects with the highest reporting bias. We use the detection labels for objects and see whether they are mentioned in the caption. The black line shows the probability of an object not being mentioned in the caption. The distribution of sizes for objects that are missed are shown by the color bars. Note that for many categories most unreported objects are small or medium in size (green and blue).}
\vspace{-0.08in}
\label{fig:annot-mismatch}
\end{figure}
We evaluate our proposed model on two datasets: Microsoft COCO~\cite{COCO} and a random subset of the Yahoo Flickr Creative Commons 100M (YFCC100M) dataset~\cite{yfcc100m}.
The YFCC100M dataset includes user-generated image tags, which we take as our source of human-centric annotations.
For MS COCO, we take the supplied image captions~\cite{COCOCaption} as human-centric annotations.
We use the MS COCO object detection labels for dataset analysis and algorithm evaluation.
These labels allow us to verify the accuracy of trained visual presence classifiers, $v^w$; these labels are never used for training our model.
\subsection{Experiments on MS COCO 1k visual concepts}
Our first set of experiments use the MS COCO 1000 visual concepts from \cite{mil-cvpr-15}.
The visual concepts are the 1000 most common words in the MS COCO captions dataset~\cite{COCOCaption} and include nouns, verbs, adjectives, and other parts of speech (see Table \ref{tbl:caption-gt-ap} for a breakdown).
For training, we generate image labels as 1000-dimensional binary vectors indicating which of the 1000 target visual concepts are present in the any of the 5 reference captions for each training image.
The training set includes approximately 80k images.
For evaluation, we follow~\cite{mil-cvpr-15} and split the val set into equally sized val and test sets of $\sim$20k images each; we use the same splits as in~\cite{mil-cvpr-15}. We report results on this 20k image test set.
\subsubsection{Human reporting bias in image descriptions}
We first analyze the annotation mismatch between the caption labels and the detection labels. We obtain labels for the 73 objects common in both the caption and object detection labels (see Section~\ref{sec:visual-predictions} for details). We use the notation from Section~\ref{sec:factor-decoupling}, and measure the human reporting bias as $r^{\star}_{01}$: the probability of an object not being mentioned in the caption ground truth ($y=0$) and being present in the detection ground truth ($z=1$), over all the training images. To account for object size as a factor in an object not being mentioned, we split these measurements based on the size of the bounding box (sizes as defined in~\cite{COCO}). Figure~\ref{fig:annot-mismatch} shows this mismatch for the top 20 objects with the highest $r^{\star}_{01}$ for values. A high $r^{\star}_{01}$ value indicates that there is a large mismatch between the caption ground truth and the detection ground truth -- objects that are visually present but not mentioned in the captions.
As observed, there is a high degree of human labeling noise in the image descriptions, with the object with highest reporting bias mentioned roughly half as much as it appears.
\subsubsection{Evaluating human-centric label prediction}
\label{sec:coco-caption}
We can evaluate our model in two ways: as a purely visual classifier ($v$) or as a predictor of human-centric ($h$) labels. We start with the latter and evaluate our model's predictions against the human-centric MS COCO captions.
As a strong baseline, we use the recently proposed MILVC~\cite{mil-cvpr-15} approach. This method applies a ConvNet (VGG16~\cite{VGG} or AlexNet \cite{alexnet})\footnote{Unless otherwise specified, we use VGG16 for all our experiments.} in a fully-convolutional way to a large input image to generate a $12 \times 12$ grid of human-centric label predictions. It then uses a noisy-OR \cite{Viola06multipleinstance} to compute a single prediction from the 144 intermediate values. During training, the noisy-OR induces a form of multiple instance learning (MIL). Note that the baseline model estimates $h$ labels directly without our decomposition into relevance and visual presence factors. As a second baseline (Classif.), we use a vanilla classification model akin to Figure~\ref{fig:simple-classification}, in which an ImageNet~\cite{ILSVRC15} pre-trained ConvNet is fine-tuned to directly predict human-centric labels.
We also include an additional baseline variant that adds extra parameters to control for the fact that our proposed model requires adding extra parameters. Specifically, we train a ``Multiple-\texttt{fc8}'' model for each method (MILVC and Classif.)~that has the same number of parameters as our model. To train Multiple-\texttt{fc8}, we add four extra randomly initialized \texttt{fc8} (linear classification) layers, each with their own loss. At test time, we average the predictions of all the \texttt{fc8} layers to get the final prediction.
We implement two variants of our model to parallel the MILVC and Classif.~baselines.
In the first variant (MILVC + Latent), $v$ uses a noisy-OR over a $12 \times 12$ grid of visual presence predictions, and for $r$ we average pool the $144$ \texttt{fc7} activation vectors to obtain a single 4096 dimensional $\phi(\mathcal{I})$ for Equation~\ref{eqn:noise-linear}.
The second variant (Classif.~+ Latent) generates a $1 \times 1$ output for $v$ and \texttt{fc7}, and therefore omits the noisy-OR and average pooling.
In both cases, $h$ predictions are obtained following Equation~\ref{eqn:decouple}, using both $r$ and $v$.
Like the baselines, our model is trained to minimize the log loss (cross-entropy loss) over $h$.
To train our model, we set the joint noise distribution $\tilde{r}$ to identity (\ie, $\tilde{r}_{11} = \tilde{r}_{00} = 0.5$) for the first two epochs and then update it for the last two epochs. Table~\ref{tbl:caption-gt-ap} shows mean average precision (mAP)~\cite{PASCAL} and precision at human recall (PHR)~\cite{COCOCaption} on the 20k test set. PHR is a metric proposed in~\cite{COCOCaption}, and measures precision based on human agreement. Briefly, this metric uses multiple references per image to compute a ``human recall'' value, an estimate of the probability that a human will use a particular word for an image. Precision is then computed at this ``human recall'' value to get PHR.~\cite{COCOCaption} shows that for the task of predicting visual concepts, PHR is a more stable metric than an AP metric, since it accounts for human agreement.
We report results for the 1000 visual concepts in aggregate, as well as grouped by their part-of-speech (POS) tags, on the MS COCO test split of 20k images (Table~\ref{tbl:caption-gt-ap}). Our latent variable model improves classification performance over all the baseline networks and architectures by \textbf{3 to 4 points} for both metrics (mAP and PHR). Interestingly, the Multiple-\texttt{fc8} model, which has the same number of parameters as our latent model, does not show an improvement, even after extensive tuning of learning hyperparameters.
This finding makes the contribution of the proposed model evident; the improvement is not simply due to adding extra parameters.
It is worth noting that in Table \ref{tbl:caption-gt-ap}, $h$ is a better predictor of MS COCO caption labels than $v$, as $h$ directly models the human-centric labels used for evaluation.
\subsubsection{Evaluating visual presence prediction}
\label{sec:visual-predictions}
The decoupling of visual presence ($v$) predictions and human-centric ($h$) label predictions allows our model to learn better visual predictors. To demonstrate this, we use the fully-labeled ground truth from the COCO detection annotations to evaluate the visually grounded $v$ label predictions.
Since the 1000 visual concepts include many fine-grained visual categories (\eg, {\prop man}, {\prop woman}, {\prop child}) and synonyms (\eg, {\prop bike}, {\prop bicycle}),
we manually specify a mapping from the visual concepts to the 80 MS COCO detection categories, \eg, $\{${\prop bike}, {\prop bicycle}$\}$ $\rightarrow$ {\prop bicycle}. We find that 73 of the 80 detection categories are present in the 1000 visual concepts. We use this mapping only at evaluation time to compute the probability of a detection category as the maximum of the probabilities of its fine-grained/synonymous categories.
Table~\ref{tbl:coco-detection-results} shows the mean average precision (mAP) of our method, as well as the baseline on these 73 categories.
As expected, using the human-centric model ($h$) for this task of visual prediction hurts performance (slightly).
The performance drop is less dramatic when evaluating on these 73 classes because these classes have less label noise for large sized objects as compared to the 1000 visual concepts.
We also train a noise-free reference model using the ground-truth visual labels from the detection dataset (\ie, the true values of the latent $z$ labels).
\begin{table}[!t]
\centering
\setlength{\tabcolsep}{0.42em}
\vspace{-0.08in}
\caption{Visual classification on 73 classes evaluated using fully labeled data from COCO.}
\vspace{-0.08in}
\label{tbl:coco-detection-results}
\begin{tabular}[b]{@{}ccccc@{}}
\toprule
& MILVC~\cite{mil-cvpr-15} & $v$ & $h$ & Using ground truth\\
\midrule
mAP & 63.7 & \textbf{66.8} & 66.5 & 76.3\\
\bottomrule
\end{tabular}
\end{table}
\subsubsection{Importance of conditioning on input images}
A central point of this paper (and also in \cite{berg2012understanding}) is that human-centric label noise is statistically dependent on image data.
Here we demonstrate that our model is indeed improved by conditioning the noise (relevance) distribution on the input image, in contrast to previous work~\cite{natrajan-noisy-labels,noisy-labels} that estimates noise parameters \emph{without} conditioning on the image.
To better understand the importance of this conditioning, we consider a model akin to~\cite{noisy-labels}. We estimate the latent distribution $r$ without conditioning on the input image, and compare it to our model that computes $r$ conditioned on the image. Table~\ref{tbl:no-image} shows that mAP is significantly improved by conditioning on the image. When not conditioned on the image, only minor gains are achieved.
\begin{table}[!t]
\centering
\setlength{\tabcolsep}{0.42em}
\vspace{-0.08in}
\caption{We show the importance of conditioning the relevance $r$ on the input image. We measure the classification mAP on MS COCO 1k visual concepts using both the visually grounded ($v$) and the human-centric ($h$) predictions. Conditioning on the input image shows improvement over the baseline showing that human reporting bias statistically depends on the input image.}
\vspace{-0.08in}
\label{tbl:no-image}
\begin{tabular}[b]{@{}ccccccc@{}}
\toprule
& & \multicolumn{2}{c}{w/o image} & & \multicolumn{2}{c}{w/ image} \\
\cmidrule{3-4}\cmidrule{6-7}
& MILVC~\cite{mil-cvpr-15}& $v$ & $h$ & & $v$ & $h$ \\
\midrule
mAP & 34.0 & 34.2 & 34.3 & & 35.1 & \textbf{36.3} \\
\bottomrule
\end{tabular}
\vspace{-0.08in}
\end{table}
\begin{figure*}[!t]
\centering
\includegraphics[width=0.98\linewidth]{results_vocab3.pdf}
\vspace{-0.11in}
\caption{Our model modifies visually correct detections to conform to human labeling. We show this modification for a few images of target visual concepts in the MS COCO Captions dataset. We first show the variation between $h$ (y axis) and $v$ values (x axis) for each concept in a 2D histogram. After thresholding at $v \geq 0.8$, we pick a representative image from each quantile of $h$ ($h$ increases from left to right).
As you move from left to right, the model transitions from predicting that a human would not ``speak'' the word to predicting that a human would speak it.
The human-centric $h$ predictions of concepts depend on the image context, \eg, {\prop fence} at a soccer game vs. {\prop fence} between a bear and a human (first row). Our model picks up such signals to not only learn a visually correct {\prop fence} predictor, but also when a {\prop fence} should be mentioned.}
\vspace{-0.13in}
\label{fig:results-vocab}
\end{figure*}
\begin{figure*}[!t]
\centering
\includegraphics[width=0.98\linewidth]{resultsVsBaseline.pdf}
\vspace{-0.11in}
\caption{Our model learns clean visual predictors from noisy labels.
Here we show corrected false positives: MILVC incorrectly reports a high probability ($h \ge 0.75$) for the concept, while our model correctly reports a low probability ($v \le 0.3$); and corrected false negatives: MILVC incorrectly reports a low probability ($h \le 0.3$) for the concept, while our model correctly reports a high probability ($v \ge 0.75)$. For example, consider \texttt{zebra} vs. \texttt{zebras}, and \texttt{banana} vs. \texttt{bananas} in the last row, where our model correctly ``counts'' compared to the baseline.
Images are from the MS COCO Captions dataset.}
\vspace{-0.13in}
\label{fig:results-correction}
\end{figure*}
\begin{table}[!b]
\centering
\vspace{-0.08in}
\caption{mAP values on a subset of YFCC100M. We add our latent model over the MILVC baseline to make predictions that are visually grounded ($v$) or that conform to human-centric ($h$) labels. POS tags: Nouns (NN), Verbs (VB), Adjectives (JJ), Pronouns (PRP), Prepositions (IN).}
\vspace{-0.08in}
\label{tbl:flickr-tag}
\resizebox{\linewidth}{!}{
\setlength{\tabcolsep}{0.3em}
\small
\begin{tabular}[b]{@{}cccccccccc@{}}
\toprule
& & \multicolumn{7}{c}{\hspace{0.55in}Mean Average Precision} \\
\cmidrule{4-10}
&& & NN & VB & JJ & PRP & IN & Others & All \\
& \scriptsize{Count $\rightarrow$} & Prob & 791 & 10 & 148 & 13 & 23 & 15 & 1000\\
\midrule
\multirow{4}{*}{\rot[90]{VGG16}} & MILVC~\cite{mil-cvpr-15} & - & 5.7 & 9.2 & 5.2 & 3.8 & 8.8 & 6.1 & 5.7 \\
& MILVC + Multiple-\texttt{fc8} & - & 4.6 & 6.2 & 3.8 & 2.7 & 7.3 & 3.1 & 4.5 \\
& MILVC + Latent (Ours) & $v$ & 9.8 & 15.1 & 8.9 & 8.3 & 12.4 & 12.4 & 9.8 \\
& MILVC + Latent (Ours) & $h$ & 11.2 & 15.4 & 9.9 & 8.2 & 16.3 & 12.5 & \textbf{11.2} \\
\bottomrule
\end{tabular}
}
\end{table}
\subsection{Experiments on Flickr image tagging}
Datasets like MS COCO are curated by searching for images with specific objects~\cite{COCO}.
In contrast, social media websites like Flickr contain much larger collections of images that are annotated with user-generated content such as tags, keywords, and descriptions.
The words found in such data exhibit the human-centric annotation properties modeled by our approach.
We test our model on this ``real world'' data by using a random subset of $\sim$89k images from the YFCC100M dataset~\cite{yfcc100m}.
We ensure that these images have at least 5 and at most 30 human annotated tags that are present in the WordNet~\cite{wordnet} lexicon. We split this dataset into 75k training images and 14k test images, and consider the top 1000 tags as the set of visual concepts. We train the baseline MILVC~\cite{mil-cvpr-15} model and our model for 4 epochs following the same hyperparameters used for MS COCO training.
Table~\ref{tbl:flickr-tag} shows the numerical results of these models evaluated on the test set using the same human annotated tags. As explained in Section~\ref{sec:coco-caption}, we compare against the MILVC baseline, and a model with the same number of parameters as ours (denoted by Multiple-\texttt{fc8}). Our model has double the performance of the baseline MILVC model and \textbf{increases mAP by 5.5 points}.
\begin{table}[!b]
\centering
\caption{LSTM captioning results on MS COCO}
\vspace{-0.08in}
\label{tbl:captioning}
\footnotesize{
\begin{tabular}[b]{@{}ccccc@{}}
\toprule
& Prob & BLEU-4 & ROUGE & CIDEr \\
\midrule
MILVC~\cite{mil-cvpr-15} & - & 27.7 & 51.8 & 89.7\\
MILVC + Latent (Ours) & $h$ & \textbf{29.2} & \textbf{52.4} & \textbf{92.8} \\
\bottomrule
\end{tabular}
}
\end{table}
\subsection{Interpretability of the noise model}
\vspace{-0.08in}
The relevance classifier $r$ models human labeling noise conditioned on the image.
Depending on the image, it can enhance or suppress the visual prediction for each concept.
We show such modifications for a few visual concepts in Figure~\ref{fig:results-vocab}.
After thresholding at $v \geq 0.8$, we pick a representative image from each quantile of $h$ ($h$ increases from left to right).
The variation in $h$ values for these high confidence $v \geq 0.8$ images (shown in a 2D histogram in each row) indicates that $h$ and $v$ have been decoupled by our model.
The images show that our model captures subtle nuances in the ground truth, \eg, mention a hat worn by a cat, do not mention the color of a pumpkin, definitely mention pink sheep, \etc.
It automatically captures that context is important for certain objects like {\prop fence} and {\prop hat}, while certain attributes are worth mentioning to help distinguish objects like the {\prop orange} pillow.
Such connections have been shown in both vision research~\cite{berg2012understanding} and psychology~\cite{sedivy2003pragmatic, gregory1966}.
\subsection{Correcting error modes by decoupling}
Modeling latent noise in human-centric annotations allows us to learn clean visual classifiers. In Figure~\ref{fig:results-correction}, we compare our model's visual presence $v$ predictions with the baseline (MILVC) and show a few error modes that it corrects. Our model is able to correct error modes like misspellings ({\prop desert} vs.~{\prop dessert} in the first row), localizes objects correctly and out of context ({\prop fridge} in the second row, {\prop net} in the first row, \etc) and is better at counting ({\prop zebra}, {\prop banana} last row).
\subsection{Using word detections for caption generation}
\vspace{-0.08in}
We now look at the task of automatic image caption generation and show how our model can help improve the task. We consider a basic Long Short-Term Memory (LSTM)~\cite{lstm} network to generate captions. We use 1000 cells for the LSTM, and learn a 256 dimensional word embedding for the input words. Following~\cite{lrcn}, our vocabulary consists of words with frequency $\geq 5$ in the input captions. The image features (1000 visual concept probabilities) are fed once to the LSTM as its first hidden input. We train this LSTM over all the captions in the MS COCO caption training data for 20 epochs using~\cite{nlpcaffe,caffe}. We use beam size of 1 for decoding. Table~\ref{tbl:captioning} shows the evaluation of the automatically generated captions using standard captioning metrics. Using the probabilities from our model shows an improvement for all evaluation metrics. Thus, modeling the human-reporting bias can help downstream applications that require such human-centric predictions.
\section{Introduction}
\begin{figure}[!t]
\centering
\includegraphics[width=0.48\textwidth]{teaser_v3.pdf}
\vspace{-0.05in}
\caption{Human descriptions capture only some of the visual concepts present in an image. For instance, the bicycle in (a) is described, while the bicycle in (b) is not mentioned. The Vespa in (c) is described as ``yellow'', while the bananas in (d) are not, as being yellow is typical for bananas.}
\vspace{-0.1in}
\label{fig:teaser}
\end{figure}
Visual concept recognition is a fundamental computer vision task with a broad range of applications in science, medicine, and industry.
Supervised learning of visual concept classifiers has been highly successful partly due to the use of large-scale, high-quality datasets (\eg, \cite{PASCAL,COCO,ImageNet}).
Depending on the complexity of the supported task, these datasets generally include annotations for 100s to 1000s of `typical' concepts.
To support an even broader range of applications, it is necessary to train classifiers for tens or even hundreds of thousands of visual concepts that may not be typical.
Since supervised learning methods require exhaustive and clean annotations, one would require high quality datasets with orders of magnitude more annotations to train such methods. However, creating such datasets is expensive.
An alternative approach is to relax this requirement of pristinely labeled data. The learning algorithm can be enabled to use readily-available sources of annotated data, such as user-generated image tags or captions from social media services like Flickr or Instagram. Such datasets easily scale to hundreds of millions of photos with hundreds of thousands of distinct tags \cite{yfcc100m}.
Images annotated with human-written tags \cite{yfcc100m} or captions \cite{COCOCaption} focus on the most important or salient information in an image, as judged implicitly by the annotator. These annotations lack information on minor objects or information that may be deemed unimportant, a phenomenon known as \emph{reporting bias} \cite{gordon2013reportingBias}.
For example, Figure \ref{fig:teaser} illustrates two concepts ({\prop bicycle}, {\prop yellow}) that are each present in two images, but only mentioned in one.
The bicycle may be considered irrelevant to the overall image in (b); and the bananas in (d) are not described as yellow because humans often omit an object's typical properties when referring to it \cite{MitchellEtAl13,WesterbeekEtAl15}.
Following \cite{berg2012understanding}, we refer to this type of labeling as \emph{human-centric annotation}.
Training directly on human-centric annotations does not yield a credible visual concept classifier.
Instead, it leads to a classifier that attempts to \emph{mimic} the reporting bias of the annotators.
To separate reporting bias from visual ground truth, we propose to train a model that explicitly factors human-centric label prediction into a \emph{visual presence} classifier (\ie, ``Is this concept visually present in this image?'') and a \emph{relevance} classifier (\ie, ``Is this concept worth mentioning in this image, given its visual presence?''). We train all these classifiers jointly and end-to-end as multiple ``heads'' branching from the same shared convolutional neural network (ConvNet) trunk \cite{lecun1989backpropagation,VGG}.
We demonstrate improved performance on several tasks and datasets. Our experiments on the MS COCO Captions dataset \cite{COCOCaption} show an improvement in mean average precision (mAP) for the learned visual classifiers when evaluated on both fully labeled data (using annotations from the MS COCO detection benchmark~\cite{COCO}) and on the human generated caption data. We also show that using such visual predictions improves image caption generation quality. Our results on the Yahoo Flickr 100M dataset~\cite{yfcc100m} demonstrate the ability of our model to learn from ``in the wild'' data (noisy Flickr tags) and \textbf{double the performance} of the baseline classification model. Apart from just numerical improvements, our results are interpretable and consistent with research in psychology showing that humans tend not to mention typical attributes \cite{MitchellEtAl13,WesterbeekEtAl15} unless required for unique identification~\cite{sedivy2003pragmatic} or distinguishability~\cite{olson1970language,tenenbaum1973locating}.
\section{Introduction}
\input{intro}
\input{relatedWork}
\input{ourAlgorithm}
\input{experiments}
\input{discussion}
{\small
\bibliographystyle{ieee}
\section{Our Approach}\label{sec:approach}
Our goal is to train visually grounded image classifiers for a set of visual concepts $w \in \mathcal{W}$ (\eg, \texttt{banana}, \texttt{yellow}, \texttt{zebra}) using images and their human-centric annotations.
The conventional approach to this problem, shown in Figure~\ref{fig:simple-classification}, is to naively apply a supervised learning algorithm:
train a classifier $h^w$ for each concept $w$, to predict its human-centric label $y^w \in \{0,1\}$ (not mentioned \vs mentioned) as a conditional probability distribution $h^w(y^w | \mathcal{I})$, in which $\mathcal{I}$ is an image.
The resulting classifier would attempt to mimic human reporting bias by predicting how a human would label the image $\mathcal{I}$ regardless of whether $w$ is visually present or absent. Thus, the predictions from each classifier $h^w$ will not be visually grounded and do not meet our goal. How can we build classifiers that predict whether a visual concept $w$ is present in an image and ``see through'' the noise in human-centric annotations?
\subsection{Factor decoupling}
\label{sec:factor-decoupling}
We propose to structure each concept output $h^w (y^w|\mathcal{I})$ in terms of two classifiers $v^w$ and $r^w$.
The first classifier $v^w$ models the conditional probability of the \emph{visual presence} of the concept $w$ in the image.
The second classifier $r^w$ models the conditional probability of the \emph{relevance} of the concept $w$, conditioned on the image and whether or not $w$ is estimated to be visually present.
The human-centric predictor is formed by marginalizing over the concept's visual presence, as described next.
Let $z^w \in \{0,1\}$ be a latent (or hidden) variable indicating whether the concept $w$ is visually present in an image.
Note that the training data only supplies human-centric labels $y^w$; the true values of $z^w$ are unknown during training.
For instance, in Figure~\ref{fig:teaser}{\color{red}(a)}, $y^w=1$ and $z^w=1$ when the bicycle is present and mentioned, while $y^w=0$ and $z^w=1$ in Figure~\ref{fig:teaser}{\color{red}(b)} when the bicycle is present but not mentioned.
We refer to $z^w$ as the \emph{visual presence label}.
The conditional probability of the human-centric label given an image $\mathcal{I}$, $h^w(y^w | \mathcal{I})$, can now be computed by marginalizing over the latent visual presence label $z^w$:
\begin{equation}
\label{eqn:decouple}
\hspace{-0.2em}h^w(y^w | \mathcal{I}) = \sum_{j \in \{ 0, 1 \}} r^w(y^w | z^w = j, \mathcal{I}) v^w(z^w = j| \mathcal{I}).
\end{equation}
An illustration of our model is shown in Figure~\ref{fig:alg-idea}. One important property of this formulation is that it allows the model to assign high confidence to unlabeled visual concepts: for an unmentioned concept ($y^w = 0$ and $z^w = 1$), the relevance classifier $r^w$ allows the visual presence classifier $v^w$ to assign a high probability to the true visual label ($z^w=1$) while still making a prediction that matches the human-centric label ($y^w=0$).
This property enables the model to ``see through'' human reporting bias.
To simplify notation, we drop the concept index $w$ from $y, z, h, v$ and $r$ when possible.
We denote the probability values of $r$ by:
\begin{align}
\label{eqn:noise-not-condition-image}
r_{ij} &= r(y=i|z=j, \mathcal{I}), ~~ \forall (i,j) \in \{0,1\}^2.
\end{align}
Another important property of the factorization in Equation \eqref{eqn:decouple} is that it provides a way to get two different predictions for the concept $w$ in the same image. The model can predict the visual presence of a visual concept; or predict how a human would annotate the image. Depending on the task at hand, one of these predictions may be more appropriate than the other, a point we demonstrate later via experimental results.
\subsection{Model learning and parameterization}
\label{sec:factor-decoupling-impl}
We estimate the model parameters by minimizing the regularized log loss
of $h^w$, summed over all concepts $w$, on the training data annotated with human-centric labels.
Since our model includes latent variables $z$ for each concept and image, one approach could be to use Expectation Maximization (EM) \cite{em}.
We choose a direct optimization approach~\cite{chapelle2014modeling} over EM for simplicity, and thus both the model parameters and latent variable posteriors are updated and inferred online. In each SGD minibatch, the model predicts the conditional distributions $r$ and $v$, marginalizes over the values of $z$, and uses the log loss of $h$ to drive better estimates of $r$ and $v$.
The conditional distributions $r$ and $v$ are modeled with a ConvNet~\cite{fukushima1980neocognitron,rumelhart1985learning, lecun1989backpropagation}.
As illustrated in Figure~\ref{fig:alg-idea}, the ConvNet trunk is shared between the two distributions (per concept) and then branches near the output into two sets of untied parameters.
We jointly train one network for all visual concepts $w \in \mathcal{W}$ by treating learning as a multi-label classification problem.
Further network architecture details are given in Section \ref{sec:experiments} with experiments.
The conditional probability distribution $r$ models transition probabilities and thus its underlying joint distribution $\tilde{r}_{ij} = \tilde{r}(y = i, z = j | \mathcal{I})$ must be a valid probability distribution.
To enforce this constraint, we directly estimate the joint distribution $\tilde{r}$ with a softmax operation on a vector of unnormalized scores.
For each concept $w$, we first compute four scores $s_{ij}$ using four linear models parameterized by weights $m_{ij}$ and biases $b_{ij}$, and then normalize them using the softmax function to get a valid joint distribution $\tilde{r}_{ij}$:
\begin{align}
s_{ij} &= m_{ij}^{T}\phi(\mathcal{I}) + b_{ij}, \label{eqn:noise-linear} \\
\tilde{r}_{ij} &= \exp({s_{ij})} / \sum_{i'j'} \exp({s_{i'j'})}.
\end{align}
For $\phi(\mathcal{I})$, we use global image features computed by the shared ConvNet trunk (\eg, \texttt{fc7} layer activations from VGG16~\cite{VGG}).
These features capture the global image context, which is helpful in estimating $r$.
Each $r_{ij}$ can then be computed from $\tilde{r}$ by dividing by the marginal $\tilde{r}(z = j | \mathcal{I})$:
\begin{align}
r_{ij} &= \tilde{r}_{ij} / \sum_{i'}\tilde{r}_{i'j}.
\end{align}
Figure~\ref{fig:alg-idea} illustrates our process of computing $r_{ij}$ from the image.
Since our operations for estimating $\tilde{r}$ (and thus $r$) are differentiable, we can backpropagate their errors to the ConvNet, allowing the full model to be trained end-to-end.
\section{Related work}
\begin{figure}[!t]
\centering
\includegraphics[width=0.45\textwidth]{baselineModel.pdf}
\vspace{-0.08in}
\caption{A simple classification model for learning from human-centric annotations. The noisy labels (\texttt{banana} is not annotated as \texttt{yellow}) impede the learning process.}
\vspace{-0.1in}
\label{fig:simple-classification}
\end{figure}
\begin{figure*}[!t]
\includegraphics[width=1.0\textwidth]{nArch_v3}
\vspace{-0.08in}
\caption{Our model uses noisy human-centric annotations $y$ for learning visually grounded classifiers without access to the visually correct ground truth $z$. It uses two classifiers: a visual presence classifier $v$ and a relevance classifier $r$. The visual presence classifier $v$ predicts whether the visual concept $w$ is visually present in an image. The relevance classifier $r$ models the noise and predicts whether the concept should be mentioned or not. We combine these predictions to get the human-centric prediction $h$.}
\vspace{-0.08in}
\label{fig:alg-idea}
\end{figure*}
Label noise is ubiquitous in real world data. It can impact the training process of models and decrease their predictive accuracy~\cite{nettleton2010study,joulin2015learning,barnard2001learning}. Since there are vast amounts of cheaply available noisy data, learning good predictors despite the label noise is of great practical value.
The taxonomy of label noise presented in~\cite{frenay2014classification} differentiates between two broad categories of noise: \emph{noise at random} and \emph{statistically dependent noise}. The former does not depend on the data, while the latter does. In practice, one may encounter a combination of both types of noise.
Human-centric annotations~\cite{berg2012understanding} exhibit noise that is highly structured and shows statistical dependencies on the data~\cite{frenay2014classification,berg2012understanding,gazedescription}. It is structured in the sense that certain labels are preferentially omitted as opposed to others. Vision researchers have studied human-centric annotations in various settings, such as missing objects in image descriptions~\cite{berg2012understanding}, scenes~\cite{standsout}, and attributes~\cite{attributepops} and show that these annotations are noisy~\cite{berg2012understanding}.
Much of the work on learning from noisy labels focuses on robust algorithms~\cite{manwani2013noise, deeptagging}, voting methods~\cite{beigman2009learning}, or statistical queries~\cite{valiantnoise}. Some of these methods~\cite{deeptagging,valiantnoise} require access to clean oracle labels, which may not be readily available.
Explicitly modeling label noise has received increasing attention in recent years~\cite{noisy-labels, natrajan-noisy-labels, xiao2015learning, mnih2012learning}. Many of these methods operate under the ``noise at random'' assumption and treat noise as conditionally independent of the image. \cite{larsen1998design} models symmetric label noise (independent of the true label), which is a strong assumption for real world data. \cite{natrajan-noisy-labels,noisy-labels} both model asymmetric label noise that is conditionally independent of the image. Such an assumption ignores the input image (and the objects therein) which directly affects the noisy annotations produced by humans~\cite{berg2012understanding}.
Recently, Xiao \etal~\cite{xiao2015learning} introduced an image conditional noise model that attempts to predict what type of noise corrupts each training sample (no noise, noise at random, and structured label swapping noise).
Unlike~\cite{xiao2015learning}, our training algorithm does not require a small amount of cleanly labeled training data to bootstrap parameter estimation. Our model is also specifically designed to handle the noise found in human-centric annotations.
Bootstrapping~\cite{reed2014training}, semi-supervised learning (SSL)~\cite{zhu2010semi,shrivastava2012constrained} and Positive Unlabeled (PU) learning~\cite{li2003learning,liu2003building,elkan2008learning,MisraSSL} are other ways of learning from noisy labeled data. However, they require access to clean oracle labels. SSL approaches are often computationally impractical~\cite{zhou2004learning,zhu2003semi} or make strong independence assumptions~\cite{fergus-ssl} that do not hold in human-centric annotations. Our approach, which trains directly on noisy labels, can serve as a starting point for these approaches.
The work described here is also consistent with research in psycholinguistics on object reference and description. Such work demonstrates that humans store typical or ``prototypical'' representations of objects and their properties~\cite{rosch1999principles}; and this background knowledge appears to have an effect on object description~\cite{MitchellEtAl13,WesterbeekEtAl15}. People tend not to mention attributes that are obvious or typical for an object, preferring to name attributes required for conversational relevance~\cite{Kronfeld89}, unique identification against alternatives~\cite{sedivy2003pragmatic,vanDerSluisEtAl06} and distinguishability~\cite{gregory1966,KoolenEtAl11}. A similar separation between {\it what is observed} and {\it what is mentioned} falls out naturally from our proposed model.
| {'timestamp': '2016-04-13T02:15:25', 'yymm': '1512', 'arxiv_id': '1512.06974', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06974'} | arxiv |
\section{Keeping queries linear in Algorithm~\ref*{algo:simplex}}
\label{app:keeplinear}
In Algorithm~\ref{algo:simplex}, we want to ensure that the queries we make in step
\step{2} are linear and that the queries we will make in the recursion step
remain linear too.
\begin{lemma}
Algorithm~\ref{algo:simplex} can be implemented so that it uses $O(n\card{I})$ linear queries.
\end{lemma}%
\begin{proof}
Let us first analyze what the queries of step \step{2} look like. In addition
to the input point \(q\) we are given a vertex \(\nu\) and we want to find the
projection \(q'\) of \(q\) in direction \(\vec{\nu q}\) on the hyperplanes of
\(\I_{\theta}\). Let the equation of \(H_{i}\) be \(\Pi_{i}(x) =
c_{i} + d_{i}
\cdot x = 0\) where \(c_{i}\) is a scalar and \(d_{i}\) is a
vector.
The projection of \(q\) along \(\vec{\nu q}\) on a hyperplane \(H_i\) can thus
be written\footnote{Note that we project from \(\nu\) instead of \(q\). We are
allowed to do this since \(\nu + \lambda_{i} \vec{\nu q} = q + (\lambda_i - 1)
\vec{\nu q}\) and there is no hyperplane
separating \(q\) from \(\nu\).}
\(\rho(q,\nu,H_i) = \nu + \lambda_{i} \vec{\nu q}\) such that \(\Pi_{i}(\nu +
\lambda_{i} \vec{\nu q}) = c_{i} + d_{i} \cdot \nu +
\lambda_{i} d_{i} \cdot
\vec{\nu q} = 0\). Computing the closest hyperplane amounts to finding
\(\lambda_{\theta} = \min_{\lambda_i > 0} \lambda_i\). Since \(\lambda_i = -
\frac{c_i + d_i \cdot \nu}{d_i \cdot \vec{\nu q}}\) we can test whether
\(\lambda_i > 0\)
using the linear query\footnote{Note that if $c_i + d_i \cdot \nu = 0$ then
$\lambda_i=0$, we can check this beforehand for free.}
\(-\frac{d_i \cdot \vec{\nu q}}{c_i + d_i
\cdot \nu} \ask{>} 0\). Moreover, if \(\lambda_i > 0\) and \(\lambda_j > 0\)
we can test whether $\lambda_i < \lambda_j$ using the linear query \(
\frac{d_i \cdot \vec{\nu q}}{c_i + d_i \cdot \nu}
\ask{<}
\frac{d_j \cdot \vec{\nu q}}{c_j + d_j \cdot \nu}\).
Step \step{2} can thus be achieved using \(O(1)\) \((2k)\)-linear queries per
hyperplane of \(\net\).
In step \step{4}, the
recursive step is carried out on \(q' = \nu + \lambda_{\theta} \vec{\nu q} = \nu -
\frac{c_{\theta} + d_{\theta} \cdot \nu}{d_{\theta} \cdot \vec{\nu q}}
\vec{\nu q}\) hence comparing \(\lambda'_i\) to \(0\) amounts to performing the
query \(-\frac{d_i \cdot \vec{\nu q}'}{c_i + d_i \cdot \nu'}
\ask{>} 0\), which is not linear in \(q\). The same goes for comparing
\(\lambda'_i\) to \(\lambda'_j\) with the query
\(\frac{d_i \cdot \vec{\nu q}'}{c_i + d_i \cdot \nu'}
\ask{<}
\frac{d_j \cdot \vec{\nu q}'}{c_j + d_j \cdot \nu'}\).
However, we can multiply both sides of the inequality test by \(d_\theta
\vec{\nu q}\) to keep the queries linear as shown below. We must be careful to
take into account the sign of the expression \(d_\theta \vec{\nu q}\), this
costs us one additional linear query.
This trick can be used at each step of the recursion. Let \(q^{(0)} = q\),
then we have
$$
q^{(s+1)} = \nu^{(s)} - \frac{c_{\theta_{s}} + d_{\theta_{s}} \cdot
\nu^{(s)}}{d_{\theta_{s}} \cdot \vec{\nu q}^{(s)}}\vec{\nu q}^{(s)}
$$
and \( (d_{\theta_{s}}\cdot \vec{\nu q}^{(s)}) q^{(s+1)}\) yields a vector
whose components are linear in \(q^{(s)}\).
Hence,
\( (\prod_{k=0}^{s} d_{\theta_{k}} \cdot \vec{\nu q}^{(k)})
q^{(s+1)}\) yields a vector
whose components are linear in \(q\),
and for all pairs of vectors \(d_i\) and \(\nu^{(s+1)}\)
we have that \( (\prod_{k=0}^{s} d_{\theta_{k}} \cdot \vec{\nu q}^{(k)}) (d_i
\cdot \vec{\nu q}^{(s+1)})\) is linear in \(q\).
Hence at the $s$th recursive step of the algorithm, we will perform
at most \(\card{\net}\) linear queries of the type
$$
-\left(\prod_{k=0}^{s-1} d_{\theta_{k}} \cdot \vec{\nu q}^{(k)}\right)
\frac{d_i \cdot \vec{\nu q}^{(s)}}{c_i + d_i \cdot
\nu^{(s)}} \ask{>} 0
$$
\(\card{\net} - 1\) linear queries of the type
$$
\left(\prod_{k=0}^{s-1} d_{\theta_{k}} \cdot \vec{\nu q}^{(k)}\right)
\frac{d_i \cdot \vec{\nu q}^{(s)}}{c_i + d_i \cdot \nu^{(s)}}
\ask{<}
\left(\prod_{k=0}^{s-1} d_{\theta_{k}} \cdot \vec{\nu q}^{(k)}\right)
\frac{d_j \cdot \vec{\nu q}^{(s)}}{c_j + d_j \cdot \nu^{(s)}}
$$
and a single linear query of the type
$$
d_{\theta_{s-1}} \cdot \vec{\nu q}^{(s-1)} \ask{<} 0.
$$
In order to detect all hyperplanes \(H_i\) such that \(\lambda_i =
\lambda_\theta\) we can afford to compute the query $f(q) > g(q)$ for all query
$f(q) < g(q)$ that we issue, and vice versa.
Note that, without further analysis, the queries can become \(n\)-linear as
soon as we enter the \(\frac{n}{k}^{\text{th}}\) recursive step.
\end{proof}
\section{Algebraic computation trees}
\label{app:act}
We consider \emph{algebraic computation trees}, whose internal nodes
are labeled with arithmetic (\(r \gets o_1 \op o_2, \op \in
\{\,+,-,\times,\div\,\}\)) and branching (\(z : 0\)) operations. We say that an
algebraic computation tree $T$ \emph{realizes} an algorithm $A$ if the paths
from the root to the leaves of $T$ correspond to the execution paths of \(A\)
on all possible inputs \(q \in \mathbb{R}^n\), where \(n\) is fixed. A leaf is
labeled with the output of the corresponding execution path of \(A\). Such a
tree is \emph{well-defined} if any internal node labeled \(r \gets o_1 \op
o_2\) has outdegree \(1\) and is such that either \(o_k = q_i\) for some \(i\)
or there exists an ancestor \(o_k \gets x \op y\) of this node, and any
internal node labeled \(z : 0\) has outdegree \(3\) and is such that either \(z
= q_i\) for some \(i\) or there exists an ancestor \(z \gets x \op y\) of this
node. In the algebraic computation tree model, we define the complexity
\(f(n)\) of an algorithm $A$ to be the minimum depth of a well-defined
computation tree that realizes $A$ for inputs of size $n$.
In the algebraic computation tree model, we only count the operations that
involve the input, that is, members of the input or results of previous
operations involving the input. The following theorem follows immediately from
the analysis of the linearity of queries
\begin{theorem}\label{thm:act}
The algebraic computation tree complexity of \(k\)-LDT is
\(\tilde{O}(n^3)\).
\end{theorem}
\begin{proof}
We go through each step of Algorithm~\ref{algo:meiser}.
Indeed, each \(k\)-linear query of step \step{1} can be implemented as
\(O(k)\) arithmetic operations, so step \step{1} has complexity
\(O(\card{\net})\).
The construction of the simplex in step \step{2} must be handled carefully.
What we need to show is that each \(n\)-linear query we use can be implemented
using $O(k)$ arithmetic operations. It is not difficult to see from the
expressions given in~Appendix~\ref{app:keeplinear} that a constant number of arithmetic
operations and dot products suffice to
compute the queries. A dot product in this case involves a constant number
of arithmetic operations because the \(d_i\) are such that they each have
exactly \(k\) non-zero components. The only expression that involves a
non-constant number of operations is the product \(\prod_{k=0}^{s}
d_{\theta_{k}} \cdot \vec{\nu q}^{(k)}\), but this is equivalent to
\((\prod_{k=0}^{s-1}
d_{\theta_{k}} \cdot \vec{\nu q}^{(k)})(d_{\theta_{s}} \cdot
\vec{\nu q}^{(s)})\)
where the first factor has already been computed during a previous step and
the second factor is of constant complexity. Since each query costs a constant
number of arithmetic operations and branching operations, step \step{2}
has complexity \(O(n\card{\net})\).
Finally, steps \step{3} and \step{4} are free since they do not involve the
input. The complexity of Algorithm~\ref{algo:meiser} in this model is thus also \(O(n^3
\log^2 n \log \card{\H{}})\).
\end{proof}
\section{Uniform random sampling}
\label{app:sampling}
Theorem~\ref{thm:enet} requires us to pick a sample of the hyperplanes
uniformly at random. Actually the theorem is a little stronger; we can draw
each element of $\net$ uniformly at random, only keeping distinct elements.
This is not too difficult to achieve for $k$-LDT when the $\alpha_i,i\in[k]$
are all distinct: to pick a hyperplane of the form $\alpha_0 + \alpha_1 x_{i_1}
+ \alpha_2 x_{i_2} + \cdots + \alpha_k x_{i_k} = 0$ uniformly at random, we can
draw each $i_j\in[n]$ independently and there are $n^k$ possible outcomes.
However, in the case of $k$-SUM, we only have $\binom{n}{k}$ distinct
hyperplanes. A simple dynamic programming approach solves the problem for
\kSUM{}. For \kLDT{} we can use the same approach, once for each class of equal
$\alpha_i$.
\begin{lemma}
Given $n\in\N$ and $(\alpha_0,\alpha_1,\ldots,\alpha_k) \in \R^{k+1}$,
a uniform random sample $\net$ of hyperplanes in $\R^n$ with equations of
the form $\alpha_0 + \alpha_1 x_{i_1} + \alpha_2 x_{i_2} + \cdots +
\alpha_k x_{i_k} =
0$ can be computed in time $O(k\card{\net})$ and preprocessing time $O(kn)$.
\end{lemma}
\begin{proof}
We want to pick
an assignment
$a=\enum{(\alpha_1,x_{i_1}),(\alpha_2,x_{i_2}),\ldots,(\alpha_k,x_{i_k})}$
uniformly at random. Note that all $x_i$ are distinct while the $\alpha_j$
can be equal.
Without loss of generality, suppose $\alpha_1 \le \alpha_2 \le \cdots \le
\alpha_k$. There is a bijection between assignments and lexicographically
sorted $k$-tuples
$((\alpha_1,x_{i_1}),(\alpha_2,x_{i_2}),\ldots,(\alpha_k,x_{i_k}))$.
Observe that $x_{i_j}$ can be drawn independently of $x_{i_{j'}}$ whenever
$\alpha_j \neq \alpha_{j'}$. Hence, it suffices to generate a lexicographically sorted
$\card{\chi}$-tuple of $x_i$ for each class $\chi$ of equal $\alpha_i$.
Let $\omega(m,l)$ denote the number of lexicographically sorted $l$-tuples,
where each element comes from a set of $m$ distinct $x_i$.
We have
$$
\omega(m,l) = \begin{cases}
1 & \text{if}\ l = 0\\
\sum_{i=1}^{m}\omega(i,l-1) & \text{otherwise.}
\end{cases}
$$
To pick such a tuple $(x_{i_1},x_{i_2},\ldots,x_{i_l})$ uniformly at random
we choose $x_{i_l} = x_o$ with probability
$$
P(x_{i_l} = x_o) = \begin{cases}
0 & \text{if}\ o > m\\
\frac{\omega(o,l-1)}{\omega(m,l)} & \text{otherwise}
\end{cases}
$$
that we append to a prefix $(l-1)$-tuple (apply the procedure recursively),
whose elements come from a set of $o$ symbols. If $l=0$ we just
return the empty tuple.
Obviously, the probability for a given $l$-tuple to be picked is equal to
$\frac{1}{\omega(m,l)}$.
Let $X$ denote the partiton of the $\alpha_i$ into equivalence classes,
then the number of
assignments is equal to $\prod_{\chi \in X}\omega(n,\card{\chi})$.
(Note that for $k$-SUM this is simply $\omega(n,k)$ since there is only a
single class of equivalence.)
For each equivalence class $\chi$ we draw independently a lexicographically
sorted $\card{\chi}$-tuple on $n$ symbols using the procedure
above. This yields a given assignment with probability
$\frac{1}{\prod_{\chi \in X}\omega(n,\card{\chi})}$.
Hence, this corresponds to a uniform random draw over the assignments.
For given $n$ and $k$, there are at most $nk$ values $\omega(m,l)$ to
compute, and for a given $k$-LDT instance, it must be computed only once.
Once those values have been computed, making a random draw takes time
$O(k)$.
\end{proof}
\section{Proof of Lemma~\ref*{lem:bound}}
\label{app:bound}
\begin{theorem}[Cramer's rule]\label{thm:cramer}
If a system of $n$ linear equations for $n$ unknowns, represented in matrix
multiplication form $Ax=b$,
has a unique solution $x=(x_1,x_2,\ldots,x_n)^T$ then, for all $i \in [n]$,
$$
x_i = \frac{\det(A_i)}{\det(A)}
$$
where $A_i$ is $A$ with the $i$th column replaced by the column vector $b$.
\end{theorem}
\begin{lemma}\label{lem:detZ}
The absolute value of the determinant of an $n\times n$ matrix $M$ with
integer entries is $O((Cn)^n)$ where $C$ is the maximum absolute value in
$M$.
\end{lemma}
\begin{proof}
The determinant of such a matrix is the sum of $2n!$ integers with maximum
absolute value $C^n$.
\end{proof}
\begin{lemma}\label{lem:detQ}
The determinant of an $n\times n$ matrix $M$ with
rational entries can be represented as a fraction whose numerators and
denominators absolute values are bounded by $O((ND^{n-1}n)^n)$ and $O(D^{n^2})$
respectively, where $N$ and $D$
are respectively the maximum absolute value of a numerator and a
denominator.
\end{lemma}
\begin{proof}
Multiply each row $M_i$ of $M$ by $\prod_j d_{i,j}$. Apply Lemma~\ref{lem:detZ}.
\end{proof}
We can now proceed to the proof of Lemma~\ref{lem:bound}.
\begin{proof}
Coefficients of the hyperplanes of the arrangement are constant rational
numbers, those can be changed to constant integers (because each
hyperplane has at most $k$ nonzero coefficients). Let $C$ denote the
maximum absolute value of those coefficients.
Because of Theorem~\ref{thm:cramer} and Lemma~\ref{lem:detZ}, vertices of
the arrangement have rational coordinates whose numerators and
denominators absolute values are bounded by $O(C^n n^n)$.
Given simplices whose vertices are vertices of the arrangement, hyperplanes
that define the faces of those simplices have rational coefficients whose
numerator and denominator are bounded by $O(C^{2n^3} n^{2n^3+n})$ by
Theorem~\ref{thm:cramer} and Lemma~\ref{lem:detQ}. (Note that some
simplices might be not fully dimensional, but we can handle those by adding
vertices with coordinates that are not much larger than that of already
existing vertices).
By applying Theorem~\ref{thm:cramer} and Lemma~\ref{lem:detQ} again, we
obtain that vertices of the arrangement of those new hyperplanes (and thus
vertices of $\simplex$) have rational coefficients whose numerator and
denominator are bounded by $O(C^{4n^5} n^{4n^5+2n^3+n})$.
\end{proof}
\section{Introduction}
The \kSUM{} problem is defined as follows: given a collection of real numbers, and a constant $k$,
decide whether any $k$ of them sum to zero.
It is a fixed-parameter version of the subset-sum problem, a standard \textit{NP}-complete
problem. The \kSUM{} problem, and in particular the special case of \threeSUM{},
has proved to be a cornerstone of the fine-grained complexity program aiming at
the construction of a complexity theory for problems in $P$. In particular,
there are deep connections between the complexity of \kSUM{}, the Strong
Exponential Time Hypothesis~\cite{PW10,CGIMPS15}, and the complexity of many
other major problems in
$P$~\cite{GO95,BH99,MO01,P10,ACLL14,AVW14,GP14,KPP14,ALW15,AWY15,CL15}.
It has been long known that the \kSUM{} problem can be solved in time
$O(n^{\frac{k}{2}}\log n)$ for even $k$, and $O(n^{\frac{k+1}{2}})$ for odd
$k$. Erickson~\cite{E99} proved a near-matching lower bound in the $k$-linear
decision tree model. In this model, the complexity is measured by the depth of
a decision tree, every node of which corresponds to a query of the form
$q_{i_1} + q_{i_2} + \cdots + q_{i_k} \ask{\le} 0$, where $q_1, q_2, \ldots, q_n$ are the
input numbers. In a recent breakthrough paper, Gr\o nlund and
Pettie~\cite{GP14} showed that in the $(2k-2)$-linear decision tree model,
where queries test the sign of weighted sums of up to $2k-2$ input numbers, only
$O(n^\frac{k}{2}\sqrt{\log n})$ queries are required for odd values of $k$. In
particular, there exists a $4$-linear decision tree for \threeSUM{} of depth
$\tilde{O}(n^\frac{3}{2})$ (here the notation $\tilde{O}$ ignores polylogarithmic
factors), while every 3-linear decision tree has depth $\Omega
(n^2)$~\cite{E99}. This indicates that increasing the size of the queries,
defined as the maximum number of input numbers involved in a query, can yield
significant improvements on the depth of the minimal-height decision tree. Ailon and
Chazelle~\cite{AC05} slightly extended the range of query sizes for which a
nontrivial lower bound could be established, elaborating on Erickson's
technique.
It has been well established that there exist nonuniform
polynomial-time algorithms for the subset-sum problem. One of them was
described by Meiser~\cite{M93}, and is derived from a data structure for point
location in arrangements of hyperplanes using the bottom vertex decomposition.
This algorithm can be cast as the construction of a linear decision tree in which
the queries have non-constant size.
\subsection{Our results.}
Our first contribution, in Section~\ref{sec:query-complexity}, is through a
careful implementation of Meiser's basic algorithm idea~\cite{M93} to show the
existence of an $n$-linear decision tree of depth $\tilde{O}(n^3)$ for \kSUM{}.
Although the high-level algorithm itself is not new, we refine the
implementation and analysis for the \kSUM{} problem.
Meiser presented his algorithm as a general method of point location in $\H{}$
given $n$-dimensional hyperplanes that yielded a depth $\tilde{O}(n^4 \log
\card{\H{}})$ linear decision tree; when viewing the \kSUM{} problem as a point
location problem, $\H{}$ is $O(n^k)$ and thus Meiser's algorithm can be viewed
as giving a $\tilde{O}(n^4)$-height linear decision tree. We reduce this height
to $\tilde{O}(n^3)$ for the particular hyperplanes that an instance $\kSUM$
problem presents when viewed as a point location problem.
While the original algorithm was cast as a nonuniform polynomial-time
algorithm, we show that it can be implemented in the linear decision tree
model. This first result also implies the existence of nonuniform RAM
algorithms with the same complexity, as shown in Appendix~\ref{app:act}.
There are two subtleties to this result. The first is inherent to the chosen
complexity model: even if the number of queries to the input is small (in
particular, the degree of the polynomial complexity is invariant on $k$), the
time required to \emph{determine which queries should be performed} may be
arbitrary. In a na\"ive analysis, we show it can be trivially bounded by
$\tilde{O}(n^{k+2})$. In Section~\ref{sec:time-complexity} we present an algorithm to
choose
which decisions to perform whereby the running time can be reduced to
$\tilde{O}(n^{\frac{k}{2}+8})$. Hence, we obtain an
$\tilde{O}(n^{\frac{k}{2}+8})$ time randomized algorithm in the RAM model
expected to perform $\tilde{O}(n^3)$ linear queries on the input\footnote{%
Gr{\o}nlund and
Pettie~\cite{GP14} mention the algorithms of auf Der Heyde~\cite{A84} and
Meiser~\cite{M93}, and state ``(\ldots) it was known that all \kLDT{} problems
can be solved by $n$-linear decision trees with depth $O(n^5\log
n)$~\cite{M93}, or with depth $O(n^4\log (nK))$ if the coefficients of the
linear function are integers with absolute value at most $K$~\cite{A84}.
Unfortunately these decision trees are not efficiently constructible. The
time required to determine \emph{which} comparisons to make is
exponential.'' We prove that the trees can have depth $\tilde{O}(n^3)$ and
that the whole algorithm can run in randomized polynomial-time.}.
The second issue we address is that the linear queries in the above algorithm may
have size $n$, that is, they may use all the components of the input.
The lower bound of Erickson shows that if the queries are of minimal size, the number
of queries cannot be a polynomial independent of $k$ such as what we obtain, so
non-minimal query size is clearly essential to a drastic reduction in the number of queries needed.
This gives rise to the natural question as to what is the relation between query size and number of queries.
In particular, one natural question is whether queries of size less than $n$
would still allow the problem to be solved using a polynomial independent of $k$
number of queries. We show that this is possible; in Section~\ref{sec:query-size},
we introduce a range of
algorithms exhibiting an explicit tradeoff between the number of queries and
their size. Using a blocking scheme, we show that we can restrict to
$\varepsilon n$-linear decision trees, for arbitrary $\varepsilon$. We also give a
range of tradeoffs for $n^{1-\varepsilon}$-linear decision trees. Although the
proposed algorithms still involve nonconstant-size queries, this is
the first time such tradeoffs are explicitly tackled. Table~\ref{tab:results} summarizes our results.
\begin{table}
\centering
\begin{tabular}{|c|c|c|c|c|}
\hline
& \# blocks & query size & \# queries & time \\
\hline
Theorem~\ref{thm:cube} &
$1$ &
$n$ &
$\tilde{O}(n^3)$ & $\tilde{O}(n^{\ceil{\frac{k}{2}}+8})$
\\
\hline
Theorem~\ref{thm:query-size} &
$b$ &
$k\ceil{\frac{n}{b}}$ &
$\tilde{O}(b^{k-4}n^3)$ &
$\tilde{O}(b^{\floor{\frac{k}{2}}-9} n^{\ceil{\frac{k}{2}}+8})$
\\
\hline
Corollary~\ref{cor:en} &
$b=\frac{k}{\varepsilon}$ &
$\varepsilon n$ &
$\tilde{O}(n^3)$ &
$\tilde{O}(n^{\ceil{\frac{k}{2}}+8})$
\\
\hline
Corollary~\ref{cor:ne} &
$b=O(n^\varepsilon)$ &
$O(n^{1-\varepsilon})$ &
$\tilde{O}(n^{3+(k-4)\varepsilon})$ &
$\tilde{O}(n^{(1+\varepsilon)\frac{k}{2} +8.5})$
\\
\hline
\end{tabular}
\caption{Complexities of our new algorithms for the \kSUM{}\ problem. The query
size is the maximum number of elements of the input that can be involved in a
single linear query. The number of blocks is a parameter that allows us to
change the query size (see Section~\ref{sec:query-size}).
The origin of the constant in the exponent of the time complexity is due to
Lemma~\ref{lem:bound}. We conjecture it can be reduced, though substantial
changes in the analysis will likely be needed to do so.}
\label{tab:results}
\end{table}
\section{Definitions and previous work}
\subsection{Definitions}
We consider the \kSUM{} problem for \(k=O(1)\). In what follows, we use the
notation \([n] = \{\,1,2,\ldots ,n\,\}\).
\begin{problem}[\kSUM{}]
Given an input vector \(q\in\mathbb{R}^n\), decide whether there exists a
$k$-tuple \((i_1, i_2,\ldots ,i_k) \in {[n]}^k\) such that \(\sum_{j=1}^k
q_{i_j} = 0\).
\end{problem}
The problem amounts to deciding in $n$-dimensional space, for each hyperplane
\(H\) of equation \(x_{i_1} + x_{i_2} + \cdots +x_{i_k} = 0\), whether \(q\)
lies on, above, or below \(H\). Hence this indeed amounts to locating the point
$q$ in the arrangement formed by those hyperplanes. We emphasize that the set
of hyperplanes depends only on $k$ and $n$ and not on the actual input vector
$q$.
Linear degeneracy testing (\kLDT{}) is a generalization of \kSUM{} where we
have arbitrary rational coefficients\footnote{The usual definition of \kLDT{}
allows arbitrary \emph{real} coefficients. However, the algorithm we provide
for Lemma~\ref{lem:multiple} needs the vertices of the arrangement of
hyperplanes to have rational coordinates.}
and an independent term in the equations
of the hyperplanes.
\begin{problem}[\kLDT{}]
Given an input vectors \(q\in\mathbb{R}^n\) and
$\alpha \in \mathbb{Q}^n$ and constant $c \in \mathbb{Q}$
decide whether there exists a
$k$-tuple \((i_1, i_2,\ldots ,i_k) \in {[n]}^k\) such that
\(c + \sum_{j=1}^k \alpha_j q_{i_j} = 0\).
\end{problem}
Our algorithms apply to this more general problem with only minor changes.
The \emph{\(s\)-linear decision tree model} is a standard model of computation
in which several lower bounds for \kSUM{}\ have been proven. In the decision tree
model, one may ask well-defined questions to an oracle that are answered
``yes'' or ``no.'' For $s$-linear decision trees, a well-defined question consists
of testing the sign of a linear function on at most \(s\) numbers \(q_{i_1},\ldots,q_{i_s}\) of the
input \(q_1,\ldots,q_n\) and can be written as
$$
c + \alpha_1 q_{i_1} + \cdots + \alpha_s q_{i_s} \ask{\le} 0
$$
Each question is defined to cost a single unit. All other operations can be
carried out for free but may not examine the input vector $q$. We refer to
$n$-linear decision trees simply as linear decision trees.
In this paper, we consider algorithms in the standard integer RAM model, but in which
the input $q\in\mathbb{R}^n$ is accessible \emph{only} via a linear query oracle. Hence we
are not allowed to manipulate the input numbers directly. The complexity is measured
in two ways: by counting the total number of queries, just as in the linear decision tree
model, and by measuring the overall running time, taking into account the time required
to determine the sequence of linear queries. This two-track computation model,
in which the running time is distinguished from the query complexity, is commonly
used in results on comparison-based sorting problems where analyses of both
runtime and comparisons are of interest (see for
instance~\cite{SS95,CFJJM10,CFJJM13}).
\subsection{Previous Results.}
The seminal paper by Gajentaan and Overmars~\cite{GO95} showed the crucial role
of \threeSUM{} in understanding the complexity of several problems in
computational geometry. It is an open question whether an
$O(n^{2-\varepsilon})$ algorithm exists for \threeSUM{}. Such a result would
have a tremendous impact on many other fundamental computational
problems~\cite{GO95,BH99,MO01,P10,ACLL14,AVW14,GP14,KPP14,ALW15,AWY15,CL15}.
It has been known for long that \kSUM{} is $W[1]$-hard. Recently, it was shown
to be $W[1]$-complete by Abboud et al.~\cite{ALW15}.
In Erickson~\cite{E99}, it is shown that we cannot solve \threeSUM{} in
subquadratic time in the \(3\)-linear decision tree model:
\begin{theorem}[Erickson~\cite{E99}]
The optimal depth of a \(k\)-linear decision tree that solves
the \kLDT{} problem is $\Theta(n^{\ceil{\frac{k}{2}}})$.
\end{theorem}
The proof uses an adversary argument which can be explained geometrically. As
we already observed, we can solve \kLDT{} problems by modeling them as point
location problems in an arrangement of hyperplanes. Solving one such problem
amounts to determining which cell of the arrangement contains the input point.
The adversary argument of Erickson~\cite{E99} is that there exists a cell having
$\Omega(n^{\ceil{\frac{k}{2}}})$ boundary facets and in this model point
location in such a cell requires testing each facet.
Ailon and Chazelle~\cite{AC05} study \(s\)-linear decision trees to solve the \kSUM{} problem when
\(s > k\). In particular, they give an additional proof for the
$\Omega(n^{\ceil{\frac{k}{2}}})$ lower bound of Erickson~\cite{E99} and
generalize the lower bound for the \(s\)-linear decision tree model when \(s >
k\). Note that the exact lower bound given by Erickson~\cite{E99} for \(s = k\) is
$\Omega({(nk^{-k})}^{\ceil{\frac{k}{2}}})$ while the one given by
Ailon and Chazelle~\cite{AC05} is $\Omega({(nk^{-3})}^{\ceil{\frac{k}{2}}})$. Their result
improves therefore the lower bound for \(s = k\) when \(k\) is large.
The lower bound they prove for \(s > k\) is the following
\begin{theorem}[Ailon and Chazelle~\cite{AC05}]
The depth of an $s$-linear decision tree solving the \kLDT{}\ problem is
$$
\Omega\mleft(\group{nk^{-3}}^{\frac{2k-s}{2\ceil{\frac{s-k+1}{2}}}
(1-\varepsilon_k) }\mright),
$$
where \(\varepsilon_k > 0\) tends to \(0\) as \(k \to\infty\).
\end{theorem}
This lower bound breaks down when
\(k = \Omega(n^{\sfrac{1}{3}})\) or \(s \ge 2 k\) and the cases where \(k < 6\)
give trivial lower bounds. For example, in the case
of \threeSUM{} with \(s = 4\) we only get an $\Omega(n)$ lower bound.
As for upper bounds, Baran et al.~\cite{BDP08} gave subquadratic Las Vegas
algorithms for 3SUM on integer and
rational numbers in the circuit RAM, word RAM, external memory, and
cache-oblivious models of computation. The idea of their approach is to exploit
the parallelism of the models, using linear and universal hashing.
More recently, Gr{\o}nlund and Pettie~\cite{GP14} proved the existence of a linear decision tree
solving the \threeSUM{} problem using a strongly subquadratic number of linear queries.
The classical quadratic algorithm for \threeSUM{} uses \(3\)-linear queries
while the decision tree of Gr{\o}nlund and Pettie uses \(4\)-linear queries and
requires $O(n^{\sfrac{3}{2}} \sqrt{\log n})$ of them.
Moreover, they show that their decision tree can be used to get better upper
bounds for \kSUM{} when \(k\) is odd.
They also provide two subquadratic \threeSUM{}
algorithms. A deterministic one running in
$O(n^2/{(\log n/\log \log n)}^{\sfrac{2}{3}})$
time and a randomized one running in
$O(n^2 {(\log \log n)}^2 / \log n)$ time with high probability.
These results refuted the long-lived conjecture that
\threeSUM{} cannot be solved in subquadratic time in the RAM model.
Freund~\cite{F15} and Gold and Sharir~\cite{GS15} later gave improvements on the
results of Gr{\o}nlund and Pettie~\cite{GP14}. Freund~\cite{F15} gave a deterministic algorithm for
\threeSUM{} running in \(O( {n^2\log \log n}/{\log n})\) time.
Gold and Sharir~\cite{GS15} gave another deterministic algorithm for \threeSUM{}
with the same running time and shaved off the $\sqrt{\log n}$ factor in the
decision tree complexities of \threeSUM{} and \kSUM{} given by Gr{\o}nlund and Pettie.
Auf der Heide~\cite{A84} gave the first point location algorithm to solve the knapsack
problem in the linear decision tree model in polynomial time. He thereby
answers a question raised by Dobkin and Lipton~\cite{DL74,DL78}, Yao~\cite{Y82}
and others. However, if one uses this algorithm to locate a point in an
arbitrary arrangement of hyperplanes the running time is increased by a factor
linear in the greatest coefficient in the equations of all hyperplanes.
On the other hand, the complexity of Meiser's point location algorithm is
polynomial in the dimension, logarithmic in the number of hyperplanes and
does not depend on the value of the coefficients in the equations of the
hyperplanes. A useful complete description of the latter is also given by
Bürgisser et al.~\cite{B97} (Section 3.4).
\section{Query complexity}
\label{sec:query-complexity}
In this section and the next, we prove the following first result.
\begin{theorem}
\label{thm:cube}
There exist linear decision trees of depth at most \(O(n^3\log^3 n)\) solving
the \kSUM{} and the \kLDT{} problems. Furthermore, for the two problems there
exists an $\tilde{O}(n^{\ceil{\frac{k}{2}}+8})$ Las Vegas algorithm in
the RAM model expected to perform $O(n^3\log^3 n)$ linear queries on the input.
\end{theorem}
\subsection{Algorithm outline}
For a fixed set of hyperplanes \(\H\) and given input vertex \(q\) in \(\R^n\),
Meiser's algorithm allows us to determine the cell of the arrangement
$\arrangement(\H)$ that contains $q$ in its interior (or that \emph{is} $q$ if
$q$ is a $0$-cell of $\arrangement(\H)$), that is, the positions $\sigma(H,q) \in
\signset$ of \(q\) with respect to all hyperplanes $H \in \H$. In the \kSUM{}
problem, the set $\H$ is the set of $\Theta(n^k)$ hyperplanes with equations of the
form $x_{i_1} + x_{i_2} + \cdots + x_{i_k} = 0$.
These equations can be modified accordingly for \kLDT{}.
We use standard results on \enets{}. Using a theorem due to Haussler and
Welzl~\cite{H87}, it is possible to construct an \enet{} \(\NH\) for the range
space
defined by hyperplanes and simplices using a random uniform sampling on \(\H\).
\begin{theorem}[Haussler and Welzl~\cite{H87}]\label{thm:enet}
If we choose \(O(\enetsize)\) hyperplanes of \(\H\) uniformly at
random and denote this selection \(\net\) then for
any simplex intersected by more than \(\varepsilon \card{\H{}}\) hyperplanes of
\(\H\), with high probability, at least one of the intersecting hyperplanes
is contained in \(\net\).
\end{theorem}
The contrapositive states that if no hyperplane in \(\net\) intersects
a given simplex, then with high probability the number of hyperplanes of
\(\H\) intersecting the simplex is at most \(\varepsilon \card{\H{}}\).
We can use this to design a prune and search algorithm as follows:
(1) construct an \enet{} \(\net\),
(2) compute the cell \(\cell\) of \(\arrangement(\net)\) containing the input
point $q$ in its interior,
(3) construct a simplex \(\simplex\) inscribed in \(\cell\) and containing
\(q\) in its interior,
(4) recurse on the hyperplanes of \(\H\) intersecting the interior of
\(\simplex\).
Proceeding this way with a constant $\varepsilon$ guarantees that at most a
constant fraction \(\varepsilon\) of the hyperplanes remains after the pruning step,
and thus the cumulative number of queries made to determine the enclosing cell at
each step is $O(n^2 \log^2 n \log \card{\H{}})$ when done in a brute-force way.
However, we still need to explain how to find a simplex \(\simplex\) inscribed
in \(\cell\) and containing \(q\) in its interior. This procedure corresponds to the well-known
\emph{bottom vertex decomposition} (or \emph{triangulation}) of a hyperplane
arrangement~\cite{GO04,Cla88}.
\subsection{Finding a simplex}
In order to simplify the exposition of the algorithm, we assume, without
loss of generality, that the input numbers $q_i$ all lie in the interval $[-1,1]$.
This assumption is justified by observing that we can normalize all the input
numbers by the largest absolute value of a component of $q$. One can then see that
every linear query on the normalized input can be implemented
as a linear query on the original input. A similar transformation can be carried out
for the \kLDT{}\ problem.
This allows us to use bounding hyperplanes of equations $x_i = \pm 1, i\in [n]$.
We denote by $\B$ this set of hyperplanes. Hence, if we choose a subset
\(\net\) of the hyperplanes, the input point is located in a bounded cell
of the arrangement \(\arrangement(\net \cup \B)\). Note that \(\card{\net \cup
\B} = O(\card{\net})\) for all interesting values of \(\varepsilon\).
We now explain how to construct \(\simplex\) under this assumption. The algorithm
can be sketched as follows. (Recall that $\sigma(H,p)$ denotes the relative position
of $p$ with respect to the hyperplane $H$.)
\begin{algorithm}[Constructing \(\simplex\)]\label{algo:simplex}
\item[input] A point \(q\) in ${[-1,1]}^n$, a set $\I$ of hyperplanes not
containing \(q\), and a set $\E$ of hyperplanes in general position
containing \(q\), such that the cell
$$
\cell = \{\,p \sut \sigma(H,p) = \sigma(H,q)
\ \text{or}\ \sigma(H,p) = 0
\ \text{for all}\ H \in (\I \cup \E)
\,\}
$$
is a bounded polytope. The value \(\sigma(H,q)\) is known for
all \(H \in (\I \cup \E)\).
\item[output] A simplex \(\simplex \in \cell\) that contains \(q\) in
its interior (if it is not a point), and all vertices
of which are vertices of \(\cell\).
\item[0.] If $\card{\E}=n$, return $q$.
\item[1.] Determine a vertex \(\nu\) of $\cell$.
\item[2.] Let \(q'\) be the projection of \(q\) along \(\vec{\nu q}\) on the
boundary of \(\cell\). Compute \(\I_\theta \subseteq \I\), the subset of
hyperplanes in \(\I\) containing \(q'\). Compute \(\I_{\tau} \subseteq
\I_{\theta}\), a maximal subset of those hyperplanes such that \(\E' = \E
\cup \I_\tau\) is a set of hyperplanes in general position.
\item[3.] Recurse on \(q'\), \(\I' = \I \setminus \I_\theta\), and \(\E'\), and
store the result in \(\simplex'\).
\item[4.] Return $\simplex$, the convex hull of \(\simplex' \cup \enum{\nu}\).
\end{algorithm}
Step \step{0} is the base case of the recursion: when there is only one point left, just return
that point. This step uses no query.
We can solve step \step{1} by using linear programming with the known values
of \(\sigma(H,q)\) as linear constraints. We arbitrarily choose an
objective function with a gradient non-orthogonal to all hyperplanes in
\(\I\) and look for the optimal solution. The optimal solution being a vertex of the arrangement,
its coordinates are independent of \(q\), and thus this step involves no query at all.
Step \step{2} prepares the recursive step by finding the hyperplanes containing
\(q'\). This can be implemented as a ray-shooting algorithm that performs
a number of comparisons between projections of $q$ on different hyperplanes of $\I$ without
explicitly computing them. In~Appendix~\ref{app:keeplinear}, we prove that all such comparisons
can be implemented using \(O(\card{\I})\) linear queries.
Constructing \(\E'\) can be done by solving systems of linear
equations that do not involve \(q\).
In step \step{3}, the input conditions are satisfied, that is, $q' \in
{[-1,1]}^n$, \(\I'\) is a set of hyperplanes not containing \(q'\), \(\E'\) is
a set of hyperplanes in general position containing \(q'\), \(\cell'\) is a
$d$-cell of \(\cell\) and is thus a bounded polytope. The value \(\sigma(H,q')\)
differs from \(\sigma(H,q)\) only for hyperplanes that have been removed from
\(\I\), and for those \(\sigma(H,q') = 0\), hence we know all necessary values
\(\sigma(H,q')\) in advance.
Since \(\card{\I'} < \card{\I}\), \(\card{\E'} > \card{\E}\), and
\(\card{\I\setminus\I'} - \card{\E'\setminus\E} \ge 0\), the complexity of the
recursive call is no more than that of the parent call, and the maximal depth
of the recursion is \(n\). Thus, the total number of
linear queries made to compute \(\simplex\) is \(O(n\card{\I})\).
Hence given an input point \(q \in [-1,1]\), an arrangement of hyperplanes
\(\arrangement(\net)\), and the value of \(\sigma(H,q)\) for all
\(H \in (\net\cup\B)\), we can compute the desired simplex \(\simplex\)
by running Algorithm~\ref{algo:simplex} on \(q\),
\(\I=\{\,H \in (\net\cup\B) \sut \sigma(H,q) \neq 0\,\}\), and
\(\E \subseteq (\net\cup\B) \setminus\I\).
This uses $O(n^3 \log^2 n)$ linear queries.
Figure~\ref{fig:meiser:step} illustrates a step of the algorithm.
\begin{figure}
\begin{center}
\includegraphics[trim=90 47 50 13,clip=true,height=0.25\textheight]{simplex}
\caption{%
Illustration of a step of Algorithm~\ref{algo:simplex}.
}
\label{fig:meiser:step}
\end{center}
\end{figure}
\subsection{Assembling the pieces}
Let us summarize the algorithm
\begin{algorithm}\label{algo:meiser}
\item[input] \(q \in {[-1,1]}^n\)
\item[1.] Pick \(O(n^2 \log^2 n)\) hyperplanes of $\H$ at random and locate $q$
in this arrangement. Call $\cell$ the cell containing $q$.
\item[2.] Construct the simplex \(\simplex\) containing \(q\) and inscribed in
\(\cell\), using Algorithm~\ref{algo:simplex}.
\item[3.] For every hyperplane of $\H$ containing $\simplex$, output a solution.
\item[4.] Recurse on hyperplanes of $\H$ intersecting the interior of $\simplex$.
\end{algorithm}
The query complexity of step \step{1} is $O(n^2 \log^2 n)$, and that of step
\step{2} is $O(n^3 \log^2 n)$. Steps \step{3} and \step{4} do not involve any
query at all. The recursion depth is $O(\log \card{\H})$, with $|\H|=O(n^k)$,
hence the total query complexity of this algorithm is $O(n^3 \log^3 n)$. This
proves the first part of Theorem~\ref{thm:cube}.\\
We can also consider the overall complexity of the algorithm in the RAM model,
that is, taking into account the steps that do not require any query, but for
which we still have to process the set $\H$. Note that the complexity
bottleneck of the algorithm are steps \step{3}-\step{4}, where we need to prune
the list of hyperplanes according to their relative positions with respect to
$\simplex$. For this purpose, we simply maintain explicitly the list of all
hyperplanes, starting with the initial set corresponding to all $k$-tuples.
Then the pruning step can be performed by looking at the position of each
vertex of $\simplex$ relative to each hyperplane of $\H$.
Because in our case hyperplanes have only $k$ nonzero coefficients, this uses a
number of integer arithmetic operations on $\tilde{O}(n)$ bits integers that is
proportional to the number of vertices times the number of hyperplanes.
(For the justification of the bound on the number of bits needed to represent
vertices of the arrangement see Appendix~\ref{app:bound}.)
Since we recurse on a fraction of the set, the overall complexity is
$\tilde{O}(n^2\card{\H{}}) = \tilde{O}(n^{k+2})$. The next section is devoted
to improving this running time.
\section{Time complexity}
\label{sec:time-complexity}
Proving the second part of Theorem~\ref{thm:cube} involves efficient implementations of
the two most time-consuming steps of Algorithm~\ref{algo:meiser}.
In order to efficiently implement the pruning
step, we define an intermediate problem, that we call the \emph{double $k$-SUM}
problem.
\begin{problem}[double $k$-SUM]
Given two vectors $\nu_1, \nu_2 \in {[-1,1]}^n$, where the coordinates of
$\nu_i$ can be written down as fractions whose numerator and denominator
lie in the interval $[-M,M]$, enumerate all
$i\in {[n]}^k$ such that
$$
\left(\sum_{j=1}^{k} \nu_{1,i_j}\right)
\left(\sum_{j=1}^{k} \nu_{2,i_j}\right)
< 0.
$$
\end{problem}
In other words, we wish to list all hyperplanes of $\H$
intersecting the open line segment $\nu_1\nu_2$.
We give an efficient output-sensitive algorithm for this problem.
\begin{lemma}\label{lem:double}
The double $k$-SUM problem can be solved in time $O(n^{\lceil \frac{k}{2}
\rceil} \log n \log M + Z)$, where $Z$ is the size of the solution.
\end{lemma}
\begin{proof}
If $k$ is even, we consider all possible $\frac{k}{2}$-tuples of numbers in
$\nu_1$ and $\nu_2$ and sort their sums in increasing order. This takes time
$O(n^{\frac{k}{2}} \log n)$ and yields two permutations $\pi_1$ and $\pi_2$
of $[n^\frac{k}{2}]$.
If $k$ is odd, then we sort both the $\lceil\frac{k}{2}\rceil$-tuples and
the $\lfloor\frac{k}{2}\rfloor$-tuples. For simplicity, we will only
consider the even case in what follows. The odd case carries through.
We let $N = n^\frac{k}{2}$. For $i \in [N]$ and $m \in \{1,2\}$, let
$\Sigma_{m,i}$ be the sum of the $\frac{k}{2}$ components of the $i$th
$\frac{k}{2}$-tuple in $\nu_m$, in the order prescribed by $\pi_m$.
We now consider the two $N \times N$ matrices $M_1$ and $M_2$ giving all
possible sums of two $\frac{k}{2}$-tuples, for both $\nu_1$ with the ordering
$\pi_1$ and $\nu_2$ with the ordering $\pi_2$.
We first solve the $k$-SUM problem on $\nu_1$, by finding the sign of all
pairs $\Sigma_{1,i} + \Sigma_{1,j}$, $i, j \in [N]$. This can be done in
time $O(N)$ by parsing the matrix $M_1$, just as in the standard \kSUM{} algorithm.
We do the same with $M_2$.
The set of all indices $i, j \in [N]$ such that $\Sigma_{1,i} +
\Sigma_{1,j}$ is positive forms a staircase in $M_1$. We sweep $M_1$ column
by column in order of increasing $j \in [N]$, in such a way that the number
of indices $i$ such that $\Sigma_{1,i} + \Sigma_{1,j} > 0$ is growing.
For each new such value $i$ that is encountered during the sweep, we insert
the corresponding $i' = \pi_2(\pi_1^{-1}(i))$ in a balanced binary search
tree.
After each sweep step in $M_1$ --- that is, after incrementing $j$ and
adding the set of new indices $i'$ in the tree --- we search the tree to
identify all the indices $i'$ such that $\Sigma_{2,i'} + \Sigma_{2,j'} <
0$, where $j' = \pi_2(\pi_1^{-1}(j))$. Since those indices form an interval
in the ordering $\pi_2$ when restricted to the indices in the tree, we can
search for the largest $i_0'$ such that $\Sigma_{2,i_0'} < -\Sigma_{2,j'}$
and retain all indices $i' \le i_0'$ that are in the tree. If we denote by
$z$ the number of such indices, this can be done in $O(\log N + z) = O(\log
n + z)$ time. Now all the pairs $i', j'$ found in this way are such that
$\Sigma_{1,i} + \Sigma_{1,j}$ is positive and $\Sigma_{2,i'} +
\Sigma_{2,j'}$ is negative, hence we can output the corresponding
$k$-tuples. To get all the pairs $i', j'$ such that
$\Sigma_{1,i} + \Sigma_{1,j}$ is negative and $\Sigma_{2,i'} +
\Sigma_{2,j'}$ positive, we repeat the sweeping algorithm after swapping the
roles of $\nu_1$ and $\nu_2$.
Every matching $k$-tuple is output exactly once, and every
$\frac{k}{2}$-tuple is inserted at most once in the binary search tree.
Hence the algorithm runs in the claimed time.
Note that we only manipulate rational numbers that are the sum of at most
$k$ rational numbers of size $O(\log M)$.
\end{proof}
Now observe that a hyperplane intersects the interior of a simplex if and only
if it intersects the interior of one of its edges. Hence given a simplex
$\simplex$ we can find all hyperplanes of $\H$ intersecting its interior by
running the above algorithm ${n\choose 2}$ times, once for each pair of
vertices $(\nu_1,\nu_2)$ of $\simplex$, and take the union of the solutions.
The overall running time for this implementation will therefore be
$\tilde{O}(n^2 (n^{\lceil \frac k2 \rceil} \log M + Z))$, where $Z$ is at most the
number of intersecting hyperplanes and $M$ is to be determined later.
This provides an implementation of the pruning step in Meiser's algorithm, that
is, step~\step{4} of Algorithm~\ref{algo:meiser}.
\begin{corollary}\label{cor:double}
Given a simplex $\simplex$, we can compute all $k$-SUM hyperplanes
intersecting its interior in $\tilde{O}(n^2 (n^{\lceil \frac k2 \rceil}
\log M + Z))$ time, where $M$ is proportional to the number of bits
necessary to represent $\simplex$.
\end{corollary}
In order to detect solutions in step~\step{3} of Algorithm~\ref{algo:meiser}, we also
need to be able to quickly solve the following problem.
\begin{problem}[multiple $k$-SUM]
Given $d$ points $\nu_1,\nu_2,\ldots,\nu_d \in \R^n$, where the coordinates of
$\nu_i$ can be written down as fractions whose numerator and denominator
lie in the interval $[-M,M]$,
decide whether there exists a hyperplane with equation of the form $x_{i_1}
+ x_{i_2} + \cdots + x_{i_k} = 0$ containing all of them.
\end{problem}
Here the standard $k$-SUM algorithm can be applied, taking advantage of
the fact that the coordinates lie in a small discrete set.
\begin{lemma}\label{lem:ksum}
$k$-SUM on $n$ integers $\in [-V,V]$ can be solved in time
$\tilde{O}(n^{\ckt}\log V)$.
\end{lemma}
\begin{lemma}\label{lem:multiple}
Multiple $k$-SUM can be solved in time $\tilde{O}(dn^{\ckt+2}\log M)$.
\end{lemma}
\begin{proof}
Let $\mu_{i,j}$ and $\delta_{i,j}$ be the numerator and denominator of
$\nu_{i,j}$ when written as an irreducible fraction. We define
$$
\zeta_{i,j} = \nu_{i,j}\prod_{\mathclap{(i,j) \in [d]\times[n]}} \delta_{i,j} =
\frac{\mu_{i,j}\displaystyle\prod_{\mathclap{(i',j') \in [d]\times[n]}} \delta_{i',j'}}{\delta_{i,j}}.
$$
By definition $\zeta_{i,j}$ is an integer and its absolute value is bounded
by $U = M^{n^2}$, that is, it can be
represented using $O(n^2 \log M)$ bits. Moreover, if one of the hyperplanes
contains the point $(\zeta_{i,1},\zeta_{i,2},\ldots,\zeta_{i,n})$, then it
contains $\nu_i$. Construct $n$ integers of $O(dn^2 \log M)$ bits that can
be written $\zeta_{1,j}+U,\zeta_{2,j}+U,\ldots,\zeta_{d,j}+U$ in base
$2Uk+1$. The answer to our decision problem is ``yes'' if and only if there
exists $k$ of those numbers whose sum is $kU,kU,\ldots,kU$. We simply
subtract the number $U,U,\ldots,U$ to all $n$
input numbers to obtain a standard $k$-SUM instance on $n$ integers of
$O(dn^2 \log M)$ bits.
\end{proof}
We now have efficient implementations of steps \step{3} and \step{4}
of Algorithm~\ref{algo:meiser} and can proceed to the proof of the second part
of Theorem~\ref{thm:cube}.
\begin{proof}
The main idea consists of modifying the first iteration of Algorithm~\ref{algo:meiser}, by
letting $\varepsilon = n^{-\frac{k}{2}}$.
Hence we pick a random subset $\net$ of
$O(n^{k/2 + 2} \log^2 n)$ hyperplanes in $\H$ and use this as an \enet.
This can be done efficiently, as shown in~Appendix~\ref{app:sampling}.
Next, we need to locate the input $q$ in the arrangement induced by
$\net$. This can be done by running Algorithm~\ref{algo:meiser} on the set
$\net$. From the previous considerations on Algorithm~\ref{algo:meiser}, the
running time of this step is
$$
O(n|\net|) = \tilde{O}(n^{k/2 + 4}),
$$
and the number of queries is $O(n^3\log^3n)$.
Then, in order to be able to prune the hyperplanes in $\H$, we have to
compute a simplex $\simplex$ that does not intersect any hyperplane of
$\net$. For this, we observe that the above call to Algorithm~\ref{algo:meiser}
involves computing a sequence of simplices for the successive pruning
steps. We save the description of those simplices. Recall that there are
$O(\log n)$ of them, all of them contain the input $q$ and have vertices
coinciding with vertices of the original arrangement $\arrangement(\H)$. In
order to compute a simplex $\simplex$ avoiding all hyperplanes of
$\net$, we can simply apply Algorithm~\ref{algo:simplex} on the set of
hyperplanes bounding the intersection of these simplices. The running time
and number of queries for this step are bounded respectively by
$n^{O(1)}$ and $O(n^2\log n)$.
Note that the vertices of $\simplex$ are not vertices
of $\arrangement(\H)$ anymore. However, their coordinates lie in a finite set
(see~Appendix~\ref{app:bound})
\begin{lemma}\label{lem:bound}
Vertices of $\simplex$ have rational coordinates whose fraction representations
have their numerators and denominators absolute value bounded by
$O(C^{4n^5} n^{4n^5+2n^3+n})$, where $C$ is a constant.
\end{lemma}
We now are in position to perform the pruning of the hyperplanes in $\H$ with
respect to $\simplex$. The number of remaining hyperplanes after the pruning is
at most $\varepsilon n^k = O(n^{k/2})$. Hence from Corollary~\ref{cor:double}, the
pruning can be performed in time proportional $\tilde{O}(n^{\ceil{k/2} + 7})$.
Similarly, we can detect any hyperplane of $\H$ containing $\simplex$ using the
result of Lemma~\ref{lem:multiple} in time $\tilde{O}(n^{\lceil k/2\rceil +
8})$. Note that those last two steps do not require any query.
Finally, it remains to detect any solution that may lie in the remaining
set of hyperplanes of size $O(n^{k/2})$. We can again fall back
on Algorithm~\ref{algo:meiser}, restricted to those hyperplanes. The running
time is $\tilde{O}(n^{k/2 + 2})$, and the number of queries is still $O(n^3 \log^3
n)$.
Overall, the maximum running time of a step is $\tilde{O}(n^{\ceil{\frac{k}{2}} + 8})$,
while the number of queries is always bounded by $O(n^3\log^3 n)$.
\end{proof}
\section{Query size}
\label{sec:query-size}
In this section, we consider a simple blocking scheme that allows us to explore
a tradeoff between the number of queries and the size of the queries.
\begin{lemma}
\label{lem:block}
For any integer $b>0$, an instance of the \kSUM{} problem on $n>b$ numbers can be split into
$O(b^{k-1})$ instances on at most $k\lceil \frac{n}{b}\rceil$ numbers, so that every $k$-tuple
forming a solution is found in exactly one of the subproblems.
The transformation can be carried out in time $O(n\log n + b^{k-1})$.
\end{lemma}
\begin{proof}
Given an instance on $n$ numbers, we can sort them in time $O(n\log n)$, then partition
the sorted sequence into \(b\) consecutive blocks \(B_1, B_2,\ldots ,B_b\) of equal size.
This partition can be associated with a partition of the real line
into $b$ intervals, say $I_1, I_2,\ldots ,I_b$. Now consider the partition of $\R^k$
into grid cells defined by the $k$th power of the partition $I_1, I_2,\ldots ,I_b$. The
hyperplane of equation $x_1 + x_2 +\cdots +x_k = 0$ hits $O(b^{k-1})$ such grid cells.
Each grid cell $I_{i_1}\times I_{i_2}\times \cdots \times I_{i_k}$ corresponds to a
\kSUM{} problem on the numbers in the set $B_{i_1}\cup B_{i_2}\cup \ldots \cup B_{i_k}$ (note that
the indices $i_j$ need not be distinct). Hence each such instance has size at most $k\lceil \frac{n}{b}\rceil$.
\end{proof}
Combining Lemma~\ref{lem:block} and Theorem~\ref{thm:cube} directly yields the following.
\begin{theorem}\label{thm:query-size}
For any integer $b>0$, there exists a $k\lceil \frac{n}{b}\rceil$-linear
decision tree of depth \(\tilde{O}(b^{k-4} n^3)\) solving the \kSUM{}
problem.
Moreover, this decision tree can be implemented as an
$\tilde{O}(b^{\floor{\frac{k}{2}}-9}n^{\ceil{\frac{k}{2}}+8})$
Las Vegas algorithm.
\end{theorem}
The following two corollaries are obtained by taking $b=\frac{k}{\varepsilon}$, and
$b=O(n^{\varepsilon})$, respectively
\begin{corollary}\label{cor:en}
For any constant $\varepsilon>0$ such that $b=\frac{k}{\varepsilon}$ and
$\frac{n}{b}$ are positive integers,
there exists an $\varepsilon n$-linear decision tree of
depth $\tilde{O} (n^3)$ solving the \kSUM{} problem.
Moreover, this decision tree can be implemented as an
$\tilde{O}(n^{\ceil{\frac{k}{2}}+8})$ Las Vegas algorithm.
\end{corollary}
\begin{corollary}\label{cor:ne}
For any $\varepsilon$ such that $0<\varepsilon<1$,
there exists an $O(n^{1-\varepsilon})$-linear decision tree of
depth $\tilde{O} (n^{3+(k-4)\varepsilon})$ solving the \kSUM{} problem.
Moreover, this decision tree can be implemented as an
$\tilde{O}(n^{(1+\varepsilon)\frac{k}{2} + 8.5})$
Las Vegas algorithm.
\end{corollary}
Note that the latter query complexity improves on $\tilde{O}(n^{\frac{k}{2}})$
whenever \(\varepsilon < \frac{1}{2}\) and $k\geq
\frac{3-4\varepsilon}{\sfrac{1}{2}-\varepsilon}$. Hence for instance, we obtain
an $O(n^\frac{3}{4})$-linear decision tree of depth $\tilde{O}(n^4)$ for the
\dsum[8] problem, and $o(n)$-linear decision trees of depth $o(n^4)$ for any
$k$.
| {'timestamp': '2016-02-19T02:08:08', 'yymm': '1512', 'arxiv_id': '1512.06678', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06678'} | arxiv |
\section{Object Instance Labeling}
The goal of this paper is to perform instance-level segmentation given a single monocular image.
We follow~\cite{ZhangICCV15} and learn deep representations to perform this task.
Our contribution is then a novel densely connected Markov random field that is able to produce a single coherent explanation of the full image and amenable to the efficient mean field inference algorithm \cite{krahenbuhl2011efficient}. As shown in our experimental evaluation the estimates provided by our approach are significantly better than those of~\cite{ZhangICCV15} in most metrics.
\subsection{Deep Learning for Instance-level Segmentation}
We follow~\cite{ZhangICCV15} to both generate surrogate ground truth and train the CNN.
We provide the details for completeness. We generate training examples by extracting overlapping patches at multiple resolutions.
Since KITTI does not have instance-level segmentations, we use~\cite{ChenCVPR14,cadmodel} to obtain the segmentations for our training set.
We label the instances according to their depth within the patch. Thus instances farther away from the camera will get higher IDs.
Using depth ordering is important to produce a single labeling, breaking the symmetry of permutations of instance-level segmentation. E.g., two instances can be labeled as either (1,2) or (2,1).
We then train a CNN to output a pixel-level instance labeling inside each patch. We use the
architecture from~\cite{SchwingTR2015}
pre-trained on ImageNet and fine-tune it for instance-level segmentation using our surrogate ground truth.
The CNN gives us (probabilistic) pixel-level predictions of instances at the patch level. We propose a model to merge all the local predictions and produce a globally consistent image labeling. This is the contribution of our paper.
\subsection{Densely Connected Pixel-wise MRF}
Given an image ${\bf x}$, we index the image patches with $z$. Let $\P_z$ be the set of pixels in patch $z$.
Let ${\bf p}_{z,i}$ be the output of the softmax for the $i$-th pixel when we apply the CNN to patch $z$. Note that the CNN predicts up to 5 instances as well as background. Thus ${\bf p}_{z,i}$ is a 6-D vector.
The goal is to merge all the patch-level information and come up with a single explanation of the image in terms of all instances. We restrict the maximum number of instances to be 9 per image, which is sufficient for KITTI.
Thus our global label space ${\mathcal L}_\text{g}$ is $\{0,1, \cdots, 9\}$ with $0$ encoding background.
Let $\mathbf{y}$ be the labeling of each pixel in the image with $y_i \in {\mathcal L}_\text{g}$.
Unlike \cite{ZhangICCV15}, we are not interested in ordering the instances by depth. Thus any labeling that separates instances is valid.
We propose a novel densely connected pixel-wise MRF to solve for the problem of labeling the full image given the local patch-based predictions.
The corresponding Gibbs energy $E({\bf y})$ of our MRF consists of three main terms: a pairwise \textit{smoothness} term, a pairwise \textit{local CNN prediction} term and a pairwise \textit{inter-connected component} term, each encoding different intuitions about the problem:
\begin{equation}
E({\bf y}) = E_\text{smo}({\bf y}) + E_\text{cnn}({\bf y}) + E_\text{icc}({\bf y}).
\end{equation}
Note that all terms are defined over densely connected pixel pairs. We cannot use the CNN output as a unary potential, as the label space of the local patches and the global image are different, i.e., only 6 labels (including background) possible locally, and instance 2 in a local patch might be totally different from instance 2 in another patch far away.
We now describe each term in more details.
\vspace{-1mm}
\subsubsection{Smoothness: $E_\text{smo}({\bf y})$}
Following~\cite{krahenbuhl2011efficient}, we incorporate a contrast-sensitive smoothness term into our MRF to remove noisy tiny regions. The idea is to describe each pixel with a feature vector, and define a potential that encourages pixels with similar features to be more likely assigned the same label. The typical feature for each pixel has been color and position on image.
In our problem we use the combination of position and the output of the CNN to form our feature space. Our CNN is trained to differentiate between object instances, so the probability vectors that the CNN outputs are a very strong cue of how likely two pixels belong to the same object.
Further, we use the position feature so that the smoothness has a lower influence between far apart regions in order not to over-smooth the result.
Notice that we do not use color as a feature. This is because different object instances can take similar colors, and color may be somewhat deceiving due to shadows, saturation and specularities.
Formally, let ${\bf d}_i$ be the 2-D position vector for pixel $i$ in the image. We define the contrast-sensitive smoothness term as a sum of patch-specific contrast-sensitive smoothness terms, each defined over all pixel pairs in the patch:
\begin{equation}
E_\text{smo}({\bf y}) =
\sum_z \sum_{i, j: i, j \in \P_z, i < j} \varphi_\text{smo}^{(z,i,j)}(y_i, y_j),
\end{equation}
where the potential is defined as
\begin{equation}
\varphi_\text{smo}^{(z,i,j)}(y_i, y_j) = w_\text{smo} \mu_\text{smo}(y_i,y_j) k_\text{smo} \left({\bf f}_i^{(z)}, {\bf f}_j^{(z)}\right).
\end{equation}
Here $w_\text{smo}$ is the weight for the potential (which we learn) controlling the degree of smoothness, and $k_\text{smo}$ denotes a Gaussian kernel defined as
\[
k_\text{smo} \left({\bf f}_i^{(z)}, {\bf f}_j^{(z)}\right) = \exp \left( - \frac{\|{\bf p}_{z,i} - {\bf p}_{z,j}\|_2^2}{2\theta_1^2} - \frac{\|{\bf d}_i - {\bf d}_j\|_2^2}{2\theta_2^2} \right),
\]
where ${\bf f}_i^{(z)}$ contains both the position ${\bf d}_i$ and the output of the CNN ${\bf p}_{z,i}$.
Note that $\theta_1$ and $\theta_2$ scale the features to reflect our notion of ``closeness" in the feature space.
Finally,
the compatibility function $\mu_\text{smo}(y_i, y_j)$ in the potential takes the form of the Potts model:
\[
\mu_\text{smo}(y_i,y_j) = \begin{cases}
1, & \text{if } y_i \neq y_j \\
0, & \text{otherwise} \end{cases}.
\]
This penalizes two pixels with similar positions and CNN predictions to have different labels.
\begin{figure}[t!]
\vspace{-1mm}
\centering
\includegraphics[width=\linewidth]{figs/shift.png}
\caption{\small Function $h_2(\cdot)$ {\bf prepends} 2 zeros to vector ${\bf p}_{z,i}$ while $h_{-2}(\cdot)$ {\bf appends} 2 zeros to vector ${\bf p}_{z,j}$. This is equivalent to shifting ${\bf p}_{z,i}$ by 2 units towards right and zero-pad both vectors to make them aligned. The shift matches the modes of ${\bf p}_{z,i}$ and ${\bf p}_{z,j}$. We input this shifted vector pair into our Gaussian kernel.}
\label{fig:shift}
\vspace{-2mm}
\end{figure}
\subsubsection{Local CNN Prediction: $E_\text{cnn}({\bf y})$}
Any given patch contains only a subset of the instances present in the full image.
When we produce our image-level labeling, we would like to maintain the separation into different instances estimated at the local level (via the CNN), while producing a coherent labeling across all patches.
For example, if the CNN predicts that in patch $z$ pixel $i$ belongs to instance 1 while pixel $j$ belongs to instance 2, then any global configuration with $y_i \neq y_j$ should be encouraged. However, it turns out to be important to have some preference over the ordering just to break the symmetry in our model to kick off the inference algorithm. We thus encourage ordering in the global labeling (in this example $y_i < y_j$).
To encode this patch-image compatibility in our energy, we define the local CNN prediction term
as a sum of patch-specific compatibility terms, each defined over all pixel pairs in the patch:
\begin{equation}
E_\text{cnn}({\bf y}) = \sum_z \sum_{i, j: i, j \in \P_z, i < j} \varphi_\text{cnn}^{(z,i,j)}(y_i, y_j).
\end{equation}
The potential $\varphi_\text{cnn}^{(z,i,j)}(y_i, y_j)$ should ideally encode the fact that we want global instance labeling to agree with local predictions. That is, if two pixels are likely to be of the same (different) instance at the local level, they should also be the same (different) at the global level.
This could be simply encoded with a compatibility potential that $y_i$ and $y_j$ are encouraged to have the same label if the output of the CNN ${\bf p}_{z,i}$ and ${\bf p}_{z,j}$ are similar, and their relative ordering ($y_i>y_j$ or vice versa) is respected if the CNN predicts them to be of different instances.
This naive approach, however, will break the efficiency of inference, as we will no longer be able to use Gaussian filtering. Gaussian filtering is however crucial, since our local CNN prediction term is fully connected at patch level.
Instead, one of the main contributions of our paper is to approximate such compatibility potentials as a series of Gaussian potentials. Each potential is composed of a Gaussian kernel applied to a shifted version of the local softmax probabilities:
\begin{equation}
\varphi_\text{cnn}^{(z,i,j)}(y_i,y_j) = \sum_{t = -T}^{T} \varphi_\text{cnn}^{(z,t,i,j)}(y_i,y_j),
\end{equation}
where $T$ is the maximum shift allowed (fixed to be 2 in our experiments).
We define the shifted pairwise potential $\varphi_\text{cnn}^{(z,t,i,j)}(y_i,y_j)$ as a product of its weight, a compatibility function and a Gaussian kernel defined over pairs of shifted local CNN predictions:
\begin{equation}
\varphi_\text{cnn}^{(z,t,i,j)}(y_i,y_j) = w_\text{cnn}^{(s(z))} \mu_\text{cnn}^{(t)}(y_i, y_j) k_\text{cnn}^{(t)}(h_t({\bf p}_{z,i}), h_{-t}({\bf p}_{z,j})), \label{eq:phi_cnn}
\end{equation}
where $w_\text{cnn}^{(s(z))}$ is the weight which depends on the size $s(z)$ of patch $z$, and $k_\text{cnn}^{(t)}$ is a Gaussian kernel characterized by its precision matrix $\Lambda_\text{cnn}^{(t)}$.
When $t>0$, a shift towards right is applied to ${\bf p}_{z,i}$ to create $h_t({\bf p}_{z,i})$ while a shift towards left is applied to ${\bf p}_{z,j}$ to create $h_{-t}({\bf p}_{z,j})$.
Note that shifting by $t$ requires {\bf prepending} $t$ zeros, while shifting by $-t$ requires {\bf appending} $t$ zeros. We refer the reader to \figref{fig:shift} for a visualization of this idea.
If the modes of ${\bf p}_{z,i}$ and ${\bf p}_{z,j}$ match for any positive $t$, it means that the label of pixel $i$ is predicted to be smaller than pixel $j$ in patch $z$ by the CNN. This is the case shown in~\figref{fig:shift}. Therefore, globally we prefer any configuration with $y_i < y_j$. The reverse is also true that if we achieve a good match with a negative $t$, then we prefer any configuration with $y_i>y_j$. If the best match is achieved without shift, it means that we prefer $y_i=y_j$.
This can be encoded via the following compatibility function:
\begin{equation}
\mu_\text{cnn}^{(t)}(y_i, y_j) = \begin{cases}
-1, & \text{if } y_i < y_j, t > 0 \\
-1, & \text{if } y_i > y_j, t < 0 \\
-1, & \text{if } y_i = y_j, t = 0 \\
0, & \text{otherwise}
\end{cases}.
\end{equation}
Note that a negative value in $\mu_\text{cnn}^{(t)}(y_i, y_j)$ implies that we encourage the configuration.
\begin{figure*}[htb!]
\vspace{-5mm}
\centering
\begin{subfigure}[b]{0.28\linewidth}
\includegraphics[height=1.67in,width=\linewidth]{figs/lattice.png}
\caption{}
\label{fig:lattice}
\end{subfigure}
~
\begin{subfigure}[b]{0.65\linewidth}
\includegraphics[height=1.67in,width=\linewidth]{figs/inter-cco.png}
\caption{}
\label{fig:inter-cco}
\end{subfigure}
\vspace{-3.0mm}
\caption{\small {\bf (a)} Suppose that $\{{\bf p}_{z,i}\}$ are positive scalars. When $t=1$, both $h_t({\bf p}_{z,i})$ and $h_{-t}({\bf p}_{z,j})$ are 2-D. The corresponding permutohedral lattice (in gray) lies on a 2-D hyperplane in a 3-D space. $\{h_{-t}({\bf p}_{z,j})\}$ are embedded in the hyperplane ({\color{blue}blue dots}). The embeddings follow a 1-D subspace due to zero-appending. Value of $\{Q_j(l')\}$ splats onto the vertices of their respective enclosing simplexes ({\color{blue}blue squares}). After Gaussian blurring, vertices shown as {\color{green}green squares} also get non-zero value. An extra step is to embed $\{h_t({\bf p}_{z,i})\}$ ({\color{red}red solid dots} and {\color{red}red open dots}). The embeddings lie on another 1-D subspace due to zero-prepending. Finally, convolution is evaluated at the new embeddings. Only {\color{red}red solid dots} get non-zero values, while {\color{red}red open dots} get a zero due to the inactivity of the vertices of their enclosing simplex. {\bf (b)} Three car blobs are shown in the image. During each mean field update, we sum up individual messages from members of ${\cal C}_3$ and pass the summation to each member of ${\cal C}_1$ and ${\cal C}_2$. Similarly for messages from ${\cal C}_1$ to ${\cal C}_2$ and ${\cal C}_3$, and messages from ${\cal C}_2$ to ${\cal C}_1$ and ${\cal C}_3$.}
\vspace{-1.5mm}
\end{figure*}
\vspace{-2mm}
\subsubsection{Inter-Connected Component: $E_\text{icc}({\bf y})$}
So far our MRF encourages smoothness as well as that global instance labeling to agree with local predictions. However, nothing prevents instances that are far apart and thus do not appear together in any patch from having the same label.
Towards this goal, for each pixel $i$, we compute the probability that it belongs to foreground, by summing the output of local CNN predictions and re-normalizing.
By thresholding this probability, we obtain a binary mask of activation. We index each connected component of the foreground of the binary mask with $m$, and the pixels it contains with ${\cal C}_m$.
Each component might contain more than one car.
However, it is reasonable to assume that each instance will never appear in two different components.
We encode this in the inter-connected component term as a sum of terms defined over component pairs, and each of the terms fully connects cross-component pixel pairs:
\begin{equation}
E_\text{icc}(y) = \sum_{m,n: m<n} \sum_{i,j: i \in {\cal C}_m, j \in {\cal C}_n} w_\text{icc} \mu_\text{icc}(y_i, y_j),
\end{equation}
with $w_\text{icc}$ the weight and $\mu_\text{icc}(y_i, y_j)$ a Potts potential
\begin{equation}
\mu_\text{icc}(y_i, y_j) = \begin{cases}
1, & \text{if } y_i = y_j \\
0, & \text{otherwise}
\end{cases}.
\end{equation}
While this potential is not Gaussian, and we have dense connections, in the next section we show that the updates can still be computed in linear time.
\subsection{Efficient Inference}
Inference in our model consists of estimating the minimum energy configuration
\[
{\bf y}^* = \argmin_{{\bf y}} E_\text{smo}({\bf y}) + E_\text{cnn}({\bf y}) + E_\text{icc}({\bf y}).
\]
Unfortunately this is NP-hard.
Instead, we perform efficient approximated inference via mean field. Towards this goal, we approximate the Gibbs distribution $P({\bf y}|{\bf x})=\frac{1}{Z({\bf x})} \exp (-E({\bf y}|{\bf x}))$ with a fully decomposable distribution $Q({\bf y}|{\bf x}) = \prod_i Q_i(y_i|{\bf x})$. Note that we drop the conditioning from now on to simplify notation.
Mean field computes updates by iteratively minimizing the KL-divergence between the approximated distribution $Q({\bf y})$ and the true distribution $P({\bf y})$.
We use an iterative algorithm which updates the local distributions $\{Q_i(y_i)\}$ in parallel.
In our model, the updates can be derived as
\begin{align}
& \log Q_i(y_i=l) \nonumber \\
= & - \sum_{z:i\in\P_z} \sum_{l': l'\in{\mathcal L}_\text{g}} \sum_{j: j \in \P_z, j \neq i} \varphi_\text{smo}^{(z,i,j)}(l, l') Q_j(l') \label{update:smooth} \\
& - \sum_{z: i \in \P_z} \sum_{t = -T}^T \sum_{l': l'\in{\mathcal L}_\text{g}} \sum_{j: j \in \P_z, j \neq i} \varphi_\text{cnn}^{(z,t,i,j)}(l,l') Q_j(l') \label{update:prediction} \\
& - w_\text{icc} \sum_{n: n \neq m, i \in {\cal C}_m} \sum_{j: j\in{\cal C}_n} Q_j(l) - \log(Z_i), \label{update:inter-cco}
\end{align}
with $Z_i$ the local partition function which is easily computable as it only depends on a single node.
We refer the reader to suppl. material for the derivation of these updates.
We use the uniform distribution as our initialization. We now describe how to compute the updates efficiently.
\vspace{-0.4cm}
\paragraph{Smoothness.} \equref{update:smooth} can be computed efficiently using the same high-dimensional Gaussian filtering algorithm of \cite{krahenbuhl2011efficient}. This results in linear updates in the number of pixels.
\begin{table*}[!htbp]
\vspace{-5mm}
\centering
\small
\addtolength{\tabcolsep}{-1.6pt}
\begin{tabular}{|c | c | c | c | c | c | c | c | c | c | c | c |}
\hline
& & \multicolumn{1}{>{\columncolor{blr}}c|}{{\bf Cls. Eval}} & \multicolumn{9}{>{\columncolor{bgr}}c|}{{\bf Instance Evaluation}} \\
\hline
& & IoU & MWCov & MUCov & AvgPr & AvgRe & AvgFP & AvgFN & InsPr & InsRe & InsF1\\
\hline\hline
\multirow{4}{*}{~\cite{ZhangICCV15}} & ConnComp & 77.1 & 66.7 & 49.1 & 82.0 & 60.3 & 0.465 & 0.903 & 49.1 & 43.0 & 45.8\\
\cline{2-12}
& Unary & {77.6} & 65.0 & 48.4 & 81.7 & 62.1 & 0.389 & 0.688 & 46.6 & 42.0 & 44.2\\
\cline{2-12}
& Unary+LongRange & {77.6} & 66.1 & 49.2 & {82.6} & 62.1 & {0.354} & 0.688 & 48.2 & 43.1 & 45.5\\
\cline{2-12}
& Unary+LR (w/ DeepLab~\cite{chen14semantic}) & {77.7} & 68.2 & 50.2 & {\bf 85.3} & {63.2} & {\bf 0.285} & {\bf 0.562} & 39.5 & 40.1 & 39.8\\
\hline\hline
\multirow{4}{*}{{\bf Ours}} & LocCNNPred & 77.4 & 58.3 & 40.9 & 80.4 & 62.6 & 0.403 & 0.681 & 25.3 & 32.9 & 28.6\\
\cline{2-12}
& LocCNNPred+InterConnComp & 76.8 & 65.7 & 50.3 & 79.9 & {\bf 63.4} & 0.507 & {0.618} & 35.8 & 46.4 & 40.4\\
\cline{2-12}
& Full & 77.1 & {69.3} & {50.6} & 80.5 & 57.7 & 0.451 & 1.076 & {56.3} & {47.4} & {51.5}\\
\cline{2-12}
& Full (w/ DeepLab~\cite{chen14semantic}) & {\bf 78.5} & {\bf 73.7} & {\bf 54.3} & 82.8 & 61.3 & 0.458 & 0.812 & {\bf 63.3} & {\bf 51.6} & {\bf 56.8}\\
\hline
& \multicolumn{11}{>{\columncolor{orr}}c|}{{\bf With Post-processing}} \\
\hline
\multirow{4}{*}{~\cite{ZhangICCV15}} & ConnComp & 77.2 & 66.8 & 49.2 & 81.8 & 60.3 & 0.465 & 0.903 & 49.8 & 43.0 & 46.1\\
\cline{2-12}
& Unary & {77.4} & 66.7 & 49.8 & 81.6 & 61.2 & 0.562 & 0.840 & 44.1 & 44.7 & 44.4\\
\cline{2-12}
& Unary+LongRange & {77.4} & 67.0 & 49.8 & 82.0 & 61.3 & 0.479 & 0.840 & 48.9 & 43.8 & 46.2\\
\cline{2-12}
& Unary+LR (w/ DeepLab~\cite{chen14semantic}) & 77.3 & 70.9 & 52.2 & {\bf 85.7} & {61.7} & 0.597 & 0.736 & 40.2 & 45.9 & 42.8\\
\hline\hline
\multirow{4}{*}{{\bf Ours}} & LocCNNPred & 76.7 & 67.5 & 52.9 & 82.5 & 61.3 & 0.646 & 0.743 & 39.4 & 51.6 & 44.7\\
\cline{2-12}
& LocCNNPred+InterConnComp & 76.3 & 68.1 & {53.9} & 80.7 & {\bf 62.2} & 0.708 & {\bf 0.701} & 42.1 & {52.2} & 46.6\\
\cline{2-12}
& Full & 77.0 & {69.7} & 51.8 & {83.9} & 57.5 & {\bf 0.375} & 1.139 & {65.3} & 50.0 & {56.6}\\
\cline{2-12}
& Full (w/ DeepLab~\cite{chen14semantic}) & {\bf 78.5} & {\bf 74.1} & {\bf 55.2} & 84.7 & 61.3 & {0.417} & 0.833 & {\bf 70.9} & {\bf 53.7} & {\bf 61.1}\\
\hline
\end{tabular}
\vspace{-2mm}
\caption{Instance-level and Class-level Evaluation on the {\bf Test Set} (144 images). See text for the explanation of the metrics. For `AvgFP' and `AvgFN' smaller is better, for the rest higher is better.}
\label{tab:metricsTest}
\end{table*}
\vspace{-0.4cm}
\paragraph{Local CNN Prediction.}
The inner most summation over pixels in~\equref{update:prediction} is the fundamental building block for the computation of the entire term. Explicitly it is given as
\begin{equation}
w_\text{cnn}^{(s(z))} \mu_\text{cnn}^{(t)}(l, l') \sum_{j: j \in \P_z, j \neq i} k_\text{cnn}^{(t)}(h_t({\bf p}_{z,i}), h_{-t}({\bf p}_{z,j})) Q_j(l'). \nonumbe
\end{equation}
This can be interpreted as a convolution with a Gaussian kernel $G_{\Lambda_\text{cnn}^{(t)}}$ evaluated at $h_t({\bf p}_{z,i})$. Since Gaussian convolution is essentially a low-pass filter, by the sampling theorem we can convolve a downsampled $\{Q_j(l')\}$ with the Gaussian kernel, and upsample the output to compute convolution at $h_t({\bf p}_{z,i})$. Following~\cite{krahenbuhl2011efficient}, we use the efficient permutohedral lattice data structure~\cite{adams2010fast} to perform downsampling, convolution and upsampling.
In the standard case of Gaussian filtering with permutohedral lattice, we embed a set of features encoding the position of $\{Q_j(l')\}$ in the hyperplane in which the lattice lies. We then downsample by splatting the value of each $Q_j(l')$ onto the vertices of its enclosing simplex with barycentric weights. Then Gaussian blurring is performed over lattice points along each lattice direction. The final result is then computed by gathering values from lattice points for the already embedded features.
Due to the fact that we introduced different shifts for the two elements of the kernel $h_t({\bf p}_{z,i})$ and $h_{-t}({\bf p}_{z,j})$, apart from the set of features $\{h_{-t}({\bf p}_{z,j})\}$ we need to embed in the first place, we have to embed an extra set of features $\{h_t({\bf p}_{z,i})\}$ at which we evaluate the convolution, in contrast to the standard case.
An example is in~\figref{fig:lattice}.
As in the standard case, we first embed $\{h_{-t}({\bf p}_{z,j})\}$ encoding the position of $\{Q_j(l')\}$ in the hyperplane. Note, however, that the features lie in a subspace of the hyperplane as they are padded with zeros (e.g., a line on a plane in~\figref{fig:lattice}).
We then distribute the value of each $Q_j(l')$ onto the vertices of its enclosing simplex.
This is followed by the filtering step over the lattice. As an extra step in contrast to the standard case, we now need to embed the first element of the kernel, i.e., $\{h_t({\bf p}_{z,i})\}$, in the hyperplane, and the embeddings lie in another subspace. Finally we evaluate the convolution at the new embeddings.
\vspace{-0.4cm}
\paragraph{Inter-Connected Component.} The first term in~\equref{update:inter-cco} is not a Gaussian kernel, however it is densely connected. This means that potentially we have an update quadratic in the number of pixels.
We exploit the fact that all members within a connected component have the exact same pairwise interaction with all other pixels not in the component.
This implies that all members within a connected component receive the exact same messages passed from other components during each update. Note that it is linear to sum up the individual messages within a connected component and pass this summation $\sum_{j: j\in{\cal C}_n} Q_j(l)$ to the members of other components. We visualize the message passing procedure for the inter-connected component potential in \figref{fig:inter-cco}.
\section{Conclusions}
\vspace{-1mm}
In this paper, we proposed a new approach for instance-level segmentation. Our approach builds upon the recently proposed work~\cite{ZhangICCV15} which trains a CNN on local patches to obtain soft instance labelings. We propose a densely connected MRF that is amenable to the efficient inference algorithm by~\cite{krahenbuhl2011efficient} to derive a globally consistent instance labeling of the full image. Our MRF exploits local CNN predictions, long-range connections between far apart instances, and contrast-sensitive smoothness. Our experiments show significant improvements over~\cite{ZhangICCV15}.
\vspace{0.2cm}
\noindent{\bf Acknowledgments:} This work was partially supported by ONR-N00014-14-1-0232, Samsung and NSERC.
\section{Introduction}
Object detection is one of the fundamental open problems in computer vision.
The main objective is to place tight bounding boxes around each object of interest.
In the past two years, detection performance has almost doubled thanks to the availability of large datasets as they enable training very deep representations~\cite{alexnet,verydeep}.
While detection might have been a good proxy when performance was low,
recent work has been trying to go beyond simple boxes by providing a detailed segmentation mask for each object instance~\cite{HariharanSimultaneousECCV2014,yang2012layered,tigheCVPR14,HeCVPR2014,WangCVPR15}.
\begin{figure}[t!]
\vspace{-2mm}
\centering
\includegraphics[width=\linewidth]{figs/intro.png}
\vspace{-6mm}
\caption{\small Our approach densely samples patches of different sizes from the image (row 1) and exploits a CNN to provide a soft instance labeling of each patch (row 2). Our MRF connects all pixel pairs inside the patches (yellow curves in row 2), as well as all pixel pairs from far away connected components obtained from patch-level CNN predictions (yellow curves in row 1), to provide a globally consistent instance labeling of the image (row 3). }
\label{fig:intro}
\vspace{-3mm}
\end{figure}
A mask is in many ways richer than a box: it allows an informed reasoning about occlusion and depth layering. For robotics applications where depth is available, it further enables a more precise 3D localization and segmentation~\cite{guptaECCV14} which is important for, e.g., obstacle avoidance, route planning and object grasping. An instance mask is also more informative than pixel-wise class labeling as it allows counting, important for applications such as retrieval~\cite{LinCVPR14}
Instance segmentation has been addressed in a variety of ways. In interactive segmentation, approaches like Grabcut~\cite{Rother2004SIGGRAPH,Boykov2004PAMI} require a user-supplied box, or a scribble on the foreground and background, in order to segment the objects. This is typically done with graph-cuts by combining appearance cues and smoothness. The most common approach to instance segmentation has been to utilize object detections and top-down shape priors to label pixels inside each detected box~\cite{Kumar05,girshick2013rich}. Methods that jointly reason about instance labeling and, possibly, depth ordering given object detections and class-level semantic segmentation have shown improved performance~\cite{tigheCVPR14}. Recently, approaches that train CNNs to predict instance labeling inside densely sampled image patches have shown very promising performance~\cite{ZhangICCV15}. However, deriving a globally consistent instance labeling of the image from local predictions is a challenging open problem.
In this paper, our goal is to estimate an accurate pixel-level labeling of object instances from a single monocular image in the context of autonomous driving.
We propose a method that combines the soft predictions of a neural net run on many overlapping patches into a consistent global labeling of the entire image.
We formulate this problem as a densely connected Markov random field (MRF) with several potentials encoding consistency with local patches, contrast-sensitive smoothness as well as the fact that separate regions form different instances. An overview of our MRF is given in Fig. \ref{fig:intro}. Our main technical contribution is a formulation that encodes all potentials in a way that is amenable to efficient mean field inference \cite{krahenbuhl2011efficient}, and we go beyond \cite{krahenbuhl2011efficient} by including Potts potentials as well.
Our experimental evaluation shows significant improvements over~\cite{ZhangICCV15} on the challenging KITTI benchmark~\cite{kitti}.
\section{Related Work}
We focus our review on techniques operating on a single monocular image, and divide them into different types.
\vspace{-0.4cm}
\paragraph{Instance-Level Segmentation by Detection.} The most common approach to object instance segmentation is to first localize objects with a set of bounding boxes, and then exploit top-down information such as object's shape and appearance in order to accurately segment the object within each box~\cite{Kumar05}.
~\cite{ladicky10,whole} proposed an MRF model to identify which detections are true positive, and output pixel-wise class labels, thus performing instance segmentation. ~\cite{HaykoECCV12} votes for object centers and uses a MRF to infer the assignment of pixels to object centers.
R-CNN~\cite{girshick2013rich} was used in~\cite{HariharanSimultaneousECCV2014} to first generate object proposals, and then predictions from two CNNs (box and region-based) were fused to segment the object inside each box. This idea was extended to RGB-D in~\cite{guptaECCV14}.
In~\cite{yang2012layered}, the authors propose a generative model that takes as input candidate detections and jointly assigns a pixel to an object instance as well as a depth layer. Inference is performed with coordinate ascent iterating between updating the layer assignment and the parameters of the appearance models. In contrast, we leverage the efficient inference algorithm for Gaussian MRFs~\cite{krahenbuhl2011efficient} to work directly on the pixel level (rather than layers), thus allowing more freedom in the final label assignment.
In~\cite{tigheCVPR14}, semantic segmentation and object detection are run as a first step. The method then solves for instance labeling and depth ordering by minimizing an integer quadratic program. In our approach we use a CNN trained to directly predict instance labeling in a stride of local patches, and then solve for a consistent instance labeling using our densely connected MRF, thus not requiring to explicitly perform object detection.
\vspace{-0.4cm}
\paragraph{3D CAD Models.} Another line of work matches CAD models to images~\cite{Aubry14,LimICCV13,guptaCVPR15a}. An image-aligned CAD model effectively provides an instance labeling of the image. CAD matching is however typically slow, and not very robust, as there is a large difference between the appearance of the synthetic models and objects in real images. Instead of matching CAD models,~\cite{Isola13} retrieves object segments from a dataset of labeled objects. Their probabilistic model then aims to find segments that optimally transform into the given image by respecting typical 3D relations. The output is an instance labeling of the image (a ``scene collage'').
\vspace{-0.4cm}
\paragraph{Interactive Segmentation.} Instance-level segmentation has also been done without prior knowledge about how the object looks like. In this line of work, the techniques rely on a user-supplied box, or a scribble on the foreground and background, and then derive the pixel-wise labeling of the object instance. For example, GrabCut~\cite{Rother2004SIGGRAPH} utilizes annotations in the form of 2D bounding boxes, and computes the foreground/background models using EM. ~\cite{Boykov2001ICCV} relies on scribbles as seeds to
model appearance of foreground/background, and uses graph-cuts by combining appearance cues and a smoothness term~\cite{Boykov2004PAMI}.
\vspace{-0.4cm}
\paragraph{Instances without Object Detection.} Recent work has tried to explicitly reason about instance segmentation (no class detectors need to be run in advance).~\cite{SilbermanECCV14} makes an optimal cut in a hierarchical segmentation tree to obtain object instance regions.~\cite{Liang15} trained a multi-output CNN that jointly predicts pixel-level class labeling of the image as well as bounding box locations and object instance numbers. Off-the-shelf clustering is used to derive the final object instance labeling of the image. In our work, we exhaustively sample bounding boxes and softly score each pixel belonging to a particular object instance. Our main efforts are then devoted to ``clustering'' (merging the predictions) which in our work is done via a densely connected MRF. Parallel to our work,~\cite{torr16} proposes a recurrent neural net to label object instances sequential by keeping a memory of which pixels have been labeled so far.
We build on~\cite{ZhangICCV15} which trains a CNN on local patches to obtain a depth-ordered pixel-wise instance labeling of each patch. \cite{ZhangICCV15} then uses a MRF along with a connected component algorithm to merge predictions in the possibly overlapping patches into a global instance labeling of the image. In our paper, we propose a densely connected MRF that exploits fast inference~\cite{krahenbuhl2011efficient}, and provides significantly better segmentations due to the dense connectivity in the model.
\iffalse
Importantly, our work makes use of ideas behind fully connected CRFs~\cite{krahenbuhl2011efficient}. Our main contribution is to extend this approach to a wider set of energies, in particular to non-symmetric pairwise potentials. {\color{red}{yes? true?}} \Ziyu{Our pairwise potentials are non-symmetric, but this is not our contribution. I've mentioned this in the introduction section. Our contribution is a good transformation of features so that fully connected CRF can be used for telling things apart instead of smoothing. This is what people never explored but we explored and succeeded.}
\fi
\section{Experimental Evaluation}
\iffalse
\begin{table*}[!htbp]
\centering
\small
\addtolength{\tabcolsep}{-1.4pt}
\begin{tabular}{| c | c | c | c | c | c | c | c | c | c | c |}
\hline
& \multicolumn{1}{>{\columncolor{blr}}c|}{{\bf Class Eval}} & \multicolumn{9}{>{\columncolor{bgr}}c|}{{\bf Instance Evaluation}} \\
\hline
& IoU & MWCov & MUCov & AvgPr & AvgRe & AvgFP & AvgFN & InsPr & InsRe & InsF1\\
\hline\hline
ConnComp~\cite{ZhangICCV15} & 76.8 & 63.4 & 47.5 & 82.5 & 55.4 & 0.342 & 0.908 & 56.1 & 51.6 & 53.7\\
\hline
Unary~\cite{ZhangICCV15} & 77.2 & 62.3 & 46.9 & 82.2 & 57.7 & 0.267 & 0.600 & 50.1 & 48.7 & 49.4\\
\hline
Unary+LongRange~\cite{ZhangICCV15} & 77.2 & 63.2 & 47.8 & 82.0 & 57.7 & 0.283 & 0.600 & 53.6 & 51.6 & 52.6\\
\hline\hline
LocCNNPred & 77.1 & 56.5 & 40.5 & 78.1 & 60.0 & 0.383 & 0.658 & 26.9 & 37.0 & 31.2\\
\hline
LocCNNPred+InterConnComp & 77.0 & 63.0 & 48.7 & 79.5 & 61.4 & 0.433 & 0.625 & 38.0 & 53.1 & 44.3\\
\hline
Full & 76.7 & 62.0 & 45.6 & 82.2 & 56.0 & 0.325 & 0.925 & 57.7 & 51.1 & 54.2\\
\hline\hline
ConnComp~\cite{ZhangICCV15}+PP & 76.8 & 63.5 & 47.6 & 82.4 & 55.4 & 0.342 & 0.908 & 56.7 & 51.6 & 54.0\\
\hline
Unary~\cite{ZhangICCV15}+PP & 77.0 & 62.7 & 47.3 & 83.5 & 56.2 & 0.333 & 0.875 & 50.8 & 50.2 & 50.5\\
\hline
Unary+LongRange~\cite{ZhangICCV15}+PP & 76.7 & 63.6 & 47.8 & 83.0 & 56.1 & 0.342 & 0.875 & 53.6 & 51.8 & 52.7\\
\hline\hline
LocCNNPred+PP & 76.5 & 64.1 & 51.5 & 83.3 & 59.0 & 0.392 & 0.692 & 48.8 & 59.0 & 53.4\\
\hline
LocCNNPred+InterConnComp+PP & 76.7 & 65.6 & 52.7 & 79.6 & 60.4 & 0.567 & 0.658 & 48.6 & 59.2 & 53.4\\
\hline
Full+PP & 76.7 & 64.7 & 49.2 & 82.7 & 55.9 & 0.308 & 0.967 & 69.3 & 57.6 & 62.9\\
\hline
\end{tabular}
\vspace{-2mm}
\caption{Instance-level and Class-level Evaluation on the {\bf Validation Set} (120 images)}
\label{tab:metricsVal}
\end{table*}
\fi
\iffalse
\begin{table*}[!htbp]
\centering
\small
\addtolength{\tabcolsep}{-0.7pt}
\begin{tabular}{| c | c | c | c | c | c | c | c | c | c | c |}
\hline
& \multicolumn{1}{>{\columncolor{blr}}c|}{{\bf Class Eval}} & \multicolumn{9}{>{\columncolor{bgr}}c|}{{\bf Instance Evaluation}} \\
\hline
& FIoU & MWCov & MUCov & AvgPr & AvgRe & AvgFP & AvgFN & InsPr & InsRe & InsF1\\
\hline\hline
ConnComp~\cite{ZhangICCV15} & 76.6 & 70.2 & 51.0 & 84.4 & 58.4 & 0.625 & 0.938 & 41.8 & 44.4 & 43.0\\
\hline
Unary~\cite{ZhangICCV15} & 77.7 & 69.2 & 50.4 & 84.7 & {\bf 63.2} & 0.340 & 0.562 & 40.1 & 43.2 & 41.6\\
\hline
Unary+LongRange~\cite{ZhangICCV15} & 77.7 & 68.2 & 50.2 & {\bf 85.3} & {\bf 63.2} & {\bf 0.285} & 0.562 & 39.5 & 40.1 & 39.8\\
\hline\hline
LocCNNPred & 75.4 & 59.0 & 42.1 & 84.2 & 62.5 & 0.333 & 0.583 & 32.8 & 32.4 & 32.6\\
\hline
LocCNNPred+InterConnComp & 73.4 & 66.4 & 50.2 & 81.9 & 62.4 & 0.479 & {\bf 0.500} & 37.0 & 44.9 & 40.6\\
\hline
Full & {\bf 78.5} & {\bf 73.7} & {\bf 54.3} & 82.8 & 61.3 & 0.458 & 0.812 & {\bf 63.3} & {\bf 51.6} & {\bf 56.8}\\
\hline
& \multicolumn{10}{>{\columncolor{orr}}c|}{{\bf With Post-processing}} \\
\hline
ConnComp~\cite{ZhangICCV15} & 76.6 & 70.4 & 51.1 & 84.4 & 58.4 & 0.597 & 0.938 & 43.3 & 44.7 & 44.0\\
\hline
Unary~\cite{ZhangICCV15} & 77.4 & 70.7 & 52.2 & 85.4 & 61.5 & 0.639 & 0.743 & 37.8 & 45.3 & 41.2\\
\hline
Unary+LongRange~\cite{ZhangICCV15} & 77.3 & 70.9 & 52.2 & {\bf 85.7} & {\bf 61.7} & 0.597 & 0.736 & 40.2 & 45.9 & 42.8\\
\hline\hline
LocCNNPred & 74.9 & 70.8 & 55.0 & 84.0 & 61.3 & 0.576 & {\bf 0.646} & 48.4 & 53.4 & 50.8\\
\hline
LocCNNPred+InterConnComp & 72.7 & 70.4 & {\bf 55.4} & 78.3 & 60.1 & 1.042 & 0.653 & 40.2 & 53.3 & 45.8\\
\hline
Full & {\bf 78.5} & {\bf 74.1} & 55.2 & 84.7 & 61.3 & {\bf 0.417} & 0.833 & {\bf 70.9} & {\bf 53.7} & {\bf 61.1}\\
\hline
\end{tabular}
\vspace{-2mm}
\caption{Instance-level and Class-level Evaluation on the {\bf Test Set} (144 images). See text for the explanation of the metrics. For `AvgFP' and `AvgFN' smaller is better, for the rest higher is better.}
\label{tab:metricsTest}
\end{table*}
\fi
\iffalse
\begin{table*}[!htbp]
\centering
\small
\addtolength{\tabcolsep}{-0.7pt}
\begin{tabular}{| c | c | c | c | c | c | c | c | c | c | c |}
\hline
& \multicolumn{1}{>{\columncolor{blr}}c|}{{\bf Class Eval}} & \multicolumn{9}{>{\columncolor{bgr}}c|}{{\bf Instance Evaluation}} \\
\hline
& IoU & MWCov & MUCov & AvgPr & AvgRe & AvgFP & AvgFN & InsPr & InsRe & InsF1\\
\hline\hline
ConnComp~\cite{ZhangICCV15} & 77.1 & 66.7 & 49.1 & 82.0 & 60.3 & 0.465 & 0.903 & 49.1 & 43.0 & 45.8\\
\hline
Unary~\cite{ZhangICCV15} & {\bf 77.6} & 65.0 & 48.4 & 81.7 & 62.1 & 0.389 & 0.688 & 46.6 & 42.0 & 44.2\\
\hline
Unary+LongRange~\cite{ZhangICCV15} & {\bf 77.6} & 66.1 & 49.2 & {\bf 82.6} & 62.1 & {\bf 0.354} & 0.688 & 48.2 & 43.1 & 45.5\\
\hline\hline
LocCNNPred & 77.4 & 58.3 & 40.9 & 80.4 & 62.6 & 0.403 & 0.681 & 25.3 & 32.9 & 28.6\\
\hline
LocCNNPred+InterConnComp & 76.8 & 65.7 & 50.3 & 79.9 & {\bf 63.4} & 0.507 & {\bf 0.618} & 35.8 & 46.4 & 40.4\\
\hline
Full & 77.1 & {\bf 69.3} & {\bf 50.6} & 80.5 & 57.7 & 0.451 & 1.076 & {\bf 56.3} & {\bf 47.4} & {\bf 51.5}\\
\hline
& \multicolumn{10}{>{\columncolor{orr}}c|}{{\bf With Post-processing}} \\
\hline
ConnComp~\cite{ZhangICCV15} & 77.2 & 66.8 & 49.2 & 81.8 & 60.3 & 0.465 & 0.903 & 49.8 & 43.0 & 46.1\\
\hline
Unary~\cite{ZhangICCV15} & {\bf 77.4} & 66.7 & 49.8 & 81.6 & 61.2 & 0.562 & 0.840 & 44.1 & 44.7 & 44.4\\
\hline
Unary+LongRange~\cite{ZhangICCV15} & {\bf 77.4} & 67.0 & 49.8 & 82.0 & 61.3 & 0.479 & 0.840 & 48.9 & 43.8 & 46.2\\
\hline\hline
LocCNNPred & 76.7 & 67.5 & 52.9 & 82.5 & 61.3 & 0.646 & 0.743 & 39.4 & 51.6 & 44.7\\
\hline
LocCNNPred+InterConnComp & 76.3 & 68.1 & {\bf 53.9} & 80.7 & {\bf 62.2} & 0.708 & {\bf 0.701} & 42.1 & {\bf 52.2} & 46.6\\
\hline
Full & 77.0 & {\bf 69.7} & 51.8 & {\bf 83.9} & 57.5 & {\bf 0.375} & 1.139 & {\bf 65.3} & 50.0 & {\bf 56.6}\\
\hline
\end{tabular}
\vspace{-2mm}
\caption{\Ziyu{Old Table with Old Unaries}Instance-level and Class-level Evaluation on the {\bf Test Set} (144 images). See text for the explanation of the metrics. For `AvgFP' and `AvgFN' smaller is better, for the rest higher is better.}
\label{tab:metricsTest}
\end{table*}
\fi
We evaluate our approach on the challenging KITTI benchmark~\cite{kitti}. In particular, we use a subset of $3,524$ images from $55$ videos and divide the images into training/validation/test sets such that given a video, all its images are exclusively contained in only one of the three sets. Altogether, we use $3260$ images for training, $120$ for validation, and $144$ for testing. $131$ images from either our validation or test set have been manually annotated with pixel-wise instance labeling for \emph{Cars} by~\cite{ChenCVPR14}. We labeled the rest of the 133 images. Thus all validation and test images have ground truth annotations.
\vspace{-0.4cm}
\paragraph{Implementation Details.} We generate surrogate ground truth for our training images with~\cite{ChenCVPR14} and train our CNN as in~\cite{ZhangICCV15}. In another experiment we also use the architecture DeepLab-LargeFOV from~\cite{chen14semantic}. By changing the CNN architecture from the naive adaptation of VGG-16 by~\cite{SchwingTR2015} to DeepLab-LargeFOV (denoted by `w/ DeepLab~\cite{chen14semantic}' in our results), we observe substantial performance gain for our approach but a slight drop for the baselines. Thus we report results with both architectures.
For our validation/test images (with typical size $375\times1242$), we extract densely overlapping patches of three sizes: large ($270\times432$), medium ($180\times288$), and small ($120\times192$) in a sliding window fashion. We run the extracted patches through the CNN to obtain local instance predictions.
Following~\cite{krahenbuhl2011efficient}, we apply a pixel-wise normalization to Gaussian kernels. We also normalize the aggregated message of each connected component by the number of pixels it contains. Normalization is able to cancel the bias caused by highly variable instance sizes.
We tune all weights, hyper-parameters and kernel widths in our MRF on the validation set. We fix the number of iterations of the mean field update to be $50$ in all experiments in the paper.
\vspace{-0.4cm}
\paragraph{Baselines.} We re-train the approach (in three different instantiations) proposed in~\cite{ZhangICCV15} on our validation set to obtain three strong baselines. Note that~\cite{ZhangICCV15} and our method use the exact same CNN unaries and patch extraction method, so we evaluate the two different MRFs on equal footing. The first baseline `ConnComp' is the `connected components ordering' potential in~\cite{ZhangICCV15} which applies a connected component algorithm to heuristically merged object instances and orders them according to their positions along the vertical axis. The second baseline `Unary' additionally adds the `CNN energy' potential in~\cite{ZhangICCV15}. The third baseline `Unary+LongRange' further adds the pairwise `long-range connections' from~\cite{ZhangICCV15}. We found that their pairwise `short-range connections' generally hurts performance, so we do not include it in our baselines.
\begin{figure*}[htb!]
\vspace{-3mm}
\includegraphics[width=0.247\linewidth]{figs/images/007256.jpg}
\includegraphics[width=0.247\linewidth]{figs/gts/007256.png}
\includegraphics[width=0.247\linewidth]{figs/iccv15predictions/007256.png}
\includegraphics[width=0.247\linewidth]{figs/predictions/007256.png}\\[0.3mm]
\includegraphics[width=0.247\linewidth]{figs/images/006815.jpg}
\includegraphics[width=0.247\linewidth]{figs/gts/006815.png}
\includegraphics[width=0.247\linewidth]{figs/iccv15predictions/006815.png}
\includegraphics[width=0.247\linewidth]{figs/predictions/006815.png}\\[0.3mm]
\includegraphics[width=0.247\linewidth]{figs/images/001411.jpg}
\includegraphics[width=0.247\linewidth]{figs/gts/001411.png}
\includegraphics[width=0.247\linewidth]{figs/iccv15predictions/001411.png}
\includegraphics[width=0.247\linewidth]{figs/predictions/001411.png}\\[0.3mm]
\includegraphics[width=0.247\linewidth]{figs/images/000021.jpg}
\includegraphics[width=0.247\linewidth]{figs/gts/000021.png}
\includegraphics[width=0.247\linewidth]{figs/iccv15predictions/000021.png}
\includegraphics[width=0.247\linewidth]{figs/predictions/000021.png}\\[0.3mm]
\includegraphics[width=0.247\linewidth]{figs/images/001140.jpg}
\includegraphics[width=0.247\linewidth]{figs/gts/001140.png}
\includegraphics[width=0.247\linewidth]{figs/iccv15predictions/001140.png}
\includegraphics[width=0.247\linewidth]{figs/predictions/001140.png}\\[0.3mm]
\includegraphics[width=0.247\linewidth]{figs/images/004735.jpg}
\includegraphics[width=0.247\linewidth]{figs/gts/004735.png}
\includegraphics[width=0.247\linewidth]{figs/iccv15predictions/004735.png}
\includegraphics[width=0.247\linewidth]{figs/predictions/004735.png}\\[0.3mm]
\includegraphics[width=0.247\linewidth]{figs/images/000252.jpg}
\includegraphics[width=0.247\linewidth]{figs/gts/000252.png}
\includegraphics[width=0.247\linewidth]{figs/iccv15predictions/000252.png}
\includegraphics[width=0.247\linewidth]{figs/predictions/000252.png}\\[0.3mm]
\includegraphics[width=0.247\linewidth]{figs/images/001042.jpg}
\includegraphics[width=0.247\linewidth]{figs/gts/001042.png}
\includegraphics[width=0.247\linewidth]{figs/iccv15predictions/001042.png}
\includegraphics[width=0.247\linewidth]{figs/predictions/001042.png}\\[0.3mm]
\includegraphics[width=0.247\linewidth]{figs/images/006503.jpg}
\includegraphics[width=0.247\linewidth]{figs/gts/006503.png}
\includegraphics[width=0.247\linewidth]{figs/iccv15predictions/006503.png}
\includegraphics[width=0.247\linewidth]{figs/predictions/006503.png}\\
\addtolength{\tabcolsep}{38.5pt}
\begin{tabular}{cccc}
Image & Ground Truth & ~\cite{ZhangICCV15}& $\ \ \ \ \ $Ours
\end{tabular}
\vspace{-3.5mm}
\caption{Successes of our model (without post-processing) with comparison to~\cite{ZhangICCV15}.}
\label{fig:success}
\vspace{-1mm}
\end{figure*}
\begin{figure*}[htb!]
\vspace{-1mm}
\includegraphics[width=0.247\linewidth]{figs/images/000391.jpg}
\includegraphics[width=0.247\linewidth]{figs/gts/000391.png}
\includegraphics[width=0.247\linewidth]{figs/iccv15predictions/000391.png}
\includegraphics[width=0.247\linewidth]{figs/predictions/000391.png}\\[0.3mm]
\includegraphics[width=0.247\linewidth]{figs/images/001999.jpg}
\includegraphics[width=0.247\linewidth]{figs/gts/001999.png}
\includegraphics[width=0.247\linewidth]{figs/iccv15predictions/001999.png}
\includegraphics[width=0.247\linewidth]{figs/predictions/001999.png}\\[-1mm]
\addtolength{\tabcolsep}{38.5pt}
\begin{tabular}{cccc}
Image & Ground Truth & ~\cite{ZhangICCV15}& $\ \ \ \ \ $Ours
\end{tabular}
\vspace{-3.5mm}
\caption{Failures of our model, mostly due to large non-car vehicles, small objects or severe occlusion.}
\label{fig:failure}
\vspace{-2mm}
\end{figure*}
\vspace{-0.4cm}
\paragraph{Evaluation Metrics.} Following~\cite{ZhangICCV15}, we use a number of metrics to provide a comprehensive evaluation of our model. We divide the metrics into two categories, namely class-level (i.e., \emph{Car} vs. \emph{non-Car}) and instance-level.
For the \emph{class-level evaluation}, we report the standard intersection-over-union score for the foreground `FIoU'.
For the \emph{instance-level evaluation}, we provide the mean-weighted-coverage score and the mean-unweighted-coverage score introduced in~\cite{SilbermanECCV14}, which we denote by `MWCov' and `MUCov' respectively. For each ground-truth instance in a given image, we find its maximally overlapping prediction and compute the IoU score between them. The weighted-coverage score for the image is then the average of the IoU scores weighted by the size of the ground-truth instances. Finally, `MWCov' is obtained by averaging the weighted-coverage score across images. The mean-unweighted-coverage score is computed similarly but treats every ground-truth instance equally. `MWCov' and `MUCov' are important, because they directly evaluate how closely our predictions overlap with ground-truth instances, since these two metrics are based on IoU scores. However, they do not penalize false positive instances.
For each predicted instance, we compute the ratio of class-level (\emph{Car} vs. \emph{non-Car}) true positive pixels inside it. The ratio is then averaged across predicted instances and reported as `AvgPr'. Similarly for each ground-truth instance, we compute the ratio of true positive pixels inside it. The ratio is then averaged across all ground-truth instances and reported as `AvgRe'.
If a predicted instance does not overlap with any ground-truth instance, we deem it as a false positive instance. We average the number of false positive instances in each image across images, and report it as `AvgFP'. Similarly, if a ground-truth instance does not overlap with any prediction, we deem it as a false negative instance. We average the number of false negative instances in each image across images, and report it as `AvgFN'.
Finally, for each ground-truth instance, we find a prediction which overlaps more than 50\% with it. We divide the number of such GT-prediction pairs either by the number of predictions to obtain instance-level precision denoted by `InsPr', or by the number of ground-truth instances to obtain instance-level recall denoted by `InsRe', and report the corresponding F1 score denoted by `InsF1'. Intuitively, `InsPr' and `InsRe' reflect the model's ability to avoid false positive instances and false negative instances respectively at a 50\% threshold. The corresponding `InsF1' score unifies the previous two metrics. `InsF1' score (on the validation set) is the metric we use for selecting our model parameters.
\vspace{-0.4cm}
\paragraph{Quantitative Results.} The evaluation results on our test set are given in Tab.~\ref{tab:metricsTest}. We report results for three instantiations of our model: `LocCNNPred' uses only the local CNN prediction term; `LocCNNPred+InterConnComp' adds the inter-connected component term; while `Full' denotes our full model. Following~\cite{ZhangICCV15}, we additionally apply a few post-processing steps including hole filling, removing tiny isolated regions and splitting the connected components of any prediction into separate instances. This is reported at the bottom of the table.
Notice that without post-processing the model `LocCNNPred' which has only the local CNN prediction term performs much worse than our baselines, because it allows instances that do not coexist in any patch to have the same labeling.
Post-processing removes some of these mistakes and makes the model already outperform the baselines~\cite{ZhangICCV15} in a number of metrics.
With the addition of the inter-connected component term, the model `LocCNNPred+InterConnComp' encourages far apart instances to take different labels, which improves the performance. Finally, our full model which further adds the smoothness term is able to remove noisy regions scattered around the image, especially around instance boundaries where the CNN predictions are not confident. Our full model boosts instance-level precision by a huge margin compared to `LocCNNPred+InterConnComp', outperforming the baselines significantly in a number of metrics.
\vspace{-0.4cm}
\paragraph{Qualitative Results.} We show examples of successes of our model (`Full') without post-processing in \figref{fig:success}.
We compare our full model to ground truth and the baseline `ConnComp' which has the highest `InsF1' score compared to the others.
While the baseline tends to merge neighboring instances into one, our model is more successful in telling them apart. Patch boundary is clearly noticeable in many of the baseline results, while our model prevents this from happening. This suggests that our model exploits the local CNN predictions in a much better way than the baselines.
A few failure cases of our model are shown in Fig.~\ref{fig:failure}, which are largely due to the CNN output. Vehicles like vans that are similar to cars (but not labeled as cars) tend to confuse the CNN, thus introducing false positives into our results. Heavily occluded cars also pose great challenges.
| {'timestamp': '2016-04-28T02:04:16', 'yymm': '1512', 'arxiv_id': '1512.06735', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06735'} | arxiv |
\section{Abstract}
Yelp is one of the largest online searching and reviewing systems for kinds of businesses, including restaurants, shopping,
home services et al. Analyzing the real world data from Yelp is valuable in acquiring the interests of users, which helps to
improve the design of the next generation system. This paper targets the evaluation of Yelp dataset, which is provided in
the Yelp data challenge. A bunch of interesting results are found. For instance, to reach any one in the Yelp social network,
one only needs 4.5 hops on average, which verifies the classical six degree separation theory;
Elite user mechanism is especially effective in maintaining the healthy of the whole network; Users who write less than
100 business reviews dominate. Those insights are expected to be considered by Yelp to make intelligent
business decisions in the future.
\section{Dataset}
The dataset is collected from real Yelp business and is released for academic purpose~\cite{dataset}. It contains 366K user
profiles for a total of 2.9M edges; 1.6M reviews and 500K tips for 61K businesses and aggregated check-ins over time for
each of the 61K businesses. To make the dataset diversity, the data of four countries are included (U.S., UK, Germany and
Canada). All the data are divided into 5 JSON files, which are business, review, user, checkin and tip. The content of these files
are straightforward to understand. Specifically, business file presents the attributes of each business, like the internal unique id of the
business, name, geolocation, categories, et al. The checkin file is a complementary attributes for each business. It presents
the aggregated checkin time for each business in the grain of each hour in a week. User file contains the basic information for
each user, such as yelping time, name, fans and social relationship with other users. Tip and review files are the review of a
particular user to a business. The difference of tip and review is that tip is always short to represent a user's opinion, like
"Don't waste your time." or "Great drink specials!", while review is long enough to allow users express their feedback.
\section{Data Storage}
Due to the size of dataset, it is both time consuming and inconvenient to analyze the statistics without the help of data storage
system. At the same time, it is rather natural to model the network of Yelp using graphs, because users and businesses can be
abstracted as nodes with different properties; review to a business and user friendships can be modeled as the relationships
between nodes. Thus, the graph database is a great fit for this purpose. For this project, we select Neo4j~\cite{neo4j} as the
database as it has a great web UI which makes graph visualization possible and a SQL-like query language (Cypher), which is easy
to learn and use. In our graph, there are two kinds of nodes, \textit{User} and \textit{Business}.
The information used to describe users and businesses are stored as attributes in the node. Three relations exist in
the graph, which are \textit{knows}, used for user friend relationship, \textit{tip} and \textit{review} for user and business
relationships, respectively.
Importing the dataset into Neo4j is all about creating nodes or relationships. However, it is worth to mention two tricks we
made. The first one is used when importing user friendship data into Neo4j. Each user has zero to many friends. To build up
the friendship, what we can do is a straightforward twice scan algorithm. We create each user node without adding the
friendship at the first scan, and build up relationship at the second time. To improve the performance of data importing, we
adopt a scan-once method. The basic idea is when creating a user node, we build up the friend relationship directly.
Specifically, for each friend of a user, a look up is performed in the current graph.
If a node is found, the user node being established and the found node is connected using \textit{knows} relationship,
otherwise, we create a node with label \textit{Person}, which means it will become a user in future, but right now its full
set of properties are not filled. When trying to create a new user, a look up is also necessary. If there is not such a node,
we create a new user, otherwise, the user node exists as a \textit{Person}, and the full information should be filled into the node.
exist as a \textit{Person} node. Another trick that we used to speedup the dataset importing is to create unique index
for both users and businesses because we noticed that the internal user id and business id are unique and there are
a lot of queries made based on their ids.
Although the use of these tricks, the whole importing process is also quite slow. Roughly speaking, it costs us 2 weeks to
import all 366K user basic information and their relationships. Although one can optimize the graph establish using REST API
instead of Cypher, it is left as future work. In order to establish graph quickly and reproduce our experiments results easily,
our database is open sourced using Dropbox, along with the graph establish and analysis codes used in this paper (https://github.com/ycui1984/yelp-data-challenge). Readers who are interested to use our database just need to download the database, extract
in the proper folder and restart the service.
\section{Analysis}
The benefits of using Neo4j is that it simplifies our analysis process by writing simple Cypher queries. For complex
tasks, we created python scripts and used \textit{py2neo} library to manipulate Neo4j.
\begin{figure}[t]
\centering
\caption{Number of Yelp Users against Degree}
\includegraphics[width=0.48\textwidth]{figures/degree-distribution.eps}
\label{fig:degree-dis}
\end{figure}
\subsection{Number of Friends Distribution}
From the high level, we found that there are 2576179 \textit{knows} directed friend relationships among 366715 users.
So, on average, each user has roughly 7 friends. To investigate into the number of friends distribution for each user,
we looked at the number of Yelp users for different degrees, which is shown in Figure~\ref{fig:degree-dis}. In this figure,
we ignore 192621 users with no friends. One thing worth to point out is that x and y axises use the log scale.
As shown in this figure, the degree distribution exhibits the power law phenomenon, which is expected.
In the dataset, the largest degree among all users is 3830. Although there is a hard limit for the largest number of
friends for a user on Yelp (5000)~\cite{limit}, we did not see any user who hits the limit.
\begin{figure}[t]
\centering
\caption{CDF for Number of Hops between Two Nodes}
\includegraphics[width=0.48\textwidth]{figures/hops.eps}
\label{fig:hops}
\end{figure}
\subsection{Hop Length between Users}
The number of hops between users are investigated in this subsection. A classical conclusion about social network is
\textit{six degrees of separation}~\cite{sixdegree}, which means that the average number of hops between every two nodes
is no more than 6. To verify this, we randomly selected 10000 node pairs among all nodes and measured length of shortest
path. Based on the measurement, the cumulative distribution function (CDF) against the number of hops is calculated.
Figure~\ref{fig:hops}
presents the experimental results. As we can see, the CDF curve increases with the number of hops, and stabilizes
at 8 hops. The probability of two users within 8 hops is 21\%. Actually, most of the time (79\%), there is no path
between selected user nodes. One natural reasoning is that two nodes are selected from two separate connected components
when there is no path, otherwise, nodes come from the same connected component. Also, there should be a lot of connected
components such that there is no path between two nodes in a high probability. Based on these conclusions,
we can see the largest number of hops between any two nodes in the same connected component is 8,
which is the diameter of the connected component. The average distance of two nodes in the same connected
component is calculated to be 4.5, which verifies the six degree separation theory. Note that the average path
length is even smaller than most of social networks including Facebook~\cite{facebook}, YoutTube~\cite{imc2007},
and LiveJournal~\cite{imc2007}, which implies that the information in Yelp network spreads faster than other networks.
\begin{figure}[t]
\centering
\caption{Connected Components Distribution}
\includegraphics[width=0.48\textwidth]{figures/ccd.eps}
\label{fig:ccd}
\end{figure}
\subsection{Connected Components Distribution}
To verify our reasoning about the structure of Yelp network, this subsection investigates the distribution of connected
components. To find all components and the number of nodes in each component, we recorded each subgraph encountered
so far. Then, each user node is iterated one by one. For each subgraph, the path existence between the subgraph and
the target node was tested. If there exists a path, the user node is included into the subgraph, otherwise, a new subgraph is
created. Figure~\ref{fig:ccd} presents the experimental results. As expected, there is 192621 connected components where
single user exists. Except that, most of users belongs to a single large connected component, which includes 168917 users.
If we calculate the probability of two user nodes in the same connected component, it is roughly 0.21, which matches
the results in the last subsection.
\begin{figure}[t]
\centering
\caption{Cluster Coefficient and Maximal K-Core}
\includegraphics[width=0.48\textwidth]{figures/coefficient.eps}
\label{fig:coefficient}
\end{figure}
\subsection{Clustering Coefficient and Maximal K-Core}
After understanding the network structure in the high level, the next investigation is how Yelp friends of a particular user
interact with each other. We try to answer interesting questions such as how many of your friends are also friends? To this
end, we measure the average clustering coefficient for users with different degrees. The clustering coefficient for a
graph is calculated by dividing the existing number of \textit{knows} relationships by the total possible number
of relationships. For example, assume there are 4 nodes in a graph, and there are 2 \textit{knows} relationships.
So, the clustering coefficient is $2 / (4*3/2)$ = 0.33. Figure~\ref{fig:coefficient} (labeled as clustering coefficient) shows the results
for users with different degrees. As indicated, the coefficient keeps decreasing with the increasing degree, which
suggests that the more friends one has, the more possible ways one's friends are also friends. Specifically, the total
number of relationships is a number of $O(n*n)$, where n is the number of friends for a user, while the actual graph is
not dense enough to keep up with the total number. To shed light on the structure of the subgraph formed by all friends of
a user, we also measured the average maximal k-core for users with increasing degrees. The k-core of a graph is defined
as the maximal subgraph where each node has k degrees at least. The maximal k-core is to look for a k-core
which maximizes k. The curve labeled as degeneracy in Figure~\ref{fig:coefficient} plots the experimental results.
Overall, the trend is the more friends
one has, the larger the maximal k-core. For instance, if one has 100 friends, the average maximal k-core is roughly 13,
which means there are at least 14 users who knows the other 13 friends of this user. One exception of the curve is
the data point when the degree is 1000. It is larger than that when degree is 3830. After examining the results, we found
that there is only one user who has degree 1000 and 3830. The exception is considered as statistical errors. If enough
users with high degrees exist, the curve is believed to increase continuously.
\begin{figure}[t]
\centering
\caption{Number of Friends of Friends}
\includegraphics[width=0.48\textwidth]{figures/fof.eps}
\label{fig:fof}
\end{figure}
\subsection{Friends of Friends}
One important property of social networks is friends of friends. For example, Linkedin recommends people you may know
if two users share the same friend. Yelp can also benefit from recommending to a user the businesses
that liked by his friends of friends. To this end, the number of unique friends of friends and non-unique friends of friends with
increasing number of degrees are counted. Note that unique friends of friends are a distinct set of user nodes one can
reach by two hops from a user, while non-unique friends of friends are all user nodes that are reachable by two hops.
Figure~\ref{fig:fof} plots the results. Besides, the $k*k$ curve is also presented for comparison, where $k$ is degree.
The common sense is that if one has $k$ friends, then $k*k$ is an estimation of the number of total friends of friends, assuming
that each of his friends has $k$ friends. By adding the $k*k$ curve, one can compare with our estimation. From this
figure, we can see that the number of unique friends of friends and non-unique friends of friends is larger than our
estimation when the degree is smaller than 100 and 200, respectively. Note that the percentage of users whose
degree is smaller than 100 is over 90\%, which suggests that, for most of users in Yelp network, your friends
have more friends than you.
\begin{figure}[t]
\centering
\caption{Average Neighbor's Degree}
\includegraphics[width=0.48\textwidth]{figures/avg.eps}
\label{fig:avg}
\end{figure}
To further prove this conclusion, the average neighbor's degree against degree is presented in Figure~\ref{fig:avg}.
Note that the figure is drawn in log scale for both x and y axises. As can be seen, the average neighbor's degree
keeps increasing when the degree of a user is relatively small, which verifies that your friends has more friends than
you. Once the degree is large enough, the average neighbor's degree becomes smaller. However, this only
happens to a small portion of users.
\begin{figure*}[t]
\centering
\begin{subfigure} [b]{0.45\textwidth}
\includegraphics[width=0.99\textwidth]{figures/stars.png}
\caption{Star Distribution}
\label{fig:star}
\end{subfigure}
\begin{subfigure}[b]{0.45\textwidth}
\includegraphics[width=0.99\textwidth]{figures/review.png}
\caption{Review Distribution}
\label{fig:review}
\end{subfigure}
\begin{subfigure}[b]{0.45\textwidth}
\includegraphics[width=0.99\textwidth]{figures/fans.png}
\caption{Fans Distribution}
\label{fig:fans}
\end{subfigure}
\begin{subfigure}[b]{0.45\textwidth}
\includegraphics[width=0.99\textwidth]{figures/votes.png}
\caption{Votes Distribution}
\label{fig:votes}
\end{subfigure}
\label{fig:dis}
\end{figure*}
\subsection{User Distribution in Stars, Reviews, Fans and Votes}
The distribution of users in terms of four important attributes (stars, reviews, fans and votes)
are evaluated in this subsection. Before going into the details of the results, we introduce how these
attributes are
generated in Yelp. Stars are used to evaluate the quality of a business after a visit. One can give stars from 1 to 5.
The more the better; Reviews are comments from a user to a business, users usually write reviews to
express their opinions; Fans are used when an user likes reviews or comments from another user
(probability because they have similar taste) and wants to receive more recommendations from him;
Votes are comments to a review from a user. Specifically, user can submit a vote of \textit{useful} or
\textit{cool} or \textit{funny} to a review.
Figure~\ref{fig:star}-Figure~\ref{fig:votes} present the distributions of users for each attribute. The following details
the analysis for each attribute. In terms of star distribution, businesses with 4 stars and 5 stars are the most
(41\% and 38\% respectively), which means that businesses collaborated with Yelp are high quality and users
have positive feedbacks to most of these businesses. Note that the results are highly consistent with the
results released in the official website~\cite{yelpdata}.
In terms of review distribution, besides the percentage of users who do not write any reviews, the percentage of
users who write a particular number range of reviews (in the grain of 100) are also presented. As indicated in
Figure~\ref{fig:review}, the percentage of users who do not write reviews are negligible, although 53\% of all
users do not have any friends on Yelp, which implies that review is a well-regarded feature on Yelp.
If we look at the distribution of users who write reviews, it is easy to find that users who write no more than
100 reviews dominate (92\%). This number tells us that although most of Yelp user do write reviews,
most of them do not write a lot.
Figure~\ref{fig:fans} presents the results for fans. The interesting finding is that most of Yelp users (74\%)
do not have any fans, while users with 0 to 100 fans dominate the remaining percentage. From the results,
we know that only a small portion of users actively comment a lot of businesses, which makes them followed
by others. Most of users only care about the businesses that they have ever been experienced, which are limited.
Figure~\ref{fig:votes} shows the user breakdown in terms of votes. Similar to Figure~\ref{fig:review}, users who
vote 0 to 1000 are the largest part (83\%). The second largest part are users who do not vote (15\%). The
total number of votes is also breakdown according to \textit{useful}, \textit{cool} and \textit{funny}. The percentage
for each category is 48\%, 27\% and 25\%, respectively. Among these three words, only \textit{funny} is
negative in tone. Thus, most of the time(75\%), Yelp users satisfy with the quality of reviews.
\subsection{Effectiveness of Elite User Mechanism}
A famous mechanism used to encourage review writing on Yelp is elite members~\cite{elite}. If one becomes
elite user successfully, he or she will be invited to many epic parties for free, which are not available for common
users. Any Yelp user can apply for a elite user, but there is a community to decide whether the application passes
or not. Without doubt, elite users should be very active in many aspects such as review writing, commenting
reviews from others and making friends on Yelp, although the internal algorithm to decide elite users are not
available to the public. This subsection measures the effectiveness of elite user mechanism, which we believe
important to Yelp because if elite users are not much more important than common users, Yelp should stop the
investment to elite users as soon as possible to save cost.
\begin{figure}[t]
\centering
\caption{The Percentage of Elite Users against Years}
\includegraphics[width=0.48\textwidth]{figures/elite.eps}
\label{fig:elite}
\end{figure}
Before introducing the details of measurement, let us look at the percentage change of elite users against years.
Figure~\ref{fig:elite} presents the experimental results. As shown in the figure, there is an increase of the percentage
in 2005, and the curve keeps decreasing since then. At 2005, the percentage is more than 50\%, while it is
even smaller than 1\% in 2014. Note that Yelp is established in 2004. The curve suggests that at early stage of
Yelp, the company uses this mechanism to engage users. Once the reputation is established, the increase of
elite users is much slower than the increase of common users.
Next, we start to measure the effectiveness of elite user mechanism. Our methodology is to collect several
metrics of elite users and compare them to average users.
The first metric is the average number of fans for elite users, which is calculated to be 16. For all users, the average
number of fans is 1.6, which is significantly smaller than 16. Next, we look at the average number of reviews written.
The experimental results for elite users and all users are 245 and 32, respectively. Again, the metric for elite users
is much better than the average of all users. The third metric we used is the average number of votes. The number is
1336 for elite users and 122 for all users. Finally, we compare the average degree for elite users. The result is 55, which
is much larger than the average(7). From these four metrics, one can find elite users own significantly more fans
(10$\times$), write much more reviews (7.6$\times$), comments more than others(10.9$\times$), and has more friends
(7.8$\times$). In another word, elite users are much more active in the community. Next, we try to answer an interesting
question. Do elite users give more or less stars for a business, compared to common users?
Similar to metrics collected, the average of stars given by
elite users is 3.78, while the average is 3.72, when considering all users as a whole. Although the value for elite users
is higher, it is rather close to the average of all users. This result implies that elite users are famous for their activeness
in the community(like the quality of reviews), instead of giving stars which are out of exceptions. Another insight of the
measurement to elite users is that Yelp community can develop a machine learning model by the use of our metrics,
which helps to decide whether an application for elite user passes or not, instead of evaluating it manually.
\section{Related Work}
During the several rounds of Yelp challenge, a lot of interesting works are done to make use of the dataset.
For instance, Bakhshi \textit{et al.} use the dataset to understand the difference of review feedbacks including
\textit{useful}, \textit{cool} and \textit{funny}~\cite{cscw}. Lee \textit{et al.} targets for a multidimensional model,
which are used to find expert (elite users) on Yelp~\cite{expert}. The model uses review text, network structure,
and user metadata to find elite users. Their conclusion was the model needs to consider all information together
to improve the accuracy of the model. In this paper, we also find several efficient indicators for elite users,
which are complementary to their work. Crain~\textit{et al.} analyzed the elite users in terms of the network
structure, where they found elite users are \textit{super-connectors} in Yelp~\cite{stanford}.
The results are consistent with ours. Besides, a lot more analysis are provided in our work. Tanvi Jindal proposed
to find local experts by the use of machine learning~\cite{local}, while our focus in this paper is to analyze the
dataset, find useful insights and be helpful to the design of next generation online review system.
\section{Conclusion}
This paper presents analysis results for Yelp dataset. Our main focus is user related data, such as the social network
formed by users and attributes in user nodes. We did not investigate the user behaviors of visiting a business and Yelp
reviews, which are believed to be valuable. These parts are left in future work.
\bibliographystyle{plain}
| {'timestamp': '2015-12-29T02:00:39', 'yymm': '1512', 'arxiv_id': '1512.06915', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06915'} | arxiv |
\section{Introduction}
First described in 2004, the cardiac biopsy-derived progenitor cells, growing in vitro as ``niche''-like microtissue, known as {\em Cardiospheres} (CSps), represent a widely adopted platform technology holding great promise to realize a powerful cell therapy system, in vitro drug screening and disease modeling opening new opportunities for myocardial repair \citep{mess,circul,cheng}. To achieve this goal, an optimal management of qualitative and quantitative CSps growth-modifying factors in terms of cell proliferation, differentiation and interaction with the external environment has to be known. It requires a simulator of the features and the fate of the Cardiospheres-niche-system which is based on new as well as already existing experimental biological data and on reliable mathematical models.
Our aim is to model the formation and differentiation of the original 3D cardiac biopsy-derived heart progenitors in vitro system, that is the CSp. These structures are cellular spheroids with a central nucleus of less differentiated elements surrounded by outer layers of cells more committed toward different levels of cardio-vascular differentiation with other proliferation features (Figure \ref{fig1_a}). Their individual formation in vitro starts from a few (low differentiated and less specialized) progenitor cells which are cultured in a carefully chosen environment and under specific conditions \citep{mess,chim1}, and have the potential to develop into a more cardiac-specific differentiation which, unless derived from pre-natal hearts, are no longer able to achieve a terminal level of contractile cardiomyocytes.
The major types of molecular processes that control cellular differentiation and proliferation involve various physical factors, nutrients and cell signaling. During the multiple stages of development, the cell size and shape changes dramatically, as a response to signaling molecules \citep{brown,agath}.
\begin{figure}
\centering
\subfigure[]{\includegraphics[width=0.5\textwidth]{figure/stem_cell1.png}\label{fig1_a}}\hspace{-1.5 cm}
\subfigure[]{\includegraphics[width=0.5\textwidth]{figure/stem_cell2.png}\label{fig1_b}}
\caption{(a) A CSp by immunofluorescence after 3 days: a cluster of immature stem cells (green) is localized in the central core of Cardiospheres, surrounded by differentiated supporting cells (red). Blue spots indicate cell nuclei, and cells inside the black area (non labeled) are to be intended in an intermediate level of differentiation, see also Section \ref{sec:problem} (source from \citealp{cheng}, by courtesy of John Wiley \& Sons). (b) An example of a numerical simulation of our mathematical model showing a CSp at 3 days. Green, blue and red colors mark respectively three increasing degrees of maturation of a single cell (see Section \ref{sec:numeric} for further details).}
\label{fig1}
\end{figure}
This biological environment is similar to that of tumor spheroids as described in \citet{wall}. Neoplastic cells hold several growth strategies, such as genetic mutation of cell cycle inhibitors, neoangiogenesis, etc., and cannot be directly compared with those more limited of the adult cardiac progenitors. Nevertheless both of the 3D cellular growth mechanisms share some common features. CSps and neoplastic spheroids hold more than two functional phenotypes (proliferating, quiescent, differentiating, dying). The growth in a form of a 3D sphere limits the diffusion of the nutrients and oxygen and leads to the formation of a central core of death cells as a consequence of necrosis, apoptosis and anoichisis (Figure \ref{fig2}). It is well known that in tumors the fastest proliferating cells are present in the intermediate and external layers forming the so-called growing front. On the contrary, in small and medium CSps the highest rate of the proliferation is observed in the central area due to the hypoxic conditions, which are closer to those corresponding to the pre-natal developing heart.
However, while the spheres become larger the necrotic core appears as in tumors.
\begin{figure}
\centering\includegraphics[width=0.5\textwidth, angle=0]{figure/image09_single22.jpg}
\caption{Histological preparation of CSps ultra-thin slices. Hemathoxilin-eosin staining shows a nuclei-free central necrotic area more evident in larger CSps.
}
\label{fig2}
\end{figure}
In this paper we introduce a discrete in continuous non-deterministic model to simulate the growth of a CSp aggregate. We treat the various biological constituents using different levels of description: on the cellular scale we adopt a discrete description, while on the molecular scale chemical signals are considered as continuous variables \citep{anderson,preziosi}. This choice is justified by the relatively small number of cells involved in the formation of CSps, for which the hypothesis of the continuum does not hold, and by the much smaller size of the molecules with respect to them. Similar approaches have been adopted in analogous cell systems, for instance in relation to the modeling of tumor growth (\citealp{enderling2012,kim,osborne2010,Chaplain2011,fletcher2015}, and references therein) or, recently, to describe the morphogenesis of the lateral line in the zebrafish embryo \citep{dicostanzo1}, and to study the behavior of the collective motion of cells under chemotaxis and alignment effect \citep{dicostanzo2}. With particular regard to the stem cell cultures, in \citet{wu} a continuous diffusion--reaction mathematical model is proposed to investigate oxygen transport and distribution in embryonic stem cell aggregates, also in comparison with experimental data.
Our proposed mathematical model relies on a hybrid description: each cell is described separately by a system of ordinary differential equations, which take into account the self--organizing interactions between cells, through typical terms of collective dynamics and chemotaxis effects (see for instance the reviews by \citealp{vicsek-collective,vicsek-collective-cell}); at a macroscopic level, by reaction-diffusion equations, we describe the concentrations of oxygen, as a representative of nutrients essential for cells metabolism, and of a growth factor TGF-$\beta$ (Transforming-Growth-factor-$\beta$), as a chemoattractant and main regulator of the cell differentiation, secreted by the cells and also present in the environment. Additionally, to model the formation of the Cardiosphere, we introduce two processes, the cell proliferation and differentiation, which lead to the growth and maturation of an initial cell cluster. Moreover, we distinguish three differentiation levels of cell maturation, which also influence the two aforesaid processes.
Moreover they are regulated by the local concentrations of oxygen and TGF-$\beta$. Another crucial feature of our model is the stochasticity. It is motivated by the so called noise in biological systems and the averaging of cells characteristics. The former is mainly due to the genetic diversity among individual cells, random collisions and thermal fluctuations in chemical reactions and randomness of various external factors, see \citet{Tsimring}. The latter concerns the simplifications introduced in our model, such as the uniform size of cells, equal maturation time or signal sensing. The randomness of the biological phenomena in our model is present in the proliferation and differentiation processes. When the necessary conditions are satisfied cells divide or pass to a higher differentiated level with some probability, which increases if the conditions are favorable.
Using the proposed mathematical model we have simulated the formation of a Cardiosphere in a two--dimensional setting. After a careful sensitivity analysis of the model parameters we were able to obtain numerical results comparable with the existing biological experiment: see again Figure \ref{fig1}, in which the structure and composition of the two images, real experiment (a) and numerical simulation (b), are in good agreement. In order to meet the need of biological research and possible therapeutic applications (including the achievement of a more advanced differentiation level) we have analyzed the development of the Cardiosphere at two typical experimental concentration of oxygen.
The paper is organized as follows: in Section~\ref{sec:problem} we present the general setting of the problem and the mathematical framework used throughout the paper. In Section~\ref{sec:model} we describe in detail the mathematical model for the cells and nutrients dynamics, together with the stochastic mechanisms of cell proliferation and differentiation. Section~\ref{sec:numeric} contains the numerical results and relative biological interpretations. Finally, Section \ref{conclusion} is devoted to the conclusions and possible future perspectives.
\section{Formulation of the problem}\label{sec:problem}
The in vitro 3D CSp formation starts from a low-density seeding of the explants-biopsy-derived cells in a defined culture conditions. First,
adhered to the culture dish bottom the individual stem cells start to
aggregate in small clusters of very few elements. Reaching certain dimensions they detach and grow immersed in a liquid environment and in a controlled gas atmosphere, which contain substances essential for their metabolism.
In our model we have reduced to two the biological and physical variables affecting the CSps growth and differentiation: the oxygen, representing nutrients and gases, and the TGF-$\beta$ which is present in the culture medium and is produced by the cells themselves. The latter represents a key modulator of the main pathway involved in the induction of the non-terminal differentiation level achieved in our basic experimental conditions \citep{forte}.
We assume that during the formation of a CSp, the cells are subject to two basic cellular processes, the proliferation and the differentiation,
which depend, with some probability, on the type of a cell and on the local availability of oxygen. Moreover, we consider three different increasing differentiation levels for living cells and, separately, dead cells. The complex differentiation mechanism is triggered by a large enough
concentration of TGF-$\beta$, is hindered by the presence in the closest proximity of a large number of
cells of the same type
and is inhibited when the concentration of oxygen
drops below a threshold value (see Section \ref{sec:prol_diff}).
To describe the formation of CSps in the next section we propose a hybrid model, in which cells are
considered as discrete entities while oxygen and TGF-$\beta$ concentrations are continuum variables. We assume that in the absence of specific signals the cell dynamics is due to attractive-repulsive forces and friction effect, taking place isotropically. The TGF-$\beta$, produced by the cells and also present in the external medium, is a chemoattractant for cell which moves towards its higher concentrations. For computational simplicity a two-dimensional description is adopted.
\subsection{Mathematical notations and operators}\label{sec:mathematical_model}
In a Cartesian coordinate system, let us consider a rectangular domain $\Omega$, which in our model represents a limited portion of the culture (containing many CSps) with a single cluster of stem cells in its center (Figure \ref{fig3}). For this reason in the following we can assume periodic boundary condition in relation to the equations of the model.
\begin{figure}
\centering\includegraphics[width=0.45\textwidth]{figure/cardiosfera_dominio.png}
\caption{Experimental picture of a culture of CSps. The dotted red line indicates the portion chosen as possible domain $\Omega$ for a single CSp in our mathematical model.}
\label{fig3}
\end{figure}
At the initial time, $N_0$ cells at the same maturation level (Section \ref{sec:prol_diff}) and radius $R$ (for simplicity all cells are assumed to have the same constant radius) are placed randomly at positions $\bfm X_i, \, i=1,2,...,N_0$ at the center of the domain. In the following, due to proliferation, the number of cells at the time $t$ will be denoted by $N(t)$. In the model we denote by $c(\mathbf{x},t)$ and $S(\mathbf{x},t)$ the concentrations of oxygen and TGF-$\beta$ respectively, and in the numerical simulations these variables are discretized on a uniform spatial mesh. In general, the cell position $\bfm X_i$ does not coincide with a mesh grid point, and we have to ``approximate'' the value of $c(\bfm X_{i}, t)$.
In general, a cell ''feels'' the presence of chemical substance (or a signal) $h(\bfm X_i, t)$ not only at the center $\bfm X_i$, but also in its proximity. To model this graded influence, a weighted average operator is defined:
\begin{equation}\label{eq:operator}
\mathcal{F}(h(\bfm X_i,t)) = \frac{1}{W}\int_{B(\bfm X_i,\bar{R})} w_i(\bfm x) h(\bfm x,t)\, d \bfm x,
\end{equation}
where:
\begin{equation}
W:=\int_{B(\bfm X_i,\bar R)} w_i(\mathbf{x})\,d\bfm x,
\end{equation}
and a possible choice for the weight function can be a truncated Gaussian
\begin{equation*}
w_i(\bfm x) :=
\left\{\begin{array}{ll}
2 \exp\left(-|| \bfm x-\bfm X_i||^2 \displaystyle\frac{\log 2}{\bar R^2}\right) -1, &\quad\textrm{if } || \bfm x- \bfm X_i|| \leq \bar R,\\
0, &\quad\textrm{otherwise},
\end{array}
\right.
\end{equation*}
which models a sensing intensity decreasing on the distance from the cell center. Here $\bar R$ represents an influence radius, possibly greater than the cell radius $R$ (Table \ref{tab-param-dim}), and
\begin{equation*}
B(\bfm X_i,R):=\{ \bfm x: || \bfm x- \bfm X_i || \leq R\}
\end{equation*}
is the ball centered in $\bfm X_i$ with radius $R$. In the following the characteristic function over the ball $B(\bfm X_i,R)$ is defined as:
\begin{equation*}
\chi_{_{B(\bfm X_i,R)}} := \left\{\begin{array}{ll}
1, &\quad \textrm{if } \bfm x \in B(\bfm X_i,R), \\
0, &\quad \textrm{otherwise}.
\end{array}\right.
\end{equation*}
\section{The mathematical model}\label{sec:model}
In this section we present in detail the discrete in continuous model for the formation of a Cardiosphere. Firstly, we present the equations describing the movement of cells and the forces acting on them. Then we focus on the proliferation and differentiation processes. The basic mechanisms of the phenomena are explained and the reaction-diffusion systems for the time evolution of the oxygen and TGF-$\beta$ concentrations are given.
\subsection{Cells dynamics}
Motion of cells
is the result of mechanical forces acting on them and of their reciprocal interactions. Due to the finite volume of cells there is an internal pressure between them which leads to repulsion
while being compressed. On the other hand, there are attractive bonds between cells which keep them in contact. We also assume that cells are driven by a chemotactic signal,
that is they move toward the higher gradient of the TGF-$\beta$ concentration,
and are slowed down because of the viscosity of the medium in which they are immersed \citep{rubinstein,fournier,bayly}.
The position of the $i$-th cell $\bfm X_{i}$ follows Newton's law and is described by the second order ordinary differential equation
\begin{equation}
\ddot {\bfm {X}}_{i} =\sum_{j:\mathbf{X}_j\in B(\mathbf{X}_i,R_2)\backslash\left\{\mathbf{X}_i\right\}}\bfm {K}( \bfm {r}_{ij}) - \mu \dot {\bfm {X}}_i + \alpha \mathcal{F}(\nabla S(\bfm{X}_i,t)) \label{eqn5},
\end{equation}
where dot denotes time derivative, $\mu$ is a friction coefficient for unit mass
and $\bfm{ K}(\bfm {r}_{ij})$ is the attraction-repulsion force for unit mass between i-th and j-th cell, defined as
\begin{equation}\label{attr-rep}
{\bfm K(\bfm {r}_{ij})}:=\left\{
\begin{array}{ll}
\displaystyle - k_1 \left(\displaystyle\frac{1}{||\bfm r_{ij}||} - \displaystyle\frac{1}{R_1}\right) \displaystyle\frac{\bfm r_{ij}}{||\bfm r_{ij}||},&\quad ||\bfm r_{ij}||\leq R_1,\\
\\
\displaystyle k_2(||\bfm r_{ij}||-R_1)\displaystyle\frac{\bfm r_{ij}}{||\bfm r_{ij}||},&\quad R_1<||\bfm r_{ij}||\leq R_{2}.
\end{array}\right.
\end{equation}
The parameters $k_1$, $k_2$ are positive constants, $\bfm r_{ij}=\bfm X_j-\bfm X_i$ is the distance
between cells, $R_1=2R$ and $R_2$ (to be chosen later, see Table \ref{tab-param-dim}) are the radii of repulsion and attraction respectively. Note that equation \eqref{attr-rep}$_1$ gives a repulsion in the form $1/r$, while \eqref{attr-rep}$_2$ is a linear
attractive elastic force.
Similar terms can be found in the model proposed in \citet{dorsogna,joie}.
Equation (\ref{eqn5}) is augmented with the initial conditions
\begin{equation*}
\bfm X_i(0)=\bfm X_i^0, \qquad \bfm{\dot X_i}(0)=\bfm V_i^0=\bfm {0}.
\end{equation*}
\subsection{Proliferation and differentiation}\label{sec:prol_diff}
Some of the present authors has been investigating the proliferation and differentiation dynamics of cells forming CSps from the original description of the method of isolation and expansion of human cardiac progenitors from heart biopsy \citep{mess}. Confocal analysis of the BrdU labeled cells which incorporate the base analogue within the replicating DNA, showed the positive fluorescence labeled cells located in the inner of the growing spheres. No or a weak signal was present in the external layers of more differentiated cells (that cannot replicate at the same speed). This kind of layered growth implies that the proliferation in the central area depends also on the CSps size and the core-cells may become quiescent or die by necrosis or apoptosis.
It is worth noting that tumor spheroid growth depends (at least partially) on the same factors, however, in this case they show a more pronounced variety of final volumes for any given cell line. We can distinguish an early phase of global undifferentiated mass, a second stage of a shell of proliferating cells around a central area of quiescent elements and the last stage in which an inner necrotic/apoptotic core is enveloped by the previous two. The external layer always represents the growing front \citep{kim}.
Stem cells are characterized by different levels of maturation (differentiation). To model this feature we mark the $i$-cell with a label $\varphi_i(t) = {1,2,3,d}$, called its ``state''. The state $\varphi=d$ indicates dead cells or the space occupied by necrotic mass (due to adverse biological conditions, as oxygen deficiency for a sufficiently long period of time). Note that apoptosis, which is a programmed cells death, occurs over a longer timescale and is not considered here. In particular, we introduce a threshold concentration $c_d$ such that whenever $\mathcal{F}(c(\mathbf{X}_i,t))>c_d$ cell survives, otherwise it dies. Such cell is marked as dead ($\varphi=d$) and does not take part in further evolution of the CSp, that is it neither proliferates nor differentiates. However, dead cells do occupy a volume and exert attractive-repulsive forces on other cells. A stochastic process introduced in the process of proliferation and differentiation models also the presence of quiescent cells. Such cells neither proliferate nor differentiate but, in contrast to dead cells, this state results from environment conditions and is only temporary. At a later time a quiescent cell can restart its functions.
For a living cell, $\varphi=1$ denotes the lowest degree of maturation (the least differentiated cells), while $\varphi=2,3$ are the intermediate and the highest degrees of differentiation, respectively. They can be experimentally reached with our previously cited method \citep{mess,chim1}.
Finally, we define a {\em cell cycle time $T_c$}, i.e. a cell maturation time after which the cell may proliferate and/or differentiate with some probability.
\subsubsection{Mechanism of differentiation}\label{sec:diff}
In the model we assume that, with some probability and when {\em environment} conditions are satisfied, from time $t$ to time $t+\Delta t $ a cell can
change its state to a higher one
by a unity according to Table~\ref{Tab:differentiation}, or can die (as described in Section \ref{sec:proliferation}).
\begin{table}[htbp!]
\centering \begin{tabular}{|c||c|c|c|}
\hline
& $\varphi_i(t+\Delta t)=1$ & $\varphi_i(t+\Delta t)=2$ & $\varphi(t+\Delta t)=3$ \\ \hline\hline
$\varphi_i(t)=1$& \checkmark & \checkmark & \\
\hline
$\varphi_i(t)=2$& & \checkmark & \checkmark \\
\hline
$\varphi_i(t)=3$& & & \checkmark
\\ \hline
\end{tabular}
\caption{Possible differentiation levels reached by a cell. The check marks the admissible transition at time $t+\Delta t$ for each cell state on the first column.}
\label{Tab:differentiation}
\end{table}
More precisely, the differentiation is triggered by chemical signals, such as TGF-$\beta$ present in the extracellular environment and secreted by cells themselves. Moreover, it can be inhibited due to the presence, in the surrounding area, of cells of the same type, as we can found in similar cell systems \citep{itoh,matsuda} and mathematical models (e.g. \citealp{dicostanzo1}). We denote by $\Gamma_i$ an inhibitor indicator function, which depends on the number $n_i$ of cells in the neighborhood of the i-th cell and is defined as
\begin{equation*}
\Gamma_i(t)=
\left\{
\begin{array}{ll}
1, \quad & \text{if } n_i \leq \bar{n}, \\
0, \quad & \text{if } n_i > \bar{n},
\end{array}
\right.
\qquad n_i:=\text{card}\{j:\bfm X_j\in B(\bfm X_i,R_4)\},\qquad i=1,\dots,N.
\end{equation*}
For the threshold $\bar{n}$ we set in the following the value $\bar{n}=4$ for a two dimensional case.
We define a differentiation threshold
\begin{equation} \label{prob-q}
q_i(t):=
\displaystyle\frac{\sigma(\varphi_i) \cdot \mathcal{F} (S(\bfm X_i,t)) \cdot \Gamma_i(t) }{ S_{\max}}, \qquad\qquad i=1,\dots,N,
\end{equation}
for the cell $i$, with $\sigma(\varphi_i)$ ($\varphi_i=1,2$) positive constants, and $S_{\max}$ the experimental maximum value of TGF-$\beta$ (Table \ref{tab-param-dim}). In addition, we assume that differentiation occurs under the condition that oxygen concentration level is above a given threshold value $\bar c (\varphi_i)$, also depending on the cell states $\varphi_i=1,2$.
\par The differentiation variable $\varphi_i(t)$ can be modeled as a non-homogeneous Poisson process with variable intensity $q_i(t)$ (see for example \citealp{anderson2015} and references therein, as well as \citealp{kushner}). In particular, the probability of a differentiation in a time interval $\Delta t$ is given by
\begin{align}
P(\varphi_i(t+\Delta t)-\varphi_i(t)\geq 1)\approxeq q_i(t)\Delta t,
\end{align}
the expected number of differentiations in the interval $(t,t+\Delta t)$ is
\begin{align}
E\left(\text{number of differentiations in $(t,t+\Delta t)$}\right)= q_i(t)\Delta t,
\end{align}
therefore in the time interval $(0,t)$ results
\begin{align}
E\left(\text{number of differentiations in $(0,t)$}\right)= \int_0^t q_i(s)\,ds.
\end{align}
Finally, we write the stochastic equation
\begin{align}\label{eq-stoc-phi}
d\varphi_i=d\mathcal{P}\left(\int_0^t q_i(s)\,ds\right),\quad i=1,\dots,N,
\end{align}
$\mathcal{P}(\int_0^t q_i(s)\,ds)$ being a inhomogeneous Poisson process with intensity $q_i(t)$.
\par In practice, if $\mathcal{F} (c(\bfm X_i,t))\geq \bar c (\varphi_i)$, starting from \eqref{eq-stoc-phi}, we compute the threshold \eqref{prob-q}, and we can adopt the following stochastic rule: cell types $\varphi_i=1$ and $\varphi_i=2$ switch irreversibly their state according to
\begin{equation}
\varphi_i(t+\Delta t) = \varphi_i(t)+
\left\{
\begin{array}{ll}
1, &\quad\textrm{if } \bar q_i < q_i \Delta t, \\
0, &\quad\textrm{otherwise},
\end{array}\right. \qquad i=1,\dots,N,
\end{equation}
where $\bar{q}_i$ is a random number between 0 and 1 (see also Section \ref{sec:numeric}).
\subsubsection{Mechanism of proliferation}\label{sec:proliferation}
We introduce the proliferation thresholds $p_i(t)$ of the i-th cell at time $t$ in the following form
\begin{equation}\label{prob}
p_i(t) = \left\{\begin{array}{ll}
g_1(\mathcal{F}(c)),&\quad\textrm{if }\varphi_i(t)=1,\\
g_2(\mathcal{F}(c)),&\quad\textrm{if }\varphi_i(t)=2,\\
g_3(\mathcal{F}(c)),&\quad\textrm{if }\varphi_i(t)=3.\\
\end{array}\right.
\end{equation}
Functions $g_1, g_2, g_3$ describe the dependence of the rate of proliferation on the concentration of oxygen. Least differentiated cells, i.e. those at state $\varphi=1$, work under anaerobic conditions. Their proliferative ability increases at low levels of oxygen with an assumed gaussian-type dependence. When $c$ is too high, cells change their metabolism and proliferate at a lower rate. Cells at states $\varphi=2,3$ behave on the opposite: their proliferation rate increases with higher concentration of oxygen. However, due to the fact that they are already differentiated, their ability to proliferate is lower than the stem cells at $\varphi=1$. As a consequence, a possible choice for functions $g_1, g_2, g_3$, used in the numerical simulations, is shown in Figure~\ref{fig4}. If, for certain interval of time, the concentration of oxygen is below a given threshold $c_d$, then cells do not have enough resources to live and die. \par
To model stochasticity in proliferation, we introduce a new state variable $\phi_i(t)$ denoting the number of
(from $i-th$) generated cells in $(0,t)$.
Similarly to the differentiation (Section \ref{sec:diff}), $\phi_i(t)$ satisfies a non-homogeneous Poisson process:
\begin{equation}
d\phi_i=d\mathcal{P}\left(\int_0^t p_i(s)\,ds\right),\quad i=1,\dots,N, \label{ery}
\end{equation}
with variable intensity $p_i(t)$ given by equation (\ref{prob}).
\begin{figure}[htbp!]
\centering\includegraphics[scale=.70, angle=0]{figure/proliferation_curves2.pdf}
\caption{Proliferation thresholds as a function of oxygen concentration (equation \eqref{prob}).}
\label{fig4}
\end{figure}
If $\mathcal{F}(c(\mathbf{X}_i))>c_d$, we compute the proliferation threshold of the i-th cell $p_i$ through equation (\ref{prob}). The following computational rule of proliferation is applied:
\begin{equation}
\phi_i(t+\Delta t) = \phi_i(t)+
\left\{
\begin{array}{ll}
1, &\quad\textrm{if } \bar p_i < p_i \Delta t, \\
0, &\quad\textrm{otherwise},
\end{array}\right. \qquad i=1,\dots,N,
\end{equation}
where $\bar{p}_i$ is a random number between 0 and 1 (see also Section \ref{sec:numeric}).
When a cell proliferates, a newborn $(N+1)$-th cell appears and is appended to the vector of coordinates $\bfm X_i$, $i=1,2,\dots,N$. Its position $\bfm X_{N+1}$ is generated randomly within the distance $r$ from the mother cell
and with same velocity. More precisely, in polar coordinates we choose randomly two numbers: the angle $\theta\in[0,2\pi]$ and the distance between the two centers $r\in[R/2,R]$.
\subsection{Dynamics of oxygen and TGF-\texorpdfstring{$\beta$}{beta} signal}
The concentration of oxygen $c=c(\mathbf{x},t)$ is a continuous variable and its time evolution is governed by a reaction-diffusion equation:
\begin{equation}\label{eqnoxy}
\left\{
\begin{array}{ll}
\displaystyle \partial_{t} c = \nabla \cdot (D_c \nabla c) - \sum_{i=1}^{N}\frac{ \lambda (\varphi_i) c^{\gamma+1}}{k(\varphi_i) + c^{\gamma+1} } \chi_{_{B(\mathbf{X}_i,R_3)}} + H \bar{B} (c_0 -c),& \\\\
\displaystyle c(\mathbf{x},0)=c_0, &\quad \text{in } \Omega, \\\\
\mbox{periodic boundary conditions,} &\quad \text{on } \partial\Omega,
\end{array}\right.
\end{equation}
with $c_0$ the environmental (constant) concentration. The last term in equation (\ref{eqnoxy})$_1$
models the two-dimensional representation of the real 3D experiment: the
supply of oxygen coming from the environment (upper surface of the culture) is recovered as a source term, modeled as proportional to the difference $c_0-c$ with rate $H$,
and spatially modulated by a well-shaped function over the CSp geometry, in the form
\begin{align}\label{eq:well}
\bar{B} (\bfm x):=
\left\{
\begin{array}{ll}
\displaystyle \frac{\exp \left[\zeta \left( \displaystyle \frac{r(\bfm x)}{ R_{\text{CSp}}}
\right)^2 \right] -1 }{\exp(\zeta) -1},&\quad \text{if }r\leq R_{\text{CSp}},\\
1,&\quad \text{otherwise}.
\end{array}
\right.
\end{align}
The constant $\zeta$ is a constant geometrical parameter, $r(\bfm x)$ is the distance from the center of the sphere, and $R_\text{CSp}$ is the mean radius of CSp at time $t$. The shaped function \eqref{eq:well} considers the graded exposition to oxygen of cells at different depth. In the equation (\ref{eqnoxy}) we
assume that oxygen diffuses in the environment and is consumed by cells with a rate depending on the metabolism of the cell (i.e. on its state $\varphi_i$), and
increases with the oxygen availability ($ \propto c^{\gamma}, \, \gamma>0$) according to the saturation Michaelis-Menten-like
law \citep{wu}. A typical value $\gamma=1/2$ is assumed. Degradation of the oxygen is negligible over the typical time scale (few days) of the experiment.
The concentration of the chemical signal $S(\mathbf{x},t)$ is governed by the similar IBV problem
\begin{equation}\label{eqntgf}
\left\{
\begin{array}{ll}
\partial_{t} S = \nabla \cdot ( D_{S} \nabla S) + \displaystyle\sum_{i=1}^{N} {\xi (\varphi_i) \chi_{_{B(\mathbf{X}_i,R_3)}}} - \eta S, & \\\\
S(\mathbf{x},0)=S_0, &\quad \text{in } \Omega, \\\\
\mbox{periodic boundary conditions,} &\quad \text{on } \partial\Omega,
\end{array}
\right.
\end{equation}
where $\xi$ is the (state dependent) $S$-release rate, $\eta$ is the molecular degradation rate and $D_S(\bfm x)$ is a diffusion coefficient
Compared with the production term, a possible $S$-consumption term is extremely low and has been neglected.
In addition, the diffusivity coefficient $D$ (say $D_c$ in equation (\ref{eqnoxy}), $D_S$ in (\ref{eqntgf})) varies in relation with the change of cell density, which we measured
in a reference volume.
Due to the presence of a large number of cells, $D$ is significantly reduced at the center of the CSp. Diffusion can be considered as in a porous medium, and the \emph{effective diffusivity}
$D(\bfm x)$ can be defined as: \\
\begin{displaymath}
D(\bfm x):= \frac{D^{\max}}{1 + \rho \bar A(\bfm x)},
\end{displaymath}
where $D^{\max}$ is the constant unperturbed diffusion, $\rho$ is a compactness parameter and $\bar A (\bfm x)$ is the occupancy fraction in a proper control volume containing $\bfm x$.
\section{Numerical results and discussion}\label{sec:numeric}
In this section we present numerical simulations of a typical formation and growth of CSps, under typical conditions \citep{mess,chim1}, using the previously described mathematical model.
For convenience we summarize here our hybrid system of equations:
\begin{align}\label{eq:complete}
\left\{
\begin{array}{ll}
\ddot {\mathbf{X}}_i &=\displaystyle\sum_{j:\mathbf{X}_j\in B(\mathbf{X}_i,R_2)\backslash\left\{\mathbf{X}_i\right\}}\bfm {K}( \bfm {r}_{ij}) - \mu \dot {\bfm {X}}_i + \alpha \mathcal{F}(\nabla S(\bfm{X}_i)), \\\\
d\varphi_i&=d\mathcal{P}\left(\displaystyle\int_0^t q_i(s)\,ds\right), \\\\
d\phi_i&=d\mathcal{P}\left(\displaystyle\int_0^t p_i(s)\,ds\right), \\\\
\displaystyle \partial_{t} c &=\displaystyle \nabla \cdot (D_c \nabla c) - \displaystyle \sum_{i=1}^{N}\frac{ \lambda (\varphi_i) c^{\gamma+1}}{k(\varphi_i) + c^{\gamma+1} } \chi_{_{B(\mathbf{X}_i,R_3)}} + H \bar{B} (c_0 -c), \\\\
\partial_{t} S &=\displaystyle \nabla \cdot ( D_{S} \nabla S) + \displaystyle\sum_{i=1}^{N} {\xi (\varphi_i) \chi_{_{B(\mathbf{X}_i,R_3)}}} - \eta S,
\end{array}
\right.
\end{align}
where $\bfm {K}( \bfm {r}_{ij})$ and $\mathcal{F}(\nabla S(\bfm{X}_i))$ are given respectively in \eqref{attr-rep} and \eqref{eq:operator}, while $q_i$ and $p_i$ given by \eqref{prob-q} and \eqref{prob}. Initial and boundary conditions are given by:
\begin{align*}\label{boundary1}
\bfm X_i(0)&=\bfm X_i^0, \qquad \dot{\bfm{ X}}_i(0)=\bfm {0},\\
N(0)&=N_0,\qquad\varphi_i(0)=1, \qquad \forall i=1,\dots,N_0,\\
c(\mathbf{x},0)&=c_0, \qquad \text{periodic boundary conditions on $\partial\Omega$},\\
S(\mathbf{x},0)&=S_0, \qquad \text{periodic boundary conditions on $\partial\Omega$}.
\end{align*}
Initially, we consider a cluster of $N_0=15$ cells at the first stage of differentiation ($\varphi_i=1$, $\forall i$) placed at the center of a square domain $\Omega=[0,225]\times [0,225]\,(\mu\text{m}^2)$. Such setting models the initiation of the numerical simulation at the time that corresponds to about 24 hours of the real experiment.
Despite the low geometrical dimension and a number of simplifying assumptions, the large set of biological parameters influences the problem and their complete characterization remains a difficult task. Each parameter is interconnected with the others and strongly affects the simulation. Some of them are taken from previously published results or literature, others are chosen in a compatible and consistent range, and the remaining ones are varied to analyze the sensitivity of the system. The complete set of biological parameters is given in Table~\ref{tab-param-dim}.
\subsection{Numerical methods}\label{numerical_method}
All the equations are discretized by finite differences. The second order equation (\ref{eq:complete})$_1$ is reduced to a system of first order equations and solved by
explicit Euler in time. In equations (\ref{eq:complete})$_{4,5}$ the diffusion terms are discretized by a standard centered difference in space and integrated implicitly in time.
The nonlinear reaction terms are treated explicitly in time. Finally, in equation (\ref{eq:complete})$_{5}$ we have eliminated the stiff term $-\eta S$ using a classical exponential transformation.
The square domain size is chosen sufficiently large, $225\, \mu$m per side, so that the growing CSp does not reach the boundary in the typical time of observation. We consider an uniform mesh with grid spacing $ \Delta x= \Delta y=3.75\, \mu$m, which guarantees a sufficient discretization over each cell (having a diameter of 15 $\mu$m, see Table~\ref{tab-param-dim}) and a reasonable accuracy.
The time step $\Delta t$ has been fixed as the maximum value to ensure stability and non-negativity of the scheme ($\max \Delta t= 0.02$ h). For the same reason, when the oxygen
concentration drops below a given threshold, it is necessary to reduce the time step to $\Delta t=0.001$ h.
\subsection{Parameter sensitivity analysis}\label{sec:sensitivity}
Mathematical models of biological phenomena are subject to sources of uncertainty, including errors of measurement, natural intrinsic variability of the system, absence of information and poor or partial understanding of the driving forces and mechanisms. This uncertainty imposes a limit on our confidence in the response or output of the model. One of the challenges is to characterize the model parameters that are not identified experimentally, and these parameters are marked as \emph{calibrated} in Table \ref{tab-param-dim}.
\par In this section we present the calibration procedure in order to obtain as reliable results as possible. To achieve this goal, we studied the influence of the parameters on the model dynamics through a local sensitivity analysis \citep{saltelli,clarelli}. This approach determines a degree of dependency between input parameters (one at a time) and the results of simulations. Although our analysis does not take into account the presence of interactions between parameters, as in the global sensitivity analysis, it can give useful information for further exploration of the parameter space.
We measure the sensitivity of the model to the variation of a positive quantity $\Psi$ with respect to a reference parameter $p_0$ by defining a sensitivity index $SV \geq0$ as:
\begin{equation}\label{eq:SV}
SV:=\frac{ |\bar \Psi(p_0 \pm \varepsilon)- \bar \Psi(p_0)| / \bar \Psi(p_0)}{\varepsilon /p_0},
\end{equation}
where $\bar \Psi$ is the average value of $\Psi$ over a large number
of runs (100 in our analysis) and it accounts for the stochasticity presents in
our model. Typically, $\varepsilon$ is a small deviation over $p_0$ ($\varepsilon=0.05 p_0$, i.e. $5\%$ variation). In Table~\ref{tab:sensitivity_index} we report the sensitivity index computed with respect to two observed variables: the total number of cells $N$, and the diameter of the CSp, both at the final simulated time of 72 hours. The smallness of the index give us confidence of the robustness of the model in the response of the system in the presence of uncertainty.
\begin{landscape}
\begin{longtable}{@{\extracolsep{\fill}}*{4}{l}}
\caption{Estimates of physical and biological parameter values. Whenever possible, the values are taken from literature or experiments, the remaining are calibrated to be consistent with other (c.w.o.). Their influence on the system is studied through a local sensitivity analysis (Section \ref{sec:sensitivity}). When a parameter admits a range of possible values, the used one in the numerical tests is put in brackets.}
\label{tab-param-dim}\\
\toprule
\multicolumn{1}{l}{Parameter} & \multicolumn{1}{l}{Definition} &
\multicolumn{1}{l}{Estimated value or range (used values)} & \multicolumn{1}{l}{Source} \\
\midrule
\endfirsthead
\multicolumn{2}{l}{\footnotesize\itshape\tablename~\thetable:
continuation from the previous page} \\
\toprule
Parameter & Definition & Estimated value or range (used values) & Source\\
\midrule
\endhead
\midrule
\multicolumn{2}{r}{\footnotesize\itshape\tablename~\thetable:
continuation in the next page} \\
\endfoot
\bottomrule
\endlastfoot
$R$ & \scriptsize cell radius & 7.5 $\mu\text{m}$ & \scriptsize\citet{wu}\\
$\bar{R}$ & \scriptsize detection radius of chemicals & 2R &\scriptsize biological assumption \\
$R_1$ & \scriptsize radius of action of repulsion between cells & 2R &\scriptsize biological assumption\\
$R_2$ & \scriptsize radius of action of adhesion between cells & 2.5R &\scriptsize biological assumption \\
$R_3$ & \scriptsize radius of production/degradation of chemicals & R &\scriptsize biological assumption\\
$R_4$ & \scriptsize detection radius for the differentiation inhibition &2R &\scriptsize biological assumption \\
$\alpha$ & \scriptsize coefficient of chemotactic effect per unit mass & $10^{10} \;\mu\text{m}^{4}\,\text{h}^{-2} \text{pg}^{-1}$ &\scriptsize calibrated, c.w.o.\\
$k_{1}$ & \scriptsize coefficient of repulsion per unit mass & $10^{17}\;\mu\text{m}^{2}\,\text{h}^{-2}$ &\scriptsize calibrated, c.w.o.\\
$k_{2}$ &\scriptsize elastic constant per unit mass & \parbox[t][][t]{7cm}{$1.29 \times 10^{14}\text{ -- }1.29 \times 10^{19}$ $(1.29\times 10^{14})\;\text{h}^{-2}$} & \scriptsize \citet{bell} \\
$\mu$ &\scriptsize friction coefficient per unit mass & $5.82\times 10^{14}\text{ -- }(5.82\times 10^{15}) \; \text{h}^{-1}$ & \scriptsize \citet{rubinstein} \\
$D_c^{\max}$ & \scriptsize oxygen diffusion coefficient & $3.72\text{ -- } 4.93 \, (4.32) \times 10^6 \mu \text{m}^2\,\text{h}^{-1}$ & \scriptsize \citet{wu}\\
$D_S^{\max}$ & \scriptsize TGF-$\beta$ diffusion coefficient & $9.36 \times 10^4 \mu \text{m}^2\,\text{s}^{-1}$ &\scriptsize \citet{sito} \\
$\xi (\varphi_{1,2,3})$ & \scriptsize coefficient of production of TGF-$\beta$ & $2.7 \times10^{-8} \text{ -- } 1.1 \times 10^{-6}$ $(5.64 \times 10^{-7}) \;\text{pg}\,\mu \text{m}^{-2}\,\text{h}^{-1}$ & \scriptsize \citet{chim}\\
$S_{\max}$ & \scriptsize maximum concentration of TGF-$\beta$ & $3 \times 10^{-8} \; \text{pg} \, \mu \text{m}^{-2}$ &\scriptsize \citet{chim}\\
$\eta$ & \scriptsize degradation constant of TGF-$\beta$ & $13.86\text{ -- }20.79$ $(17.33)\;\text{h}^{-1}$\; &\scriptsize \citet{wake}\\
$\sigma(\varphi=1,2)$ & \scriptsize differentiation constant & 50 (if $\varphi=1$), 2.5 (if $\varphi=2$) (nondim.) & \scriptsize calibrated, c.w.o.\\
$\lambda(\varphi=1,2,3)$ & \scriptsize oxygen consumption constant &\parbox[t][][t]{6.5cm}{ $ 0.9 \times 10^{-2} \text{ -- } 2.52 \times 10^{-2}$ \\(1.4 $\times 10^{-2}$ if $\varphi=1$, 2.5$\times 10^{-2}$ if $\varphi=2$, 2.5 $\times 10^{-2}$ if $\varphi=3$) $\text{pg}\, \mu \text{m}^{-2} \, \text{h}^{-1}$ }& \scriptsize \citet{wu} \\
$k(\varphi=1,2,3)$ &\scriptsize Michaelis-Menten oxygen constant & $1.67 \times 10^{-5} \; \text{pg}\, \mu \text{m}^{-2}$ &\scriptsize \citet{wu} \\
$\bar c (\varphi=1,2)$ &\scriptsize oxygen concentration threshold value for diff. & 4$\times 10^{-4}$ (if $\varphi=1$), 28$\times 10^{-4}$ (if $\varphi=2$) $\text{pg}\, \mu \text{m}^{-2}$ &\scriptsize calibrated, c.w.o.\\
$c_{d}$ &\scriptsize oxygen minimum concentration for life (necrosis) & $1.93 \times 10^{-4}\; \text{pg}\, \mu \text{m}^{-2}$ &\scriptsize \citet{wu} \\
\newpage
$c_0$ & \scriptsize environmental concentration for oxygen & \parbox[t][][t]{6cm}{$3.68 \times 10^{-3}\, \text{pg}\, \mu \text{m}^{-2} \mbox{ (if $O_2$ at 21\%)}$, $8.83 \times 10^{-4}\, \text{pg}\, \mu \text{m}^{-2} \mbox{ (if $O_2$ at 5\%)}$ } &\scriptsize \citet{wu} \\
$S_0 $ & \scriptsize environmental concentration for S & $6.62 \times 10^{-9} \, \text{pg}\, \mu \text{m}^{-2}$ &\scriptsize \citet{ther} \\
$T_c $ & \scriptsize cell cycle time & $15\,\text{h}\mbox{ (if $O_2$ at 21\%)},$ $12\,\text{h} \mbox{ (if $O_2$ at 5\%)}$ &\scriptsize \citet{mess} \\
$ H $ & \scriptsize source rate & $40\,\text{h}^{-1}$ &\scriptsize calibrated, c.w.o. \\
$\rho $ &\scriptsize compactness parameter & $9\times 10^{3}$ (nondim.) &\scriptsize calibrated, c.w.o. \\
\end{longtable}
\end{landscape}
\begin{table}[htbp!]
\caption{Local sensitivity index $SV$ as defined in equation \eqref{eq:SV} with $\varepsilon$ corresponding to a 5\% variation, computed for the parameters used in the numerical simulations and marked as calibrated in Table \ref{tab-param-dim}. The average values have been taken on 100 independent runs, in the case of oxygen at 21\%. Observed variables $N$ and the CSp diameter have been considered at the final time of 72 h. In the first row for $N$ and for the diameter the reference average value and the standard deviation are shown.}
\label{tab:sensitivity_index}
\begin{center}
\begin{tabular}{l l l l l}
\toprule
Parameters changed & $N$ & $SV_N$ & diameter & $SV_{\text{diameter}}$ \\
& {\footnotesize average=73.31} & & {\footnotesize average=123.28 $\mu$m} & \\
& {\footnotesize (st. dev.=13.42 \%)} & & {\footnotesize (st. dev.=5.71\%)} & \\
\midrule
$\alpha + \varepsilon $ & -0.68 \% & 0.14 & -0.21\% & 0.04 \\
$\alpha - \varepsilon $ & -1.28 \% & 0.26 & -0.83\% & 0.17 \\
$\bar{c}(\varphi_1) + \varepsilon $ & -2.08 \% & 0.41 & -1.38\% & 0.27 \\
$\bar{c}(\varphi_1) - \varepsilon $ & -1.28 \% & 0.26 & -0.83\% & 0.16 \\
$\bar{c}(\varphi_2) + \varepsilon $ & +0.31 \% & 0.06 & +0.36\% & 0.07 \\
$\bar{c}(\varphi_2) - \varepsilon $ & +0.29 \% & 0.06 & -0.51\% & 0.10 \\
$H + \varepsilon $ & -0.29 \% & 0.06 & -0.30\% & 0.06 \\
$H - \varepsilon $ & +2.74 \% & 0.55 & -0.73\% & 0.14 \\
$k_1 + \varepsilon $ & +0.79 \% & 0.16 & +0.40\% & 0.08 \\
$k_1 - \varepsilon $ & -0.28 \% & 0.05 & -2.57\% & 0.51 \\
$k + \varepsilon $ & +0.87 \% & 0.17 & -0.05\% & 0.01 \\
$k - \varepsilon $ & -0.25 \% & 0.05 & -1.19\% & 0.24 \\
$\sigma(\varphi_1) + \varepsilon $ & -1.36 \% & 0.27 & -1.15\% & 0.23 \\
$\sigma(\varphi_1) - \varepsilon $ & -1.87 \% & 0.37 & -1.43\% & 0.29 \\
$\sigma(\varphi_2) + \varepsilon $ & -2.63 \% & 0.53 & -0.83\% & 0.17 \\
$\sigma(\varphi_2) - \varepsilon $ & +0.87 \% & 0.17 & -0.83\% & 0.17 \\
$\rho+ \varepsilon $ & +0.80 \% & 0.16 & -0.70\% & 0.13 \\
$\rho - \varepsilon $ & -0.53 \% & 0.10 & -0.76\% & 0.15 \\
$\lambda(\varphi_1)+ \varepsilon $ & +1.32 \% & 0.26 & -1.55\% & 0.31 \\
$\lambda(\varphi_1) - \varepsilon $ & -2.55 \% & 0.51 & -0.84 \% & 0.16 \\
$\lambda(\varphi_2)+ \varepsilon $ & +1.80 \% & 0.36 & -0.15\% & 0.03 \\
$\lambda(\varphi_2) - \varepsilon $ & -2.01 \% & 0.40 & -1.01 \% & 0.20
\\
\midrule
\end{tabular}
\end{center}
\end{table}
\subsection{Simulations: growth and maturation of the CSp}
We performed numerical simulations of growth and differentiation of CSp considering the $O_2$ and TGF-$\beta$ as the only key-regulatory biological mechanism. We compared the composition and the structure of the CSp at two typical experimental oxygen conditions.
First, we analyzed the normal culture condition which corresponds to the 21\% concentration of the oxygen $O_2$. The state of the CSp at the initial and three following times is presented at Figure~\ref{fig:sphere_21percent}. Differentiation levels are marked by different colors: green for the least differentiated cells ($\varphi=1$), blue color is for the intermediate level of differentiation ($\varphi=2$), while the red color labels cells with the highest degree of maturation ($\varphi=3$). The reported results are in good agreement with the biological observations. We reproduced the CSp biological system consisting of a central core of less differentiated but faster proliferating cells surrounded by more specialized ones. The oxygen and TGF-$\beta$ concentrations at different times are shown at Figure~\ref{fig:oxygen_tgf_concentration}.
Then we considered
the hypoxic culture conditions in the CSp environment, that is the $5 \%$ oxygen concentration.
The corresponding structure and composition of CSp, shown at Figure~\ref{fig:sphere_5percent}, match the real situation.
The size of the sphere is larger than that experimentally observed, because of the equally circular shape of cells and their constant radius in our model.
\begin{figure}[htbp!]
\centering
\subfigure[]{\includegraphics[scale=0.5, angle=0]{figure/oxy21percent/t0_cell.pdf}}
\subfigure[]{\includegraphics[scale=0.5, angle=0]{figure/oxy21percent/t24_cell.pdf}}
{\scriptsize $t=0, N_1=15, N_2=0, N_3=0, N_d=0$} \qquad \qquad
{\scriptsize $t= 24h, N_1=5, N_2=10, N_3=0, N_d=0$}
\subfigure[]{\includegraphics[scale=0.5, angle=0]{figure/oxy21percent/t48_cell.pdf}}
\subfigure[]{\includegraphics[scale=0.5, angle=0]{figure/oxy21percent/t72_cell.pdf}} \\
{\scriptsize $t=48h, N_1=9, N_2=31, N_3=4, N_d=0$} \qquad \qquad
{\scriptsize $t=72h, N_1=19, N_2=49, N_3=15, N_d=0$}
\caption{(a)--(d) Numerical simulation of the CSp growth for a $21\%$ oxygen environmental concentration, at times $t=0, 24, 48, 72$ h. System \eqref{eq:complete} is solved in a domain $\Omega=\left[0,225\right]\times\left[0,225\right]$ ($\mu$m$^2$),
with the model parameters given by Table~\ref{tab-param-dim}.
Differentiation levels are marked by different colors: green for the least differentiated cells ($\varphi=1$), blue color is for the intermediate level of differentiation ($\varphi=2$), while the red color labels cells with the highest degree of maturation ($\varphi=3$). Values $N_1$, $N_2$, $N_3$, $N_d$, in the subplot captions indicate the numbers of cells in the CSp, respectively for each state of maturation and for dead cells, $\varphi=1,2,3,d$.}
\label{fig:sphere_21percent}
\end{figure}
\begin{figure}[htbp!]
\centering
\subfigure[]{\includegraphics[scale=0.35, angle=0]{figure/oxy21percent/t24_oxy2.pdf}}
\subfigure[]{\includegraphics[scale=0.35, angle=0]{figure/oxy21percent/t48_oxy2.pdf}}
\subfigure[]{\includegraphics[scale=0.35, angle=0]{figure/oxy21percent/t72_oxy2.pdf}} \\\vspace{1 cm}
\subfigure[]{\includegraphics[scale=0.35, angle=0]{figure/oxy21percent/t24_tgf2.pdf}}
\subfigure[]{\includegraphics[scale=0.35, angle=0]{figure/oxy21percent/t48_tgf2.pdf}}
\subfigure[]{\includegraphics[scale=0.35, angle=0]{figure/oxy21percent/t72_tgf2.pdf}}
\caption
Spatial distribution of the oxygen (a)--(c) and the TGF-$\beta$ (d)--(f) in the case of 21\% oxygen environmental concentration, at $t=24, 48, 72$ h.
Equations \eqref{eq:complete}$_{4,5}$ are solved in a domain $\Omega=\left[0,225\right]\times\left[0,225\right]$ ($\mu$m$^2$), with the model parameters given by Table~\ref{tab-param-dim}.}
\label{fig:oxygen_tgf_concentration}
\end{figure}
\begin{figure}[htbp!]
\centering
\subfigure[]{\includegraphics[scale=0.5, angle=0]{figure/oxy5percent/t0_cell_5p.pdf}}
\subfigure[]{\includegraphics[scale=0.5, angle=0]{figure/oxy5percent/t24_cell_5p.pdf}} \\
{\scriptsize $t=0, N_1=15, N_2=0, N_3=0, N_d=0$} \qquad \qquad
{\scriptsize $t= 24h, N_1=16, N_2=7, N_3=0, N_d=0$} \\ \vspace{1cm}
\subfigure[]{\includegraphics[scale=0.5, angle=0]{figure/oxy5percent/t48_cell_5p.pdf}}
\subfigure[]{\includegraphics[scale=0.5, angle=0]{figure/oxy5percent/t72_cell_5p.pdf}} \\
{\scriptsize $t=48, N_1=41, N_2=16, N_3=0, N_d=7$} \qquad \qquad
{\scriptsize $t= 72h, N_1=114, N_2=2, N_3=0, N_d=36$} \\ \vspace{1cm}
\caption
(a)--(d) Numerical simulation of the CSp growth for a $5\%$ oxygen environmental concentration, at times $t=0, 24, 48, 72$ h. System \eqref{eq:complete} is solved in a domain $\Omega=\left[0,225\right]\times\left[0,225\right]$ ($\mu$m$^2$), with the model parameters given by Table~\ref{tab-param-dim}. Differentiation levels are marked by different colors: green for the least differentiated cells ($\varphi=1$), blue color is for the intermediate level of differentiation ($\varphi=2$), while the red color labels cells with the highest degree of maturation ($\varphi=3$). Black region indicates a necrotic/apoptotic core composed by dead cells. As in Figure \ref{fig:sphere_21percent}, $N_1$, $N_2$, $N_3$, $N_d$, in the subplot captions show the composition of the CSp at the displayed times.}
\label{fig:sphere_5percent}
\end{figure}
To
compare and summarize the above results we show at Figure~\ref{fig:diameter_evolution_a} in the form of pie charts the cell composition after 72 h in the two above cases. Similarly, Figure~\ref{fig:diameter_evolution_b} presents the growth of CSp diameter, and Figure~\ref{fig:diameter_evolution_c}--\ref{fig:diameter_evolution_d} the time evolution of the ratio between the total mass at time $t$ and the initial mass, $m_{\text{rel}}(t):=m(t)/m(0)$, respectively for oxygen and TGF-$\beta$. We observe that the oxygen levels decrease more at the hypoxic conditions (5$\%$) due to the increased proliferation and, as a result, initially the diameter of the sphere at $5$\% is larger than at $21$\%. However, the increasing deficiency of the oxygen lead to the formation of the necrotic core and the slower growth. Because of the initial condition equal for each cell and equal maturation time, cells undergo a higher degree of synchronisation. As a result we observe the characteristic steps in the curves describing the growth of the CSp diameter, in correspondence of the beginning of the proliferation cycle.
\begin{figure}[htbp!]
\centering
\subfigure[]{\includegraphics[width=0.5\textwidth]{figure/torte.png}\label{fig:diameter_evolution_a}} \hspace{-0.25 cm}
\subfigure[]{\includegraphics[width=0.5\textwidth]{figure/diameter.pdf}\label{fig:diameter_evolution_b}} \\
\subfigure[]{\includegraphics[width=0.5\textwidth]{figure/oxy_mass.pdf}\label{fig:diameter_evolution_c}} \hspace{-0.25 cm}
\subfigure[]{\includegraphics[width=0.5\textwidth]{figure/tgf_mass.pdf}\label{fig:diameter_evolution_d}}
\caption{(a) Pie charts describing the relative percentage distribution of the three types of cells (e.g. $(N_1/N_{\text{tot}})*100$) of a CSp in the case of $21$\% and $5$\% oxygen environmental concentration. The presented values are the averages over 100 independent simulations. (b) The diameter of the CSp as a function of time. (c)--(d) Oxygen and TGF-$\beta$ relative masses, $m_{\text{rel}}(t):=m(t)/m(0)$ versus time. For all the figures blue and red curves corresponds respectively to 21\% and 5\% oxygen concentration. In figures (b)--(d) the solid line represents the average value computed over 100 simulations, while the dotted curves show the interval corresponding to one standard deviation.}
\end{figure}
The proposed model appears to be in
a good agreement with the
observed biological experiments at hand \citep{mess,chim1}. We were able to reproduce the basic structures of CSps at two different oxygen concentration levels. In case of $21$\% of the environmental concentration we observed the central region with proliferating, undifferentiated cells and the external ring of less multiplicating but differentiating cells. On the other hand, at $5$\% an evident necrotic core is observed, without many cells at higher differentiation level in the surrounding layers.
\newpage
\section{Conclusions and perspectives}\label{conclusion}
In this paper we developed a hybrid mathematical model describing the dynamics of cardiac biopsy-derived stem cells leading to the formation of the so-called Cardiosphere from a cluster of a few cells
The complexity of the problem is extremely high and the biological phenomena leading to the formation of a CSp are still not completely understood. Moreover the quantitative characterization of the processes misses the estimate of some parameters essential for the accuracy of a mathematical model. Nevertheless, the proposed mathematical model appears in perfect agreement with the expected biological and pharmacological application shown in \citet{mess,chim1,chim,forte}. In particular, we were able to reproduce the basic structures of CSps assuming that only two elements are sufficient to describe the overall growth and maturation of the CSps: the oxygen as nutrient's emblem and the TGF-$\beta$ as the chemical differentiation signal representative. Our choice to select these two key regulators of the CSps growth and differentiation gives us many more chances to easily foresee the main possible cellular consequences following experimental biological or pharmacological modifications, with a strong impact in both research quality and cost. The layered growth of the CSps, with a central proliferating region, surrounded by differentiated and less proliferating cells, has been observed in the numerical experiments. In this regard, the biological technology has a high potential for therapeutic purposes and possible strategies for further differentiated cells are under investigation \citep{Lee2013,Chen2014}. Furthermore, in a possibly more general framework, our modeling tool could be applied to many other cellular spheroid culture systems, such as tumor cells spheroids, induced-progenitor cells, embryoid bodies-derived stem cells.
| {'timestamp': '2015-12-23T02:06:20', 'yymm': '1512', 'arxiv_id': '1512.07033', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.07033'} | arxiv |
\section{#1}}
\newcommand{\mysubsection}[1]{\subsection{#1}}
\newcommand{\mysubsubsection}[1]{\subsubsection{#1}}
\newenvironment{sketch}{\noindent {\bf Proof sketch: }
\newtheorem{thm}{Theorem}[section]
\newtheorem{cor}{Corollary}
\newtheorem{alg}{Algorithm}
\title{On Lagrangian Relaxation and Reoptimization Problems
\footnote{A preliminary version of this paper appeared in the Proceedings of the
6th Workshop on Approximation and Online Algorithms, Germany, September 2008.
Research supported
by the Israel Science Foundation
(grant number 1574/10), and
by the Ministry of Trade and Industry MAGNET program through the NEGEV
Consortium.}}
\author{
Ariel Kulik \thanks{Computer Science Department, Technion,
Haifa 32000, Israel. \mbox{E-mail: {\tt \{kulik,hadas,galtamir\}@cs.technion.ac.il}}}
\and Hadas Shachnai\thanks{Corresponding author.}
\and Gal Tamir}
\maketitle
\begin{abstract}
We prove a general result demonstrating the power of Lagrangian relaxation in solving constrained maximization problems with arbitrary objective functions.
This yields a unified approach for solving a wide class of {\em subset selection} problems with linear constraints.
Given a problem in this class and some small $\eps \in (0,1)$,
we show that if there exists an $r$-approximation algorithm for the Lagrangian relaxation of the problem, for some $r \in (0,1)$, then our technique achieves a ratio of $\frac{r}{r+1} -\! \eps$ to the optimal, and this ratio is tight.
The number of calls to the $r$-approximation algorithm, used by our algorithms, is {\em linear} in the input size and in $\log (1 / \eps)$ for inputs with cardinality constraint, and polynomial in the input size and in $\log (1 / \eps)$ for inputs with arbitrary linear constraint. Using the technique we obtain (re)approximation algorithms for natural (reoptimization) variants of classic subset selection problems, including real-time scheduling,
the {\em maximum generalized assignment problem (GAP)} and maximum weight
independent set.
\comment{
In addition using that technique we obtain a general $(1, \alpha)$-reoptimization scheme for subset selection problems.
In the Reoptimization version of a problem we are require to resolve the problem when a previous solution is presented with minimal changes (transition cost).
Each new solution is measured by tow objective functions, the original problem's objective profit function $p(x)$ and the transition cost function $\delta(x)$.
When approximating Reoptimization problem we compare our solution to the optimal solution $OPT$
(the optimal solution has the minimal transition cost among all the optimal solution of $\Pi$), $OPT=\{S|p(S)=p(\mO), \delta(S)=\argmin_{p(S)=p(\mO)}{\delta(S)}\}$
thus a solution $S$ is a $(r_1, r_2 )$-reapproximation if its objective functions approximated compared to the optimal solution $OPT$,
that is $\delta(S) \leq r_1\cdot \delta (OPT)$
and $p(S) \geq r_2 \cdot p(OPT)$. We use that scheme to obtain a reapproximation algorithm to the "Cloud Provider problem" and the "Video on Demand problem".
}
\end{abstract}
\section{Introduction}
Lagrangian relaxation is a fundamental technique in combinatorial optimization. It has been used extensively in the design of approximation algorithms for a variety of problems (see e.g.,\cite{GR96,G96,KR00,JV01,KPS06,BBGS08} and a comprehensive survey in \cite{M07}).
In this paper we prove a general result demonstrating the power of
Lagrangian relaxation
in solving constrained maximization problems of the following form.
Given a universe $U$, a weight function $w:U \rightarrow \mathbb{R^+}$,
a function $f:U \rightarrow \mathbb{N}$ and an integer $L \geq 1$, we
want to solve
\begin{eqnarray}
\label{prb:general_constraint}
\Pi:& {\max}_{s \in U} & f(s) \\
\nonumber
&\mbox{subject to:} & w(s) \leq L.
\end{eqnarray}
We solve $\Pi$ by finding an
efficient solution for the Lagrangian relaxation of $\Pi$, given by
\begin{equation}
\label{prb:general_lagrange}
\Pi (\lambda): ~\max_{s\in U} {f(s) - \lambda\cdot w(s),}
\end{equation}
for some $\lambda \geq 0$.
A traditional approach for using Lagrangian relaxation in
approximation algorithms (see, e.g., \cite{G96,JV01,BBGS08})
is based on
initially finding two solutions, ${SOL}_1$, ${SOL}_2$, for
$\Pi (\lambda_1), \Pi (\lambda_2)$, respectively,
for some $\lambda_1, \lambda_2$, such that each of the solutions is an
approximation for the corresponding Lagrangian relaxation; while one of
these solutions is feasible for $\Pi$ (i.e., satisfies the weight constraint),
the other is not.
A main challenge is then to find a way to {\em combine}
${SOL}_1$ and ${SOL}_2$
to a feasible solution that yields a good approximation for $\Pi$.
We prove (in Theorem \ref{lemma:lagrangian_relaxation}) a general result,
which allows to obtain a solution for $\Pi$ based on {\em one} of the
solutions only. In particular, we show that, with appropriate selection of the
parameters $\lambda_1, \lambda_2$
in the Lagrangian relaxation, we can obtain solutions
${SOL}_1$, ${SOL}_2$
such that one of them yields an
efficient approximation for our original problem $\Pi$.
The resulting
technique leads to fast and simple approximation algorithms for
a wide class of {\em subset selection} problems with linear constraints.
\subsection{Subset Selection Problems}
Subset selection problems form a large class
encompassing such NP-hard problems as
real-time scheduling,
the generalized assignment problem (GAP) and maximum weight independent set,
among others. In these problems,
a subset of elements satisfying certain
properties
needs to be selected out of a universe, so as to maximize some
objective function.\footnote{We give a formal definition in Section
\ref{sec:rounding}.}
We apply our general technique to obtain efficient approximate
solutions for the following natural variants of some classic subset selection
problems.
\myparagraph{Budgeted Real Time Scheduling (BRS)}
The input is a set
${\cal A} = \{ A_1, \ldots , A_m \}$
of \emph{activities},
where each activity consists of a set
of \emph{instances};
an instance $\cI \in A_i$ is defined
by a half open time interval $[s(\cI),e(\cI))$ in which the instance
can be scheduled ($s(\cI)$ is the start time, and $e(\cI)$ is
the end time), a cost
$c(\cI)\in \mathbb{N}$, and a profit $p(\cI)\in \mathbb{N}$.
A schedule is \emph{feasible} if it contains
at most one instance of each activity, and for any $t \geq 0$, at
most one instance is scheduled at time $t$.
The goal is to find a feasible schedule, in which
the total cost of all the scheduled instances
is bounded by a given budget $L \in \mathbb{N}$, and
the total profit of the scheduled instances is maximized.
{\em Budgeted continuous real-time scheduling (BCRS)}
is a variant of this problem where each instance is associated
with a {\em time window}
$\cI = [s(\cI),e(\cI))$
and length $\ell(\cI)$.
An instance $\cI$ can be scheduled at any time interval
$[\tau,\tau+\ell(\cI))$, such that
$s(\cI) \leq \tau \leq e(\cI) - \ell(\cI))$.
BRS and BCRS arise in many scenarios in which we need to schedule activities
subject to resource constraints, e.g.,
storage requirements for the outputs of the activities.
\myparagraph{Budgeted Generalized Assignment Problem (BGAP)}
The input is a set of bins
(of arbitrary capacities)
and a set of items, where
each item has a size, a value and a packing cost
for each bin. Also, we are given a budget $L \geq 0$.
The goal is to pack in the bins a feasible subset of items of maximum value,
such that the total packing cost is at most $L$.
BGAP arises in many real-life scenarios (e.g., inventory
planning with delivery costs).
\myparagraph{Budgeted Maximum Weight Independent Set (BWIS)}
Given a budget $L$ and a graph $G=(V,E)$, where each
vertex $v\in V$ has an associated profit $p_v$ (or, \emph
{weight}) and associated cost $c_v$, choose a subset $V' \subseteq V$
such that $V'$ is an \emph{independent set} (i.e., for any $e=(v,u)\in E$, $v \notin V'$ or $u \notin V'$),
the total cost of vertices in $V'$, given by
$\sum_{v\in V'} c_v$, is bounded by $L$,
and the total profit of $V'$, $\sum_{v\in V'} p_v$, is maximized. BWIS is a generalization of the classical {\em maximum independent
set (IS)} and {\em maximum weight independent set (WIS)} problems.
\subsection{Combinatorial Reoptimization}
Traditional combinatorial optimization problems require finding
solutions for a single instance. However, many of the real-life
scenarios motivating these problems involve systems that change
over time. Thus, throughout the continuous operation of
such a system, it is required to compute solutions for new problem
instances, derived from previous instances. Moreover, since there is
some cost associated with the transition from one solution to
another, the solution for the new instance must be {\em close} to the former solution
(under certain distance measure).
Solving the resulting {\em reoptimization} problem involves two
challenges:
$(i)$ {\em computing} an optimal (or close to the optimal) solution for
a new instance, and
$(ii)$ efficiently {\em converting} a given solution to a new one (we give below the formal definitions).
Indeed, due to the transition costs, we seek for the modified instance an efficient solution
which can be reached at low cost.
In that sense, the given initial solution plays a restrictive role, rather than serve as guidance to the algorithm.
For example, consider a cloud provider that runs virtual machines for its customers.
The provider has a set of servers (hypervisors); each server has a limited resource
available for use by the virtual machines that it hosts.
The demand for a particular virtual machine changes over time, with a corresponding change in its resource consumption.
This may require to migrate some virtual machines among the servers,
so as to keep the total demand
on each server bounded by its resource availability.
Thus, given an initial assignment of virtual machines to the servers,
the provider has to find a new assignment which maximizes the profit from serving customers,
while minimizing the total migration cost.
\comment{
\myparagraph{\bf Applications} Reoptimization problems
naturally arise
in many real-life scenarios. Indeed, planned or unanticipated
changes occur over time in almost any system. It is then required
to respond to these changes quickly and efficiently. Ideally, the
response should maintain high performance while affecting only a
small portion of the system. In \cite{full} we give a
detailed description of some of the applications for which our
reoptimization model fits well. This includes storage systems for
VoD services, communication services and other network problems,
stock trading, production planning and vehicle routing.
}
\subsubsection{Definitions and Notation}
A reoptimization problem $R(\Pi)$ is comprised of three elements: a universe $U$ of
all feasible solutions, a profit $p: U \rightarrow \mathbb{R^+}$
and a transition cost $\delta : U \rightarrow \mathbb{R^+}$.
In solving the reoptimization version of a
maximization problem, the objective is to find a solution
that maximizes the profit, while minimizing the transition cost.
In the original optimization problem, we only need to maximize the profit (e.g. $\max\{p(s)|s\in U\}$). We denote this problem by $\Pi$ and refer to it as the {\em base problem}.
The transition cost for a particular instance of the
reoptimization problem represents the
cost of moving from an existing solution to a given new solution.
(for example, in the cloud provider scenario, this can be the number of virtual machines that
need to migrate to reach a new assignment).
\comment
{
In the following we formally define the model
for combinatorial
reoptimization. Given an optimization problem $\Pi$ , let $I_0$ be
an input for $\Pi$, and let ${\cal C_{I}}_0 = \{ C_{I_0}^1,
C_{I_0}^2, \ldots \}$ be the set of configurations corresponding to
the solution space of $\Pi$ for ${I_0}$.\footnote{A configuration
can be any representation of a (partial) solution for $\Pi$.} Each
configuration $C_{I_0}^j \in {\cal C_{I}}_0$ has some value
$val(C_{I_0}^j)$.
In the reoptimization problem, $R(\Pi)$,
an instance $I_R$ contains an initial configuration for the original problem $C_{I_0}^j \in {\cal C_{I}}_0$ of an initial instance ${I_0}$, and a
new instance $I$ derived from $I_0$ by
admissible operation, e.g, addition or removal of elements,
changes in element parameters etc.
For any element $i \in I$ the transition cost of this element
$\delta(i)$ is derived directly from the initial configuration $C_{I_0}^j$.
Some time we even omit the initial configuration $C_{I_0}^j$ from $I_R$ and leave it with the transition cost function $\delta(i)$.
This representation keeps the input description more compact.
The primary goal is to find an optimal solution
for the problem $\Pi$ on the instance $I$.
Among all configurations with an optimal $val(C_{I}^k)$
value, we seek a configuration $C_{I}^{*}$ for which the
total transition cost, given by $\sum_{i \in
I \cap C_{I}^{*} }\delta(i)$ is minimized.
}
In the following, we show how the above notation can be used to describe
a reoptimization version of the {\em maximum spanning tree (MAX-ST)} problem. Denote this problem by $\Pi$.
Let $G_0=(V_0,E_0)$ be a weighted graph, and let $T_0=(V_0,E_{T_0})$
be a MAX-ST for $G_0$. Let $G=(V,E)$ be a graph derived from $G_0$ by
adding or removing vertices and/or edges, and by (possibly) changing the weights of edges.
Let $T=(V,E_{T})$ be a MAX-ST for $G$.
For every edge $e \in E_{T} $, we are given the cost $\delta(e)$ of
adding $e$ to the new solution (an example of transition cost
$\delta(e)$ can be: $\delta(e) = 0$ if $e \in E_0$; otherwise,
$\delta(e) = 1$).
The goal in the reoptimization problem $R($MAX-ST$)$ is to find a MAX-ST of $G$ with minimal total transition cost.
The formal representation of $R(\Pi)$ is $U=\{\mbox{all spanning trees of $G$}\}$,
$p(T)= \sum_{e\in T} w(e)$, where $w$ is the weight on the graph edges, and $\delta(T)= \sum_{e\in T} \delta(e)$.
A polynomial time algorithm for $R($MAX-ST$)$ is given in \cite{STT12}.
\comment{
The input for the reoptimization problem, $I_R$, contains both the
new instance, $I$, and the transition costs $\delta$ (that may be
encoded in different ways). Note that $I_R$ does not include the
initial configuration $I_0$ since, apart from determining the
transition costs, it has no effect on the reoptimization problem.
}
It is worth noting that the input for the reoptimization problem contains only the new instance of the problem, but not the existing state
($T_0$ in the MAX-ST example), as the current state is reflected by the
transition cost $\delta$.
\myparagraph{Approximate Reoptimization}
When the problem $\Pi$ is NP-hard, or when the reoptimization problem
$R(\Pi)$ is NP-hard,\footnote{As shown in \cite{STT12}, it may be that none, both, or only $R(\Pi)$ is NP-hard.}
we seek approximate solutions.
The goal is to find a good solution for the new instance, while keeping a low transition cost from the initial solution (or, {\em configuration}) to the new one.
Formally, denote by ${\cal O}$ an optimal solution for $\Pi$, that is, $p({\cal O})=\max_{s \in U} (p(s))$.
Denote by $OPT$ a solution for $R(\Pi)$ having the minimal transition cost among all the solutions that have a
profit $p({\cal O})$. Formally, $\delta(OPT)=\argmin_{s\in U | p(s)= p({\cal O })} (\delta(s))$.
We now define the notion of {\em reapproximation} algorithm.\footnote{We refer the reader to \cite{STT12} for further details.}
\begin{definition}
\label{def:weak_reapprox}
For $r_1\geq 1$ and $r_2 \in (0,1]$
a solution $s$ is an $(r_1, r_2 )$-reapproximation for $R(\Pi)$ if it satisfies $(i)$ $\delta(s) \leq r_1\cdot \delta (OPT)$,
and $(ii)$ $p(s) \geq r_2 \cdot p(OPT)$.
\end{definition}
\comment{
Formally,
\begin{definition}
\label{def:weak_reapprox}
An algorithm ${\cal A}$ yields an $(r_1, r_2)$-reapproximation for $R(\Pi)$, for $r_2,r_1 \geq 1$,
For any instance $I$ of a reoptimization problem $R(\Pi)$,
if its transition costs satisfies $delta (s) \leq r_1 \cdot \delta (OPT)$, ans its total profit is $p(s) \geq r_2 \cdot p(OPT)$.
\end{definition}
}
In this paper we develop a framework that enables to obtain $(1,\alpha)$-reapproximation algorithms for a wide
class of subset selection problems, where $\alpha \in (0,1)$.
While some of the resulting approximation ratios may be improved, by applying problem-specific approximation
techniques (see Section \ref{sec:related_work}), our
framework is of interest due to its simplicity and generality.
We demonstrate the usefulness of our framework in solving the
following reoptimization problem.
\myparagraph{The Surgery Room Allocation Problem (SRAP)}
In a hospital, a surgery room is a vital resource.
Operations are scheduled by the severity of patient illness;
however, operation schedules tend to change due to sudden changes in patients' condition, the arrival
of new patients requiring urgent treatment, or the unexpected absence of senior staff members.
Schedule changes
involve some costs, e.g., due to the need to rearrange the equipment,
or to change the staff members taking care of the patients, as well as their individual schedules.
There is also a profit accrued from each operation. Indeed, some
operations are more profitable than others, e.g., due to the coverage received from insurance companies,
or due to higher charges in case the operation is scheduled after work hours.
Formally, suppose that the initial input, $I_0$, consists of $n_0$ patients. Each patient $j$ is associated with a set $A_{0,j}$ of possible time intervals in which
$j$ can be scheduled for operation. An interval ${\cal I} \in A_{0,j}$ is a half open time interval $[s_0({\cal I}), e_0({\cal I})$, where
$s_0({\cal I}) \leq e_0({\cal I})$. Each interval ${\ci} \in \azj$ is associated with a profit $p_0({\ci})$, for all $1 \leq j \leq n_0$.
Let $S_0$ be a given operation schedule for $I_0$. Consider the input $I$ derived from $I_0$ by adding or removing patients, by changing the possible time intervals for the patients,
or the profits associated with the operations. Suppose that $I$ consists of $n$ patients; each patient $j$ has a set of possible time intervals $\aj$. Each interval ${\ci} \in \aj$ has a profit $p({\ci}) \geq 0$
and a transition cost $\delta({\ci}) \in \mathbb{N}$.
This is either the cost of adding ${\ci}$ to the schedule, if ${\ci} \notin S_0$, or the cost of omitting ${\ci}$ from $S_0$.
In any feasible schedule $S$ for $I$, at most one interval ${\ci} \in \aj$ is selected, for all $1 \leq j \leq n$,
and the surgery room is occupied by at most one patient at any time $t \geq 0$. The goal is to find a feasible schedule that maximizes
the total profit, while minimizing the aggregate transition cost. In particular, we want to obtain a $(1, \alpha)$-reapproximation
algorithm for the problem, for some $\alpha \in (0,1]$.
\comment{
suppose there are $n$ patients waiting for surgery.
For each patient $j$, there is a set $A_j$ of possible time intervals in which patient $j$ can be scheduled for a surgery.
Each interval ${\cal I} \in A_j$ is defined as a half open time interval $[s(\cI),e(\cI))$, where $s(\cI) \leq e(\cI)$.
Each interval ${\cI} \in A_j$ is associated with a profit $p(\cI)\in \mathbb{N}$ and a migration cost $\delta(\cI)\in \mathbb{N}$.\footnote{We note
that the previous schedule of the patients, that is modified in our reoptimization problem is (implicitly) represented by the migration costs.} A feasible
solution contains at most one time interval ${\cI} \in A_j$ for each patient $1 \leq j \leq n$, and at most one patient in the surgery room at any time $t \geq 0$.
The goal is to minimize the total migration cost, while maximizing the total profit accrued from the schedule.
}
\comment{
$I_j\subset\{(j,[s,t))| s < t\}$ for scheduling a surgery.
Additionally, the profit from a schedule is given by $p: \bigcup_{j=0}^{n} I_j \rightarrow \mathbb{N}$ and migration-cost function $\delta: \bigcup_{j=0}^{n} I_j \rightarrow \mathbb{N}$.
A feasible solution for the problem is collection of assignment $(j,[s,t))$ denoted by $S$ such that each patient is assigned to at most
one surgery and for any $t \geq 0 $, at most one patient is in the surgery room.
Our goal is to find a feasible schedule with maximal profit that minimize the migration-cost.
}
\comment{
even though this framework doesn't always produce the best
reoptimization ratio (for in \cite{KUL11} they show how to get an aproximation ratio of $(1-\frac{1}{e})$ for {\em BGAP} instead of $\frac{1-\frac{1}{e}}{2-\frac{1}{e}}$, using Theorem \ref{thm:reopt} we can get better reapproximation ratio for $R(GAP)$)
it is an immediate tool to show that the problem is in the class of $(1,\alpha)$-reoptimization problems.
}
\comment{
\myparagraph{The cloud provider reoptimization problem (CPRP)}
In the cloud provider reoptimization problem, there are $n$ hypervisors, each having computing power of $C_i$, $m$ virtual machines, each requires $r_j$ computing units and have profit of $p_j$, and migration cost of $\delta_{i,j}$ (for the reassignment of machine $j$ to server (hypervisors) $i$).
A feasible solution for the problem is collection of assignment $(i,j)$ denoted by $S$ such that each virtual machine $j$ appears at most in one assignment in $S$, and for each hypervisor $i$ the total amount of computing units required for the assignment do nit exceed computing power of the hypervisor, i.e.,
$$\sum_{j| (i,j) \in S } r_j \leq C_i.$$
The universe $U$ of the problem is the collection of all feasible solutions, and the profit of solution $S$ is $$p(S)=\sum_{ (i,j)\in S } p_j.$$
The transition cost of $S$ is $$\delta(S) = \sum_{ (i,j)\in S } \delta_{i,j}$$
\myparagraph{The Video on Demand (VoD) reconfiguration problem}
Same technique holds for the Video on Demand problem that was presented in Shachnai Tamir and Tamir paper \cite{STT09}.
In the Video on Demand problem, movie popularities tend to change frequently.
In order to satisfy new client requests, the content of the storage system needs to be modified.
The new storage allocation needs to satisfy the current demand; also, due to the
cost of file migrations, this should be achieved by using a minimum
number of reassignments of file copies to servers.
Formally, there are $n$ servers each with load capacity of $L_j$, which is the number of data streams that can be read simultaneously from that server, and a storage capacity of $S_i$, $m$ movies each with popularity of $p_j$ and size of $s_j$, and migration cost of $\delta_{i,j}$ (for copying a movie $j$ to a server $i$).
}
\label{sec:related}
\subsection{Main Results}
We prove (in Theorem \ref{lemma:lagrangian_relaxation})
a general result demonstrating the power of Lagrangian relaxation
in solving constrained maximization problems with arbitrary objective functions.
We use this result to develop
a unified approach for solving
subset selection problems with linear constraints.
In particular, given a problem $\Pi$ in this class, and a fixed $\eps \in (0,1)$,
we show that if there exists
an $r$-approximation algorithm for the Lagrangian relaxation of $\Pi$,
for some $r \in (0,1)$, then our technique yields a ratio of
$(\frac{r}{r+1} -\! \!\eps)$ to the optimal.
We further show (in Section \ref{sec:example}) that this bound is essentially tight, within additive of $\eps$.
Specifically,
there is
a subset selection problem $\Gamma$
such that, if
there exists an $r$-approximation algorithm for the Lagrangian relaxation
of $\Gamma$ for some $r \in (0,1)$, there is an input $I$
for which finding the
solutions ${SOL}_1$ and ${SOL}_2$ (for the Lagrangian relaxation)
and combining these solutions
yields at most a ratio of $\frac{r}{r+1}$ to the optimal.
The number of calls
to the $r$-approximation algorithm, used by our algorithms,
is {\em linear} in
the input size and in $\log (1 / \eps)$, for inputs with cardinality
constraint (i.e., where $w(s)=1$ for all $s \in U$), and polynomial in
the input size and in $\log (1 / \eps)$ for inputs with arbitrary linear
constraint (i.e., arbitrary weights $w(s) \geq 0$).
We apply the technique to obtain efficient approximations for
natural variants of some classic subset selection problems.
In particular, for the budgeted variants of
the real-time scheduling problem we obtain (in Section \ref{sec:bba})
a bound of $(1/3 - \eps)$ for BRS and $(1/4 -\eps)$ for
BCRS.
For budgeted GAP we give (in Section \ref{sec:bgap}) an approximation
ratio of $\frac{1-e^{-1}}{2-e^{-1}} -\eps$.
For BWIS we show (in Section \ref{sec:bwis})
how an approximation algorithm $\mathcal{A}$ for WIS can be used
to obtain an approximation algorithm for BWIS with
the same asymptotic approximation ratio.
More specifically,
let $\mathcal{A}$ be a polynomial time algorithm
that finds in a graph $G$ an independent set whose profit is at least
$f(n)$ of the optimal, where $(i)$ $f(n)=o(1)$ and
$(ii)$ $\log(f(n))$ is polynomial in the input size.\footnote{These two
requirements hold
for most approximation algorithm for the problem.}
Our technique yields an
approximation algorithm which runs in polynomial time and achieves
an approximation ratio of $g(n)=\Theta(f(n))$.
Moreover,
$\lim_{n\rightarrow \infty} \frac{g(n)}{f(n)} =1$.
Since BWIS generalizes WIS, this implies that the two problems are
essentially equivalent in terms of hardness of approximation.
Our technique can be applied iteratively to obtain an $(\frac{r}{1
+ d r} - \eps)$-approximation algorithm for subset selection
problems with $d > 1$ linear constraints, when there exists an
$r$-approximation algorithm for the non-constrained version of
the problem, for some $r \in (0,1)$.
It is important to note that the above results, which apply for maximization
problems with {\em linear} constraints, do not
exploit the result in Theorem \ref{lemma:lagrangian_relaxation} in
its full generality.
We believe that the theorem will find more uses,
e.g., in deriving approximation
algorithms for subset selection problems with {\em non-linear} constraints.
Finally, we show how our technique can be used to develop a general $(1,\alpha)$-reapproximation algorithm for any subset selection problem.
Specifically, given an instance of a reoptimization problem $R(\Pi)$, where $\Pi$ is a subset selection problem with
an $r$-approximation algorithm
$\ca$, we find a $(1,(\frac{r^2}{1+r}-\varepsilon))$-reapproximation algorithm for $R(\Pi)$.
We do so by considering a family of
{\em budgeted reoptimization problems} (see Section \ref{reopt:budgeted}) denoted by $R(\Pi, b)$.
The problem $R(\Pi, b)$ is a restricted version of $R(\Pi)$,
in which we add the constraint that the total transition cost is at most $b$, for some budget $b \geq 0$.
The optimal solution for $\rpim$ is denoted $\co_b$. Note that
$\co_b$ is the profit of the best solution that can be obtained from the initial solution with transition
cost at most $b$. Each of these budgeted sub-problems can be approximated
using the Lagrangian relaxation technique. We search for the lowest budget $b^*$
such that $R(\Pi, b^*)$ has a solution of profit that exceeds a certain threshold.
Using this algorithm, we derive a $(1,\frac{1}{6}-\varepsilon)$-reapproximation algorithm for SRAP (see Section \ref{sec:reopt}).
\subsection{Related Work}
\label{sec:related_work}
Most of the approximation techniques based on Lagrangian relaxation are
tailored to handle specific optimization
problems. In solving the {\em k-median} problem through a relation to {\em
facility location}, Jain and Vazirani
developed in \cite{JV01} a general framework for using Lagrangian relaxation to derive
approximation algorithms (see also \cite{G96}).
The framework, that is based on a primal-dual approach, finds initially
two approximate solutions
${SOL}_1$, ${SOL}_2$
for the Lagrangian relaxations
$\Pi(\lambda_1)$, $\Pi(\lambda_2)$ of a problem $\Pi$, for carefully selected values of
$\lambda_1, \lambda_2$; a
{\em convex combination} of these solutions yields a (fractional)
solution which uses the budget $L$.
This solution is then rounded to obtain an integral
solution that is a good approximation for the original problem.
Our approximation technique (in Section \ref{sec:technique}) differs
from
the technique of \cite{JV01} in
two ways. First,
it does not require
rounding a fractional solution: in fact, we do not attempt to
combine the
solutions
${SOL}_1$, ${SOL}_2$,
but rather, examine each separately and compare the
two feasible solutions which can be easily derived
from
${SOL}_1$, ${SOL}_2$,
using
an efficient transformation of the non-feasible solution,
${SOL}_2$,
to a
feasible one.
Secondly, the framework of \cite{JV01}
crucially depends on a primal-dual interpretation of the approximation
algorithm for the relaxed problem, which is not required here.
K\"{o}nemann et al. considered in \cite{KPS06} a technique for
solving general partial cover problems. The technique
builds on the framework of \cite{JV01}, namely, an instance of a problem
in this class is
solved by initially finding the two solutions
${SOL}_1$, ${SOL}_2$
and generating a
solution
${SOL}$,
which combines these two solutions.
A comprehensive survey of other work is given in \cite{M07}.\footnote{For
conditions under which Lagrangian relaxation can be used to
solve discrete/continuous optimization problems see, e.g., \cite{NW99}.}
There has been some earlier work on
using Lagrangian relaxation to solve subset selection problems.
The paper \cite{NST07} considered a subclass of the class
of the subset selection problems that we study here.\footnote{This subclass includes the {\em
real-time scheduling} problem.}
Using the framework of \cite{JV01},
the paper claims
to obtain an approximation ratio of $r -\eps$ for any
problem in this subclass,
given a $r$-approximation algorithm for the
Lagrangian relaxation of the problem (satisfying certain properties).
Unfortunately, this approximation ratio was shown to be incorrect \cite{S07}. Berget et al. considered
in \cite{BBGS08} the budgeted matching problem and the budgeted matroid
intersection problem.
The paper gives the
first polynomial time approximation schemes for these problems.
The schemes, which are based on Lagrangian relaxation, merge the two obtained
solutions using some strong combinatorial properties of the problems.
The non-constrained variants of the subset selection problems that we study
here are well studied.
For known results on real-time scheduling
and related problems see, e.g., \cite{BB00,COR06,BGNS01,BBCR08}.
Surveys of known results for the generalized assignment problem
are given, e.g., in \cite{CK06,CKR06,FV06,FG06}.
Numerous approximation algorithms have been proposed and analyzed for the
maximum (weight) independent set problem.
Alon at al. \cite{AFWZ95} showed that IS
cannot be approximated within factor $n^{-\eps}$ in polynomial time,
where $n=|V|$ and $\eps > 0$ is some constant, unless $P=NP$.
The best known approximation ratio of $\Omega(\frac{\log^2 n}{n})$ for WIS
on general graphs is due to Halld{\'o}rsson \cite{Ha00}.
A survey of other known results for IS and WIS
can be found e.g., in \cite{H98,H00}.
To the best of our knowledge, approximation algorithms
for the budgeted variants of the above problems
are given here for the first time.
Our bound for BGAP (in Theorem \ref{thm:bgap}) was improved in \cite{ariel_thesis} to $1 - 1/e$.
There is a wide literature on scenarios leading to reoptimization problems, however, most of the earlier studies refer
to a model in which the goal is to find an optimal solution for a modified problem instance, with no transition costs incurred in the process
(see \cite{STT12} and the references therein). In this paper, we adopt the reoptimization model introduced in \cite{STT12}.
In this model, it is shown in \cite{STT12} that for any subset selection problem $\Pi$ that is polynomially solvable, there is
a polynomial time $(1,1)$-reoptimization algorithm for $R(\Pi)$.
\section{Lagrangian Relaxation Technique}
\label{sec:technique}
Given a universe $U$, let
$f:U \rightarrow \mathbb{N}$ be some objective function,
and let
$w:U \rightarrow \mathbb{R^+}$ be a non-negative weight function.
Consider the problem $\Pi$ of maximizing $f$ subject to
a budget constraint $L$ for $w$, as given in \eqref{prb:general_constraint},
and the Lagrangian relaxation of $\Pi$, as given in
\eqref{prb:general_lagrange}.
We assume that the value of an optimal solution $s^*$ for $\Pi$
satisfies $f(s^*) \geq 1$.
For some $\eps' >0$, suppose that
\begin{equation}
\label{eq:lambda_one_two}
\lambda_2 \leq \lambda_1 \leq \lambda_2 + \eps'.
\end{equation}
The heart of our approximation technique is the next result.
\begin{theorem}
\label{lemma:lagrangian_relaxation}
For any $\eps > 0$ and $\lambda_1, \lambda_2$ that satisfy
(\ref{eq:lambda_one_two}) with $\eps'=\eps/L$, let $s_1={SOL_1}$ and
$s_2={SOL_2}$ be
$r$-approximate solutions for
$\Pi(\lambda_1),\Pi(\lambda_2)$,
such that
$w(s_1) \leq L \leq w(s_2)$. Then
for any $\alpha \in [1- r, 1]$, at least one of the following holds:
\begin{enumerate}
\item
$f(s_1) \geq \alpha r f(s^*)$
\item
\label{s_2_case}
$f(s_2)
(1-\alpha -\eps)f(s^*) \frac{w(s_2)}{L} $.
\end{enumerate}
\end{theorem}
\begin{proof}
Let $L_i=w(s_i)$, $i=1,2$, and $L^* = w (s^*)$.
From \eqref{prb:general_lagrange} we have that
\begin{equation}
\label{lagrange_prop1}
f(s_i)- r f(s^*) \geq \lambda_i (L_i-r L^*).
\end{equation}
Assume that, for some
$\alpha \in [1- r, 1]$,
it holds that
$f(s_1) < \alpha r f(s^*)$,
then
\[
(\alpha -1)r f(s^*) > f(s_1)-r f(s^*) \geq
\lambda_1(L_1- r L^*) \geq -r \lambda_1 L^* \geq
-r \lambda_1 L.
\]
The second inequality follows from \eqref{lagrange_prop1}, the third
inequality from the fact that $\lambda_1 L_1 \geq 0$, and the last inequality
holds due to the fact that $L^* \leq L$.
Using \eqref{eq:lambda_one_two}, we have
\begin{equation}
\label{eq:lambda_and_f}
\frac{ (1- \alpha ) f(s^*)} {L} <
\lambda_1 < \lambda_2 +\eps'.
\end{equation}
Since $\eps'= \eps/L$, we get that
\begin{eqnarray*}
f(s_2) &\geq& \lambda_2(L_2-L^*)+r f(s^*)
>
\left( \frac{(1-\alpha) f(s^*) }{L} - \eps' \right) (L_2-L) +r f(s^*)
\\
&\geq&
(1-\alpha) f(s^*) \frac{L_2}{L} - \eps' L_2
\geq
(1- \alpha -\eps' L)\frac{L_2}{L}f(s^*)
= (1-\alpha -\eps)\frac{L_2}{L}f(s^*)
\end{eqnarray*}
The first inequality follows from \eqref{lagrange_prop1}, by taking $i=2$,
and the second inequality is due to \eqref{eq:lambda_and_f} and the fact that
$L^* \leq L$.
The third inequality holds since $r \geq 1- \alpha$, and the last inequality
follows from the fact that $f(s^*) \geq 1$.
\end{proof}
We summarize the above discussion in the next theorem,
which is the heart of our technique:
\begin{theorem}
\label{lemma:lagrangian_relaxation}
Let $\eps'=\frac{\eps}{L}$.If $S_1,S_2$ are
$r$-approximation for
$\Pi(\lambda_1),\Pi(\lambda_2)$,
$\lambda_2 \leq \lambda_1 < \lambda_2 +\eps'$,
and $w(S_1) \leq L \leq w(S_2)$, then
for all $1- r \leq \alpha \leq 1 $, one of the
following holds:
\begin{enumerate}
\item
$f(S_1) \geq \alpha r f(S^*)$
\item
\label{s_2_case}
$f(S_2) \geq (1-\alpha -\eps)f(S^*) \frac{L_2}{L} $,
\end{enumerate}
where $S^*$ is an optimal solution for $\Pi$.
\end{theorem}
Theorem \ref{lemma:lagrangian_relaxation} asserts
that at least one of the solutions $s_1,s_2$ is
{\em good} in solving our original problem, $\Pi$.
If $s_1$ is a good solution then
we have an $\alpha r$-approximation for $\Pi$,
otherwise we need to find a way to convert $s_2$ to a
solution $s'$ such that $w(s') \leq L$ and $f(s')$ is
a good approximation for $\Pi$.
Such conversions
are presented in Section \ref{sec:rounding} for
a class of {\em subset selection problems
with linear constraints}.
Next, we show how to find two solutions which satisfy
the conditions of Theorem \ref{lemma:lagrangian_relaxation}.
\subsection{Finding the Solutions $s_1, s_2$}
\label{sec:finding}
Suppose that we have an algorithm $\mathcal{A}$ which
finds a $r$-approximation for $\Pi(\lambda)$, for
any $\lambda \geq 0$. Given an input $I$ for $\Pi$,
denote the solution which
$\mathcal{A}$ returns for $\Pi(\lambda)$ by
$\mathcal{A}(\lambda)$,
and assume that
it is sufficient to consider $\Pi(\lambda)$ for
$\lambda \in (0, \lambda_{max})$,
where $\lambda_{max} = \lambda_{max}(I) $ and
$w(\mathcal{A}(\lambda_{max}))\leq L$.
Note that if $w(\mathcal{A}(0)) \leq L$ then
$\mathcal{A}(0)$ is a $r$-approximation
for $\Pi$; otherwise, there exist $\lambda_1,
\lambda_2 \in (0,\lambda_{max})$ such that
$\lambda_1,\lambda_2$, and $s_1=\mathcal{A}(\lambda_1),
s_2=\mathcal{A}(\lambda_2)$ satisfy \eqref{eq:lambda_one_two} and
the conditions of
Theorem \ref{lemma:lagrangian_relaxation}, and $\lambda_1, \lambda_2$
can be easily found using binary search.
Each iteration of the binary search requires a single
execution of $\mathcal{A}$ and reduces the size of the
search range by half. Therefore, after
$R = \ceil{ \log (\lambda_{max})+
\log(L) + \log(\eps ^{-1})}$
iterations, we have two solutions which satisfy
the conditions of the theorem.
Note that the values of $\lambda$ used during
the execution of the algorithm can be represented by
$O (\log(\lambda_{max})+\log(L)+\log(\eps^{-1}))$
bits; thus, we keep the
problem size polynomial in its original
size and in $\log(\eps^{-1})$.
\begin{theorem}
\label{lemma:finding}
Given an algorithm $\mathcal{A}$ which outputs
an $r$-approximation for $\Pi(\lambda)$, and
$\lambda_{max}$, such that
$w(\mathcal{A}(\lambda_{max})) \leq L$,
an $r$-approximate solution or two solutions $s_1, s_2$
which satisfy the conditions of Theorem
\ref{lemma:lagrangian_relaxation} can be found by using binary
search.
This requires $\ceil{ \log (\lambda_{max})+
\log(L) + \log(\eps ^{-1})}$
executions of $\mathcal{A}$.
\end{theorem}
We note that when $\mathcal{A}$ is a randomized approximation
algorithm whose
{\em expected} performance ratio is $r$,
a simple binary search may not output solutions that
satisfy the conditions of Theorem \ref{lemma:lagrangian_relaxation}.
In this case,
we repeat the executions
of $\mathcal{A}$ for the same input
and select the solution of maximal value.
For some pre-selected values $\beta >0$ and $\delta >0$,
we can guarantee that the probability that any of the used solutions
is not a $(r-\beta)$-approximation is
bounded by $\delta$. Thus, with appropriate selection of the values of
$\beta$ and $\delta$, we get a result similar to the result in
Theorem \ref{lemma:lagrangian_relaxation}.
We discuss this case in detail in the full version of the paper.
\section{Approximation Algorithms for Subset Selection Problems}
\label{sec:rounding}
In this section we develop an approximation technique for subset selection
problems. We start with some definitions and notation.
Given a universe $U$, let $X \subseteq 2^U$ be a domain, and
$f:X \rightarrow \mathbb{N}$ a set function. For a subset $S \subseteq U$, let
$w(S)= \sum_{s \in S} w_s$, where $w_s \geq 0$ is the \emph{weight} of the element $s \in
U$.
\begin{definition}
The problem
\[
\Gamma:~ \max_{S \in X} ~f(S)~~~
\]
\negA
\negA
\begin{equation}
\label{eq:subset_constraint}
\mbox{subject to:} ~ w(S) \leq L
\end{equation}
is a \emph{subset selection problem with a linear constraint} if $X$
is a lower ideal, namely, if $S \in X$ and
$S' \subseteq S$ then $S' \in X$, and $f$ is
a linear non-decreasing set function with $f(\emptyset)=0$.\footnote{For simplicity,
we assume throughout the discussion that $f(\cdot)$ is a {\em linear}
function; however, all of the results in this section hold also for
the more general case where $f: 2 ^S \rightarrow \mathbb{N}$ is a
non-decreasing {\em submodular}
set function, for any $S \in X$.}
\end{definition}
Note that subset selection problems with linear constraints
are in the form of \eqref{prb:general_constraint}, and
the Lagrangian relaxation of any problem $\Gamma$ in this class
is $\Gamma(\lambda)=\max_{S\in X} f(S)- \lambda w(S)$; therefore,
the results of Section \ref{sec:technique} hold.
Thus, for example, BGAP can be formulated
as the following subset selection problem with linear constraint. The
universe $U$
consists of all pairs $(i,j)$ of item $1 \leq i \leq n$
and bin $ 1 \leq j \leq m$. The domain $X$ consists of
all the subsets $S$ of $U$, such that each item appears at
most once (i.e., for any item $1 \leq i \leq n$, $\left| \{ (i',j') \in S : i'=i \}\right| \leq 1$),
and the collection of items that appears with a bin $j$, i.e.,
$\{ i : (i,j) \in S \}$ defines
a feasible assignment of items to bin $j$. It is easy to see that $X$
is indeed a lower ideal.
The function $f$ is
$f(S)= \sum_{(i,j)\in S} f_{i,j}$, where $f_{i,j}$ is the profit
from the assignment of item $i$ to bin $j$, and $w(S) = \sum_{(i,j)\in S} w_{i,j}$
where $w_{i,j}$ is the size of item $i$ when assigned to bin $j$.
The Lagrangian relaxation of BGAP is then
$$\max_{S \in X} f(S) -\lambda w(S)= \max_{S \in X} \sum_{(i,j)\in S}
(f_{i,j} - \lambda w_{i,j})\enspace{.}$$
The latter can be interpreted as the following
instance of GAP: if $f_{i,j}-\lambda w_{i,j} \geq 0$ then
set $f_{i,j}-\lambda w_{i,j}$ to be the profit from assigning item $i$ to bin $j$; otherwise,
make item $i$ infeasible for bin $j$ (set the size of item $i$
to be greater than the capacity of bin $j$).
We now show how the Lagrangian relaxation technique described in Section
\ref{sec:technique} can be applied to subset selection problems.
Given a problem $\Gamma$ in this class, suppose that $\ca$
is a $r$-approximation algorithm for $\Gamma(\lambda)$, for some $r \in
(0,1)$. To find $\lambda_1, \lambda_2$ and ${SOL}_1, {SOL}_2$,
the binary search of Section \ref{sec:finding}
can be applied over the range $[0,p_{max}]$, where
\begin{equation}
\label{eq:def_pmax}
p_{max} = \max_{s \in U} f(s)
\end{equation}
is the maximum profit of any element in the universe $U$.
To obtain the solutions $S_1, S_2$ which correspond to $\lambda_1,
\lambda_2$, the number of calls to ${\ca}$ in the binary search is
bounded by $O(\log(\frac{L \cdot p_{max}}{\eps}))$.
Given the solutions $S_1,S_2$
satisfying the conditions of
Theorem \ref{lemma:lagrangian_relaxation},
consider the case where, for some $\alpha \in [1- r, 1]$,
property \ref{s_2_case} (in the theorem)
holds. Denote the value of an optimal solution for $\Gamma$
by $\mO$. Given a solution $S_2$ such that
\begin{equation}
\label{eq:beta_appx}
f(S_2) \geq (1-\alpha - \eps) \frac{w(S_2)}{L} \cdot \mO,
\end{equation}
our goal is to find a solution $S'$ such that
$w(S') \leq L$ (i.e., $S'$ is valid for $\Gamma$),
and $f(S')$ is an approximation for $\mO$.
We show below how $S'$ can be obtained from $S_2$. We first consider
(in Section \ref{sec:rounding_card}) instances with unit weights. We
then describe (in Section \ref{sec:rounding_linear}) a scheme for
general weights. Finally, we give (in Section \ref{sec:enumeration})
a scheme which
yields improved approximation ratio for general instances, by
applying enumeration.
\subsection{Unit Weights}
\label{sec:rounding_card}
Consider first the special case where
$w_s = 1$ for any $s\in U$ (i.e., $w(S)= |S|$; we refer to
(\ref{eq:subset_constraint}) in this case
as \emph{cardinality constraint}).
\comment{
To obtain $S'$, select the $L$ elements in $S_2$ with
the highest profits.\footnote{When $f$ is a submodular
function,
iteratively select the element $s \in S_2$ which maximizes $f(T\cup \{s\})$,
where $T$ is the subset of elements chosen in
the previous iterations.}
It follows from (\ref{eq:beta_appx}) that
$f(S') \geq (1-\alpha - \eps) \cdot \mO = (\frac{r}{\1+r} - \eps)\mO$.
}
Suppose that we have solutions $S_1,S_2$
which satisfy the conditions
of Theorem \ref{lemma:lagrangian_relaxation}, then by
taking $\alpha = \frac{1}{1+r}$ we get that
either $f(S_1) \geq (\frac{r}{1+r} -\eps) \mO$,
or $f(S_2) \geq ( \frac{r}{1+r} -\eps)
\frac{w(S_2)}{L} \mO$.
If the former holds
then we
have a ($\frac{r}{1+r}-\eps$)-approximation
for the optimum; otherwise, $f(S_2) \geq ( \frac{r}{1+r} -\eps)
\frac{w(S_2)}{L} \mO$.
To obtain $S'$, select the $L$ elements in $S_2$ with
the highest profits.\footnote{When $f$ is a submodular
function,
iteratively select the element $s \in S_2$ which maximizes $f(T\cup \{s\})$,
where $T$ is the subset of elements chosen in
the previous iterations.}
It follows from (\ref{eq:beta_appx}) that
$f(S') \geq (1-\alpha - \eps) \cdot \mO = (\frac{r}{1+r} - \eps)\mO$.
Combining the above with the result of Theorem
\ref{lemma:finding}, we get the following.
\begin{theorem}
\label{lemma:cardinality}
Given a subset selection problem $\Gamma$ with unit weights,
an algorithm $\mathcal{A}$ which
yields a $r$-approximation for $\Gamma(\lambda)$ and
$\lambda_{max}$, such that
$w(\mathcal{A}(\lambda_{max})) \leq L$, a
$(\frac{r}{r+1} -\eps)$-approximation for
$\Gamma$ can be derived by using $\mathcal{A}$ and selecting among
$S_1, S'$ the set with highest profit.
The number of calls to $\mathcal{A}$ is
$O(\log(\frac{L \cdot p_{max}}{\eps}))$, where $p_{max}$ is given in (\ref{eq:def_pmax}).
\end{theorem}
\comment{
Combining the above with the result of Theorem
\ref{lemma:finding}, we get the following.
\begin{theorem}
\label{lemma:cardinality}
Given a subset selection problem $\Gamma$ with unit weights,
an algorithm $\mathcal{A}$ which
yields a $r$-approximation for $\Gamma(\lambda)$, and
$\lambda_{max}$, such
$w(\mathcal{A}(\lambda_{max})) \leq L$, a
$(\frac{r}{r+1} -\eps)$-approximation for
$\Gamma$ can be derived by using $\mathcal{A}$.
The number of calls for $\mathcal{A}$ is
linear in the input size and $(\log (1/\eps))$,
plus a linear time processing.
\end{theorem}
}
\subsection{Arbitrary Weights}
\label{sec:rounding_linear}
For general element weights, we may assume w.l.o.g. that,
for any $s \in U$, $w_s \leq L$.
We partition $S_2$ to a collection of
up to $\frac{2W(S_2)}{L}$
disjoint sets $T_1, T_2, \ldots$
such that $w(T_i) \leq L$ for all $i \geq 1$. A simple
way to obtain such sets is by adding elements of $S_2$ in arbitrary
order to $T_i$ as long as we do not exceed the budget $L$.
A slightly more efficient implementation has a running time that
is linear in the size of $S_2$ (details omitted).
\begin{lemma}
Suppose that $S_2$ satisfies \eqref{eq:beta_appx} for some $\alpha \in [1-
r,1]$, then there exists $i \geq 1$ such
that $f(T_i) \geq \frac{1-\alpha - \eps}{2}\cdot \mO$.
\end{lemma}
\begin{proof}
Clearly, $f(T_1)+...+f(T_N) = f(S_2)$,
where $N \leq \frac{2w(S_2)}{L} $ is the number of disjoint
sets. By the pigeon hole principle
there exists $1 \leq i \leq N$ such that
$f(T_i) \geq \frac{f(S_2)}{N} \geq
\frac{L \cdot f(S_2)}{2 w( S_2)} \geq
\frac{1 - \alpha -\eps}{2} \cdot \mO$.
\end{proof}
\comment{
Trivial for the linear case, hence omitted
\begin{proof}
As before, let $f(S)=f(c_2,S)$.
Then
$f(T_1)+...+f(T_N) \geq f(S_2)$, and by the
pigeon hole principle and Observation \ref{observation:rounding_comb}
there is $i$ such that
$f(c_2,T_i) \geq \frac{f(S_2)}{N} \geq
\frac{L \cdot f(S_2)}{2 w( S_2)} \geq
\frac{\beta}{2} \cdot \mO$.
\hspace*{\fill} $\Box$ \vskip \belowdisplayskip
\end{proof}
}
Assuming we have solutions $S_1, S_2$ which satisfy the conditions
of Theorem \ref{lemma:lagrangian_relaxation}, by
taking $\alpha = \frac{1}{1+2r}$ we get that
either $f(S_1) \geq (\frac{r}{1+2r} -\eps) \mO$,
or $f(S_2) \geq ( \frac{2r}{1+2r} -\eps)
\frac{w(S_2)}{L} \mO$ and can be converted to $S'$ (by setting
$S'=T_i$ for $T_i$ which maximizes $f(T_i)$),
such that $f(S') \geq (\frac{r}{1+2r} -\eps) \mO$, i.e.,
we get a $(\frac{r}{1+2r}- \eps)$-approximation for $\Gamma$.
Combining the above with the result of Theorem
\ref{lemma:finding}, we get the following.
\begin{theorem}
\label{lemma:general_case}
Given a subset selection problem $\Gamma$ with a linear
constraint, an algorithm $\mathcal{A}$ that
yields an $r$-approximation for $\Gamma(\lambda)$, and
$\lambda_{max}$, such that
$w(\mathcal{A}(\lambda_{max})) \leq L$, an
$(\frac{r}{2r+1} -\eps)$-approximation for
$\Gamma$ can be obtained using
$O(\log(\frac{L \cdot p_{max}}{\eps}))$ calls to $\mathcal{A}$, where $p_{max}$ is given in (\ref{eq:def_pmax}).
\end{theorem}
\subsection{Improving the Bounds via Enumeration}
\label{sec:enumeration}
In this section we present an algorithm that
uses enumeration to obtain a new problem, for which
we apply our Lagrangian relaxation technique. This enables
to improve the approximation ratio in
Section \ref{sec:rounding_linear}
to match the bound obtained for unit weight inputs (in Section
\ref{sec:rounding_card}).\footnote{The running time
when applying enumeration depends on the size of the universe (which may be
super-polynomial in the input size; we elaborate on that in
Section \ref{sec:bba}).}
\comment{
Though enumeration is applicable in
many cases, for
some cases the interpretation of a problem as a subset selection
problem yields an unbounded or super-polynomial number of elements,
as in the case of budgeted bandwidth allocation, when the
input is given with time windows (we elaborate on that in
Section \ref{sec:bba}). In such cases enumeration,
of even a small number of elements, cannot be implemented in
polynomial time.
}
For some $k \geq 1$, our algorithm initially `guesses' a subset $T$
of (at most) $k$ elements with the highest profits in some optimal solution.
Then, an approximate solution is obtained by adding
elements in $U$, whose values are bounded by $f(T)/|T|$.
Given a subset $T \subseteq U$, we define
$\Gamma_T$, which can be viewed as the sub-problem that `remains' from $\Gamma$
once we select $T$ to be the initial solution.
Thus, we refer to $\Gamma_T$ below as the {\em residual problem with
respect to T}.
Let
\begin{equation}
\label{eq:largest_density}
X_T = \left\{ S \left | ~ S \cap T =\emptyset, S \cup T \in X,
\mbox{ and } \forall s \in S: f(\{s\}) \leq \frac{f(T)}{|T| }\right. \right\}
\end{equation}
Consider the residual problem $\Gamma_T$ and its Lagrangian relaxation
$\Gamma_T(\lambda)$:
\[
\begin{array}{lcr}
\begin{array}{ll}
\Gamma_T & \mbox{maximize~} f(S)
~~~~~~~
\\
\mbox{subject~to}:& S \in X_T\\
& w(S) \leq L-w(T)
\end{array} &
~~
&
\begin{array}{ll}
\Gamma_T(\lambda)&\mbox{maximize~} f (S) -\lambda w(S)\\
\mbox{subject~to}:& S \in X_T
\end{array}
\end{array}
\]
In all of our examples, the residual problem $\Gamma_T$ is a smaller instance of
the problem $\Gamma$, and therefore, its Lagrangian relaxation is an instance
of the Lagrangian relaxation of the original problem. Assume that we have an approximation algorithm
$\mathcal{A}$ that, given $\lambda$ and a pre-selected set $T \subseteq U$ of
at most
$k$ elements, for some constant $k >1$, returns an $r$-approximation for
$\Gamma_T(\lambda)$ in polynomial time (if there is
a feasible solution for $\Gamma_T$). Consider the following
algorithm, in which we take $k=2$:
\begin{center}
\fbox{
\begin{minipage}{0.8\textwidth}
\begin{alg} General approximation algorithm
\label{alg:general}
\begin{enumerate}
\item
\label{enum:main_loop}
For any $T \subseteq U$ such that $|T| \leq k$,
find solutions $S_1,S_2$ (for $\Gamma_T(\lambda_1),\Gamma_T(\lambda_2)$ respectively)
satisfying the conditions of
Theorem \ref{lemma:lagrangian_relaxation} with respect to the problem $\Gamma_T$. Evaluate
the following solutions:
\begin{enumerate}
\item
$T \cup S_1$
\item
\label{enum:s2_bags}
Let $S'= \emptyset$, add elements to $S'$ in the
following manner:
Find an element $x \in S_2 \backslash S'$ which maximizes
the ratio $\frac{f(\{x\})}{w_x}$.
If $w(S' \cup \{x\}) \leq L-w(T)$ then add $x$ to $S'$
and repeat the process, otherwise return $S' \cup T$ as a
solution.
\end{enumerate}
\item
Return the best of the solutions found in Step 1.
\\
\end{enumerate}
\end{alg}
\end{minipage}
}
\end{center}
Let $\mO= f(S^*)$ be an optimal solution for
$\Gamma$, where $S^*= \{x_1, \ldots , x_h \}$.
Order the elements in $S^*$ such that
$f(\{x_1\}) \geq f(\{x_2\})\geq \ldots \geq f(\{x_h\})$.
\comment{
REMOVED DUE TO SUBMODULARITY
$f(\{x_1\}) \geq f_{\{x_1 \}} (\{x_2\}) \geq \cdot \! \cdot \! \cdot
f_{\{ x_1, x_2, \ldots , x_{i-1} \}} (\{ x_i \}) \geq
\cdot \! \cdot \! \cdot$,
namely,
for any $1 \leq i \leq h$, $x_i$ is the element for which
$f_{\{ x_1, x_2, \ldots , x_{i-1} \}} (\{ x_i \})$ is maximized.
}
\begin{lemma}
Let $T_i = \{x_1, \ldots, x_i \}$, for some $1 < i \leq h$,
then for any $j > i$, $f(\{x_j \}) \leq \frac{f(T_i)}{i}$.
\end{lemma}
In analyzing our algorithm, we consider the iteration in which $T=T_k$.
Then $S^* \setminus T_k$ is an optimal solution for $\Gamma_T$
(since $S^*
\setminus T_k \in X_{T_k}$ as in \eqref{eq:largest_density}); thus, the optimal value
for $\Gamma_{T_k}$ is at least
$f( S^* \backslash T_k) = f(S^*) - f(T_k)$.
\comment{
by decreasing
profits $x_1,x_2,...,x_n$ - $x_1$ is the element
for which $f(x)$ is maximal, $x_2$ is the element
for which $f_{ \{x_1\}} (x_2)$ is maximal and so
forth. Note that for any $i$, let
$T_i= \{x_1, ... ,x_i\}$ and every $j> i$ then
$f_{T_i} (x_j) \leq \frac{f(T_i)}{i}$. Which mean
that the optimal value for $\Gamma_{T_k}$ is
at least $f_{T_k}( S^* \backslash T_k) = f(S^*) - f(T)$.
}
\begin{lemma}
\label{lemma:enum_s'}
Let $S'$ be the set generated from $S_2$ by the
process in Step 1(b) of the algorithm.
Then
$f(S') \geq f(S_2) \frac{L-w(T)}{w(S_2)}
- \frac{f(T)}{|T|}$
\end{lemma}
\begin{proof}
Note that the process cannot terminate when $S'=S_2$
since $w(S_2) > L - w(T)$. Consider the first element
$x$ that maximized the ratio
$\frac{f(\{x\})}{w_x}$,
but was not added to $S'$, since
$w(S' \cup \{x\}) > L- w(T)$.
By the linearity of $f$,
it is clear that
\begin{enumerate}
\item[(i)]
$\frac{f(S' \cup \{x\} ) } {w(S' \cup \{x\})}
\geq \frac{f( \{x\})}{w_x}$, and
\item[(ii)]
For any $y \in S_2 \backslash (S' \cup \{x\})$,
$\frac{f(\{y\})} {w_y} \leq \frac{f(\{x\})}{w_x}$.
\comment{
\begin{enumerate}
\item[(i)]
$\frac{f(S' \cup \{x\} ) } {w(S' \cup \{x\})}
\geq \frac{f( \{x\})}{w_x}$
\item[(ii)]
For any $y \in S_2 \backslash (S' \cup \{x\})~~$
$\frac{f(\{y\} )}
{w_y}
\leq \frac{f(\{x\})}{w_x}$
\end{enumerate}
}
\end{enumerate}
Thus, we get that for any
$y \in S_2 \backslash (S' \cup \{x\})$,
$
\frac{f(\{y\})}
{w_y}
\leq
\frac{f(S' \cup \{x\} ) } {w(S' \cup \{x\})},
$
and
$$
f(S_2) = f(S'\cup \{x\}) +\sum_{y\in S_2 \setminus (S' \cup \{x\})} f(\{y\})
\leq f(S' \cup \{x\}) \frac{ w(S_2)}{w(S' \cup \{x\})}.
$$
By the linearity of $f$, we get that
$f(S') + f(\{x\})=f(S' \cup \{x\}) \geq f(S_2) \frac{L - w(T)}{w(S_2)}$.
Since $x\in S_2 \in X_T$, we get $f(\{x\}) \leq \frac{f(T)}{|T|}$.
Hence $f(S') \geq f(S_2) \frac{L - w(T)}{w(S_2)} - \frac{f(T)}{|T|}$.
\end{proof}
Consider the iteration of Step \ref{enum:main_loop}.
in the above algorithm,
in which $T = T_2$ (assuming there are at least two elements
in the optimal solution; else $T= T_1$),
and the values of the solutions found in this iteration.
By Theorem \ref{lemma:lagrangian_relaxation}, taking
$\alpha= \frac{1}{1+r}$, one of
the following holds:
\begin{enumerate}
\item
\label{enum:s1_is_good}
$f(S_1) \geq \frac{r}{1+r} [f(S^*)- f(T)]$
\item
\label{enum:s2_is_good}
$f(S_2) \geq (1-r -\eps) [f(S^*)-f(T)]
\frac{w(S_2)} {L-w(T)}$.
\end{enumerate}
If \ref{enum:s1_is_good}. holds then we get
$f(S_1 \cup T) \geq f(T)+
( \frac{r}{1+r} - \eps )[ f(S^*) -f(T)]
\geq (\frac{r}{1+r} - \eps) f(S^*)$,
else we have that
$f(S_2) \geq (\frac{r}{1+r} -\eps) [f(S^*)-f(T)]
\frac{w(S_2)}{L-w(T)}$,
and by Lemma \ref{lemma:enum_s'},
$$
f(S') \geq f(S_2)\frac{L-w(T)}{w(S_2)} -
\frac{f(T)}{|T|}\\
\geq (\frac{r}{1+r}-\eps)[f(S^*)-f(T) ] -
\frac{f(T)}{|T|}.
$$
Hence, we have
\begin{eqnarray*}
f(S' \cup T) &=& f(S') + f(T) \geq
f(T)+ (\frac{r}{1+r}-\eps)[f(S^*)-f(T) ] -
\frac{f(T)}{|T|} \\
&=& (1- \frac{1}{k})f(T)+ (\frac{r}{1+r}-\eps)[f(S^*)-f(T) ]
\geq (\frac{r}{1+r}-\eps)f(S^*).
\end{eqnarray*}
The last inequality follows from choosing $k=2$, and
the fact that $\frac{1}{2} \geq \frac{r}{1+r}- \eps$.
\begin{theorem}
\label{thm:enumeration_ratio}
Algorithm \ref{alg:general} outputs an
$(\frac{r}{1+r} -\eps)$-approximation for $\Gamma$.
The number of calls to algorithm $\mathcal{A}$ is
$O( ( \log (p_{max})+ \log(L) + \log(\eps ^{-1}) )n^2)$,
where $n= \left| U \right|$ is the size of the universe of elements
for the problem $\Gamma$.
\end{theorem}
We summarize the above discussion in the next result.
\begin{corollary}
\label{cor:lagrang}
Given a subset selection problem $\Gamma$ with a linear
constraint, an algorithm $\mathcal{A}$ that
yields an $r$-approximation for $\Gamma(\lambda)$, and
$\lambda_{max}$, such $w(\mathcal{A}(\lambda_{max})) \leq L$,
there is an $(\frac{r}{1+r} -\eps)$-approximation
algorithm, such that the number of calls of the algorithm to $\mathcal{A}$
is polynomial in $\eps$, the size of the universe, $|U|$,
and the input size.
\end{corollary}
In the Appendix we show how our technique for solving subset selection
problems with a single linear constraint can be extended to
solve such problems with multiple linear constraints, by
repetitive usage of our technique.
\comment{
\myparagraph{Submodular objective functions} In the more general
case,
where $f$ is a submodular function, we need to redefine the objective
function for $\Gamma_T$ to be $f_T(S')=f(S'\cup T) -f(T)$,
and the condition $f(\{s\}) \leq \frac{f(T)}{|T|}$ should
be modified to $f_T(\{s\}) \leq \frac{f(T)}{|T|}$. In Step 1(b)
of the algorithm, the
element $x$ to be chosen in each stage
is $x\in S_2\setminus S'$ which maximizes
the ratio $\frac{f_T(S'\cup \{x\}) - f_T(S')}{w_x}$.
\subsection{Extension to Multiple Linear Constraints}
\label{sec:multi_budgeted}
In the Appendix we show how our technique for solving subset selection
problems with a single linear constraint can be extended to
solve such problems with multiple linear constraints, by
repetitive usage of our technique.
\begin{theorem}
\label{thm:multi_budgeted}
Given a subset selection problem $\Gamma$ with $d > 1$ linear
constraints, an algorithm $\mathcal{A}$ which
yields a $r$-approximation for $\Gamma(\lambda)$, and
$\lambda_{max}$, such
$w(\mathcal{A}(\lambda_{max})) \leq L$,
there is a $(\frac{r}{1+dr} -\eps)$-approximation
algorithm, such that number of call of the
algorithm to $\mathcal{A}$ is polynomial
in $\eps$, the size of of the universe $|U|$, and the input size.
\end{theorem}
The previously showed results in this paper shows how a problem with
a single linear constraint can be solved using an algorithm
that solve the Lagrangian relaxation of the problem. However, in many
real life scenario more than one linear constraint appears in the problem.
More formally, consider the problem:
\begin{eqnarray}
\label{prb:multi}
\max_{S \in X} & f(S)~~~ \mbox{subject to:} \\
\forall_{1\leq i \leq d}: & w_i(S) \leq L_i \nonumber
\end{eqnarray}
Where $X$ is a lower ideal, and the function $f$ and $w_i$ for every $1 \leq i \leq d$ are
non-decreasing linear set function, such that $f(\emptyset)=w_i(\emptyset)=0$.
This problem can be interpreted as a subset selection problem with
linear constraint as follows; let
$X' = \left\{S \in X | \forall_{1\leq i \leq d-1}:~ w_i(S) \leq L_i \right\}$, and
the linear constraint would be $w_d(S) \leq L_d$, the function $f$ would remain as
it is. The Lagrangian relaxation of \eqref{prb:multi} would be of the same form (after
removing elements with negative profit in the relaxation),
but with $d-1$ linear constraints instead of $d$.
This mean, that by repetitive usage of the technique presented in the
above subsection, an approximation algorithm for \eqref{prb:multi}
can be obtained from an approximation algorithm for the
problem without linear constraint (which is $\max_{S\in X} f'(X)$, where
$f'$ is some linear function). Hence, given a $r$-approximation algorithm for
the problem after "relaxing" $d$ constraints, an $\frac{r}{1+dr}$
approximation algorithm for \eqref{prb:multi} is obtained.
Note that there is a simple reduction\footnote{
Assume w.l.o.g that $L_i=1$ for every $1\leq i\leq d$, and
set the weight of an element $e$ to be $w_e = \max_{1\leq i \leq d} w_i(\{e\})$}
from problem \eqref{prb:multi}
to the same problem with $d=1$, which obtains
a $\frac{r}{d}$-approximation for \eqref{prb:multi} given a $r$-approximation
algorithm $\mathcal{A}$
for the problem with single constrain.
By repetitive usage
of Lagrangian relaxation a $\frac{r}{1+(d-1)r}$-approximation
algorithm can be obtained using $\mathcal{A}$, which is always
a better approximation ratio than the ratio obtained by the simple
reduction.
}
\subsection{Lagrangian Relaxation: Example}
\label{sec:example}
We now show the tightness of the bound in Theorem \ref{thm:enumeration_ratio}. Consider the following problem.
We are given a base set of elements $A$, where each element $a \in A$
has a profit $p(a) \in \mathbb{N}$. Also, we have three subsets of elements $A_1,A_2,A_3 \subseteq A$,
and a bound $k >1$. We need to
select a subset $S\subseteq A$ of size at most $k$, such that
$S \subseteq A_1$, or
$S \subseteq A_2$, or $S \subseteq A_3$, and the
total profit from elements in $S$
is, i.e., $\sum_{a\in S} p(a)$, is maximized.
The problem can be easily interpreted as a subset selection problem,
by taking the universe
to be $U= A$, the domain $X$ consists of all the subsets $S$ of
$U$, such that
$S \subseteq A_1$ or $S \subseteq A_2$, or $S \subseteq A_3$. The
weight function is $w(S) = |S|$,
with the weight bound
$L=k$, and the profit of a subset $S$ is given by $f(S)= \sum_{a\in S} p(a)$.
The Lagrangian relaxation of the problem with parameter $\lambda$ is
$\max_{S\in X} f(S)-\lambda w(S)$.
Assume that we have an algorithm $\mathcal{A}$ that
returns an $r$-approximation for the Lagrangian relaxation of the problem.
For any $\frac{1}{2}>\delta >0$ and an integer $k>\frac{1}{r}+4$,
consider the following input:
\begin{itemize}
\item
$A_1 = \{a_1,\ldots,a_{k-1},b\}$, where $p(a_i) = \frac{1}{r}$ for
$1\leq i \leq k-1$, and $p(b) = k-1$.
\item
$A_2 =\{c\}$ where $p(c) = k +\delta$.
\item
$A_3 = \{d_1,\ldots,d_\ell \}$, where
$\ell = \ceil{\frac{(1+r)(k-1)}{\delta r}}$, and $p(d_i) = 1 +\delta$
for $1 \leq i \leq \ell$.
\item
$U= A= A_1 \cup A_2 \cup A_3$, and the set $S$ to be chosen is of size at most $k$.
\end{itemize}
Denote the profit from a subset $S \subseteq U$ by $p(S)$, and the
profit in the Lagrangian
relaxation with parameter $\lambda$ by $p_\lambda(S)$.
Clearly, the subset $S = A_1$ is an optimal solution for the problem,
of profit $p(A_1)=(k -1)\frac{1+r}{r}$.
Consider the possible solutions algorithm $\mathcal{A}$ returns
for different values of $\lambda$:
\begin{itemize}
\item
For $\lambda <1$: the profit from any subset of $A_1$ is bounded by the
original profit of
$A_1$, given by $p(A_1)=(k -1)\frac{1+r}{r}$;
the profit from the set $S=A_3$ is equal to
$p(A_3)=(1+\delta- \lambda)\ell \geq
\delta \ell \geq (k-1)\frac{(1+r)}{r}$, i.e.,
$A_3$ has higher profit than $A_1$.
\item
For $1 \leq \lambda \leq \frac{1}{r}$: the profit from any
subset of $A_1$ is bounded by the total profit of $A_1$ (all
elements are of non-negative profit in the relaxation).
Taking the difference, we have
\begin{eqnarray*}
r \cdot p_\lambda(A_1) - p_\lambda(A_2) &=&
r \left( k-1-\lambda +(k-1)(\frac{1}{r} - \lambda) \right) - (k -\lambda) \\
&=& r k -r - r \lambda +k - - r \lambda k +r k -k + \lambda \\
&= & (1-\lambda)(r k -1) -r \leq 0
\end{eqnarray*}
This implies that in case the optimal set is $A_1$ (or a subset of $A_1$),
the algorithm $\mathcal{A}$ may choose the set $A_2$.
\item
For $\lambda > \frac{1}{r}$: the maximal profit from any subset of $A_1$
is bounded in this case by $\max\{k-1-\lambda,0\}$, whereas the profit
from $A_2$ is $\max\{k-\lambda,0\}$.
\end{itemize}
From the above, we get that $\mathcal{A}$ may return a subset of $A_2$
or $A_3$ for any value of $\lambda$.
However, no combination of elements of $A_2$ and $A_3$ yields a
solution for the original problem
of profit greater than $k(1+\delta)$.
This means that, by combining the solutions returned by
the Lagrangian relaxation, one cannot achieve approximation ratio better than $\frac{k(1+\delta)}{(k-1)(1+\frac{1}{r})}=
\frac{r}{1+r}\cdot \frac{k(1+\delta)}{k-1}$.
Since $\frac{r}{1+r} \cdot \frac{k(1+\delta)}{k-1} \rightarrow \frac{r}{1+r}$
for $(k,\delta) \rightarrow (\infty,0)$,
one cannot achieve approximation ratio better than $\frac{r}{1+r}$.
\comment{
\section{Proof of Lemma \ref{lemma:card_greedy}}
We use in the proof the next result, due to Nemhauser et al. \cite{NWF78}.
\begin{lemma}
\label{lemma:greedy_increments}
A set function $f$ over a ground set $X$ is non-decreasing submodular iff
for all $S,T \subseteq X$ $f(T) \leq f(S) + \sum_{x \in T \setminus S}
\Delta_x f$,
where $\Delta_xf= f(S \cup \{x \})- f(S)$.
\end{lemma}
{\noindent \bf Proof of Lemma \ref{lemma:card_greedy}:}
It is easy to show (e.g., by using induction) that for every element
$s \in S_2 \backslash S'$,
\begin{equation}
\label{eq:card_relative_density}
f(S'\cup \{x\})- f(S') < \frac{f(S')}{L},
\end{equation}
since $f$ is a
non-decreasing submodular set function.
Using \eqref{eq:card_relative_density} and the fact that $f$ is submodular,
we get that
\comment{
$$
f(S_2) \leq
f(S') + \sum_{s \in S_2\backslash S'} {f(S' \cup \{s\}) - f(S')}
\leq
f(S')+ (|S_2| - L ) \frac{f(S')}{L}
= f(S') \frac{|S_2|}{L}
$$
}
\begin{eqnarray*}
f(S_2) &\leq&
f(S') + \sum_{s \in S_2\backslash S'} {f(S' \cup \{s\}) - f(S')} \\
&\leq&
f(S')+ (|S_2| - L ) \frac{f(S')}{L}
= f(S') \frac{|S_2|}{L}
\end{eqnarray*}
Thus, using \eqref{eq:beta_appx}, we have that
\[
f(S') \geq f(S_2) \frac{L}{w(S_2)} \geq \beta \cdot OPT.
\]
\hspace*{\fill} $\Box$ \vskip \belowdisplayskip
}
\section{Applications to Budgeted Subset Selection}
In this section we show how
the technique of Section \ref{sec:rounding}
can be applied to obtain approximation algorithms
for several classic subset selection problems with a linear constraint.
\subsection{Budgeted Real Time Scheduling}
\label{sec:bba}
The budgeted real-time scheduling problem
can be interpreted as the following subset selection problem
with linear constraint. The universe $U$
consists of all instances associated with the activities
$\{ A_1, \ldots , A_m\}$.
The domain $X$ is the set of all feasible schedules;
for any $S \in X$, $f(S)$ is the profit from the instances
in $S$, and $w(S)$ is the total cost of the instances in $S$ (note
that each instance is associated with specific
time interval). The Lagrangian relaxation of this
problem is the classic \emph{interval scheduling} problem discussed
in \cite{BB00}: the paper gives a $\frac{1}{2}$-approximation algorithm,
whose running time is $O(n \log n)$, where $n$ is the total number
of instances in the input.
Clearly,
$p_{\max}$ (as defined in \eqref{eq:def_pmax}) can be used as $\lambda_{\max}$.
By Theorem \ref{lemma:finding}, we can find two
solutions $S_1,S_2$ which satisfy the conditions of
Theorem \ref{lemma:lagrangian_relaxation}
in $O(n\log (n)\log(Lp_{\max}/ \eps))$ steps.
Then, a straightforward implementation of the
technique of Section \ref{sec:rounding_card}
yields a $\left(\frac{1}{3}-\eps \right)$-approximation algorithm
whose running time is
$O(n\log (n)\log(Lp_{\max}/\eps))$ for inputs where all instances have {\em
unit} cost.
The same approximation ratio can be obtained in
$O(n^3 \cdot \log (n) \log(Lp_{\max} / \eps))$
steps when the instances may have {\em arbitrary} costs,
using Theorem \ref{thm:enumeration_ratio} (Note that the
Lagrangian relaxation of the residual problem with respect
to a subset of elements $T$ is also an instance of the
interval scheduling problem).
Consider now the continuous case, where each instance within some activity
$A_i$, $1 \leq i \leq m$, is given by a time window.
One way to interpret BCRS as a subset
selection problem is by setting the universe
to be all the pairs of an instance and
a time interval in which it can be scheduled.
The size of the resulting universe is
unbounded: a more careful consideration of all possible start times of any
instance yields a universe of exponential size.
The Lagrangian
relaxation of this problem is known
as \emph{single machine scheduling with release times and deadlines},
for which a $( \frac{1}{2} -\eps)$-approximation algorithm is given
in \cite{BB00}.
Thus, we can apply our technique for
finding two solutions $S_1,S_2$ for which
Theorem \ref{lemma:lagrangian_relaxation} holds.
However, the running time of the algorithm in
Theorem \ref{thm:enumeration_ratio}
may be exponential in the input size (since the number of the
enumeration steps depends on the size of the universe,
which may be exponentially large).
Thus,
we derive an approximation algorithm using the technique of Section
\ref{sec:rounding_linear}.
We summarize in the next result.
\begin{theorem}
\label{thm:bba}
There is a polynomial time algorithm that yields an approximation ratio of
$( \frac{1}{3} -\eps)$ for BRS, and the ratio $\left(\frac{1}{4} - \eps
\right)$ for BCRS.
\end{theorem}
Our results also hold for other budgeted variants
of problems that appear in \cite{BB00}.
\subsection{The Budgeted Generalized Assignment Problem}
\label{sec:bgap}
Consider the interpretation of GBAP as a subset selection problem, as given
in Section \ref{sec:rounding}.
The Lagrangian
relaxation of BGAP (and also of the
deduced residual problems) is an instance of GAP, for which
the paper \cite{FG06} gives a $(1-e^{-1}-\eps)$-approximation
algorithm.
We can take in
Theorem \ref{lemma:finding} $\lambda_{\max}= p_{\max}$,
where $p_{\max}$ is defined by \eqref{eq:def_pmax}, and
the two solutions $S_1,S_2$
that satisfy the condition of Theorem
\ref{lemma:lagrangian_relaxation} can be found in polynomial time.
Applying the techniques of Sections \ref{sec:rounding_card} and
\ref{sec:enumeration}, we get the next result.
\begin{theorem}
\label{thm:bgap}
There is a polynomial time
algorithm that yields an approximation ratio of
$\frac{1- e^{-1}}{2- e^{-1}} -\eps \approx 0.387 - \eps$
for BGAP.
\end{theorem}
A slightly better approximation ratio can be obtained by using
an algorithm of \cite{FV06}.
More generally, our result holds also
for any constrained variant of the {\em separable assignment problem (SAP)}
that can be solved using a technique of \cite{FG06}.
\subsection{Budgeted Maximum Weight Independent Set}
\label{sec:bwis}
BWIS can be interpreted as the following
subset selection problem with linear constraint. The universe $U$ is
the set of all vertices in the graph, i.e., $U=V$, the domain $X$ consists of
all subsets $V'$ of $V$, such
that $V'$ is an independent set in the given graph $G$. The objective
function $f$ is $f(V')= \sum_{v\in V'} p_v$,
the weight function is $w(V')= \sum_{v \in V'} c_v$, and
the weight bound
is $L$. The Lagrangian relaxation of BWIS is an instance
of the classic WIS problem (vertices with negative profits
in the relaxation are deleted, along with their edges).
Let $|V|=n$, then by Theorem \ref{thm:enumeration_ratio},
given an approximation algorithm $\mathcal{A}$ for WIS with approximation
ratio $f(n)$, the technique of Section \ref{sec:enumeration}
yields an approximation algorithm $\mathcal{A}_{I}$ for $BWIS$, whose
approximation ratio is
$\frac{f(n)}{1+f(n)}- \eps$. The running time of $\mathcal{A}_{I}$ is
polynomial in the input size
and in $\log(1/\eps)$. If $\log(1/f(n))$ is polynomial, take
$\eps = \frac{f(n)}{n}$; the value $\log(1/\eps) = \log(1/f(n))+ \log(n)$
is polynomial in the input
size; thus, the algorithm remains polynomial. For this selection
of $\eps$, we have the following result.
\comment{
the approximation ratio of the algorithm is $g(n)=\frac{f(n)}{1+f(n)} -\frac{f(n)}{n} =\Theta(f(n))$.
this means that
the approximation ratios of $\mathcal{A}$ and $\mathcal{B}$ are asymptotically identical.
For example, this mean that using the algorithm of \cite{Ha00}, our technique
archives a $\Omega(\frac{\log^2 n}{n})$ approximation for BWIS.
}
\begin{theorem}
\label{thm:bwis}
Given an $f(n)$-approximation algorithm for WIS, where
$f(n)=o(n)$, for any $L \geq 1$ there exists a polynomial time algorithm that
outputs a $g(n)$-approximation ratio for any instance of BWIS with the budget
$L$, where $g(n)=\Theta(f(n))$, and $\lim_{n\rightarrow \infty}
\frac{g(n)}{f(n)} =1$.
\end{theorem}
This means that
the approximation ratios of $\mathcal{A}$ and $\mathcal{A}_I$ are
asymptotically the same.
Thus, for example, using the algorithm of \cite{Ha00}, our technique
achieves an $\Omega(\frac{\log^2 n}{n})$-approximation for BWIS.
Note that the above result holds for any constant number of linear
constraints added to an input for WIS, by repeatedly applying
our Lagrangian relaxation technique.
\section{Reoptimization of Subset Selection Problems}
\label{sec:reopt}
In this section we show how
our Lagrangian relaxation technique can be used to obtain $(1,\alpha)$-reapproximation algorithms for subset selection problems, where
$\alpha \in (0,1)$.
To this end, we present the notion of {\em budgeted reoptimization}.
Throughout the discussion, we assume that $R(\Pi)$ is the reoptimization version of a maximization problem $\Pi$.
\subsection {\bf Budgeted Reoptimization}
\label{reopt:budgeted}
The budgeted reoptimization problem $R(\Pi, b)$ is a restricted version of $R(\Pi)$, in which we add the constraint that the
transition cost is at most $b$, for some budget $b \geq 0$, and the transition function $\delta$.
Formally,
\begin{eqnarray}
\label{reopt_prb:general_constraint}
R(\Pi,b):& {\max}_{s \in U} & p(s) \\
\nonumber
&\mbox{subject to:} & \delta(s) \leq b.
\end{eqnarray}
The optimal profit for $\rpim$ is denoted $p(\co_b)$, where
$\co_b$ is the best solution that can be reached from the initial solution with transition cost at most $b$.
\begin{definition}
An algorithm ${\cal A}$ yields an $r$-approximation for $\rpim$, for $r\in (0,1]$, if
for any reoptimization input $I$, ${\cal A}$
yields a solution $s$ of profit $p(s) \geq r\cdot p(\orpim)$, and transition cost at most $b$.
\end{definition}
\noindent{\bf Example:}
Assume that $\Pi$ is the $0$-$1$
Knapsack problem. An instance $I$ of $\Pi$ consists of a bin of capacity $B$ and $n$ items with profits $p_i \geq 0$
and weights $w_i \geq 0$, for $1\leq i\leq n$. The formal representation of the problem is $U=\{$all feasible packings of the knapsack$\}$, and $p(s)=\sum_{i\in s}{p_i}$. In the reoptimization version of the problem,
$R(\Pi)$, each instance $I$ contains also the transition cost of item $i$, given by $\delta_i \geq 0$, for $1 \leq i \leq n$.
In the budgeted reoptimization version, $\rpim$,
$U$ is restricted to contain solutions having transition cost at most $b$. Thus, $U=\{s|~ s$ is a feasible packing of
the bin, and $\delta(s)\leq b\} = \{s|~ w(s) \leq B$,
and $ \delta(s) \leq b \}$.
For various problems, $R(\Pi,b)$ satisfies the conditions of
Corollary \ref{cor:lagrang}. In particular, given a problem $\Pi$, let $\Gamma_b = \rpim$, for some $b \geq 0$, and let
$\Gamma_b(\lambda)$ be the Lagrangian relaxation of $\rpim$, i.e.,
$\Gamma_b(\lambda) = \max_{s \in U} p(s) - \lambda \cdot \delta(s)$. If $\Gamma_b(\lambda)$ yields an instance of $\Pi$ then, by Corollary \ref{cor:lagrang}, an
$r$-approximation algorithm ${\cal A}$ for $\Pi$, satisfying for certain value of $\lambda$: $w({\cal A}) \leq b$, yields
an $(\frac{r}{r+1} - \eps)$-approximation for $\rpim$.
In the following, we show how this can be used to obtain a reaproximation algorithm for $R(\Pi)$.
\subsection {\bf Algorithm}
An instance of our reoptimization problem $R(\Pi)$ consists of a universe $U$ of $n$ items.
Each item $i$ has a non-negative profit $p_i$, and a transition cost $\delta_{i} \in \mathbb{N}$.
We give below Algorithm \ref{alg:reopt}, which uses approximation algorithms for $\Pi$ and $\rpim$ in solving
$R(\Pi)$.
\begin{center}
\fbox{
\begin{minipage}{0.8\textwidth}
\begin{alg} \label{alg:reopt} Reapproximating
$R(\Pi)$ for an instance $I$
\begin{enumerate}
\item \label{alg:approximate}
For $r_1, r_2 \in (0,1]$, let $\ca$ be an $r_1$-approximation algorithm for
$\Pi$, and\\let $\ca_b$ be an $r_2$-approximation algorithm for
$R(\Pi,b)$.
\item \label{alg:approximate}
Approximate $\Pi(I)$ using $\ca(I)$ :
$$Z \leftarrow p(\ca(I))$$
\item \label{alg:calculate}
Use binary search
to find a budget $b > 0$ satisfying:
\begin{enumerate}
\item \label{alg:profit}
$p(\ca_b(I)) \geq
r_2 \cdot Z$
\item \label{alg:budget}
$p(\ca_{b-1}(I)) < r_2 \cdot Z$
\end{enumerate}
\item Return $\ca_{b}(I)$
\end{enumerate}
\end{alg}
\end{minipage}
}
\end{center}
\begin{theorem}
\label{thm:reopt}
Let $I$ be an instance of the reoptimization problem $R(\Pi)$. For $r_1, r_2 \in (0,1]$, given
an $r_1$-approximation algorithm $\ca$ for $\Pi$,
and an $r_2$-approximation algorithm $\ca_b$ for $R(\Pi,b)$, for all $b \geq 0$,
Algorithem \ref{alg:reopt} yields in polynomial time a
$(1,r_1\cdot r_2)$-reapproximation
for $R(\Pi)$.
\end{theorem}
Recall that ${\cal O}$ is an optimal solution for $\Pi$, and $OPT$ is a solution for $R(\Pi)$ having the minimum transition cost,
among the solutions of
profit $p({\cal O})$.
In Section \ref{subsec:Proof} we prove the theorem,
by showing that the solution, $S_{\ca}$, output by Algorithm \ref{alg:reopt}
has the following properties.
\begin{enumerate}
\item [(i)]
The total transition cost of ${\Sa}$ is at most the
transition cost of $OPT$,
i.e., $$\delta({\Sa}) \leq \delta(OPT)$$
\item [(ii)]
The profit of ${\Sa}$ satisfies
$$p(\Sa) \geq r_1 \cdot r_2 \cdot p(OPT).$$
\end{enumerate}
Combining Theorem \ref{thm:reopt} and Corollary \ref{cor:lagrang},
we show that a wide class of reoptimization problems can be
approximated using our technique.
\begin{cor}
\label{cor:reoptlag}
Let $R(\Pi)$ be the reoptimization version of a subset selection problem $\Pi$, and let $\Gamma_b= \rpim$, for $b \geq 0$.
Denote by ${\cal A}$ an $r$-approximation algorithm for $\Pi$, for $r \in (0,1)$.
If the lagrangian relaxation of $\Gamma_b$, $\Gamma_b(\lambda)$, yields an instance of the base problem $\Pi$, for all $b \geq 0$,
then for any $\eps >0$, Algorithm \ref{alg:reopt} is a $(1,\frac{r^2}{1+r}-\varepsilon)$-reapproximation
algorithm for $R(\Pi)$.
\end{cor}
\begin{proof}
By Corollary \ref{cor:lagrang}, given $\eps' >0$, we have an $(\frac{r}{r+1} - \eps')$-approximation algorithm, ${\cal A}_b$, for $\rpim$,
for any $b \geq 0$. Thus, using Theorem \ref{thm:reopt} with algorithms ${\cal A}$ and ${\cal A}_b$, and
taking $\eps' = \frac{\varepsilon}{r}$, we obtain a
$(1,r \cdot (\frac{r}{1+r} - \frac{\varepsilon}{r}))$-reapproximation algorithm
for $R(\Pi)$.
\end{proof}
\subsection {\bf Proof of Theorem \ref{thm:reopt}}
\label{subsec:Proof}
We use in the proof the next lemmas.
\begin{lemma}
\label{lem:cost}
The solution output by Algorithm \ref{alg:reopt}
for an instance $I$
satisfies $\delta({\Sa})\leq {\delta(OPT)}$.
\end{lemma}
\begin{proof}
Let $OPT$ be a solution of minimum transition cost, among those that yield an optimal profit for $\Pi$,
and let $b^* \geq \delta(OPT)$.
By definition, $OPT$ is a valid solution of
$\Pi(R,b^*)$.
Hence, the optimal profit of $\Pi(R,b^*)$ is
$p(OPT)$, and we have
$$p(\ca_{b^*}(I)) \geq r_2 \cdot p(OPT) \geq r_2 \cdot Z.$$
It follows that, for any budget $b$ satisfying $\ca_b(I) < r_2 \cdot Z$, we have $b <\delta(OPT)$.
By Step (\ref{alg:budget}), the algorithm selects a budget $b$ such that
$p(\ca_{b-1}(I)) < r_2\cdot Z$. Hence, $b-1<\delta(OPT)$. Since
$b$ and $\delta(OPT)$ are integers, we have that $b\leq \delta(OPT)$.
\end{proof}
\begin{lemma}
\label{lem:profit}
The profit of $S_{\ca}$ satisfies
$p(S_{\ca}) \geq r_1 \cdot r_2\cdot{p(OPT)}$.
\end{lemma}
\begin{proof}
In Step (\ref{alg:profit}), Algorithm \ref{alg:reopt} selects a solution of profit at least
$r_2\cdot Z$. Also,
$Z$ is an $r_1$-approximation for $\Pi$; therefore, $Z \geq r_1\cdot p(OPT)$.
This yields the statement of the lemma.
\end{proof}
\begin{lemma}
\label{lem:time}
Algorithm \ref{alg:reopt} has polynomial running time.
\end{lemma}
\begin{proof}
The algorithm proceeds in three steps.
Step \ref{alg:approximate} is polynomial since $\ca$ runs in
polynomial time. In Step \ref{alg:calculate} we search over all budgets
$0 \leq b \leq b_{max} = \sum_{a \in I} \delta(a)$. While $b_{max}$
may be arbitrarily large,
$log(b_{max})$ is polynomial in the input size, and indeed Algorithm \ref{alg:reopt} calls $\ca_b$ $O(log(b_{max}))$ times.
\end{proof}
Combining the above lemmas, we have the statement of the theorem.
\qed
\subsection{A Reapproximation Algorithm for SRAP}
We now show how to use Algorithm \ref{alg:reopt} to
obtain a $(1,\alpha)$-reapproximation algorithm for SRAP, for some $\alpha \in (0,1)$. Recall, that an input for the {\em real-time scheduling problem}
consists of a set
${\cal A} = \{ A_1, \ldots , A_m \}$
of \emph{activities},
where each activity consists of a set
of \emph{instances};
an instance $\cI \in A_j$ is defined
by a half open time interval $[s(\cI),e(\cI))$ in which the instance
can be scheduled ($s(\cI)$ is the start time, and $e(\cI)$ is
the end time), and a profit $p(\cI) \geq 0$.
A schedule is \emph{feasible} if it contains
at most one instance of each activity, and for any $t \geq 0$, at
most one instance is scheduled at time $t$.
The goal is to find a feasible schedule of a subset of the activities that maximizes the total profit (see, e.g., \cite{BB00}).
Let $\Pi$ be the real-time scheduling problem. Then SRAP can be cast as $R(\Pi)$, the reoptimization version of $\Pi$.
Now, given budgeted SRAP, $\Gamma_b = R(\Pi, b)$, in which the transition cost is bounded by $b$, for some $b \geq 0$,
we can write $\Gamma_b$ in the form
\[
\Gamma_b:~ \max_{S \in X} ~f(S)~~~
\]
\negA
\negA
\begin{equation}
\label{eq:subset_constraint}
\mbox{subject to:} ~ w(S) \leq b,
\end{equation}
where $X=\{\mbox{all feasible operation schedules} \}$, and $w(S)=\delta(S)$. The Lagrangian relaxation of $\Gamma_b$ is
$\Gamma_b (\lambda): ~\max_{S\in X} {f(S) - \lambda\cdot w(S),}$.
We note that $\Gamma_b (\lambda)$ yields an instance of the real-time scheduling problem, $\Pi$.
Our base problem, $\Pi$, can be approximated within factor $1/2$ \cite{BB00}.
As shown in Section \ref{sec:bba}, budgeted real-time scheduling admits a $(\frac{1}{3} -\eps)$-approximation.
The next result follows from Theorem \ref{thm:reopt}.
\begin{theorem}
\label{thm_srap}
There is a polynomial-time $(1, 1/6 -\eps)$-reapproximation algorithm for SRAP.
\end{theorem}
\comment{
We derive below a $(1,\alpha)$-reapproximation algorithm for the surgery room allocation problem, using the following steps.
\begin{enumerate}
\item Find the base problem.
\item Find an $r_1$-aproximation algorithm for the base problem
\item Find an $r_2$-aproximation algorithm for the budgeted version of the base problem
\end{enumerate}
We note that the base problem is the discrete version of {\em real-time scheduling}, for which there is a $1/2$-approximation algorithm \cite{BB00}.
a $(1, \frac{1}{6} - \eps)$-reapproximation algorithm for the surgery room allocation problem.
}
\comment{
\mysubsection {\bf Cloud Provider Problem}
Cloud computing is a term used to refer to a model of network computing where a program or application runs on a connected server or servers rather than on a local computing device.
Nowadays many companies in the industry provides a growing service of cloud computing and cloud storage (see. e.g., Google Cloud Platform [cloud.google.com], Amazon Web Services [aws.amazon.com] , Microsoft Azure [azure.microsoft.com], IBM [www.ibm.com/cloud-computing], HP [www.hpcloud.com], and many more). The provider delivers an infrastructure that enables clients to perform Their own services on remote virtual machines.
In the cloud provider reoptimization problem, there are $n$ hypervisors each with computing power of $C_i$, $m$ virtual machines each requires $r_j$ computing units and have profit of $p_j$, and migration cost of $\delta_{i,j}$ (for the reassignment of machine $j$ to server (hypervisors) $i$).
A feasible solution for the problem is collection of assignment $(i,j)$ denoted by $S$ such that each virtual machine $j$ appears at most in one assignment in $S$ and
that for each hypervisor $i$ the computing units required for the assignment
fit into its computing power of the hypervisor- $$\sum_{j| (i,j) \in S } r_j \leq C_i$$
The universe $U$ of the problem is the collection of all feasible solutions,
the profit function of the problem is
$$p(S)=\sum_{ (i,j)\in S } p_j$$ and
the transition cost function is $$\delta(S) = \sum_{ (i,j)\in S } \delta_j$$
\begin{theorem}
\label{thm:cloud}
There is a $(1,1/2-\varepsilon)$-reapproximation algorithm for the "Cloud Provider Problem".
\end{theorem}
\label{subsec:cloud}
\mysubsubsection {\bf Proof of Theorem \ref{thm:cloud}}
In order to construct an algorithm to the "Cloud Provider Problem"
We first show that the base problem of the problem is the
Multiple Knapsack Problem [Lemma \ref{lma:mkp}],
then we show that $\Gamma(R(\Pi,m))$ is an instance of the base
problem [Lemma \ref{lma:mkplag}], from \cite{MKP05} We get a PTAS for the base problem, with that We can use Corollary \ref{cor:reoptlag} to find a $(1,1/2-\varepsilon)$-reapproximation for the "Cloud Provider Problem".
\begin{lemma}
\label{lma:mkp}
The "Cloud Provider Problem" base problem is an instance of the "Multiple Knapsack Problem".
\end{lemma}
\begin{proof}
In the "Cloud Provider Problem" base problem we need to maximize
the profit of the allocation of the virtual machines on the hypervisors.
There are $n$ hypervisors each with computing power of $C_i$, $m$ virtual machines each requires $r_j$ computing units and have profit of $p_j$. and that is the "Multiple Knapsack Problem" (MKP).
\begin{eqnarray}
\label{prb:general_constraint}
\Pi:& {\max} & \sum_{i}{\sum_{j}{x_{i,j}\cdot p_j}} \\
\nonumber
&\mbox{\bf subject to:}\\
&\forall \mbox{ hypervisors } i & \sum_{j}{x_{i,j}\cdot r_j} \leq C_i\\
&\forall \mbox{ virtual machines } j & \sum_{i}{x_{i,j}} \leq 1\\
\nonumber
& & x_{i,j}\in \{0,1\}
\end{eqnarray}
\end{proof}
\begin{lemma}
\label{lma:mkplag}
The Lagrangian relaxation of $R($MKP$,m)$ a.k.a, $\Gamma(R($MKP$,m))$ is an instance of MKP.
\end{lemma}
\begin{proof}
\begin{eqnarray}
\label{prb:general_constraint}
R(\mbox{MKP},b):& {\max} & \sum_{i}{\sum_{j}{x_{i,j}\cdot p_j}} \\
\nonumber
&\mbox{\bf subject to:}\\
&\forall \mbox{ hypervisors } i & \sum_{j}{x_{i,j}\cdot r_j} \leq C_i\\
&\forall \mbox{ virtual machines } j & \sum_{i}{x_{i,j}} \leq 1\\
& & \sum_{i}{\sum_{j}{\delta_{i,j}}} \leq b\\
\nonumber
& & x_{i,j}\in \{0,1\}
\end{eqnarray}
The Lagrangian relaxation of $R(MKP,m)$ is:
\begin{eqnarray}
\Gamma(R(\mbox{MKP},b)):& {\max} & \sum_{i}{\sum_{j}{(x_{i,j} - \lambda \cdot \delta_{i,j})\cdot p_j}} \\
\nonumber
&\mbox{\bf subject to:}\\
&\forall \mbox{ hypervisors } i & \sum_{j}{x_{i,j}\cdot r_j} \leq C_i\\
&\forall \mbox{ virtual machines } j & \sum_{i}{x_{i,j}} \leq 1\\
\nonumber
& & x_{i,j}\in \{0,1\}
\end{eqnarray}
And the is an instance of MKP.
\end{proof}
\begin{lemma}
\label{lma:cloudfactor}
The Reapproximation factor of the algorithm is $(1,1/2-\varepsilon)$.
\end{lemma}
\begin{proof}
MKP has a PTAS (shown in \cite{MKP05}) thus by Corollary \ref{cor:reoptlag} the
aproximization factor is
$$(1,\frac{(1-\varepsilon)^2}{1+1-\varepsilon})=(1,\frac{1}{2}-\varepsilon')$$
\end{proof}
\mysubsection {\bf The V.O.D Problem}
{\em Video on Demand (VoD)} services have become common in
library information retrieval,
entertainment and commercial applications.
In a VoD system, clients are connected through a network
to a set of servers which hold a large library of video programs.
Each client can choose a program he wishes to view and
the time he wishes to view it. The service should be provided
within a small latency and guaranteeing an almost constant
transfer rate of the data.
The transmission of a movie to a client requires the allocation of
unit load capacity (or, a {\em data stream}) on a server which holds a
copy of the movie.
Since video files are typically large, it is impractical to store
copies of all movies on each server. Moreover, as observed in large
VoD systems, the distribution of accesses to movie files is highly skewed. The goal is to store the movie
files on the servers in a way which enables to satisfy as many
client requests as possible, subject to the storage and load
capacity constraints of the servers.
Formally, suppose that the system consists of $M$ video program
files and $N$ servers. Each movie file $j$, $1 \leq j \leq M$, is
associated with a predicted demand of $p_j$ users, size $s_j$, and $\delta_{i, j}$ the migration cost to server $i$. Each server $i$, $1 \leq i \leq N$,
is characterized by $(i)$ its storage capacity, $S_i$, that is the
size of the disc of the server, and $(ii)$
its load capacity, $L_j$, which is the number of data streams that
can be read simultaneously from that server.
In \cite{STT09} they show that by dividing the movies into two groups, Big and Small, numerate the big movies and solving a restricted version of the problem, in witch each movies can be allocated on a single server, for the small movies will solve the problem.
Where we will show how to solve the allocation of the small movies,
called the Reoptimization Allocation Problem (denoted by $R(AP)$).
By doing so we can eliminate the constraints that in \cite{STT09}
(like the assumptions that all the files have the same size and that the configuration has an optimal solution that
can allocate all users).
\mysubsubsection {\bf Solving the Reoptimization Allocation Problem ($R($AP$)$)}
In $R($AP$)$ We are required to find an profit-optimal feasible
allocation that minimize the transition cost.
The next linear program describe the problem:
\begin{eqnarray}
\label{prb:general_constraint}
R(\mbox{AP}):& {\min} & \sum_{i}{\sum_{j}{\delta_{i,j}\cdot x_{i,j}}} \\
\nonumber
&\mbox{\bf subject to:}\\
& & \sum_{i}{\sum_{j} p_j \cdot {x_{i,j}}} \geq \co. \\
&\forall \mbox{ server } i & \sum_{j}{ s_j \cdot x_{i,j}} \leq S_i\\
&\forall \mbox{ server } i & \sum_{j}{ p_j \cdot x_{i,j}} \leq L_i\\
&\forall \mbox{ movie } j & \sum_{i}{x_{i,j}} \leq 1\\
\nonumber
& & x_{i,j}\in \{0,1\}
\end{eqnarray}
The base problem (the Allocation Problem (AP)) is to find an
optimal-profit feasible allocation.
\begin{eqnarray}
\label{prb:general_constraint}
\mbox{AP}:& {\max} & \sum_{i}{\sum_{j} p_j \cdot {x_{i,j}}} \\
\nonumber
&\mbox{\bf subject to:}\\
&\forall \mbox{ server } i & \sum_{j}{ s_j\cdot x_{i,j}} \leq S_i\\
&\forall \mbox{ server } i & \sum_{j}{ p_j\cdot x_{i,j}} \leq L_i\\
&\forall \mbox{ movie } j & \sum_{i}{x_{i,j}} \leq 1\\
\nonumber
& & x_{i,j}\in \{0,1\}
\end{eqnarray}
This problem is the "Multiple bi-dimensional Knapsack Problem",
with $N$ Knapsacks (each server is a knapsacks).
Now all that remain to show is that the Lagrangian relaxation of $R(AP,m)$, a.k.a, $\Gamma(R(AP,m))$ is an instance of the "Multiple bi-dimensional Knapsack Problem".
\begin{eqnarray}
\label{prb:general_constraint}
R(\mbox{AP},b):& {\max} & \sum_{i}{\sum_{j}{ p_j\cdot x_{i,j}}} \\
\nonumber
&\mbox{\bf subject to:}\\
& & \sum_{i}{\sum_{j}{\delta_{i,j}\cdot x_{i,j} }} \leq b\\
&\forall \mbox{ server } i & \sum_{j}{s_j\cdot x_{i,j} } \leq S_i\\
&\forall \mbox{ server } i & \sum_{j}{ p_j\cdot x_{i,j}} \leq L_i\\
&\forall \mbox{ movie } j & \sum_{i}{x_{i,j}} \leq 1\\
\nonumber
& & x_{i,j}\in \{0,1\}
\end{eqnarray}
\begin{eqnarray}
\label{prb:general_constraint}
\Gamma(R(\mbox{AP},b)):& {\max} & \sum_{i}{\sum_{j} {(p_j-\lambda\cdot\delta_{i,j})\cdot x_{i,j}}}
\\
\nonumber
&\mbox{\bf subject to:}\\
&\forall \mbox{ server } i & \sum_{j}{s_j\cdot x_{i,j} } \leq S_i\\
&\forall \mbox{ server } i & \sum_{j}{ p_j\cdot x_{i,j}} \leq L_i\\
&\forall \mbox{ movie } j & \sum_{i}{x_{i,j}} \leq 1\\
\nonumber
& & x_{i,j}\in \{0,1\}
\end{eqnarray}
Thus $\Gamma(R(\mbox{AP},m))$ is an instance of the M2DKP. \\
In order the show the reapproximation ratio for $R(AP)$ we need
a good approximation algorithem for the "Multiple bi-dimensional Knapsack Problem"\\
We can get a $(1-\frac{1}{e} -\varepsilon)$-approximation for the
"Multiple bi-dimensional Knapsack Problem" using
the approximation for SAP (in \cite{SAP11} with
\footnote{The single bi-dimensional Knapsack Problem have a PTAS}
$\beta = (1-\varepsilon)$ ), thus the Reoptimization Allocation Problem
have a $(1,\frac{(1-\frac{1}{e} -\varepsilon)^2}{1+(1-\frac{1}{e} -\varepsilon)}) =
(1,\frac{(1-\frac{1}{e} )^2}{1+1-\frac{1}{e}}-\varepsilon')=
(1,\frac{1- \frac{2}{e} + \frac{1}{e^2}}{2-\frac{1}{e}}-\varepsilon')=
(1,\frac{e^2-2e+1}{2e^2-e}-\varepsilon')=(1,\frac{2.95249}{12.05983}-\varepsilon')=(1,0.24482-\varepsilon')$-reapproximation algorithm.
\begin{theorem}
\label{thm:vod}
There is a $(1,0.24-\varepsilon)$-reapproximation algorithm for the
"Multiple bi-dimensional Knapsack Problem".
\end{theorem}
}
| {'timestamp': '2015-12-22T02:25:06', 'yymm': '1512', 'arxiv_id': '1512.06736', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06736'} | arxiv |
\section{Introduction}\label{sec:intro}
It is increasingly common for organizations to computerize their business and management processes.
The co-ordination of the tasks or steps that comprise a computerized business process is managed by a workflow management system (or business process management system).
A workflow is defined by the steps in a business process and the order in which those steps should be performed.
A workflow is executed multiple times, each execution being called a \emph{workflow instance}.
Typically, the execution of each step in a workflow instance will be triggered by a human user, or a software agent acting under the control of a human user.
As in all multi-user systems, some form of access control, typically specified in the form of policies and constraints, should be enforced on the execution of workflow steps, thereby restricting the execution of each step to some authorized subset of the user population.
Policies typically specify the workflow steps for which users are authorized (what Basin \textit{et al.}\xspace\ call \emph{history-independent} authorizations~\cite{BaBuKa12}).
Constraints restrict which groups of users can perform sets of steps.
It may be that a user, while authorized by the policy to perform a particular step $s$, is prevented (by one or more constraints) from executing $s$ in a specific workflow instance because particular users have performed other steps in the workflow (hence the alternative name of \emph{history-dependent} authorizations~\cite{BaBuKa12}).
The concept of a Chinese wall, for example, limits the set of steps that any one user can perform~\cite{BrNa89}, as does separation-of-duty, which is a central part of the role-based access control model~\cite{ansi-rbac04}.
We note that policies are, in some sense, discretionary, as they are defined by the workflow administrator in the context of a given set of users.
However, constraints may be mandatory (and independent of the user population), in that they may encode statutory requirements governing privacy, separation-of-concerns, or high-level organizational requirements.
A simple, illustrative example for purchase order processing~\cite{CrGu13} is shown in Figure~\ref{fig:example-workflow}.
In the first step of the workflow, the purchase order is created and approved (and then dispatched to the supplier).
The supplier will submit an invoice for the goods ordered, which is processed by the create payment step.
When the supplier delivers the goods, a goods received note (GRN) must be signed and countersigned.
Only then may the payment be approved and sent to the supplier.
In addition to defining the order in which steps must be performed, the workflow specification includes constraints to prevent fraudulent use of the purchase order processing system.
In our purchase order example, these constraints restrict the users that can perform pairs of steps in the workflow (illustrated in Figure~\ref{subfig:constraints}): the same user may not sign and countersign the GRN, for example.
In addition, we may specify an authorization policy, in this case using roles (Figures~\ref{subfig:role-step-assignment} and~\ref{subfig:user-role-assignment}).
\begin{figure}[h]\centering
\begin{subfigure}[b]{.325\textwidth}\centering
\includegraphics{01-steps.pdf}
\caption{Ordering on steps}\label{subfig:hasse}
\end{subfigure}
\hfill
\begin{subfigure}[b]{.15\textwidth}\centering
\includegraphics{02-constraints.pdf}
\caption{Constraints}\label{subfig:constraints}
\end{subfigure}
\hfill
\begin{subfigure}[b]{.4\textwidth}\centering\small\setlength{\extrarowheight}{1pt}
\begin{tabular}{|@{}l@{}@{}l@{}|}
\hline
$s_1$ & create purchase order \\
$s_2$ & approve purchase order \\
$s_3$ & sign GRN \\
$s_4$ & create payment \\
$s_5$ & countersign GRN \\
$s_6$ & approve payment \\
\hline
$\ne$ & different users must perform steps \\
$=$ & same user must perform steps \\
\hline
\end{tabular}
\caption{Legend}
\end{subfigure}
\begin{subfigure}[b]{.35\textwidth}\centering\small
\[
\begin{array}{|lr|rrrrrr|}
\hline
& & s_1 & s_2 & s_3 & s_4 & s_5 & s_6 \\
\hline
{\sf financeClerk} & r_1 & 1 & & 1 & 1 & & \\
{\sf marketingClerk} & r_2 & 1 & & 1 & & & \\
{\sf marketingAdmin} & r_3 & & 1 & 1 & & 1 & \\
{\sf financeAdmin} & r_4 & & & 1 & 1 & 1 & \\
{\sf accountant} & r_5 & & & & & 1 & 1 \\
\hline
\end{array}
\]
\caption{Role-step assignment}\label{subfig:role-step-assignment}
\end{subfigure}
\hfill
\begin{subfigure}[b]{.225\textwidth}\centering\small
\[
\begin{array}{|r|rrrrr|}
\hline
& r_1 & r_2 & r_3 & r_4 & r_5 \\
\hline
u_1, u_2 & 1 & & & & \\
u_3, u_4, u_5 & & 1 & & & \\
u_6 & & & 1 & & \\
u_7 & & & & 1 & \\
u_8 & & & & & 1\\
\hline
\end{array}
\]
\caption{User-role assignment}\label{subfig:user-role-assignment}
\end{subfigure}
\hfill
\begin{subfigure}[b]{.25\textwidth}\small
\[
\begin{array}{|r|rrrrrr|}
\hline
& s_1 & s_2 & s_3 & s_4 & s_5 & s_6 \\
\hline
u_1, u_2 & 1 & & 1 & 1 & & \\
u_3, u_4, u_5 & 1 & & 1 & & & \\
u_6 & & 1 & 1 & & 1 & \\
u_7 & & & 1 & 1 & 1 & \\
u_8 & & & & & 1 & 1 \\
\hline
\end{array}
\]
\caption{Authorization relation}\label{subfig:authorization-relation}
\end{subfigure}
\caption{A simple constrained workflow for purchase order processing}\label{fig:example-workflow}
\end{figure}
It is well known that a workflow specification may be ``unsatisfiable'' in the sense that the combination of policies and constraints means that there is no way of allocating authorized users to workflow steps without violating at least one constraint. Informally, an instance of the Workflow Satisfiability Problem (WSP) asks whether a particular workflow specification is satisfiable or not.
This problem is NP-hard~\cite{WaLi10}, although relatively efficient algorithms have been developed~\cite{CoCrGaGuJo14,CrGuYe13,KaGaGu,WaLi10} (assuming that the number of workflow steps is much smaller than the number of users that may perform steps in the workflow and that all constraints are user-independent).%
\footnote{The satisfaction of a user-independent constraint~--~defined formally in Section~\ref{sec:related-work}~--~does not depend on the identity of the users.}
Of course, the objectives of the business process associated with a workflow specification can never be achieved if the WSP instance is unsatisfiable.
Hence, it is interesting to consider an extended version of WSP that seeks a ``best'' allocation of users to steps in the event that the instance is unsatisfiable.
We might, for example, decide that the ``cost'' of breaking a binding-of-duty constraint is lower than that associated with breaking a separation-of-duty constraint, and wish to find a plan, based on this assumption, in the event that the workflow is not satisfiable.
Alternatively, if we have to assign a step to an unauthorized user, we might well wish to associate different costs with those unauthorized users: in our purchase order example, the cost of assigning the create-payment step to a user in the \textsf{accountant} role will presumably be less than that of assigning the step to a user in the \textsf{marketingClerk} role.
Accordingly, Crampton, Gutin and Karapetyan introduced the Valued WSP~\cite{CrGuKa15} in which each plan is associated with two costs, which are determined, respectively, by the authorization policy violations and constraint violations induced by the plan.
To make the Valued WSP a single-objective optimization problem, the two costs were aggregated into one total cost by summing the two costs.
For a satisfiable instance of WSP there will exist at least one plan with zero cost.
However, if an instance is unsatisfiable, Valued WSP will return a plan of minimum total cost.
While this is a step in the right direction, the output of Valued WSP is rather crude, in that it simply generates a plan that minimizes the total cost.
In many situations, it may be appropriate to consider the cost of authorization policy violations and constraint violations separately.
As we noted above, authorization policy is typically a matter of local, "discretionary" configuration, whereas constraints may be mandated by statutory requirements.
Thus, we may want to find a plan that, for example, ensures the cost of constraint violations is zero and and the cost due to policy violations is minimized.
In this paper, we study the \emph{Bi-Objective} Workflow Satisfiability Problem (\textsc{BO-WSP}\xspace) with (weighted) user-independent constraints.
Informally, we associate each constraint and authorization violation with a cost, which may, for example, be regarded as an estimate of the risk associated with allowing those violations.
We then consider \textsc{BO-WSP}\xspace as a bi-objective optimization problem and identify three approaches to \textsc{BO-WSP}\xspace optimization, including the computation of a so-called Pareto front that generalizes the other two.
A Pareto front is a maximal set of incomparable \textsc{BO-WSP}\xspace solutions, allowing practitioners to choose the most suitable of those solutions.
In a sense, our work is related to recent work on risk-aware access control~\cite{ChCr11,ChRoKeKaWaRe07,DiBeEyBaMo04,NiBeLo10}, which seeks to compute the risk of allowing a user to perform an action, rather than simply computing an allow/deny decision, and ensure that cumulative risk remains within certain limits.
However, unlike related work, we focus on computing user-step assignments of minimal costs, rather than access control decisions.
Workflow resiliency is a property related to workflow satisfiability~\cite{WaLi10}: informally, a workflow specification is resilient if it remains satisfiable even if some authorized users are not available to perform steps.
It is known that decision problems related to resiliency are PSPACE-complete~\cite[Theorems 14--15]{WaLi10}.
Recent work has investigated quantitative resiliency, which seeks to measure the extent to which a workflow is resilient, rather than simply deciding whether it is resilient or not~\cite{MaMoMo14}.
In this paper, we study the decision problems of Wang and Li~\cite{WaLi10} from the perspective of fixed-parameter tractability.
We also demonstrate that some questions regarding quantitative resiliency can be reduced to \textsc{BO-WSP}\xspace.
We now summarize the main contributions of our paper:
\begin{itemize}
\item to define \textsc{BO-WSP}\xspace as a bi-objective optimization version of WSP;
\item to prove that computing a Pareto front admits a fixed-parameter tractable (FPT) algorithm\footnote{fixed-parameter tractability is discussed in the next section.} for weighted user-independent constraints;
\item to prove that the running time is the best we can hope for in theory (see Theorem \ref{thm:tightness} and remarks afterwards);
\item to show how to implement this result efficiently by presenting an algorithm called \emph{Pattern Branch and Bound (PBB)};
\item to provide a second algorithm for computing a Pareto front for \textsc{BO-WSP}\xspace, based on mixed-integer programming (MIP);
\item to prove that \textsc{BO-WSP}\xspace can be used to solve (a generalized version of) the Cardinality-Constrained Minimum User Problem~\cite{Roy2015};
\item to provide a parameter-driven instance generator for \textsc{BO-WSP}\xspace, which may be of independent interest;
\item to use this generator to compare the performance of our two methods for solving \textsc{BO-WSP}\xspace, and conclude that PBB demonstrates significantly better performance on most of the test instances;
\item to prove that decision problems for workflow resiliency that are known to be PSPACE-complete~\cite{WaLi10} are FPT;
\item to introduce a new model for reasoning about workflow resiliency, and
\item to show how \textsc{BO-WSP}\xspace can be used to solve problems related to workflow resiliency.
\end{itemize}
In the next section, we review relevant concepts from the literature concerning the workflow satisfiability problem, user-independent constraints and resiliency in workflows.
In Section~\ref{sec:wwsp}, we define the bi-objective problem \textsc{BO-WSP}\xspace, and describe three ways in which the problem could be addressed.
Then we give a fixed-parameter algorithm that can be used to solve \textsc{BO-WSP}\xspace in the case of user-independent constraints. We also describe a generalization of a problem introduced by Roy {\em et al.}~\cite{Roy2015} and how our fixed-parameter algorithm can be applied to the generalized problem.
In Section~\ref{sec:experiments}, we describe the implementation of two algorithms for computing a Pareto front of \textsc{BO-WSP}\xspace, one relying on the FPT approach described in the previous section, the other using mixed integer programming.
We then describe an experimental framework for generating random instances of \textsc{BO-WSP}\xspace, and compare the performance of the two implementations.
In Section~\ref{sec:resiliency}, we study the resiliency problem in workflow systems. We review the model of resiliency of Wang and Li~\cite{WaLi10} and give a fixed-parameter algorithm deciding whether a workflow is resilient up to $t$ unavailable users, when only UI constraints are considered. We then define a new model allowing an organization to encode the availabilities of users in terms of probabilities, and then reduce this problem to \textsc{BO-WSP}\xspace in order to find a plan with the highest likelihood of success, using the algorithm presented in Section~\ref{sec:wwsp}.
We conclude the paper with a discussion of related work, a summary of contributions and some suggestions for future work.\\
A preliminary version of this work was presented at the $20^{th}$ ACM Symposium on Access Control Models and Technologies (SACMAT 2015) \cite{CrGuKa15}. The main additional contributions of the present paper are \begin{inparaenum}[(i)]%
\item to formally state the \textsc{BO-WSP}\xspace as a bi-objective optimization problem (only a single-objective problem, a special case of \textsc{BO-WSP}\xspace, was introduced in \cite{CrGuKa15});
\item to give a fixed-parameter algorithm and an MIP-based algorithm for computing a Pareto front for \textsc{BO-WSP}\xspace, thus generalizing the algorithms of \cite{CrGuKa15};
\item to compare experimentally the performances of both algorithms using a richer generator of synthetic test instances;
\item to study resiliency in workflow systems, first as a decision problem, by giving the first positive results (using fixed-parameter algorithms) with respect to the model of \cite{WaLi10}, and secondly by introducing a new model relying on probabilities of user availabilities. We then illustrate one application of \textsc{BO-WSP}\xspace by showing that the proposed algorithm can be used to find a most resilient plan with respect to this new model.
\end{inparaenum}
\section{Definitions and related work}\label{sec:related-work}
In this section we recall the definition of the workflow satisfiability problem and user-independent constraints.
We also review related work.
\subsection{The workflow satisfiability problem}
\begin{df}\label{def:workflow}
A \emph{workflow specification} is defined by a partially ordered set $(S,<)$, where $S$ is a set of steps.
Given a workflow specification $(S,<)$ and a set of users $U$, an \emph{authorization policy} for a workflow specification is a relation $A \subseteq S \times U$.
A \emph{workflow authorization schema} is a tuple $((S,<),U,A)$, where $(S,<)$ is a workflow specification, $U$ the set of users, and $A$ an authorization policy.
\end{df}
A workflow specification describes a set of steps and restricts the order in which they must be performed when the workflow is executed, each such execution being called a \emph{workflow instance}.
In particular, if $s < s'$ then $s$ must be performed before $s'$ in every instance of the workflow.
User $u$ is authorized\footnote{In practice, the set of authorized step-user pairs, $A$, will not be defined explicitly.
Instead, $A$ will be inferred from other access control data structures.
In our purchase order workflow, for example, it is straightforward to infer $A$ (Figure~\ref{subfig:authorization-relation}) from the role-step and user-role assignment relations (Figures~\ref{subfig:role-step-assignment} and~\ref{subfig:user-role-assignment}).
We prefer to use $A$ in order to simplify the exposition.} to perform step $s$ only if $(s,u) \in A$.
We assume that for every step $s \in S$ there exists some user $u \in U$ such that $(s,u) \in A$ (otherwise the workflow is trivially unsatisfiable).
\begin{df}
A \emph{workflow constraint} has the form $(T,\Theta)$, where $T \subseteq S$ and $\Theta$ is a family of functions with domain $T$ and range $U$.
$T$ is the \emph{scope} of the constraint $(T,\Theta)$.
A \emph{constrained workflow authorization schema} is a tuple $((S,<),U,A,C)$, where $((S,<),U,A)$ is a workflow authorization schema and $C$ is a set of workflow constraints.
\end{df}
In the example of Figure \ref{fig:example-workflow}, the constraint requiring that $s_1$ and $s_3$ are assigned the same user can be written as $(T', \Theta')$, where $T'=\{s_1,s_3\}$ and $\Theta'=
\{T' \rightarrow \{u_i\}:\ i=1,2,\dots ,8\}.$
Given $\pi :S' \rightarrow U$, where $S' \subseteq S$, and $T \subseteq S'$, we define $\pi|_T : T \rightarrow U$, where $\pi|_T(s) = \pi(s)$ for all $s \in T$.
\begin{df}
Let $((S,<),U,A,C)$ be a constrained workflow authorization schema.
A \emph{(partial) plan} is a function $\pi: S' \rightarrow U$, where $S'\subseteq S$. A plan $\pi$ is \emph{complete} if $S'=S.$
Given $S' \subseteq S$, we say a plan $\pi : S' \rightarrow U$:
\begin{itemize}
\item is \emph{authorized} if for all $t \in S'$, $(t,\pi(t)) \in A$;
\item \emph{satisfies} a workflow constraint $(T,\Theta)$ if $T \not\subseteq S'$ or $\pi|_T \in \Theta$; and
\item is \emph{valid} if it is authorized and satisfies every constraint in $C$.
\end{itemize}
\end{df}
Informally, a workflow constraint $(T,\Theta)$ limits the users that are allowed to perform a set of steps $T$ in any given instance of the workflow.
In particular, $\Theta$ identifies authorized (partial) assignments of users to workflow steps in $T$.
The objective of the workflow satisfiability problem is to find a valid complete plan (if one exists).
More formally, we have the following definition~\cite{WaLi10}:
\begin{center}
\fbox{%
\begin{tabulary}{.95\columnwidth}{@{}r<{~}@{}L@{}}
\multicolumn{2}{@{}l}{\sc Workflow Satisfiability Problem (WSP)}\\
\emph{Input:} & A constrained workflow authorization schema $((S,<),U,A,C)$\\
\emph{Output:} & A valid plan $\pi : S \rightarrow U$ (WSP is satisfiable) or an answer that WSP is not satisfiable
\end{tabulary}%
}
\end{center}
Consider a pair $\tau,\tau'$ of complete plans in our purchase order workflow defined as follows: $\tau(s_1)=\tau(s_3)=u_1$, $\tau(s_2)=\tau(s_5)=u_6,$ $\tau(s_4)=u_2$, $\tau(s_6)=u_8$, $\tau'(s_1)=\tau'(s_3)=u_2$, $\tau'(s_2)=\tau'(s_5)=u_6,$ $\tau'(s_4)=u_1$, and $\tau'(s_6)=u_7$. Since $\tau$ is a valid plan, the purchase order workflow is satisfiable. Plan $\tau'$ is not valid as $u_7$ is not authorized for $s_6$. If we add the constraint that $s_5$ and $s_6$ must be performed by different users and
$u_6$ and $u_7$ become unavailable, then the workflow becomes unsatisfiable as only $u_8$ is authorized to perform either of $s_5$ and $s_6$.
WSP may be used in a number of ways.
First, it may be used as a form of static analysis, prior to deployment, to ensure that the workflow specification is useful, in the sense that there exists at least one ``execution path'' through the workflow.
Second, it may be used to generate plans for workflow instances, where a plan assigns steps to users for each instance of the workflow specification when it is instantiated.
Finally, it may be used in a more dynamic way, when steps in a workflow instance are not assigned to users in advance. Instead, a user would select a ``ready'' step in a workflow instance to execute. A ready step is any step $t$ such that all steps $s$ such that $s < t$ have been performed.
We may model a partially complete workflow instance as a workflow specification in which the set of authorized users for any step that has been performed is a singleton, containing the user that performed the step.
Then a request by user $u$ to perform $t$ is evaluated by the workflow management system: the request is permitted if:
\begin{inparaenum}[(i)]%
\item $u$ is authorized to perform $t$; and
\item the updated workflow specification in which the only authorized user for step $t$ is $u$ is satisfiable.
\end{inparaenum}
It is worth noting that constraints are defined in terms of sets and functions, and a plan is also defined to be a function. That is, constraint satisfaction is (assumed to be) independent of the ordering on steps.
Moreover, the authorization policy is fixed and independent of the ordering on steps. In other words, the ordering on steps, for the ``standard'' applications of WSP described above, is only relevant to the sequence in which the steps of a workflow instance are executed, not in determining whether there exists a valid plan (or the construction of a valid plan).
However, in Section~\ref{sec:resiliency}, we will see that we may model workflow resiliency problems using authorization policies that vary over time. In this context, the order in which steps are performed is relevant to satisfiability.
\subsection{Constraint specification and user-independent constraints}
\label{sec:ui-constraints}
In practice, we do not define constraints by enumerating all possible elements of $\Theta$.
Instead, we define families of constraints that have ``compact'' descriptions.
Thus, for example, we might define the family of simple separation-of-duty constraints, each of which could be represented by a set $\set{t_1,t_2} \subseteq S$, the constraint being satisfied by a plan $\pi$ if and only if $\pi(t_1) \neq \pi(t_2)$.
More generally, for any binary relation $\propto$ defined on $U$, constraint $(s_1,s_2,\propto)$ is satisfied by any plan $\pi$ such that $\pi(s_1) \propto \pi(s_2)$.
(In particular, we may represent a binding-of-duty constraint in the form $(s_1,s_2,=)$ and a separation-of-duty constraint in the form $(s_1,s_2,\ne)$.)
A constraint $(T,\Theta)$ is said to be \emph{user-independent} (UI, for short) if, for every $\theta \in \Theta$ and every permutation $\phi : U \rightarrow U$, we have $\phi \circ \theta \in \Theta$, where $(\phi \circ \theta)(s) = \phi(\theta(s))$.
Informally, a constraint is UI if it does not depend on the identity of the users.
It appears most constraints that are useful in practice are UI~\cite{CoCrGaGuJo14}.
In particular, cardinality constraints, separation-of-duty and binding-of-duty constraints are UI.
In our experiments (Section~\ref{sec:experiments}), we will consider two particular types of UI constraints:
\begin{itemize}
\item an \emph{at-least-$r$} \emph{counting} constraint has the form $\mathsf{atleast}(T,r)$, where $r \leqslant \card{T}$, and is satisfied provided at least $r$ users are assigned to the steps in $T$;
\item an \emph{at-most-$r$} \emph{counting} constraint has the form $\mathsf{atmost}(T,r)$, where $r \leqslant \card{T}$, and is satisfied provided at most $r$ users are assigned to the steps in $T$.
\end{itemize}
Note that a separation-of-duty constraint $(s_1,s_2,\ne)$ is the counting constraint $\mathsf{atleast}(\set{s_1,s_2},2)$, and a binding-of-duty constraint $(s_1,s_2,=)$ is the constraint $\mathsf{atmost}(\set{s_1,s_2},1)$.
It is important to stress that our approach works for any UI constraints.
We chose to use counting constraints because such constraints have been widely considered in the literature (often known as cardinality constraints~\cite{CoCrGaGuJo14}).
Moreover, counting constraints can be efficiently encoded using mixed integer programming, so we can use off-the-shelf solvers to solve WSP and thus compare their performance with that of our bespoke algorithms.
\subsection{Related work}
A na\"ive approach to solving WSP would consider every possible assignment of users to steps in the workflow.
There are $n^k$ such assignments if there are $n$ users and $k$ steps, so an algorithm of this form would have complexity $\Omega(mn^k)$, where $m$ is the number of constraints.\footnote{We say that $f = \Omega(g)$ for two functions $f, g : \mathbb{N} \rightarrow \mathbb{N}$ if there exist $N_0, d \in \mathbb{N}^*$ such that $f(N) \ge d g(N)$ for all $N \ge N_0$.}
Moreover, Wang and Li showed that WSP is NP-hard, by reducing {\sc Graph $k$-Colorability} to WSP with separation-of-duty constraints~\cite[Lemma 3]{WaLi10}.
\subsubsection{Fixed-parameter tractability results for WSP}
\label{sec:fpt-results}
The importance of finding an efficient algorithm for solving WSP led Wang and Li to look at the problem from the perspective of \emph{parameterized complexity} \cite{DowFel13,Ni06}.
Parameterized complexity is a two-dimensional extension of classical complexity: in parameterized complexity an instance of a decision problem is a pair consisting of an instance $x\in \Sigma^*$ of a classical decision problem and a parameter $\kappa\in \mathbb{N}$, where $\Sigma$ is an alphabet. An algorithm is said to be \emph{fixed-parameter tractable} (FPT) if it solves a problem in time $O(f(\kappa)p(|x|))$, where $|x|$ is the size of $x$, and $f$ and $p$ are respectively a computable function and a polynomial. Normally, for applications $\kappa$ is supposed to be relatively small and thus if $f$ is a moderately growing function, an FPT algorithm may provide an efficient solution for the problem under consideration. If a problem can be solved using an FPT algorithm then we say that it is an \emph{FPT problem} and that it belongs to the class FPT.
Let us introduce a class W[1] of parameterized problems that includes all FPT problems, but whose hardest problems (W[1]-complete problems) are widely believed not to be in FPT \cite{DowFel13,Ni06}. Consider two parameterized problems $P$ and $P'$ (each problem is a set of two-dimensional instances, \emph{i. e.} a subset of $\Sigma^* \times \mathbb{N}$, where $\Sigma$ is a fixed alphabet). We say that $P$ reduces to $P'$ by a {\em parameterized reduction} if for every $(x, \kappa) \in \Sigma^* \times \mathbb{N}$, one can compute $(x', \kappa') \in \Sigma^* \times \mathbb{N}$ in time $O(f(k)(|x|+\kappa)^c)$ for a computable function $f$ and a constant $c$ such that (i) $\kappa' \le g(\kappa)$ for a computable function $g$, and (ii) $(x, \kappa) \in P$ if and only if $(x', \kappa') \in P'$.
Class W[1] consists of all parameterized problems that can be reduced to {\sc Independent Set} parameterized by the size of the solution: given a graph $G$ and a parameter $\kappa$, decide whether $G$ has an independent set of size $\kappa$.
Wang and Li observed that parameterized complexity is an appropriate way to study the WSP, because the number $k$ of steps is usually small and often much smaller than the number $n$ of users;\footnote{The SMV loan origination workflow studied by Schaad \textit{et al.}\xspace, for example, has 13 steps and identifies five roles~\cite{ScLoSo06}. It is generally assumed that the number of users is significantly greater than the number of roles.} thus, $k$ can be considered as the parameter.
Wang and Li \cite{WaLi10} proved that, in general, WSP is W[1]-hard and thus is highly unlikely to admit an FPT algorithm.
However, they also proved WSP is FPT if we consider only separation-of-duty and binding-of-duty constraints \cite{WaLi10}. Henceforth, we consider special families of constraints, but allow arbitrary authorizations.
Crampton \textit{et al.}\xspace~\cite{CrGuYe13} obtained significantly faster FPT algorithms that were applicable to ``regular'' constraints, thereby including the cases shown to be FPT by Wang and Li.
Subsequent research has demonstrated the existence of FPT algorithms for {\sc WSP} in the presence of other constraint types~\cite{CrCrGuJoRa13,CrGu13}. Cohen \textit{et al.}\xspace~\cite{CoCrGaGuJo14}
introduced the class of UI constraints and showed that WSP remains FPT if only UI constraints are included. Note that every regular constraint is UI and all the constraints defined in the ANSI RBAC standard \cite{ansi-rbac04} are UI. Results of Cohen \textit{et al.}\xspace~\cite{CoCrGaGuJo14} have led to algorithms which significantly outperform the widely used SAT-solver SAT4J on difficult instances of WSP with UI constraints \cite{CoCrGaGuJo14c,KaGaGu}.
\subsubsection{Finding plans for unsatisfiable instances}
There has been considerable interest in recent years in making the specification and enforcement of access control policies more flexible.
Naturally, it is essential to continue to enforce effective access control policies.
Equally, it is recognized that there may well be situations where a simple ``allow'' or ``deny'' decision for an access request may not be appropriate.
It may be, for example, that the risks of refusing an unauthorized request are greater than the risks of allowing it.
One obvious example occurs in healthcare systems, where the denial of an access request in an emergency situation could lead to loss of life.
Hence, there has been increasing interest in context-aware policies, such as ``break-the-glass''~\cite{BrPe09}, which allow different responses to requests in different situations.
Risk-aware access control is a related line of research that seeks to quantify the risk of allowing a request~\cite{DiBeEyBaMo04}, where a decision of ``0'' might represent an unequivocal ``deny'' and ``1'' an unequivocal ``allow'', with decisions of intermediate values representing different levels of risk.
Similar considerations arise very naturally when we consider workflows.
In particular, we may specify authorization policies and constraints that mean a workflow specification is unsatisfiable.
Clearly, this is undesirable from a business perspective, since the business objective associated with the workflow can not be achieved.
There are two possible ways of dealing with an unsatisfiable workflow specification: modify the authorization policy and/or constraints; or find a ``least bad'' complete plan.
Prior work by Basin, Burri and Karjoth considered the former approach~\cite{BaBuKa12}.
They restricted their attention to modification of the authorization policy, what they called \emph{administrable authorizations}.
They assigned costs to modifying different aspects of a policy and then computed a strategy to modify the policy of minimal cost.
We adopt a different approach and consider minimizing the cost of ``breaking'' the policies and/or constraints.
\section{The bi-objective workflow satisfiability problem}\label{sec:wwsp}
Informally, given a workflow specification and a plan $\pi$, we assign two costs to $\pi$, determined by the authorizations and constraints that $\pi$ violates.
The {\sc Bi-objective Workflow Satisfiability Problem} (\textsc{BO-WSP}\xspace) seeks to find a plan that minimizes these costs.
WSP is a decision problem; \textsc{BO-WSP}\xspace is a multi-objective optimization problem.
Since it is not possible, in general, to minimize both costs in \textsc{BO-WSP}\xspace simultaneously, we consider three different approaches to solving \textsc{BO-WSP}\xspace.
We show that all three approaches can be tackled by FPT algorithms for user-independent constraints (Theorem~\ref{thm1}).\footnote{In Section \ref{sec:fpt-results}, we defined FPT only for the decision problems, but the notion can be naturally extended to optimization problems. In case of \textsc{BO-WSP}\xspace, an FPT algorithm runs in time $O(f(k) {\rm poly}(n)),$ where $k$ and $n$ are the numbers of steps and users, respectively.}
More formally, let $(S, <)$ be a workflow, $U$ a set of users, and $C$ a
set of constraints. Let $\Pi$ denote the set of all possible plans from $S$ to $U$, and let $\mathbb{Q}^+$ be the set of non-negative rationals.
For each $c \in C$, we say that a function $\omega_c : \Pi \rightarrow
\mathbb{Q}^+$ is a \emph{constraint weight function} if, for all $\pi \in \Pi$:
\[
\omega_c(\pi)
\begin{cases}
= 0 & \text{if $\pi$ satisfies $c$}, \\
> 0 & \text{otherwise}.
\end{cases}
\]
The pair $(c,\omega_c)$ is a \emph{weighted constraint}.
The intuition is that $\omega_c(\pi)$ represents the extent to which $\pi$ violates $c$.
Consider the constraints $c_1 = (\set{s_1,s_2},\ne)$ and $c_2 = (\set{s_1,s_3},=)$ from our purchase order workflow.
Then we might define, for some $x \in \mathbb{Q}^+$,
\[
\omega_{c_1}(\pi) =%
\begin{cases}
0 & \text{if $\pi(s_1) \ne \pi(s_2)$}, \\
10x & \text{otherwise};
\end{cases}
\quad\text{and}\quad
\omega_{c_2}(\pi) =%
\begin{cases}
0 & \text{if $\pi(s_1) = \pi(s_3)$}, \\
x & \text{otherwise}.
\end{cases}
\]
In this example, we have assigned a greater weight to breaking the separation-of-duty constraint than breaking the binding-of-duty constraint.
These weights reflect the danger of fraud that exists when the same user performs $s_1$ and $s_2$, compared to the relatively unimportant constraint that the same user creates a purchase order and signs for the goods received.
In a different workflow specification in which different security considerations are relevant, these weights might be reversed.
Now consider the counting constraint $\mathsf{atmost}(T,r)$.
Then $\omega_c(\pi)$ depends only on the number of users assigned to the steps in $T$ (and the penalty should increase as the number of users increases).
Let $\pi(T)$ denote the set of users assigned to steps in $T$.
Then $\omega_c(\pi) = 0$ if $\card{\pi(T)} \le r$, and $\omega_c(\pi) > 0$ otherwise. Further, if $\pi$ and $\pi'$ are two plans such that $\card{\pi(T)} < \card{\pi'(T)}$, then $\omega_c(\pi) \le \omega_c(\pi')$.
Having defined $\omega_c$ for each constraint in the workflow specification, we define
\[
\omega_C(\pi) = \sum_{c \in C} \omega_c(\pi),
\]
which we call the \emph{constraint weight} of $\pi$.
Note that $\omega_C(\pi) = 0$ if and only if $\pi$ satisfies all constraints in $C$.
Note also that $\omega_C(\pi)$ need not be defined to be the linear sum: $\omega_C(\pi)$ may be defined to be an arbitrary function computable in time polynomial in the input size of the tuple $(\omega_c(\pi):\ c\in C)$ and Theorem \ref{thm1} below would still hold. However, we will not use this generalization in this paper, but simply remark that it is possible, if needed.
We say that a function $\omega: 2^S \times U \rightarrow \mathbb{Q}^+$ is a \emph{weighted set-authorization} function if $\omega(\emptyset, u) = 0$ for all $u \in U$.
Let $\pi^{-1}(u) = \{ s \in S: \pi(s)=u \}$ denote the set of steps to which $u$ is assigned by plan $\pi$.
Then, given a weighted set-authorization function $\omega$, we define an \emph{authorization weight} function $\omega_A : \Pi \rightarrow \mathbb{Q}^+$ to be, for all $\pi \in \Pi$:
\[
\omega_A(\pi) = \sum_{u \in U} \omega(\pi^{-1}(u),u).
\]
In the remainder of the paper, we assume that both $\omega_A$ and $\omega_C$ are computable in polynomial time.
Given a workflow $(S,<)$, a set of users $U$, a set of weighted constraints $C_{\omega}$, and weighted set-authorization function $\omega$, we say that $((S,<),U,\omega,C_{\omega})$ is a \emph{weighted constrained workflow schema}.
\begin{center}
\fbox{%
\begin{tabular}{p{0.08\linewidth}p{0.65\linewidth}}
\multicolumn{2}{@{}l}{\sc Bi-Objective WSP (\textsc{BO-WSP}\xspace)}\\
\emph{Input:} & A weighted constrained workflow schema $((S,<),U,\omega,C_{\omega})$ \\
\emph{Output:} & A plan $\pi : S \rightarrow U$\\
\emph{Goal:} & Minimize $\omega_C(\pi)$ and $\omega_A(\pi)$\\
\end{tabular}%
}
\end{center}
The alert reader will have noticed that the authorization relation is no longer included in the workflow specification.
This is because any authorization relation $A$ can be encoded by an appropriate choice of $\omega$.
The next result formalizes this claim and establishes that \textsc{BO-WSP}\xspace generalizes WSP.
\begin{prop}\label{pro}
Given an instance of WSP $((S,<),U,A,C)$, let $\omega$ be a weighted set-authorization function such that for all $T \subseteq S$ and all $u \in U$:
\[
\omega(T,u)
\begin{cases}
= 0 & \text{if $(u,t) \in A$ for all $t \in T$}, \\
> 0 & \text{otherwise};
\end{cases}
\]
And, for each $c \in C$, let $\omega_c$ be a constraint weight function.
Then the \textsc{BO-WSP}\xspace instance $((S,<),U,\omega,C_{\omega})$, where $C_{\omega} = \set{(c,\omega_c) : c \in C}$, has a plan $\pi$ such that $\omega_A(\pi) = \omega_C(\pi) = 0$ if and only if $((S,<),U,A,C)$ is satisfiable.
\end{prop}
In many cases, a weighted set-authorization function $\omega: 2^S \times U \rightarrow \mathbb{Q}^+$ satisfies the ``linearity'' condition $\omega(T,u)=\sum_{t\in T}\omega(\{t\},u)$ for every $T\subseteq S$ and $u\in U$.
However, $\omega$ does not necessarily satisfy this condition. For example:
\begin{enumerate}
\item We can introduce a large penalty $\omega(T,u)$, effectively modeling simple ``prohibitions'' or ``negative authorizations'' (for instance, that we prefer not to involve $u$ in steps in $T$).
We use weights like this in our experimental work, described in Section~\ref{sec:experiments}.
In our purchase order example, we might set different (non-zero) weights for $\omega(\set{s_5},u_3)$, $\omega(\set{s_5},u_4)$ and $\omega(\set{s_5},u_5)$, depending on the relative seniority and/or experience of these three users (each of whom is assigned to the \textsf{marketingClerk} role).
\item We can define a limit $\ell_u$ on the number of steps that can be executed by $u$, by setting a large penalty $\omega(T,u)$ for all $T$ of cardinality greater than $\ell_u$.
\item The weights associated with the same user executing different steps may not increase linearly.
Once a user has performed one particular unauthorized step, the additional cost of executing a \emph{related} unauthorized step may be reduced, while the additional cost of executing an \emph{unrelated} unauthorized step may be the same as the original cost.
In our purchase order example, we might set $\omega(\set{s_1},u) = M$, where $M$ is a large constant, for any user not authorized for step $s_1$.
However, we would then set $\omega(\set{s_1,s_3},u) = M$, since the binding-of-duty constraint in $s_1$ and $s_3$ requires the same user performs the two steps.
\item We can implement separation-of-duty on a per-user basis, which is not possible with UI constraints. In particular, it may be acceptable for $u_1$ to perform steps $s_1$ and $s_2$, but not $u_2$, in which case $\omega(\{s_1,s_2\},u_1)$ would be small, while $\omega(\{s_1,s_2\},u_2)$ would be large.
In our purchase order example, we would set $\omega(\set{s_4,s_6},u_8) < \omega(\set{s_4,s_6},u_7) < \omega(\set{s_4,s_6},u_1)$, because of the relative seniority of the respective roles to which these users are assigned.
\item We can minimize the cost of involved users, see Section \ref{sec:mup}.
\end{enumerate}
And in certain cases, it may be that $\omega(T,u) > 0$ for all pairs $(T,u)$.
We see an example of a set-authorization function with this property in Section~\ref{sec:mup}.
\subsection{Optimizing bi-objective WSP}
By analogy to the satisfiability constraint, a weighted constraint $(c,\omega_c)$ is called {\em user-independent} if, for every permutation $\theta$ of $U$, $\omega_c(\pi)=\omega_c(\theta\circ\pi)$.
Thus, a weighted UI constraint does not distinguish between users.
Any (weighted) counting constraint, for which the weight of plan $\pi$ is defined in terms of the cardinality of the image of $\pi$, is UI.
Given a plan $\pi:\ S'\rightarrow U$, where $S'\subseteq S$, we define an equivalence relation $\sim_{\pi}$ on $S'$ as follows: $s \sim_{\pi} s'$ if and only if $\pi(s) = \pi(s')$. This equivalence relation partitions set $S'$ into (non-empty) subsets, called {\em blocks}; the set of blocks is called the {\em pattern} $P(\pi)$ of $\pi$. We say that two plans $\pi$ and $\pi'$ are {\em equivalent} if they have the same pattern.
Consider the following plans for our purchase order workflow.
\begin{center}
\begin{tabular}{|>{$}r<{$}|*{6}{>{$}r<{$}}|}
\hline
& s_1 & s_2 & s_3 & s_4 & s_5 & s_6 \\
\hline
\tau & u_1 & u_6 & u_1 & u_2 & u_6 & u_5 \\
\tau' & u_2 & u_6 & u_2 & u_1 & u_6 & u_8 \\
\hline
\end{tabular}
\end{center}
Then $\tau$ and $\tau'$ are equivalent as both have pattern $\{\{s_1,s_3\},\{s_4\},\{s_2,s_5\},\{s_6\}\}.$
Observe that if all constraints are UI and plans $\pi$ and $\pi'$ are equivalent, then $\omega_C(\pi)=\omega_C(\pi')$.
Note, however, that $\omega_A(\pi)$ is not necessarily equal to $\omega_A(\pi')$, because $\omega_A(\pi)$ is determined by the set-authorization function, which does depend on the particular users assigned to steps by a plan.
A pattern is said to be {\em complete} if $S'=S$. Plans $\tau$ and $\tau'$ above are complete.
Ideally, we would like to minimize both weights of \textsc{BO-WSP}\xspace simultaneously, but, in general, this is impossible as a plan which minimizes one weight will not necessarily minimize the other.
Thus, we will consider \textsc{BO-WSP}\xspace as a bi-objective optimization problem.
There are three standard approaches to solving bi-objective optimization problems~\cite{Miet}:
\begin{enumerate}
\item We consider a single objective function defined as a linear combination of $\omega_C(\pi)$ and $\omega_A(\pi)$: that is, we consider an objective function of the form $a\omega_C(\pi)+b\omega_A(\pi)$, where $a$ and $b$ are constants. Since we can incorporate $a$ and $b$ into $\omega_C$ and $\omega_A$, we obtain an optimization problem in which we wish to find a plan $\pi$ of minimum total weight $\omega_C(\pi)+\omega_A(\pi)$. This problem was introduced in \cite{CrGuKa15}, where it was called the {\sc Valued WSP}.
Henceforth, we will call this problem \textsc{BO-WSP-LC}\xspace (the LC standing for ``linear combination'').
\item A complete plan $\pi$ is called {\em Pareto optimal} if there is no complete plan $\pi'$ such that
\[ \omega_C(\pi)\ge \omega_C(\pi'),\quad \omega_A(\pi)\ge \omega_A(\pi')\quad \text{and}\quad \omega_C(\pi) + \omega_A(\pi)>\omega_C(\pi') + \omega_A(\pi'). \]
In this approach, we minimize one weight subject to the other being upper bounded.
More precisely, given an upper bound $B$ to the constraint (resp. authorization) weight, we aim to find a Pareto optimal plan among all plans $\pi$ such that $\omega_C(\pi) \le B$ (resp. $\omega_A(\pi) \le B$).
Henceforth, we call this problem \textsc{BO-WSP-PO}\xspace (the PO standing for ``Pareto optimal'').
\item A pair of complete plans $\pi$ and $\pi'$ are called {\em weight-equal} if
\[ \omega_C(\pi)= \omega_C(\pi')\quad \text{and}\quad \omega_A(\pi)=\omega_A(\pi'). \]
In this approach, we compute the {\em Pareto front}, which is a maximal set of non-weight-equal Pareto optimal plans.
Henceforth, we call this problem \textsc{BO-WSP-PF}\xspace (the PF standing for ``Pareto front'').
\end{enumerate}
It is not hard to see that optimal plans obtained by solving \textsc{BO-WSP-LC}\xspace and \textsc{BO-WSP-PO}\xspace are Pareto optimal.
Thus, \textsc{BO-WSP-PF}\xspace generalizes \textsc{BO-WSP-LC}\xspace and \textsc{BO-WSP-PO}\xspace.
It is known that replacing a single objective with multiple objectives (and computing a Pareto front) usually increases the complexity class of the problem \cite{Miet}.
However, for \textsc{BO-WSP-PF}\xspace with UI constraints, we have the following theorem.
\begin{thm}\label{thm1} Given a weighted constrained workflow schema $((S,<),U,\omega,C_{\omega})$ in which all constraints are UI, we can solve \textsc{BO-WSP-PF}\xspace in time\footnote{$O^*(.)$ suppresses any polynomial factors and terms.} $O^*(2^{k\log_2 k})$, where $k$ is the number of steps.
\end{thm}
\begin{proof}
We show how to calculate the Pareto front, which we store in the set $\mathcal{P}$ and initialize to the empty set.
Recall that for equivalent complete plans $\pi$ and $\pi'$, we have $\omega_C(\pi)=\omega_C(\pi').$
However, $\omega_A(\pi) = \sum_{u\in U} \omega_A(\pi^{-1}(u),u)$ is, in general, different from $\omega_A(\pi')$.
Let $\pi$ be a complete plan.
Observe that if there is a complete plan $\pi'$, which is Pareto optimal and equivalent to $\pi$, then $\omega_A(\pi')$ is minimum among all equivalent complete plans equivalent to $\pi$.
Let $P(\pi) = \{T_1,\dots,T_p\}$.
Then to find such a plan $\pi'$ efficiently, we construct a weighted complete bipartite graph $G_{\pi}$ with partite sets $\set{1,\dots,p}$ and $U$ and define the weight of edge $\{q,u\}$ to be $\omega(T_q,u)$.
(Henceforth, for a positive integer $x$, we write $[x]$ to denote $\{1,\dots ,x\}$.)
Now observe that $G_{\tau}=G_{\pi}$ for every pair $\pi,\tau$ of equivalent complete plans and that $\omega_A(\pi)$ equals the weight of the corresponding matching of $G_{\pi}$ covering all vertices of $[p]$. Hence, it suffices to find such a matching of $G_{\pi}$ of minimum weight, which can be done by the Hungarian method~\cite{Ku55} in time $O(n^3)$ for a graph with $n$ vertices.
Let ${\cal B}_k$ be the number of partitions of the set $[k]$ into non-empty subsets: that is, ${\cal B}_k$ denotes the $k$th Bell number.
Observe that ${\cal B}_k$ is smaller than $k!$ and there are algorithms of running time $O({\cal B}_k)=O(2^{k\log_2 k})$ to generate all partitions of $[k]$ \cite{Er88}.
Thus, we can generate all patterns in time $O(2^{k\log_2 k})$.
For each pattern we compute the corresponding complete plan $\pi$ of minimum authorization weight, and add $\pi$ to $\mathcal{P}$ unless $\mathcal{P}$ already has a plan $\tau$ such that
\[ \omega_C(\pi)\ge \omega_C(\tau)\quad \text{and}\quad \omega_A(\pi)\ge \omega_A(\tau)\quad \text{and}\quad \omega_C(\pi) + \omega_A(\pi)>\omega_C(\tau) + \omega_A(\tau). \]
The total running time is $O^*(2^{k\log_2 k})$.
\end{proof}
As we noted above, an algorithm that solves \textsc{BO-WSP-PF}\xspace can be used to solve \textsc{BO-WSP-LC}\xspace and \textsc{BO-WSP-PO}\xspace.
We thus have the following two corollaries of Theorem~\ref{thm1}:
\begin{cor}
We can compute, in time $O^*(2^{k\log_2 k})$, a plan $\pi$ for \textsc{BO-WSP}\xspace with UI constraints such that $\omega_C(\pi) + \omega_A(\pi)$ is minimum.
\end{cor}
\begin{cor}
For any $B \in \mathbb{N}$, we can compute, in time $O^*(2^{k\log_2 k})$, a plan $\pi$ for \textsc{BO-WSP}\xspace with UI constraints such that $\omega_A(\pi)$ (resp. $\omega_C(\pi)$) is minimum among all plans $\tau$ such that $\omega_C(\tau) \le B$ (resp. $\omega_A(\tau) \le B$).
\end{cor}
For the sake of completeness, we state the following result whose proof can be found in Appendix~\ref{app:pareto-front-may-have-B-k-points}.
\begin{thm}\label{thm:tightness}
There exist instances of \textsc{BO-WSP}\xspace with UI constraints with a Pareto front consisting of ${\cal B}_k$ points.
\end{thm}
This result implies that the algorithm described in the proof of Theorem~\ref{thm1} has an optimal\footnote{One may possibly improve only the polynomial factors.} asymptotic worst-case running time, as any such algorithm must output all points from the Pareto front (recall that the running time of the algorithm is actually $O^*({\cal B}_k)$).
In addition, note that Gutin and Wahlstr{\"o}m \cite{GutinW15} recently proved that WSP with UI constraints cannot be solved in time $O^*(2^{ck\log_2 k})$ for any $c<1$, unless the Strong Exponential Time Hypothesis (SETH)\footnote{The Strong Exponential Time Hypothesis claims there is no algorithm of running time $O^*(2^{cn})$ for SAT on $n$ variables, for any $c < 1$~\cite{ImPaZa01}.} fails. Hence, even concerning Approach 1 only (and even with $0$-$1$ weights only), the algorithm in the proof of Theorem~\ref{thm1} has an optimal asymptotic running time possible, under SETH.
\subsection{Minimizing user cost}\label{sec:mup}
The aim of this subsection is to demonstrate that an interesting and applicable problem, the Cardinality-Constrained Minimum User Problem (CMUP)~\cite{Roy2015}, can be reduced to multiple instances of WSP or an instance of BO-WSP.
Moreover, we can solve CMUP in the presence of arbitrary UI constraints.
CMUP asks, given a satisfiable instance of WSP, what is the minimum number of users required to obtain a valid plan.
Roy {\em et al.} \cite{Roy2015} motivate their study of CMUP by noting that many companies and other organizations are interested in cost-cutting in their businesses.
However, CMUP can be useful in other scenarios, such as when a smaller number of users increases security.
For CMUP, Roy {\em et al.} \cite{Roy2015} used only constraints of the form at-most-$r$ and at-least-$r'$ and suggested using either an Integer Programming Solver (they used CPLEX) or a bespoke greedy-like heuristic generalizing a greedy-like heuristic for coloring hypergraphs.
Note, however, that one can solve CMUP using any WSP solver that can deal with at-most-$r$ constraints, which are UI for any integer $r$.
In particular, the WSP solver developed by Cohen {\em et al.}~\cite{CoCrGaGuJo14c,KaGaGu} for solving WSP with UI constraints can be used.
First note that no plan for a satisfiable instance requires more than $k$ users.
Hence, we can use binary search, with repeated calls to the WSP solver, to solve CMUP.
Before making the first call to the WSP solver, we add the constraint $\mathsf{atmost}(S,k/2)$ to $W$, and test whether the resulting instance is satisfiable or not.
If it is satisfiable, we then replace $\mathsf{atmost}(S,k/2)$ with $\mathsf{atmost}(S,k/4)$ and call the WSP solver; otherwise we replace $\mathsf{atmost}(S,k/2)$ with $\mathsf{atmost}(S,3k/4)$ (and call the WSP solver).
By iterating this process at most $\lceil \log_2 k \rceil$ times, we obtain the minimum number of users (recall that the CMUP instance is required to be satisfiable).
In contrast, the \textsc{BO-WSP}\xspace algorithm can solve CMUP directly.
In fact, \textsc{BO-WSP}\xspace allows us to model and solve the following generalization of CMUP.
We will allow any weighted UI constraints. Assume that the users' costs vary (salaries, costs of additional training, etc.) and let $\mu_u > 0$ be the cost of user $u$. Then we can define a weighted set-authorization function as follows:
\[
\omega(T,u)=
\begin{cases}
\mu_u & \text{if $(u,t) \in A$ for all $t \in T$}, \\
M & \text{otherwise},
\end{cases}
\]
where $M$ is a constant such that $M>\sum_{u\in U}\mu_u$.
(Note here that $\omega(T,u) > 0$ for all $T \ne \emptyset$.)
By definition of \textsc{BO-WSP}\xspace, the algorithm will find a valid plan involving a set of users of minimum cost (the CMUP case corresponds to $\mu_u = 1$ for every user $u$). We may also consider decreasing the cost by allowing some ``minor'' constraints to be violated.
\section{\textsc{BO-WSP}\xspace algorithms and experimental results}
\label{sec:experiments}
In this section, we describe two concrete algorithms we have developed to solve \textsc{BO-WSP}\xspace and study their performance on a range of \textsc{BO-WSP}\xspace instances.
The first, which we call \emph{Pattern Branch and Bound}, solves \textsc{BO-WSP-PF}\xspace directly; the algorithm is FPT and based on patterns.
The second algorithm, which we call \emph{MIP-based}, solves \textsc{BO-WSP-PF}\xspace by solving multiple instances of \textsc{BO-WSP-PO}\xspace expressed as a mixed integer programming (MIP) problem.
Note that a Pareto front of \textsc{BO-WSP}\xspace may include plans with very large authorization or constraint weights despite the fact that such plans are of little practical interest.
For that reason we introduce two parameters, $B_A$ and $B_C$, which bound the authorization and constraint weights, respectively.
Both of our solution methods ignore plans $\pi$ such that $\omega_A(\pi) > B_A$ or $\omega_C(\pi) > B_C$.
These upper bounds not only reduce the size of the Pareto front, thereby reducing the number of choices that an end-user would need to evaluate, but, as we will show later, also speed up the algorithms.
\subsection{Pattern backtracking algorithm}
Pattern Branch and Bound (PBB) is an efficient implementation of the algorithm described in the proof of Theorem~\ref{thm1}.
The algorithm explores the space of patterns in a depth-first search like manner and, for each complete pattern, computes an optimal complete plan.
The algorithm maintains a set $\mathcal{P}$ of Pareto optimal plans found so far.
When the search is completed, $\mathcal{P}$ is the full Pareto front.
The search tree of the algorithm is formed as follows.
Each node of the search tree corresponds to a (partial) pattern.
Branching in PBB is based on extending the parent pattern with one step.
Let $P = \set{T_1, T_2, \ldots, T_{|P|}}$ be the (partial) pattern in some node of the search.
Then PBB will select some step $s \in S \setminus (T_1 \cup T_2 \cup \ldots \cup T_{|P|})$ and extend $P$ with $s$ in every possible way, i.e.
\begin{align*}
& \set{T_1 \cup \set{s},\ T_2,\ \ldots,\ T_{|P|}}, \\
& \set{T_1,\ T_2 \cup \set{s},\ \ldots,\ T_{|P|}}, \\
& \ldots \\
& \set{T_1,\ T_2,\ \ldots,\ T_{|P|} \cup \set{s}}, \\
& \set{T_1,\ T_2,\ \ldots,\ T_{|P|},\ \set{s}}.
\end{align*}
Like most tree-search algorithms, PBB uses pruning when it can guarantee that the current branch of the search contains no new Pareto optimal solutions.
Since all weights are non-negative, extending a pattern can only increase the weight of a pattern.
Thus, if we can establish that $\mathcal{P}$ already includes a plan that is weight-equal to or dominated by every plan in the current branch of the search, we may terminate the search of the sub-tree rooted at $P$.
More specifically, for a given pattern $P$ defined over steps $T \subseteq S$, we define
\[
\underline{\omega_c}(P) \stackrel{\rm def}{=} \min\set{\omega_c(\pi) : \text{$\pi$ is a complete plan such that $P(\pi|_T) = P$}}.
\]
For example, suppose $c$ is an at-least-3 constraint with scope $T$, where $|T| = 5$, and four of the steps in $T$ are already assigned the same user (by pattern $P$).
Then $\underline{\omega_c}(P)$ is equal to the penalty for assigning two users to the steps in $T$ (since we may assume that this penalty will be no greater than the penalty for assigning a single user to all five steps in $T$).
We then compute lower bounds for $P$:
\[
\underline{\omega_A}(P) \stackrel{\rm def}{=} \sum_{B \in P} \min_{u \in U} \omega(B, u)\quad\text{and}\quad
\underline{\omega_C}(P) \stackrel{\rm def}{=} \sum_{c \in C} \underline{\omega_c}(P).
\]
Then we may prune the branch rooted at $P$ if one of the following conditions holds:
\begin{itemize}
\item there exists a plan $\pi'$ in $\mathcal{P}$ such that $\omega_A(\pi') \le \underline{\omega_A}(P)$ and $\omega_C(\pi') \le \underline{\omega_C}(P)$;
\item $\underline{\omega_A}(P) > B_A$;
\item $\underline{\omega_C}(P) > B_C$.
\end{itemize}
The size of the search tree depends on the order of steps by which the pattern is extended.
This order is determined dynamically by a heuristic which selects the constrained step $s$ most likely to reduce the average branching factor.
The implementation of the heuristic depends on particular types of constraints and users, and in our case was adjusted by automated parameter tuning, as we describe in more detail in Appendix~\ref{sec:bh}.
\subsection{MIP-based algorithm}
Modern, general-purpose MIP solvers are convenient and powerful tools that can be used to tackle many hard combinatorial optimization problems, thereby reducing costs resulting from the development and maintenance of bespoke systems.
In this section we show how an MIP solver can be used to solve \textsc{BO-WSP-PF}\xspace.
Current MIP solvers can only return a single solution in a run.
\textsc{BO-WSP-PF}\xspace, however, is a bi-objective problem with multiple Pareto optimal solutions in general.
Thus, to solve \textsc{BO-WSP-PF}\xspace, we need a control algorithm that calls an MIP solver multiple times with different parameters.
We now describe the construction of such an algorithm in more detail.
\subsubsection{Computing a Pareto Front}
Given an instance of \textsc{BO-WSP}\xspace and integers $a$, $b$, $c$ and $d$, suppose we have a function {\it mipMinimizeWeight} that can be evaluated using an MIP solver and returns a plan $\pi$ such that
\begin{inparaenum}[(i)]
\item either the authorization weight or constraint weight of $\pi$ is minimized,
\item $\omega_A(\pi) \in [a,b]$, and
\item $\omega_C(\pi) \in [c,d]$.
\end{inparaenum}
We explain how to construct the required MIP formulation for {\it mipMinimizeWeight} in Section~\ref{sec:mipMinimizeWeight}.
Let us assume that $\mathit{mipMinimizeWeight}(0,a,b,c,d)$ returns a plan $\pi$ such that the \emph{authorization} weight is minimized, and $\mathit{mipMinimizeWeight}(1,a,b,c,d)$ returns a plan such that the \emph{constraint} weight is minimized.
Then we can compute the Pareto optimal plan $\pi^{\ell}$ such that $\omega_A(\pi^{\ell}) \le \omega_A(\tau)$ for any Pareto optimal plan $\tau$ using the following computations:
\begin{align}
\pi &\leftarrow \mathit{mipMinimizeWeight}(0,0,B_A,0,B_C) \label{eqn:initpi} \\
\pi^{\ell} &\leftarrow \mathit{mipMinimizeWeight}(1,\omega_A(\pi),\omega_A(\pi),0,B_C). \label{eqn:pileft}
\end{align}
The method is illustrated schematically in Figure~\ref{fig:computing-pareto-optimal-plan-minimizing-authorization}.
(The black dot in each sub-figure indicates the optimal plan, subject to the particular weight being minimized, which is indicated by a black arrow.
The gray area in each sub-figure indicates the region within which we are seeking a plan.)
\begin{figure}[!htb]\centering
\begin{subfigure}[t]{.45\textwidth}
\centering
\includegraphics{04-step1.pdf}
\caption{Step 1 (see (\ref{eqn:initpi}))}
\end{subfigure}
\hfill
\begin{subfigure}[t]{.45\textwidth}
\centering
\includegraphics{05-step2.pdf}
\caption{Step 2 (see (\ref{eqn:pileft}))}
\end{subfigure}
\caption{Computing a Pareto optimal plan having minimum authorization weight}
\label{fig:computing-pareto-optimal-plan-minimizing-authorization}
\end{figure}
\noindent%
Similarly, computing
\begin{align}
\pi &\leftarrow \mathit{mipMinimizeWeight}(1,0,B_A,0,B_C) \\
\pi^r &\leftarrow \mathit{mipMinimizeWeight}(0,0,B_A,\omega_C(\pi),\omega_C(\pi))
\end{align}
will compute a Pareto optimal plan $\pi^r$ having the smallest constraint weight (among all Pareto optimal plans).
These steps form the basis for computing the entire Pareto front, as illustrated by the pseudo-code in Algorithm~\ref{alg:mip-based}.
Informally, we compute the ``extremal'' Pareto optimal plans $\pi^{\ell}$ (lines \ref{line:start-compute-left-pareto-optimal}--\ref{line:end-compute-left-pareto-optimal}) and $\pi^r$ (lines \ref{line:start-compute-right-pareto-optimal}--\ref{line:end-compute-right-pareto-optimal}).%
\footnote{In line~\ref{line:start-compute-right-pareto-optimal}, we wish to find plan $\pi^r$ such that $\omega_C(\pi^r) < \omega_C(\pi^{\ell})$.
However, MIP does not allow strict inequality constraints; thus we must use a constraint $\omega_C(\pi^r) \le \omega_C(\pi^{\ell}) - \epsilon$ for a small $\epsilon > 0$.
Since all the weights in our experiments are integers, we can set $\epsilon = 1$ without loss of correctness.
Analogous comments hold for $\omega_C(\pi^r)$ and $\omega_A(\pi^r)$.}
Having done that, we iteratively shrink the (two-dimensional) objective space, moving the bottom-right hand corner towards the top left-hand corner, and find the remaining Pareto optimal plans within those successively smaller regions (lines~\ref{line:start-compute-mid-pareto-optimal}--\ref{line:end-compute-mid-pareto-optimal}).
The operation of the algorithm is illustrated schematically in Figure~\ref{fig:mip-based}.
\begin{algorithm2e}[!h]
\caption{MIP-based algorithm to compute a Pareto front}
\label{alg:mip-based}
$\pi \gets \mathit{mipMinimizeWeight}(0,0,B_A,0,B_C)$\;\label{line:start-compute-left-pareto-optimal}
$\pi^{\ell} \gets \mathit{mipMinimizeWeight}(1,\omega_A(\pi),\omega_A(\pi),0,B_C)$\;\label{line:end-compute-left-pareto-optimal}
\If {$\pi^{\ell} = \mathit{(none)}$}
{
\Return $\emptyset$\;
}
$\mathcal{P} \gets \set{\pi^{\ell}}$\;
$\pi \gets \mathit{mipMinimizeWeight}(1,\omega_A(\pi^{\ell}) + 1,B_A,0,\omega_C(\pi^{\ell})-1)$\;\label{line:start-compute-right-pareto-optimal}
$\pi^r \gets \mathit{mipMinimizeWeight}(0,\omega_A(\pi^{\ell}) + 1,B_A,\omega_C(\pi),\omega_C(\pi))$\;\label{line:end-compute-right-pareto-optimal}
\If {$\pi^r = \mathit{(none)}$}
{
\Return $\mathcal{P}$\;
}
$\mathcal{P} \gets \mathcal{P} \cup \set{\pi^r}$\;
\While {$\omega_A(\pi^r) - \omega_A(\pi^{\ell}) > 1$ and $\omega_C(\pi^{\ell}) - \omega_C(\pi^r) > 1$} { \label{line:begin-loop}
$\pi \gets \mathit{mipMinimizeWeight}(1,\omega_A(\pi^{\ell}) + 1,\omega_A(\pi^r)-1,\omega_C(\pi^r)+1,\omega_C(\pi^{\ell})-1)$\;\label{line:start-compute-mid-pareto-optimal}
$\pi^c \gets \mathit{mipMinimizeWeight}(0,\omega_A(\pi^{\ell}) + 1,\omega_A(\pi^r)-1,\omega_C(\pi),\omega_C(\pi))$\;\label{line:end-compute-mid-pareto-optimal}
\If {$\pi^c = \mathit{(none)}$}
{
\Return $\mathcal{P}$\;
}
$\mathcal{P} \gets \mathcal{P} \cup \set{\pi^c}$\;
$\pi^r \gets \pi^c$\;\label{line:end-loop}
}
\Return $\mathcal{P}$\;
\end{algorithm2e}
\begin{figure}[!htb]\centering
\begin{subfigure}[t]{.3\textwidth}
\centering
\includegraphics{06-mipbased01.pdf}
\caption{}
\label{fig:mip1}
\end{subfigure}
\hfill
\begin{subfigure}[t]{.3\textwidth}
\centering
\includegraphics{06-mipbased02.pdf}
\caption{}
\label{fig:mip2}
\end{subfigure}
\hfill
\begin{subfigure}[t]{.3\textwidth}
\centering
\includegraphics{06-mipbased03.pdf}
\caption{}
\label{fig:mip3}
\end{subfigure}
\\
\begin{subfigure}[t]{.3\textwidth}
\centering
\includegraphics{06-mipbased04.pdf}
\caption{}
\label{fig:mip4}
\end{subfigure}
\hfill
\begin{subfigure}[t]{.3\textwidth}
\centering
\includegraphics{06-mipbased05.pdf}
\caption{}
\end{subfigure}
\hfill
\begin{subfigure}[t]{.3\textwidth}
\centering
\includegraphics{06-mipbased06.pdf}
\caption{}
\label{fig:mip6}
\end{subfigure}
\caption{
Schematic representation of the computation of the Pareto front using our MIP-based algorithm}
\label{fig:mip-based}
\end{figure}
\subsubsection{The function {\it mipMinimizeWeight}}\label{sec:mipMinimizeWeight}
In order to formulate $\mathit{mipMinimizeWeight}$ as an MIP problem, we define a matrix of binary decision variables $x = (x_{su})$ to represent a plan: specifically, if $x_{su} = 1$ then step $s \in S$ is assigned to user $u \in U$; otherwise step $s$ is assigned to some other user.
Then the constraint weight $\omega_C(x)$ and the authorization weight $\omega_A(x)$ of the plan defined by $x$ are
\[
\omega_A(x) \stackrel{\rm def}{=} \sum_{u \in U} \omega_u(x) \quad\text{and}\quad \omega_C(c) \stackrel{\rm def}{=} \sum_{c \in C} \omega_c(x),
\]
where the encodings of $\omega_u(x)$ and $\omega_c(x)$ depend on user and constraint types (and may require the introduction of additional decision variables).%
\footnote{For example, a separation-of-duty constraint $c$ with scope $\{s, t\}$ requires the introduction of a binary decision variable $p_c$, where $p_c \ge x_{su} + x_{tu} - 1$.
Thus, $p_c = 0$ if and only if $s$ and $t$ are assigned to different users.
If the violation of $c$ is associated with weight $x$, say, then we define $\omega_c(x) = xp_c$.}
We describe the encoding of $\omega_u(x)$ and $\omega_c(x)$ for the users and constraints used in our experiments in Appendix~\ref{sec:mip-encodings}.
Having defined the functions $\omega_A(x)$ and $\omega_C(x)$, we formulate the MIP problem as follows:
\begin{align}
\label{eq:mip-objective}
& \text{minimize } (1 - \alpha) \omega_A(x) + \alpha \omega_C(x) \\
& \text{subject to}
%
\label{eq:omega_A_bounds}
&& a \le \omega_A(x) \le b, \\
%
\label{eq:omega_C_bounds}
&&& c \le \omega_C(x) \le d, \\
\label{eq:mip-x}
&&& \sum_{u \in U} x_{su} = 1 \qquad \forall s \in S, \\
%
\label{eq:x-values}
&&& x_{su} \in \set{0, 1} \qquad \forall s \in S, \forall u \in U.
\end{align}
The parameter $\alpha$ determines the relative importance of the authorization and constraint weights.
In particular, if $\alpha = 0$ then the problem is to minimize the authorization weight only; and if $\alpha = 1$ then it is to minimize the constraint weight only.
Constraint~\eqref{eq:x-values} ensures that each variable $x_{su}$ takes binary values.
Constraints~\eqref{eq:omega_A_bounds} and~\eqref{eq:omega_C_bounds} restrict the search space to the bounds defined by $a$, $b$, $c$ and $d$.
Finally, constraint~\eqref{eq:mip-x} ensures that each step is assigned to exactly one user.
The solution $x$ can be trivially translated into the plan $\pi$ to be returned by $\mathit{mipMinimizeWeight}$: $\pi(s) = u$ if and only if $x_{su} = 1$.
\subsection{Testbed}
\label{sec:testbed}
We use a pseudo-random instance generator to produce benchmark instances.
Our generator is an extension of generators for WSP~\cite{KaGaGu} and Valued WSP~\cite{CrGuKa15}.
For ease of reference, we define the \emph{authorization density} of a WSP instance to be the average
number of permitted steps per user, where a step is said permitted if its
corresponding cost is not prohibitive, \textit{i.e.} is smaller than a given constant $M$ (see later).
Similarly, we define the \emph{separation-of-duty constraint density} to be the ratio of the number of separation-of-duty constraints to $\binom{k}{2}$, since there are at most $\binom{k}{2}$ choices for pairs of steps in a separation-of-duty constraint.
Our \textsc{BO-WSP}\xspace instance generator takes the following parameters: (i) number of steps $k$, (ii) authorization density $d$, (iii) separation-of-duty constraint density $e$, and (iv) seed value for the pseudo-random number generator.
All the constraints are generated randomly.
In particular, the scopes are produced randomly and uniformly such that no two constraints of the same type have identical scopes; penalties (i.e., weights) are also selected randomly and uniformly, with allowed ranges given in Figure~\ref{fig:constraint-penalties}. Our choice of penalties is based on the fact that we view at-most-3 constraints as soft constraints (i.e., constraints that a plan may violate, if needed) and we wish the penalty of assigning four users to the scope of such a constraint to be smaller than assigning five. We view at-least-3 constraints as ``semi-soft'', i.e., we issue a small penalty for assigning just two users, but basically forbid assigning just one (so that we forbid ``dictators''). We view separation-of-duty constraints as hard constraints, i.e. constraints that a plan must satisfy.
The values of parameters and penalty functions used in our generator are obtained empirically such that the instances are relatively hard to solve.
The generator produces $\left\lfloor e \binom{k}{2} + \frac{1}{2} \right\rfloor$ separation-of-duty constraints, $k$ at-most-3 constraints and $k$ at-least-3 constraints.
\begin{figure}[htb]
\begin{subfigure}[b]{.3\textwidth}\centering
\begin{tabular}{@{} cr @{}}
\toprule
Distinct users & Penalty \\
\midrule
1 & 0 \\
2 & 0 \\
3 & 0 \\
4 & 3--5 \\
5 & 10--15 \\
\bottomrule
\end{tabular}
\caption{At-most}
\end{subfigure}
\hfill
\begin{subfigure}[b]{.3\textwidth}\centering
\begin{tabular}{@{} cr @{}}
\toprule
Distinct users & Penalty \\
\midrule
1 & 1,000,000 \\
2 & 1--3 \\
3 & 0 \\
4 & 0 \\
5 & 0 \\
\bottomrule
\end{tabular}
\caption{At-least}
\end{subfigure}
\hfill
\begin{subfigure}[b]{.3\textwidth}\centering
\begin{tabular}{@{} cr @{}}
\toprule
Distinct users & Penalty \\
\midrule
1 & 1,000,000 \\
2 & 0 \\
\\
\\
\\
\bottomrule
\end{tabular}
\caption{Separation-of-duty constraints}
\end{subfigure}
\caption{Penalties associated with constraints produced by our \textsc{BO-WSP}\xspace instance generator; where a range is given, the penalty is selected from the range uniformly at random}\label{fig:constraint-penalties}
\end{figure}
The generator creates $10k + 10$ users, based on the assumption that the number of users will be an order of magnitude greater than the number of steps.
In particular, it produces $10k$ \emph{staff members} and 10 \emph{(external) consultants}.
The weight function for these two types of users are different.
In particular, consultants are not authorized for any steps, so there is always a non-zero penalty associated with any plan that assigns a consultant to a step.
We assume that each member of staff $u$ is authorized for some subset $A_u$ of $S$ and, in the absence of authorized users, could be assigned to some subset $B_u$ of $S$ (thereby incurring a modest penalty).
Thus, each staff member $u$ is assigned two non-intersecting sets of steps, $A_u, B_u \subset S$, where $|A_u|$ has Poisson distribution\footnote{We artificially cap the size $|A_u|$ by $k - 2$.} with $\lambda = d$, and $|B_u| = 2$.
Then the penalty function $\omega(T, u)$ for a staff member $u$ is defined to be
\[ \omega(T, u) = \sigma_u \cdot |T \cap B_u| + M \cdot |T \setminus (A_u \cup B_u)|, \]
where $\sigma_u \in [5, 15]$ is selected for each member of staff randomly and uniformly, and $M$ is a large constant (1,000,000 in our implementation).
Similarly, each consultant $u$ is assigned a set $B_u$ such that $|B_u|$ has Poisson distribution (capped artificially by $k$) with $\lambda = d$.
This set represents steps that a consultant could perform in the absence of authorized users without incurring too large a penalty.
Then the penalty function for consultants is defined to be
$$
\omega(T, u) =
\begin{cases}
0 & \text{if } T = \emptyset, \\
\sigma_u & \text{if } T \subseteq B_u, \\
M & \text{otherwise,}
\end{cases}
$$
where $\sigma_u \in [10, 30]$ is selected randomly and uniformly.
The MIP encodings of the (weighted) constraints used in our experiments are described in Appendix~\ref{sec:mip-encodings}.
The source code of our instance generator can be found at~\cite{sourceSACMAT2015}.
\subsection{Computational experiments}
\label{sec:experimentsresults}
In this section we report the results of our computational experiments with \textsc{BO-WSP}\xspace.
Our algorithms are implemented in C\#, and the MIP solver used by the MIP-based algorithm is CPLEX~12.6.
Our test machine is based on two Intel Xeon CPU E5-2630 v2 (2.6~GHz) and has 32~GB RAM installed.
Hyper-threading is enabled, but we never run more than one experiment per physical CPU core concurrently, and concurrency is not exploited in any of the tested solution methods.
In Figure~\ref{fig:pareto-fronts}, we show examples of optimal solutions (full Pareto fronts) of four \textsc{BO-WSP}\xspace instances with various authorization densities $d$ and separation-of-duty constraint densities $e$.
The objective upper bounds $B_A$ and $B_C$ are set to 1000 in all four cases.
The relatively lightly constrained instance ($d = 20\%$ and $e = 10\%$) is almost satisfiable; it has only two Pareto optimal solutions $(0, 1)$ and $(5, 0)$, where each tuple gives the objectives $(\omega_A(\pi), \omega_C(\pi))$.
All other instances used in this experiment do not have plans that would satisfy all the constraints (at least for $\omega_A(\pi) \le B_A$), but they all have plans that satisfy all the authorizations.
As we noted earlier, given at least one user is authorized for each step $s \in S$, there necessarily exists a plan $\pi$ such that $\omega_A(\pi) = 0$; $\omega_C(\pi)$, however, may well be very large.
\begin{figure}[h]\centering
\includegraphics{07-graph01.pdf}
\caption{Optimal solutions for four \textsc{BO-WSP}\xspace instances}\label{fig:pareto-fronts}
\end{figure}
In Figure~\ref{fig:scaling-k}, we compare the performance of the PBB (solid lines) and MIP-based algorithms (dashed lines) as the number $k$ of steps grows.
Each experiment is repeated 100 times (on 100 different instances obtained by varying the pseudo-random number generator seed value); median running times have been reported; and $B_A = B_C = 1000$.
PBB shows a slightly super-exponential growth, consistent with the worst case time complexity $O^*({\cal B}_k) = O^*(2^{k \log_2 k})$.
The scaling factor is roughly the same for all the classes of instances, but the constant factor is higher for the more constrained instances.
The MIP-based algorithm is significantly slower than PBB on most of the instances, but shows better scaling than PBB on instances with low authorization density.
This suggests that the branching heuristic of PBB will need to be improved in the future to better account for authorizations.
On the other hand, PBB is an FPT algorithm and, thus, its running time scales \emph{polynomially} with the number of users $n$ (see Section~\ref{sec:fpt-results}), whereas the MIP-based algorithm scales \emph{exponentially} with $n$.
Indeed, our MIP formulation does not exploit the FPT nature of \textsc{BO-WSP}\xspace, and it is very unlikely that an MIP solver will be able to discover the FPT nature of the problem itself.
The exponential scaling of the MIP-based algorithm's running time was also confirmed empirically (the results are not reported here).
As a result, the MIP-based algorithm is particularly weak when $n$ is large relative to $k$.
\begin{figure}[h]\centering
\includegraphics{07-graph02.pdf}
\caption{A comparison of running times for the PBB and the MIP-based algorithms. We use dashed lines for the MIP algorithm and solid for PBB.}
\label{fig:scaling-k}
\end{figure}
We have seen in Figure~\ref{fig:pareto-fronts} that most of the Pareto-optimal plans in our instances have moderate authorization and constraint weights.
Nevertheless, parameters $B_A$ and $B_C$ play an important role in the performance of our algorithms.
Figure~\ref{fig:scaling-b} shows how the running times of PBB and the MIP-based algorithm depend on $B_A$ and $B_C$. Here we are solving instances with parameters $k = 20$, $d = 10\%$ and $e = 30\%$.
Each experiment is repeated 100 time (on 100 different instances) and the median running time is reported.
It is easy to see that both approaches are sensitive to the values of $B_A$ and $B_C$, but PBB is particularly good at exploiting tight upper bounds.
This suggests that setting realistic values for $B_A$ and $B_C$ can significantly improve the performance of PBB (recall that in all the previous experiments we used relatively large values $B_A = B_C = 1000$).
\begin{figure}[h]\centering
\includegraphics{07-graph03.pdf}
\caption{Dependence of the algorithms' performance on the objective upper bounds $B_A$ and $B_C$}\label{fig:scaling-b}
\end{figure}
\section{Resiliency}\label{sec:resiliency}
If we assume that all users are available at all times and that all constraints are UI, then the authorization relation $A$ is fixed for the duration of a workflow instance.
Moreover, the construction of a plan is independent of the order in which the steps are executed in any workflow instance.
However, in practice, users may be unavailable for a wide variety of reasons, which means, essentially, that the authorization relation varies over time.
If a user $u$ has been assigned to a step $s$ by a plan $\pi$ for a workflow instance $I$ and that user is absent, then $I$ cannot complete until $u$ becomes available again.
Similarly, if users are not pre-assigned to steps in a workflow instance $J$ but the only users authorized for the steps that are ready to be performed in $J$ are unavailable, then the execution of the workflow instance is suspended until one or more of those users becomes available.
Resiliency is the study of workflow satisfiability under the assumption that the user population may vary over time.
It was first studied by Wang and Li~\cite{WaLi10} and a number of results are known about the computational complexity of decision problems associated with workflow resiliency.
In this section, we establish the first FPT results for these decision problems.
Then, acknowledging the argument that knowing the answer to these decision problems is unlikely to be of practical use~\cite{MaMoMo14}, we introduce a new model for resiliency and relate problems associated with this model to \textsc{BO-WSP}\xspace.
Before proceeding further, it is useful to introduce the notions of order ideals and linear extensions in a partially ordered set.
An \emph{order ideal} $Y$ in a partially ordered set $(X,<)$ is a subset of $X$ such that for any $y \in Y$ and any $x \in X$, $x < y$ implies $x \in Y$.
A partially complete instance of a workflow specification $W = ((S,<),U,A,C)$ may be modeled as a pair $(W,\pi)$, where $\pi$ is a partial plan $\pi : T \rightarrow U$ for some order ideal $T$ in the partial order defined by $(S,<)$.
The set $T$ models the steps that have been executed in the workflow instance.
The set of steps $\{x \in S : \{x\} \cup T \text{ is an order ideal in } S\}$ denotes the set of \emph{ready} steps.
Thus a complete instance defines a sequence of order ideals $[T_1, \dots, T_k]$, where $|T_1| = 1$, $T_{i} \subseteq T_{i+1}$ and $|T_{i+1}| = |T_i|+1$ for all $i \in \{0, \dots, k-1\}$; equivalently, a complete instance defines a sequence of steps $[s_1,\dots,s_k]$, where $\{s_i\} = T_i \setminus T_{i-1}$ (with $T_0$ being assumed to be $\emptyset$) for $i \in [k]$.
It is easy to show that for any such sequence we have $s_i < s_j$ for all $i \le j$ (as the contrary would mean that a non-ready step had been executed during the workflow instance).
A sequence of steps with this property is said to be a \emph{linear extension} of $(S,<)$~\cite{DaPr02}.
Every linear extension represents a possible order of execution of the steps in $S$.
The linear extensions for the workflow depicted in Figure~\ref{fig:example-workflow}, for example, are $[ s_1, s_2, s_3, s_4, s_5, s_6 ]$, $[s_1, s_2, s_3, s_5, s_4, s_6]$, and $[s_1, s_2, s_4, s_3, s_5, s_6]$.
\subsection{The work of Wang and Li}
Wang and Li introduced the notion of workflow resiliency to reason about situations in which one or more users might not be available to execute steps in a workflow~\cite{WaLi10}.
Essentially, workflow resiliency asks whether a workflow remains satisfiable even if some users are not available.
Wang and Li considered three different scenarios of user availability over the lifetime of a workflow instance:
\begin{itemize}
\item \emph{static} resiliency is concerned with the scenario that some fixed subset of users is unavailable;
\item \emph{decremental} resiliency is concerned with the scenario that the set of available users decreases monotonically; and
\item \emph{dynamic} resiliency is concerned with the scenario that an arbitrary set of users is unavailable at any given point in time.
\end{itemize}
More formally, we have the following definitions~\cite{WaLi10}.
In Section~\ref{sec:res:wangli}, we present equivalent and, arguably, more intuitive definitions in order to prove our FPT results.
\begin{df}
Given an integer $t \ge 0$, a constrained workflow authorization schema $((S, <), U, A, C)$ is {\em statically $t$-resilient} if, for all $U' \subseteq U$ such that $|U'| \ge n-t$, $((S, <), U', A, C)$ is satisfiable.
\end{df}
\begin{df} \label{def:decrres}
Given an integer $t \ge 0$, a constrained workflow authorization schema $((S, <), U, A, C)$ is {\em decrementally $t$-resilient} if and only if Player 1 can always win the following two-person game when playing optimally:\\
Initialization: $U_0 \gets U$, $S_0 \gets S$, $t_0 \gets t$ and $i \gets 1$\\
Round $i$ of the game:
\begin{compactenum}
\item Player 2 selects a set of unavailable users $U'_{i-1}$ such that $|U'_{i-1}| \le t_{i-1}$
$U_i \gets (U_{i-1} \setminus U'_{i-1})$ and $t_i \gets (t_{i-1} - |U'_{i-1}|)$
\item Player 1 selects a ready step $s_{i} \in S_{i-1}$ and a user $u \in U_i$
$\pi(s_{i}) \gets u$ and $S_i \gets S_{i-1} \setminus \{s_{i}\}$
if $\pi$ is not a valid partial plan with respect to $s_{1}, \dots, s_{i}$, then Player 1 loses.
\item if $S_i = \emptyset$, then Player 1 wins; otherwise, let $i \gets i+1$ and the game goes on to the next round.
\end{compactenum}
\end{df}
\begin{df}\label{def:dynres}
Given an integer $t \ge 0$, a constrained workflow authorization schema $((S, <), U, A, C)$ is {\em dynamically $t$-resilient} if and only if Player 1 can always win the following two-person game when playing optimally:\\
Initialization: $S_0 \gets S$, and $i \gets 1$\\
Round $i$ of the game:
\begin{compactenum}
\item Player 2 selects a set $U'_{i-1}$ such that $|U'_{i-1}| \le t$
$U_i \gets (U \setminus U'_{i-1})$
\item Player 1 selects a ready step $s_{i} \in S_{i-1}$ and a user $u \in U_i$
$\pi(s_{i}) \gets u$ and $S_i \gets S_{i-1} \setminus \{s_{i}\}$
if $\pi$ is not a valid partial plan with respect to $s_{1}, \dots, s_{i}$, then Player 1 loses.
\item if $S_i = \emptyset$, then Player 1 wins; otherwise, let $i \gets i+1$ and the game goes on to the next round.
\end{compactenum}
\end{df}
Wang and Li established the following results~\cite[Theorems 13--15]{WaLi10}:
\begin{itemize}
\item determining whether a workflow is statically $t$-resilient is NP-hard (and is in coNP$^{\rm NP})$;
\item determining whether a workflow is decrementally $t$-resilient is PSPACE-complete; and
\item determining whether a workflow is dynamically $t$-resilient is PSPACE-complete.
\end{itemize}
The proof of the first result follows from the fact that WSP itself corresponds to the special case $t = 0$.
The remaining results are proved by establishing a reduction from the {\sc Quantified Satisfiability} problem, which is known to be PSPACE-complete.
Note that if a workflow is dynamically $t$-resilient then it is decrementally $t$-resilient; and if a workflow is decrementally $t$-resilient then it is statically $t$-resilient.
\subsection{Fixed-parameter tractability results}\label{sec:res:wangli}
The moves of Player 1 in Definitions~\ref{def:decrres} and~\ref{def:dynres}, after an execution of the game, give a linear extension $[s_1, \dots, s_k]$ of $(S, <)$. On the other hand, the moves of Player 2 give a particular sequence of user sets. Using these ideas, we now give equivalent definitions of $t$-resiliency that are more suitable for developing the algorithm we present in Theorem \ref{thm:fptresiliency}.
To do so, we first introduce the notion of a $t$-close userset family and then define what it means for a plan to be compatible with a linear extension and a $t$-close userset family.
\begin{df}
Let $W=((S, <), U, A, C)$ be a constrained workflow authorization schema, and $t \le |U|$. A family $F=\{U_i\}_{i \in [k]}$ is called a {\em $t$-close userset family} of $U$ if $U_i \subseteq U$ and $|U| - |U_i| \le t$ for all $i \in [k]$.
\end{df}
\begin{df}
Let $W = ((S, <), U, A, C)$ be a constrained workflow authorization schema, $t \le |U|$, $F=\{U_i\}_{i \in [k]}$ be a $t$-close userset family of $U$ and $\ell = [s_1, \dots, s_k]$ be a linear extension of $(S, <)$. We say that a plan $\pi : S \rightarrow U$ is {\em $(F,\ell)$-compatible} if for every $i \in [k]$, $\pi(s_i) \in U_{i}$.
\end{df}
The following result demonstrates that dynamic $t$-resiliency can be defined in terms of compatible plans and linear extensions (rather than two-player games).
This turns out to be a more convenient formulation for determining whether a workflow is dynamically $t$-resilient.
\begin{thm}
Let $W=((S, <), U, A, C)$ be a constrained workflow authorization schema, and $t \le |U|$. $W$ is dynamically $t$-resilient if and only if for every $t$-close userset family $F=\{U_i\}_{i \in [k]}$ of $U$, there exists a linear extension $\ell = [s_1, \dots, s_k]$ of $(S, <)$ and a valid plan for $W$ which is $(F,\ell)$-compatible.
\end{thm}
\begin{proof}
Suppose that $W$ is dynamically $t$-resilient, and suppose we are given a $t$-close userset family $F=\{U_i\}_{i \in [k]}$ of $U$. Then by assumption, if we run the game with Player 2 making choices corresponding to $F$, then there exists a sequence of moves for Player 1, that is, a linear extension $\ell = [s_1, \dots, s_k]$ of $(S, <)$ together with a valid plan $\pi : S \rightarrow U$ such that $\pi(s_{i}) \in U_i$. In other words, $\pi$ is $(F, \ell)$-compatible.
Conversely, moves of Player 2 can be represented by a $t$-close userset family $F=\{U_i\}_{i \in [k]}$. By hypothesis, there exists a linear extension $\ell = [s_1, \dots, s_k]$ of $(S, <)$ and a valid plan $\pi : S \rightarrow U$ which is $(F, \ell)$-compatible, i.e. such that Player 1 can win by picking step $s_{i}$ at iteration $i$.
\end{proof}
It is easily seen that similar statements can be made for static and decremental resiliency by selecting appropriate conditions on the $t$-close userset families.
\begin{thm}
Let $W=((S, <), U, A, C)$ be a constrained workflow authorization schema, and $t \le |U|$. $W$ is statically $t$-resilient if and only if for every $t$-close userset family $F=\{U_i\}_{i \in [k]}$ of $U$ such that $U_i = U_j$ for all $i, j \in [k]$, there exists a linear extension $\ell = [s_1, \dots, s_k]$ of $(S, <)$ and a valid plan for $W$ which is $(F,\ell)$-compatible.
\end{thm}
\begin{thm}
Let $W=((S, <), U, A, C)$ be a constrained workflow authorization schema, and $t \le |U|$. $W$ is decrementally $t$-resilient if and only if for every $t$-close userset family $F=\{U_i\}_{i \in [k]}$ of $U$ such that $U_{i+1} \subseteq U_i$ for all $i \in [k-1]$, there exists a linear extension $\ell = [s_1, \dots, s_k]$ of $(S, <)$ and a valid plan for $W$ which is $(F,\ell)$-compatible.
\end{thm}
A na\"ive approach for deciding whether a workflow is $t$-resilient would be to enumerate all possible scenarios (i.e. all possible $t$-close userset families and all linear extensions of $(S, <)$), and then test whether a valid plan is compatible with this scenario. However, such an enumeration would be highly inefficient from a computational point of view, as it would lead to an algorithm running in time $O^*(n^{tk})$.
We now show that it is sufficient to enumerate all $t$-close userset families of a {\em subset} of users whose size depends on $k$ and $t$ only.
Using this result, we are able to prove that deciding whether a workflow is (statically, decrementally or dynamically) $t$-resilient is FPT parameterized by $k+t$. In other words, if both the number of steps and the maximum number of unavailable users are small, we obtain an efficient algorithm.
It seems reasonable to assume that $t$ will be small relative to $n$ in practice.
\begin{thm}\label{thm:fptresiliency}
We can decide whether a constrained workflow authorization schema \mbox{$W=((S, <), U, A, C)$} is dynamically $t$-resilient for some $t \in \mathbb{N}$ in time $O^*(f(k, t))$ for some computable function $f$ if all constraints in $C$ are UI.
\end{thm}
It is important to note that all constraints considered by Wang and Li are UI.
In fact, the class of UI constraints is far larger than the constraints considered by Wang and Li in their work.
\begin{proof}[Proof of Theorem~\ref{thm:fptresiliency}]
The first step of the algorithm consists of reducing the set of users to a size depending on $k$ and $t$ only.
To do so, for any $p \le k$ and any partition $P$ of $S$ into $p$ non-empty disjoint subsets $\{T_1, \dots, T_p\}$, we construct a bipartite graph $G_P$ with partite sets $\{T_1, \dots, T_p\}$ and $U$.
The adjacencies are defined by the authorization policy: for any $i \in [p]$ and any $u \in U$, we connect $T_i$ and $u$ if and only if $(u, s) \in A$ for all $s \in T_i$. Moreover, for all $i \in [p]$, we note $N(T_i) = \{u \in U: \forall s \in T_i, ~ (u, s) \in A\}$.
We then proceed to a marking step, which results in a set of marked users $U_m \subseteq U$:
for every $i \in [p]$, if $|N(T_i)| < k+t$, then mark all users in $N(T_i)$. Otherwise, mark an arbitrarily chosen set of $k+t$ users of $N(T_i)$.
Doing this for any partition $P$, it is clear that the total number of marked users is at most $k (k+t) {\cal B}_k$, and thus $|U_m| = O(2^{k \log_2 k} k (k+t))$.
For the remainder of the proof, let $A_m$ be the restriction of $A$ to $U_m$, i.e. $A_m = A \cap (U_m \times S)$, and $W'=((S, <), U_m, A_m, C)$. We also denote $\bar{U}_m = U \setminus U_m$.
\begin{lemma}\label{lemma:equivsol}
$W$ is dynamically $t$-resilient if and only if $W'$ is dynamically $t$-resilient.
\end{lemma}
\begin{proof}
Suppose that $W$ is dynamically $t$-resilient, and let $F=\{U_i\}_{i \in [k]}$ be a $t$-close userset family of $U_m$. We set $U_i' = U_i \cup \bar{U}_m$ for each $i \in [k]$, and $F' = \{U_i'\}_{i \in [k]}$. One can see that $F'$ is a $t$-close userset family of $U$, and thus there exists a linear extension $\ell$ of $(S, <)$ and a valid $(F', \ell)$-compatible plan $\pi$ for $W$. Let us denote by $P(\pi) = \{T_1, \dots, T_p\}$ the pattern of $\pi$, with $p \le k$. For all $i \in [p]$, if $\pi(T_i) \in U_m$, then define $\pi'(T_i) = \pi(T_i)$. If $\pi(T_i) \notin U_m$, then it means that $\pi(T_i) \in U_{i}' \cap \bar{U}_m$, and, by construction of the marking algorithm, it implies that $|N(T_i) \cap U_m| = k+t$, and thus $|N(T_i) \cap U_{i}| \ge k$. Hence, there must exist $u \in N(T_i) \cap U_{i}$ such that $\pi(T_j) \neq u$ for all $j \neq i$, and we set $\pi'(T_i) = u$. By doing this, we can check that $\pi'$ is a valid plan for $W'$ that is $(F,\ell)$-compatible.
Conversely, suppose that $W'$ is dynamically $t$-resilient, and let $F=\{U_i\}_{i \in [k]}$ be a $t$-close userset family of $U$. In this case, we define $U'_i = U_i \cap U_m$ for every $i \in [k]$, and $F' = \{U'_i\}_{i \in [k]}$. One can verify that $|U'_i| \ge |U_m|-t$, and thus $F'$ is a $t$-close userset family of $U_m$. Thus, there must exist a linear extension $\ell$ of $(S, <)$ together with a valid plan $\pi$ for $W'$ which is $(F,\ell)$-compatible, and it is easily seen that this plan is both valid for $W$ and $(F',\ell)$-compatible.
\end{proof}
Since the size of $U_m$ now depends on $k$ and $t$ only, we can enumerate all $t$-close userset families of $U_m$: for each such family $F$, we test whether there exists a linear extension $\ell$ of $(S, <)$ (by enumerating all of them) and a valid plan for $W'$ which is $(F,\ell)$-compatible in time $O(g(k, t))$ for some computable function $g$. Since the marking algorithm runs in time $O^*({\cal B}_k)$, the total running time is $O^*(f(k, t))$ for some computable function $f$. Correctness of the algorithm is ensured by Lemma~\ref{lemma:equivsol}.
\end{proof}
It is easily seen that the previous algorithm can be adapted to the decremental and static notions of resiliency. Hence, we have the following:
\begin{thm}
We can decide whether a constrained workflow authorization schema $W=(\mbox{$(S, <)$}, U, A, C)$ is decrementally $t$-resilient (resp. statically $t$-resilient) in time $O^*(f(k, t))$ for some computable function $f$ if all constraints in $C$ are UI.
\end{thm}
\subsection{A new model for resiliency}
Mace \textit{et al.}\xspace argue that knowing whether a workflow is dynamically $t$-resilient or not is unlikely to be of much use in the real world~\cite{MaMoMo14}.
They suggest it would be more valuable to quantify the extent to which a workflow was resilient.
Accordingly, they introduce metrics for ``quantitative resiliency'' and used Markov decision processes to compute these metrics.
Informally, they consider every pair of $t$-close userset family and plan to compute these metrics, making their approach computationally expensive.
Their approach also appears to assume that the \emph{set of unavailable users} is selected uniformly at random from all possible subsets of available users.
This means, in particular, that the probability of no users being unavailable is the same as $t$ specific users being unavailable -- an assumption that seems unlikely to hold in practice.
While agreeing with the motivation for studying quantitative resiliency, we adopt a different approach and one which enables us to treat questions about quantitative resiliency as instances of \textsc{BO-WSP}\xspace.
Our basic approach is to identify three aspects that affect resiliency: the authorization policy, ``known'' unavailability of users, and ``unknown'' unavailability of users.
We start with a constrained workflow authorization schema $W=((S,<),U,A,C)$, where $A$ is given as a function from $S \times U$ to $\{0, 1\}$ (i.e. $A(s,u) = 1$ if and only if user $u$ is authorized to perform step $s$).
We are also given a description of user availability, comprising a deterministic component (the ``known'' unavailability) and a probabilistic component (the ``unknown unavailability'').
The deterministic component is specified as a function $\alpha : S \times U \rightarrow \set{0,1}$, where $\alpha(s,u) = 1$ if and only if $u$ is available to execute step $s$.
Such a component may be derived from inspection of user calendars and take into account activities such as holidays and time away from the office on business.
(Of course, defining $\alpha$ will also require some assumptions to be made about when the steps in a workflow instance will be executed, which may not always be possible.
In such cases, we can simply set $\alpha(s,u) = 1$ for all $s$ and $u$.)
The probabilistic component is specified as a function $\rho : S \times U \rightarrow [0,1]$, where $\rho(s,u)$ denotes the probability that $u$ is not available to execute step $s$.
Values of $\rho(s,u)$ could be derived from historical information about user availability, such as (unplanned) absences from work.
Given $W$, $\alpha$, $A$ and $\rho$, we define
\[
\omega(s,u) = %
\begin{cases}
M & \text{if $A(s,u) \cdot \alpha(s,u)=0$}, \\
\rho(s,u) & \text{otherwise},
\end{cases}
\]
where $M$ is a large positive constant.
Finally, for a plan $\pi$, we define \[ \omega_A(\pi) = \sum_{s \in S} \omega(s, \pi(s)). \]
In other words, assigning an unauthorized or unavailable user results in a weight of at least $M$, while assigning an authorized user incurs a weight corresponding to the likelihood of the user being unavailable.
Clearly $\omega_A$ respects the definition of an authorization weight function as described in Section~\ref{sec:wwsp}.
In addition to this authorization function, we can define a constraint weight function $\omega_C : \Pi \rightarrow \mathbb{Q}^+$, as we did in Section~\ref{sec:wwsp}.
We may now solve the resulting instance of \textsc{BO-WSP}\xspace with one of the three approaches mentioned earlier.
We now consider how the result of solving such an instance of \textsc{BO-WSP}\xspace may be interpreted and provide useful information to workflow administrators.
For a plan $\pi$, let $X(\pi)$ be a random variable equal to the number of unexecuted steps due to users being unavailable.
Notice that by definition of expectation, if $\omega_A(\pi)$ is less than $M$, then $\mathbb{E}[X(\pi)]=\omega_A(\pi)$ and thus by Markov's inequality\footnote{Markov's inequality states that if $X$ is a non-negative random variable and $a>0$, then $\mathbb{P}(X\ge a)\le \mathbb{E}[X]/a$~\cite{Weisstein}.} and the fact that $X(\pi)$ is integer-valued, the probability that all steps will be executed by $\pi$ is
\begin{align*} \mathbb{P}(X(\pi) = 0) &= 1-\mathbb{P}(X(\pi)\ge 1) \\ &\ge 1-\omega_A(\pi). \end{align*}
Now consider our purchase order workflow example.
For simplicity, we will assume that $\rho(s,u)$ does not depend on $s$; that is, $\rho(s,u)=\rho(s',u)$ for all $s,s' \in S$ and we may simply write $\rho(u)$.
Illustrative values of $\rho(u)$ are shown in Figure~\ref{subfig:user-probabilities}, and the function $\omega$ derived from those probabilities (using Figures~\ref{subfig:authorization-relation} and~\ref{subfig:user-probabilities}) is shown in Figure~\ref{subfig:omega-for-resiliency-example}.
\begin{figure}[h]
\begin{subfigure}{\textwidth}\centering
\begin{tabular}{|*{8}{>{$}r<{$}}|}
\hline
u_1 & u_2 & u_3 & u_4 & u_5 & u_6 & u_7 & u_8 \\
\hline
~0.01 & ~0.06 & ~0.03 & ~0.05 & ~0.07 & ~0.05 & ~0.06 & ~0.01 \\
\hline
\end{tabular}
\caption{$\rho : U \rightarrow [0,1]$}\label{subfig:user-probabilities}
\end{subfigure}
\vspace*{.5\baselineskip}
\begin{subfigure}{\textwidth}\centering
\begin{tabular}{|>{$}r<{$}|*{6}{>{$}r<{$}}|}
\hline
& s_1 & s_2 & s_3 & s_4 & s_5 & s_6 \\
\hline
u_1 & 0.01 & M & 0.01 & 0.01 & M & M \\
u_2 & 0.06 & M & 0.06 & 0.06 & M & M \\
u_3 & 0.03 & M & 0.03 & M & M & M \\
u_4 & 0.05 & M & 0.05 & M & M & M \\
u_5 & 0.07 & M & 0.07 & M & M & M \\
u_6 & M & 0.05 & 0.05 & M & 0.05 & M \\
u_7 & M & M & 0.06 & 0.06 & 0.06 & M \\
u_8 & M & M & M & M & 0.01 & 0.01 \\
\hline
\end{tabular}
\caption{$\omega : S \times U \rightarrow \mathbb{Q}^+$}\label{subfig:omega-for-resiliency-example}
\end{subfigure}
\caption{Assigning probabilistic weights}\label{fig:assigning-probabilistic-weights}
\end{figure}
For ease of illustration we assume that the penalty of breaking each constraint is the same and that we allow at most one constraint to be violated.
We also assume that $\alpha(s,u) = 1$ for all $s$ and $u$.
Then it makes sense to seek a Pareto optimal plan (since the above assumptions essentially fix the maximum penalty due to the violation of constraints).
The plan $\tau$ that minimizes $\omega_A$ is given by $\tau(s_1)=\tau(s_3)=\tau(s_4)=u_1$, $\tau(s_2)=u_6$, $\tau(s_5)=\tau(s_6)=u_8$ and the expected value of the number of unexecuted steps $\omega_A(\tau)$ equals $0.10$.
Thus, the probability that all steps will be executed is at least $0.90$.\footnote{Markov's inequality is known to provide only a rough bound and so the probability that all steps will be executed is likely to be even larger.}
Now assume that we do not allow any constraint to be violated.
Then $\tau'(s_1)=\tau'(s_3)=u_3$, $\tau'(s_4)=u_1$, $\tau'(s_2)=u_6$, $\tau'(s_5)=\tau'(s_6)=u_8$ is a minimum authorization weight plan and the expected value of the number of unexecuted steps equals $0.14$, implying that the probability that all steps will be executed is at least $0.86$.
Notice that the probability that all steps will be executed is lower when we don't allow any constraints to be violated (as one would expect).
Hence, we believe that the model presented in this section may fit well
to many practical situations, and that the results provided by a solution to
BO-WSP may provide useful information to workflow administrators.
\section{Concluding remarks}\label{sec:conclusion}
In this paper, we have generalized the {\sc Valued WSP} problem~\cite{CrGuKa15}, by defining the {\sc Bi-objective WSP} (\textsc{BO-WSP}\xspace).
In doing so, we have introduced a tool for analyzing a variety of problems relating to workflow satisfiability.
Moreover, we have developed fixed-parameter tractable algorithms to solve \textsc{BO-WSP}\xspace.
This means that we are able to solve many instances of \textsc{BO-WSP}\xspace in which the parameters take values that one would expect to see in practice (namely, the numbers of users is large compared to the number of steps).
Our work improves on existing work in a number of ways and provides a single framework within which a variety of problems may be analyzed and solved.
In particular, we are able to solve {\sc Valued WSP} (and generalizations thereof), the Cardinality-Constrained Minimum User Problem~\cite{Roy2015} (and generalizations thereof), and questions about workflow resiliency.
We have also established that the decision problems associated with resiliency due to Wang and Li are fixed-parameter tractable.
We have taken inspiration from the work of Mace \emph{et al.}~\cite{MaMoMo14} by developing a new model for quantifying workflow resiliency in terms of the expected number of steps that will be executed for a given plan, based on probabilities associated with the (un)availability of users.
We believe our model for user unavailability is more realistic than that of Mace \emph{et al}.
It is certainly the case that our approach leads to more efficient methods of computing the expected number of steps that will be executed.
Nevertheless, Mace \emph{et al.} introduced a number of useful metrics that cannot be computed using \textsc{BO-WSP}\xspace.
Unfortunately, these metrics are very expensive to compute, because it is necessary to consider every possible plan and every possible sequence of usersets that may be available.
There are several opportunities for further research in this area.
For most workflow specifications it is not necessary to consider the control flow (specified in our model by the partial ordering on the set of steps)~\cite{CrGu13}.
However, some workflow specifications may contain sub-workflows that are iterated and problems analogous to WSP in this context are known to be hard~\cite{BaBuKa12}.
We intend to investigate whether our methods can be extended to cater for such workflows.
We also hope to extend our research into quantitative workflow resiliency.
In particular, we would like to develop metrics that provide useful information in practice (like those of Mace \emph{et al.}) but can be computed using \textsc{BO-WSP}\xspace (for appropriate choices of weight functions).
\paragraph{Acknowledgements.}
This research was partially supported by an EPSRC grant EP/K005162/1.
Gutin's research was partially supported by Royal Society Wolfson Research Merit Award.
Karapetyan's research was partially supported by EPSRC grant EP/H000968/1.
| {'timestamp': '2016-11-16T02:08:31', 'yymm': '1512', 'arxiv_id': '1512.07019', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.07019'} | arxiv |
\section{Introduction}
\label{setI}
Nearest neighbor search in very large databases is becoming increasingly important in machine learning, computer vision, pattern recognition, and multimedia retrieval along with many applications in document, image, audio, and video retrievals~\cite{tLiu2004, Weiss2008, Lowe2004, Datar2004, Andoni2006, Nister2006, Philbin2007, Boiman2008, Jegou2008, JegouDYGG12, HeKC2012}. However, it becomes difficult to efficiently store and search huge collections when the dataset size gets larger and larger (e.g. millions or even billions). The idea of mapping real-valued vectors to compact codes \cite{Torralba08smallcodes, Jegou2010, GongS2011} provides a very attactive way to solve this problem. There have been many recent methods on developing hashing methods for compressing data to compact binary strings \cite{Torralba08smallcodes, GongS2011, Andoni2006, Kulis2009, Charikar02,SSH:cvpr2010,cvpr12:KSH}, or vector quantization based methods \cite{Jegou2010, GeHKS2013, NorouziF2013} that compress data to compact codes.
Vector quantization (VQ) was actively studied for source coding/signal compression under real-time constraints dating back to decades ago~\cite{Gersho-VQ-Book}. Recently, the problem of how to apply VQ techniques to efficient approximate nearest neighbor (ANN) search has attracted a lot of attension~\cite{Jegou2010, chen2010, YuanL12, BabenkoL2012, GeHKS2013, NorouziF2013, ZhangDW2014, BabenkoL2014}. While many structured VQ models can be found~\cite{Gersho-VQ-Book, JainMF1999, BarnesRN1996}, in this paper, we restrict our attention to product quantization (PQ) and residual quantization (RQ), which both have been successfully applied to fast nearest neighbor search \cite{Jegou2010,chen2010}.
\subsection{Related Works}
Product quantization works by grouping the feature dimensions into groups, and performs quantization to each feature group. In particular, it performs a $k$-means clustering to each group to obtain sub-codebooks, and the global quantization codebook is generated by the Cartesian products of all the small sub-codebooks. In this way, it can generate a huge number of landmark points in the space, which guarantees low quantization error; it has achieved state of the art performance on approximate nearest neighbor search~\cite{Jegou2010}, and can also provide a compact representation to the vectors. Inspired by the success of PQ, some latest works have extended PQ to a more general model by finding an optimized space-decomposition to minimize its overall distortion~\cite{GeHKS2013, NorouziF2013}. A very recent work~\cite{KalantidisA2014} has deployed this optimized PQ within residual clusters. While it maximizes the strength of locality, it also uses extra space for multiple transformations as well as PQ codebooks.
\begin{figure*}[th]
\centering
\includegraphics[trim=2cm 12cm 4cm 1cm,clip=true, width=.95\linewidth]{ORQ-example-2.pdf}
\caption{A toy example of two-level RQ and TRQ. While the first-level vector quantizer (a) is identical to the two models, the residual space in the ordinary RQ model (b) is much noisy than the TRQ model (c), in which the residual clusters are aligned by our novel method.}
\label{figure:ORQ-example}
\end{figure*}
Different from PQ, RQ works by performing quantization to the whole feature space, and then recursively apply VQ models to the residuals of the previous quantization level, which is a stacked quantization model. In particular, it performs a $k$-means clustering to the original feature vectors, and construct $k$ clusters. For points in each cluster, it computes the residuals between points and the cluster centers. In the next level, it aggregates all the residual vectors for all points, and performs another clustering to these residual vectors. This process is recursively applied (stacked) for several levels. In this way, RQ produces sequential-product codebooks. A comprehensive survey of earlier RQ models can be found in Barnes et al.~\cite{BarnesRN1996}. Recent works have shown the effectiveness of RQ to perform both indexing~\cite{YuanL12} and data compression~\cite{chen2010} tasks in ANN search problems.
However, it has been observed that the effectiveness of RQ might be limited to a very small number of levels~\cite{Gersho-VQ-Book}, and the randomness of residual vectors increases very quickly when we stack more and more RQ layers. This results in increasingly noisy residual vectors of each level, and effective quantization at higher RQ levels becomes more difficult. In other words, the layer-wise learning in RQ models provides suboptimal sub-codebooks in that each sub-codebook is learned without consideration to subsequent layers. Thence several global optimization approaches have been proposed by jointly learning sub-codebooks over all layers~\cite{ChanGG1992, ZhangDW2014, BabenkoL2014}. Different from seeking out joint optimization solutions, we here look for specific transformations to each of the residual clusters to make the resulting vectors more aligned, in order to directly address the problem of cluster misalginment and noise increase over each level after the first and improve overall quantization accordingly.
\subsection{Contributions}
To this end, we propose a novel approach to optimizing the RQ model that is motivated by the noise and shape in the residual space, as shown in Figure \ref{figure:ORQ-example}. We find that the residual vectors for each cluster have significantly different directions, which make quantization at the next level much harder. A natural idea is to align these residual vectors for each cluster, which can potentially reduce quantization error in the next level. Thus, we propose to learn one rotation matrix for each residual cluster, and use them to align the residual vectors in each cluster, so as to reduce the global quantization error. Then we alternate between learning rotation matrices and the residual quantization to minimize its distortion, which is mainly inspired by ``Iterative Quantization (ITQ)'' \cite{GongS2011}; very recently ITQ has been successfully applied to the PQ models~\cite{GeHKS2013, NorouziF2013, KalantidisA2014}. Different from ITQ and the optimized PQ (OPQ), which learn a global rotation, both ours and the locally optimized PQ (LOPQ)~\cite{KalantidisA2014} learn one projection matrix per residual cluster. In stead of independent learning in LOPQ, however, all local transformations in our method are learned associatively with a shared codebook. In this way, we successfully reduce the memory overheads about codebook usage in LOPQ. This offers a great flexibility to use reasonable larger codebooks in potential.
We have found that by doing this iterative alignment and quantization, we can achieve significantly smaller quantization error than both vanilla RQ and OPQ methods. In addition, we also propose a hybrid ANN search method which is based on the proposed TRQ and PQ. Experimental results on several large-scale datasets have clearly demonstrated the effectiveness of our proposed methods, in particular have shown that the extra transformations only introduced very limited computation overheads when integrated with advanced indexing structures, e.g. the inverted mutli-index~\cite{BabenkoL2012}. Therefore, our method is able to achieve very significant gain over other state of the art methods in terms of trade-off among memory usage, search quality and speed.
\section{Background and Formulations}
\label{sectR}
In this section, we review related background on two types of structured vector quantization, i.e. product quantization and residual quantization. To accurately quantize large number of points in a high dimensional space, we need a large number of landmark points (or centroids). For example, if we use the $k$-means clustering method to find such quantizers, when the number of cluster centers $k$ becomes huge (e.g. millions or even more), performing $k$-means becomes prohibitively expensive. Structured vector quantization make special assumptions about the data distribution, and try to explore such structure to generate large number of landmark points to increase the quantization accurateness \cite{Gersho-VQ-Book}. PQ and RQ are two structured VQ families with different assumptions about data distribution. We here present discussions on structural codebook constructions and objective function formulations of the related VQ models following a brief introduction of the unstructured VQ.
Vector quantization (VQ a.k.a.~$k$-means) without any structure constraints is probably one of the most widely used vector quantization method. Given a dataset $X = \{ \boldsymbol x_{j}: \boldsymbol x_{j} \in \mathbb{R}^{D}, j = 1,...,N\}$, VQ is a mapping:
\begin{equation}
\label{eq:vq_mapping}
q(\boldsymbol x_{j})= \boldsymbol c_{i}, \boldsymbol c_{i} \in C
\end{equation}
where $q$ is a quantizer and $\boldsymbol c_{i}, i = 1,2,...,k$ is a \textit{centroid} or a \textit{center} from the codebook $C$. According to Lloyd's optimality conditions, an optimal quantizer satisfies the nearest neighbor condition: $\displaystyle q(\boldsymbol x_{j}) = \argmin_{\boldsymbol c_{i} \in C} d(\boldsymbol x_{j}, \boldsymbol c_{i}).$ Here $d(., .)$ is the distance between two vectors and Euclidean distance is used in this paper. For each centroid, a set of data points will be assigned to it, and forms a cluster. According to the second optimal condition, a centroid is computed as: $\boldsymbol c_{i} = E(\boldsymbol x_{j} | \boldsymbol x_{j} \in V_{i}).$ We estimate the codebook centers to minimize the objective function: the mean squared error (MSE)
\begin{equation}
\label{eq:vq_mse}
\text{MSE}(q)= 1/N \sum_{j=1}^{N} \left \| \boldsymbol x_{j}-q(\boldsymbol x_{j}) \right \|_{2}^{2}.
\end{equation}
While the globally optimal solution of the above problem is NP-hard, it can be solved by heuristic alternatives. The best known approach is the $k$-means algorithm~\cite{Gersho-VQ-Book}, in which the above two conditions are optimized alternatively.
\subsection{Product Quantization}
Product quantization assumes that certain groups of features are independent with each other, and explores this assumption to generate a large number of landmark points by grouping the feature space into $m$ groups (each group is a subspace). By quantizing each of the subspaces separately using sub-quantizer $q_i(\cdot)$, it produces an implicit codebook as a Cartesian product of $m$ small sub-codebooks, $C = C_{1} \times C_{2} \ldots \times C_{m}$. In this case, codebook $C$ can provide an exponentially large number of cluster centers while retains a linear size of storage. Given a data point $\boldsymbol x_{j}$, it estimates the globally nearest center by concatenating all its nearest sub-centers from the sub-codebooks as $q(\boldsymbol x_j) = \boldsymbol c_{i1} | \ldots | \boldsymbol c_{im} $.
The MSE of this product quantizer can be estimated as:
\begin{equation}
\label{eq:pq_mse}
\text{MSE}(q) = \sum_{i=1}^{m} \text{MSE}(q_{i}).
\end{equation}
The degradation of PQ performance can be severe if there are substantial statistical dependences among the feature groups~\cite{Gersho-VQ-Book}; Recent works have shown that such dependences could be reduced, to some extent, by more careful space-decomposition~\cite{GeHKS2013, NorouziF2013}. Their works extended the idea from iterative quantization~\cite{GongS2011} to the PQ scheme that learn an rotation to transform the data to reduce the dependences between feature groups. For example, the work from \cite{GeHKS2013} jointly seeks a whole space rotation $T$ and PQ codebooks $C$ by minimizing
\begin{equation}
\label{eq:opq_mse}
\text{MSE}(q)= 1/N \sum_{j=1}^{N} \left \| T\boldsymbol x_{j}-q(T\boldsymbol x_{j}) \right \|_{2}^{2},
\end{equation}
\vspace{-10pt}
\[
s.t.~~~~q(T \boldsymbol x_{j}) = T(\boldsymbol c_{i_{1}} | \boldsymbol c_{i_{2}} |...| \boldsymbol c_{i_{m}}).
\]
\subsection{Residual Quantization}
Residual quantization (RQ) has a different assumption in that it does not assume the features are independent, but assumes the quantization residuals of the first level quantizer can be further quantized. Thus, it is a stacked quantization model. For the first level, RQ simply uses a $k$-means clustering to quantize the data, and assign them to $k$ centers. For each data point, by subtracting from the assigned centroid, we can collect their residual vectors as $\boldsymbol r_{j} = \boldsymbol x_{j } - q_{1}(\boldsymbol x_{j})$. Then $R = \{\boldsymbol r_{j}, j = 1,...,N\}$ will be used as the input to the next level, and we again use $k$-means\footnote{Although other quantizers can be used, such as a product quantizer, using $k$-means is a basic choice.} to quantize the residual vectors. By repeating this for $h$ times, we can have a sequential product codebook $C = C_{1} \times C_{2} \ldots \times C_{h}$. Given an input vector $\boldsymbol x_{j}$, by computing the nearest center at each level, we can get a sequence of indexes $(i_{1}, i_{2}, \ldots, i_{h})$. The globally nearest center for $\boldsymbol x_{j}$ here becomes a direct sum of all the sub-centers $q(\boldsymbol x_i) = \sum_{l=1}^{h} \boldsymbol c_l$.
Simply considering one level, we represent $\boldsymbol x_{j}$ at level $l$ as $\boldsymbol x_{j}^{l}$ where $\boldsymbol x_{j} = \boldsymbol x_{j}^{1}$. Then the residual vector from level $l$ is
\begin{equation}
\label{eq:rvec}
\boldsymbol x_{j}^{l+1} = \boldsymbol x_{j}^{l} - q_{l}(\boldsymbol x_{j}^{l}),
\end{equation}
the MSE for a $h$-level RQ is
\begin{align}
\label{eq:rq_mse}
\text{MSE}(q) = \text{MSE}(q_h) = 1/N \sum_{j=1}^{N} \| \boldsymbol x_{j}^{h} - q_{h}(\boldsymbol x_{j}^{h}) \|_{2}^{2} \nonumber \\
= 1/N \sum_{j=1}^{N} \| \boldsymbol x_j^{h+1} \|_{2}^{2}.
\end{align}
The most important advantage of RQ is that it does not make the unrealistic assumption that the features are statistically independent. In addition, it holds a non-increasing property, that is, adding a level will always reduce the MSE error.
\section{Transformed Residual Quantization}
\label{sectM}
As discussed above, residual quantization recursively performs quantization on residual vectors from previous levels. In other words, all the residual vectors from different clusters are collected and fed into the same quantizer in the next level. As shown in Figure \ref{figure:ORQ-example} (b), the residual clusters can have different shapes, orientations, or scales, which makes effective quantization of them very hard in general. To address this problem, we propose to learn one rotation per cluster to transform the residual clusters, to make them more aligned to each other, and potentially can make more fruitful residual-level quantizers (see Figure \ref{figure:ORQ-example}(c)).
\subsection{Residual Quantization with Cluster-Wise Transforms}
For simplicity, we focus our analysis on a two-level RQ model. We fix the first level to be an $k$-means clustering with $k_{1}$ clusters. And at this point, we are not going to specify the second-level quantizer $q_{2}$ considering our proposed method is general to any quantizer performed in the residual space. In this way, we have a first-level codebook $C^{1}$ with $k_{1}$ cluster centers $\boldsymbol c_{i}^{1}, i=1,...,k_{1}$. We suppose that a vector $\boldsymbol x_{j}$ is assigned to $\boldsymbol c_{i}^{1}$, its residual vector is denoted as
\begin{equation}
\label{eq:rvec2}
\boldsymbol r_{j} = \boldsymbol x_j - \boldsymbol c_{i}^{1},
\end{equation}
A residual cluster $V_{i}$ then is a collection of all residual vectors assigned to its center,
\begin{equation}
\label{eq:rcluster}
V_{i} = \{\boldsymbol r_{j} : q_{1}(\boldsymbol x_{j}) = \boldsymbol c_{i}^{1}\}.
\end{equation}
The residual set $R = \{\boldsymbol r_{j}: j=1,...,N\}$ forms the input for the next level quantizer $q_{2}$. Finally, the objective function for such a RQ model simply follows either Equation~\ref{eq:rq_mse} or Equation~\ref{eq:pq_mse}, depending on whether another $k$-means or PQ is selected to be the residual quantizer. To alleviate the misalignment of these clusters, we propose to apply cluster-specified transforms right after the first level so that all clusters are aligned for better adaption to the shared residual quantizer. We associate each cluster center $\boldsymbol c_{i}^{1}$ with a transform $T_{i}$, whose inverse $(T_{i})^{-1}$ must exist. Accordingly, a transformed residual cluster is then represented as
\begin{equation}
\label{eq:trans_rcluster}
V_{i}' = \{T_{i}\boldsymbol r_{j} : q_{1}(\boldsymbol x_{j}) = \boldsymbol c_{i}^{1}\}.
\end{equation}
We dubbed the generalized RQ model as transformed residual quantization (TRQ). While our generalization only requires transforms to be invertible, the property of non-increasing MSE error remain valid if transforms are orthogonal matrices, i.e., $(T_i)^T \times T_i = I$, (where $I$ is the identity matrix) because applying orthogonal matrices does not change the MSE error. Yet, in this case, scaling inhomogeneity among residual clusters can not be accounted for by the transforms. Finally, denoting a reproduction cluster as $\widetilde{V}_{i}' = q_{2}(V_{i}')$, and Frobenius norm as $\| . \|_{F}$, the MSE for our TRQ model is given by
\begin{equation}
\label{eq:orq_mse}
\text{MSE} = 1/N \sum_{i=1}^{k_{1}} \| T_{i}V_{i} - \widetilde{V}_{i}' \|_{F},
\end{equation}
\begin{table}[h]
\caption{Complexity comparison with different VQ models, where $m$ is the number of subspaces in PQ model, $h$ is the number of levels in RQ and TRQ models, and $l$ is the number of levels having transformations involved in our TRQ model; $O_{dist}$ and $O_{tran}$ are operation costs on distance computations and vector transformations respectively.}
\label{table:complexity}
\vskip 0.15in
\begin{center}
\begin{small}
\begin{sc}
\begin{tabular}{lccr}
\hline
Model & \# Cells & Assignment & Memory \\
\hline
VQ & $k$ & $kO_{dist}$ & $kD$ \\
PQ & $(k^{\ast})^{m}$ & $k^{\ast}O_{dist}$ & $k^{\ast}D$ \\
RQ & $(k^{\ast})^{h}$ & $hk^{\ast}O_{dist}$ & $hk^{\ast}D$ \\
TRQ & $(k^{\ast})^{h}$ & $hk^{\ast}O_{dist}+lO_{tran}$ & $hk^{\ast}D+lk^{\ast}D^{2}$ \\
\hline
\end{tabular}
\end{sc}
\end{small}
\end{center}
\vskip -0.1in
\end{table}
The complexity analysis of TRQ is presented in Table \ref{table:complexity} along with the comparison with aforementioned VQ families. TRQ bring extra computational costs with transforms introduced in the model. In section \ref{sectE}, however, we will justify the advantage of TRQ in nearest neighbor search context with consideration of the substantial increase of search accuracy and reasonable control of using additional computational resources.
\subsection{Iterative Residual Cluster Alignment}
The remaining question is how to estimate $T_{i}$'s that would be effective. An intuitive way is to align all clusters to a specific target set of points. The cluster $V_{i}$ with the greatest population, for instance, is widely used in Procrustes shape analysis~\cite{mardia-shape-book}. In this way, a one-to-one matching is required between the two sets, some extra computations then are performed due to the population difference. At the same time, you may have found that a one-to-one matching already exists between $\boldsymbol r_{j}$ and its reproduction $\boldsymbol{\widetilde{r}}_{j} = q_{2}(\boldsymbol r_{j})$. Therefore, a more reasonable choice is a direct alignment from a cluster $V_{i}$ to the reproduction set $\widetilde{V}_{i}$. A byproduct of this alignment is that it directly meets the ultimate goal to minimize the objective function in Equation~\ref{eq:orq_mse}.
Based on these observations, we propose an iterative alignment (IA) approach to finding $T_{i}$'s. Where we iteratively update all the residual sub-codebooks in $C^{2}$ and the orthogonal matrices $T_{i}$'s until MSE converges, or a specified number of iterations has reached. We formulate the two steps as follows,
\textit{Fix $T_{i}$'s, update $C^{2}$}: When $T_{i}$'s are fixed, the procedure is the same as a normal iteration in a vanilla residual quantizer. There are two step involved:
\begin{enumerate}
\item updating the assignment $I_{j}^{2}$ for each $\boldsymbol r_{j}$, i.e. the indexes of centers $q_{2}(\boldsymbol r_{j})$;
\item updating the codebook $C^{2}$ according to the new assignment $B = \{ I_{j}^{2} : j=1,...,N\}$.
\end{enumerate}
\textit{Fix $C^{2}$, update $T_{i}$'s}: When the residual codebook $C^{2}$ is fixed, we need to find an optimal orthogonal matrix $T_{i}$ for each residual cluster that
\begin{equation}
\label{eq:alignment_matrix}
T_{i} = \argmin_{\Omega} \| \Omega V_{i} - \widetilde{V}_{i}' \|_{F},
\end{equation}
where $\Omega^{T}\Omega = I$. The equation is solved by the Orthogonal Procrust analysis. The solution is straightforward. Given the covariance matrix $M = V_{i}\widetilde{V}_{i}'$, we use the singular value decomposition (SVD) $M=U\Sigma~V^{\ast}$, to have the objective matrix $T_{i} = UV^{\ast}$.
\subsection{Optimization to Inverted-Index Based ANN Search}
\label{sectM-ANN}
The merits of RQ and PQ techniques for large-scale nearest neighbor search are two folds. For indexing, they produce very large number of landmark points that partition the space, and can be used with efficiency as hashing for fast indexing~\cite{Nister2006, Muja2009, chen2010, YuanL12, YuanL2013, BabenkoL2012}; On the other hand, they can produce a very compact representation of the vectors, and enable us to store huge amount of data in memory ~\cite{Jegou2010, Jegou2011, GeHKS2013, NorouziF2013}. Here we briefly introduce two state of the art ANN search systems, and then discuss optimization to the systems with our IA method. More information about parameter settings and experimental results are given in Section \ref{sectE}.
In the system introduced by Jegou et al.~\cite{Jegou2010, Jegou2011}, the first level is an indexer, which employs the $k$-means to construct an inverted file (IVF). In the second level, a product quantizer is used to compress the residuals to product codes. An approximate search then consists of a shortlist retrieval from the indexer IVF, and candidates re-ranking by the product codes. As database size increases, however, the inverted file becomes a bottleneck since the complexity for a $k$-means codebook learning is $O(Nk)$ and a vector assignment is $O(k)$. Where $k$ is the codebook size or the number of cells in IVF. In order to address this issue, Babenko et al. \cite{BabenkoL2012} introduced the inverted multi-index to replace the IVF in above system. The new indexer employs a novel algorithm to jointly sort product cells in a PQ model. The complexities are reduced to $O(Nk^{\frac{1}{m}})$ for PQ codebook learning and $O(k^{\frac{1}{m}})$ for an vector assignment. It has been shown that both search speed and quality were improved. Ge et al. \cite{GeHKS2013} recently applied their optimized PQ (OPQ) approach to the later system. The two levels are both optimized because they are essentially two PQ models.
Both of the systems are indeed based on hybrid models of residual product quantization. In the IVF system, the first level is a flat $k$-means, and the residual level is an ordinary product quantizer. At the same time, the inverted multi-index seems to be more complicated since two-level PQ models involved. However, we could simply see it as $m_1$ residual product quantizers independently produced from the $m_1$ subspaces in the multi-index structure. To optimize such residual product quantizers by our IA method, we only need to pay attention to the steps of the assignment and residual codebook $C^{2}$ updating, to make them follow the way of an ordinary PQ codebook learning.
\section{Experiments}
\label{sectE}
In this section, we examine the proposed TRQ model's performance on several large scale benchmark datasets. We consider both quantization distortion (i.e. mean squared error (MSE)) and ANN search. The first task is a direct measurement of the quantization error of different models, and the second task is a real world ANN search application of these quantization models.
\begin{table}[!ht]
\caption{Statistics of datasets used.}
\label{table:datasets}
\vskip 0.15in
\begin{center}
\begin{small}
\begin{sc}
\begin{tabular}{lcccr}
\hline
Data set & \# Dim. & \# Base & \# Training & \# Query \\
\hline
MNIST & 784 & 60K & 60K & 10K\\
SIFT1M & 128 & $10^{6}$ & 100K & 10K\\
GIST1M & 960 & $10^{6}$ & 500K & 1K\\
SIFT1B & 128 & $10^{9}$ & $10^{8}$ & 10K \\
\hline
\end{tabular}
\end{sc}
\end{small}
\end{center}
\vskip -0.1in
\end{table}
\begin{figure*}[!ht]
\begin{center}
\subfloat{\label{fig:MSE-mnist60k}
\includegraphics[trim=2.1cm 16.3cm 2.2cm 6.9cm,clip=true, width=.95\linewidth]
{mnist60k-n60000-h2-k_r10-m8-k_pq64-niter100.pdf}} \\
\subfloat{\label{fig:MSE-sift1m}
\includegraphics[trim=2.1cm 16.3cm 2.2cm 6.9cm,clip=true, width=.95\textwidth]
{sift1m-n1000000-h2-k_r32-m8-k_pq256-niter100.pdf}} \\
\subfloat{\label{fig:MSE-gist1m}
\includegraphics[trim=2.1cm 16.3cm 2.2cm 6.9cm,clip=true, width=.95\textwidth]
{gist1m-n1000000-h2-k_r32-m8-k_pq256-niter100.pdf}}
\end{center}
\caption{Comparative evaluation about distortion performance. The first level quantizers are fixed across all models so we only examine the behaviors on the residual quantizers. For SIFT1M and GIST1M, we use $k1 = 32$ and $k2 = 256$ that are numbers of clusters used in two levels. While for MNIST, $k1 = 10$ and $k2 = 64$. And $m$-- is the number of feature groups for residual quantizers. In addition, the codebook trainings are directly performed on the base sets.}
\label{fig:MSE}
\end{figure*}
We have used four large scale datasets in our evaluation. The data types include images of hand-written digits from MNIST, local image descriptors SFIT~\cite{Lowe2004}, and global image descriptors GIST~\cite{Oliva2001}. See Table~\ref{table:datasets} for statistics of the datasets. We will present in-depth experimental analysis on three relatively small datasets (MNIST~\cite{LeCunCB1998}, GIST1M, SIFT1M~\cite{Jegou2010}), and report large-scale ANN results on the largest SIFT1B dataset~\cite{Jegou2011}.
In our experiments, we mainly consider two strong quantization baselines. The first method is product quantization (PQ) \cite{Jegou2010} which groups features into different groups, and performs quantization separately. The second method is optimized product quantization (OPQ) \cite{NorouziF2013}, which learns a rotation matrix for PQ to make feature groups more independent with each other, and to make quantization error smaller. This method has been shown to produce state of the art performance for ANN search.
\subsection{Evaluation on Quantization Distortion}
We first report quantization distortion for each model on different datasets, and we use mean squared error (MSE) as the distortion measurement. We only consider a 2 level quantization model in this section (no additional stacked layers for RQ and TRQ), which will help us better evaluate the quantization distortion. The parameter settings are given in Figure~\ref{fig:MSE}. For PQ, when the number of feature groups $m=1$, it does not perform any grouping to the feature dimensions, and is reduced to an ordinary VQ ($k$-means clustering).
Figure~\ref{fig:MSE} shows clearly that our proposed method TRQ has achieved a very significant gain over all other methods. Both TRQ and OPQ work better than the vanilla PQ model, which shows learning these optimal rotations has a clear advantage. Our method further improves OPQ by a significant margin. This is probably because our model does not make any independence assumptions about the feature dimensions or feature groups, while PQ and OPQ heavily rely on this assumption, which is usually too strong for real-world data. It also shows
that the gain of our methods is much more significant on MNIST and SIFT than that on GIST. This is probably because the feature dimensions of GIST are more independent, as has been shown and verified in \cite{Jegou2010}. In general, on all three datasets, our proposed TRQ method has achieved consistent and substantial gain over all other state of the art methods.
\subsection{Evaluation on ANN Search}
Our second experiment applies our method to optimize the ANN search system from~\cite{Jegou2010}. The system is a typical two-level RQ model described in Section~\ref{sectM}, which first applies $k$-means clustering and cluster the dataset into $k$ clusters. All the residual vectors are then passed to a PQ to learn the compact codes. During a search, for a query point $\boldsymbol y$, we first compute its distance to all the first-level cluster centers, and probe $\boldsymbol y$ into the nearest $w$ clusters, and then compute corresponding residuals $\boldsymbol r_{j}, j=1,...,w$ for $\boldsymbol y$. If $\boldsymbol r_{j}$ is from cluster $i$, then we need to rotate it as $\boldsymbol r_{j}' = T_{i}\boldsymbol r_{j}$ in our TRQ model. Finally, each $\boldsymbol r_{j}'$ is used to re-rank all candidates in its cluster through their PQ-codes. Depending on the dataset size, we use $w=6$ for SIFT1M and GIST1M, and $w=2$ for MNIST. We use Recall@R to measure the search quality, which represents the recall of the nearest neighbor within the top R candidates.
Figure \ref{fig:ann-small} shows a similar trend as that of the previous section. Our TRQ method has achieved significantly better performance than the other two methods. For instance, on SIFT1M, we have achieved 31.51\% on Recall@1, while OPQ achieved 25.77\% and PQ 24.61\%, respectively. Similar to the quantization distortion experiments, the gain of our method is much smaller on the GIST1M. This is probably because the feature dimensions of GIST are more independent (as verified by \cite{Jegou2010}). The true underlying reasons
are to be further investigated.
\begin{figure*}[h]
\begin{center}
\includegraphics[trim=2.1cm 16.4cm 2.2cm 6.9cm,clip=true, width=.95\textwidth]{ann.pdf}
\end{center}
\caption{ANN search evaluation on different datasets. The parameters used are exactly the same as in Fig. \ref{fig:MSE}, except that here $m=8$ is fixed for all.}
\label{fig:ann-small}
\end{figure*}
\subsection{Large-Scale Experiments with The Inverted Multi-Index}
The last experiment shown in this paper is to integrate our TRQ model with the inverted multi-index~\cite{BabenkoL2012} to improve its search accuracy on SIFT1B dataset. From Table \ref{table:sift1b-result}, we can see that the search accuracy was substantially improved by our TRQ , which is up to $8\%$ Recall@1 comparing to OPQ.
As the discussion in Section \ref{sectM-ANN}, the basic search steps are similar to the above IVF system~\cite{Jegou2010}, which include shortlist retrieval and candidates re-ranking by PQ-codes. We here refer interested readers to~\cite{BabenkoL2012} and~\cite{GeHKS2013} for more details about the inverted multi-index and its optimized version called OMulti~\cite{GeHKS2013}. Here we are going to discuss more details about the search procedure when our TRQ integrated with OMulti, and more comparative results with other state of the art methods.
\begin{table}[!ht]
\caption{ANN search comparisons between our model TRQ with OPQ \cite{GeHKS2014} on SIFT1B with 16-byte codes ($m$=16) per vector. This table corresponds to Table 5 in \cite{GeHKS2014}. $T$ is the length of shortlist retrieved by the optimized multi-indexer OMulti \cite{BabenkoL2012, GeHKS2014} for final re-ranking. The time is average search time per query that consists of shortlist retrieval and re-ranking.}
\label{table:sift1b-result}
\vskip 0.15in
\begin{center}
\begin{small}
\begin{sc}
\begin{tabular}{lccccr}
\hline
Method & $T$ & R@1 & R@10 & R@50 & $t$(ms) \\
\hline
OPQ & 10K & 0.359 & 0.734 & 0.791 & 4.2 \\
TRQ & 10K & 0.426 & 0.769 & 0.795 & 4.8 \\
OPQ & 30K & 0.379 & 0.818 & 0.907 & 7.9 \\
TRQ & 30K & 0.446 & 0.868 & 0.914 & 8.6 \\
OPQ & 100K & 0.385 & 0.851 & 0.961 & 18.2 \\
TRQ & 100K & 0.465 & 0.911 & 0.972 & 19.8 \\
\hline
\end{tabular}
\end{sc}
\end{small}
\end{center}
\vskip -0.1in
\end{table}
\textbf{Parameters} There are mainly four parameters involved, where $m_{1}$ and $m_{2}$ are used to represent the numbers of feature groups for the two different level PQ models, while $k_{1}$ and $k_{2}$ as the numbers of centers. We choose $m_{1}=2$ and $m_{2}=16$, with $k_{1}=16384$ and $k_{2}=256$, to be consistent with~\cite{BabenkoL2012} and~\cite{GeHKS2013}. Since the multi-index has split the features to two groups (see $m_1=2$), the system can simply be seen as a concatenation of two independent residual product quantization models, and each of them has $m_{1}=1$ and $m_{2}=8$ while $k_1$ and $k_2$ are retained. In our case, they are optimized as two TRQ models.
From now on, we only need to present how one of the TRQ models works during a search. Note that, we are integrating TRQ with OMulti, so the whole raw space has been transformed by, say $T^{1}$, the transformation learnt in OMulti. A query $\boldsymbol y$ becomes $\boldsymbol y'=T^{1} \boldsymbol y$ before it probes to the first-level clusters. We split $y'$ equally to two segments, $\boldsymbol y'= \boldsymbol y_{1}' | \boldsymbol y_{2}'$. Here we show only what happens to $\boldsymbol y_{1}'$; it then will be probed into the left subspace. If it is assigned to the sub-center $\boldsymbol c_{1i}^{2}$, in our setting, the residual for $\boldsymbol y_{1}'$ is $\boldsymbol r_{1}'' = T_{1i}^{2} \boldsymbol r_{1}' = T_{1i}^{2}(\boldsymbol y_{1}' - \boldsymbol c_{1i}^{2})$. Finally, the concatenation $\boldsymbol r_{1}'' | \boldsymbol r_{2}''$ are used for re-ranking PQ-codes on the shortlist that is provided by the indexer OMulti.
\textbf{Computation-Wise Discussion} A potential concern might be centered on the extra computational and storage costs required by the proposed TRQ model. TRQ applies transformations in the residual spaces and aims to improve the quantization quality and furthermore the search accuracy in the ANN problem. It slightly increases memory usage due to the local transformations. In the setting for Table \ref{table:sift1b-result}, for instance, it requires about 2.5\% extra memory space for all the transformation matrices relative to PQ or OPQ model. This is acceptable with the substantially increased search accuracy considered.
Even though our presented results have been restricted to comparisons with PQ and OPQ, we here give a short discussion about comparison between our method with LOPQ~\cite{KalantidisA2014} considering the common feature of the locally learned transformations. LOPQ learn different PQ codebooks for each cluster while our TRQ share just one PQ codebook among all clusters. This results in LOPQ use much more extra memory than TRQ dose. In the same setting as Table \ref{table:sift1b-result} LOPQ produce 16384 PQ codebooks that takes 2 GB (about 10\%) extra memory compared to ours and other methods. Taking advantage of the considerable memory usage, LOPQ have achieved about 2\% higher recall than our TRQ on this SIFT1B dataset.
Computationally, the number of transformations or matrix multiplications in both TRQ and LOPQ for each query is determined by the number of visited cells from the first level index; it is usually less than 100 out of 16384 (in Table 2). The results in Table \ref{table:sift1b-result} show that the extra computational costs can be well justified given the significant improvements on search accuracy. We also use only 10 millions of the training points to speed up the codebooks learning in both of OPQ and TRQ. All the results have been produced using a single thread with an Intel(R) Xeon(R) CPU @ 3.40GHz with 25.6M cache size, and 128 GB RAM. All methods have been implemented in MATLAB and C (for codebook learning and database encoding) and C++ (for searching).
\section{Conclusions and Future Directions}
Product quantization and residual quantization are the well-known quantization models that reduce both computation and storage complexities. We have seen that different ways to optimize these models are becoming active and fruitful in the computer vision area. In this paper, we have presented a novel approach to reducing quantization error of residual quantization for fast nearest neighbor search. We have also presented two hybrid searching architectures that are based on product quantization and the proposed transformed residual quantization. Our experiments show that the proposed TRQ has achieved significantly smaller quantization error than previous methods, which clearly demonstrates the benefits of the proposed model. Also, in large-scale ANN experiments on 1 billion vectors, our method has achieved significantly better accuracy than previous methods.
Despite that we have restricted our attention to the ANN search problem in this paper, the approach can be extensively used for many other problems that require efficient and effective very large-scale clustering. For examples, $k$NN graph construction, and feature matching for image retrieval, and for object recognition to name a few. In addition, how to integrate our transformation-based approach with the global codebook learning approaches arises to be a very interesting question for residual quantization optimization. These become our future research directions.
| {'timestamp': '2015-12-23T02:02:01', 'yymm': '1512', 'arxiv_id': '1512.06925', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06925'} | arxiv |
\section{Fluxionnal compiler} \label{section:compiler}
The source languages we focus on should offer higher-order functions and be implemented as an event-loop with a global memory.
Javascript is such a language and is often implemented on top of an event-loop, like in \textit{Node.js}.
We developed a compiler that transforms a \textit{Node.js} application into a fluxional application compliant with the execution model described in section \ref{section:model}.
Our compiler uses the \textit{estools}\ftnt{https://github.com/estools} suite to parse, manipulate and generate source code from Abstract Syntax Tree (AST).
And it is tailored for -- but not limited to -- web applications using \textit{Express}\ftnt{http://expressjs.com/}, the most used \textit{Node.js} web framework.
\begin{figure}
\includegraphics[width=\linewidth]{compiler-stream.ps}
\caption{Compilation chain}
\label{fig:compilation}
\end{figure}
The chain of compilation is described in figure \ref{fig:compilation}.
The compiler extracts an AST from the source with \texttt{esprima}.
From this AST, the \textit{Analyzer} step identifies the limits of the different application parts and how they relate to form a pipeline.
This first step outputs a pipeline representation of the application.
Section \ref{section:compiler:analyzer} explains this first compilation step.
In the pipeline representation, the stages are not yet independent and encapsulated into fluxions.
From the AST, \texttt{escope} produces a representation of the memory scopes.
The \textit{Pipeliner} step analyzes the pipeline representation and the scopes representation to distribute the shared memory into independent groups of fluxions.
Section \ref{section:compiler:pipeliner} explains this second compilation step.
\subsection{Analyzer step} \label{section:compiler:analyzer}
The limit between two application parts is defined by a rupture point.
The analyzer identifies these rupture points, and outputs a representation of the application in a pipeline form.
Application parts are the stages, and rupture points are the message streams of this pipeline.
\subsubsection{Rupture points} \label{section:compiler:analyzer:rupture}
A rupture point is a call of a loosely coupled function.
It is an asynchronous call without subsequent synchronization with the caller.
In \textit{Node.js}, I/O operations are asynchronous functions and indicate rupture points between two application parts.
Figure \ref{fig:basicrp} shows a code example of a rupture point with the illustration of the execution of the two application parts isolated into fluxions.
The two application parts are the caller of the asynchronous function call on one hand, and the callback provided to the asynchronous function call on the other hand.
\begin{figure}[h!]
\includegraphics[width=\linewidth]{basicrp.ps}
\begin{code}
asyncCall(arguments, function callback(result){ //@\circled{2}@ });
// Following statements //@\circled{1}@
\end{code}
\caption{Rupture point interface}
\label{fig:basicrp}
\end{figure}
A callback is a function passed as a parameter to a function call.
It is invoked by the callee to continue the execution with data not available in the caller context.
There are three kinds of callbacks, but only two are asynchronous: listeners and continuations.
The two corresponding types of rupture points are \textit{start} and \textit{post}.
\textbf{Start rupture points} (listeners) are on the border between the application and the outside, continuously receiving incoming user requests.
An example of a start rupture point is in listing \ref{lst:source}, between the call to \texttt{app.get()}, and its listener \texttt{handler}.
These rupture points indicate the input of a data stream in the program, and the beginning of a chain of fluxions to process this stream.
\textbf{Post rupture points} (continuations) represent a continuity in the execution flow after an asynchronous operation yielding a unique result, such as reading a file, or a database.
An example of a post rupture points is in listing \ref{lst:source}, between the call to \texttt{fs.readFile()}, and its continuation \texttt{reply}.
\subsubsection{Detection}
The compiler uses a list of common asynchronous callees, like the \texttt{express} and file system methods.
This list can be augmented to match asynchronous callees individually for any application.
To identify the callee, the analyzer walks the AST to find a call expression matching this list.
After the identification of the callee, the callback needs to be identified as well, to be encapsulated in the downstream fluxion.
For each asynchronous call detected, the compiler tests if one of the arguments is of type \texttt{function}.
Some callback functions are declared \textit{in situ}, and are trivially detected.
For variable identifiers, and other expressions, the analyzer tries to detect their type.
The analyzer walks back the AST to track their assignations and modifications, so as to determine their last value.
\subsection{Pipeliner step} \label{section:compiler:pipeliner}
A rupture point eventually breaks the chain of scopes between the upstream and downstream fluxion.
The closure in the downstream fluxion cannot access the scope in the upstream fluxion as expected.
The pipeliner step replaces the need for this closure, allowing application parts to rely only on independent memory stores and message passing.
It determines the distribution using the scope representation, which represents the variables' dependencies between application parts.
Depending on this representation, the compiler can replace the broken closures in three different ways.
We present these three alternatives in figure \ref{fig:states}.
\begin{figure}[h!]
\includegraphics[width=\linewidth]{states.ps}
\caption{Variable management from Javascript to the high-level fluxionnal language}
\label{fig:states}
\end{figure}
\paragraph{Scope}
If a variable is modified inside only one application part in the current \textit{post} chain, then the pipeliner adds it to the context of its fluxion.
In figure \ref{fig:states}, the variable \texttt{a} is updated in the function \texttt{add}.
The pipeliner step stores this variable in the context of the fluxion \texttt{add}.
\paragraph{Stream}
If a modified variable is read by downstream application parts, then the pipeliner makes the upstream fluxion add this variable to the message stream to be sent to the downstream fluxions.
It is impossible to send variables to upstream flux\-ions, without causing inconsistencies.
If the fluxion retro propagates the variable for an upstream fluxion to read, the upstream fluxion might use the old version while the new version is on its way.
In figure \ref{fig:states}, the variable \texttt{b} is set in the function \texttt{onReq}, and read in the function \texttt{add}.
The pipeliner step makes the fluxion \texttt{onReq} send the updated variable \texttt{b}, in addition to the variable \texttt{v}, in the message sent to the fluxion \texttt{add}.
Exceptionally, if a variable is defined inside a \textit{post} chain, like \texttt{b}, then this variable can be streamed inside this \textit{post} chain without restriction on the order of modification and read.
Indeed, the execution of the upstream fluxion for the current \textit{post} chain is assured to end before the execution of the downstream fluxion.
Therefore, no reading of the variable by the upstream fluxion happens after the modification by the downstream fluxion.
\paragraph{Share}
If a variable is needed for modification by several application parts, or is read by an upstream application part, then it needs to be synchronized between the fluxions.
To respect the semantics of the source application, we cannot tolerate inconsistencies.
Therefore, the pipeliner groups all the fluxions sharing this variable with the same tag.
And it adds this variable to the contexts of each fluxions.
In figure \ref{fig:states}, the variable \texttt{c} is set in the function \texttt{end}, and read in the function \texttt{add}.
As the fluxion \texttt{add} is upstream of \texttt{end}, the pipeliner step groups the fluxion \texttt{add} and \texttt{end} with the tag \texttt{grp\_c} to allow the two fluxions to share this variable.
\section{Conclusion} \label{section:conclusion}
In this paper, we presented our work on a high-level language allowing to represent a web application as a network of independent parts communicating by message streams.
We presented a compiler to transform a \textit{Node.js} web application into this high-level representation.
To identify two independent parts, the compiler spots rupture points in the application, possibly leading to memory isolation and thus, parallelism.
We presented an example of a compiled application to show the limits of this approach.
The parallelism of this approach allows code-mobility which may lead to a better scalability.
We believe it can enable the scalability required by highly concurrent web applications without discarding the familiar, feature-driven programming models.
\section{Real test case} \label{section:evaluation}
This section presents a test of the compiler on a real application, gifsockets-server\ftnt{https://github.com/twolfson/gifsockets-server}.
This test proves the possibility for an application to be compiled into a network of independent parts.
It shows the current limitations of this isolation and the modifications needed on the application to circumvent them.
This section then presents future works.
\begin{code}[js, caption={Simplified version of gifsockets-server},label={lst:gifsocket}]
var express = require('express'),
app = express(),
routes = require('gifsockets-middleware'), //@\label{lst:gifsocket:gif-mw}@
getRawBody = require('raw-body');
function bodyParser(limit) { //@\label{lst:gifsocket:bodyParser}@
return function saveBody(req, res, next) { //@\label{lst:gifsocket:saveBody}@
getRawBody(req, { //@\label{lst:gifsocket:getRawBody}@
expected: req.headers['content-length'],
limit: limit
}, function (err, buffer) { //@\label{lst:gifsocket:callback}@
req.body = buffer;
next(); //@\label{lst:gifsocket:next}@
});
};
}
app.post('/image/text', bodyParser(1 * 1024 * 1024), routes.writeTextToImages); //@\label{lst:gifsocket:app.post}@
app.listen(8000);
\end{code}
This application, simplified in listing \ref{lst:gifsocket}, is a real-time chat using gif-based communication channels.
It was selected in a previous work \cite{Brodu2015} from the \texttt{npm} registry because it depends on \texttt{express}, it is tested, working, and simple enough to illustrate this evaluation.
The server transforms the received text into a gif frame, and pushes it back to a never-ending gif to be displayed on the client.
On line \ref{lst:gifsocket:app.post}, the application registers two functions to process the requests received on the url \texttt{/image/text}.
The closure \texttt{saveBody}, line \ref{lst:gifsocket:saveBody}, returned by \texttt{bodyParser}, line \ref{lst:gifsocket:bodyParser}, and the method \texttt{routes.write\-Text\-To\-Images} from the external module \texttt{gifsockets-middleware}, line \ref{lst:gifsocket:gif-mw}.
The closure \texttt{saveBody} calls the asynchronous function \texttt{getRawBody} to get the request body.
Its callback handles the errors, and calls \texttt{next} to continue processing the request with the next function, \texttt{routes.write\-Text\-To\-Images}.
\subsection{Compilation}
We compile this application with the compiler detailed in section \ref{section:compiler}.
Listing \ref{lst:flx-gifsocket} presents the compilation result.
The function call \texttt{app.post}, line \ref{lst:gifsocket:app.post}, is a rupture point.
However, its callbacks, \texttt{bodyParser} and \texttt{routes.write\-Text\-To\-Images} are evaluated as functions only at runtime.
For this reason, the compiler ignores this rupture point, to avoid interfering with the evaluation.
\begin{code}[flx, caption={Compilation result of gifsockets-server},label={lst:flx-gifsocket}]
flx main & express {req}
>> anonymous_1000 [req, next]
var express = require('express'),
app = express(),
routes = require('gifsockets-middleware'), //@\label{lst:flx-gifsocket:gif-mw}@
getRawBody = require('raw-body');
function bodyParser(limit) { //@\label{lst:flx-gifsocket:bodyParser}@
return function saveBody(req, res, next) { //@\label{lst:flx-gifsocket:saveBody}@
getRawBody(req, { //@\label{lst:flx-gifsocket:getRawBody}@
expected: req.headers['content-length'], //@\label{lst:flx-gifsocket:req.headers}@
limit: limit
}, >> anonymous_1000);
};
}
app.post('/image/text', bodyParser(1 * 1024 * 1024), routes.writeTextToImages); //@\label{lst:flx-gifsocket:app.post}@
app.listen(8000);
flx anonymous_1000
-> null
function (err, buffer) { //@\label{lst:flx-gifsocket:callback}@
req.body = buffer; //@\label{lst:flx-gifsocket:buffer}@
next(); //@\label{lst:flx-gifsocket:next}@
}
\end{code}
The compiler detects a rupture point : the function \texttt{get\-Raw\-Body} and its anonymous callback, line \ref{lst:gifsocket:callback}.
It encapsulates this callback in a fluxion named \texttt{anonymous\_\-1000}.
The callback is replaced with a stream placeholder to send the message stream to this downstream fluxion.
The variables \texttt{req} and \texttt{next} are appended to this message stream, to propagate their value from the \texttt{main} fluxion to the \texttt{anonymous\_\-1000} fluxion.
When \texttt{anonymous\_\-1000} is not isolated from the \texttt{main} fluxion, as if they belong to the same group, the compilation result works as expected.
The variables used in the fluxion, \texttt{req} and \texttt{next}, are still shared between the two fluxions.
Our goal is to isolate the two fluxions, to be able to safely parallelize their executions.
\eject
\subsection{Isolation}
In listing \ref{lst:flx-gifsocket}, the fluxion \texttt{anonymous\_1000} modifies the object \texttt{req}, line \ref{lst:flx-gifsocket:buffer}, to store the text of the received request, and it calls \texttt{next} to continue the execution, line \ref{lst:flx-gifsocket:next}.
These operations produce side-effects that should propagate in the whole application, but the isolation prevents this propagation.
Isolating the fluxion \texttt{anonymous\_1000} produces runtime exceptions.
We detail in the next paragraph, how we handle this situation to allow the application to be parallelized.
\subsubsection{Variable \texttt{req}}
The variable \texttt{req} is read in fluxion \texttt{main}, lines \ref{lst:flx-gifsocket:getRawBody} and \ref{lst:flx-gifsocket:req.headers}.
Then its property \texttt{body} is associated to \texttt{buffer} in fluxion \texttt{anonymous\_1000}, line \ref{lst:flx-gifsocket:buffer}.
The compiler is unable to identify further usages of this variable.
However, the side effect resulting from this association impacts a variable in the scope of the next callback, \texttt{routes.writeTextToImages}.
We modified the application to explicitly propagate this side-effect to the next callback through the function \texttt{next}.
We explain further modification of this function in the next paragraph.
\subsubsection{Closure \texttt{next}}
The function \texttt{next} is a closure provided by the \texttt{express} \texttt{Router} to continue the execution with the next function to handle the client request.
Because it indirectly relies on the variable \texttt{req}, it is impossible to isolate its execution with the \texttt{anonymous\_\-1000} fluxion.
Instead, we modify \texttt{express}, so as to be compatible with the fluxionnal execution model.
We explain the modifications below.
\begin{code}[flx, caption={Simplified modification on the compiled result},label={lst:mflx-gifsocket}]
flx anonymous_1000
-> express_dispatcher
function (err, buffer) { //@\label{lst:mflx-gifsocket:callback}@
req.body = buffer; //@\label{lst:mflx-gifsocket:buffer}@
next_placeholder(req, -> express_dispatcher); //@\label{lst:mflx-gifsocket:next-placeholder}@
}
flx express_dispatcher & express {req} //@\label{lst:mflx-gifsocket:express-dispatcher}@
-> null
function (modified_req) {
merge(req, modified_req);
next(); //@\label{lst:mflx-gifsocket:next}@
}
\end{code}
In listing \ref{lst:gifsocket}, the function \texttt{next} is a continuation allowing the anonymous callback, line \ref{lst:gifsocket:callback}, to call the next function to handle the request.
To isolate the anonymous callback into \texttt{anonymous\_\-1000}, \texttt{next} is replaced by a rupture point.
This replacement is illustrated in listing \ref{lst:mflx-gifsocket}.
The \texttt{express} \texttt{Router} registers a fluxion named \texttt{express\_\-dispatcher}, line \ref{lst:mflx-gifsocket:express-dispatcher}, to continue the execution after the fluxion \texttt{anonymous\_\-1000}.
This fluxion is in the same group \texttt{express} as the \texttt{main} fluxion, hence it has access to the original variable \texttt{req}, and to the original function \texttt{next}.
The call to the original \texttt{next} function is replaced by a placeholder to push the stream to the fluxion \texttt{express\_\-dispatcher}, line \ref{lst:mflx-gifsocket:next-placeholder}.
The fluxion \texttt{express\_\-dispatcher} receives the stream from the upstream fluxion \texttt{anonymous\_\-1000}, merges back the modification in the variable \texttt{req} to propagate the side effects, and finally calls the original function \texttt{next} to continue the execution, line \ref{lst:mflx-gifsocket:next}.
After the modifications detailed above, the server works as expected.
The isolated fluxion correctly receives, and returns its serialized messages.
The client successfully receives a gif frame containing the text.
\subsection{Future works}
We intend to implement the compilation process presented into the runtime.
A just-in-time compiler would allow to identify callbacks dynamically evaluated, and to analyze the memory to identify side-effects propagations instead of relying only on the source code.
Moreover, this memory analysis would allow the closure serialization required to compile application using higher-order functions.
\section{Introduction}
\textit{``Release early, release often''}, \textit{``Fail fast''}.
The growth of a real-time web service is partially due to Internet's capacity to allow very quick releases of a minimal viable product (MVP).
It is crucial for the prosperity of such project to quickly validate that it meets the needs of its users.
Indeed, misidentifying the market needs is the first reason for startup failure\ftnt{https://www.cbinsights.com/blog/startup-failure-post-mortem/}.
Hence the development team quickly concretizes an MVP using a feature-driven approach and iterates on it.
The service needs to be scalable to be able to respond to the growth of its user-base.
However, feature-driven development best practices are hardly compatible with the required parallelism.
The features are organized in modules which disturb the organization of a parallel execution \cite{Clements2013a,Hughes1989,Parnas1972}.
Eventually the growth requires to discard the initial approach to adopt a more efficient processing model.
Many of the most efficient models decompose applications into execution units \cite{Fox1997, Welsh2000, Dean2008}.
However, these tools are in disruption from the initial approach.
This shift causes the development team to spend development resources in background to start over the initial code base, without adding visible value for the users.
It is a risk for the evolution of the project.
Running out of cash and missing the right competences are the second and third reasons for startup failures$^2$.
The risk described above comes from a disruption between the two levels of application expression, the feature level and the execution level.
To avoid this risk and allow a continuous development process, we propose a tool to automatically map one level onto the other, and make the transition.
We focus on web applications driven by users requests and developed in Javascript using the \textit{Node.js}\ftnt{https://nodejs.org/} execution environment.
Javascript is widely adopted\ftnt{http://githut.info/}\ftnt{http://stackoverflow.com/tags} to develop web applications, and its event-loop model is very similar to a pipeline architecture.
So we propose a compiler to transform an application into a pipeline of parallel stages communicating by message streams.
We named these stages \textit{fluxions}, by contraction between a flux and a function.
We present a proof of concept for this compilation approach.
Section \ref{section:model} describes the execution environment targeted by this compiler.
Then, section \ref{section:compiler} presents the compiler, and section \ref{section:evaluation} its evaluation.
Section \ref{section:related} compare our work with related works.
And finally, we conclude this paper.
\section{Fluxional execution model} \label{section:model}
This section presents an execution model to provide scalability to web applications with a granularity of parallelism at the function level.
Functions are encapsulated in autonomous execution containers with their state, so as to be mobile and parallel, similarly to the actors model.
The communications are similar to the dataflow programming model, which allows to reason on the throughput of these streams, and to react to load increases \cite{Bartenstein2014}.
The fluxional execution model executes programs written in our high-level fluxionnal language, whose grammar is presented in figure \ref{fig:flx-lang}.
An application $\bnfpn{program}$ is partitioned into parts encapsulated in autonomous execution containers named \textit{fluxions} $\bnfpn{flx}$.
The following paragraphs present the \textit{fluxions} and the messaging system to carry the communications between \textit{fluxions}, and then an example application using this execution model.
\subsection{Fluxions and Messaging System}
A \textit{fluxion} $\bnfpn{flx}$ is named by a unique identifier $\bnfpn{id}$ to receive messages, and might be part of one or more groups indicated by tags $\bnfpn{tags}$.
A \textit{fluxion} is composed of a processing function $\bnfpn{fn}$, and a local memory called a \textit{context} $\bnfpn{ctx}$.
At a message reception, the \textit{fluxion} modifies its \textit{context}, and sends messages to downstream \textit{fluxions} on its output streams $\bnfpn{streams}$.
The \textit{context} stores the state on which a \textit{fluxion} relies between two message receptions.
The messaging system queues the output messages for the event loop to process them later by calling the downstream \textit{fluxions}.
In addition to message passing, the execution model allows \textit{fluxions} to communicate by sharing state between their \textit{contexts}.
The fluxions that need this synchronization are grouped with the same tag, and loose their independence.
There are two types of streams, \textit{start} and \textit{post}, which correspond to the nature of the rupture point producing the stream.
A variable created within a chain of \textit{post} streams requires more synchronization than a variable created upstream a \textit{start} stream.
The two types and implications of rupture points are further detailed in section \ref{section:compiler}.
\textit{Start} rupture points are indicated with a double arrow ($\to$ \hspace{-1.4em} $\to$ or \texttt{>>}) and \textit{post} rupture points with a simple arrow ($\to$ or \texttt{->}).
\begin{figure}[h]
\vspace{-0.6\baselineskip}
\begin{bnf*}
\bnfprod{program} {\bnfpn{flx} \bnfor \bnfpn{flx} \bnfsp \bnftd{eol} \bnfsp \bnfpn{program}}\\
\bnfprod{flx} {\bnfts{\texttt{flx}} \bnfsp \bnfpn{id} \bnfsp \bnfpn{tags} \bnfsp \bnfpn{ctx} \bnfsp \bnftd{eol} \bnfsp \bnfpn{streams} \bnfsp \bnftd{eol} \bnfsp \bnfpn{fn}}\\
\bnfprod{tags} {\bnfts{\texttt{\&}} \bnfsp \bnfpn{list} \bnfor \bnftd{empty string}}\\
\bnfprod{streams} {\bnfts{\texttt{null}} \bnfor \bnfpn{stream} \bnfor \bnfpn{stream} \bnfsp \bnftd{eol} \bnfsp \bnfpn{streams}}\\
\bnfprod{stream} {\bnfpn{type} \bnfsp \bnfpn{dest} \bnfsp [\bnfpn{msg}]}\\
\bnfprod{dest} {\bnfpn{list}}\\
\bnfprod{ctx} {\bnfts{\texttt{\{}} \bnfpn{list} \bnfts{\texttt{\}}}}\\
\bnfprod{msg} {\bnfts{\texttt{[}} \bnfpn{list} \bnfts{\texttt{]}}}\\
\bnfprod{list} {\bnfpn{id} \bnfor \bnfpn{id} \bnfsp \bnfts{,} \bnfsp \bnfpn{list}}\\
\bnfprod{type} {\bnfts{\texttt{>}\texttt{>}} \bnfor \bnfts{\texttt{-}\texttt{>}}}\\
\bnfprod{id} {\bnftd{Identifier}}\\
\bnfprod{fn} {\bnftd{Source language with~} \bnfpn{stream} \bnftd{~placeholders}}\\
\end{bnf*}
\vspace{-2.5\baselineskip}
\caption{Syntax of a high-level language to represent a program in the fluxionnal form}
\label{fig:flx-lang}
\end{figure}
\subsection{Example}
\begin{code}[js,
caption={Example web application},
label={lst:source}]
var app = require('express')(),
fs = require('fs'),
count = 0; //@\label{lst:source-counter}@
app.get('/', function handler(req, res){ //@\label{lst:source-handler}@
fs.readFile(__filename, function reply(err, data) {
count += 1;
res.send(err || template(count, data)); //@\label{lst:source-send}@
});
}); //@\label{lst:source-handler-end}@
app.listen(8080);
\end{code}
The fluxional execution model is illustrated with an example application presented in listing \ref{lst:source}.
This application reads a file, and sends it back along with a request counter.
The \texttt{handler} function, line \ref{lst:source-handler} to \ref{lst:source-handler-end}, receives the input stream of requests.
The \texttt{count} variable at line \ref{lst:source-counter} counts the requests, and needs to be saved between two messages receptions.
The \texttt{template} function formats the output stream to be sent back to the client.
The \texttt{app.get} and \texttt{res.send} functions, lines \ref{lst:source-handler} and \ref{lst:source-send}, interface the application with the clients.
Between these two interface functions is a chain of three functions to process the client requests : \texttt{app.get} $\to$ \hspace{-1.4em} $\to$ \texttt{handler} $\to$ \texttt{reply}.
This chain of functions is transformed into a pipeline, expressed in the high-level fluxionnal language in listing \ref{lst:fluxional}.
The transformation process between the source and the fluxional code is explained in section \ref{section:compiler}.
\begin{figure}[h!]
\includegraphics[width=\linewidth]{schema-message.ps}
\caption{The fluxionnal execution model in details}
\label{fig:MesSys}
\end{figure}
The execution is illustrated in figure \ref{fig:MesSys}.
The dashed arrows between fluxions represent the message streams as seen in the fluxionnal application.
The plain arrows represent the operations of the messaging system during the execution.
These steps are indicated by numeroted circles.
The \textit{program} registers its fluxions in the messageing system, \circled{1}.
The fluxion \textit{reply} has a context containing the variable \texttt{count} and \texttt{tem\-plate}.
When the application receives a request, the first fluxion in the stream, \textit{main}, queues a \texttt{start} message containing the request, \circled{2}.
This first message is to be received by the next fluxion \textit{handler}, \circled{3}, and triggers its execution, \circled{4}.
The fluxion \textit{handler} sends back a message, \circled{5}, to be enqueued, \circled{6}.
The system loops through steps \circled{3} through \circled{6} until the queue is empty.
This cycle starts again for each new incoming request causing another \texttt{start} message.
\begin{code}[flx, caption={Example application expressed in the high-level fluxional language}, label={lst:fluxional}]
flx main & grp_res
>> handler [res]
var app = require('express')(),
fs = require('fs'),
count = 0;
app.get('/', >> handler); //@\label{lst:fluxional-streamtohandler}@
app.listen(8080);
flx handler
-> reply [res]
function handler(req, res) {
fs.readFile(__filename, -> reply); //@\label{lst:fluxional-readfile}@
}
flx reply & grp_res {count, template}
-> null
function reply(error, data) {
count += 1; //@\label{lst:fluxional-counter}@
res.send(err || template(count, data)); //@\label{lst:fluxional-ressend}@
}
\end{code}
The chain of functions from listing \ref{lst:source} is expressed in the fluxional language in listing \ref{lst:fluxional}.
The fluxion \texttt{handler} doesn't have any dependencies, so it can be executed in a parallel event-loop.
The fluxions \texttt{main} and \texttt{reply} belong to the group \texttt{grp\_res}, indicating their dependency over the variable \texttt{res}.
The group name is arbitrarily chosen by the compiler.
All the fluxions inside a group are executed sequentially on the same event-loop, to protect against concurrent accesses.
The variable \texttt{res} is created and consumed within a chain of \textit{post} stream.
Therefore, it is exclusive to one request and cannot be propagated to another request.
It doesn't prevent the whole group from being replicated.
However, the fluxion \texttt{reply} depends on the variable \texttt{count} created upstream the \textit{start} stream, which prevents this replication.
If it did not rely on this state, the group \texttt{grp\_res} would be stateless, and could be replicated to cope with the incoming traffic.
This execution model allows to parallelize the execution of an application as a pipeline, as with the fluxion \texttt{handler}.
And some parts are replicated, as could be the group \texttt{grp\_res}.
This parallelization improves the scalability of the application.
Indeed, as a fluxion contains its state and expresses its dependencies, it can be migrated.
It allows to adapt the number of fluxions per core to adjust the resource usage in function of the desired throughput.
Our goal, as described in the introduction, is not to propose a new high-level language but to automate the architectural shift.
We present the compiler to automate this architectural shift in the next section.
\section{Related Works} \label{section:related}
Splitting a task into independent parts goes back to the Actor's model, functional programming \cite{Hughes1989} and the following works on Data\-Flow leading to Flow-based Programming (FBP) and Functional Reactive program\-ming (FRP) \cite{Elliott1997}.
Both FBP and FRP, recently got some attention in the Javascript community with \textit{NoFlo}\ftnt{http://noflojs.org/}, \textit{Bacon.js}\ftnt{https://baconjs.github.io/} and \textit{react}\ftnt{https://facebook.github.io/react/}.
The execution model we presented in section \ref{section:model}, is inspired by works on scalability for very large systems, like the Staged Event-Driven Architecture (SEDA) by Matt Welsh \cite{Welsh2000} and by the MapReduce architecture \cite{Dean2008}.
It also drew its inspiration from more recent work following SEDA like Spark \cite{Zaharia2012}, MillWheel \cite{Akidau2013}, Naiad \cite{McSherry} and Storm \cite{Toshniwal2014}.
The first part of our work stands upon these thorough studies.
However, we believe that it is difficult for most developers to distribute the state of an application.
This belief motivated us to propose a compiler from an imperative programming model to these more scalable, distributed execution engines.
The transformation of an imperative programming model to be executed onto a parallel execution engine was recently addressed by Fernandez \textit{et. al.} \cite{Fernandez2014a}.
However, as in similar works \cite{Power2010}, it requires annotations from developers, therefore partially conserves the disruption with the feature-based development.
Our approach discards the need for annotations, thus targets a broader range of developers than only ones experienced with parallel development.
A great body of work focuses on parallelizing sequential programs \cite{Banerjee2013,Li2012,Matsakis2012a,Radoi2014}.
Because of the synchronous execution of a sequential program, the speedup of parallelization is inherently limited \cite{Amdahl1967,Gunther2008}.
On the other hand, our approach is based on an asynchronous programming model.
Hence the attainable speedup is not limited by the main synchronous thread of execution. | {'timestamp': '2015-12-23T02:07:03', 'yymm': '1512', 'arxiv_id': '1512.07067', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.07067'} | arxiv |
\section{Introduction}
Random numbers are widely used in cryptographic, simulation (e.g., in Monte Carlo methods)
and modeling (e.g., computer games) applications.
A generator of truly random binary digits generates such sequences
$x_1 x_2 ... $ that, with probability one, for any binary word $u$ the following property is valid:
\begin{equation}\label{fr}
\lim_{t \rightarrow\infty } \nu_t(u) / (t - |u| ) = 2^{-|u|} \,
\end{equation}
where $\nu_t(u) $ is a number of occurrences of the word $u$ in the sequence $x_1 ... x_{|u|}$,
$x_{2 } ... x_{ |u|+1 }, ...$, $x_{t-|u|+1} ... x_{t }$.
(As in most studies in this field, for brevity, we will consider the case
when processes generate letters fro the binary alphabet $\{0,1\}$,
but the results can be extended to the case of any finite alphabet.)
The RNG and PRNG attract attention of many researchers
due to its importance to practice
and interest of theory, because, in a certain sense,
this problem is close to foundations of probability theory, see, for example,
\cite{Calude:02,Vitanyi:08}.
There are two types of methods for generating sequences of random digits: so called RNG and PRNG.
The RNGs are based on digitizing of physical processes (like noises in electrical circuits), whereas PRNGs
can be considered as computer programs
whose input is a (short) word (called a seed) and the output is
a long sequence (compared to the input). As a rule, the seed is a truly random sequence and the PRNG
can be viewed as an expander of randomness which stretches a short truly random seed into a long sequence that is supposed
to appear and behave as a true random sequence \cite{L'Ecuyer:15}.
So, the purpose of RNG and PRNG is to use low-entropy sources for generating sequences which look truly random.
Note that the Shannon entropy of the truly random process (i.e., the Bernoulli with $p(0) = p(1) = 1/2$)
is 1 per letter, whereas
for any other stationary process the entropy is strictly less then 1; see \cite{Cover:06}. That is why, the properties
of truly randomness
and low entropy are, in a certain sense, contradictory.
There are a lot of papers devoted to RNG and PRNG, because they are widely used in
cryptography and other fields. For example, the National Institute of Standards and Technology (NIST, USA)
published a recommendation specifying mechanisms for the generation of random bits using
deterministic methods \cite{NIST-prng}. Nowadays, quality of almost all practically used RNG and PRNG is estimated by statistical tests
intended to find deviations from true
randomness (see, for ex., NIST Statistical Test Suite \cite{NIST-test}).
Nevertheless, researchers look for RNG and PRNG with provable guarantees on their randomness
because methods with proven
properties are of great interest in cryptography.
In this paper we describe several kinds of random processes whose entropy can be much less than one, but, in a certain sense,
they generate sequences for which the property of true randomness (\ref{fr})
is valid either for any integer $k$ or
for $k$s from a certain interval (i.e. $1 < k < K$, where $K$ is an integer).
It shows the existence of low-entropy RNGs and PRNGs which generate sequences satisfying the property (\ref{fr}).
Besides, the description of the suggested processes show how they can be used to construct
RNGs and PRNGs for which the property (\ref{fr}) is valid.
Note that so-called
two-faced processes, for which the property (\ref{fr}) is valid for a given $k$ were described in \cite{BRyabko:05a,BRyabko:05}.
Here those processes are generalized and some new results concerning their properties are established.
More precisely, in this paper we describe the following two processes.
First, we describe so-called two-faced process of order $k$, $k \ge 1$, which is the $k$-order Markov chain
and, with probability 1, for any sequence $x_1 ... x_t$
and any binary word $u \in \{0,1\}^k $ the frequency of occurrence
of the word $u$ in the sequence $x_1 ... x_{|u|}$,
$x_{2} ... x_{|u|+1 }, ...$, $x_{t-|u|+1} ... x_{t}$ goes to $2^{-|u|}$, where $t$ grows.
Second, we describe so-called twice two-faced processes for which this property is valid for any integer $k$.
Besides, we show how such processes can be used to construct RNG and PRNG for which the property (\ref{fr}) is valid.
The paper is organized as follows: the next part contains descriptions of two-faced processes and transformations. The third part gives definitions of the
so-called twice two-faced processes for which the property (\ref{fr}) valid for every
integer $k$.
In the conclusion we briefly discuss possible application of two-faced processes to RNG and PRNG.
\section{Two-faced processes}
First, we describe two families of random processes $T_{k, \pi}$ and
$\bar{T}_{k, \pi}$, where $k=1,2, \ldots,\,$ and $ \pi \in (0,1)$
are parameters. The processes $T_{k, \pi}$ and $\bar{T}_{k, \pi}$ are
Markov chains of the connectivity (memory) $k$, which generate
letters from $\{0,1\}$. It is convenient to define their transitional matrices
inductively. The process matrix of $T_{k, \pi}$ is defined by conditional
probabilities $P_{T_{1, \pi}}(0/0) = \pi, P_{T_{1, \pi}}(0/1) =
1-\pi $ (obviously, $P_{T_{1, \pi}}(1/0) =1- \pi, P_{T_{1, \pi}}(1/1) = \pi $).
The process $\bar{T}_{1,\pi}$ is defined by
$P_{\bar{T}_{1, \pi}}(0/0) =1- \pi, P_{\bar{T}_{1, \pi}}(0/1) = \pi$. Assume that transitional matrices $T_{k, \pi}$ and $\bar{T}_{k, \pi}$ are defined and
describe $T_{k+1, \pi}$ and $\bar{T}_{k+1, \pi}$ as follows
\begin{equation}\label{1}
P_{T_{k+1, \pi}}(0/0u) = P_{T_{k, \pi}}(0/u), $$ $$ P_{T_{k+1, \pi}}(1/0u)
= P_{T(k, \pi)}(1/u), $$ $$ P_{T(k+1, \pi)}(0/1u) = P_{\bar{T}(k,
\pi)}(0/u), $$ $$ P_{T(k+1, \pi)}(1/1u) = P_{\bar{T}(k, \pi)}(1/u) ,
\end{equation}
and, vice versa,
\begin{equation}\label{2}
P_{\bar{T}(k+1, \pi)}(0/0u) = P_{\bar{T}(k,
\pi)}(0/u), $$ $$ P_{\bar{T}(k+1, \pi)}(1/0u) = P_{\bar{T}(k,
\pi)}(1/u), $$ $$ P_{\bar{T}(k+1, \pi)}(0/1u) = P_{T(k,
\pi)}(0/u), $$ $$ P_{\bar{T}(k+1, \pi)}(1/1u) = P_{T(k, \pi)}(1/u)
\end{equation}
for each $u \in \{0,1\}^k$ (here $vu$ is a concatenation of the words
$v$ and $u$). For example,
\begin{equation}\label{ex}
P_{T(2,\pi)}(0/00) = \pi,
P_{T(2,\pi)}(0/01) = 1-\pi, \end{equation}$$ P_{T(2,\pi)}(0/10) = 1-\pi,
P_{T(2,\pi)}(0/11) = \pi. $$
To define a process $x_1 x_2 ...$ the initial probability distribution needs to be specified.
We define
the initial distribution of the processes $T(k, \pi)$ and $\bar{T}(k, \pi)$, $k=1,2, \ldots,\,$,
to be uniform on $\{0,1\}^k$, i.e. $P\{ x_1 ... x_k = u \} = 2^{-k}$ for any $u \in \{0,1\}^k$.
On the other hand, sometimes processes with a
different (or unknown) initial distribution will be considered; that is why,
in both cases the initial state will be mentioned in order to avoid
misunderstanding.
Let us define the Shannon entropy of a stationary process $\mu$. The conditional entropy
of order $m$, $m=1,2, ...$, is defined by
\begin{equation}\label{en}
h_m = - \sum_{u \in \{0,1\}^{m-1} } \mu(u) \sum_{v \in \{0,1\} } \mu(v/u) \log \mu(v/u)
\end{equation}
and the limit Shannon entropy is defined by
\begin{equation}\label{enl}
h_\infty = \lim_{m \rightarrow \infty }h_m \, \, ,
\end{equation}
see \cite{Cover:06}.
The following theorem describes the main properties of
the processes defined above.
\begin{theorem}\label{T1}
Let a sequence $x_1 x_2 ... $ be
generated by the process $T(k, \pi)$ (or $\bar{T}(k, \pi)$), $k \ge 1$
and $u$ be a binary word of length $k$.
Then,
i) If the initial state obeys the uniform distribution over $\{0,1\}^k$, then for any $j \ge 0$
\begin{equation}\label{u2}
P(x_{j+1} ... x_{j+k} = u) = 2^{-|u|} .
\end{equation}
ii)
for any initial state of the Markov chain $T(k, \pi)$ (or $\bar{T}(k, \pi)$)
\begin{equation}\label{u1}
\lim_{j \rightarrow\infty } P(x_{j+1} ... x_{j+k} = u) = 2^{-|u|} .
\end{equation}
iii) For each $\pi \in (0,1) $ the $k$-order
Shannon entropy ($h_k$) of the processes $T(k, \pi)$ and
$\bar{T}(k, \pi)$ equals 1 bit per letter
whereas the limit Shannon entropy ($h_\infty $) equals $ - (\pi
\log_2 \pi + (1- \pi) \log_2 (1-\pi) ).$
\end{theorem}
The proof of the theorem is given in the Appendix, but here we
consider examples of ``typical'' sequences of the processes
$T(1,\pi)$ and $\bar{T}(1,\pi)$ for $\pi$, say, 1/5. Such
sequences could be as follows: $ 010101101010100101...$ and $
000011111000111111000.... .$ We can see that each sequence
contains approximately one half of 1's and one half of 0's. (That
is why the first order Shannon entropy is 1 per a letter.) On the
other hand, both sequences do not look like truly random, because
they, obviously, have too long subwords like either $101010 ..$
or $000.. 11111.. .$ (In other words, the second order Shannon
entropy is much less than 1 per letter.) So,
informally, we can say that those sequences mimic truly random, if one takes into account only frequencies of words of the
length one.
Due to Theorem 1, we give the following
\begin{definition}
A random process is called asymptotically two-faced of order $k$, if the equation (\ref{u1}) is valid for all
$u \in \{0,1\}^k$.
If the equation (\ref{u2}) is valid, the process is called
two-faced of order $k$.
\end{definition}
Theorem 1 shows that the processes $T(k, \pi)$ and $\bar{T}(k, \pi)$ are two-faced.
The statements i) and ii) show that the processes look like truly random
if we consider blocks whose length is less than the process order $k$. On the other hand, if we take
into consideration blocks whose length is grater, the statement iii) shows that their distribution is far form uniform
(if $\pi$ is either small or large). Those properties explain the name ``two-faced''.
The following theorem shows that, in a certain sense, there exist quite many two-faced processes.
\begin{theorem}\label{T2}
Let $X = x_1 x_2 ... $ and $Y = y_1 y_2 ...$ be random processes.
We define the process $Z = z_1z_2 ...$ by equations $z_1 = x_1 \oplus y_1$, $z_2 = x_2 \oplus y_2, ...$ where $ x_1 x_2 ... $ and
$y_1 y_2 ...$ are
distributed according to $X$ and $Y$ and $ a \oplus b = ( a+b) \, mod \, \, 2 $.
Then, if $X$ is a $k$-order two-faced process ($k \ge 1$), then $Z$ is a $k$-order two-faced process.
If $X $ is an asymptotically $k$-order two-faced process then $Z$ is asymptotically $k$-order two-faced, too.
\end{theorem}
\section{Two-faced transformation}
Earlier we described two-faced processes which, in a certain sense, mimic truly random.
In this section we show how
any Bernoulli process can be converted to a two-faced process.
Informally, any sequence $X = x_1 x_2 ... $ created by Bernoulli process with $P(x_i = 0) = \pi $, $P(x_i = 1) = 1 - \pi $,
will be transformed into a sequence $y_1 y_2 ... $ of ``letters'' $\pi$ and $(1-\pi)$ by a map $0 \rightarrow \pi$,
$1 \rightarrow (1-\pi)$. Then this sequence can be considered as an input of the transition matrix $T_{k,\pi} $ and a new
sequence $Y= y_1 y_2 ... $ can be generated according to $k$-order two-faced process, if we have an initial state, i.e. a binary word of
length $k$.
For example, let $k = 2$, the initial state be $01$ and $x_1 x_2 ... x_5$ $= 10010$. Then, $y_1 ... y_5$ $= (1-\pi) \pi \pi (1-\pi) \pi$
and, according to (\ref{ex}), we obtain a new sequence $01110$.
In fact, the output sequence is generated by the transition matrix $T_{k,\pi} $; that is why the output process
is $2$-order two-faced.
Now we formally describe a family of transformations which, in a certain sense, convert random processes into two-faced ones.
For this purpose we first define two families of matrices $M_k$ and $\bar{M}_k$, $k \ge 1$, which are
connected
with transition matrices $T_{k,\pi} $ and $\bar{T}_{k, \pi}$.
\begin{definition} For any $k \ge 1$, $v \in \{0,1\}^k$,
$w \in \{0,1\}$, the matrix $M_k$ is defined as follows:
\begin{equation}\label{tau}
M_k(w,v) = \left\{ \begin{array}{c} \,
0,\, \, \, if \, \, \, T_{k,\pi}(w,v) = \pi \\
\, \, \, \, \, \, 1, \, \, \, if \, \, \, T_{k,\pi}(w,v) = 1 - \pi \\
\end{array} \right.
\end{equation}
$\bar{M}_k$ is obtained from $\bar{T}_{k,\pi}$ analogously.
\end{definition}
Informally, these matrices combine the two steps from the previous example.
Namely,
a transition from $x_1 x_2 ... $ to a sequence of symbols $\pi$, $1-\pi$ and,
second, transition from it to the new sequence of zeros and ones.
\begin{definition}
Let $X= x_1 x_2 ... $ be an infinite binary word, $k > 0$ be an integer and $v \in \{0,1\}^k$.
The two-faced conversion $\tau^k$ maps a pair $(X,v)$ into an infinite binary sequence $Y$ as follows:
$$ y_{-k+1} y_{-k+2} ... y_0 = v \, \, ,$$
\begin{equation}\label{tau}
y_i = M_{k} ( x_i, \, \, \, y_{i-k} y_{i-k+1} \, ... \, y_{i-1} )\, \, \, \, \, if \, \, 1 \le i
\end{equation}
where $i = 1, 2, ... $.
\end{definition}
It can be seen from definitions that the $y_1 y_2 ... $ is generated according to the transition matrix $T_{k,\pi}$ if
$x_1 x_2 .. $ generated by Bernoulli process with $P(0) = \pi$, $P(1) = (1-\pi)$.
From this and Theorem 1 we obtain the following statement:
\begin{claim}
Let $X = x_1 x_2 ... $ be any Bernoulli process, $k \ge 1$ be an integer
and $\tau_k $ be a two-faced transformation. If $v$ is a word from $ \{0,1\}^k$,
then $ \tau^k(X,v )$ is asymptotically two-faced of order $k$. If, additionally, $v$
obeys the uniform distribution on $\{0,1\}^k$, then $ \tau^k(X,v)$ is two-faced of order $k$.
\end{claim}
\section{Generalization}
The $k$-order two-faced processes mimic true random ones for block lengths $1, 2, ..., k$. Here we describe
such processes that mimic true randomness for blocks of every
length.
By analogy with so-called twice universal codes known in information theory, we call such processes twice two-faced.
\begin{definition}
A random process is called (asymptotically) twice two-faced, if the equation (\ref{u2}) ( (\ref{u1}) )
is valid for every integer $k$ and $u \in \{0,1\}^k$.
\end{definition}
Now we describe a family of such processes.
Let $n^* = n_1, n_2, .... $ be an infinite sequence of integers such that $n_1 < n_2 < n_3 ....$ and
$X^1 = x^1_1 x^1_2 ...$, $X^2 = x^2_1 x^2_2 ...$, $X^3 = x^3_1 x^3_2 ...$, $...$
be (asymptotically) two-faced
processes of order $n_1, n_2, ...$, correspondingly. Define a process $W$ $= w_1 w_2 $ $ ...$ by
\begin{equation}\label{3}
w_i =
\left\{ \begin{array}{c}
x^1_i\ \ \,\, \, \,\, \, \,\, \, \,\, \,\, i\le n_1, \\
x^1_i \oplus x^ 2_i \, \, \, \,\, \, \,\, \, \,\, \,\,\, \, n_1 < i \le n_2 , \\
x^1_i \oplus x^ 2_i \oplus x^3_i \, \, \, \, n_2 < i \le n_3 , \\
............................. \\
\end{array} \right.
\end{equation}
and denote this process as $\bigoplus_{i=1}^\infty X^i$.
\begin{theorem}\label{T3}
If all $ X^i$ $i=1,2, ... $ are two-faced then the process $\bigoplus_{i=1}^\infty X^i$ is
twice two-faced, i.e. for any binary word $u$ the equation (\ref{u2}) is valid. If all
$X^i$ are asymptotically two faced,
then the process $\bigoplus_{i=1}^\infty X^i$ is asymptotically
twice two-faced, i.e.
equation (\ref{u1}) is valid for any word $u$.
\end{theorem}
\begin{corollary}
Let $X = x_1 x_2 ... $ and $Y = y_1 y_2 ...$ be random processes and $X$ be twice two-faced.
Then the process $Z$ defined
by equations $z_1 = x_1 \oplus y_1$, $z_2 = x_2 \oplus y_2, ...$ is twice two-faced, too.
\end{corollary}
It is worth noting that the total entropy of the processes $X^1, X^2, ... $ can be arbitrarily small, hence,
the ``input randomness'' of the process $\bigoplus_{i=1}^\infty X^i$ can be very small, whereas, in a certain sense,
the process looks like a true random one.
\section{Conclusion}
In this paper we focus on the existence of processes whose entropy can be arbitrary small, but they
mimic truly randomness in the sense that the frequency of occurrences of any
word $u$ asymptotically equals $2^{-|u|}$. In Conclusion we note how such processes can be directly used in order to
construct (or ``improve '' ) RNGs and PRNGs. For example, Theorems 2 and 3 shows that output sequence of any RNG
and PRNG will, in a certain sense, looks like truly random, if it is summed
with a (low-entropy) two-faced (or twice two-faced) process.
The possibility to transform Bernoulli processes into two-faced ones gives a possibility to create low-entropy
two-faced processes. Indeed, schematically, it can be done as follows:
Imagine, that one has a short word $v$ (it corresponds to the seed of a PRNG) and wants to create a
sequence $V$, $|V| > |v|$, which could be considered
as generated by a $k$-order two-faced process. Now denote $h= |v|/|V|$ and let $\pi$ be a solution of the equation
$- (\pi \log \pi + (1- \pi) \log (1-\pi) = h$. It is well-known in information theory that
there exists a lossless
code $\phi$ which compresses sequences generated by a Bernoulli process with probability $(\pi, 1 - \pi)$ in such a way that
the (average) length of output words is close to the Shannon entropy $h$, see \cite{Cover:06}.
Denote the decoder by $\phi^{-1}$ and let the sequence $U $ be $ \phi^{-1}(v)$. Informally, this sequence will look like
generated by a Bernoulli source with probabilities $(\pi, 1 - \pi)$ and the final sequence $V$ can be obtained from $U$ by the transformation as described
in the Definition 3.
(We did not consider the initial $k$-bit words, which can be obtained, for example, as a part of the seed $v$.
In such a case $h$ can be defined as $(|v|-k)/|V|$.
\section{Appendix}
\emph{Proof} of Theorem 1. We prove the theorem for the process
$T_{k, \pi},$ but this proof is valid for $\bar{T}_{k, \pi},$ too.
First we show that
\begin{equation}\label{a} p^*(x_1...x_k)=2^{-k}, \end{equation}
$ (x_1...x_{k}) \in \{ 0,1 \}^{k}, $ is a
stationary (or limit) distribution for the processes $T_{k, \pi}$.
For any values of $k, k \geq 1,$ (\ref{a}) will be proved if we
show that the system of equations
$$ P_{T(k, \pi)}(x_1...x_k)=
P_{T(k, \pi)}(0x_1...x_{k-1})\,P_{T(k,\pi)}(x_k/0x_1...x_{k-1})\:
$$ $$+\,P_{T(k, \pi)}(1x_1...x_{k-1})\,
P_{T(k, \pi)}(x_k/1x_1...x_{k-1}) \, ;
$$
$$ \sum_{v \in \{0,1\}^k} p(v) = 1 $$
has the solution
$p(x_1...x_k)=2^{-k}$, $ (x_1...x_{k}) \in \{ 0,1 \}^{k}.$ It can be easily seen, if we take
into account that, by definitions (\ref{1}) and (\ref{2}), the equality $P_{T(k, \pi)}(x_k/0x_1...x_{k-1})\: +\,
P_{T(k, \pi)}(x_k/1x_1...x_{k-1})=1 $ is valid for all $
(x_1...x_{k}) \in \{ 0,1 \}^{k} $. From this equality and the low
of total probability we immediately obtain (\ref{a}).
Having taken into account that the initial distribution matches the stationary (limit) one,
we obtain the the first claim of the theorem (\ref{u2}).
From definitions (\ref{1}), (\ref{2}), we can see that all transition probabilities are nonzero
(they are either $\pi$ or $1 - \pi$). Hence, the Markov chain $T(k, \pi)$ is ergodic and
the equations (\ref{u2}) are valid due to ergodicity.
Let us prove the third claim of the theorem. From the definitions (\ref{1}), (\ref{2})
we can see that either $P_{T(k,
\pi)}(0/x_1...x_{k})= \pi,\, P_{T(k, \pi)}(1/x_1...x_{k})=1-\pi$
or $P_{T(k, \pi)}(0/x_1...x_{k})=1- \pi,\, P_{T(k,
\pi)}(1/x_1...x_{k})=\,\pi$. From this and (\ref{en}) we can see that $h_{k+1} =
- (\pi \log_2 \pi + (1- \pi) \log_2 (1-\pi) )$ and, taking into account (\ref{enl}), we obtain
$h_\infty = - (\pi \log_2 \pi + (1- \pi) \log_2 (1-\pi) )$. The
theorem is proved.
\emph{Proof} of Theorem 2. The following chain of equations proves the first claim of the theorem:
\begin{equation}\label{f}
P\{z_{j+1} ... z_{j+k} = u\} = $$ $$\sum_{v \in \{0,1\}^k} P\{x_{j+1} ... x_{j+k} = v \} P\{y_{j+1} ... y_{j+k} = v\oplus u \}
\end{equation}
$$ = 2^{-k} \sum_{v \in \{0,1\}^k} P\{y_{j+1} ... y_{j+k} = u\oplus v \} =
2^{-k} \times 1 = 2^{-k} \, . $$
(Here we took into account (\ref{u2}) and the obvious equation $v\oplus u \oplus v = u$.)
In order to prove the second statement, we note that by definitions,
$$
\lim_{j \rightarrow\infty } P(x_{j+1} ... x_{j+k} = u) = 2^{-|u|} $$
for any $u \in \{0,1\}^k$, see (\ref{u1}). Hence, for any $\delta$, $\delta > 0$,
there exists $J$ such that
$$ |P(x_{j+1} ... x_{j+k} = u) - 2^{-|u|} | < \delta \, \, u \in \{0,1\}^k \,
$$ if $j > J$.
From this inequality and the equation (\ref{f}) we obtain
$$ (2^{-k}- \delta) \sum_{v \in \{0,1\}^k} P\{y_{j+1} ... y_{j+k} = u\oplus v \} $$ $$
\le P\{z_{j+1} ... z_{j+k} = u\} \le $$ $$
(2^{-k} + \delta) \sum_{v \in \{0,1\}^k} P\{y_{j+1} ... y_{j+k} = u\oplus v \} \, . $$
Taking into account that this sum equals 1, we obtain the following inequalities:
$$ (2^{-k}- \delta)
\le P\{z_{j+1} ... z_{j+k} = u\} \le
(2^{-k} + \delta) \, . $$
It is true for any $\delta > 0$, hence (\ref{u2})
is valid and the process $Z$ is asymptotically $k$-order two-faced.
Theorem is proven.
\emph{Proof} of Theorem 3. Let $ u$ be any binary word and $|u| = k $.
Take such an integer $n_i$ that $ k \le n_i$ and consider
the process $S = \bigoplus_{j=1}^{i-1} X^j \, \oplus \, \bigoplus_{j= i+1}^{\infty} X^j $.
(Here $U \oplus V = \{ u_1 \oplus v_1 \, \, u_2 \oplus v_2 \, \, u_3 \oplus v_3 \, \,... \, \}$ .
Obviously, $ \bigoplus_{j = 1}^{\infty} X^j = X^i \oplus S$. The process $X^i$ is (asymptotically) $n_i$-order
two faced. Having taken into account Theorem 2 we can see that $ \bigoplus_{j = 1}^{\infty} X^j $ is
$n_i$-order two faced and, hence, $k$-order (asymptotically) two-faced (because $k \le n_i$,
hence (\ref{u2}) ( (\ref{u1}) ) is valid.
Theorem is proven.
\section*{Acknowledgment}
Research was supported by Russian Foundation for Basic Research
(grant no. 15-29-07932).
| {'timestamp': '2015-12-23T02:03:24', 'yymm': '1512', 'arxiv_id': '1512.06961', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06961'} | arxiv |
\section{Introduction}
The \emph{power-flow} problem is fundamental to all aspects of modelling, analysis, operation, and control of transmission and distribution systems. In a nutshell, it amounts to solving for the nodal voltages in the nonlinear active- and reactive-power balance equations that characterize the sinusoidal steady-state behaviour of AC electrical networks. Iterative numerical methods are ubiquitous in this regard, since multiplicative and trigonometric nonlinearties quash any fledgling hopes of obtaining analytical closed-form solutions. Having said that, linear approximations that yield accurate estimates of nodal voltages have long been recognized to be useful from computational and analysis perspectives~\cite{Stott-2009,Saverio-2015}.
In this paper, we investigate linearizations of the nonlinear power-flow equations with voltages expressed in rectangular coordinates. The main premise is to solve for a (complex-valued) perturbation vector in rectangular form around an appropriately formulated nominal voltage profile. We provide solutions tailored to the constitutional properties of transmission systems (where generators are modelled as $\mathrm{PV}$ buses and loads are modelled as $\mathrm{ZIP}$ buses) and distribution systems (where, in addition to a slack bus, nodes in the network are modelled as $\mathrm{ZIP}$ buses). Indeed, a key assumption that is made from the outset to obtain the linearized model is that the second-order terms in the power-balance expressions are negligible. To investigate the validity of this assumption, we provide a priori computable bounds on the active- and reactive-power balance errors as appropriate.
Voltage phasors are typically expressed in polar coordinates in most renditions of the power-flow equations. Noteworthy exceptions where rectangular-coordinate representations are leveraged for analytical and computational benefits include: algorithms for optimal power flow~\cite{Torres96optimalpower,Costa-1999,Zhang-2005}, techniques to identify low-voltage solutions~\cite{Overbye-1996}, solving the power-flow equations for ill-conditioned systems~\cite{Iwamoto-1981}, investigating load-flow feasibility~\cite{Makarov-2000}, and state estimation~\cite{Rao-1983,Keyhani-1985}. (This is by no means an exhaustive survey.) Formulating the power-flow equations with voltages expressed in rectangular coordinates affords us to opportunity to offer a fresh perspective on the ubiquitous \emph{DC power-flow} equations~\cite{Wood:1996}. (See also~\cite{Dorfler-DCPowerFlow-2013,Stott-2009} for recent work in this domain.) Particularly, we formally uncover the restrictive assumptions (flat voltage profile, small angle approximations, neglecting shunt loads and current loads, etc.) with which the linearized solution in rectangular coordinates boils down to the classical DC power-flow approximations. Another theoretical contribution of this work is that in lossless transmission systems including $\mathrm{PV}$ and $\mathrm{ZIP}$ buses, we prove that a purely imaginary complex perturbation around a flat-voltage linearization ensures active-power balance in the original nonlinear power-flow equations. Similar insights have recently been reported in~\cite{Ross-2013}, where the author observes that a purely complex perturbation around a flat start ensures balance of the active-power flows in the original nonlinear equations for lossless networks. (This is also alluded to in~\cite{Baosen-2013}.) Leveraging insights from lossless networks, we hypothesize on a voltage profile for transmission networks as an alternative to the DC power-flow equations that incorporates $\mathrm{ZIP}$ loads, and does not assume the slack bus has unit voltage magnitude.
In addition to the transmission-network setting, we also consider distribution networks that are composed of $\mathrm{ZIP}$ buses in addition to a slack bus (that models the secondary side of the step-down transformer at the feeder head). The nominal voltage is chosen to be the one where the constant-power nodal constraints are ignored; this is referred to subsequently as the~\emph{no-load voltage}. The choice of the no-load voltage is intuitively obvious from a circuit-theoretic vantage point, and proves to be algebraically beneficial in that it yields an analytically tractable linear model. We outline graph- and network-theoretic conditions to establish the uniqueness of solutions to this linearized system. For this setting, the real and imaginary components of the voltage perturbation vector can be solved uniquely without any further structural assumptions since the active- and reactive-power injections at all buses are known. Our results for distribution networks extend recent results in~\cite{Bolognani-2015} to include constant-current loads. We also systematically delineate the restrictive set of assumptions under which it is appropriate to presume that voltage magnitudes are strongly coupled to active-power injections and phases are strongly coupled to reactive-power injections. These assumptions underpin a vast body of work on distribution-system operation and control~\cite{Robbins-2013,Zhong-2013,Emiliano-2015}.
The remainder of this manuscript is organized as follows. Section~\ref{sec:Prelim} establishes notation and describes the power-system model. In Sections~\ref{sec:Transmission} and~\ref{sec:Distribution}, we outline solution strategies suited to transmission and distribution networks, respectively. Concluding remarks are provided in Section~\ref{sec:Conclusions}.
\section{Preliminaries and Power-system Model}
\label{sec:Prelim}
In this section, we establish notation, a few pertinent mathematical preliminaries, and describe the power-system model and the linearization used in the remainder of the paper.
\subsection{Notation and Mathematical Preliminaries}
The matrix transpose will be denoted by $(\cdot)^\mathrm{T}$, complex conjugate by $(\cdot)^*$, real and imaginary parts of a complex number by $\mathrm{Re}\{\cdot\}$ and $\mathrm{Im}\{\cdot\}$, respectively, magnitude of a complex scalar by $|\cdot|$, and $\mathrm{j} := \sqrt{-1}$.
A diagonal matrix formed with entries of the vector $x$ is denoted by $\mathrm{diag}(x)$;
$\mathrm{diag}(x/y)$ forms a diagonal matrix with the $\ell$th entry given by $x_\ell/y_\ell$, where $x_\ell$ and $y_\ell$ are the $\ell$th entries of vectors $x$ and $y$, respectively; and $\mathrm{diag}(1/x)$ forms a diagonal matrix with the $\ell$th entry given by $x_\ell^{-1}$. For a matrix $X$, $x_{\ell m}$ returns the entry in the $\ell$ row and $m$ column of $X$. The null space of a matrix $X$ is denoted by $\mathrm{N}(X)$. For a vector $x=[x_1,\dots,x_N]^\mathrm T$, $\cos(x):= [\cos(x_1),\dots,\cos(x_N)]^\mathrm T$ and $\sin(x):= [\sin(x_1),\dots,\sin(x_N)]^\mathrm T$. We will routinely decompose the complex-valued vector $x \in \mathbb{C}^N$ (complex-valued matrix $X \in \mathbb{C}^{N \times N}$) into its real and imaginary parts as follows: $x = x_\mathrm{re} + \mathrm j x_\mathrm{im}$ ($X = X_\mathrm{re} + \mathrm j X_\mathrm{im}$, respectively).
The spaces of $N\times1$ real-valued and complex-valued vectors are denoted by $\mathbb{R}^N$ and $\mathbb{C}^N$, respectively; $\mathbb{T}^N$ denotes the $N$-dimensional torus.
The $N \times N$ identity matrix is denoted by $I_{N\times N}$. The $M \times N$ matrices with all zeros and ones are denoted by $\mathbf{0}_{M\times N}$ and $\mathbf{1}_{M\times N}$, respectively; similarly, the $N \times 1$ vectors with all zeros and ones are denoted by $\mathbf{0}_{N}$ and $\mathbf{1}_{N}$, respectively.
In subsequent developments, we will routinely employ the following norms. The standard $2$-norm of the vector $x \in \mathbb{C}^N$ is denoted by $||x||$, and defined as
\begin{equation}
||x|| := \left( \sum_{\ell=1}^N |x_\ell|^2 \right)^{\frac{1}{2}}.
\label{eq:2norm}
\end{equation}
We will also find the following norm for the matrix $A \in \mathbb{C}^{N \times N}$ useful~\cite{Bolognani-2015}:
\begin{equation}
||A||^\dagger := \max_\ell \left( \sum_{k=1}^N |a_{\ell k}|^2 \right)^{\frac{1}{2}}.
\label{eq:mtxNorm}
\end{equation}
We conclude this section, with two bounds that we will utilize to bound error terms in the remainder of the paper. Let $||x||$ be the 2-norm of a complex-valued vector, $x \in \mathbb{C}^N$, as defined in~\eqref{eq:2norm}, and $||A||^\dagger$ be the matrix norm of a complex-valued matrix, $A \in \mathbb{C}^{N \times N}$, as defined in~\eqref{eq:mtxNorm}. Then
\begin{align}
||\mathrm{diag} (x) A x|| &\leq ||A||^\dagger ||x||^2, \label{eq:bound1} \\
||A x|| &\leq ||A||^\dagger ||x||. \label{eq:bound2}
\end{align}
These bounds can be derived from Lemma A.1 in~\cite{Bolognani-2015}.
\subsection{Power-system Model}
Consider a power system with $N+1$ buses collected in the set $\mathcal{N}$. We model loads as the parallel interconnection of a constant impedance, a constant current, and a constant power component; in the literature, this is commonly referred to as a $\mathrm{ZIP}$ model~\cite{price1993load}. On the other hand, we model generators as $\mathrm{PV}$ buses, i.e., at generator buses the voltage magnitudes and active-power injections are fixed.
Without loss of generality, the slack bus is fixed to be the $N+1$ bus, and its voltage is denoted by $V_\circ \mathrm{e}^{\mathrm j \theta_\circ}$. Let $V = [V_1, \dots, V_{N}]^\mathrm{T} \in \mathbb{C}^N$, where $V_\ell = |V|_\ell \angle \theta_\ell \in \mathbb{C}$ represents the voltage phasor at bus $\ell$. In subsequent developments, we will find it useful to define the vectors $|V| = [|V|_1,\dots,|V|_N]^\mathrm T \in \mathbb{R}^N_{>0}$ and $\theta = [\theta_1,\dots,\theta_N]^\mathrm T \in \mathbb{T}^N$. Given our focus on rectangular coordinates, we will also routinely express $V = V _\mathrm{re} + \mathrm j V_\mathrm{im}$, where $V_\mathrm{re}, V_\mathrm{im} \in \mathbb{R}^N$ denote the real and imaginary components of $V$.
Let $I = [I_1, \dots, I_{N}]^\mathrm{T}$, where $I_\ell \in \mathbb{C}$ denotes the current injected into bus $\ell$. Kirchhoff's current law for the buses in the power system can be compactly represented in matrix-vector form as follows:
\begin{equation}
\left[ \begin{array}{c} I \\ I_{N+1} \end{array} \right] = \left[ \begin{array}{c c} Y & \overline{Y}\\ \overline{Y}^{\mathrm T} & y \end{array} \right] \left[ \begin{array}{c} V \\ V_\circ \mathrm e^{\mathrm j \theta_\circ} \end{array} \right],
\label{eq:Ii}
\end{equation}
where $V_\circ \mathrm e^{\mathrm j \theta_\circ}$ is the slack-bus voltage, $I_{N+1}$ denotes the current injected into the slack bus, and the entries of the admittance matrix have the following dimensions: $Y \in \mathbb{C}^{N\times N}$, $\overline Y \in \mathbb{C}^{N}$, and $y \in \mathbb{C} \setminus \{0\}$.
Corresponding to the matrix $Y = G + \mathrm{j}B$, where $ G, B \in \mathbb{R}^{N\times N}$, we will denote the vector of shunt admittances (that appear on its diagonal) by $Y_\mathrm{sh} \in \mathbb{C}^N$, and write $Y_\mathrm{sh} = G_\mathrm{sh} + \mathrm j B_\mathrm{sh}$, where $G_\mathrm{sh}, B_\mathrm{sh} \in \mathbb{R}^N$. Exploiting the construction of the admittance matrix, we can extract these shunt elements through:
\begin{equation}
Y \mathbf{1}_N + \overline Y = Y_\mathrm{sh} = G_\mathrm{sh} + \mathrm j B_\mathrm{sh}.
\label{eq:Ysh}
\end{equation}
Note that $Y_\mathrm{sh}$ includes both the shunt terms from the transmission-line lumped-element model as well as those originating from the constant-impedance component of the $\mathrm{ZIP}$ load model.
\noindent \textbf{Remark.} The matrix $Y$ does~\emph{not} correspond to the admittance matrix of a realizable AC electrical circuit. Nonetheless, we prove in Lemma~1 that it is nonsingular by virtue of irreducible diagonal dominance~\cite{Horn:2013} if removal of the slack bus does not affect connectivity of the remaining network.
Denote the vector of complex-power bus injections by $S = [S_1, \dots, S_{N}]^\mathrm T$, where $S_\ell = P_\ell + \mathrm j Q_\ell$. By convention, $P_\ell$ and $Q_\ell$ are positive for generators and negative for loads (these represent the constant power component of the $\mathrm{ZIP}$ load model). Furthermore, let $I_\mathrm{L} = [I_{\mathrm{L}1}, \dots, I_{\mathrm{L}N}]^\mathrm{T}$, where $I_{\mathrm{L}\ell} \in \mathbb{C}$ denotes the current injected into bus $\ell$ due to the constant current component of the $\mathrm{ZIP}$ load at that bus. Then, using~\eqref{eq:Ii}, complex-power bus injections can be compactly written as
\begin{align}
S &= \mathrm{diag}\left(V\right) I^* -\mathrm{diag}\left(V\right) I_\mathrm{L}^* \nonumber \\
&= \mathrm{diag}\left(V\right) \left(Y^* V^* + \overline{Y}^* V_\circ \mathrm{e}^{-\mathrm j \theta_\circ} - I_\mathrm{L}^* \right).
\label{eq:S}
\end{align}
\subsection{Linearized Power-flow Equations} \label{sec:PowerFlow}
Suppose the solution to the power-balance expression in~\eqref{eq:S} is given by $V^\star \in \mathbb{C}^N$:
\begin{equation}
S = \mathrm{diag}(V^\star) \left(Y^* (V^\star)^* + \overline{Y}^* V_\circ \mathrm{e}^{-\mathrm j \theta_\circ}- I_\mathrm{L}^*\right).
\label{eq:pfstar}
\end{equation}
The abounding nonlinearities in~\eqref{eq:pfstar} preclude the possibility of seeking a closed-form solution to $V^\star$ (or even establish existence of solutions). Therefore, we will seek to linearize~\eqref{eq:pfstar} instead. Central to the linearization approach is to express $V^\star = V + \Delta V$, where $V$ is some a priori determined nominal voltage vector,\footnote{We slightly abuse notation with this formulation, since $V^\star$ (and not $V$) satisfies~\eqref{eq:Ii}. Nonetheless, for ease of exposition, we persist with this notation subsequently.} and entries of $\Delta V$ capture perturbations around $V$. With $V$ appropriately determined (we comment on the choice of $V$ shortly), we need to solve for $\Delta V$ that satisfies~\eqref{eq:pfstar}. Substituting $V^\star = V + \Delta V$ in~\eqref{eq:pfstar}, we see that $V+ \Delta V$ satisfies:
\begin{equation} \label{eq:SDeltaS}
S = \mathrm{diag}\left(V + \Delta V\right) \left( Y^* (V + \Delta V)^* + \overline{Y}^* V_\circ \mathrm{e}^{-\mathrm j \theta_\circ}- I_\mathrm{L}^*\right).
\end{equation}
Expanding terms in~\eqref{eq:SDeltaS}, we get
\begin{align} \label{eq:Sinter}
S &= \mathrm{diag}\left(V\right) Y^* V^* + \mathrm{diag}\left(V\right) Y^* \Delta V^* \nonumber \\
&+ \mathrm{diag}\left(\Delta V\right) Y^* V^* + \mathrm{diag}\left(\Delta V\right) Y^* \Delta V^* \nonumber \\
&+ \mathrm{diag}\left( V\right) \overline{Y}^* V_\circ \mathrm{e}^{-\mathrm j \theta_\circ} + \mathrm{diag}\left( \Delta V\right) \overline{Y}^* V_\circ \mathrm{e}^{-\mathrm j \theta_\circ} \nonumber \\
&- \mathrm{diag}\left(V\right) I_\mathrm{L}^* - \mathrm{diag}\left(\Delta V\right) I_\mathrm{L}^*.
\end{align}
Neglecting the second-order term, $\mathrm{diag}\left(\Delta V\right) Y^* \Delta V^*$, and recognizing that
\begin{align}
&\mathrm{diag}\left(\Delta V\right) Y^* V^* = \mathrm{diag}\left(Y^* V^*\right)\Delta V, \nonumber \\
&\mathrm{diag}\left( \Delta V\right)\overline{Y}^* V_\circ \mathrm{e}^{-\mathrm j \theta_\circ} = V_\circ \mathrm{e}^{-\mathrm j \theta_\circ}\mathrm{diag}\left(\overline{Y}^*\right)\Delta V, \nonumber \\
&\mathrm{diag}\left(\Delta V\right) I_\mathrm{L}^* = \mathrm{diag}\left(I_\mathrm{L}^*\right) \Delta V, \nonumber
\end{align}
we can reorganize terms in~\eqref{eq:Sinter} to get
\begin{equation} \label{eq:Sinter1}
\Gamma \Delta V + \Xi \Delta V^* = S + \Pi,
\end{equation}
where $\Gamma \in \mathbb{C}^{N \times N}$, $\Xi \in \mathbb{C}^{N \times N}$, and $\Pi \in \mathbb{C}^N$ are given by
\begin{align}
\Gamma &= \mathrm{diag}\left(Y^* V^* + \overline{Y}^* V_\circ \mathrm e^{-\mathrm j \theta_\circ} - I_\mathrm{L}^* \right), \label{eq:A}\\
\Xi &= \mathrm{diag}\left(V\right) Y^*, \label{eq:B} \\
\Pi &= -\mathrm{diag}\left(V\right) \left(Y^* V^* + \overline{Y}^* V_\circ \mathrm e^{-\mathrm j \theta_\circ} - I_\mathrm{L}^*\right). \label{eq:C}
\end{align}
With~\eqref{eq:Sinter1} in place, we turn our attention to solving for the bus-voltage perturbation vector $\Delta V$, using which we could recover an approximation to the actual solution $V^\star$. Decomposing all quantities in~\eqref{eq:Sinter1} into their real and imaginary parts, we can write it equivalently as follows:
\begin{equation}
\left[ \begin{array}{c c} \Gamma_\mathrm{re}+\Xi_\mathrm{re} & -\Gamma_\mathrm{im}+\Xi_\mathrm{im} \\ \Gamma_\mathrm{im}+\Xi_\mathrm{im} & \Gamma_\mathrm{re}-\Xi_\mathrm{re} \end{array} \right]
\left[ \begin{array}{c} \Delta V_\mathrm{re} \\ \Delta V_\mathrm{im} \end{array} \right] = \left[ \begin{array}{c} P + \Pi_\mathrm{re}\\ Q + \Pi_\mathrm{im}\end{array} \right],
\label{eq:linear}
\end{equation}
In general, it is not possible to establish the invertibility of the $2N \times 2N$ matrix in~\eqref{eq:linear}. Some special cases do allow us to establish this, and we dwell on these soon. We next outline some possible choices for the nominal voltage, $V$.
\subsubsection{Flat Voltage} In a non-stressed system, we can assume all bus-voltage magnitudes are close to $1\,\mathrm{p.u.}$ and phase-angle differences are small. In this simplest case, we set $V = \mathbf{1}_N$. We will utilize this approximation in our study of transmission networks in Section~\ref{sec:Transmission}.
\subsubsection{No-load Voltage}
The structure of the expressions in~\eqref{eq:Sinter1} and~\eqref{eq:A}--\eqref{eq:C} suggest that with the following choice:
\begin{equation} \label{eq:V}
V = Y^{-1}\left(I_\mathrm L - \overline Y V_\circ \mathrm e^{\mathrm j \theta_\circ} \right),
\end{equation}
we get $\Gamma = \mathbf{0}_{N \times N}$, $\Pi = \mathbf{0}_N$, and subsequently recover the following linearized power-flow expressions
\begin{equation} \label{eq:DeltaVPowerFlow}
\mathrm{diag}\left(V^*\right) Y \Delta V = S^*.
\end{equation}
Notice that $V$ in~\eqref{eq:V} is the non-zero voltage solution recovered when the current injections in the buses (i.e., $YV + \overline Y V_\circ \mathrm{e}^{\mathrm j \theta_\circ} - I_\mathrm{L}$) are zero. Since this corresponds to the non-zero solution to~\eqref{eq:S} when $S = \mathbf{0}_N$, we refer to it as the \emph{no-load voltage}. It turns out that with the choice of the no-load voltage, we can establish the following result on existence and uniqueness of solutions to~\eqref{eq:DeltaVPowerFlow}.
\begin{lemma}
\label{lemma:Yinv}
A unique solution to~\eqref{eq:DeltaVPowerFlow} exists with the choice of the no-load voltage, $V = Y^{-1}\left(I_\mathrm L - \overline Y V_\circ \mathrm e^{\mathrm j \theta_\circ} \right)$, in~\eqref{eq:V} if
\begin{enumerate}
\item[(i)] Removal of the slack bus does not affect network connectivity.
\item[(ii)] The constant-current components of the $\mathrm{ZIP}$ buses are such that $I_\mathrm L \neq \overline Y V_\circ \mathrm e^{\mathrm j \theta_\circ}$.
\end{enumerate}
Condition (i)~establishes invertibility of $Y$ and (ii)~ensures that $V =Y^{-1}\left(I_\mathrm L - \overline Y V_\circ \mathrm e^{\mathrm j \theta_\circ} \right) \neq \mathbf{0}_N$. Taken together, they guarantee that the matrix $\mathrm{diag}\left(V^*\right) Y$ is non-singular, and consequently this ensures~\eqref{eq:DeltaVPowerFlow} admits a unique solution.\end{lemma}
\noindent \emph{Proof.} We first dwell on (i). Since removal of the slack bus does not affect network connectivity, it follows that the undirected graph induced by $Y$ is connected. This is equivalent to stating that $Y$ is irreducible~\cite[Theorem 6.2.24]{Horn:2013}. Furthermore, by construction of the network admittance matrix, it follows that the entries of $Y$ are such that
\begin{equation*}
|y_{\ell \ell}| \geq \sum_{\ell \neq m} |y_{\ell m}|, \quad \forall \, \ell \in \mathcal{N}\setminus\{ N + 1\}.
\end{equation*}
This implies that $Y$ is diagonally dominant. In addition, for the buses that are connected to the slack bus, a set that we denote by $\mathcal{N}_{N+1}$, it follows that
\begin{equation*}
|y_{\ell \ell}| > \sum_{\ell \neq m} |y_{\ell m}|, \quad \forall \, \ell \in \mathcal{N}_{N+1}.
\end{equation*}
Under these conditions, it follows that $Y$ is irreducibly diagonally dominant~\cite[Definition 6.2.25]{Horn:2013}, from which we conclude that $Y$ is nonsingular~\cite[Corollary 6.2.27]{Horn:2013}.
Next, consider the statement in (ii). Since (i) ensures invertibility of $Y$, it follows that $\mathrm{N}(Y) = \mathrm{N}(Y^{-1})= \{\mathbf{0}_N\}$. Therefore, ensuring $I_\mathrm L \neq \overline Y V_\circ \mathrm e^{\mathrm j \theta_\circ}$ is sufficient to guarantee that $V = Y^{-1}\left(I_\mathrm L - \overline Y V_\circ \mathrm e^{\mathrm j \theta_\circ} \right) \neq \mathbf{0}_N$.
Considered together, conditions (i) and (ii) ensure that the matrix $\mathrm{diag}\left(V^*\right) Y$ is nonsingular, hence guaranteeing a unique solution to~\eqref{eq:DeltaVPowerFlow}.
\hfill \ensuremath{\blacksquare}
We will utilize the no-load voltage profile in analyzing distribution networks in Section~\ref{sec:Distribution}.
\subsection{Errors in Complex-, Active-, and Reactive-power Balance}
To gauge the accuracy of linearized solutions outlined subsequently, we will revert to the quadratic term $\mathrm{diag}(\Delta V)Y^* \Delta V^*$ that we neglected in the derivation of~\eqref{eq:Sinter1}. To this end, we denote the \emph{error in complex-power balance} by $S_\mathrm{h.o.t.}$ and express it as
\begin{align} \label{eq:Shot}
S_\mathrm{h.o.t.} &= \mathrm{diag}(\Delta V)Y^* \Delta V^* \\
&=\mathrm{diag}(\Delta V_\mathrm{re} + \mathrm j \Delta V_\mathrm{im}) (G - \mathrm j B) (\Delta V_\mathrm{re} - \mathrm j \Delta V_\mathrm{im}). \nonumber
\end{align}
From above, isolating the real part of $S_\mathrm{h.o.t.}$, we obtain the \emph{error in active-power balance}, which we denote by $P_\mathrm{h.o.t.}$:
\begin{align}
P_\mathrm{h.o.t.} &= \mathrm{Re}\{S_\mathrm{h.o.t.}\} \nonumber \\
&= \mathrm{diag}\left(\Delta V_\mathrm{re}\right) (G \Delta V_\mathrm{re} - B \Delta V_\mathrm{im}) \nonumber \\
&+ \mathrm{diag}\left(\Delta V_\mathrm{im}\right) (G \Delta V_\mathrm{im} + B \Delta V_\mathrm{re}). \label{eq:Phot}
\end{align}
Similarly, we isolate the imaginary part of $S_\mathrm{h.o.t.}$, to recover the \emph{error in reactive-power balance}, which we denote by $Q_\mathrm{h.o.t.}$:
\begin{align}
Q_\mathrm{h.o.t.} &= \mathrm{Im}\{S_\mathrm{h.o.t.}\} \nonumber \\
&= \mathrm{diag}\left(\Delta V_\mathrm{im}\right) (G \Delta V_\mathrm{re} - B \Delta V_\mathrm{im}) \nonumber \\
&- \mathrm{diag}\left(\Delta V_\mathrm{re}\right) (G \Delta V_\mathrm{im} + B \Delta V_\mathrm{re}). \label{eq:Qhot}
\end{align}
Note that $S_\mathrm{h.o.t.}$, $P_\mathrm{h.o.t.}$, and $Q_\mathrm{h.o.t.}$ are all functions of $\Delta V = \Delta V_\mathrm{re} + \mathrm j \Delta V_\mathrm{im}$. However, we will drop this functional dependence to simplify notation.
\section{Approximations Tailored to Transmission Networks} \label{sec:Transmission}
In this section, we exploit the well-known structural property that transmission networks are mostly inductive~\cite{Wood:1996} to postulate on a solution to~\eqref{eq:linear}. We consider the special case where $G = \mathbf{0}_{N \times N}$ in Section~\ref{sec:inductive}, and then examine the classical DC power-flow approximations in Section~\ref{sec:DCPowerFlow}.
\subsection{Purely Inductive Network \& Flat-voltage Linearization} \label{sec:inductive}
Consider an inductive network for which $G \approx \mathbf{0}_{N\times N}$. This model is appropriate for transmission networks where the line inductive elements dominate over the resistive ones. In making this assumption, recognize that we have also neglected all shunt conductance terms (i.e., $G_\mathrm{sh} = \mathbf{0}_N$). For such a network, it turns out that with a linearization around the flat-voltage $V = \mathbf{1}_N$, and under a (technical) constraint on the constant-current component of the $\mathrm{ZIP}$ loads, we can demonstrate that the solution to~\eqref{eq:linear} where $\Delta V_\mathrm{re} = \mathbf{0}_{N}$ ensures zero error in the active-power balance. We formally state and prove this next. Before so doing, we establish some notation to ease exposition. From~\eqref{eq:A}--\eqref{eq:C}, for the particular case $G = \mathbf{0}_{N \times N}$, $G_\mathrm{sh} = \mathbf{0}_N$, $V = \mathbf{1}_N$, and $V_\circ \mathrm{e}^{\mathrm j \theta_\circ} = 1$, with the aid of~\eqref{eq:Ysh}, we get
\begin{align}
\Gamma &= \mathrm{diag}\left(Y^* V^* + \overline{Y}^* V_\circ \mathrm e^{-\mathrm j \theta_\circ} - I_\mathrm{L}^* \right) \nonumber \\
&= \mathrm{diag}\left(Y^* \mathbf{1}_N + \overline{Y}^* - I_\mathrm{L}^*\right) = \mathrm{diag}(Y^*_\mathrm{sh} - I_\mathrm{L}^*) \nonumber \\
&= \mathrm{diag}(-\mathrm j B_\mathrm{sh} - I_\mathrm{L}^*), \nonumber \\
\Xi &= \mathrm{diag}\left(V\right) Y^* = I_{N\times N} Y^* = -\mathrm j B, \nonumber \\
\Pi &= -\mathrm{diag}\left(V\right) \left(Y^* V^* + \overline{Y}^* V_\circ \mathrm e^{-\mathrm j \theta_\circ} - I_\mathrm{L}^*\right) \nonumber \\
&= -I_{N\times N}\left(Y^* \mathbf{1}_N + \overline{Y}^*- I_\mathrm{L}^*\right) = - \left( Y^*_\mathrm{sh}- I_\mathrm{L}^* \right) \nonumber \\
&= \mathrm j B_\mathrm{sh} + I_\mathrm{L}^*.
\end{align}
We will find it useful to define
\begin{align} \label{eq:UsefulDefs}
\Phi_\mathrm{re} &:= \Gamma_\mathrm{re} + \Xi_\mathrm{re} = - \mathrm{diag}(I_\mathrm{L,re}), \\
\Phi_\mathrm{im} &:= -\Gamma_\mathrm{im} + \Xi_\mathrm{im} = - (B - \mathrm{diag}(B_\mathrm{sh})) - \mathrm{diag}(I_\mathrm{L,im}). \nonumber
\end{align}
With the definitions in~\eqref{eq:UsefulDefs}, it follows that following linear equations need be solved to determine the voltage-perturbation vector, $\Delta V$:
\begin{equation} \label{eq:maineq1}
\Phi_\mathrm{re} \Delta V_\mathrm{re} + \Phi_\mathrm{im} \Delta V_\mathrm{im} = P + I_\mathrm{L,re}.
\end{equation}
Note that~\eqref{eq:maineq1} is underdetermined, specifically, with $N$ equations and $2N$ unknowns. We next examine the solution where the real component is suppressed, i.e., $\Delta V_\mathrm{re} = \mathbf{0}_N$, and demonstrate that it satisfies the active-power balance in the original nonlinear power-flow expressions. We formally prove this statement next.
\begin{theorem}
\label{prop:inductive_main}
Consider an inductive network, $G = \mathbf{0}_{N \times N}$. Suppose that the constant-current component of the $\mathrm{ZIP}$ loads satisfies the following requirements:
\begin{enumerate}
\item For node $\ell \in \mathcal{N}\setminus\{ N + 1\}$, we have
\begin{equation} \label{eq:ILcondition1}
\Big|-\sum_{\ell \neq m} b_{\ell m} - I_{\mathrm{L,im},\ell} \Big| \geq \sum_{\ell \neq m} |b_{\ell m}|.
\end{equation}
\item For at least one node in the set $\mathcal{N}_{N+1}$ we have
\begin{equation} \label{eq:ILcondition2}
\Big|-\sum_{\ell \neq m} b_{\ell m} - I_{\mathrm{L,im},\ell} \Big| > \sum_{\ell \neq m} |b_{\ell m}|.
\end{equation}
\end{enumerate}
It follows that the voltage profile
\begin{equation} \label{eq:ApproxInductive}
\mathbf{1}_N + \Delta V = \mathbf{1}_N + \mathrm j \Phi_\mathrm{im}^{-1} (P + I_\mathrm{L,re}),
\end{equation}
where $\Phi_\mathrm{im}$ is specified by~\eqref{eq:UsefulDefs} minimizes the active-power-balance error, $||P_\mathrm{h.o.t.}||$, to zero, i.e.,
\begin{align} \label{eq:InductiveResult1}
\mathrm{arg} \min_{\Delta V \in \mathbb{C}^N} ||P_\mathrm{h.o.t.}|| &= \mathrm j \Phi_\mathrm{im}^{-1} (P + I_\mathrm{L,re}) \nonumber \\
\min_{\Delta V \in \mathbb{C}^N} ||P_\mathrm{h.o.t.}|| &= 0.
\end{align}
Furthermore, the voltage profile in~\eqref{eq:ApproxInductive} yields the following upper bound on the reactive-power balance error
\begin{equation} \label{eq:QhotBound}
||Q_\mathrm{h.o.t.}|| \leq ||B||^\dagger ||\Phi_\mathrm{im}^{-1} (P + I_\mathrm{L,re})||^2.
\end{equation}\end{theorem}
\noindent \emph{Proof.} With the conditions in~\eqref{eq:ILcondition1}--\eqref{eq:ILcondition2}, it follows that $\Phi_\mathrm{im}$ is invertible. Consequently, from~\eqref{eq:maineq1}, we can write
\begin{align} \label{eq:DeltaVispecial}
\Delta V_\mathrm{im} &= \Phi_\mathrm{im}^{-1} (P + I_\mathrm{L,re}) - \Phi_\mathrm{im}^{-1} \Phi_\mathrm{re} \Delta V_\mathrm{re}.
\end{align}
Also, in the setting where $G = \mathbf{0}_{N \times N}$, we see that $P_\mathrm{h.o.t.}$ from~\eqref{eq:Phot} simplifies to the following
\begin{equation} \label{eq:Photspecial}
P_\mathrm{h.o.t.} = -\mathrm{diag}\left(\Delta V_\mathrm{re}\right) B \Delta V_\mathrm{im} + \mathrm{diag}\left(\Delta V_\mathrm{im}\right) B \Delta V_\mathrm{re}.
\end{equation}
Substituting for $\Delta V_\mathrm{im}$ from~\eqref{eq:DeltaVispecial} in~\eqref{eq:Photspecial}, we get after a few elementary algebraic manipulations
\begin{align} \label{eq:Temp1}
P_\mathrm{h.o.t.} &= -\mathrm{diag}(B\Phi_\mathrm{im}^{-1}(P+I_\mathrm{L,re})) \Delta V_\mathrm{re} \nonumber \\
&\hspace{-0.4in}+ \mathrm{diag}(\Delta V_\mathrm{re}) \Phi_\mathrm{im}^{-1}\Phi_\mathrm{re} \Delta V_\mathrm{re} + \mathrm{diag}(\Phi_\mathrm{im}^{-1}(P+I_\mathrm{L,re})) B \Delta V_\mathrm{re} \nonumber \\
&\hspace{-0.4in} - \mathrm{diag}(\Phi_\mathrm{im}^{-1}\Phi_\mathrm{re} \Delta V_\mathrm{re}) B \Delta V_\mathrm{re}.
\end{align}
Taking the $2$-norm on both sides above, applying the triangle inequality, and utilizing~\eqref{eq:bound1}--\eqref{eq:bound2}, we see that
\begin{align}
||P_\mathrm{h.o.t.}|| &\leq ||\mathrm{diag}(B\Phi_\mathrm{im}^{-1}(P+I_\mathrm{L,re}))||^\dagger ||\Delta V_\mathrm{re}|| \nonumber \\
&\hspace{-0.6in}+||\Phi_\mathrm{im}^{-1}\Phi_\mathrm{re}||^\dagger ||\Delta V_\mathrm{re}||^2 + ||\mathrm{diag}(\Phi_\mathrm{im}^{-1}(P+I_\mathrm{L,re})) B||^\dagger ||\Delta V_\mathrm{re}|| \nonumber \\
&\hspace{-0.6in}+ ||\Phi_\mathrm{im}^{-1}\Phi_\mathrm{re} B^{-1}||^\dagger ||B \Delta V_\mathrm{re}||^2.
\end{align}
Taking the minimum on both sides above with respect to $\Delta V_\mathrm{re}$, and noting that $\mathrm{N}(B) = \mathbf{0}_N$ (see Lemma~1), we see that
\begin{align} \label{eq:temp}
&\min_{\Delta V_\mathrm{re} \in \mathbb{R}^N}||P_\mathrm{h.o.t.}|| \nonumber \\
&\leq \min_{\Delta V_\mathrm{re} \in \mathbb{R}^N} \Big(||\mathrm{diag}(B\Phi_\mathrm{im}^{-1}(P+I_\mathrm{L,re}))||^\dagger ||\Delta V_\mathrm{re}|| \nonumber \\
&\hspace{-0.0in}+||\Phi_\mathrm{im}^{-1}\Phi_\mathrm{re}||^\dagger ||\Delta V_\mathrm{re}||^2 + ||\mathrm{diag}(\Phi_\mathrm{im}^{-1}(P+I_\mathrm{L,re})) B||^\dagger ||\Delta V_\mathrm{re}|| \nonumber \\
&\hspace{-0.0in}+ ||\Phi_\mathrm{im}^{-1}\Phi_\mathrm{re} B^{-1}||^\dagger ||B \Delta V_\mathrm{re}||^2\Big) = 0.
\end{align}
Note that~\eqref{eq:InductiveResult1} then follows straightforwardly from~\eqref{eq:temp}.
Furthermore, from~\eqref{eq:Qhot}, for the case $G = \mathbf{0}_{N \times N}$, we can see that the error in the reactive-power balance is given by
\begin{equation}
Q_\mathrm{h.o.t.} = -\mathrm{diag}(\Delta V_\mathrm{im}) B \Delta V_\mathrm{im} - \mathrm{diag}(\Delta V_\mathrm{re}) B \Delta V_\mathrm{re}.
\end{equation}
With the choice
\begin{equation}
\Delta V_\mathrm{re} = \mathbf{0}_N, \quad \Delta V_\mathrm{im} = \Phi_\mathrm{im}^{-1}(P + I_\mathrm{L,re}),
\end{equation}
we can simplify above to get
\begin{equation}
Q_\mathrm{h.o.t.} = -\mathrm{diag}(\Phi_\mathrm{im}^{-1} (P + I_\mathrm{L,re})) B \Phi_\mathrm{im}^{-1} (P + I_\mathrm{L,re}).
\end{equation}
Applying~\eqref{eq:bound1} (with the choice $x = \Phi_\mathrm{im}^{-1} (P + I_\mathrm{L,re})$ and $A = B$), we recover the upper bound on the reactive-power-balance error in~\eqref{eq:QhotBound}.
\hfill \ensuremath{\blacksquare}
\subsection{Connection to the classical DC Power Flow} \label{sec:DCPowerFlow}
The voltage profile in~\eqref{eq:ApproxInductive} brings to mind the \emph{classical DC power flow} relations~\cite{Wood:1996}:
\begin{equation} \label{eq:DCapprox}
-\left(B - \mathrm{diag}(B_\mathrm{sh}) \right) \theta = P,
\end{equation}
where $B \in \mathbb{R}^{N\times N}$ is the imaginary part of $Y \in \mathbb{C}^{N\times N}$, $B_\mathrm{sh} \in \mathbb{R}^N$ is the vector with shunt susceptance terms, $\theta \in \mathbb{T}^N$ is the vector of bus phases, and $P \in \mathbb{R}^N$ is the vector of active-power bus injections.\footnote{Typically, in the literature, solutions to the DC power flow expressions are written as $-B^{-1}P$. However, with regard to the notation we use in this work, the matrix $B$ includes shunt terms that are excluded in the classical DC power flow expressions.}
We remark that~\eqref{eq:ApproxInductive} extends the classical DC power flow approximation to the case where the network contains $\mathrm{ZIP}$ loads and assumptions of small bus-voltage angle differences are not made. Next, we demonstrate how~\eqref{eq:DCapprox} can be recovered from~\eqref{eq:Sinter1}, and in so doing, illustrate all the restrictive assumptions imposed in deriving~\eqref{eq:DCapprox}.
\begin{lemma}
The DC power flow approximation in~\eqref{eq:DCapprox} can be derived from~\eqref{eq:Sinter1} under the following assumptions and approximations:
\begin{enumerate}
\item a flat-voltage initialization, $V = \mathbf{1}_N$;
\item disregarding the constant-current loads, $I_\mathrm{L} = \mathbf{0}_N$;
\item neglecting shunt conductances, $G_\mathrm{sh} = \mathbf{0}_N$;
\item setting the slack bus voltage to unity, $V_\circ \mathrm{e}^{\mathrm j \theta_\circ} = 1 \angle 0$; and
\item the small-angle approximation for voltages $\theta \approx \Delta V_\mathrm {im}$.
\end{enumerate}
\end{lemma}
\noindent \emph{Proof.} Let us begin with~\eqref{eq:A}--\eqref{eq:C}. We set $I_\mathrm{L} = \mathbf{0}_N$, and operate under the flat-voltage assumptions $V = \mathbf{1}_N$, $V_\mathrm{o} = 1\,\mathrm{p.u.}$, and $\theta_\mathrm o = 0^\circ$. Then, with the aid of~\eqref{eq:Ysh}, we get
\begin{align}
\Gamma &= \mathrm{diag}\left(Y^* V^* + \overline{Y}^* V_\circ \mathrm e^{-\mathrm j \theta_\circ} - I_\mathrm{L}^* \right) \nonumber \\
&= \mathrm{diag}\left(Y^* \mathbf{1}_N + \overline{Y}^*\right) = \mathrm{diag}(Y^*_\mathrm{sh}), \nonumber \\
\Xi &= \mathrm{diag}\left(V\right) Y^* = I_{N\times N} Y^*, \nonumber \\
\Pi &= -\mathrm{diag}\left(V\right) \left(Y^* V^* + \overline{Y}^* V_\circ \mathrm e^{-\mathrm j \theta_\circ} - I_\mathrm{L}^*\right) \nonumber \\
&= -I_{N\times N}\left(Y^* \mathbf{1}_N + \overline{Y}^*\right) = - Y^*_\mathrm{sh}. \nonumber
\end{align}
Substituting $\Gamma$, $\Xi$, and $\Pi$ from above in~\eqref{eq:Sinter1}, we get
\begin{equation}
\mathrm{diag}\left(Y^*_\mathrm{sh} \right) \Delta V + Y^* \Delta V^* = S - Y^*_\mathrm{sh}.
\label{eq:DC1}
\end{equation}
Assuming $\Delta V_\mathrm{re} = \mathbf{0}_N$, we see that $\Delta V = \mathrm{j}\Delta V_\mathrm{im}$. Consequently, it follows that $\Delta V^* = -\Delta V$, and~\eqref{eq:DC1} simplifies to
\begin{equation}
-\left(Y^* - \mathrm{diag}\left(Y^*_\mathrm{sh} \right)\right)\Delta V = S - Y^*_\mathrm{sh}.
\label{eq:DC2}
\end{equation}
Isolating the real part of~\eqref{eq:DC2}, we obtain
\begin{equation}
-\left(B - \mathrm{diag}(B_\mathrm{sh}) \right) \Delta V_\mathrm{im} = P - G_\mathrm{sh}.
\label{eq:DC3}
\end{equation}
We see that~\eqref{eq:DCapprox} follows from~\eqref{eq:DC3} by neglecting the shunt conductance terms (i.e., setting $G_\mathrm{sh} = \mathbf{0}_N$), and under the small-angle approximation
\begin{equation}
\theta = \angle(V + \Delta V) = \angle(\mathbf{1}_N + \mathrm j \Delta V_\mathrm{im}) \approx \Delta V_\mathrm {im},
\end{equation}
which completes the proof. \hfill \ensuremath{\blacksquare}
\noindent \textbf{Remark.} It is straightforward to see that the error in the solution to $\Delta V_\mathrm{im}$ incurred in neglecting the shunt conductance terms is given by $||\left(B - \mathrm{diag}(B_\mathrm{sh}) \right)^{-1} G_\mathrm{sh}||$. Since $G_\mathrm{sh}$ includes shunt conductance terms from the constant-impedance portion of $\mathrm{ZIP}$ loads (in addition to that emerging from the transmission-line lumped-element model), neglecting $G_\mathrm{sh}$ can potentially result in large errors in the estimate of the bus-voltage angles with the conventional DC power flow approximations.
\section{Approximations Tailored to Distribution Networks} \label{sec:Distribution}
In this section, we consider a network that only contains $\mathrm{ZIP}$ buses in addition to the slack bus. This model is appropriate for distribution networks, where the slack bus models the secondary side of the step-down transformer at the feeder head. We begin with the solution for the most general case, and present some special cases next.
\subsection{Solution for the General Case}
Since we know the active- and reactive-power injections at all buses, and assuming the conditions of Lemma~1 are met, the solution to~\eqref{eq:DeltaVPowerFlow} can be expressed in analytical closed form as follows:
\begin{equation} \label{eq:DeltaVPQ}
\Delta V = Y^{-1}\mathrm{diag}\left(1/V^*\right) S^*,
\end{equation}
with $V$ chosen as in~\eqref{eq:V} from before. The linear approximation to the voltage profile in this setting is therefore given by $V + Y^{-1}\mathrm{diag}\left(1/V^*\right) S^*$. Finally, note that the error in complex-power balance induced by this linear approximation can be obtained from~\eqref{eq:Shot}, and is given by
\begin{equation}
S_\mathrm{h.o.t.} = \mathrm{diag}\left(Y^{-1} \mathrm{diag}\left( 1/V^* \right) S^*\right) \mathrm{diag}\left(1 / V\right) S,
\label{eq:Shot_zip}
\end{equation}
Applying~\eqref{eq:bound1} (with the choice $x = Y^{-1} \mathrm{diag}\left( 1/V^* \right) S^*$ and $A = Y^*$), we recover the following upper bound on the complex-power-balance error:
\begin{equation}
||S_\mathrm{h.o.t.}|| \leq ||Y^*||^\dagger ||Y^{-1} \mathrm{diag}\left(1/V^*\right) S^*||^2.
\end{equation}
\subsection{Revisiting Coupling Arguments}
Let us denote $(G + \mathrm j B)^{-1} = R + \mathrm j X$. Then, expanding the terms in~\eqref{eq:DeltaVPQ}, it is straightforward to separately write out the real and imaginary components of $\Delta V$ as follows:
\begin{align} \label{eq:DeltaVrPQ}
\Delta V_\mathrm{re} &= \left(R \mathrm{diag}\left(\frac{\cos \theta}{|V|}\right) - X \mathrm{diag}\left(\frac{\sin \theta}{|V|}\right) \right) P \nonumber \\
&+ \left(X \mathrm{diag}\left(\frac{\cos \theta}{|V|}\right) + R \mathrm{diag}\left(\frac{\sin \theta}{|V|}\right) \right) Q,
\end{align}
\begin{align} \label{eq:DeltaViPQ}
\Delta V_\mathrm{im} &= \left(X \mathrm{diag}\left(\frac{\cos \theta}{|V|}\right) + R \mathrm{diag}\left(\frac{\sin \theta}{|V|}\right) \right) P \nonumber \\
&- \left(R \mathrm{diag}\left(\frac{\cos \theta}{|V|}\right) - X \mathrm{diag}\left(\frac{\sin \theta}{|V|}\right) \right) Q.
\end{align}
If we suppose that entries of $V_\mathrm{re}$ and $V_\mathrm{im}$ dominate those in $\Delta V_\mathrm{re}$ and $\Delta V_\mathrm{im}$, respectively, then $|V| + \Delta V_\mathrm{re}$ serves as a first-order approximation to the voltage magnitudes across the distribution network. Similarly, $\theta + \Delta V_\mathrm{im}$ serves as a first-order approximation to the phases across the distribution network.
In literature pertaining to distribution system operation and control, a common assumption made to simplify analysis is that voltage magnitudes are strongly coupled to active-power injections and phases are strongly coupled to reactive-power injections~\cite{Robbins-2013,Zhong-2013,Emiliano-2015}. Here, with the aid of~\eqref{eq:DeltaVrPQ} and~\eqref{eq:DeltaViPQ}, we investigate the validity of these assumptions, and the exact topological and constitutional requirements to justify them. First, we have to assume $B = \mathbf{0}_{N \times N}$, following which, we have $R = G^{-1}$ and $X = \mathbf{0}_{N \times N}$ in~\eqref{eq:DeltaVrPQ}--\eqref{eq:DeltaViPQ}. (Note that setting $B = \mathbf{0}_{N\times N}$ neglects the line reactances as well as inductive shunt loads.) We also need to suppose $\cos \theta = \mathbf{1}_N$ and $\sin \theta = \mathbf{0}_N$. Under these assumptions, we get
\begin{equation*} \label{eq:DeltaVriPQspecial}
\Delta V_\mathrm{re} = G^{-1} \mathrm{diag}\left(\frac{1}{|V|}\right) P, \Delta V_\mathrm{im} = - G^{-1} \mathrm{diag}\left(\frac{1}{|V|}\right)Q.
\end{equation*}
With these restrictive set of assumptions, we see that $|V| + \Delta V_\mathrm{re}$, the first-order approximation to the voltage magnitudes, is only a function of the active-power injections. Similarly, $\theta + \Delta V_\mathrm{im}$, the first-order approximation to the voltage phases across the distribution network, is only a function of the reactive-power injections.
\subsection{Recovering Results in~\cite{Bolognani-2015} as a Special Case}
Consider the special case in which constant-current components in the $\mathrm{ZIP}$ loads are neglected, i.e., $I_\mathrm{L} = \mathbf{0}_N$ in~\eqref{eq:V}. In this case, from~\eqref{eq:V}, the choice of $V$ simplifies to
\begin{equation}
V = V_\circ \mathrm{e}^{\mathrm j \theta_\circ} w,
\label{eq:Vzip}
\end{equation}
where $w = -Y^{-1}\overline{Y}$ (adopting the notation in~\cite{Bolognani-2015}). Using the choice of $V$ in~\eqref{eq:Vzip}, the solution to~\eqref{eq:DeltaVPowerFlow} becomes
\begin{equation*}
\Delta V = Y^{-1}\mathrm{diag}\left(\frac{1}{V^*}\right) S^* = \frac{\mathrm{e}^{\mathrm j \theta_\circ}}{V_\circ} Y^{-1}\mathrm{diag}\left(\frac{1}{w^*}\right) S^*.
\end{equation*}
This suggests the following linearized voltage profile
\begin{equation}
V_\circ \mathrm{e}^{\mathrm j \theta_\circ} \left(w + \frac{1}{V^2_\circ} Y^{-1} \mathrm{diag}\left(\frac{1}{w^*}\right) S^* \right)
\label{eq:PQvoltage}
\end{equation}
to be a good first-order approximation for voltages in the distribution network. We mention that this result matches that in~\cite{Bolognani-2015}, which was derived with fixed-point arguments. Finally, we note that with this voltage profile, it follows that
\begin{equation}
||S_\mathrm{h.o.t.}|| \leq \frac{1}{V_\circ^2} ||Y^*||^\dagger ||Y^{-1} \mathrm{diag}\left(1/w^*\right) S^*||^2.
\end{equation}
\section{Concluding Remarks} \label{sec:Conclusions}
This paper examined the classical power-flow expressions written in a compact matrix-vector form and with the nodal voltages expressed in rectangular coordinates. We sought solutions to the nodal voltages in the form of a perturbation around a nominal voltage. For lossless transmission networks, with the usual flat-voltage linearization, we proved that the perturbation where the real component is suppressed yields a voltage profile that satisfies active-power balance in the original nonlinear power-flow expressions. For distribution networks, we demonstrated the analytical convenience of a no-load voltage linearization, and extended recent results on linear voltage approximations to include $\mathrm{ZIP}$ loads.
\balance
\bibliographystyle{IEEEtran}
| {'timestamp': '2015-12-23T02:01:26', 'yymm': '1512', 'arxiv_id': '1512.06903', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06903'} | arxiv |
\section{Introduction}
Image classification is a fundamental problem in computer vision. The classic approach tries to categorize images into a fixed set of classes by training a multi-class classifier. And continuous efforts have been made in building image classification systems with larger-scale image datasets as well as a broader coverage of visual classes. However, due to complex relationships among the concepts (\emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot, hierarchical, disjoint, etc.), it is hard to define a perfect classifier encoding all those semantic relations \cite{JiaDengECCV14}. Also, since the set of classes is predefined, such systems need to be re-trained whenever a new visual entity emerges.
To address these shortcomings, visual-semantic embedding methods \cite{DeviSE, NoriuziICLR14} are introduced which leverage semantic information from unannotated text data to learn semantic relationships between labels, and explicitly map images into a rich semantic embedding space (in such space, certain semantic relationships are encoded, \emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot, \emph{sun} and \emph{sunrise} may locate at close positions. And images from these two classes may share some common visual appearance.). By resorting to classification in the embedding space with respect to a set of label embedding vectors, visual-semantic models have shown comparable performance to the state-of-the-art visual object classifiers and demonstrated \emph{zero-shot learning} capability, \emph{i.e}\onedot} \def\Ie{\emph{I.e}\onedot, correctly predicting object category labels for unseen categories (which validates the ability to address the shortcomings mentioned before).
\begin{figure}
\centering
\includegraphics[width=0.48\textwidth] {Fig1.pdf}
\caption{ (a) An example of an image with multiple labels, which are listed in the middle. (b) We observe that different labels may correspond to various image subregions, but not necessarily the whole image, such as the labels \emph{clouds}, \emph{sun}, \emph{bird} are associated with the subregions in the bounding boxes.}
\label{FigIntro}
\vspace{-5pt}
\end{figure}
Although visual-semantic embedding models have shown impressive preliminary results on visual tasks for images with single labels, no attempts have been made on optimizing it for multi-label classification (or annotation) problem. And it is of great importance to develop such a model due to the following reasons. Firstly, real-world images are often associated with multiple description labels. Existing visual-semantic embedding models are developed for single-label images only. Secondly, it is nontrivial to extend a single-label visual-semantic embedding model to a multi-label one. The implicit assumption that all image labels correspond to the whole image does not hold for multi-label cases. For a typical multi-label image, some labels may correspond to image subregions, instead of the whole image. For example, as shown in Fig.\ref{FigIntro}, only the scene label \emph{sunrise} corresponds to the whole image, and all other label concepts correspond to specific subregions in the image as shown in the bounding boxes.
To address these problems, we present Multi-Instance visual-semantic Embedding model (MIE) to embed images with single or multiple labels. To this end, we learn an embedding model that discovers and maps semantically-meaningful image subregions to their corresponding labels in the semantic space. To automatically generate semantically-meaningful regions for each label, we utilize region proposals method \cite{GOPECCV14} to construct the image subregion set. Then, we infer the best-matching region for each label jointly to build region-to-label correspondence. This model allows us to avoid embedding an image to distant labels, and generate a image subregion ``instance" for each label concept as best as it can.
The effectiveness of our model is evaluated on two tasks. In the multi-label image annotation task, our model can correctly annotate images with multiple labels (which outperforms state-of-the-art method by 4.5\%) and discover the semantically-meaningful subregion associated with each label (which is a distinct advantage of our method). And for the zero-shot learning task, the superiority of our model is further validated by comparing with the baseline embedding model on new category classification.
\vspace{-1pt}
\section{Related Work}
We briefly outline connections and differences to three related lines of research.
\vspace{5pt}
\noindent \textbf{Multi-modal Embedding models}
\vspace{2pt}
Multi-modal embedding models relate information from multiple sources, such as images and texts.
Attributes are a common way to encode the presence and absence of a set of visual properties within an object instance. In attribute-based approaches \cite{attribute1, relativeattr11}, the semantic space was constructed by representing each class label by a vector of attributes. WSABIE \cite{wsabie11} proposed a loss function specifically designed for image annotation task to embed images with the associated multiple labels together. While these embedding approaches effectively capture richer label information than multi-class classifiers, they have not demonstrated the effectiveness of scaling to very large-scale cases.
To address this problem, visual-semantic embedding models \cite{DeviSE, NoriuziICLR14} were proposed. By leveraging the plenty textual data available on the Internet, scalable and lexically distributed representations of words were learned to capture the semantic meaning among them, \emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot, word2vec model \cite{Word2VecNIPS13} and Glove model \cite{glove14}. Thus, instead of manually designing the semantic label space, Frome $et\ al.$ \cite{DeviSE} and Norouzi $et\ al.$ \cite{NoriuziICLR14} leveraged such semantic information to learn visual-semantic embedding where semantic relationship between labels was preserved.
Although those visual-semantic embedding models have shown good scalability on the ImageNet-size dataset with single label, they are not applied to images with multiple labels which is typical for automatic image annotation.
\vspace{5pt}
\noindent \textbf{Multi-label image annotation}
\vspace{1pt}
Early work for multi-label image annotation focused on learning statistical models based on hand-crafted features, including sparse coding \cite{JianchaoCVPR09}, fisher vectors \cite{FisherVectorCVPR07}, bag-of-words \cite{ChenBOWCVPR12}, etc. For instance, Makadia $et\ al.$ \cite{MakadiaECCV08} and Guillaumin $et\ al.$ \cite{Tagprop09} proposed nonparametric nearest-neighbor methods to transfer image labels. WSABIE \cite{wsabie11} demonstrated superior results with a WARP loss based on bag-of-words feature.
Recently, as the learned image representation using deep convolutional neural network (CNN) has shown superior accuracy in various vision tasks \cite{LecunNIPS90, Alexnet12, visualCNN14, googlenet15, vggnet15, fastrcnn15}, Gong $et\ al.$ \cite{YunchaoICLR14} applied the CNN architecture to the multi-label image annotation problem and achieved the state-of-the-art performance.
\vspace{4pt}
\noindent \textbf{Zero-shot learning}
\vspace{2pt}
Zero-shot learning is commonly used to evaluate the scalability of a system w.r.t. the number of categories, \emph{i.e}\onedot} \def\Ie{\emph{I.e}\onedot, annotating images with new labels corresponding to previously unseen object categories.
Early work \cite{marknips09, marcuscvpr11} attempted to solve this problem relying on additional curated semantic information, \emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot, \cite{marknips09} used a knowledge base containing descriptions for each class and \cite{marcuscvpr11} used the WordNet hierarchy. Recently, various methods were proposed to learn semantic representation directly from unannotated text data, \emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot, visual-semantic embedding models \cite{DeviSE, NoriuziICLR14} and Socher $et\ al.$\cite{sochernips13}.
\section{Preliminary on Visual-Semantic Embedding}
We first review the preliminary on visual-semantic embedding and introduce our baseline model.
Given a multi-label image dataset $\mathcal{D}\equiv\{(x_i,{{\mathbf{y}}}_i)\}_{i=1}^N$, where each image is represented by a $d$-dimensional feature vector (\emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot, a CNN layer output), \emph{i.e}\onedot} \def\Ie{\emph{I.e}\onedot, $x_i\in \mathbb{R}^d$, and a set of class labels, ${{\mathbf{y}}}_i=(y_i^1,...,y_i^t)$, where the label set size $t$ ($t\geq1$) can be varied across images. For generality we denote $\mathcal{X}\stackrel{def}{=}\mathbb{R}^d$. Previous methods formulate the multi-label image classification or annotation problem as multi-class classification, which predefines a fixed set of class labels, \emph{i.e}\onedot} \def\Ie{\emph{I.e}\onedot, $y_i^l\in \mathcal{Y}\equiv\{1,...,m\}$, and learns an $m$-way classifier or $m$ one-against-all classifiers that classifies images into training labels $(\mathcal{X}\to\mathcal{Y})$.
\begin{figure*}
\centering
\includegraphics[width=0.9\textwidth] {Fig2.pdf}
\caption{ Illustration of our Multi-Instance visual-semantic Embedding model, which is composed of two steps: (a) extract image subregion features; (b) embed each semantically-meaningful image subregion into nearby position of its corresponding label in the semantic space (the red symbols illustrate the embedding of text labels, and symbols of other colors indicate that of different image subregions.). Note: the bounding boxes are for visualization only, and they are not provided in training, better viewed in color. }
\label{Fig2}
\vspace{-10pt}
\end{figure*}
However, this standard classification models lack scalability w.r.t. the number of class labels, and needs to be retrained when any new label emerges. Recently, visual-semantic embedding models \cite{DeviSE} were proposed to overcome this issue for single-label image classification, \emph{i.e}\onedot} \def\Ie{\emph{I.e}\onedot, instead of defining image labels as a discrete set $\mathcal{Y}$, it aims to learn a continuous semantic space $\mathcal{S}$ which captures the semantic relationship among labels and explicitly learn the mapping function from images to such a space $(\mathcal{X}\to\mathcal{S})$. A training dataset $\{(x_i,s({{\mathbf{y}}}_i))\}$ is constructed to learn an embedding function $f: \mathcal{X}\to\mathcal{S}$ that aims to map $x_i$ to $s({{\mathbf{y}}}_i)$ where $s: \mathcal{Y} \to \mathcal{S}$.
Thus, there are two main problems to explore for a visual-semantic embedding model: 1) how to construct the continuous semantic space $\mathcal{S}$ of image labels; and 2) how to learn the embedding function $f$.
\subsection{Constructing the semantic label space}
\label{glovesec}
The skip-gram text modeling architecture \cite{Word2VecNIPS13, glove14} trained with unannotated text data from the Internet has been demonstrated to provide semantically-meaningful embedding features for text terms. This method is able to learn similar embedding points for semantically related words because of the fact that synonyms are more likely to appear in similar semantic contexts.
Thus, we utilize the Glove model \cite{glove14} to construct a 300-d text label space $\mathcal{S}$ which embodies the semantic relationship among text labels.
\subsection{Our ranking loss baseline model}
\label{LearnEmbeddingF}
The embedding function for an image-label pair, $f: \mathcal{X}\to\mathcal{S}$, is typically learned with a $L_2$ or a ranking loss function. These loss functions are designed such that, for a given image, its projected point is encouraged to be closer to its corresponding label in the embedding space.
Motivated by the success of the ranking loss in visual-semantic embedding \cite{DeviSE} and multi-label annotation \cite{YunchaoICLR14}, we construct our baseline with the following pairwise hinge-ranking loss:
\vspace{-17pt}
\begin{small}
\begin{equation}
l_{\text{rank}}(x_i,{{\mathbf{y}}}_i)=\!\sum_{j\in \mathcal{T}_+}\sum_{k\in \mathcal{T}_-} \max\left(0, m\!+\!D_{f(x_i),y_j}\!-\!D_{f(x_i),y_k}\right)\!,
\label{Rankingloss}
\end{equation}
\end{small}
$\!\!$\noindent where $f(\cdot)$ is the embedding function to be learned, $m$ is the margin. For simplicity of notations, we use $y$ instead of $s(y)$ to denote the label vector in $\mathcal{S}$. $\mathcal{T}_+$ and $\mathcal{T}_-$ denote the set of positive labels and negative labels, and $\{y_j\}_{j\in \mathcal{T}_+}$ and $\{y_k\}_{k\in \mathcal{T}_-}$ denote the positive and negative label vectors, respectively. $D_{f(x_i),y_j}$\footnote{\label{note1}In this paper we use squared Euclidean distance to measure distance in the embedding space , \emph{i.e}\onedot} \def\Ie{\emph{I.e}\onedot, $D_{f(x_i), y_j}=||f(x_i)-y_j||^2_2$.} indicates the distance between the image embedding vector $f(x_i)$ and a label vector $y_j$.
\section{Multi-Instance Visual-Semantic Embedding}
\vspace{-3pt}
Our baseline model presented in Eq.\ref{Rankingloss} is seemingly plausible for multi-label image embedding where each training image is associated with multiple labels. However, there is a problem. Each image $x_i$ may correspond to multiple labels in ${{\mathbf{y}}}_i$, but one or more pairs of those labels could be located far away from others in the embedding space $\mathcal{S}$, as shown in Fig.\ref{Fig2}. Trying to push the embedding of a whole image, $f(x_i)$, to be close to multiple distant locations will confuse the embedding function; in the worst case, the image could be mapped to near average position of those label vectors, which might correspond to a totally different concept.
The key observation for overcoming this problem is that different image labels often correspond to different regions in the image. For example, in Fig.\ref{Fig2}, the image has four labels \emph{sunrise}, \emph{clouds}, \emph{sun}, and \emph{bird}. Among them only \emph{sunrise} corresponds to the whole image and other labels correspond to image subregions shown in the bounding boxes. This motivates us to derive a new idea for multi-label embedding in which one can generate multiple different crops (or region proposals) from the image and use the resulting subregion set to match the set of labels in the embedding space. This requires a region-to-label correspondence to be constructed on-the-fly during the learning process.
\vspace{-1pt}
\subsection{Modeling region-to-label correspondence}
\vspace{-1pt}
Based on the above motivation, we propose Multi-Instance visual-semantic Embedding (MIE) to discover the semantically-meaningful image subregions for each label and map them to their corresponding labels in semantic space respectively, as shown in Fig.\ref{Fig2}. The basic loss function to learn MIE embedding is defined as follows (we will improve it in Eq.\ref{MIEloss2}):
\vspace{-8pt}
\begin{small}
\begin{equation}
{l_{\text{MIE}}}(x_i,{{\mathbf{y}}}_i)=\!\!\!\sum_{j\in \mathcal{T}_+}\sum_{k\in \mathcal{T}_-} \max(0, m+\min_{c\in \mathcal{C}}D_{f(x_i^c),y_j}\!-\min_{c\in \mathcal{C}}D_{f(x_i^c),y_k}),
\vspace{-1pt}
\label{MIEloss}
\end{equation}
\end{small}
$\!\!$\noindent where $x_i^c$ indicates a subregion of image $x_i$, $\mathcal{C}$ is the set of all image subregions (we will discuss how to obtain $\mathcal{C}$ in Section \ref{learnMIE}), $\{y_j\}_{j\in \mathcal{T}_+}$ and $\{y_k\}_{k\in \mathcal{T}_-}$ denote the positive and negative label vectors, and $D_{f(x_i^c), y_j}$\cref{note1} indicates the distance between $f(x_i^c)$ and $y_j$.
As shown in the equation, we simply model the region-to-label correspondence by a $\min$ operation on the distances from a label to all the subregions. This follows our intuition that: 1) each ground truth label should be encouraged to have at least one matching subregion to explain the concept; 2) the subregion with the closest distance to a label is more likely to represent the label.
\subsection{Optimizing the ranking}
\label{rankoptimize}
However, as stated in \cite{wsabie11}, one limitation of the loss function in Eq.\ref{MIEloss} is that it does not directly optimize the ranking of the predicted labels (instead it optimizes the area under the ROC curve). In order to optimize the ranking of labels, we need to encourage positive (ground truth) labels to have smaller min-distance than most negative labels, \emph{i.e}\onedot} \def\Ie{\emph{I.e}\onedot, to rank the positive labels on the top of the prediction list. Thus, following \cite{wsabie11}, we give larger penalties to false predictions of ranking positive labels at the bottom, as follows:
\vspace{-18pt}
\begin{small}
\begin{equation}
\begin{split}
&\widehat{l_{\text{MIE}}}(x_i,{{\mathbf{y}}}_i)=\\ &\!\!\!\!\sum_{j\in \mathcal{T}_+}\sum_{k\in \mathcal{T}_-}\!\!w(r_j)\cdot \max(0, m+\min_{c\in \mathcal{C}}D_{f(x_i^c),y_j}\!-\min_{c\in \mathcal{C}}D_{f(x_i^c),y_k}),
\label{MIEloss2}
\end{split}
\end{equation}
\end{small}
$\!\!$\noindent where $w(\cdot)$ is a weight function defined below, and $r_j$ is the rank of a ground truth label $y_j$ in the prediction:
\vspace{-10pt}
\begin{small}
\begin{equation}
r_j = \sum_{t\neq j} \mathbbm{1}\left(\min_{c\in \mathcal{C}}D_{f(x_i^c),y_t} \leq \min_{c\in \mathcal{C}}D_{f(x_i^c),y_j}\right),
\label{rankdefine}
\end{equation}
\end{small}
$\!\!\!$\noindent where $\mathbbm{1}(\cdot)$ is the indicator function. As we see, given an image $x_i$, we rank a predicted label $y_t$ according to its distance to all image subregions, \emph{i.e}\onedot} \def\Ie{\emph{I.e}\onedot, $\min_{c\in \mathcal{C}}D_{f(x_i^c),y_t}$. And we define the weight function $w(\cdot)$ in Eq.\ref{MIEloss2} as follows:
\vspace{-3pt}
\begin{small}
\begin{equation}
w(r) = \begin{cases}
1&\ \ \ \ \mbox{if\ $r< \#(\mathcal{T}_+)$,} \\
r&\ \ \ \ \mbox{otherwise}.
\end{cases}
\label{weightdefine}
\end{equation}
\end{small}
Given an image with $\#(\mathcal{T}_+)$ ground truth labels, if a ground truth label is ranked within top-$\#(\mathcal{T}_+)$ in the prediction list, we give small penalty weights to the loss. While if a ground truth label is not ranked top, \emph{i.e}\onedot} \def\Ie{\emph{I.e}\onedot, $r_j\geq\#(\mathcal{T}_+)$, we assign much larger weight to it. The intuition for the weighting scheme of ranking optimization in Eq.\ref{MIEloss2} is that it pushes the positive labels to the top, thus pushing meaningful image subregions map closer to their corresponding ground truth labels in the embedding space.
\subsection{Learning multi-instance embedding}
\label{learnMIE}
In the following, we introduce our overall MIE training architecture and explain how we construct $\mathcal{C}$.
\vspace{7pt}
\noindent \textbf{MIE network architecture}
\vspace{3pt}
Fig.\ref{Fig3} illustrates the overall network architecture of the MIE model.
As discussed in Section \ref{glovesec}, we utilize the Glove model \cite{glove14} to obtain 300-d text features ${{\mathbf{y}}}_i$. And we adopt fully convolutional layers of pretained Googlenet \cite{googlenet15} (including convolution, pooling, and inception layers) to extract 1024-d image features $x_i$\footnote{In principal, MIE can be applied to any image, text representations.}. To learn the embedding from image to semantic space, \emph{i.e}\onedot} \def\Ie{\emph{I.e}\onedot, $f: \mathcal{X}\to\mathcal{S}$, a fully connected layer is used following the image feature output. Then, $L_2$ normalization layers are added on both image and text embedding vectors, which makes the embeddings of image and text modalities comparable (we tested MIE without the normalization layers and the results were worse). Finally, we add the MIE loss layer on the top to guide the training.
In our MIE model, we need to extract image features for many image subregions within the image, $x_i^c$. For efficiency, we follow the Fast RCNN \cite{fastrcnn15} scheme to extract image subregion features. Namely, given an image $x_i$ and the regions of interests (RoI) $\mathcal{C}$, we pass the image through the fully convolutional network only once, and each subregion $c\in \mathcal{C}$ is pooled into a fixed-size feature map to obtain the final feature vector $x_i^c$.
\vspace{7pt}
\begin{figure}
\centering
\includegraphics[width=0.5\textwidth] {Fig3.pdf}
\caption{ The deep network architecture of MIE model composed of 4 components: (a) subregion (RoI) image features extraction; (b) image features embedding; (c) text features embedding; (d) joint embedding learning guided by the MIE loss layer.}
\label{Fig3}
\end{figure}
\noindent \textbf{MIE subregion set construction}
\vspace{3pt}
Note that we do not have bounding box annotations for training, thus an essential problem of our MIE model is how to construct the image subregion set $\mathcal{C}$. Inspired by the recent object-proposal-based methods \cite{RCNN14, fastrcnn15} in object detection, we construct the set using a state of the art region proposals method \cite{GOPECCV14} followed by post-processing.
Since semantically-meaningful subregions of an image do not necessarily contain objects, general object proposal methods that focus on foreground are not suitable here, especially the ones depend on edge information. Hence we use geodesic object proposals \cite{GOPECCV14} since they cover both foreground and background regions reasonably well. Finally, we post-process the subregions to discard regions of too small size or extreme aspect ratio (in our experiments we constraint the subregions' side length to be at least 0.3 of the image and the extreme aspect ratio to be 1:4 or 4:1).
\subsection{Inference with multi-instance embedding}
\label{inference}
Given the trained MIE model, now we introduce how to do inference on a new test image $x^\prime$.
Firstly, the subregion set $\mathcal{C}^\prime$ is constructed by \cite{GOPECCV14} and post-processing. Secondly, we pass $x^\prime$ and $\mathcal{C}^\prime$ through our MIE network to obtain the embedding vectors, $f(x^{\prime c})$. Then, for any text labels $y^\prime$ in the embedding space $\mathcal{S}$, the distance between image $x^\prime$ and $y^\prime$ is computed by $\min_{c\in \mathcal{C^\prime}}D_{f(x^{\prime c}),y^\prime} $. Finally, the corresponding labels of an image is selected according to the distance ranking list. In addition, given a predicted label $y^*$, we can locate the corresponding image subregion $c^*$, \emph{i.e}\onedot} \def\Ie{\emph{I.e}\onedot, $c^*=\operatornamewithlimits{argmin}_{c\in\mathcal{C}}D_{f(x_i^c), y^*}$.
Intuitively, in our inference stage, we embed image subregions into the semantic space. And if there is any subregion close enough to a text label, we reckon that this label is associated with the image since there is a corresponding subregion that interprets the label concept, thus such label can be assigned to the image.
\section{Experiments}
To evaluate the proposed model, we conduct experiments on two tasks: multi-label image annotation and zero-shot learning.
\subsection{Datasets and implementation details}
For the task of multi-label image annotation, we test on the largest publicly available multi-label image dataset, NUS-WIDE \cite{nuswide09}. This dataset contains 209,347 images from Flickr that have been manually annotated. We follow the train-test split of \cite{YunchaoICLR14} to use a subset of 150,000 images for training and the rest for testing. The label dictionary of this dataset contains 81 different labels.
For the task of zero-shot learning, we train our model on NUS-WIDE dataset and test it on the validation images of Places205 dataset \cite{Places205}. We test on 197 classes which are not included in NUS-WIDE (we exclude the images from 8 classes, \emph{i.e}\onedot} \def\Ie{\emph{I.e}\onedot, \emph{bridge}, \emph{castle}, \emph{harbor}, \emph{mountain}, \emph{ocean}, \emph{sky}, \emph{tower}, and \emph{valley}, since they are included in NUS-WIDE), and there are 100 validation images per class.
We use Caffe \cite{caffe14} to implement our model. The optimization of our network is achieved by stochastic gradient descent
with a momentum term of weight 0.9 and with mini-batch size of 100. The initial learning rate is set to 0.1, and we update it with the ``steps" policy. A weight decay of 0.0005 is applied.
\subsection{Experiments on multi-label image annotation}
For the task of multi-label image annotation, CNN-based method \cite{YunchaoICLR14} recently reported state-of-the-art performance in NUS-WIDE. Thus we follow the evaluation protocols in \cite{YunchaoICLR14} to evaluate our performance.
\begin{table*}
\centering
\small
\rowcolors{2}{}{gray!35}
\begin{tabular}{ c | c c c c c }
\toprule[0.2 em] %
method& per-class recall & per-class precision & overall recall & overall precision & $N_+$ \\
\midrule
Upper bound & 97.00&44.87&82.76&66.49&100.00 \\
\midrule
CNN + Ranking\cite{YunchaoICLR14} &26.83&31.93 & 58.00& 46.59& 95.06 \\
CNN + WARP\cite{YunchaoICLR14} & 35.60& 31.65& 60.49 & 48.59& 96.29\\
\midrule
Embed + Ranking &31.59&34.75 &60.26 &49.17 & 98.77\\
MIE + 36 subregions w/o Rank Optimization& 34.71&35.92 &61.87 & 50.53& 98.77\\
MIE w/o Rank Optimization & 38.90&\bf{37.87} & 63.12& 51.55& 98.77\\
MIE Full Model & \bf{40.15}& 37.74& \bf{65.03}& \bf{52.23}&\bf{100.00} \\
\bottomrule[0.1 em]
\end{tabular}
\caption{Image annotation results on NUS-WIDE with $k$=3 annotated labels per image. See Sec. \ref{Quantitative1} for the definition of ``Upper bound".}
\label{Exp1Tb1}
\end{table*}
\begin{table*}
\centering
\small
\rowcolors{2}{}{gray!35}
\begin{tabular}{ c | c c c c c }
\toprule[0.2 em] %
method& per-class recall & per-class precision & overall recall & overall precision & $N_+$ \\
\midrule
Upper bound & 99.57&28.83&96.40&46.22&100.00 \\
\midrule
CNN + Ranking\cite{YunchaoICLR14} &42.48&22.74 & 72.78& 35.08& 97.53 \\
CNN + WARP\cite{YunchaoICLR14} & 52.03& 22.31& 75.00 & 36.16& \bf{100.00}\\
\midrule
Embed + Ranking & 50.25&26.08 & 75.62& 36.94&98.77\\
MIE + 36 subregions w/o Rank Optimization & 53.92&26.83 &76.81 & 37.78&\bf{100.00}\\
MIE w/o Rank Optimization & 57.79 & 28.19& 79.16& 38.14 &\bf{100.00}\\
MIE Full Model & \bf{59.81}& \bf{28.26}& \bf{80.94}&\bf{39.00} & \bf{100.00}\\
\bottomrule[0.1 em]
\end{tabular}
\caption{Image annotation results on NUS-WIDE with $k$=5 annotated labels per image. See Sec. \ref{Quantitative1} for the definition of ``Upper bound".}
\label{Exp1Tb2}
\vspace{-5pt}
\end{table*}
\begin{figure*}
\centering
\includegraphics[width=0.99\textwidth] {Fig4.pdf}
\caption{ The image annotation results and the discovered image region associated with each label using our method. The first three rows show correct results and the last row shows two failed cases. The predicted labels are listed according to the ranking (We show top-3 predictions if the number of ground truth labels is smaller than or equal to 3, otherwise we show top-5 predictions.). The ground truth labels (GT) are listed according to alphabetic order. Better viewed in color.}
\label{Fig4}
\end{figure*}
\subsubsection{Evaluation Protocols}
\label{Exp1Metric}
For each image, we assign $k$ (e.g., $k$ = 3, 5) highest-ranked labels to the image and compare
the assigned labels to the ground-truth labels. We compute the recall and precision for each label separately, and then report the per-class recall and per-class precision:
\vspace{-10pt}
\begin{small}
\begin{equation}
\text{per-class recall} = \frac{1}{t}\sum_{i=1}^t\frac{N_i^c}{N_i^g},\ \ \ \text{per-class precision} = \frac{1}{t}\sum_{i=1}^t\frac{N_i^c}{N_i^p}, \nonumber
\label{metric1}
\end{equation}
\end{small}
$\!$\noindent where $t$ is the total number of labels, $N_i^c$ is the number of correctly annotated image for label $i$, $N_i^g$ is the number of ground-truth labeling for label $i$, and $N_i^p$ is the number of predictions for label $i$. The above evaluations are biased toward infrequent labels, because making them correct would have a very significant impact on the final accuracy. Therefore we also report the overall recall and overall precision:
\vspace{-15pt}
\begin{small}
\begin{equation}
\text{overall recall} = \frac{\sum_{i=1}^tN_i^c}{\sum_{i=1}^tN_i^g},\ \ \ \text{overall precision} =\frac{\sum_{i=1}^tN_i^c}{\sum_{i=1}^tN_i^p}, \nonumber
\label{metric1}
\end{equation}
\end{small}
Finally, the percentage of recalled labels in all labels is also evaluated, represented as $N_+$. We believe that evaluating all of these 5 metrics makes the evaluation less biased and thorough.
\subsubsection{Quantitative results}
\label{Quantitative1}
To better justify the superiority of our method for modeling the region-to-label correspondence and optimizing the ranking, we test our MIE model with four variants: I) ``Embed + Ranking" which represents our ranking loss embedding baseline defined in Section \ref{LearnEmbeddingF}; II) ``MIE + 36 subregions w/o Rank Optimization" where the subregion set is constructed manually by selecting subregions with minimum side length as 2, in the 4$\times$4 rigidly defined image grid (totally 36 such subregions) and rank optimization in Section \ref{rankoptimize} is not included; III) ``MIE w/o Rank Optimization" as defined in Eq.\ref{MIEloss}, which uses region proposals method \cite{GOPECCV14} to construct subregion set but does not include rank optimization; IV) ``MIE Full Model" that represents our full model in Eq.\ref{MIEloss2} with region proposals and the rank optimization scheme.
And we also compare our method with two models in \cite{YunchaoICLR14}: 1) ``CNN + Ranking" which represents their ranking loss baseline; 2) ``CNN + WARP" that represents their WARP loss model which is the state-of-the-art model in multi-label image annotation.
We evaluate the performance w.r.t. the number of predicted labels $k$, and the results with $k=3$, $k=5$ are shown in Table \ref{Exp1Tb1}, \ref{Exp1Tb2}, respectively.
In the first row of Table \ref{Exp1Tb1} and \ref{Exp1Tb2}, we list the ``Upper bound" results. Because in NUS-WIDE, each image has different number of ground-truth labels. Thus, we follow \cite{YunchaoICLR14} to define the ``upper bound" method: for each image, when the number of ground-truth labels is larger than $k$, we randomly choose $k$ ground-truth labels and assign them to the image; when the number of ground-truth labels is smaller than $k$, we assign all ground-truth labels to the image and randomly pick other labels to include. This method represents the ``upper bound" performance.
Our ``Embed + Ranking" baseline and the ``CNN + Ranking" baseline in \cite{YunchaoICLR14} are comparable since ranking loss is used in both methods. As we see, in the second and fourth rows of the Tables, ``Embed + Ranking" outperforms ``CNN + Ranking" by 3.23\% averaged in all metrics for $k=3$ and 3.41\% for $k=5$. One reason for this is we use Googlenet to obtain image features and \cite{YunchaoICLR14} used Alexnet.
Thus, for fair comparison, we compare with our ranking loss baseline ``Embed + Ranking" model. Overall, our ``MIE Full Model" outperforms the ``Embed + Ranking" baseline by 4.12\% averaged in all metrics for $k=3$ and 4.07\% for $k=5$. Several factors may contribute to such improvement.
We compare various variants of our method and the ``Embed + Ranking" model to justify the contribution of several key components we proposed. Firstly, ``MIE w/o Rank Optimization" introduces the idea of modeling region-to-label correspondence. As shown in the sixth row of the Tables, it outperforms ``Embed + Ranking" baseline by 3.13\% for $k=3$ and 3.12\% for $k=5$, which validates the contribution of modeling region-to-label correspondence. Then, by considering rank optimization, our ``MIE Full Model" further boost the performance of ``MIE w/o Rank Optimization" by 0.99\% for $k=3$ and 0.95\% for $k=5$. Besides, the effectiveness of constructing image subregion set using region proposals method is evaluated. In the fifth and sixth rows of the Tables, we compare the method with region proposals to the one that manually generates subregions, which shows an improvement of 1.68\% for $k=3$ and 1.59\% for $k=5$.
And finally, our ``MIE Full Model" outperforms the state-of-the-art method ``CNN + WARP" in all metrics by a large margin, of 4.51\% averaged over 5 metrics for $k=3$ and 4.50\% for $k=5$.
\subsubsection{Qualitative results}
As discussed in Section \ref{inference}, our model is able to discover the image regions corresponding to the predicted labels, \emph{i.e}\onedot} \def\Ie{\emph{I.e}\onedot, for a predicted label $y^*$, $c^*=\operatornamewithlimits{argmin}_{c\in\mathcal{C}}D_{f(x_i^c), y^*}$ is its corresponding region.
In Fig.\ref{Fig4}, we show the image annotation result, as well as the localized corresponding region for each predicted label. The first three rows show some good annotation cases that most of the ground truth labels are correctly predicted. As we see, for these images, the correctly predicted labels are associated with reasonable regions, such as \emph{Sky} of the upper left image, \emph{Window} of the upper right image, \emph{Person} of the middle left image, \emph{Animals} of the middle right image, \emph{Road} of the lower left image, and \emph{Grass} of the lower right image, \emph{etc}\onedot} \def\vs{\emph{vs}\onedot., are reasonably discovered by the associated bounding boxes. There are some wrong annotations or inaccurate bounding boxes as well. For instance, the middle right image are annotated with \emph{Plants}. But if we look at the bounding box of \emph{Plants}, the subregion interprets the label concepts well. The same case happens in the last row of Fig.\ref{Fig4} where two failed cases are shown. Even the predicted \emph{Buildings} of the left image and \emph{Sunset} of the right image are not included in the ground truth labels, the subregions in the bounding boxes interpret the predicted labels very well. It is important to note that our task is not detection and no bounding box annotation is provided in training. Thus, some objects are not tightly bounded by the boxes, \emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot, \emph{Animals} of the right image in the second row. Overall, our method is able to correctly annotate images with labels, and more importantly, the semantic region associated with each label can be located, which is a distinct advantage of our method over existing multi-label annotation methods.
\begin{figure*}
\centering
\includegraphics[width=0.99\textwidth] {Fig5.pdf}
\caption{ Zero-shot test images from Places205, and their corresponding top-5 labels predicted by MIE Full Model and Embed + Ranking baseline model. All the labels predicted are not seen during training stage for both models. The correct labels are shown in blue. The semantically-meaningful image subregion associated with each correctly predicted label are shown in green bounding boxes.}
\label{Fig5}
\end{figure*}
\subsection{Experiments on zero-shot learning}
Another distinct advantage of our model is its ability to make reasonable inferences about candidate labels
that it has never visually seen at training stage. For example, a MIE model trained on images labeled \emph{swallow}, \emph{magpie}, and \emph{woodpecker} would likely have the ability to generalize to other labels related to bird, because the language model encodes the general concept of bird which share similar visual appearance. Thus if tested on images of highly specific classes of bird which the model has never seen before, for example a photo of an \emph{pelican}, and asked whether the correct label is more likely \emph{pelican} or some other unfamiliar label, say $panda$, our model stands a fighting chance of guessing correctly because the language model ensures that the embedding of $pelican$ is closer to that of birds our model has seen, while the embedding of \emph{panda} is closer to those of mammals.
\begin{table}
\centering
\scriptsize
\rowcolors{2}{}{gray!35}
\begin{tabular}{ c | c c c c }
\toprule[0.2 em] %
method& MAP@1 & MAP@2 & MAP@5 & MAP@10 \\
\midrule
Embed + Ranking & 6.53 & 10.18 & 18.92 & 28.17 \\
MIE Full Model & \bf{7.14} & \bf{11.29} & \bf{20.50} & \bf{30.27}\\
\bottomrule[0.1 em]
\end{tabular}
\caption{Zero-shot learning results on 197 classes of Places205 dataset.}
\label{exp2table3}
\end{table}
To evaluate the scalability of our model w.r.t. the number of label categories, we train our model on NUS-WIDE dataset and use it to predict the label of images from the 197 previously unseen labels in Places205 dataset.
Fig.\ref{Fig5} depicts some qualitative results. The two columns by the side of each image show the top-5 label predictions of MIE model and the ranking loss baseline model defined in Section \ref{LearnEmbeddingF}. The superiority of visual-semantic models over classification methods in zero-shot learning has been thoroughly validated in \cite{DeviSE}. Since classification methods need to retrain the classifiers whenever a new class emerges, they could not generate to new labels. Thus we do not test with classification methods.
``MIE Full Model" and ``Embed + Ranking" are visual-semantic models that utilize information from the label semantic space, thus, as it shows, both methods predict reasonable results. Even ``Embed + Ranking" does not predict the true labels for those images, its predictions are generally semantically ``close" to the desired labels.
MIE successfully predicts a wide range of labels outside its training set. In addition, the semantically-meaningful image subregion associated with each correctly predicted label are shown in Fig.\ref{Fig5}. As we see, the localized image region interprets the label concept in some aspects. For instance, for the upper right image, \emph{attic} is semantically close to \emph{window} from the NUS-WIDE dataset, thus a window region is discovered and the semantic concept of such specific region is transferred to assist the prediction of new labels.
To quantify the performance, the mean average precision@$k$ (MAP@$k$) metric is adopted, which measures the precision of predicting the ground truth label within the top-$k$ predicted labels. The results are shown in Table \ref{exp2table3}. As we see, our MIE model outperforms ranking loss baseline model in all metrics by 1.35\% on average.
Taken together, the multi-label image annotation and zero-shot learning experiments validate the effectiveness of modeling the region-to-label correspondence and optimizing the ranking for visual-semantic embedding models. Moreover, the proposed model could be applied to various visual tasks, especially the ones related to images and texts.
\section{Conclusion and Future Work}
In this paper, we have proposed a novel multi-instance visual-semantic embedding model for general images with single or multiple labels. Instead of embedding a whole image into the semantic space, we propose to embed the semantically-meaningful image subregions to the corresponding image labels. Such an embedding space possesses superior representation and generalization power over previous methods. By experimental validation, we show that: 1) Our model not only outperforms state-of-the-art method in multi-label image annotation, but also can discover the corresponding region that interprets the concept of each image label; 2) Our model has the ability to make correct predictions across plenty of previously unseen labels by leveraging semantic knowledge elicited from the embedding space.
In the future, we would like to explore the modeling in the semantic space, and apply our model to various vision applications.
{\small
\bibliographystyle{ieee}
| {'timestamp': '2015-12-23T02:03:25', 'yymm': '1512', 'arxiv_id': '1512.06963', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06963'} | arxiv |
\section{Introduction}
We have known for centuries how to dissect any polygon $P$ into any
other polygon $Q$ of equal area, that is, how to cut $P$ into
finitely many pieces and re-arrange the pieces to form~$Q$
\cite{Frederickson-1997,Lowry-1814,Wallace-1831,Bolyai-1832,Gerwien-1833}.
But we know relatively little about how many pieces are necessary.
For example, it is unknown whether a square can be dissected into an
equilateral triangle using fewer than four pieces
\cite[pp.~8--10]{Dudeney-1902-hinged,Frederickson-2002}.
Only recently was it established that a pseudopolynomial number of
pieces suffices~\cite{FeatureSize_EGC2011f}.
In this paper, we prove that it is NP-hard even to approximate the minimum
number of pieces required for a dissection, to within some constant ratio.
While perhaps unsurprising, this result is the first analysis
of the complexity of dissection. We prove NP-hardness even when
the polygons are restricted to be simple (hole-free) and orthogonal.
The reduction holds for all cuts that leave the resulting pieces connected,
even when rotation and reflection are permitted or forbidden.
Our proof significantly strengthens the observation (originally made by the
Demaines during JCDCG'98) that the second half of dissection---re-arranging
given pieces into a target shape---is NP-hard: the special case of exact
packing rectangles into rectangles can directly simulate \textsc{3-Partition}
\cite{Jigsaw_GC}.
Effectively, the challenge in our proof is to construct a polygon for which
any $k$-piece dissection must cut the polygon at locations we desire, so that
we are left with a rectangle packing problem.
\section{The Problems} \label{sec-prob}
\subsection{Dissection}
We begin by formally defining the problems involved in our proofs, starting with \textsc{$k$-Piece Dissection}, which is the central focus of our paper.
\begin{definition}
\textsc{$k$-Piece Dissection} is the following decision problem:
\textsc{Input:} two polygons $P$ and $Q$ of equal area, and a positive integer $k$.
\textsc{Output:} whether $P$ can be cut into $k$ pieces such that these $k$ pieces can be packed into $Q$ (via translation, optional rotation, and optional reflection).
\end{definition}
To prevent ill-behaved cuts, we require every piece to be a \emph{Jordan region (with holes)}: the set of points interior to a Jordan curve $e$ and exterior to $k \geq 0$ Jordan curves $h_1, h_2, \dots, h_k$, such that $e, h_1, h_2, \dots, h_k$ do not meet.
There are two properties of Jordan regions that we use in our proofs. First, Jordan regions are Lebesgue measurable; we will refer to the Lebesgue measure of each piece as its area. Second, a Jordan region is path-connected. For brevity, we refer to path-connected as connected throughout the paper.
Next we define the optimization version of the problem, \textsc{Min Piece Dissection}, in which the objective is to minimize the number of pieces.
\begin{definition}
\textsc{Min Piece Dissection} is the following optimization problem:
\textsc{Input:} two polygons $P$ and $Q$ of equal area.
\textsc{Output:} the smallest positive integer $k$ such that $P$ can be cut into $k$ pieces such that these $k$ pieces can be packed into $Q$.
\end{definition}
\subsection{5-Partition}
Our NP-hardness reduction for \textsc{$k$-Piece Dissection} is from
\textsc{5-Partition}, a close relative of \textsc{3-Partition}.
\begin{definition}
\textsc{5-Partition} is the following decision problem:
\textsc{Input:} a multiset $A = \{a_1, \dots, a_n\}$ of $n = 5m$ integers.
\textsc{Output:} whether $A$ can be partitioned into $A_1, \dots, A_m$ such that, for each $i = 1, \dots, m$, $\sum_{a \in A_i} a = p$ where $p = \left(\sum_{a \in A} a \right)/m$.
\end{definition}
Throughout the paper, we assume that the partition sum $p$ is an integer; otherwise, the instance is obviously a \textsc{No} instance.
Garey and Johnson~\cite{Garey-Johnson-1975} originally proved NP-completeness of \textsc{3-Partition}, a problem similar to \textsc{5-Partition} except that 5 is replaced by 3. In their book~\cite{Garey-Johnson-1979}, they show that \textsc{4-Partition} is NP-hard; this result was, in fact, an intermediate step toward showing that \textsc{3-Partition} is NP-hard. It is easy to reduce \textsc{4-Partition} to \textsc{5-Partition} and thus show it also NP-hard.\footnote{Given a \textsc{4-Partition} instance $A = \{a_1, \dots, a_n\}$, we can create a \textsc{5-Partition} instance by setting $A' = \{na_1, \dots, na_n, 1, \dots, 1\}$ where the number of $1$s is $n/4$.}
Our reduction would work from 3-Partition just as well as 5-Partition. The advantage of the latter is that we can analyze the following optimization version.
\begin{definition}
\textsc{Max 5-Partition} is the following optimization problem:
\textsc{Input:} a multiset $A = \{a_1, \dots, a_n\}$ of $n = 5m$ integers.
\textsc{Output:} the maximum integer $m'$ such that there exist disjoint subsets $A_1, \dots, A_{m'}$ of $A$ such that, for each $i = 1, \dots, m'$, $\sum_{a \in A_i} a = p$ where $p = \frac{5}{n}\left(\sum_{a \in A} a \right)$.
\end{definition}
\subsection{4-Dimensional Matching}
While \textsc{5-Partition} is known to be NP-hard, we are not aware of any results on the hardness of approximating \textsc{Max 5-Partition}. We derive the result ourselves by reducing from \textsc{4-Uniform 4-Dimensional Matching} (\textsc{4DM}).
\begin{definition}
\textsc{4-Uniform 4-Dimensional Matching} (or \textsc{4DM}) is the following optimization problem:
\textsc{Input:} a 4-uniform 4-partite balanced hypergraph $H = (V^1, V^2, V^3, V^4, E)$.
\textsc{Output:} a matching of maximum size in $H$, i.e., a set $E' \subseteq E$ of maximum size such that none of the edges in $E'$ share the same vertex.
\end{definition}
Hazan, Safra, and Schwartz~\cite{Hazan-Safra-Schwartz-2003} proved inapproximability of \textsc{4-Uniform 4-Dimensional Matching}. We use this to prove hardness of approximating \textsc{Max 5-Partition}, which we then reduce to \textsc{Min Piece Dissection} to establish the hardness of its approximation.
\subsection{Gap Problems}
We show that our reductions have a property stronger than approximation preservation called \emph{gap preservation}.
Let us define the gap problem for an optimization problem, a notion widely used in hardness of approximation.
\begin{definition}
For an optimization problem $P$ and parameters $\beta > \gamma$ (which may be functions of $n$), the \textsc{Gap}$_P[\beta, \gamma]$ problem is to distinguish whether the optimum of a given instance of $P$ is at least $\beta$ or at most $\gamma$. The input instance is guaranteed to not have an optimum between $\beta$ and $\gamma$.
\end{definition}
If \textsc{Gap}$_P[\beta, \gamma]$ is NP-hard, then it immediately follows that approximating $P$ to within a factor of $\beta/\gamma$ of the optimum is also NP-hard. This result makes gap problems useful for proving hardness of approximation.
\section{Main Results}
Now that we have defined the problems, we state our main results.
\begin{theorem} \label{thm-main}
\textsc{$k$-Piece Dissection} is NP-hard.
\end{theorem}
We do not know whether \textsc{$k$-Piece Dissection} is in NP (and thus is NP-complete). We discuss the difficulty of showing containment in NP in Section~\ref{sec-open}.
We also prove that the optimization version, \textsc{Min Piece Dissection}, is hard to approximate to within some constant ratio:
\begin{theorem} \label{thm-main-approx}
There is a constant $\varepsilon_{\mathrm{MPD}} > 0$ such that it is NP-hard to approximate \textsc{Min Piece Dissection} to within a factor of $1 + \varepsilon_{\mathrm{MPD}}$ of optimal.\footnote{The best $\varepsilon_{\mathrm{MPD}}$ we can achieve is $1/1080 - \varepsilon$ for any $\varepsilon \in (0, 1/1080)$.}
\end{theorem}
Both results are based on essentially the same reduction, from \textsc{5-Partition} for Theorem~\ref{thm-main} or from \textsc{Max 5-Partition} for Theorem~\ref{thm-main-approx}. We present the common reduction in Section~\ref{sec-reduction}. We then prove Theorem~\ref{thm-main} and Theorem~\ref{thm-main-approx} in Sections~\ref{sec-proof} and~\ref{sec-proof-approx} respectively.
Restricting the kinds of polygons given as input, the kinds of cuts allowed, and the ways the pieces can be packed gives rise to many variant problems. Section~\ref{sec-variant} explains for which variants our results continue to hold.
\section{The Reduction} \label{sec-reduction}
This section describes a polynomial-time reduction from \textsc{5-Partition} to \textsc{$k$-Piece Dissection} and states a lemma crucial to both of our main proofs later in the paper. The proof of the lemma is deferred to \ifabstract Appendix\else Section\fi~\ref{sec-lem-proof}.
\paragraph{Reduction from \textsc{5-Partition} to \textsc{$k$-Piece Dissection}.} Let $A = \{a_1, \dots, a_n\}$ be the given \textsc{5-Partition} instance and let $p = \frac{5}{n}\Sigma_{a \in A} a$ denote the target sum. Let $d_s = 12 (\max_{a \in A} a + p)$ and $d_t = (n-1)d_s + \Sigma_{a \in A} a + 2\max_{a \in A} a$. We create a source polygon $P$ consisting of \emph{element rectangles} of width $a_i$ and height 1 for each $a_i \in A$ spaced $d_s$ apart, connected below by a rectangular \emph{bar} of width $\Sigma_{a \in A} a + (\frac{n}{5} - 1)d_t$ and height $\delta = \frac{1}{10\Sigma_{a \in A} a + 2(\frac{n}{5} - 1)d_t}$. The first element rectangle's left edge is flush with the left edge of the bar; the bar extends beyond the last element rectangle. Our target polygon $Q$ consists of $\frac{n}{5}$ \emph{partition rectangles} of width $p$ and height 1 spaced $d_t$ apart, connected by a bar of the same dimensions as the source polygon's bar. The first partition rectangle's left edge and last partition rectangle's right edge are flush with the ends of the bar. Both polygons' bars have the same area and the total area of the element rectangles equals the total area of the partition rectangles, so the polygons have the same area. Finally, let the number of pieces $k$ be $n$.
\begin{figure}[h]
\centering
\begin{tikzpicture}[scale=0.75]
\draw (1,0.9)--(1,1.5)--(1.6,1.5)--(1.6,1)--(5.4,1)--(5.4,1.5)--(5.9,1.5)--(5.9,1)--(6.2,1);
\draw (6.9,1)--(7.2,1)--(7.2,1.5)--(7.8,1.5)--(7.8,1)--(17,1)--(17,0.9);
\draw (1,0.9)--(6.2,0.9);
\draw (6.9,0.9)--(17,0.9);
\draw (1,1.7)--(1.6,1.7);
\draw (1,1.6)--(1,1.8);
\draw (1.6,1.6)--(1.6,1.8);
\draw (5.4,1.7)--(5.9,1.7);
\draw (5.4,1.6)--(5.4,1.8);
\draw (5.9,1.6)--(5.9,1.8);
\draw (7.2,1.7)--(7.8,1.7);
\draw (7.2,1.6)--(7.2,1.8);
\draw (7.8,1.6)--(7.8,1.8);
\draw (1.6,2)--(5.4,2);
\draw (1.6,1.9)--(1.6,2.1);
\draw (5.4,1.9)--(5.4,2.1);
\node at (6.55,0.95) {$\cdots$};
\node[above] at (1.3,1.7) {$a_1$};
\node[above] at (5.65,1.7) {$a_2$};
\node[above] at (7.5,1.7) {$a_n$};
\node[above] at (3.5,2) {$d_s$};
\draw (1,-0.8)--(1,-0.2)--(3.2,-0.2)--(3.2,-0.7)--(11.1,-0.7)--(11.1,-0.2)--(13.3,-0.2)--(13.3,-0.7)--(13.7,-0.7);
\draw (14.4,-0.7)--(14.8,-0.7)--(14.8,-0.2)--(17,-0.2)--(17,-0.8);
\draw (1,-0.8)--(13.7,-0.8);
\draw (14.4,-0.8)--(17,-0.8);
\draw (1,0)--(3.2,0);
\draw (1,-0.1)--(1,0.1);
\draw (3.2,-0.1)--(3.2,0.1);
\draw (11.1,0)--(13.3,0);
\draw (11.1,-0.1)--(11.1,0.1);
\draw (13.3,-0.1)--(13.3,0.1);
\draw (14.8,0)--(17,0);
\draw (14.8,-0.1)--(14.8,0.1);
\draw (17,-0.1)--(17,0.1);
\draw (3.2,0.3)--(11.1,0.3);
\draw (3.2,0.2)--(3.2,0.4);
\draw (11.1,0.2)--(11.1,0.4);
\node at (14.05,-0.75) {$\cdots$};
\node[above] at (2.1,0) {$p$};
\node[above] at (12.05,0) {$p$};
\node[above] at (15.9,0) {$p$};
\node[above] at (7.15,0.3) {$d_t$};
\end{tikzpicture}
\caption{The source polygon $P$ (above) and the target polygon $Q$ (below) are shown (not to scale). Length $d_t$ is longer than the distance between the leftmost edge of the leftmost element rectangle and the rightmost edge of the rightmost element rectangle.}
\end{figure}
\paragraph{Reduction from \textsc{Max 5-Partition} to \textsc{Min Piece Dissection}.} The optimization problem uses the same reduction as the decision problem, except that we do not specify $k$ for the optimization problem.
The idea behind our reduction is to force any valid dissection to cut each element rectangle off the bar in its own piece.\footnote{Because $k = n$, $a_1$ will remain attached to the bar, forcing it to be the first element rectangle placed in the first partition rectangle. Because the order of and within partitions does not matter, this constraint does not affect the \textsc{5-Partition} simulation.} When $\delta$ is small enough, the resulting packing problem is a direct simulation of \textsc{5-Partition}.
Intuitively, each dissected piece should contain only one element rectangle. Our reduction sets $d_s$ large enough that any piece containing parts of two element rectangles does not fit in a partition rectangle. At the same time, we pick $d_t$ large enough that no piece can be placed in more than one partition rectangle. Thus one could plausibly prove that each element rectangle must be in its own piece.
Unfortunately, we were unable to prove that each element rectangle must be in its own piece. For each element rectangle, we define the \emph{trimmed element rectangle} corresponding to each element rectangle as the rectangle resulting from ignoring the lower $4\delta$ of the element rectangle's height; see Figure~\ref{fig-trimmedelmrect}. In other words, for each $a_i$, the corresponding trimmed element rectangle is the rectangle that shares the upper left corner with the element rectangle and is of width $a_i$ and height $1 - 4\delta$.
\begin{figure}[h]
\centering
\begin{tikzpicture}
\draw (1,1)--(3,1)--(3,4)--(7,4)--(7,1)--(9,1);
\draw (1,0.8)--(9,0.8);
\draw (3, 1.8)--(7,1.8);
\path [fill=gray, opacity=0.2] (3,1.8) rectangle (7,4);
\draw (3,4.2)--(7,4.2);
\draw (3,4.3)--(3,4.1);
\draw (7,4.3)--(7,4.1);
\draw (7.2,1)--(7.2,4);
\draw (7.1,4)--(7.3,4);
\draw (7.1,1.8)--(7.3,1.8);
\node[above] at (5,4.2) {$a_i$};
\node[right] at (7.2,1.4) {$4\delta$};
\node[right] at (7.2,2.9) {$1 - 4\delta$};
\end{tikzpicture}
\caption{The $i$th trimmed element rectangle. \label{fig-trimmedelmrect}}
\end{figure}
While we could not prove that each element rectangle is in its own piece, we can prove the corresponding statement about trimmed element rectangles:
\begin{lemma} \label{lem-one-per-rec}
If $P$ can be cut into pieces that can be packed into $Q$, then each of these pieces intersect with at most one trimmed element rectangle.
\end{lemma}
The proofs of both of our main theorems use this lemma. The intuition behind the proof of this lemma is similar to the intuitive argument for why each element rectangle should be in its own piece. As the details of the proof are not central to this paper, we defer the proof of this lemma to \ifabstract Appendix\else Section\fi~\ref{sec-lem-proof}.
\section{Proof of NP-hardness of \textsc{$k$-Piece Dissection}} \label{sec-proof}
\iffull
Before we prove Theorem~\ref{thm-main}, we state the result from~\cite{Garey-Johnson-1979} for \textsc{5-Partition}:
\begin{theorem}[\cite{Garey-Johnson-1979}] \label{thm-5-part-hard}
\textsc{5-Partition} is NP-hard.\footnote{As stated earlier, the result from~\cite{Garey-Johnson-1979} is for \textsc{4-Partition}, but \textsc{4-Partition} is easily reduced to \textsc{5-Partition}; see Section~\ref{sec-prob}.}
\end{theorem}
\fi
We now prove Theorem~\ref{thm-main}.
\begin{proof}[of Theorem~\ref{thm-main}]
We prove that the reduction described in the previous section
is indeed a valid reduction from \textsc{5-Partition}.
The reduction clearly runs in polynomial time. We are left to prove that the instance of \textsc{$k$-Piece Dissection} produced by the reduction is a \textsc{yes} instance if and only if the input \textsc{5-Partition} is also a \textsc{yes} instance.
\paragraph{(\textsc{5-Partition}$\implies$\textsc{$k$-Piece Dissection})} Suppose that the \textsc{5-Partition} instance is a \textsc{yes} instance. Given a \textsc{5-Partition} solution, we can cut all but the first element rectangle off the bar and pack them in the partition rectangles according to the \textsc{5-Partition} solution. The piece containing the first element rectangle must be placed at the very left of the first partition rectangle, but we can reorder the partitions in the \textsc{5-Partition} solution so that the first element is in the first partition. As a result, the \textsc{$k$-Piece Dissection} instance is also a \textsc{yes} instance.
\paragraph{(\textsc{$k$-Piece Dissection}$\implies$\textsc{5-Partition})} Suppose that the \textsc{$k$-Piece Dissection} instance is a \textsc{yes} instance, i.e., $P$ can be cut into $k$ pieces that can then be placed into $Q$. By Lemma~\ref{lem-one-per-rec}, no two trimmed element rectangles are in the same piece. Because there are $n = k$ such rectangles, each piece contains exactly one whole trimmed element rectangle. Because these pieces can be packed into $Q$, we must also be able to pack all the trimmed element rectangles into $Q$ (with some space in $Q$ left over).
Let $B_i$ be the set of all trimmed element rectangles (in the packing configuration) that intersect the $i$th partition rectangle. From our choice of $d_t$, each trimmed element rectangle can intersect with at most one partition rectangle. Moreover, no trimmed element rectangles fit entirely in the bar area, so each of them must intersect with at least one partition rectangle. This means that $B_1, \dots, B_{n/5}$ is a partition of the set of all trimmed element rectangles. Let $A_i$ be the set of all integers in $A$ corresponding to the trimmed element rectangles in $B_i$. Observe that $A_1, \dots, A_{n/5}$ is a partition of $A$.
We claim that $A_1, \dots, A_{n/5}$ is indeed a solution for \textsc{5-Partition}. Assume for the sake of contradiction that $A_1, \dots, A_{n/5}$ is not a solution, that is, $\sum_{a \in A_i} a \ne p$ for some $i$. Because $\sum_{a \in A} a = p(n/5)$, there exists $j$ such that $\sum_{a \in A_j} a > p$. Because all $a \in A$ are integers and $p$ is an integer, $\sum_{a \in A_j} a \geq p + 1$.
Consider the $j$th partition rectangle. Define the \emph{extended partition rectangle} as the area that includes a partition rectangle, the bar area directly below it, and the bar $\delta/2$ to the left and to the right of the partition rectangle. Figure~\ref{fig-extendedpartrec} illustrates an extended partition rectangle.
\begin{figure}[h]
\centering
\begin{tikzpicture}
\draw (1,1)--(3,1)--(3,4)--(7,4)--(7,1)--(9,1);
\draw (1,0.6)--(9,0.6);
\draw (2.8,0.6)--(2.8,1);
\draw (7.2,0.6)--(7.2,1);
\path [fill=gray, opacity=0.2] (3,1) rectangle (7,4);
\path [fill=gray, opacity=0.2] (2.8,0.6) rectangle (7.2,1);
\draw (3,4.2)--(7,4.2);
\draw (3,4.3)--(3,4.1);
\draw (7,4.3)--(7,4.1);
\draw (7.2,1)--(7.2,4);
\draw (7.1,4)--(7.3,4);
\draw (7,0.4)--(7.2,0.4);
\draw (7,0.3)--(7,0.5);
\draw (7.2,0.3)--(7.2,0.5);
\node[right] at (7.2,2.5) {$1$};
\node[above] at (5,4.2) {$p$};
\node[below] at (7.1,0.4) {$\frac{\delta}{2}$};
\end{tikzpicture}
\caption{The shaded area is the extended partition rectangle corresponding to this partition rectangle. \label{fig-extendedpartrec}}
\end{figure}
Consider any trimmed element rectangle in the packing configuration that intersects with this partition rectangle. We claim that each such trimmed element rectangle must be wholly contained in the extended partition rectangle.
Consider the area of the trimmed element rectangle outside the partition rectangle and the bar below it. If this is not empty, this must be a right triangle with hypotenuse on the extension down to the bar of a vertical side of the partition rectangle (see Figure~\ref{fig-trimmedinextended}). The hypotenuse of this triangle is of length at most $\delta$, so the height of the triangle (perpendicular to the hypotenuse) is at most $\delta/2$. Thus, the triangle must be in the extended partition rectangle. Thus the whole trimmed element rectangle must be in the extended partition rectangle, as claimed.
\begin{figure}[h]
\centering
\begin{tikzpicture}[scale=0.7]
\draw (4,2)--(6,2)--(6,7)--(12,7)--(12,2)--(14,2);
\draw (4,1.2)--(14,1.2);
\draw (6,1.2)--(6,2);
\draw[fill=gray, opacity=0.2] (7,1.2) -- ++(165:1.17) -- ++(75:5) -- ++(345:1.17) -- ++(255:5);
\draw (7,1.2) -- ++(165:1.17) -- ++(75:5) -- ++(345:1.17) -- ++(255:5);
\draw (6,7.4)--(12,7.4);
\draw (6,7.6)--(6,7.2);
\draw (12,7.6)--(12,7.2);
\draw (12.4,2)--(12.4,7);
\draw (12.2,7)--(12.6,7);
\draw (14.4,2)--(14.4,1.2);
\draw (14.2,2)--(14.6,2);
\draw (14.2,1.2)--(14.6,1.2);
\node[above] at (10,7.4) {$p$};
\node[right] at (12.4,4.5) {$1$};
\node[right] at (14.4,1.6) {$\delta$};
\end{tikzpicture}
\caption{A configuration where the trimmed element rectangle is outside of the partition rectangle and the bar below it. The shaded area is the trimmed element rectangle. The area of the trimmed element rectangle outside of the partition rectangle and the bar directly below it is a right triangle with hypotenuse on the extension of a vertical edge of the partition rectangle. This extension is of length $\delta$. \label{fig-trimmedinextended}}
\end{figure}
The area of the extended partition rectangle is $p + p\delta + \delta^2 < p + 1/2$. However, the total area of the trimmed element rectangles contained in this area is $\sum_{a \in A_j} a (1 - 4\delta) = \sum_{a \in A_j} a - 4\delta\sum_{a \in A_j}a \geq (p + 1) - 4\delta\sum_{a \in A_j}a > p + 1/2$, which is a contradiction.
Thus we conclude that $A_1, \dots, A_{n/5}$ is a solution to \textsc{5-Partition}, which implies that the \textsc{5-Partition} instance is a \textsc{yes} instance as desired.
\end{proof}
\section{Proof of Inapproximability of \textsc{Min Piece Dissection}} \label{sec-proof-approx}
In this section, we show the inapproximability of \textsc{Min Piece Dissection} via a reduction from the intermediate problem \textsc{Max 5-Partition}.
In Section~\ref{subsec-approx-m5p} below, we prove the following
inapproximability result for \textsc{Max 5-Partition}:
\begin{lemma} \label{lem-5-part-approx}
There is a constant $\alpha_{\mathrm{M5P}} > 1$ such that \textsc{Gap}\textsubscript{\textsc{Max-5-Partition}}$[n(1-\varepsilon)/5, n(1/\alpha_{\mathrm{M5P}} + \varepsilon)/5]$ is NP-hard for any sufficiently small constant $\varepsilon>0$.\footnote{The best $\alpha_{\mathrm{M5P}}$ we can achieve here is 216/215.}
\end{lemma}
Lemma~\ref{lem-5-part-approx} implies that it is hard to approximate \textsc{Max 5-Partition} to within an $\alpha_{\mathrm{M5P}} - \varepsilon$ ratio for
any sufficiently small $\varepsilon>0$.
The proof of inapproximability of \textsc{Max 5-Partition} largely relies on the reduction used to prove NP-hardness of \textsc{4-Partition} in~\cite{Garey-Johnson-1979},
so we defer the proof of this lemma to \ifabstract Appendix\else Subsection\fi~\ref{subsec-approx-m5p}.
Here we focus on the gap preservation of the reduction, which
implies Theorem~\ref{thm-main-approx}.
\begin{lemma} \label{lem-main-approx}
There is a constant $\alpha_{\mathrm{MPD}} > 1$ such that the following properties hold for the reduction described in Section~\ref{sec-reduction}:
\begin{itemize}
\item if the optimum of the \textsc{Max 5-Partition} instance is at least $n(1-\varepsilon)/5$, then the optimum of the resulting \textsc{Min Piece Dissection} instance is at most $n(1+\varepsilon/5)$; and
\item if the optimum of the \textsc{Max 5-Partition} instance is at most $n(1/\alpha_{\mathrm{M5P}} + \varepsilon)/5$, then the optimum of the resulting \textsc{Min Piece Dissection} is at least $n(\alpha_{\mathrm{MPD}} + \varepsilon/5)$.
\end{itemize}
\end{lemma}
Because it is NP-hard to distinguish the two cases of the input \textsc{Max 5-Partition} instance, it is also NP-hard to approximate \textsc{Min Piece Dissection} to within an $\alpha_{\mathrm{MPD}} - \varepsilon$ ratio for any
sufficiently small constant $\varepsilon>0$.
Thus, Lemma~\ref{lem-main-approx} immediately implies Theorem~\ref{thm-main-approx}.
It remains to prove Lemma~\ref{lem-main-approx}:
\begin{proof}[of Lemma~\ref{lem-main-approx}]
We will show that both properties are true when we choose $\alpha_{\mathrm{MPD}}$ to be $1 + (1 - 1/\alpha_{\mathrm{M5P}})/5$.
\paragraph{(\textsc{Max 5-Partition}$\implies$\textsc{Min Piece Dissection})} Suppose that the input \textsc{Max 5-Partition} instance has optimum at least $n(1-\varepsilon)/5$. Let $A_1, \dots, A_{m'}$ be the optimal partition where $m' \geq n(1-\varepsilon)/5$. We cut $P$ into pieces as follows:
\begin{enumerate}
\item First, we cut every element rectangle except the first one from the bar.
\item Next, let the indices of the elements in $A - (A_1 \cup A_2 \cup \cdots \cup A_{m'})$ be $i_1, \dots, i_{l}$ where $1 \leq i_1 < i_2 < \cdots < i_{l} \leq n$.
\item For each $i = 1, \dots, n/5 - m'$, let $j$ be the smallest index such that $a_{i_1} + \cdots + a_{i_j} \geq ip$. Cut the piece corresponding to $a_{i_j}$ vertically at position $ip - \left(a_{i_1} + \cdots + a_{i_{j - 1}}\right)$ from the left. (If the intended cut position is already the right edge of the piece, then do nothing.)
\end{enumerate}
\begin{figure}[h]
\centering
\begin{tikzpicture}[scale=0.8]
\draw (0,3.8)--(0,5.5)--(2,5.5)--(2,4)--(3.5,4)--(3.5,5.5)--(6.5,5.5)--(6.5,4)--(7.5,4);
\draw (8.5,4)--(9.5,4)--(9.5,5.5)--(11,5.5)--(11,4)--(11.5,4)--(15,4)--(15,3.8);
\draw (0,3.8)--(7.5,3.8);
\draw (8.5,3.8)--(15,3.8);
\draw (0,5.7)--(2,5.7);
\draw (0,5.6)--(0,5.8);
\draw (2,5.6)--(2,5.8);
\draw (3.5,5.7)--(6.5,5.7);
\draw (3.5,5.6)--(3.5,5.8);
\draw (6.5,5.6)--(6.5,5.8);
\draw (9.5,5.7)--(11,5.7);
\draw (9.5,5.6)--(9.5,5.8);
\draw (11,5.6)--(11,5.8);
\draw[dashed] (3.5,4)--(6.5,4);
\draw[dashed] (9.5,4)--(11,4);
\node[above] at (1,5.7) {$a_1$};
\node[above] at (5,5.7) {$a_2$};
\node[above] at (10.25,5.7) {$a_n$};
\node at (8,3.9) {$\cdots$};
\draw (0,1)--(10,1);
\draw (12,1)--(15,1);
\draw (0,2.5)--(10,2.5);
\draw (12,2.5)--(15,2.5);
\draw (0,1)--(0,2.5);
\draw (2,1)--(2,2.5);
\draw (5,1)--(5,2.5);
\draw (7.5,1)--(7.5,2.5);
\draw (9.5,1)--(9.5,2.5);
\draw (12.5,1)--(12.5,2.5);
\draw (15,1)--(15,2.5);
\draw[dashed] (4.5,1)--(4.5,2.5);
\draw[dashed] (9,1)--(9,2.5);
\draw (0,2.7)--(9.5,2.7);
\draw (12.5,2.7)--(15,2.7);
\draw (0,0.8)--(9,0.8);
\draw (0,2.6)--(0,2.8);
\draw (2,2.6)--(2,2.8);
\draw (5,2.6)--(5,2.8);
\draw (7.5,2.6)--(7.5,2.8);
\draw (9.5,2.6)--(9.5,2.8);
\draw (12.5,2.6)--(12.5,2.8);
\draw (15,2.6)--(15,2.8);
\draw (0,0.9)--(0,0.7);
\draw (4.5,0.9)--(4.5,0.7);
\draw (9,0.9)--(9,0.7);
\node[above] at (1, 2.7) {$a_{i_1}$};
\node[above] at (3.5, 2.7) {$a_{i_2}$};
\node[above] at (6.25, 2.7) {$a_{i_3}$};
\node[above] at (8.5, 2.7) {$a_{i_4}$};
\node[above] at (13.75, 2.7) {$a_{i_l}$};
\node[below] at (2.25,0.8) {$p$};
\node[below] at (6.75,0.8) {$p$};
\node at (11,1.75) {$\cdots$};
\end{tikzpicture}
\caption{An illustration of how the source polygon $P$ is cut. The cuts from step 1 are shown as dashed lines on the top figure; every element rectangle except the first one is cut from the bar. On the bottom, the cuts from step 3 are demonstrated. We can think of the cutting process as first arranging $a_{i_1}, \dots, a_{i_l}$ consecutively and then cutting at $p, 2p, \dots$. \label{fig-cut}}
\end{figure}
To pack these pieces into $Q$, we arrange all pieces whose corresponding elements are in partitions in the optimal \textsc{Max 5-Partition} solution, then pack the remaining pieces into the remaining partition rectangles using the additional cuts made in step 3. We leave the piece containing the first element rectangle (and the bar) at its position in $P$, but this does not constrain our solution because the other pieces and the partitions can be freely reordered.
The number of cuts in step 1 is $n - 1$ and in step 3 is at most $n/5 - m' \leq \varepsilon n/5$. Thus the total number of cuts is at most $n - 1 + \varepsilon n / 5$, so the number of pieces is at most $1 + (n - 1 + \varepsilon n / 5) = n(1 + \varepsilon/5)$ as desired.
\paragraph{(\textsc{Min Piece Dissection}$\implies$\textsc{Max 5-Partition})} We prove this property in its contrapositive form. Suppose that the resulting \textsc{Min Piece Dissection} has an optimum of $k < n(\alpha_{\mathrm{MPD}} + \varepsilon/5)$. Let us call these $k$ pieces $R_1, \dots, R_k$.
For each $i = 1, \dots, k$, let $R'_i$ denote the intersection between $R_i$ with the union of all trimmed element rectangles. By Lemma~\ref{lem-one-per-rec}, each trimmed element rectangle can intersect with only one piece. This means that each $R'_i$ is a part of a trimmed element rectangle. (Note that $R'_i$ can be empty; in this case, we say that it belongs to the first trimmed element rectangle.)
Consider $R'_1, \dots, R'_k$. Because each of them is a part of a trimmed rectangle and there are $n$ trimmed rectangles, at most $k - n$ trimmed rectangles contain more than one of the $R'_i$. In other words, there are at least $n - (k - n) = 2n - k$ indices $i$ such that $R'_i$ is a whole trimmed element rectangle. Without loss of generality, suppose that $R'_1, \dots, R'_{2n-k}$ are entire trimmed element triangles.
We call a partition rectangle a \emph{good partition rectangle} if it does not intersect with any of $R'_{2n-k+1}, \dots, R'_{n}$ in the packing configuration. From our choice of $d_t$, each $R'_i$ which is part of a trimmed element rectangle can intersect with at most one partition rectangle. As a result, there are at least $n/5 - (k - n)$ good partition rectangles.
For each good partition rectangle $O$, let $A_O$ be the subset of all elements of $A$ corresponding to $R'_i$s that intersect $O$. (Because $O$ is a good partition rectangle, each $R'_i$ that intersects $O$ is always a whole trimmed element rectangle.)
We claim that the collection of $T_O$'s for all good partition rectangles $O$ is a solution to the \textsc{Max 5-Partition} instance. We will show that this is indeed a valid solution. First, observe again that, because each $R'_i$ intersects with at most one partition rectangle, all $A_O$'s are mutually disjoint. Thus, we now only need to prove that the sum of elements of $A_O$ is exactly the target sum $p$.
Suppose for the sake of contradiction that there exists a good partition rectangle $O$ such that $\sum_{a \in A_O} a \ne p$. Consider the following two cases.
\begin{description}
\item[Case 1:] $\sum_{a \in A_O} a > p$.
\medskip
As we showed in the proof of Theorem~\ref{thm-main}, each trimmed element rectangle corresponding to $a \in A_O$ must be in the extended partition rectangle. By an argument similar to the argument used in the proof of Theorem~\ref{thm-main}, the total area of all these trimmed element rectangles is more than the area of the extended partition rectangle, which is a contradiction.
\medskip
\item[Case 2:] $\sum_{a \in A_O} a < p$.
\medskip
Because every $a \in A_O$ and $p$ are integers, $\sum_{a \in A_O} a + 1 \leq p$. From the definition of $A_O$, no trimmed element rectangles apart from those in $A_O$ intersect $O$. Hence the total area that trimmed element rectangles contribute to $O$ is at most $$\left(\sum_{a \in A_O}a\right)(1 - 4\delta) < \sum_{a \in A_O}a \leq p - 1.$$ This means that an area of at least $1$ unit square in $O$ is not covered by any of the trimmed element rectangles. However, the area of the source polygon outside of all the trimmed element rectangles is $$\delta\left(\left(\frac{n}{5} - 1\right)d_t + \sum_{a \in A} a\right) + 4 \delta\left(\sum_{a \in A} a\right) < 1,$$ which is a contradiction.
\end{description}
Hence, the solution defined above is a valid solution. Because the number of good partition rectangles is at least $n/5 - (k - n) > n/5 - n(\alpha_{\mathrm{MPD}} + \varepsilon/5 - 1) = n(1/\alpha_{\mathrm{M5P}} - \varepsilon)/5$, the solution contains more than $n(1/\alpha_{\mathrm{M5P}} - \varepsilon)/5$ subsets, which completes the proof of the second property.
\end{proof}
\later{
\ifabstract
\section{Proof of NP-hardness of Approximation of \textsc{Max 5-Partition}}
\else
\section{Proof of NP-hardness of Approximation of \textsc{Max 5-Partition}}
\fi
\label{subsec-approx-m5p}
To prove hardness of approximating \textsc{Max 5-Partition}, we will reduce from \textsc{4-Uniform 4-Dimensional Matching}.
\textsc{2-Uniform 3-Dimensional Matching}, a problem similar to \textsc{4-Uniform 4-Dimensional Matching}, was first proved to be hard to approximate by Chleb{\'{\i}}k and Chleb{\'{\i}}kov{\'{a}}~\cite{Chlebik-Chlebikova-2002}. Shortly after, \textsc{4-Uniform 4-Dimensional Matching} was proved to be NP-hard to approximate by Berman and Karpinski~\cite{Berman-Karpinski-2003}. These two results, however, are not strong enough for our proof.\footnote{Our proof requires the \emph{near perfect completeness} property. This property refers to the value $\beta$ for which \textsc{Gap}\textsubscript{\textsc{4DM}}[$\beta, \gamma$] is NP-hard. To have near perfect completeness, $\beta$ needs to correspond to an almost perfect matching.} For the purpose of this paper, we will use the following inapproximability result for \textsc{4-Uniform 4-Dimensional Matching} by Hazan, Safra and Schwartz~\cite{Hazan-Safra-Schwartz-2003}:
\begin{theorem}[\cite{Hazan-Safra-Schwartz-2003}] \label{thm-match}
There is a constant $\alpha_{\mathrm{4DM}} > 1$ such that, for
any sufficiently small constant $\varepsilon>0$,
\textsc{Gap}\textsubscript{\textsc{4DM}}$[n'(1 - \varepsilon), n'(1/\alpha_{\mathrm{4DM}} + \varepsilon)]$ is NP-hard where $n'$ denote $|V^1| = |V^2| = |V^3| = |V^4|$.\footnote{In~\cite{Hazan-Safra-Schwartz-2003}, $\alpha_{\mathrm{4DM}}$ is 54/53.}
\end{theorem}
We now prove Lemma~\ref{lem-5-part-approx} using Theorem~\ref{thm-match}.
\begin{proof}[of Lemma~\ref{lem-5-part-approx}]
First we describe the reduction from \textsc{4-Uniform 4-Dimensional Matching} to \textsc{Max 5-Partition}. The reduction is similar to the reduction used to prove NP-hardness of \textsc{4-Partition} in~\cite{Garey-Johnson-1979}. Given an instance $(V^1, V^2, V^3, V^4, E)$ of \textsc{4-Uniform 4-Dimensional Matching}, we construct an instance $A = \{a_1, \dots, a_n\}$ of \textsc{Max 5-Partition} as follows:
\begin{enumerate}
\item Let $n = 20n'$. Because $(V^1, V^2, V^3, V^4, E)$ is 4-uniform and balanced, $|E| = 4|V^1| = 4|V^2| = 4|V^3| = 4|V^4| = 4n'$, or equivalently, $n = 4|V^1| + 4|V^2| + 4|V^3| + 4|V^4| + |E|$.
\item For convenience, let $M = 100(n' + 1)^2$ and, for each $m = 1, \dots, 4$, label $V^m$'s vertices from 1 to $n'$.
\item For each vertex $i = 1, \dots, n'$ of $V^m$, add four elements to the set $A$: one \emph{matching element} of value $M^8 + 4M^{m + 3} + M^{m - 1} i$ and three \emph{dummy elements} of value $M^8 + M^7 + M^6 + M^5 + M^4 + M^{m - 1} i$.
\item For each edge $(i, j, k, l) \in E$, add an element of value $M^8 - M^3 l - M^2 k - M j - i$ into $A$.
\end{enumerate}
In the resulting instance of \textsc{Max 5-Partition}, the target partition sum is $5M^8 + 4M^7 + 4M^6 + 4M^5 + 4M^4$. It is easy to see that this can be met by only two types of subsets: an edge element and the four corresponding matching elements, and an edge element and the four corresponding dummy elements.
A subset of the first type corresponds to an edge in a matching in the \textsc{4-Uniform 4-Dimensional Matching} instance because there is only one matching element for each vertex $i$ of $V^m$, preventing two subsets from sharing a vertex; we will call these subsets \emph{matching subsets}. We will call subsets of the other type \emph{dummy subsets}.
This reduction clearly runs in polynomial time. Select $\alpha_{\mathrm{M5P}}$ such that $1/\alpha_{\mathrm{M5P}} = 1/(4\alpha_{\mathrm{4DM}}) + 3/4$. We prove the two following properties of the reduction, which together immediately yield Lemma~\ref{lem-5-part-approx}:
\begin{enumerate}
\item If the optimum of the \textsc{4-Uniform 4-Dimensional Matching} instance is at least $n'(1 - \varepsilon)$, then the optimum of the resulting \textsc{Max 5-Partition} instance is at least $n(1-\varepsilon)/5$.
\item If the optimum of the \textsc{4-Uniform 4-Dimensional Matching} instance is at most $n'(1/\alpha_{\mathrm{4DM}} + \varepsilon)$, then the optimum of the resulting \textsc{Max 5-Partition} instance is at most $n(1/\alpha_{\mathrm{M5P}} + \varepsilon/4)/5$.
\end{enumerate}
\paragraph{(\textsc{4-Uniform 4-Dimensional Matching}$\implies$\textsc{Max 5-Partition})} We now prove the first property. Suppose that the input \textsc{4-Uniform 4-Dimensional Matching} instance has optimum at least $n'(1 - \varepsilon)$. We create a solution to the \textsc{Max 5-Partition} instance by first taking the matching subsets corresponding to the matching. Then, for each edge not in the matching, we pick the corresponding dummy subset if possible. (We cannot pick it if all the dummy elements corresponding to a vertex in the edge are already taken.) This is our solution for \textsc{Max 5-Partition}.
Consider each vertex $i \in V^m$. If $i$ is in the matching, then there are only three dummy subsets left, so we will not run out of dummy elements for $i$ when we try to pick the dummy subsets. On the other hand, if $i$ is not in the matching, we will run out of dummy elements for one of the dummy subsets.
Because the matching is of size at least $n'(1 - \varepsilon)$, the number of vertices not in the matching is at most $4n'\varepsilon$. Because each such vertex causes at most one dummy subset to not be picked, at most $4n'\varepsilon$ dummy subsets are not picked. Hence, the solution created for the \textsc{Max 5-Partition} instance has at least $n/5 - 4n'\varepsilon = n(1 - \varepsilon)/5$ subsets, which concludes the proof for the first property.
\paragraph{(\textsc{Max 5-Partition}$\implies$\textsc{4-Uniform 4-Dimensional Matching})} We will show the second property using its contrapositive. Suppose that the \textsc{Max 5-Partition} instance has optimum more than $n(1/\alpha_{\mathrm{M5P}} + \varepsilon/4)/5$, i.e., there exist more than $n(1/\alpha_{\mathrm{M5P}} + \varepsilon)/5$ disjoint subsets each having a sum of elements equal to $5M^8 + 4M^7 + 4M^6 + 4M^5 + 4M^4$. Consider the dummy subsets among these subsets.
Because there are only three dummy elements corresponding to each vertex, there are only $3 \cdot 4n' = 12n'$ dummy elements in $A$. Four dummy elements are needed for each dummy subset, so there are at most $12n'/4 = 3n' = 3n/20$ such subsets. As a result, there are more than $n(1/\alpha_{\mathrm{M5P}} + \varepsilon/4)/5 - 3n/20 = n(1/\alpha_{\mathrm{4DM}} + \varepsilon)/20 = n'(1/\alpha_{\mathrm{4DM}} + \varepsilon)$ matching subsets. These subsets correspond to a matching of size more than $n'(1/\alpha_{\mathrm{4DM}} + \varepsilon)$ in the \textsc{4-Uniform 4-Dimensional Matching} instance. Thus, the second property holds.
Thus, the two properties are true and Lemma~\ref{lem-5-part-approx} follows immediately.
\end{proof}
}
\later{
\section{Proof of Lemma~\ref{lem-one-per-rec}} \label{sec-lem-proof}
In this section, we prove Lemma~\ref{lem-one-per-rec}. Before we do so, we prove the following helper lemma.
\begin{lemma} \label{lem-tri-height}
For any triangle that can be fit into a bar of height $\delta$, at least one of its heights is of length at most $2\delta$.
\end{lemma}
\begin{proof}
Consider the leftmost and rightmost vertices, denoted $A$ and $B$ respectively, of the triangle in the configuration that fits into the bar. Consider a strip where $A$ is on the left edge, $B$ is on the right edge and the upper and lower edges are on the edges of the bar. This strip contains the whole triangle and its width is at most $AB$, so the strip has area at most $\delta\cdot AB$. The triangle has area equal to half of $AB$ multiplied by the height with respect to base $AB$, so the height with respect to base $AB$ is at most $2\delta$.
\end{proof}
\begin{figure}[h]
\centering
\begin{tikzpicture}
\draw (1,1)--(9,1);
\draw (1,0)--(9,0);
\draw (2,0)--(2,1);
\draw (8,0)--(8,1);
\path [fill=gray, opacity=0.2] (2,0) rectangle (8,1);
\draw (2,0.9)--(4,0.2)--(8,0.6)--(2,0.9);
\fill (2,0.9) circle (1.5pt);
\node[below left] at (2,0.9) {$A$};
\fill (8,0.6) circle (1.5pt);
\node[right] at (8,0.6) {$B$};
\draw (9.2,0)--(9.2,1);
\draw (9.1,0)--(9.3,0);
\draw (9.1,1)--(9.3,1);
\node[right] at (9.2,0.5) {$\delta$};
\draw (2,1.2)--(8,1.2);
\draw (2,1.1)--(2,1.3);
\draw (8,1.1)--(8,1.3);
\node[above] at (5,1.2) {$\leq AB$};
\end{tikzpicture}
\caption{A triangle fitted into a bar of height $\delta$. The shaded area is the strip considered in the proof of Lemma~\ref{lem-tri-height}. \label{fig-trianinstrip}}
\end{figure}
We are now ready to prove Lemma~\ref{lem-one-per-rec}.
\begin{proof}[of Lemma~\ref{lem-one-per-rec}]
Suppose for the sake of contradiction that there exists a piece $R$ that intersects with two different trimmed element rectangles. Let the indices of the trimmed element rectangles be $i$ and $j$ where $i < j$.
Define area $T_i$ to be the whole area below the $i$th trimmed element rectangle together with the area of the bar of width $d_s/3$ immediately on the right of the element rectangle. Similarly, define $T_j$ to be the whole area below the $j$th trimmed element rectangle together with the area of the bar of width $d_s/3$ immediately on the left of the element rectangle. $T_i$ and $T_j$ are illustrated in Figure~\ref{fig-trimmedex}.
\begin{figure}[h]
\centering
\begin{tikzpicture}[scale=0.9]
\draw (2.5,1)--(3,1)--(3,3)--(5.5,3)--(5.5,1)--(8.5,1);
\draw (9.5,1)--(12.5,1)--(12.5,3)--(15,3)--(15,1)--(15.5,1);
\draw (2.5,0.8)--(8.5,0.8);
\draw (9.5,0.8)--(15.5,0.8);
\draw (3,1.8)--(5.5,1.8);
\draw (12.5,1.8)--(15,1.8);
\path [fill=gray, opacity=0.2] (3,0.8)--(3,1.8)--(5.5,1.8)--(5.5,1)--(8.25,1)--(8.25,0.8);
\path [fill=gray, opacity=0.2] (9.75,0.8)--(9.75,1)--(12.5,1)--(12.5,1.8)--(15,1.8)--(15,0.8);
\draw (3,0.8)--(3,1);
\draw (8.25,1)--(8.25,0.8);
\draw (9.75,0.8)--(9.75,1);
\draw (15,0.8)--(15,1);
\draw (3,3.2)--(5.5,3.2);
\draw (3,3.3)--(3,3.1);
\draw (5.5,3.3)--(5.5,3.1);
\node[above] at (4.25,3.2) {$a_i$};
\draw (5.5,3.5)--(12.5,3.5);
\draw (5.5,3.4)--(5.5,3.6);
\draw (12.5,3.4)--(12.5,3.6);
\node[above] at (9,3.5) {$\geq d_s/3$};
\draw (12.5,3.2)--(15,3.2);
\draw (12.5,3.3)--(12.5,3.1);
\draw (15,3.3)--(15,3.1);
\node[above] at (13.75,3.2) {$a_j$};
\draw (5.7,1)--(5.7,1.8);
\draw (5.6,1.8)--(5.8,1.8);
\node[right] at (5.7,1.4) {$4\delta$};
\draw (15.2,1)--(15.2,1.8);
\draw (15.1,1.8)--(15.3,1.8);
\node[right] at (15.3,1.4) {$4\delta$};
\draw (5.5,0.6)--(8.25,0.6);
\draw (5.5,0.5)--(5.5,0.7);
\draw (8.25,0.5)--(8.25,0.7);
\node[below] at (6.875,0.6) {$d_s/3$};
\draw (9.75,0.6)--(12.5,0.6);
\draw (9.75,0.5)--(9.75,0.7);
\draw (12.5,0.5)--(12.5,0.7);
\node[below] at (11.125,0.6) {$d_s/3$};
\node at (9, 0.9) {$\cdots$};
\end{tikzpicture}
\caption{$T_i$ and $T_j$ are shown as the shaded areas on the left and on the right respectively. \label{fig-trimmedex}}
\end{figure}
We first prove the following claim: in the final packing configuration in $Q$, at least one point in $R \cap T_i$ must be in a partition rectangle.
Suppose for the sake of contradiction that $R \cap T_i$ is completely contained in the bar. For convenience, we name the points as follows:
\begin{itemize}
\item Let $C$ be the lower left corner of the $i$th trimmed element rectangle.
\item Let $D$ be the lower right corner of the trimmed element rectangle.
\item Let $E$ be the lower right corner of the $i$th (untrimmed) element rectangle.
\item Let $F$ be the intersection of the extension of the right edge of the element rectangle with the lower edge of the bar.
\item Let $G$ be the point on the upper edge of the bar that is distance $d_s/3$ to the right of $E$.
\item Let $H$ be the point on the lower edge of the bar that is distance $d_s/3$ to the right of $F$.
\end{itemize}
These points are marked in Figure~\ref{fig-pointsname}.
\begin{figure}[h]
\centering
\begin{tikzpicture}
\draw (2.5,1)--(3,1);
\draw (3,0.6)--(3,4);
\draw (3,4)--(7,4)--(7,0.6);
\draw (7,1)--(12,1);
\draw (2.5,0.6)--(12,0.6);
\draw (3,2.6)--(7,2.6);
\path [fill=gray, opacity=0.2] (3,0.6)--(3,2.6)--(7,2.6)--(7,1)--(11.5,1)--(11.5,0.6);
\draw (11.5,0.6)--(11.5,1);
\draw (3,4.2)--(7,4.2);
\draw (3,4.3)--(3,4.1);
\draw (7,4.3)--(7,4.1);
\node[above] at (5,4.2) {$a_i$};
\fill (3,2.6) circle (1.5pt);
\node[left] at (3,2.6) {$C$};
\fill (7,2.6) circle (1.5pt);
\node[right] at (7,2.6) {$D$};
\fill (7,1) circle (1.5pt);
\node[above right] at (7,1) {$E$};
\fill (7,0.6) circle (1.5pt);
\node[below] at (7,0.6) {$F$};
\fill (11.5,1) circle (1.5pt);
\node[above] at (11.5,1) {$G$};
\fill (11.5,0.6) circle (1.5pt);
\node[below] at (11.5,0.6) {$H$};
\end{tikzpicture}
\caption{An illustration of the points $C, D, E, F, G$ and $H$. The shaded area is the area $T_i$ defined earlier. \label{fig-pointsname}}
\end{figure}
From the assumptions that $R$ contains pieces from both trimmed element rectangles and that $R$ is connected, we know the piece must intersect $\overline{CD}, \overline{GH}$ and $\overline{EF}$. Let the points at which $R$ intersects these line segments be $I, J$ and $K$ respectively. By our assumption that $R \cap T_i$ is completely contained in the bar in the packing configuration, $I, J$ and $K$ must all be in the bar in the final configuration. Let $L$ be the intersection of $\overline{IJ}$ and $\overline{DF}$ and $M$ be the intersection between $\overline{IJ}$ and $\overline{EG}$ (see Figure~\ref{fig-inter}; we will show that $L$ lies on $\overline{DE}$ and thus $\overline{IJ}$ indeed intersects $\overline{EG}$). If $I = D$, let $L$ be $D$. Similarly, if $J = G$, let $M$ be $G$. Because $I$ and $J$ are in the bar in the final configuration by our assumption, and the bar is convex, $L$ and $M$ must also be in the bar.
\begin{figure}[h]
\centering
\begin{tikzpicture}
\draw (2.5,1)--(3,1);
\draw (3,0.6)--(3,4)--(7,4);
\draw (7,4)--(7,0.6);
\draw (7,1)--(12,1);
\draw (2.5,0.6)--(12,0.6);
\draw (3,2.6)--(7,2.6);
\path [fill=gray, opacity=0.2] (3,0.6)--(3,2.6)--(7,2.6)--(7,1)--(11.5,1)--(11.5,0.6);
\draw (11.5,0.6)--(11.5,1);
\draw (3,4.2)--(7,4.2);
\draw (3,4.3)--(3,4.1);
\draw (7,4.3)--(7,4.1);
\node[above] at (5,4.2) {$a_i$};
\fill (3,2.6) circle (1.5pt);
\node[left] at (3,2.6) {$C$};
\fill (7,2.6) circle (1.5pt);
\node[right] at (7,2.6) {$D$};
\fill (7,1) circle (1.5pt);
\node[above right] at (7,1) {$E$};
\fill (7,0.6) circle (1.5pt);
\node[below] at (7,0.6) {$F$};
\fill (11.5,1) circle (1.5pt);
\node[above right] at (11.5,1) {$G$};
\fill (11.5,0.6) circle (1.5pt);
\node[below] at (11.5,0.6) {$H$};
\fill (6,2.6) circle (1.5pt);
\node[above] at (6,2.6) {$I$};
\fill (11.5,0.85) circle (1.5pt);
\node[right] at (11.5,0.85) {$J$};
\draw [dashed] (6,2.6)--(11.5,0.85);
\fill (7,2.27) circle (1.5pt);
\node[below left] at (7,2.27) {$L$};
\fill (11.06,1) circle (1.5pt);
\node[above] at (11.06,1) {$M$};
\fill (7,0.8) circle (1.5pt);
\node[left] at (7,0.8) {$K$};
\end{tikzpicture}
\caption{An illustration of the points $L$ and $M$ defined above. \label{fig-inter}}
\end{figure}
Consider $\angle LID$. We have $$\tan \angle LID = \frac{LD}{ID} = \frac{ED+GJ}{ID+EG}.$$
Thus, $$LD = \frac{ED + GJ}{1 + EG/ID}.$$
Because $ED = 4\delta, EG = d_s/3, ID \leq CD = a_i < d_s/12$ and $GJ \leq GH = \delta$, we have
\begin{align*}
LD &< \frac{4\delta + \delta}{1 + (d_s/3)/(d_s/12)} \leq \delta.
\end{align*}
Thus $LE = 4\delta - LD > 3\delta$.
Consider $\angle MLE$. We again have $$\tan \angle MLE = \frac{ME}{LE} = \frac{EG}{LE + GJ}.$$
Thus $$ME = \frac{EG}{1 + GJ/LE}.$$
Substituting $EG = d_s/3, GJ \leq GH = \delta$ and $LE > 3\delta$ into the equality above, we have
\begin{align*}
ME &> \frac{d_s/3}{1 + \delta/(3\delta)} = \frac{d_s}{12}.
\end{align*}
Because $L$ and $K$ are in the bar and $E$ is on $LK$, $E$ must also be in the bar. Consider the triangle $\triangle LEM$. Because all of its vertices are in the bar, the whole triangle is contained in the bar. However, the smallest height of the triangle (the one with the hypotenuse as the base) is of height
\begin{align*}
\frac{LE \cdot ME}{LM} &= \frac{LE \cdot ME}{\sqrt{LE^2 + ME^2}} = \frac{LE}{\sqrt{(LE/ME)^2 + 1}} > \frac{LE}{\sqrt{2}} > \frac{3\delta}{\sqrt{2}} > 2\delta
\end{align*}
where the first inequality follows from the fact that $LE \leq 4\delta < d_s/12 < ME$.
This contradicts Lemma~\ref{lem-tri-height}. Hence at least one point in $R \cap T_i$ must be in a partition rectangle in the final packing configuration.
Similarly, at least one point in $R \cap T_j$ must be in a partition rectangle. Consider a point $P$ in $R \cap T_i$ and a point $Q$ in $R \cap T_j$ that are contained in partition rectangles. Because $P \in T_i$ and $Q \in T_j$, we have $PQ \geq d_s/3$. By our construction, $d_s/3 > \sqrt{p^2 + 1}$, and thus $P$ and $Q$ cannot fit within the same partition rectangle.
Consider the locations of $P$ and $Q$ in the source polygon. Because $P \in T_i$ and $Q \in T_j$, their $x$ coordinates can differ by at most $(n - 1)d_s + \sum_{a \in A} a$; this corresponds to the extreme case where $P$ is on the left edge of the first element rectangle and $Q$ is on the right edge of the $n$th element rectangle. The $y$ coordinate of the two points also cannot differ by more than $5\delta$. As a result, the distance between the two points is at most $\sqrt{((n - 1)d_s + \sum_{a \in A} a)^2 + (5\delta)^2}$, which is less than $d_t$. Thus, $P$ and $Q$ cannot be in different partition rectangles either. This is a contradiction, completing the proof of Lemma~\ref{lem-one-per-rec}.
\end{proof}
}
\section{Variations and Open Questions} \label{sec-variant} \label{sec-open}
Table~\ref{variations table} lists variations of \textsc{$k$-Piece Dissection} and whether our proofs of NP-hardness and inapproximability continue to hold. Because it is obvious from the proofs, we do not give detailed explanations as to why the proofs still work (or do not work) in these settings. Specifically:
\begin{enumerate}
\item Our proofs remain valid when the input polygons are restricted to be simple (hole-free) and orthogonal with all edges having integer length.\footnote{Our reduction uses rational lengths, but the polygons can be scaled up to use integer lengths while still being of polynomial size.}
\item Our results still hold under any cuts that leave each piece connected and Lebesgue measurable.
\item Our proofs work whether or not rotations and/or reflections are allowed when packing the pieces into~$Q$.
\end{enumerate}
\begin{table}[h!]
\centering
\begin{tabular}{| c | c | c |}
\hline
\bf Variation on & \bf Variation description & \bf Do our results hold? \\
\hline \hline
\multirow{4}{*}{Input Polygons} & Polygons must be orthogonal & YES \\ \cline{2-3}
& Polygons must be simple (hole-free) & YES \\ \cline{2-3}
& Edges must be of integer length & YES \\ \cline{2-3}
& Polygons must be convex & NO \\
\hline \hline
\multirow{4}{*}{Cuts Allowed} & Cuts must be straight lines & YES \\ \cline{2-3}
& Cuts must be orthogonal & YES \\ \cline{2-3}
& Pieces must be simple (hole-free) & YES \\ \cline{2-3}
& Pieces may be disconnected & NO \\
\hline \hline
\multirow{2}{*}{Packing Rules} & Rotations are forbidden & YES \\ \cline{2-3}
& Reflections are forbidden & YES \\ \cline{2-3}
\hline
\end{tabular}
\caption{Variations on the dissection problem.}
\label{variations table}
\end{table}
While we have proved that the \textsc{$k$-Piece Dissection} is NP-hard and that its optimization counterpart is NP-hard to approximate, we are far from settling the complexity of these problems and their variations. We pose a few interesting remaining open questions:
\begin{itemize}
\item Is \textsc{$k$-Piece Dissection} in NP, or even decidable? We do not know the answer to this question even when only orthogonal cuts are allowed and rotations and reflections are forbidden.
In particular, there exist two-piece orthogonal (staircase) dissections
between pairs of rectangles which seem to require a cut comprised of
arbitrarily many line segments \cite[p.~60]{Frederickson-1997}.
\iffull
If we require each piece to be a polygon with a polynomial number of sides, then problem becomes decidable. In fact, we can place this special case in the complexity class $\exists \mathbb{R}$, that is, deciding true sentences of the form $\exists x_1 : \cdots : \exists x_m : \varphi(x_1, \dots, x_m)$ where $\varphi$ is a quantifier-free formula consisting of conjunctions of equalities and inequalities of real polynomials. To prove membership in $\exists \mathbb{R}$, use $x_1, \dots, x_m$ to represent the coordinates of the pieces' vertices in $P$ and $Q$. Then, use $\varphi$ to verify that the pieces are well-defined partitions of $P$ and $Q$ and that each piece in $P$ is a transformation of a piece in~$Q$; these conditions can be written as polynomial (in)equalities of degree at most two. $\exists \mathbb{R}$ is known to be in PSPACE~\cite{Canny-1988}.
\fi
\item Is \textsc{$k$-Piece Dissection} still hard when one or both of the input polygons are required to be convex?
\item Can we prove stronger hardness of approximation, or find an approximation algorithm, for \textsc{Min Piece Dissection}? The current best known algorithm for finding a dissection is a worst-case bound of a pseudopolynomial number of pieces~\cite{FeatureSize_EGC2011f}.
\item Is \textsc{$k$-Piece Dissection} solvable in polynomial time for constant~$k$? Membership in FPT would be ideal, but even XP would be interesting.
\end{itemize}
\section*{Acknowledgments}
We thank Greg Frederickson for helpful discussions.
\bibliographystyle{splncs03}
| {'timestamp': '2015-12-22T02:24:27', 'yymm': '1512', 'arxiv_id': '1512.06706', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06706'} | arxiv |
\section{Introduction}
\label{sec:intro}
Cutting-edge brain mapping techniques such as functional magnetic resonance imaging (fMRI) generate huge amounts of datasets that allows the construction of whole brain functional networks. Attempts to analyze and quantitatively characterize the structural properties of these networks are based on techniques of an emergence new field, namely complex network analysis (\cite{Boccaletti}; \cite{Newman}; \cite{Strogatz}).
Complex network analysis originated from mathematics, more specifically in graph theory, and aims to characterize the whole brain networks with a few number of measures. In this approach, a brain network is represented by a graph, in which its vertices represent the brain regions of interest (ROI), and edges represent the functional associations between ROIs (e.g. functional connectivity). Various graph-theoretic metrics can be used to investigate the mechanisms underlying the functional brain networks. Some examples are measures of functional integration, network motifs, centrality, and network resilience (\cite{Rubinov}). The analysis of the structural properties of the graphs allow us to visualize and understand the overall connectivity pattern of ROIs and also to quantitatively characterize its organization. These approaches became more popular over the last decade after it has provided an essential framework to elucidate the relationship between brain structure and function, and also to have proven by an increasing number of studies to give insights regarding the potential mechanisms involved in aging (\cite{Perry2015}), sex differences (\cite{Ingalhalikar2014}), various brain disorders (\cite{Stam2014}), and structural reconfiguration of the brain in response to external task modulation (\cite{Sherwin2015}).
Although applications of methods developed in graph theory have been successful in the analysis of brain networks as aforementioned, there is still a gap between these graph-based computational approaches and Statistics. For example, to the best of our knowledge, the concept of correlation between graphs is unknown. The concept of correlation between graphs may aid the understanding of how brain sub-networks interact and also to identify differences in those interactions between controls and patients (subjects diagnosed with a disorder) that may be useful for the development of novel procedures for diagnosis and prognosis.
Graphs are difficult to be manipulated from a statistical viewpoint because they are not numbers, but objects composed of one set of vertices and one set of edges. By observing the graphs depicted in Figure \ref{figure:illustration}, it is very difficult to identify correlation between them by only analyzing their structures. Thus, to construct a framework to infer correlation, one natural idea would be to imagine that a graph is generated by a mathematical model with a set of parameters. The parameters are the random variables. Intuitively, two vectors of graphs are correlated whether the parameters (random variables) of the graph model are correlated (Figure \ref{figure:illustration}). However, given two vectors of graphs, the model that generates them is rarely known, and consequently, the parameters cannot be estimated. Thus it is necessary to identify a feature of the graph that is highly associated with the parameters of the graph. In order to identify the feature that contains the information of the parameter, we investigated the spectral properties of random graphs (set of eigenvalues of its adjacency matrix). It is known that some structural properties, such as the number of walks, diameter, and cliques can be described by the spectrum of the graph (\cite{Mieghem}). Here, we propose to estimate the correlation between graphs by using the spectral radius (largest eigenvalue) of the graphs. Our results show that the spectral radius is highly associated with the parameters that generate the graph, and thus, it can be a good feature to calculate correlation between two graphs.
\begin{figure}
\centering
\includegraphics[width=4in]{./Figure1.pdf}
\caption{Two vectors of perfectly correlated random graphs {\bf A} and {\bf B}, each one of size four. Graphs {\bf A} and {\bf B} are caricatural representations of two distinct brain sub-networks (e.g. somatomotor and default-mode) of four subjects. The identification of correlation by directly analyzing the structure of graphs {\bf A} and {\bf B} is very difficult. Notice that although they are generated by the same model (in this illustration, the graphs were generated by an Erd\"os-R\'enyi random graph model) and parameters, they are structurally different. Thus, one solution to identify correlation between graphs consists in identifying correlation between the parameters of the random graph models. \label{figure:illustration}}
\end{figure}
We illustrate the usefulness of our method by analyzing a large fMRI dataset (ABIDE - The Autism Brain Imaging Data Exchange - Consortium website - \url{http://fcon_1000.projects.nitrc.org/indi/abide/}) composed of 814 participants comprising 529 controls and 285 individuals with ASD
\section{Description of the method}
\label{sec:meth}
\subsection{Graph}
A graph is a pair of sets $G=(V,E)$, where $V$ is a set of $n$ vertices ($v_{1}, v_{2}, \ldots, v_{n}$) and $E$ is a set of $m$ edges that connect two vertices of $V$.
Any undirected graph $G$ with $n$ vertices can be represented by its adjacency matrix ${\bf A}^G$ with $n \times n$ elements ${\bf A}_{ij}^G$ ($i,j=1, \ldots, n$), whose value is ${\bf A}_{ij}^G = {\bf A}_{ji}^G = 1$ if vertices $v_i$ and $v_j$ are connected, and 0 otherwise. The spectrum of graph $G$ is the set of eigenvalues of its adjacency matrix ${\bf A}^G$. Thus, an undirected graph with $n$ vertices has $n$ real eigenvalues $\lambda_1 \ge \lambda_2 \ge \ldots \ge \lambda_n$.
\subsection{Correlation between graphs}
\label{sec:correlation}
Two random variables are statistically independent whether knowledge about one of them does not aid in the prediction of the other. On the other hand, if they are not independent, then the values of one of the variables can be predicted by information provided about the other.
In this study, we consider that the parameters of the graph models are random variables. Thus, we assume we have $k$ independent graphs randomly generated by the same graph model, but each one with a distinct set of parameters (sampled from a probabilistic distribution).
Let $k$ and $\Theta$ be the number of graphs and their parameters, respectively. Then, let $\undertilde{\theta}^1 = \{ \theta_{1}^{1}, \theta_{2}^{1}, \ldots, \theta_{k}^{1} \}$ and $\undertilde{\theta}^2 = \{ \theta_{1}^{2}, \theta_{2}^{2}, \ldots, \theta_{k}^{2} \}$ be two samples of random variables $\Theta^1$ and $\Theta^2$, respectively, ${\undertilde{G}}^1(\undertilde{\theta}^1) = \{ G_{1}^{1}(\theta_{1}^{1}), G_{2}^{1}(\theta_{2}^{1}), \ldots, G_{k}^{1}(\theta_{k}^{1})\}$ and ${\undertilde{G}}^2(\undertilde{\theta}^2) = \{ G_{1}^{2}(\theta_{1}^{2}), G_{2}^{2}(\theta_{2}^{2}), \ldots, G_{k}^{2}(\theta_{k}^{2})\}$ be two samples of random graphs constructed by using $\undertilde{\theta}^1$ and $\undertilde{\theta}^2$, respectively. To illustrate this concept, suppose that ${\undertilde{G}}^1$ and ${\undertilde{G}}^2$ are two vectors of Erd\"os-R\'enyi random graphs (\cite{Erdos}). An Erd\"os-R\'enyi random graph (\cite{Erdos}) has $n$ labeled vertices in which each pair of vertices is connected by an edge with a given probability $p$. In this case, the probability $p$ is the parameter of graph $G$. Thus, the two vectors of Erd\"os-R\'enyi random graphs can be described as ${\undertilde{G}}^1(\undertilde{p}^1)=\{ G_{1}^{1}(p_{1}^{1}), G_{2}^{1}(p_{2}^{1}), \ldots, G_{k}^{1}(p_{k}^{1})\}$ and ${\undertilde{G}}^2(\undertilde{p}^2) = \{ G_{1}^{2}(p_{1}^{2}), G_{2}^{2}(p_{2}^{2}), \ldots, G_{k}^{2}(p_{k}^{2})\}$.
We say that random graphs ${\undertilde{G}}^1(\undertilde{\theta}^1)$ and ${\undertilde{G}}^2(\undertilde{\theta}^2)$ are independent if the vectors of parameters ${\undertilde{\theta}}^1$ and ${\undertilde{\theta}}^2$ are independent. In our example for an Erd\"os-R\'enyi random graph, we say that graphs ${\undertilde{G}}^1(\undertilde{p}^1)$ and ${\undertilde{G}}^2(\undertilde{p}^2)$ are correlated if the vectors of probabilities ${\undertilde{p}}^1=\{p_{1}^{1}, \ldots, p_{k}^{1}\}$ and ${\undertilde{p}}^2=\{p_{1}^{2}, \ldots, p_{k}^{2}\}$ are correlated.
Formally, two random variables $\Theta^{1}$ and $\Theta^{2}$ with probability density functions $f(\Theta^1)$ and $f(\Theta^2)$ are independent if and only if the combined random variable $(\Theta^1, \Theta^2)$ has a joint probability density function $f(\Theta^1,\Theta^2)=f(\Theta^1) \times f(\Theta^2)$. We say that two random variables $\Theta^1$ and $\Theta^2$ are dependent if they are not independent.
The test of independence between $G^1$ and $G^2$ is described as a hypothesis test as follows:\\
$\text{H}_0$: $\Theta^1$ and $\Theta^2$ are independent (null hypothesis)\\
$\text{H}_1$: $\Theta^1$ and $\Theta^2$ are not independent (alternative hypothesis)
One simple manner to identify correlation between $\Theta^1$ and $\Theta^2$ consists in, if the graph model is known, to estimate the parameters of the graphs, and then test the probabilistic dependence between them. However, the graph model is rarely known for real world graphs. Thus, the problem consists in detecting dependence only from the observation of random graphs (and not the parameters). In other words, it is necessary to identify a feature of the graph that is highly associated with the parameters of the graph.
From spectral graph theory, the largest eigenvalue ($\lambda_1$) of a graph $G$ is known as its spectral radius or index (for simplicity, we will denote the largest eigenvalue $\lambda_1$ just as $\lambda$). For several random graphs, it is known that the spectral radius is a function of the parameters of the graph. For example, for the Erd\"os-R\'enyi random graph, let $n$ and $p$ be the number of vertices and the probability that two vertices are connected by an edge, respectively. Then, the spectral radius of an Erd\"os-R\'enyi random graph is $np$. Thus, we propose to use the spectral radius to identify correlation between graphs.
Let ${\undertilde{G}}^1 = \{ G_{1}^{1}, G_{2}^{1}, \ldots, G_{k}^{1},\}$ and ${\undertilde{G}}^2 = \{ G_{1}^{2}, G_{2}^{2}, \ldots, G_{k}^{2},\}$ be two samples of random graphs and $\undertilde{\lambda}^1 = \{ \lambda_{1}^{1}, \lambda_{2}^{1}, \ldots, \lambda_{k}^{1} \}$ and $\undertilde{\lambda}^2 = \{ \lambda_{1}^{2}, \lambda_{2}^{2}, \ldots, \lambda_{k}^{2} \}$ be the spectral radii associated with ${\undertilde{G}}^1$ and ${\undertilde{G}}^2$, respectively. Thus, to identify correlation between graphs, one may test the independence between $\undertilde{\lambda}^1$ and $\undertilde{\lambda}^2$.
\subsubsection{Identification of the correlation between graphs} \label{section:spearman_correlation}
Once defined the feature to be used to identify the correlation between graphs, then it is necessary to estimate the correlation itself. We propose the use of the Spearman's rank correlation ($\rho$) because: (i) its implementation is simple; (ii) it is robust to outliers; and (iii) it does not require assumptions of linearity in the relationship between variables (it can identify monotonic nonlinear associations), nor the variables should be measured at interval scales, as it can be used for ordinal variables (\cite{spearman1904general}).
Let $\hat{\rho}$ be the sample Spearman's rank correlation coefficient. To estimate $\hat{\rho}$, first convert the raw values of $\lambda^1_i$ and $\lambda^2_i$ ($i=1, \ldots, k$) to ranks, and calculate the differences $d_i$ between the ranks of $\lambda^1_i$ and $\lambda^2_i$. Then, calculate the Spearman's rank correlation coefficient ($\hat{\rho}$) as:
\begin{math}
\hat{\rho} = 1-\frac{6\sum_{i=1}^{k}d_i^2}{k(k^2-1)}
\end{math}
\noindent where $\lim_{k \rightarrow \infty}\mathbb{E}[\hat{\rho}(\undertilde{\lambda}^1, \undertilde{\lambda}^2)] := \rho(\lambda^1, \lambda^2) = 12 \mathbb{E}[F_1(\lambda^1)F_2(\lambda^2)] - 3$.
Observe that if $\lambda^1$ and $\lambda^2$ are independent, then $\rho(\lambda^1, \lambda^2) = 0$. The main idea of this article is that in several cases $12 \mathbb{E}[F_1(\lambda^1)F_2(\lambda^2)] - 3 = 0$ if and only if $12 \mathbb{E}[F_1(\Theta^1)F_2(\Theta^2)] - 3 = 0$ therefore we can use $\hat{\rho}(\undertilde{\lambda}^1, \undertilde{\lambda}^2)$ to estimate $12 \mathbb{E}[F_1(\Theta^1)F_2(\Theta^2)] - 3$.
We can prove the validity of this idea in a simple case. Denote by $F$ the joint probability distribution for $(\Theta^1, \Theta^2)$ and the marginals for $\Theta^1$ and $\Theta^2$ by $F_1$ and $F_2$, respectively.
\begin{prop}
Let $F$ be differentiable on both coordinates. Given i.i.d. copies $(\Theta^1_i, \Theta^2_i)_{i = 1,\ldots, k}$ of $(\Theta^1, \Theta^2)$, let $(G^1_i(\Theta^1_i))_{i = 1,\ldots, k}$ and $(G^2_i(\Theta^2_i))_{i = 1,\ldots, k}$ be independent ER random graphs of size $n$. Then, for any positive $\epsilon, \delta$ there exist an integer $k_0$ such that for all $k > k_0$ and $n > n_0(k)$ we have with probability larger than $1-\delta$ that
\begin{equation}
\left|\hat{\rho}(\undertilde{\lambda}^1, \undertilde{\lambda}^2) - 12 \mathbb{E}[F_1(\Theta^1)F_2(\Theta^2)] +3\right| \leq \epsilon
\end{equation}
\end{prop}
\begin{proof}
Let $\mathbb{P}$ be the joint probability measure for the sequences $(\Theta^1_i)_{i \geq 1}$, $(\Theta^2_i)_{i \geq 1}$, $(G^1_i(\Theta^1_i))_{i \geq 1}$, and $(G^2_i(\Theta^2_i))_{i \geq 1}$. To prove the proposition, it is enough to show that for suitable choices of $k$ and $n$, we have
\begin{equation}\label{eq:boundeig}
\mathbb{P}\left(\left|\hat{\rho}(\undertilde{\lambda}^1, \undertilde{\lambda}^2) - \hat{\rho}(\undertilde{\Theta}^1, \undertilde{\Theta}^2) \right| > \epsilon/2\right)< \delta/2
\end{equation}
and
\begin{equation} \label{eq:boundrho}
\mathbb{P}\left(\left|\hat{\rho}(\undertilde{\Theta}^1, \undertilde{\Theta}^2) - 12 \mathbb{E}[F_1(\Theta^1)F_2(\Theta^2)] +3\right| > \epsilon/2 \right) < \delta/2.
\end{equation}
It is a classical result (see for example \cite{borkowf2002computing}) that $\hat{\rho}((\Theta^1_i)_{i = 1,\ldots, k}, (\Theta^2_i)_{i = 1,\ldots, k})$ converges in probability to $12 \mathbb{E}[F_1(\Theta^1)F_2(\Theta^2)] -3$, therefore, for sufficiently large $k$, we have that \eqref{eq:boundrho} holds.
Now, it remains to prove that there is $n_0(k)$ such that for all $n > n_0(k)$ inequality \eqref{eq:boundeig} holds. Let $\hat{r}_i^1$ and $\hat{r}_i^2$ for $i =1, \ldots, k$ be the ranks of the spectral radii of the graphs $G^1_i(\Theta^1_i)$ and $G^2_i(\Theta^2_i)$, respectively. Also, let $r_i^1$ and $r_i^2$ for $i =1, \ldots, k$ be the ranks of the $\Theta^1_i$ and $\Theta^2_i$, respectively.
From the definition of Spearman correlation, it is clear that if $\hat{r}_i^l = r_i^l$ for $i=1,\ldots, k$ and $l =1,2$, we have that
\begin{equation*}
\hat{\rho}(\undertilde{\lambda}^1, \undertilde{\lambda}^2) = \hat{\rho}(\undertilde{\Theta}^1, \undertilde{\Theta}^2).
\end{equation*}
Therefore, we have that
\begin{align*}
&\mathbb{P}\left(\left|\hat{\rho}(\undertilde{\lambda}^1, \undertilde{\lambda}^2) - \hat{\rho}(\undertilde{\Theta}^1, \undertilde{\Theta}^2) \right| > \epsilon/2\right)\\
& \leq \mathbb{P}\left(\hat{\rho}(\undertilde{\lambda}^1, \undertilde{\lambda}^2) \neq \hat{\rho}(\undertilde{\Theta}^1, \undertilde{\Theta}^2)\right)\\
&\leq \mathbb{P} \left(\hat{r}^l_i \neq r^l_i \;\; \text{for some} \;\; i=1,\ldots, k\;\; \text{and}\;\; l =1,2 \right)\\
& \leq \sum_{l =1}^2\sum_{i=1}^k\mathbb{P}\left( \hat{r}^l_i \neq r^l_i \right)
\end{align*}
To prove \eqref{eq:boundeig}, using the above inequalities, it is enough to show for $l = 1,2$ and $i = 1, \ldots, k$ that
\begin{equation*}
\mathbb{P}\left( \hat{r}^l_i \neq r^l_i \right) < \frac{\delta}{4k}.
\end{equation*}
Let $\gamma = \min\{| \Theta^l_i - \Theta^l_j |: i, j = 1, \ldots, k \;\; \text{and}\; l = 1,2\}$. We have that
\begin{equation*}
\mathbb{P}\left( \hat{r}^l_i \neq r^l_i \right) \leq \mathbb{P}\left(\left|\frac{\lambda_i^l}{n} - \Theta^l_i \right| > \gamma/2 \right).
\end{equation*}
For an increasing sequence of ER random graph with parameter $p$ and their respective spectral radii $\lambda(n)$, it is well known that $\lambda(n)/n$ converges in probability to $p$ (\cite{ding2010spectral}), therefore, for large enough $n_0$ we have that for all $n > n_0$
\begin{equation*}
\mathbb{P}\left(\left|\frac{\lambda_i^l}{n} - \Theta^l_i \right| > \gamma/2 \right) < \frac{\delta}{4k}.
\end{equation*}
This concludes the proof of the proposition.
\end{proof}
Spearman's correlation coefficient ($\rho$) assumes values between -1 and 1, where $\rho$ is $+1$ in the case of a perfect monotonically increasing relationship and $-1$ in the case of a perfect monotonically decreasing relationship. In the case of imperfect monotonically dependence, $-1 < \rho < +1$, and in the case of monotonically independent random variables, $\rho=0$.
Thus, the hypothesis test to identify Spearman's correlation between two vectors of graphs can be defined as:
$\text{H}_0$: $\rho=0$ (null hypothesis)\\
$\text{H}_1$: $\rho\ne0$ (alternative hypothesis)
The Spearman's rank correlation coefficient under the null hypothesis can be asymptotically approximated by a Student's t-distribution with $k-2$ degrees of freedom as (\cite{spearman1904general}):
\begin{math}
t=\frac{\hat{\rho}\sqrt{k-2}}{\sqrt{1-\hat{\rho}^2}}
\end{math}
Now, suppose we have two conditions A and B and consequently, we have four graphs ${\undertilde{G}}^1_{\text{A}}$ and ${\undertilde{G}}^2_{\text{A}}$ in condition A, and ${\undertilde{G}}^1_{\text{B}}$ and ${\undertilde{G}}^2_{\text{B}}$ in condition B. We are interested in testing whether the correlation between graphs ${\undertilde{G}}^1_{\text{A}}$ and ${\undertilde{G}}^2_{\text{A}}$ are equal to the correlation between ${\undertilde{G}}^1_{\text{B}}$ and ${\undertilde{G}}^2_{\text{B}}$. In other words, we would like to test
$\text{H}_0: \rho_{\text{A}} = \rho_{\text{B}}$\\
$\text{H}_1: \rho_{\text{A}} \ne \rho_{\text{B}}$.
This test can be performed by using the procedure developed by \cite{Fisher}. Let $k_\text{A}$ and $k_\text{B}$ be the number of graphs in conditions A and B, respectively. First, transform each of the two correlation coefficients as $\hat{\rho}'_{\text{A}} = \frac{1}{2}\text{log}(\frac{1+\hat{\rho}_{\text{A}}}{1-\hat{\rho}_{\text{A}}})$ and $\hat{\rho}'_{\text{B}} = \frac{1}{2}\text{log}(\frac{1+\hat{\rho}_{\text{B}}}{1-\hat{\rho}_{\text{B}}} )$. Then, calculate the test statistic as $z=\frac{\hat{\rho}'_{\text{A}} - \hat{\rho}'_{\text{B}}}{\sqrt{ \frac{1}{k_\text{A} - 3} + \frac{1}{k_\text{B}-3}}}$. Finally, compute the $p$-value for the $z$-statistic.
In the present study, we used the \verb+R+ function \verb+cor.test+ with parameter \verb+method='spearman'+ (package \verb+stats+) to compute the Spearman's correlation test.
\section{Simulation studies} \label{section:simulations}
We carried out Monte Carlo simulations in five different random graphs to illustrate the performance of the proposed framework. Among several classes of random graphs, we describe the Erd\"os-R\'enyi random graph (\cite{Erdos}), random geometric graph (\cite{Penrose}), random regular graph (\cite{Meringer}), Barab\'asi-Albert random graph (\cite{Barabasi}), and Watts-Strogatz random graph (\cite{Watts}), due to their importance to model real world events or their well known theoretical results.
\subsection{Random graph models}
\subsubsection{Erd\"os-R\'enyi random graph} \label{section:random}
Erd\"os-R\'enyi random graphs (\cite{Erdos}) are one of the most studied random graphs. Erd\"os and R\'enyi defined a random graph as $n$ labeled vertices in which each pair of vertices $(v_i,v_j)$ is connected by an edge with a given probability $p$.
The spectral radius of an Erd\"os-R\'enyi random graph is $np$ (\cite{Furedi}).
The \verb+R+ function used to generate an Erd\"os-R\'enyi random graph is \verb+erdos.renyi.game+ (package \verb+igraph+). The \verb+igraph+ package can be downloaded from the \verb+R+ website (http://www.r-project.org).
\subsubsection{Random geometric graph}
A random geometric graph (RGG) is a spatial network. An undirected graph is constructed by randomly placing $n$ vertices in some topological space $\text{R}^d$ (e.g. a unit square - $d=2$) according to a specified probability distribution (e.g. uniform distribution) and connecting two vertices by an edge if their distance (according to some metric, e.g., Euclidian norm) is smaller than a certain neighborhood radius $r$. Hence, random geometric graphs have a spatial element absent in other random graphs.
The spectral radius of a random geometric graph converges almost surely to $r^{d}$ (\cite{Bordenave}).
The \verb+R+ function used to generate a geometric random graph is \verb+grg.game+ (package \verb+igraph+).
\subsubsection{Random regular graph}
A random regular graph is a graph where each vertex has the same number of adjacent vertices; i.e. every vertex has the same degree. A random regular graph with vertices of degree $deg$ is called a random $deg$-regular graph or random regular graph of degree $deg$ (\cite{Meringer}).
Random regular graphs of degree at most 2 are well known: a 0-regular graph consists of disconnected vertices; a 1-regular graph consists of disconnected edges; a 2-regular graph consists of disconnected cycles and infinite chains; a 3-regular graph is known as a cubic graph.
The spectral radius of a random $deg$-regular graph is $deg$ (\cite{Alon}).
The \verb+R+ function used to generate a regular random graph is \verb+k.regular.game+ (package \verb+igraph+).
\subsubsection{Barab\'asi-Albert random graph} \label{section:SF-graph}
Barab\'asi-Albert random graphs proposed by \cite{Barabasi} have a power-law degree distribution due to vertices preferential attachment (the more connected a vertex is, the more likely it is to receive new edges). \cite{Barabasi} proposed the following construction: start with a small number of ($n_0$) vertices and at every time-step, add a new vertex with $m_1$ ($m_1 \le n_0$) edges that connect the new vertex to $m_1$ different vertices already present in the system. When choosing the vertices to which the new vertex connects, assume that the probability that a new vertex will be connected to vertex $v_i$ is proportional to the degree of vertex $v_i$ and the scaling exponent $p_s$ ($P(v_i) \sim degree(v_i)^{p_s}$, where $degree(v_i)$ is the number of adjacent edges of vertex $v_i$ in the current time step) which indicates the order of the proportionality ($p_s=1$ linear; $p_s=2$ quadratic and so on).
Let $k_0$ be the smallest degree, the spectral radius of the Barab\'asi-Albert random graph is of the order of $k_{0}^{1/2}n^{1/2(p_s-1)}$ (\cite{Dorogovtsev}).
The \verb+R+ function used to generate a Barab\'asi-Albert random graph is \verb+barabasi.game+ (package \verb+igraph+).
\subsubsection{Watts-Strogatz random graph} \label{section:WS-graph}
Watts-Strogatz random graph (\cite{Watts}) is a random graph that interpolates between a regular lattice and an Erd\"os-R\'enyi random graph. This random graph present small-world properties (short average path lengths, i.e., most vertices are not neighbors of one another but can be reached from every other vertex by a small number of steps) and higher clustering coefficient (the number of triangles in the graph) than Erd\"os-R\'enyi random graphs.
The algorithm to construct a Watts-Strogatz random graph is as follows:
{\bf Input}: Let $n$, $nei$, and $p_w$ be the number of vertices, the number of neighbors (mean degree), and the rewiring probability, respectively.
\begin{enumerate}
\item construct a ring lattice with $n$ vertices, in which every vertex is connected to its first $nei$ neighbors ($\frac{nei}{2}$ on either side);
\item choose a vertex and the edge that connects it to its nearest neighbor in a clockwise sense. With probability $p_w$, reconnect this edge to a vertex chosen uniformly at random over the entire ring. This process is repeated by moving clockwise around the ring, considering each vertex in turn until one lap is completed. Next, the edges that connect vertices to their second-nearest neighbors clockwise are considered. As in the previous step, each edge is randomly rewired with probability $p_w$; continue this process, circulating around the ring and proceeding outward to more distant neighbors after each lap, until each edge in the original lattice has been considered once.
\end{enumerate}
{\bf Output}: the Watts-Strogatz random graph
To the best of our knowledge, the spectral radius of a Watts-Strogatz random graph is not analytically defined, but there are empirical evidences that it is a function of $p_w$ and $nei$ (\cite{Mieghem}).
The \verb+R+ function used to generate a Watts-Strogatz random graph is \verb+watts.strogatz.game+ (package \verb+igraph+).
\subsection{Simulation description} \label{simulation}
We designed three simulations to evaluate: (i) whether the Spearman's correlation between the spectral radii indeed retrieves the association between the parameters of the graph; (ii) the control of the rate of type I error and power of the method based on the spectral radius; and (iii) the performance of the Fisher's test on the spectral radius.
\subsubsection{Simulation 1}\label{simulation1}
In order to verify whether the Spearman's correlation coefficient between the spectral radii in fact retrieves the association between the parameters of the graph, we compared the correlation estimated directly from the parameters with the correlation obtained by analyzing the spectral radius. The design of the experiment is as follows: we set the graph model as the Erd\"os-R\'enyi random graph, the number of graphs as $k=50$ and the size of the graph as $n=100$. The parameter $p$ of the Erd\"os-R\'enyi random graphs were generated from a bivariate normal distribution with mean zero and covariance matrix $\Sigma=\begin{pmatrix} 1 & s\\ s & 1\end{pmatrix}$ with $s = -1.0, -0.9, \ldots,0, \ldots, 0.9, 1.0$. Spearman's correlation coefficients are estimated by using the spectral radii. For each value of $s$, we repeated this procedure 30 times and compared the estimated correlation coefficient with the correlation ($s$) in fact used to generate the graphs.
\subsubsection{Simulation 2}\label{simulation2}
In order to evaluate the control of the rate of false positives under the null hypothesis and also its statistical power to identify correlation between two vectors of graphs, we constructed the following simulation study.
The parameters of the graphs are generated from a bivariate normal distribution with covariance matrix $\Sigma$ ($(\Theta^1, \Theta^2) \sim N(0, \Sigma)$). In order to evaluate the control of the rate of false positives under the null hypothesis (no correlation), we set $\Sigma=\begin{pmatrix} 1 & 0\\0 & 1\end{pmatrix}$. To evaluate the power of the test, we set $\Sigma=\begin{pmatrix} 1 & 0.5\\0.5 & 1\end{pmatrix}$. Notice that the vectors of parameters ($(\undertilde{\theta}^1, \undertilde{\theta}^2)$) must be linearly normalized in the interval $[0, 1]$. The set-up of the parameters of the graphs is as follows:
\begin{itemize}
\item Erd\"os-R\'enyi random graph: $p := \theta$
\item Random geometric graph: $r := \theta$ and $d=2$
\item Random regular graph: $deg$ := $\text{integer part of } 10 \times \theta$
\item Barab\'asi-Albert random graph: $k_0=3$ and $p_s := \text{integer part of } 10\times \theta$
\item Watts-Strogatz random graph: $nei=3$, and $p_w := \theta$
\end{itemize}
The number of graphs varied in $k = 20, 40, 60, 80, 100$. The size of the graphs was set to $n=50$.
The vectors of spectral radii ($\undertilde{\lambda}^1$ and $\undertilde{\lambda}^2$) were computed by using the adjacency matrix of each graph; and the Spearman's correlation test applied on both the parameters and the spectral radii.
This process was repeated 1,000 times for each number of graphs $k$ and pair of graph models. In order to evaluate and compare the power of the test between applying the correlation test on the parameters of the graph or on the spectral radii, we constructed receiver-operating characteristic (ROC) curves. The ROC curve is a bi-dimensional plot with the one minus the specificity (number of true negatives/(number of true negatives+number of false positives)) on the $x$-axis and the sensitivity (number of true positives/(number of true positives+number of false negatives)) on the $y$-axis. A curve above and further the diagonal means high power while a curve close to the diagonal means random decisions. In our case, the nominal $p$-value is on the $x$-axis and the proportion of rejected null hypothesis (the proportion of associations identified between two random variables), on the $y$-axis. ROC curves were plot (i) to verify the control of the rate of false positives; (ii) to evaluate the power of the test; and (iii) to compare the performance of the correlation estimated by using the spectral radius and the original parameter of the graph.
\subsubsection{Simulation 3}\label{simulation3}
In order to evaluate the performance of Fisher's test on both the control of the rate of false positives under the null hypothesis and also its statistical power between two conditions A and B, we constructed ROC curves for the following experimental set-up.
The graphs were constructed by using the Erd\"os-R\'enyi random graph model with the parameter $p$ generated by bivariate normal distributions with means zero and covariance matrices $\Sigma_{\text{A}}$ and $\Sigma_{\text{B}}$ for conditions A and B, respectively. In order to evaluate the control of the rate of false positives under the null hypothesis (same correlation between conditions A and B), we set $\Sigma_{\text{A}}=\Sigma_{\text{B}}=\begin{pmatrix} 1 & 0.5\\0.5 & 1\end{pmatrix}$. To evaluate the power of the test in identifying differences in correlation between conditions A and B, we set $\Sigma_{\text{A}}=\begin{pmatrix} 1 & 0.3\\0.3 & 1\end{pmatrix}$ and $\Sigma_{\text{B}}=\begin{pmatrix} 1 & 0.6\\0.6 & 1\end{pmatrix}$. The number of graphs varied in $k = 20, 40, 60, 80, 100$. The size of the graphs was set to $n=50$. This process was repeated 1,000 times for each number of graphs $k$.
\subsection{Results and analysis of the simulations}
One first natural question is, instead of using the spectral radius, may one use another feature of the graph, such as the number of edges or measures of network centrality? In order to verify whether the spectral radius is indeed better than those measures, we simulated the five random graph models described in section \ref{section:random} and compared the performance between the spectral radius against other six measures, namely transitivity centrality, betweenness centrality, closeness centrality, eigenvector centrality, degree centrality, and assortativity.
The experimental set-up is as follows. The parameters of the graphs were generated by uniform distributions: Erd\"os-R\'enyi random graph $p \sim U(0,1)$, random geometric graph $r \sim U(0,1)$, random regular graph $k \sim \text{integer part of }U(1,10)$, Barab\'asi-Albert random graph $p_s \sim \text{integer part of }U(1,4)$, Watts-Strogatz random graph $p_w \sim U(0,1)$. The number of graphs is set to $k=30$. The number of vertices of the graph varied in $n=25, 50, 75, 100$. Then, we calculated the Spearman's correlation coefficient between the original parameter used to generate the graph and the feature (the spectral radius, transitivity centrality, betweenness centrality, closeness centrality, eigenvector centrality, degree centrality, and assortativity). This process was repeated 100 times for each $n$ and graph model. The correlation calculated here measures how much information regarding the parameter is represented in the feature. In other words, it measures how well the feature describes the parameter.
\begin{figure}
\centering
\includegraphics[width=4in]{./Figure2.pdf}
\caption{Simulation study to select the most suited feature of the graph to be used in the identification of correlation between vectors of graphs. The $x$-axis and $y$-axis represent the size of the graph $n$ (number of vertices) and the average Spearman's correlation coefficient between the original parameter and the feature. The error bars represent the 95\% confidence interval. $\lambda$: spectral radius; TC: transitivity centrality; BC: betweenness centrality; CC: closeness centrality; EVC: eigenvector centrality; DC: degree centrality; AS: assortativity. Notice that for Erd\"os-R\'enyi, geometric, and $k$-regular graphs, spectral radius, transitivity, and closeness centralities are the best choices. For Albert-Barab\'asi random graph model, the spectral radius and the closeness centrality are the best features. However, for Watts-Strogatz random graph model, the spectral radius is the most correlated to the parameter ($p_w$) of the graph. \label{figure:best_feature}}
\end{figure}
Figure \ref{figure:best_feature} illustrates the average Spearman's correlation coefficient and the 95\% confidence interval between the actual parameter used to generate the graphs and the features. For Erd\"os-R\'enyi random graph, the spectral radius, transitivity, and closeness centralities presented the highest associations with the parameter $p$. For geometric, $k$-regular, and Barab\'asi-Albert random graph models, the spectral radius and the closeness centrality are the features that better represent the actual parameter. For Watts-Strogatz random graph model, the spectral radius is the most correlated to the parameter of the graph. By combining all these results, we conclude that the spectral radius is the one that contains the highest information regarding the parameters and consequently is the most suited feature to be used to identify correlation between graphs. The quite high performance of closeness centrality can be explained by the fact that for Erd\"os-R\'enyi, geometric, $k$-regular, and Barab\'asi-Albert random graph models, the parameters of the graph are associated with the number of edges. Notice that highly connected graphs tends to present higher closeness centrality. On the other hand, the parameter $p_w$ of the Watts-Strogatz random graph model represents the rewiring probability of the edges. In other words, what vary along Watts-Strogatz random graphs is their structure (connectivity), and not the number of edges. Thus, the performance of closeness centrality becomes poor and not adequate to identify correlation when the structure of the graph is modified without altering the number of edges. Some features such as the degree centrality and assortativity for the $k$-regular random graph model, and the transitivity centrality for the Barab\'asi-Albert random graph model could not be calculated. It happened because a $k$-regular graph presents the same degree for all vertices; therefore, all the vertices present the same degree centrality. For the Barab\'asi-Albert random graph model, a few vertices present very high degree while the majority of vertices present low degree.
Figure \ref{figure:boxplot} represents the correlation coefficient obtained by carrying out simulation 1 (section \ref{simulation1}). The $x$-axis indicates the real correlation used to generate the parameters while the boxplots on the $y$-axis indicate the correlation estimated by using the Spearman's correlation on the spectral radius. Notice that the correlation estimated by applying on the spectral radius ($y$-axis) is indeed monotonic (and also linear) in relation to the actual correlation between the parameters of the graph ($x$-axis). In other words, the higher the correlation between the parameters, the higher is the Spearman's correlation coefficient. Therefore, the spectral radius is in fact a good feature to identify correlation between graphs.
\begin{figure}
\begin{center}
\includegraphics[width=4in]{./Figure3.pdf}
\end{center}
\caption{Boxplots to investigate the monotonicity of the correlation between spectral radii and the real correlation between the parameters used to generate the graphs. The $x$-axis indicates the real correlation used to generate the parameters while the $y$-axis indicates the correlation estimated by the Spearman's correlation using the spectral radius. Notice that the estimated correlation is monotonic (and linear) in relation to the actual correlation between the parameters of the graphs. \label{figure:boxplot}}
\end{figure}
Figures \ref{figure:roc-H0} and \ref{figure:roc-H1} describe the ROC curves for the correlation between different classes of graph models (Erd\"os-R\'enyi, geometric, regular, Barab\'asi-Albert, and Watts-Strogatz) under the null and alternative hypotheses, respectively, in 1,000 repetitions. For further details regarding the design of this experiment, refer to simulation 2 described in section \ref{simulation2}. The panels on the upper triangle represent the ROCs curves obtained by using the spectral radius. The panel on the lower triangle represents the ROC curve (reference ROC curve) obtained by using the original parameters of the graph. By analyzing the ROC curves, it is possible to notice at least that: (i) the ROC curves under the null hypothesis are in the diagonal (Figure \ref{figure:roc-H0}), i.e., the statistical test is effectively controlling the rate of false positives (the proportion of rejected null hypothesis is as expected by the $p$-value threshold); (ii) the power of the test increases as the number of graphs ($k$) increases (Figure \ref{figure:roc-H1}); and (iii) ROC curves obtained by applying Spearman's correlation in the spectral radius (ROC curves in the upper triangle of Figure \ref{figure:roc-H0} and \ref{figure:roc-H1}) are similar to the one obtained by applying on the original parameters of the graphs (ROC curves in the lower triangle (reference ROC curve) of Figure \ref{figure:roc-H0} and \ref{figure:roc-H1}). These simulation studies show that, in fact, it is possible to retrieve the underlying correlation between the parameters of the graphs by analyzing the spectral radius of their adjacency matrices, at least, for these five random graph models.
\begin{figure}
\begin{center}
\includegraphics[width=4in]{./Figure4.pdf}
\end{center}
\caption{On the upper triangle, ROC curves constructed based on the correlations estimated from spectral radii. On the lower triangle, the reference ROC curve constructed based on the parameter of the graph. The $x$-axis represents the $p$-value's threshold and the $y$-axis represents the proportion of rejected null hypothesis in 1,000 repetitions. The different types of line (solid and dashed) represent the number of graphs ($k=20, 40, 60, 80, 100$) used in each repetition. Notice that all lines are in the diagonal, i.e., the statistical test is indeed controlling the rate of false positives as expected. \label{figure:roc-H0}}
\end{figure}
\begin{figure}
\begin{center}
\includegraphics[width=4in]{./Figure5.pdf}
\end{center}
\caption{On the upper triangle, ROC curves constructed based on the correlations estimated from spectral radii. On the lower triangle, the reference ROC curve constructed based on the parameters of the graph. The $x$-axis represents the $p$-value's threshold and the $y$-axis represents the proportion of rejected null hypothesis in 1,000 repetitions. The different types of line (solid and dashed) represent the number of graphs ($k=20, 40, 60, 80, 100$) used in each repetition. Notice that the greater the number of graphs ($k$), the higher is the power of the test. \label{figure:roc-H1}}
\end{figure}
Figure \ref{figure:fisher-roc} panels (A) and (B) describe the ROC curves for simulation 3 (simulation to evaluate the Fisher's test. For further details, refer to section \ref{simulation3}) under the null and alternative hypotheses, respectively. By analyzing Figure \ref{figure:fisher-roc}A, it is possible to notice that the test in fact controls the rate of false positives. By analyzing Figure \ref{figure:fisher-roc}B, it is possible to see that the power of the test increases proportionally to the number of graphs. In summary, the Fisher's test is indeed identifying distinct correlations between two conditions.
\begin{figure}
\begin{center}
\includegraphics[width=4in]{./Figure-ROC-Fisher.pdf}
\end{center}
\caption{Comparison of two conditions by using the Fisher's test. The $x$-axis represents the $p$-value's threshold and the $y$-axis represents the proportion of rejected null hypothesis in 1,000 repetitions. The different types of line (solid and dashed) represent the number of graphs ($k=20, 40, 60, 80, 100$) used in each repetition. (A) Under the null hypothesis, i.e., there is no difference in correlation between two conditions. The lines in the diagonal show that the statistical test is indeed controlling the rate of false positives. (B) The correlation between two conditions is in fact different. Notice that the greater the number of graphs ($k$), the higher is the power of the test. \label{figure:fisher-roc}}
\end{figure}
\section{Application to Autism Spectrum Disorder dataset}
Autism spectrum disorder (ASD) is a neurodevelopmental disorder usually diagnosed in early childhood. ASD etiology is complex and not completely understood (\cite{Ecker2015}), involving several risk factors, such as genetic, environmental, psychological, and neurobiological (\cite{Hallmayer, Betancur}). It is usually diagnosed by a multidisciplinary group composed of physicians and psychologists that, through clinical interviews and tests, identify a combination of unusual behavioral characteristics and try to assess deficits in social communication, social reciprocity, and repetitive and stereotyped behaviors and interests (\cite{Wing}). These symptoms frequently manifest during the child's first three years and are accompanied by developmental differences in brain anatomy, functioning, and functional brain connectivity.
Current studies suggest that ASD is a disorder of brain systems (\cite{Wass2011, Stevenson2012, Just2012, Frith2003}) and that anatomical abnormalities are subtle but widespread over the brain (\cite{Ecker2013}). Thus, one straightforward approach to enhance our comprehension of neural substrates of this disorder is to investigate differences in brain connectivity when compared to controls. In this context, most studies focus on finding differences between region-to-region functional connectivity or in vertex centrality measures. Due to the lack of a suitable methodological framework, investigations in how the structural organization in one brain sub-network is associated with the organization of another sub-network is scarce. Moreover, the description of these ``correlations'' among sub-networks in clinical populations remains unexplored. In the current study, we establish a novel framework to define correlation between graph structures and illustrate the usefulness of this method by enhancing our comprehension on the neurobiology of ASD.
\subsection{Dataset description}
A large resting state fMRI dataset initially composed of 908 individuals comprising controls and subjects diagnosed with ASD was downloaded from the ABIDE Consortium website (\url{http://fcon_1000.projects.nitrc.org/indi/abide/}). The ABIDE dataset is fully anonymized in compliance with the HIPAA Privacy Rules and the 1000 Functional Connectomes Project/INDI protocols. Protected health information is not included in this dataset. Further details can be obtained from the ABIDE Consortium website.
The pre-processing of the imaging data was performed using the Athena pipeline downloaded from (\url{http://www.nitrc.org/plugins/mwiki/index.php/neurobureau:AthenaPipeline}). The 351 regions of interest (ROIs) considered as the vertices of the brain network were defined by the CC400 atlas (\cite{Craddock}). A total of 35 ROIs including the ventricles were identified by using the MNI atlas and removed, resulting 316 ROIs for the construction of brain networks. The average time series within the ROIs were considered as to be the region representatives. Subject's head movement during magnetic resonance scanning was treated by using the ``scrubbing'' procedure described by \cite{Power}. Individuals with a number of adequate scans less than 100 after the ``scrubbing'' were discarded, which resulted in 814 subjects for subsequent analyses. Thus, the dataset used in this study was composed of 529 controls (430 males, mean age $\pm$ standard deviation, $17.47 \pm 7.81$ years) and 285 ASD (255 males, $17.53 \pm 7.13$ years).
\subsection{Brain functional networks}
The schema of the entire fMRI data analysis can be seen in Figure \ref{figure:schema}. A brain functional network can be modeled as a graph, i.e., a pair of sets $G=(V,E)$, in which $V$ is the set of regions of interest - ROIs (vertices), and $E$ is a set of functional connectivity (edges) connecting the ROIs. In the current study, the functional connectivity between two ROIs was obtained by calculating the Spearman's correlation coefficient between ROIs $i$ and $j$ ($i,j = 1, \ldots, 316$) for each individual $q=1, \ldots, 814$. Thus, a brain functional network $G^q$ with 316 ROIs can be represented by its adjacency matrix ${\bf A}^q$ with $316 \times 316$ elements ${\bf A}^q_{ij}$ containing the connectivity (Spearman's correlation coefficient) between the ROIs $i$ and $j$ ($i,j=1,\ldots, 316$; $q=1, \ldots, 814$).
\begin{figure}
\begin{center}
\includegraphics[width=4in]{./Figure-schema.pdf}
\end{center}
\caption{General pipeline schema of the fMRI data analysis. Raw fMRI data is pre-processed by using the Athena pipeline. Head movement effects are removed by using the “scrubbing” procedure. Functional networks were constructed by estimating the Spearman's correlation among ROIs and site effects removed by a generalized linear model. The number of functional brain sub-networks (clusters) were estimated by the slope statistic and the sub-networks were obtained by applying the spectral clustering algorithm. Finally, the correlation among sub-networks were estimated by the Spearman's correlation applied on the spectral radii. \label{figure:schema}}
\end{figure}
Site effects were modeled with a generalized linear model (GLM), i.e., with the site as a categorical predictor variable and the correlation coefficient as the response variable. The residuals of the model were used for subsequent analyses as the connectivity filtered by the site effect.
$P$-values for each Spearman's correlation coefficient between ROIs $i$ and $j$ were calculated and corrected for the false discovery rate (FDR) (\cite{Benjamini}). To estimate the number of sub-networks and also to identify the sub-networks themselves in a data-driven manner, we applied the slope criterion (\cite{Fujita}) and the spectral clustering algorithm (\cite{Ng}), respectively, on the average connectivity matrix (the average of the $z$-values associated with the $p$-values) taking into account the entire dataset. The application of the spectral clustering resulted in five (estimated by the slope statistic) well defined sub-networks namely somatomotor, visual, default-mode, cerebellar, and control, depicted in Figure \ref{figure:cluster}.
\begin{figure}
\begin{center}
\includegraphics[width=4in]{./Figure6.pdf}
\end{center}
\caption{Brain functional sub-networks. The ROIs were clustered by the spectral clustering algorithm. The number of sub-networks was estimated as five by the slope statistic. Each sub-network is represented by a different color, namely somatomotor (green), visual (blue), default-mode (purple), cerebellar (red), and control (orange). R: right; L: left. \label{figure:cluster}}
\end{figure}
To obtain the adjacency matrix that represents the brain functional sub-network of each individual, we set ${\bf A}^{q}_{ij} = 1$ if the $p$-value corrected for the FDR is less than 0.05, and ${\bf A}^{q}_{ij} = 0$, otherwise. Notice that the Spearman's correlation test is not used as a statistical test to identify correlation between two ROIs but only as an objective criterion to construct the adjacency matrix of the graph. Then, we calculated the spectral radius for each sub-network of each subject. Thus, we obtained five vectors (one for each sub-network) of size 529 and other five vectors of size 285, for controls and ASD, respectively.
The 10 correlations among all the five sub-networks were estimated by using the spectral radius only for controls (Figure \ref{figure:net}). Figure \ref{figure:net} shows the statistically significant ($p<0.05$ after FDR correction for multiple tests) correlations between brain sub-networks. Interestingly, all sub-networks are positively correlated among them. The thickness of the edge represents the strength of the correlation, i.e., the thicker the edge, the higher is the correlation between sub-networks.
\begin{figure}
\begin{center}
\includegraphics[width=4in]{./Figure7.pdf}
\end{center}
\caption{Correlation between control brain sub-networks. The thickness of the edge represents the correlation coefficient, i.e., the thicker the edge, the higher is the absolute value of the correlation between sub-networks. Only statistically significant correlations at a significance threshold of 0.05 (after FDR correction for multiple tests) are shown. All identified correlations are positive. \label{figure:net}}
\end{figure}
Then, to identify correlations among sub-networks that are different between controls and ASD, we carried out the statistical test developed by Fisher (\cite{Fisher}) (section \ref{section:spearman_correlation}).
Figure \ref{figure:diff-net} illustrates the results obtained by comparing the correlations between controls versus ASD in the ``scrubbed'' data. The ``scrubbing'' procedure (\cite{Power}) is necessary to remove head movement effects that may cause spurious results. Only correlations that are statistically different between controls and ASD are represented by edges. At the edges there are the scatterplots with the linear regression lines that fit the data (blue and red represent the spectral radii of controls and ASD, respectively) and the Spearman's correlation coefficient for controls and ASD. Interestingly, default-mode and control, default-mode and somatomotor, and default-mode and visual systems showed statistically significant higher inter-correlation in ASD when compared to controls ($p<0.05$ after FDR correction for multiple tests).
\begin{figure}
\centering
\includegraphics[width=4in]{./figure-net.pdf}
\caption{Correlation between brain sub-networks in the ``scrubbed'' data. At the edges there are represented the scatterplots with the linear regression lines that fit the data and the Spearman's correlation coefficient for controls and ASD. Blue and red dots represent the eigenvalues for controls and ASD, respectively. Default-mode and control, default-mode and somatomotor, and default-mode and visual systems showed higher inter-correlation in ASD than in controls ($p<0.05$ after FDR correction for multiple tests) \label{figure:diff-net}}
\end{figure}
Currently, ASD is characterized as a disconnection syndrome (\cite{geschwind2007autism}) that affects information processing at both the local and global levels (\cite{hernandez2014neural}). This hypothesis has been mainly derived from studies suggesting that the wide heterogeneity of autistic symptoms and traits are highly unlikely to be due to impairments in a single system, or brain region, but instead emerge from disruptions in multiple neurocognitive systems (for a review see \cite{Ecker2015}). The framework for correlation inference between graphs proposed in our study therefore represents a useful and suitable method for examining brain connectivity alterations in ASD related to abnormalities in the relationships between domain-specific sub-networks in the brain.
Our findings indicate a different pattern of interactions between the default-mode and several sub-networks associated with sensorymotor, visual and executive processing in ASD. Abnormalities in the connectivity between nodes of the default-mode network (DMN) has been widely investigated in ASD (\cite{assaf2010abnormal, kennedy2008functional, weng2010alterations}) giving its associations with social cognition (\cite{buckner2008brain}). There are also functional connectivity studies reporting ASD-related differences in motor and visual networks (\cite{mcgrath2012atypical, nebel2014precentral}). Moreover, task-based connectivity studies have also reported differences in individuals with ASD in fronto-parietal nodes of the control network in response to cognitive control tasks (\cite{kana2007inhibitory}). While these previous studies have contributed to the characterization of the disconnection model of ASD, evidence of commonly interacting abnormalities in several distinct neurocognitive systems remain scarce. The present results therefore go beyond previous research by providing evidence for altered interactions between sub-networks in ASD ranging from sensory and motor processing to higher-order cognitive functions.
The mechanisms underlying this pattern of widespread connectivity abnormalities are likely to be related to the complex nature of atypical trajectory of brain maturation in ASD, which is probably mediated by many genetic and environmental factors and their interactions (\cite{abrahams2010connecting}). As a result, the impact of ASD on brain anatomy, functioning and connectivity is expected to be multidimensional and observable at multiple neural systems (\cite{Ecker2015}). For instance, ASD prediction accuracy using a support vector machine (SVM) analytic approach (\cite{ecker2010describing}) was shown to be improved by the use of a combined set of different morphometric features of the cortical surface rather than a specific anatomical characteristic; moreover a spatially distributed pattern of regions instead of an isolated brain region contributed with maximal classification weights to the prediction model. It is therefore likely that the distributed patterns of functional connectivity differences reported here also reflect some of these systems-level features of ASD pathology.
This result reinforces the theory that ASD is related to abnormal neurodevelopmental processes (Frith, 2003), which is spread across the whole brain. By using the proposed methodological framework of graph correlations, our main contribution was to demonstrate that these latent processes result in correlated topological organization between multiple brain systems. To the best of our knowledge, this is the first description of this feature in ASD.
\section{Final remarks}
In this study, we used the Spearman's rank correlation as a measure to identify dependence between graphs due to its simplicity. However, instead of Spearman's rank correlation, other methods that identify a broader type of dependence in data can be used, such as distance correlation (\cite{Szekely2007}), mutual information (\cite{shannon2015mathematical}), Hoeffding's D measure (\cite{hoeffding1948non}), and the measure proposed by Heller-Heller-Gorfine (\cite{Heller}).
Here, we focused on the development of a method to identify correlation for undirected graphs. For directed graphs, little is known about their spectrum. Notice that the adjacency matrix of an undirected graph is not symmetric, and consequently, the eigenvalues are not real numbers. Thus, in order to develop a framework to identify correlation between undirected graphs, it is necessary to better understand how are their eigenvalues (or eventually use another approach not based on their spectrum).
To the best of our knowledge, there is no general analytical equation that describes the spectral radius as a function of the parameters for all kinds of random graphs models. However, for the Erd\"os-R\'enyi random graph model we prove that the proposed approach is consistent and not biased. For the other four random graph models used in this study, we showed by simulations that the spectral radius is indeed associated with the parameters of the graph and it is also a good feature to infer correlation between graphs. This approach based on the spectral radius seems to be promising and we hope it may open opportunities to develop other formal statistical methods in graphs.
| {'timestamp': '2015-12-22T02:27:49', 'yymm': '1512', 'arxiv_id': '1512.06830', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06830'} | arxiv |
\subsection{Concrete Syntax}
The syntax of a hypothetical query in the system DES is as follows:
{\fontsize{11}{11}
\begin{verbatim}
rule1 /\ ... /\ ruleN => goal
\end{verbatim}
}
\vspace*{-5mm}
\noindent where each rule \mytt{rule{\em i}} can be a regular (usual) rule or a restricting rule.
A restricting rule has a head of the form \mytt{-Atom}, where \mytt{Atom} is an atom.
For facts, the body is empty (no neck symbol either) and the atom is ground to ensure safety \cite{Ullman88} (rules and queries must be safe as well).
Such a hypothetical query represents that, assuming that the current database is augmented with the regular rules in $\mathcal{R}=$\{\mytt{rule{\em i}} $|$ $\mytt{1}\leq \mytt{{\em i}} \leq \mytt{N}$\},
and that the meaning of the restricting rules in $\mathcal{R}$ are removed from their corresponding predicates,
then \mytt{goal} is computed with respect to such modified current database.
Note that the implication symbol \mytt{=>} (intuitionistic implication to the right) is used for the so-called embedded implication in {\em lieu} of the classical implication \mytt{:-} (implication to the left) typically used in logic programming systems.
Such query is also understood as a literal in the context of a rule, so that any rule can contain hypothetical goals (in particular, any \mytt{rule{\em i}}).
Variables in each \mytt{rule{\em i}} are encapsulated w.r.t. the rule (i.e., they are neither shared with other rules nor with the goal, even when they might have the same name).
Moreover, a hypothetical literal does neither share variables with other literals nor with the head of the rule in which it occurs.
As it is usual in logic programming systems, variables start with upper case or underscore and other program identifiers either start with lower case or are delimited by single quotes.
\subsection{A University Example}
Borrowing an example from \cite{Bonner90hypotheticaldatalog}, we consider an extended and adapted rule-based system for describing a university policy.
EDB is composed of: \mytt{student(S)} (meaning that \mytt{S} is a student), \mytt{course(C)} (\mytt{C} is a course), and \mytt{take(S,C)} (student \mytt{S} takes course \mytt{C}).
And IDB is: \mytt{grad(S)} (student \mytt{S} is eligible for graduation).
EDB contains facts as:
{\fontsize{11}{11}
\begin{verbatim}
student(adam). student(scott). course(eng). take(adam,eng). take(scott,his).
student(bob). student(tony). course(his). take(pete,his). take(scott,lp).
student(pete). course(lp). take(pete,eng). take(tony,his).
\end{verbatim}
}
IDB can contain rules as: \mytt{grad(S) :- take(S,his), take(S,eng).}
A regular query for students that would be eligible to graduate is:
{\fontsize{11}{11}
\begin{verbatim}
DES> grad(S)
{ grad(pete) }
\end{verbatim}
}
\noindent where the answer is the bag of goal instances delimited between curly brackets.
\begin{example}{}
A first hypothetical query for this database asks "If Tony took \mytt{eng}, would he be eligible to graduate?":
{\fontsize{11}{11}
\begin{verbatim}
DES> take(tony,eng) => grad(tony)
Info: Processing:
answer :- take(tony,eng)=>grad(tony).
{ answer }
\end{verbatim}
}
\noindent Here, the query has been automatically rewritten as a temporary view with name \mytt{answer}, i.e., a view which is added to the database and eventually removed.
This allows non atomic goals to be solved, as it is the case for an implication.
The outcome of the query is the result of the goal \mytt{answer}, which can be proved because assuming that premise allows to deduce the consequent.
\end{example}
\begin{example}{}
Also, more than one assumption can be simultaneously stated, as in: "If Tony took \mytt{eng}, and Adam took \mytt{his}, what are the students that are eligible to graduate?":
{\fontsize{11}{11}
\begin{verbatim}
DES> take(tony,eng) /\ take(adam,his) => grad(S)
Info: Processing:
answer(S) :- take(tony,eng)/\take(adam,his)=>grad(S).
\end{verbatim}
\vspace*{-1.8mm}
\noindent
\verb+{ answer(adam), answer(pete), answer(tony) }+
}
\end{example}
\pagebreak
\begin{example}{}
Another query is "Which are the students which would be eligible to graduate if \mytt{his} and \mytt{lp} were enough to get it?":
{\fontsize{11}{11}
\begin{verbatim}
DES> (grad(S) :- take(S,his), take(S,lp)) => grad(S)
Info: Processing:
answer(S) :- (grad(S):-take(S,his),take(S,lp))=>grad(S).
{ answer(pete), answer(scott) }
\end{verbatim}
}
Note that, although \mytt{S} occurs in both the premise and the conclusion of \mytt{=>}, they are not actually shared, and they simply act as different variables.
\end{example}
\begin{example}{}
\label{ex:assum-noassum}
Let us consider the following question: ``Which are the new students that are eligible to graduate if we consider that \mytt{his} and \mytt{lp} were enough to graduate?" This query needs to compare the students under the assumption with the students with no assumption at all.
A possible formulation is:
{\fontsize{11}{11}
\begin{verbatim}
DES> ((grad(S) :- take(S,his), take(S,lp)) => grad(S)), not grad(S)
Info: Processing:
answer(S) :- (grad(S):-take(S,his),take(S,lp)) => grad(S)),not grad(S).
{ answer(scott) }
\end{verbatim}
}
Note that the assumption affects only to the first goal \mytt{grad(S)}.
This assumption does not affect to the second, negated goal \mytt{grad(S)}.
Negation allows to compute the set difference of students.
\end{example}
\begin{example}{}
Next rules represent information about course prerequisites:
{\fontsize{11}{11}
\begin{verbatim}
pre(eng,lp). pre(hist,eng).
pre(Pre,Post) :- pre(Pre,X), pre(X,Post).
\end{verbatim}
}
Whether adding a new prerequisite implies a cycle can be asked with:
{\fontsize{11}{11}
\begin{verbatim}
DES> pre(lp,hist)=>pre(X,X)
Info: Processing: answer(X) :- pre(lp,hist)=>pre(X,X).
{ answer(eng), answer(hist), answer(lp) }
\end{verbatim}
}
The answer includes those nodes in the graph that are in a cycle.
Another option is to avoid cycles by using the following strong constraint (which are defined in \cite{sae13c-ictai13}):
{\fontsize{11}{11}
\begin{verbatim}
DES> :-pre(X,X)
\end{verbatim}
}
\noindent which means that it should not be the case of finding a subject that depends on itself.
Then, to list prerequisites assuming {\tt pre(lp,hist)}:
{\fontsize{11}{11}
\begin{verbatim}
DES> pre(lp,hist)=>pre(X,Y)
Info: Processing:
answer(X,Y) :- pre(lp,hist)=>pre(X,Y).
Error: Integrity constraint violation.
ic(X) :- pre(X,X).
Offending values in database: [ic(lp),ic(eng),ic(hist)]
Info: The following rule cannot be assumed:
pre(lp,hist).
{ answer(eng,lp), answer(hist,eng), answer(hist,lp) }
\end{verbatim}
}
So, the system informs that there is an inconsistency when trying to assert such offending fact (\mytt{pre(lp,hist)}), which makes prerequisites to form a cycle (as shown in the offending value list \mytt{[ic(lp),ic(eng),ic(hist)]}).
The system informs about the rules that cannot be assumed but continues its processing.
This is also useful to know the result for the admissible assumptions.
Note that, in general, offending facts can be a subset of the meaning of an assumed rule in the context of the current database.
To illustrate this, let's consider a game that students like to play that consists of tossing a coin:
{\fontsize{11}{11}
\begin{verbatim}
:- win, heads.
win :- heads ; tails.
\end{verbatim}
}
The predicate {\tt win} states that one wins if either heads or tails are got, and the constraint states that you have to get tails to win.
Here, the semicolon ``;" denotes disjunction as in Prolog syntax.
Then, the following hypothetical goal states whether assuming heads or tails leads to win.
{\fontsize{11}{11}
\begin{verbatim}
DES> heads /\ tails => win
Info: Processing:
answer :- heads/\tails=>win.
Error: Integrity constraint violation.
ic :- win, heads.
Info: The following rule cannot be assumed: heads.
{ answer }
\end{verbatim}
}
As it is informed, heads cannot be assumed in order to win.
\end{example}
\begin{example}{}
\label{ex:unsolved1}
Consider a query as: "If Pete had {\em not} taken \mytt{eng}, could he have graduated?", which is equivalent to say: "If \mytt{take(pete,eng)} were deleted from the database, could we infer \mytt{grad(pete)}?"
This query cannot be solved with the former proposal in \cite{sae13c-ictai13} but is supported in \cite{Bonner90hypotheticaldatalog}.
\end{example}
\begin{example}{}
\label{ex:unsolved2}
Further, consider the query: "What would happen if the current prerequisites were the other way round?"
This would imply to remove the intensional rule about prerequisites and add a modified one.
In turn, this is neither supported by \cite{Bonner90hypotheticaldatalog} nor by \cite{sae13c-ictai13}.
\end{example}
The next section introduces restricted predicates as a means to provide semantics to such deletions, which are referred to as {\em negative assumptions} in the context of an embedded implication.
Then, it will be possible to specify these last two examples with such implications.
\subsection{Syntax}
The syntax of the logic is first order and includes a universe of constant symbols, a set of variables and a set of predicate symbols ($\mathcal{P}$).
For concrete symbols, we write variables starting with upper-case and the rest of symbols starting with lower-case.
Removing function symbols from the logic is a condition for finiteness of answers, a natural requirement of database users.
A rule has the form $A \leftarrow \phi$, where $A$ is either a regular atom or a restricting atom
and $\phi$ is a conjunction of goals.
In addition, since we consider a hypothetical system, a goal can also take the form $G \leftarrow R$, a construction known as an embedded implication, where the premise $R$ represents an assumption and takes the form of a rule.
Moreover, we extend \cite{bonner90adding} by, first, allowing the premise to be a conjunction of rules $\bigwedge R_i$ as an assumption, and, second, allowing each $R_i$ to be a either a regular or a restricting rule.
From now on, we use the term rule to refer to both regular and restricting rules unless needed otherwise.
For solving the conclusion $G$, regular (restricting resp.) rules in $\bigwedge R_i$ will be used to augment (prune resp.) the meaning of their corresponding predicates with respect to the current database.
As an embedded implication behaves different from a regular implication \cite{bonner90adding}, it receives a different syntax symbol: $\Rightarrow$.
The following definition captures the syntax of the language, where $vars(T)$ is the set of variables occurring in $T$:
\begin{mydef}{Syntax of Rules}
\quad \\
$R := A \leftarrow G_1 \land \ldots \land G_n$ \\
$G := A \mid \neg G \mid R_1 \land \ldots \land R_m \Rightarrow G$\\
\noindent where $R$ and $R_i$ stand for rules (both regular and restricting), $G$ and $G_i$ for goals, $A$ for an atom (either regular or restricting), $n \geq 0$ (for $n=0$, $R$ is called a {\em fact}), $m>0$, and $vars(R_i)$ do not occur but in $R_i$.
\end{mydef}
Strong constraints are also supported in this new setting as rules with no head \cite{sae13c-ictai13}, and in the following we assume databases (as a set of rules and constraints) that are safe (with respect to query answers) and consistent (with respect to constraints) \cite{sae13c-ictai13}.
\subsection{Predicate Dependency Graph and Stratification}
\label{sect:pdg}
Introducing negation in literals of body clauses adds another issue:
The possibility to have more than one minimal model \cite{Ullman88}.
Stratification is a syntactic condition on programs which ensures that only one minimal model can be assigned to a program.
Predicates in the program are classified into strata so that negation does not occur through recursion.
For building a stratification (i.e., a mapping between predicate symbols and natural numbers), a device called predicate dependency graph (PDG) is usually convenient.
A PDG depicts the positive and negative dependencies between predicates.
\begin{mydef}{Dependencies}
A predicate $P$ {\em positively} ({\em negatively}, resp.) depends on $Q$ if $P$ is the predicate symbol of $A$ in a rule (both a program rule and a rule in a premise) $A \leftarrow G_1 \land \ldots \land G_n$ and $Q$ occurs either in some positive (either negative or restricting, resp.) atom $G_i$ or in $G$ in an embedded implication $G_j \equiv R_1 \land \ldots \land R_n \Rightarrow G$.
\end{mydef}
Note that the implication $\leftarrow$ is the source for dependencies, whereas the embedded implication $\Rightarrow$ is not.
However, all the non-atomic rules in the premise of $\Rightarrow$ are involved in adding dependencies.
This fact is propagated to the construction of the predicate dependency graph and the stratification for a program \cite{sae13c-ictai13}.
The PDG is the set of pairs $<N,A>$, where $N$ is the set of predicate symbols in $\Delta$ and $A$ is the set of arcs $P \leftarrow Q$ such that $P$ positively depends on $Q$, and $R \stackrel{\neg}{\leftarrow} S$ such that $R$ negatively depends on $S$.
The stratification is a mapping from predicates to integers such that if there is a dependency $R \leftarrow S$, then the integer assigned to $R$ must be less or equal than the one assigned to $S$.
If the dependency is negative: $R \stackrel{\neg}{\leftarrow} S$, then the relation is strictly less.
\subsection{Stratified Inference}
Following \cite{bonner90adding} we define a logical inference system for stratified intuitionistic logic programming, with the following main differences:
Allowing duplicates, integrity constraints, premises with multiple rules, and enforcing encapsulation of variables in premises.
Stratified inference requires an inference system for each stratum.
Inference starts from the lower stratum and its derivations are inputs to the inference for the next stratum above.
For a given stratum $i$, these derivations $\mathcal{A}$ are inference expressions which are constructed by the axioms derived in the stratum below and the rules defining the predicates belonging to stratum $i$.
Input $\mathcal{A}$ is the empty set for the first stratum.
In the following, we consider programs $\Delta$ which are both safe and stratifiable.
Otherwise, inference cannot be applied.
Duplicates would require working with bags (multisets) in order to denote the multiple occurrences of the same atom.
Instead, we resort to uniquely identifying each rule in a program and work with expressions tagged with such identifiers.
\begin{mydef}{Inference Expression}
\label{def:inference-expression}
An inference expression for a program $\Delta$ is denoted by $\Delta \vdash \psi$, where $\psi$ can be either an identified ground atom (either regular or restricting) $id:\phi$, where $id$ is a rule identifier and $\phi$ a ground atom, or $\bot$.
The inference expression is positive iff $\phi$ is positive and negative iff $\phi$ is negative, and inconsistent otherwise.
\end{mydef}
An inference expression includes the program $\Delta$ from which an identified atom can be deduced by an inference system.
By contrast with a Horn-clause logic system, the program $\Delta$ is not fixed and can vary because of the assumptions in the implications.
In \cite{sae13c-ictai13}, the definition of such an inference system can be found by using the adapted notion of inference expression in Definition \ref{def:inference-expression} above.
Solving an embedded implication amounts to add all the rules in its premise to the given program $\Delta$:
\begin{center}
$\infer[]{\Delta \vdash R_1 \land \ldots \land R_n \Rightarrow \phi}{\Delta \cup \{R_1, \ldots, R_n\} \vdash \phi}$
\end{center}
\noindent where a rule such this in the inference system is read as: If the formulas above the line can be inferred, then those below the line can also be inferred.
Also, recall that an inference expression can include either a regular atom or a restricting atom.
In the first case, we refer to such an axiom as a {\em positive axiom}, and, in the second case, as a {\em restricting axiom}.
So, $\Delta \vdash id:A$ is a positive axiom if $A$ is a regular atom, and a restricting axiom if $A$ is a restricting atom.
Like all Gentzen-style inference systems,
$d_s : \mathcal{A} \rightarrow \mathcal{A}$ enjoys monotonicity, idempotence and inflationaryness \cite{sae13c-ictai13}, where $\mathcal{A}$ denotes the set of inference expressions for programs.
The positive information of a set of axioms is defined as follows:
\begin{mydef}{Positive Information of a Set of Inference Expressions}
\label{def:positive}
The positive information of the set of inference expressions $\mathcal{A}$ is the set of each axiom including a regular atom in $\mathcal{A}$ excepting those with a counterpart restricting axiom (i.e., including a restricting atom) in $\mathcal{A}$ for the same context $\Delta$.
\end{mydef}
\noindent For example, $\Delta \vdash id_1:-take(tony,eng)$ is the counterpart restricting axiom of $\Delta \vdash id_2:take(tony,eng)$.
The negative information is deduced by applying the closed world assumption (CWA) \cite{Ullman88} to inference expressions.
However, due to the restricting atoms in inference expressions, this negative information is extended with such expressions, as it is defined next:
\begin{mydef}{Closed World Assumption of a Set of Inference Expressions}
\label{def:cwa}
The closed world assumption of the set of inference expressions $\mathcal{A}$ (written as $cwa(\mathcal{A})$) is the union of the positive information in $\mathcal{A}$ and the negative inference expression for $\Delta \vdash \phi$ such that either $\Delta \vdash \phi \notin \mathcal{A}$ or $\Delta \vdash \phi \in \mathcal{A}$ where $\phi$ is a restricting axiom.
\end{mydef}
This captures the negative information which can be deduced from a couple of sources: First, the intensional notion of negative information due to the classical closed world assumption and, second, the extensional (explicit) information due to the restricting part of the program (i.e., the set of restricting axioms).
This last one is called {\em restricting meaning} from now on.
Definition 13 in \cite{sae13c-ictai13} describes the unified stratified semantics as the bottom-up construction of the semantics, stratum by stratum, in which the inductive step $\mathcal{A}^{s+1} = cwa(d_{s+1}(\mathcal{A}^{s}))$ for $s \geq 0$ builds the semantics of the database in a finite number of steps (the number of strata is finite and no function symbols are allowed).
The meaning of a goal $\phi$ w.r.t. a set of axioms $\mathcal{A}$
is defined as
$solve(\phi,\mathcal{A}) = \{\Delta \vdash id:\psi \in \mathcal{A} ~ \mbox{such that} ~ \phi\theta = \psi\}$
where $\phi$ is a goal, $solve$ returns a bag, and $\theta$ is a substitution.
\subsection{Tabling}
\label{subsect:tabling}
Though there have been some works regarding implementations \cite{DBLP:conf/lpar/VieilleBKLM92}, as far as we know there has not been an implementation of hypothetical Datalog based on tabling and
allowing both embedded implications and stratified negation.
Tabling faces some well-known problems of logic programming implementations:
Unsoundness, repeated computations, and termination, providing some overcomes, and it has been useful in particular for implementing efficient systems.
It has been applied to different fields (logic programming systems \cite{Guzman:2008:ICC:1785754.1785768,DBLP:journals/tplp/SwiftW12}) and in particular to deductive databases (e.g., \cite{Shen02slt-resolutionfor,sae13a}).
Systems implementing tabling memorize the deduced instances (answers) to goals (calls) in an answer table and call table, respectively, in order to reuse already available deductions.
A call table $ct$ stores the goal calls made along resolutio
, and an answer table $at$ stores (ground) answers
The inference rule for hypothetical goals defined in Section \ref{sect:formal} amounts to try to prove a goal in the context of the current database augmented with the premise of the implication.
As a literal can be of the form $R_1 \land \ldots \land R_n \Rightarrow \phi$, where $R_i$ are rules and $\phi$ a goal, the database $\Delta$ for which this hypothetical literal is to be proven must be augmented with $\{R_1, \ldots, R_n\}$.
Deductions delivered in proving $\phi$ are only valid in the context of the augmented database, i.e., in the tabling tree constructed for $\phi$.
So, such deductions must be tagged in order to be only used in its context (contexts will be denoted by $\chi$).
Filling the answer and call tables is due to the so-called {\em memo function} which proceeds by tabled SLDNF resolution as detailed in \cite{sae13c-ictai13}.
The memo function $memo(\phi,\Delta,\chi,ct,at)$ is applied, respectively, to a goal $\phi$, a program $\Delta$, a context identifier $\chi$, and input call and answer tables $ct$ and $at$, and returns the (possibly) augmented call and answer tables $ct'$ and $at'$.
An entry in the answer table has the form $id^\chi:A$, where $id$ is the program rule identifier in the context $\chi$, and $A$ is either a positive or negative or restricting atom.
The positive information of an answer table is the set of all its entries $id^\chi:A$ such that $A$ is a regular atom.
The answer table is augmented with the head of a program clause with the corresponding substitutions derived from proving each of its literals in the body clause.
A literal can be proven if an atom (either regular or restricting) is found in the closed world assumption of the input answer table for the current context.
Such closed world assumption of an answer table is defined analogously to the closed world assumption of a set of inference expressions:
\begin{mydef}{}\hspace*{-2mm}{\em (Closed World Assumption of an Answer Table):~~}
\label{def:hyp_cwa_at}
The closed world assumption of an answer table $at$ (written as $cwa(at)$) in the context of a program is the positive information of $at$, and any $\epsilon^\chi:\neg A$ such that, either $id^\chi:-A \in at$ or $id^\chi:A \notin at$ for any rule identifier $id$ and context $\chi$, where $\epsilon$ is a fixed, arbitrary identifier which does not occur in the program.
\end{mydef}
Filling the answer and call tables is done by strata by ensuring that the meaning of negated atoms which are required to prove other goals are already stored in the answer table.
So, following the stratification for the program for a given goal $\phi$, a goal dependency graph is computed, which is the subgraph of the PDG such that contains all the reachable nodes from $\phi$.
Then, for each node $p_i$ in the subgraph such that there is a negative arc coming out from $p_i$, an open goal $\phi_i$ is built with the same arity as $p_i$.
Goals $\phi_i$ are ordered by $str(\Delta,\phi_i)$, so that lower-strata goals will be computed before upper-strata goals.
The goal dependency graph is specified in \cite{sae13c-ictai13} as the function $gdg(\Delta,\phi)$ which is applied to a program $\Delta$ and goal $\phi$, returning the pair of nodes and arcs $<N,A>$.
We refer here to \cite{sae13c-ictai13} for the definitions of the stratified meaning of a program restricted to a goal (Definition 19), the fixpoint of the database built with $\bigsqcup_{n\geq 0}$, and the meaning of a tabled goal (Definition 20).
\subsection{An Example}
Following an analogous example to the one in Section III.{\em B} in \cite{sae13c-ictai13}:
\begin{tabular}{l}
$route(X,Y) \leftarrow connected(X,Y) \lor connected(Y,X)$\\
$route(X,Y) \leftarrow route(X,Z) \land route(Z,Y)$\\
$no\_route(X,Y) \leftarrow station(X) \land station(Y) \land \neg route(X,Y)$\\
\end{tabular}
\noindent for which its PDG is $<\{station,$ $connected,$ $route,$ $no\_route\},$ $\{route \leftarrow connected,$ $route \leftarrow route,$ $no\_route \leftarrow station,$ $no\_route \stackrel{\neg}{\leftarrow} route\}>$, and a stratification is $\{(station,1)$, $(connected,1)$, $(route,1)$, $(no\_route,2)\}$.
Then, let us consider in addition to this database the predicate $closed/1$ that lists stations that must be closed sometime due to workmanship.
The following rule allows to know what are the possible connections under such an assumption:
\noindent
\begin{tabular}{rcll}
$restricted\_route(X,Y)$ & $\leftarrow$
& $(-connected(A,B) \leftarrow connected(A,B),closed(A)) \land$ \\
& & $(-connected(A,B) \leftarrow connected(A,B),closed(B))$ & $\Rightarrow route(X,Y)$
\end{tabular}
This new rule adds to the PDG the edges
$\{connected/2 \leftarrow closed/1,$
$connected/2 \leftarrow connected/2,$
$route/2 \stackrel{\neg}{\leftarrow} connected/2,$ $restricted\_route/2 \leftarrow route/2\}$ and the stratification becomes:
$\{(closed/1,1),$
$(connected/2,1),$
$(station/1,1),$
$(route/2,2),$
$(restricted\_route/2,2)\}$,
where both
$restricted\_route/2$ and $route/2$ are located at the second stratum due to the negative assumption on $connected/2$ that imposes the negative arc $route/2 \stackrel{\neg}{\leftarrow} connected/2$.
\subsection{Implementing Tabling}
DES implements implications in Prolog as described in \cite{sae13c-ictai13}.
Recalling, each time an implication is to be solved, a new context is created by augmenting the current database with the rules and facts in the premise.
If the same program point is reached for solving the implication due to the fixpoint computation (corresponding to a new iteration), then the database is not changed because the program rules for the premise are already loaded and tagged for that context.
Entries in the call and answer tables are accordingly tagged so that the outcome for a given context can be identified as well.
Solving a goal $g$ in a stratum greater than 1 proceeds by stratified computation as described in
\cite{sae13c-ictai13},
i.e., solving stratum by stratum the meaning of the involved predicates on which $g$ negatively depends, and solving $g$ with the results for other predicates already stored in the answer table.
Next, first the implementation of solving restricted predicates is depicted and, then, a couple of optimizations are proposed.
\subsubsection{Solving Restricted Predicates}
Solving a call to a restricted predicate $p$ is also done by stratum because its actual (restricted) meaning must be computed before any predicate that depends on $p$.
The rationale behind this solving is to compute both the positive part and the restricted part of $p$ by considering, respectively, its defining rules with regular and restricting atoms in the head.
As any predicate with an outgoing negative dependency, the restricted predicate $p$ is located at a higher stratum than each $q_i$ such that $q_i \stackrel{\neg}{\leftarrow} p$ is in the PDG.
This implies that $p$ is to be solved (before each $q_i$) in its stratum for an open call \mytt{p(X$_1$,...,X$_n$)}, where $n$ is the arity of $p$ and \mytt{X$_i$} are fresh variables.
The next code excerpt illustrates the solving of a single call (either regular, restricted or negative) for a given stratum:
{\fontsize{11}{11}
\begin{verbatim}
solve_datalog_stratum(not Q,Stratum,CId,Undefined) :-
solve_datalog_stratum(Q,Stratum,CId,_Undefined), !,
solve_positive_datalog_stratum(not Q,Stratum,CId,Undefined).
solve_datalog_stratum(Q,Stratum,CId,Undefined) :-
solve_pos_res_datalog_stratum(Q,Stratum,CId,Undefined).
solve_pos_res_datalog_stratum(Q,Stratum,CId,Undefined) :-
solve_positive_datalog_stratum(Q,Stratum,CId,Undefined),
functor(Q,N,A),
(restricted_predicate(N/A)
-> solve_positive_datalog_stratum(-Q,Stratum,CId,_Undefined2),
remove_restricted_tuples(Q,CId)
; true).
\end{verbatim}
}
Here, the predicate \mytt{solve\_datalog\_stratum} is responsible of solving a given call (first argument) in a stratum (second argument).
Its third argument \mytt{CId} corresponds to the context identifier $\chi$ as introduced already.
The last argument \mytt{Undefined} stands for undefined results, which are got for non-stratifiable databases\footnote{Such behaviour is allowed for teaching purposes in order to highlight the problems in trying to compute non-stratifiable databases.}.
For a non negated call (second clause) a possibly restricted call is solved with \mytt{solve\_pos\_res\_data-}\linebreak \mytt{log\_stratum}.
This predicate first solves the non-restricted (i.e., positive) meaning of the call \mytt{Q} and, if it refers to a restricted predicate, then its extensional negative meaning (corresponding to the restricting call \mytt{-Q}) is computed.
After computing \mytt{-Q}, both the positive and extensional negative meanings are already stored in the answer call, and the actual meaning is changed in the answer call by removing all entries with a counterpart restricting atom.
For example, if \mytt{\{p(1),p(2),-p(2)\}} are in the answer table after solving the calls \mytt{Q} and \mytt{-Q} for a given context $\chi$, then the resulting meaning for \mytt{p} is just \mytt{\{p(1),-p(2)\}}, where \mytt{p(2)} has been removed by \mytt{remove\_restricted\_tuples}.
So, given this answer table for a context $\chi$, the call \mytt{-p(1)} does not succeed because \mytt{-p(1)} is not in the restricting meaning of \mytt{p} for $\chi$.
As well, the call \mytt{-p(2)} succeeds and the call \mytt{-p(3)} does not succeed for analogous reasons.
For a negative call \mytt{not Q} (first clause), \mytt{Q} is firstly solved as before.
This fills the answer table with the (possibly restricted) meaning of \mytt{Q}, so its negation can be solved with the call \mytt{solve\_positive\_data-}\linebreak \mytt{log\_stratum(not Q,\ldots)}
The negative meaning of \mytt{Q} is composed of its extensional negative meaning (restricted part of the predicate) and its intensional negative meaning (which follows SLDNF).
So, continuing with the last example, the calls \mytt{not -p(1)}, \mytt{not -p(2)}, and \mytt{not -p(3)} respectively succeeds, does not succeed, and succeeds.
Note that the call \mytt{not p(3)} succeeds (as \mytt{not -p(3)} does) because {\tt p(3)} cannot be proven by SLDNF.
This is equivalent to say that, with the available information, neither \mytt{p(3)} nor \mytt{-p(3)} can be proved.
Finally, it is not possible to solve \mytt{not -p(X)} simply because the query is unsafe (c.f., Section II.{\em B} in \cite{sae13c-ictai13}).
A context can be thought of as the current database along query solving which has been modified with respect to the original database due to positive and negative assumptions (i.e., by respectively adding regular and restricting rules).
A na\"ive implementation of contexts would be to represent each rule of the current database in the parameter $\chi$.
Instead, we resort to tag each program rule with a context identifier, which is identified as a list of integers.
Each integer in this list corresponds to the rule identifier in which an assumption is made.
The initial context is the empty list, and only entries in the answer table referring to this context are kept, though along the computation, entries for other contexts are kept.
Let us consider the following simple program (where each rule is identified by an integer and a context between parentheses):
{\fontsize{11}{11}
\begin{verbatim}
(0,[]): p :- q => r.
(1,[]): r :- q.
\end{verbatim}
}
After solving the query \mytt{p} (which succeeds), the answer table includes the (simplified) tuple \mytt{(p,[])}, indicating that \mytt{p} is true in the initial context.
For solving this query, an assumption is made, which amounts to locally adding the fact \mytt{q} (as a new rule identified by the integer \mytt{2}) to the initial context.
This addition is implemented as the assertion of this new rule for the context \mytt{[0]} becoming:
{\fontsize{11}{11}
\begin{verbatim}
(2,[0]): q.
\end{verbatim}
}
The new rule is asserted only once along fixpoint iterations, and it is removed at the end of query solving.
When assumptions are nested, as in \mytt{p :- q => r => s}, the rule is transformed by removing nested assumptions:
{\fontsize{11}{11}
\begin{verbatim}
(0,[]): '$p0' :- r => s.
(1,[]): p :- q => '$p0'.
\end{verbatim}
}
Here, the new predicate \mytt{\$p0} is automatically created during preprocessing so that each context can be identified by a single rule.
\subsubsection{Dynamic PDG and Stratification}
Section \ref{sect:pdg} introduced the construction of the predicate dependency graph by considering all the rules defined in the program, including those in the antecedent of embedded implications.
However, a more refined approach can be considered by building a PDG and stratification for each context.
Indeed, rules that do not form part of a given context may introduce negative dependencies which imply to solve the {\em complete} meaning of a given predicate, instead of considering only its actual context.
For instance, let us consider the rules $p(X) \leftarrow t(X)$ and $q(X) \leftarrow (p(Y) \leftarrow t(Y) \land \neg r(Y)) \Rightarrow s(X)$.
The arcs in the corresponding PDG are $\{ p/1 \stackrel{\neg}{\leftarrow} r/1, p/1 \leftarrow t/1, q/1 \leftarrow s/1\}$, and a possible stratification is $\{(q/1,1),$ $(r/1,1),$ $(s/1,1),$ $(t/1,1),$ $(p/1,2) \}$.
So, consider the goal $p(1)$, whose solving proceeds by stratum: First, the open goal $r(X)$ is solved in the first stratum (providing the complete meaning of $r/1$ in the answer table), then the goal $p(1)$ is solved in the second stratum (no other predicates are considered since the computation is restricted to the goal dependency graph).
But consider that $r$ can contain millions of tuples, and all of them are computed when they are not really needed.
If only one tuple of $t$ matched the call for $p$ then only one tuple would be needed.
The negative dependency that forces $p$ to be in stratum 2 comes from a premise that is not involved in the current solving.
So, we build a specific (dynamic) predicate dependency graph and stratification for each context, which are correspondingly tagged and therefore avoids such wasteful computations.
Thus,
the arcs in the PDG and stratification for the goal $p(1)$ are, respectively, $\{ p/1 \leftarrow t/1, q/1 \leftarrow s/1\}$, and all nodes remain in a single stratum.
Solving $p(1)$ fills only one tuple of the answer table for $t/1$ and no one for $r/1$.
In the concrete implementation, this program is written as follows (where identifiers have been included as before):
{\fontsize{11}{11}
\begin{verbatim}
(0,[]) p(X) :- t(X).
(1,[]) q(X) :- (p(Y):-t(Y), not r(Y)) => s(X).
\end{verbatim}
}
The PDG and strata for the top-level context \mytt{[]} can be inspected with:
{\fontsize{11}{11}
\begin{verbatim}
DES> /pdg
Nodes: [p/1,q/1,s/1,t/1]
Arcs : [p/1+t/1,q/1+s/1]
DES> /strata
[(p/1,1),(q/1,1),(s/1,1),(t/1,1)]
\end{verbatim}
}
\noindent where \mytt{P+Q} (\mytt{P-Q}) denotes that the predicate \mytt{P} positively (negatively, resp.) depends on the predicate \mytt{Q}.
When solving the query \mytt{q(X)}, the following PDG and strata are computed for the new context \mytt{[1]} due to the assumption in rule \mytt{(1,[])}, which can be displayed by enabling verbose output (with \mytt{/verbose on}).
{\fontsize{11}{11}
\begin{verbatim}
DES> q(X)
...
Info: Building hypothetical computation context [1] for:
p(Y) :- t(Y), not r(Y).
Info: PDG:
Nodes: [p/1,q/1,r/1,s/1,t/1]
Arcs : [p/1-r/1,p/1+t/1,q/1+s/1]
Info: Strata:
[(q/1,1),(r/1,1),(s/1,1),(t/1,1),(p/1,2)]
...
\end{verbatim}
}
The PDG and strata are incrementally built for each modification (rule addition or deletion) in the database.
So, when an assumption is made, they are updated according to the assumption (recall that an assumption always adds a rule, either regular or restricting).
Upon entering into a new context, the old PDG and strata are saved and eventually restored when the computation for the new context is finished.
\subsubsection{Reusing Answers from Previous Contexts}
\label{sect:optimization}
Solving an embedded implication as presented requires to recompute from scratch the given goal for all the involved strata.
While this is a conservative approach, former computations in previous contexts can be reused to avoid some recomputations, i.e., reusing entries in the answer table.
For the database restricted to the goal
consisting only of a single stratum, this reusing is safe as only additions to the answer table are possible.
So, retrievals from the answer table can be done from the first context up to the current one.
However, when negation is involved in this restricted database, some already deduced information in a former context might be not true anymore.
Consider, for instance, the program consisting of the identified rules \mytt{(1,[]):} $p \leftarrow \neg q$ and \mytt{(2,[]):} $r \leftarrow q \Rightarrow p$.
The goal $p$ succeeds in the initial context \mytt{[]}, but fails in the context \mytt{[2]} when solving the conclusion $p$.
A straightforward implementation for facing this issue is simply to avoid the reusing for strata greater than 1, which can be done by adding a new parameter to the predicates stating the current stratum.
Another, more refined implementation is by identifying those predicates which do not depend on assumed information, either directly or indirectly, and avoiding the reusing of their deduced information, committing only to the current context.
\section{Introduction}
\label{sect:intro}
\input{01_intro.tex}
\section{Introductory Example}
\label{sect:example}
\input{02_example.tex}
\section{Restricted Predicates: Informal Semantics}
\label{sect:restricted}
\input{03_restricted.tex}
\section{Formal Framework}
\label{sect:formal}
\input{04_formal.tex}
\section{Implementation}
\label{sect:implementation}
\input{05_implementation.tex}
\section{Conclusions and Future Work}
\label{sect:conclusions}
\input{07_conclusions.tex}
| {'timestamp': '2015-12-23T02:02:48', 'yymm': '1512', 'arxiv_id': '1512.06945', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06945'} | arxiv |
\section{Introduction}
With the increasing popularity of different online social platforms, such as Facebook, Twitter, Pinterest etc., multi-modal data streams (e.g. text, image, audio, video, etc) are generated as byproducts of people's everyday online activities in the digital world. The wide availability of these \textit{digital breadcrumbs} \cite{Estrin:2014:SDN:2580723.2580944} have already cultivated major research efforts in the industry and academia to develop techniques to understand personal preferences. These techniques have led to the success of recommendation systems \cite{das2007google, middleton2004ontological}, such as Yelp, Foursquare etc., that help users find things they will enjoy, and enabled accurate targeting of advertisements.
Text-centric data, such as tweets, and status updates, are among the most popular data streams for profiling personal attributes \cite{schwartz2013personality} due to their early adoption and pervasiveness. It has been shown by \cite{ schwartz2013personality, correa2010interacts, bamman2014gender} that various personal traits, such as gender, age, extroversion and openness, are manifested in these language features. Until recently, as driven by the emergence of photo sharing social media sites (e.g. Pinterest and Instagram) and the wide availability of embedded cameras on mobile devices, images have become a significant portion of contents that people posted online, and text data is thus limited for not capturing visual preferences.
Building on this line of research, some recent work started to explore the value of visual contents in uncovering people's interests \cite{you2015picture, ottoni2014pins, lovato2013we, lovato2014faved}. However, most current research in this domain \cite{you2015picture, ottoni2014pins, lovato2013we} converts images to one or more labels, and uses the text-based, categorical information to understand users' preferences. While such image-to-text approaches can benefit from the existing techniques developed for text-based data, they potentially miss the rich context and visual cues that are known to affect and guide people's perceptions of image contents \cite{gibson1950perception}. This limitation is especially highlighted on image intensive social networks, such as Pinterest. For example, as Fig.\ref{fig:sample} shows, even under the same category, \textit{Travel}, there are obvious distinctions between the \textit{pins} (i.e. the images on Pinterest) curated by different users. These distinctions could play an important role in not only image recommendations itself, but also in domains, such as travel destination recommendations.
\begin{figure}
\centering
\includegraphics[width=0.95\linewidth]{images/sample}
\caption{Image samples from four travel boards curated by different users (All images are chronologically randomly sampled from users' boards)}
\label{fig:sample}
\vspace{-5mm}
\end{figure}
In this paper, we take a step \textit{deeper} into profiling users' visual preferences for images under the \textbf{same} label. We propose a novel framework based on Deep Convolutional Neural Networks (CNN) to directly learn a image distance metric from a large set of similar and dissimilar image pairs. We then leverage this similarity measure to profile each user's visual preferences. The experimental results, based on 5,790 Pinterest users' pins under the Travel category, indicate that the proposed approach is able to reveal each user's distinct visual preferences, and the derived user profile has strong predictive power to predict the images that the user will \textit{pin}.
Compared with traditional solutions, our work offers three major contributions:
\begin{itemize}
\item Our approach enables fine-grained user interest profiling directly from visual contents. For images under the same label, we reveal intra-categorical variances that traditional classification methods were not able to capture.
\item We propose a novel distance-metric learning method based on the combination of traditional-CNN and Siamese Network\cite{chopra2005learning} models. This framework outperforms the state-of-the-art CNN model in terms of mean Average Precision (mAP).
\item Our experiment demonstrates \textit{beyond classification} utilities of visual contents in user interest profiling. We believe that our findings, while preliminary, shed light on the potential of incorporating fine-grained visual content analysis as an important technique for personalization.
\end{itemize}
\section{Related Work}
\subsection{Visual Content Analysis on OSNs}
The pioneering work in this domain studied online photos on Flickr \cite{lovato2013we, lovato2014faved, schifanella15image} and demonstrated the feasibility of extracting aesthetic and biometric features from user-generated image collections. It has been shown that people's preferences over these photographic features are identifiable and could be used for personalization \cite{yeh2010personalized}. Building on these prior efforts, recent literature has begun to explore the possibilities of profiling user's behavior \cite{ottoni2014pins, zhong2013sharing, bernardini2014pin} and interests \cite{you2015picture} from visual contents posted on social media. Although the work from \cite{you2015picture} has shown the initial findings of intra-categorical image variations among different users, most existing approaches treated image analysis as a classification problem where one or more labels are assigned and processed in a manner similar to text data. The major limitation behind such approaches is that a general classification model is trained and applied to all the users while ignoring individual users' distinct perception and preferences to an image category. Our preliminary experiments show that individual users do have distinct preferences even under the same category, and this personal preference is consistent over the user's lifetime.
\subsection{Image Retrieval and Personalization}
The algorithms we propose in this paper are related to the \textit{similar image retrieval} problem in computer vision \cite{kim2012web, deng2011hierarchical, fu2015tagging}, where given a text query, semantically relevant images will be returned from a large database. It's similar to our work because the image similarity metric is an important component of the retrieval function and it has been shown that the algorithmic performance will achieve major improvements when incorporating user interests profile and temporal patterns of social events\cite{kim2012web}. Although most retrieval functions directly use visual features for similarity measurement\cite{kim2012web, deng2011hierarchical}, it is still unclear whether images themselves could provide utilities other than categorical labels and the extent of their usefulness in personal interest profiling. In this paper, we conduct experiments using publicly available data from 5,790 Pinterest users. The results demonstrate identifiable signals from visual contents that extend beyond classification and image categories.
\section{Problem Definition}
The general question we intend to answer in this paper is \textit{whether user-generated visual contents have predictive power for users' preferences beyond labels}. To quantitatively measure the differences of visual contents posted by different users under the same category, we consider the following setup of the problem.
Under an image category, each active user who posted in this category is denoted by $u_{i}, u_{i} \in \{u_{1}, u_{2}, ..., u_{N}\}$, and the images a user posted are denoted by $\mathcal{S}^{i}=\{I_{1}^{i}, I_{2}^{i}, ..., I_{\mid\mathcal{S}^{i} \mid}^{i}\}$ in the chronological order. The problem is to find a function $G$ such that $\boldsymbol{v}_{i} = G(\mathcal{S}^{i})$ can accurately characterize the user $i$'s distinct visual preferences. More specifically, we consider the following two tasks:
(1) \textbf{Pairwise Comparison:} Given the general characteristics $\boldsymbol{\overline{v}}$ of images posted under this category, we analyze whether the proposed profiling function $G$ can distinguish the pairwise users' preferences so that the differences between each derived profile pair $(\boldsymbol{v}_{i}, \boldsymbol{v}_{j})$ are statistically significant.
(2) \textbf{Prediction:} We divide every user's image set $\mathcal{S}^{i}$ into training $(\mathcal{S}^{i}_{\text{train}})$ and testing $(\mathcal{S}^{i}_{\text{test} })$ subsets, and evaluate the predictive power of profile $\boldsymbol{v}_{i}^{\text{train}}$ by using it to predict which is the user $i$'s collections (board) among all the testing sets.
\section{Dataset Collection}
We choose Pinterest as the targeted platform since it is one of the most popular image-centric social networks. On Pinterest, users posted \textit{pins} (i.e. typically an image along with a short description) and organized them in self-defined \textit{boards}, each of which is associated with one of 34 predefined categories. This fully structured way of image collection makes Pinterest a natural candidate for investigating intra-categorical user preferences. In this paper, we scraped different users' boards within the \textit{travel} category. These travel boards are further filtered by the following two criteria: (1) The board should contain no less than 100 pins to guarantee that there is enough data for each user; and (2) The board should have at least one pin posted after June 2014 to ensure that the user is still active\cite{danescu2013no}. After filtering, we obtained 5,790 \textit{travel boards}, each of which belongs to a different user. We use 1,800 of them as background corpus $\mathcal{S}_{\text{bg}}$ and exclude them from the analysis.
\section{Proposed Methodology}
\begin{figure*}[t]
\centering
\includegraphics[width=0.9\linewidth]{images/overview}
\caption{Algorithmic framework for user interests profiling from visual contents. \textit{Phase 1:} Siamese Network and CNN based feature extraction; \textit{Phase 2:} Euclidean distance based soft assignment to pre-trained visual clusters; \textit{Phase 3:} Generate user profile by aggregating all image visual cluster features.}
\label{fig:overview}
\vspace{-2mm}
\end{figure*}
Fig.\ref{fig:overview} shows an overview of the proposed framework. The framework consists of three major components: (1) Each image (i.e. \textit{pin}) $I_{j}^{i}$ is first embedded in a 410-dimensional feature space via a pre-trained Siamese network and the Places-CNN. The feature vector for each image $I_{j}^{i}$ is denoted by $\boldsymbol{d}_{j}^{i}$; (2) Based on the distance between $\boldsymbol{d}_{j}^{i}$ and the center of each pre-trained visual cluster, an image is soft-assigned to 200 pre-trained clusters such that the final representation ($\boldsymbol{c}_{j}^{i}$) for the image $I_{j}^{i}$ is its affinities to all the clusters. (3) Finally, a user profile $\boldsymbol{v}_{i}$ is defined as the aggregate of all the feature vectors $\boldsymbol{c}_{1}^{i}, ..., \boldsymbol{c}_{\mid \mathcal{S}^{i} \mid}^{i}$. i.e. $\boldsymbol{v}_{i} = \frac{1}{Z} \sum_{j=1}^{\mid \mathcal{S}^{i} \mid} \boldsymbol{c}_{j}^{i}$, where $Z = \| \boldsymbol{v}_{i} \|_{1}$. In the following, we discuss important design decisions and the rationales behind each component.
\subsection{Deep Distance Metric Learning}
Distance metric learning using Deep Siamese Network has achieved significant performance improvements in face verification\cite{taigman2014deepface}, geo-localization\cite{lin2015learning} and food image embedding\cite{yang2015CIKM}. In addition, it is suggested by \cite{sun2013hybrid} that feature concatenation (hybrid) from CNNs trained under different conditions will further strengthen the discriminative power of the model. In light of these prior efforts, we fine-tuned a Siamese Network based on the Places dataset\cite{zhou2014learning} and concatenated its features with the pre-trained Places-CNN model\cite{zhou2014learning} (Fig.\ref{fig:overview}), both of which utilized the AlexNet\cite{krizhevsky2012imagenet} architecture. We choose to use the Places dataset and include the Places-CNN model because the images we deal with are mostly scene photos from the \textit{travel} category. In this section, we focus on our design and training choices for the Siamese Network. Interested readers can refer to the original papers for details\cite{krizhevsky2012imagenet}.
\begin{figure}
\centering
\includegraphics[width=0.95\linewidth]{images/siamese}
\caption{Structure of Siamese Network used in the feature embedding}
\label{fig:siamese}
\vspace{-2mm}
\end{figure}
As illustrated in Fig. \ref{fig:siamese}, our Siamese Network architecture is the same as AlexNet\cite{krizhevsky2012imagenet} except that we change the output dimension of the last fully connected layer to 205 in order to stay consistent with the output of Places-CNN. We also add a Batch Normalization layer \cite{ioffe2015batch} at the end to normalize the 205 dimensional feature so that each dimension has zero mean and unit variance within a training batch. Our goal is to learn a low dimensional feature embedding where similar scene images are pulled together while dissimilar images are pushed far away. Specifically, we want $f(x)$ and $f(y)$ to have small distance (close to 0) if $x$ and $y$ are similar instances; otherwise, they should have distance larger than a margin $m$. In this paper, we choose Contrastive Loss $\mathcal{L}$ proposed in \cite{hadsell2006dimensionality} as the loss function when optimizing the Siamese Network.
\begin{equation}
\label{eqn_loss}
\mathcal{L}(x, y, l) = \frac{1}{2} l D^2 + \frac{1}{2} (1 - l) \max\left(0, m - D\right)^2
\end{equation}
In eqn.(\ref{eqn_loss}), similarity label $l \in \{0, 1\}$ indicates whether the input pair of scene images $x, y$ are similar or not ($l=1$ for similar, $l=0$ for dissimilar), $m>0$ is the margin for dissimilar scenes and $D=\|f(x) - f(y)\|_{2}$ is the Euclidean Distance between $f(x)$ and $f(y)$ in the embedding space. We use the open-source implementation of gradient descent and back-propagation provided by Caffe\cite{jia2014caffe} to train and test Siamese Network.
In the training phase, we treat the Places dataset images with the same labels as similar pairs and those under different categories as dissimilar pairs. We sample 102,500 similar pairs and 1,045,500 dissimilar pairs to train our Siamese Network. We set the learning rate of the last fully connected layer as $10^{-5}$ and the rate for the rest layers as $10^{-7}$. The model that we use in this paper is trained for 50,000 iterations. Finally, the output of Siamese Network (205 dimension) will be concatenated with the output of the fully connected layer in Places-CNN, which together form a 410 dimensional feature embedding for each image.
\subsection{Clustering and User Profiling}
After the training phase, we use the pretrained Siamese Network and Places-CNN to extract 410 dimensional feature $\boldsymbol{d}_{j}^{i}$ for each image $I_{j}^{i}$. We randomly sample 1800 users and use their images $\mathcal{S}_{\text{bg}} = \mathcal{S}^{1}\cup...\cup\mathcal{S}^{1800}$ as the background corpus to discover latent clusters \footnote{They are excluded from the following pair-wise comparison and prediction tasks}. A traditional K-means\cite{macqueen1967some} unsupervised clustering algorithm is used to divide the image set into 200 visual clusters, and their centers are denoted by $\boldsymbol{r}_{1}, \boldsymbol{r}_{2}, ..., \boldsymbol{r}_{200}$. Built on the pre-trained cluster centers, each image is then soft assigned to 200 clusters based on eqn.(\ref{eqn:assignment}) such that each dimension of the final representation $\boldsymbol{c}_{j}^{i}$ reveals the likelihood of the image belonging to a specific visual cluster.
\begin{equation}
\boldsymbol{c}_{j}^{i}(k) = \left\{
\begin{array}{lr}
e^{-\frac{1}{2\alpha^{2}} \lVert \boldsymbol{d}_{j}^{i} - \boldsymbol{r}_{k} \rVert^{2}} & : \lVert \boldsymbol{d}_{j}^{i} - \boldsymbol{r}_{k} \rVert \leq \delta\\
0 & : \lVert \boldsymbol{d}_{j}^{i} - \boldsymbol{r}_{k} \rVert > \delta
\end{array}
\right.
\label{eqn:assignment}
\end{equation}
where $\alpha^{2} = \frac{1}{\mid \mathcal{S}_{\text{bg}} \mid^{2}} \sum_{I_{j}^{i}, I_{n}^{l} \in \mathcal{S}_{\text{bg}}} \|\boldsymbol{d}_{j}^{i} - \boldsymbol{d}_{n}^{l} \|^{2}$ and $\delta = m$ ($m$ is the margin of Siamese Network).
Finally, for each user $u_{i}$, we derive her profile by aggregating all the image feature representations $\boldsymbol{c}_{j}^{i}$ in her collection of pins $\mathcal{S}^{i}$ via eqn.(\ref{eqn:aggregation}). This profile intuitively represents the distribution of users' interests over different visual clusters.
\begin{equation}
\boldsymbol{\tilde{v}}_{i} = \sum_{j=1}^{\mid \mathcal{S}^{i} \mid} \boldsymbol{c}_{j}^{i}; \quad \boldsymbol{v}_{i} = \frac{1}{\| \boldsymbol{\tilde{v}}_{i} \|_{1}} \boldsymbol{\tilde{v}}_{i}
\label{eqn:aggregation}
\end{equation}
\subsection{User Pairwise Comparison}
Given a pair of user $i$ and user $j$, we investigate whether the derived profile has the discriminative power to different users' preferences. Users' pairwise differences are evaluated over the general distribution $\boldsymbol{\overline{v}}$ of images under \textit{travel} boards. This general distribution is derived from the background corpus $\mathcal{S}^{\text{bg}}$, where $\boldsymbol{\overline{v}} = \sum_{I_{j}^{i} \in \mathcal{S}^{\text{bg}}} \boldsymbol{c}_{j}^{i}$. We adopt \textit{log odds ratio with informative Dirichlet prior} proposed in \cite{monroe2008fightin} to analyze pairwise differences; this approach was originally used for comparing the differences of word frequencies between articles.
We first calculate the \textit{log odds ratio} with respect to different visual cluster $k$ as in eqn.(\ref{eqn:log}), where $\alpha$ controls the size of background corpus.
\begin{equation}
\begin{split}
\hat{\delta}_{k}^{\boldsymbol{v}_{i} - \boldsymbol{v}_{j}} &= log(\frac{\boldsymbol{\tilde{v}}_{i}(k) + \alpha\boldsymbol{\overline{v}}(k)}{\sum_{k}\boldsymbol{\tilde{v}}_{i}(k) + \alpha\sum_{k}\boldsymbol{\overline{v}}(k) - (\boldsymbol{v}_{i}(k) + \alpha\boldsymbol{\overline{v}}(k))}) \\
&- log(\frac{\boldsymbol{\tilde{v}}_{j}(k) + \alpha\boldsymbol{\overline{v}}(k)}{\sum_{k}\boldsymbol{\tilde{v}}_{j}(k) + \alpha\sum_{k}\boldsymbol{\overline{v}}(k) - (\boldsymbol{v}_{j}(k) + \alpha\boldsymbol{\overline{v}}(k))})
\end{split}
\label{eqn:log}
\end{equation}
In addition, we consider the estimated uncertainty as suggested in \cite{monroe2008fightin} and calculate the variance value as in eqn.(\ref{eqn:variance}).
\begin{equation}
\sigma^{2}(\hat{\delta}_{k}^{\boldsymbol{v}_{i} - \boldsymbol{v}_{j}}) \approx \frac{1}{\boldsymbol{\tilde{v}}_{i}(k) + \alpha\boldsymbol{\overline{v}}(k)} + \frac{1}{\boldsymbol{\tilde{v}}_{j}(k) + \alpha\boldsymbol{\overline{v}}(k)}
\label{eqn:variance}
\end{equation}
The final statistic for each visual cluster $k$ is the z-score of the log-odds-ratio, computed as in eqn(\ref{eqn:zscore}).
\begin{equation}
z_{k} = \frac{\hat{\delta}_{k}^{\boldsymbol{v}_{i} - \boldsymbol{v}_{j}}}{\sqrt{\sigma^{2}(\hat{\delta}_{k}^{\boldsymbol{v}_{i} - \boldsymbol{v}_{j}})}}
\label{eqn:zscore}
\end{equation}
The method we adopt in this section takes into account the background corpus as prior, which alleviates the data sparsity problem and makes the differences of very frequent visual clusters detectable. Under such conditions, if $\mid z_{k}\mid \geq 2$, the confidence level that user $u_{i}$ and $u_{j}$ are significantly different is greater than $95\%$. We will show the overall distribution of all pairwise user differences in the following experiments section.
\section{Experiments}
\subsection{Distance Metric Evaluation}
\begin{figure}
\centering
\includegraphics[width=0.95\linewidth]{images/embedding}
\caption{Pinterest \textit{travel} images embedding based on our hybrid CNN model; The images are projected to 2-D plane using t-SNE.}
\label{fig:embedding}
\vspace{-3mm}
\end{figure}
\begin{table}[h]
\centering
\begin{tabular}{c|c|c|c}
\hline
\textbf{Hybrid CNN} & \textbf{Places CNN} & \textbf{SIFT+BOW} & \textbf{Random Guess} \\ \hline
\textbf{0.134} & 0.132 & 0.019
& 0.005 \\ \hline
\end{tabular}
\vspace{3mm}
\caption{mean Average Precision (mAP) value of the image clustering task on Places dataset}
\label{tbl:map}
\vspace{-3mm}
\end{table}
We evaluate the efficacy of the distance metric derived from our hybrid model by measuring its clustering performance, namely to what extent the distance metric can cluster test images that share the same labels in the Places Dataset\cite{zhou2014learning}. We check the nearest $k$-neighbors of each test image for $k = 1, 2, ..., N$, where $N=20,500$ is the size of the testing dataset, and calculate the Precision and Recall values for each $k$. We use mean Average Precision (mAP) as the evaluation metric to compare the performance with the competing algorithms as suggested in \cite{yang2015CIKM}. For every method, the Precision/Recall values are averaged over all the images in the testing set. The results are shown in Table.\ref{tbl:map} where an ideal algorithm has mAP value equals to 1
We compare our hybrid model with two important competing algorithms: (1) \textit{Pretrained Places CNN}\cite{zhou2014learning}: We extract a 205-dimensional feature from the output of the last fully connected layer in the Places CNN and use it as the representation for each image; (2) \textit{SIFT+Bag of Words(BoW)}\cite{lowe2004distinctive}: For this state-of-the-art hand crafted representation, we extract features using 410 visual words so that it has the same feature dimension as our hybrid model. As is shown in Table.\ref{tbl:map}, traditional feature representation (\textit{SIFT + BOW}) does not have enough discriminative power for the task of scene image embedding. The hybrid model that we propose in this paper outperforms both of the approaches mentioned above in terms of mAP values. These evaluation results not only justify the value of the Siamese network method, but also show that the strategy of concatenating different CNN features could improve the performance of the model.
The feature embedding model proposed in this paper has the promise for visualizing and discovering image clusters among travel images. We randomly sample 10,000 pins from background corpus $\mathcal{S}_{\text{bg}}$ and project all images to a 2-D plane using t-Distributed Stochastic Neighbor Embedding (t-SNE)\cite{van2008visualizing}. As shown in Fig.\ref{fig:embedding}, we divide the plane into many small blocks, and for each block we randomly sample a representative scene image that resides in that area. The final embedding clearly groups similar scenes more closely in the new space. The embedding results (Fig.\ref{fig:embedding}) indicate that we can capture rather fine-grained image categories that are likely to appear in \textit{travel} boards. For instance, natural scenes (e.g. beach, mountains), city views (e.g. building, street) and travel necessities (e.g. bags, shoes).
\subsection{Pairwise Comparison}
\begin{figure}
\centering
\includegraphics[width=0.88\linewidth]{images/cdf}
\caption{Empirical Cumulative Distribution Function (eCDF) of $\hat{z}_{ij}$. The dotted lines denote the confidence levels associated with different $z$ scores. It shows that more than half of the user pairs have statistically significant differences (i.e. $\hat{z}_{ij} \geq 2$) in visual preferences even under the same category of images.}
\label{fig:cdf}
\vspace{-2mm}
\end{figure}
To investigate how much intra-categorical variance exists between Pinterest users, for each pair of users $(u_{i}, u_{j})$ (except those 1,800 users used for background corpus), we estimate the pairwise dissimilarity between them using the z-score described in Section V. More specifically, let $z_{ij,k}$ denote the z-score that estimates the difference between users $(u_{i}, u_{j})$ in the visual cluster $k$. Then, the overall preference difference between users $(u_{i}, u_{j})$, denoted by $\hat{z}_{ij}$, is estimated by the maximum z-score over all $K$ visual clusters as defined in eqn.(\ref{eqn:pair}).
\begin{equation}
\hat{z}_{ij} = \text{max}_{k} \mid z_{ij,k} \mid
\label{eqn:pair}
\end{equation}
We plot the empirical cumulative distribution function (eCDF) of $\hat{z}_{ij}$ for all the pairwise users in Fig.\ref{fig:cdf}. The distribution demonstrates that there are more than half of the user pairs that have statistically significant difference (i.e. $\hat{z}_{ij} \geq 2$) in their visual preferences even for the same category of images. This result verifies our assumption that there is significant intra-categorical variance among different users and underscores the importance of understanding users' fine-grained interests and preferences.
\subsection{Prediction of Future Pins Collections}
\begin{figure}
\centering
\includegraphics[width=0.9\linewidth]{images/retrieval}
\caption{Mean Reciprocal Rank (MRR) for the pin collection (i.e. board) retrieval task with different sizes of training samples. The performance is compared across three algorithms : \textit{Random guess}, \textit{Text similarity based retrieval} and \textit{Image similarity based retrieval}.}
\label{fig:retrieval}
\vspace{-6mm}
\end{figure}
In addition to pair-wise comparisons, the other question we want to answer is whether the user profile derived with our hybrid model has discriminative power to different users' preferences. In order to quantitatively measure that, we propose the following prediction task: (1) 100 images (denoted as $\tilde{\mathcal{S}}^{i}$) are randomly sampled from each image set $\mathcal{S}^{i}$ to guarantee that each user has the same number of pins for training and prediction; (2) Each sampled image set $\tilde{\mathcal{S}}^{i}$ is then divided into training ($\tilde{\mathcal{S}}^{i}_{\text{train}}$) and testing ($\tilde{\mathcal{S}}^{i}_{\text{test}}$) subsets based on their chronological order; (3) Each user's profile is calculated based on two sets separately (i.e. $\boldsymbol{v}_{i}^{\text{train}} = G(\tilde{\mathcal{S}}^{i}_{\text{train}}); \boldsymbol{v}_{i}^{\text{test}} = G(\tilde{\mathcal{S}}^{i}_{\text{test}})$); (4) For each user $i$ and her profile $\boldsymbol{v}_{i}^{\text{train}}$ based on her training set, we predict which testing set belongs to her using euclidean distances. More specifically, we sort all the testing sets $\tilde{\mathcal{S}}^{j}_{\text{test}}$ by the euclidean distances between their profile $\boldsymbol{v}_{j}^{\text{test}}$ and the user's profile $\boldsymbol{v}_{i}^{\text{train}}$ in an ascending order, and the ranking of the user's real testing set $\boldsymbol{v}_{i}^{\text{test}}$ is denoted as $rank_{i}$. Finally, Mean Reciprocal Rank (MRR), as defined in eqn.\ref{eqn:mrr}, is used to evaluate the overall prediction accuracy across all the users ($N=3,990$). MRR is a standard metric for evaluating the accuracy of a prediction algorithm.
\begin{equation}
\text{MRR} = \frac{1}{N} \sum_{i=1}^{N} \frac{1}{rank_{i}}
\label{eqn:mrr}
\end{equation}
In order to show the effects of the size of training set, we fix the testing set $\tilde{\mathcal{S}}^{i}_{\text{test}}$ to contain the last 50 pins in $\tilde{\mathcal{S}}^{i}$ and vary the training set $\tilde{\mathcal{S}}^{i}_{\text{train}}$ to include the first 10, 20, 30, 40, 50 pins. In addition, we compare our approach to a text-based user interesting profiling approach. The procedure for this text-based user interests profiling is similar to the one shown in Fig.\ref{fig:overview}, but, instead of using hybrid deep neural network, we adopt the state-of-the-art PV-DM model\cite{le2014distributed} to embed each pin's text description into a 100-dimensional feature space.
As is shown in Fig.\ref{fig:retrieval}, the profiles that we calculated based on visual contents have significantly better performance than text and random baselines in terms of Mean Reciprocal Rank. The results further demonstrate the possibilities that, in image-centric social networks (e.g. Pinterest), visual contents play a more significant role in affecting users' behavior and preferences compared to traditional text-based platforms. Although there is still a large space of algorithmic improvements to be explored, our preliminary results provide promising evidence for using intra-categorical variance information to understand people's interests and preferences.
\section{Future Work}
Moving forward, there are several directions we would like to pursue. (1) \textit{Comprehensive intra-categorical image analysis model:} in this paper, we only consider the images under the \textit{travel} category. However, in real world applications, there are a large number of image categories. A general and comprehensive model to analyze users' intra-categorical preferences for a wide variety of images categories will be of significant importance; (2) \textit{Information fusion of inter- and intra- categorical image analysis:} one of the opportunities enabled by the fine-grained image analysis is to fuse and propagate inter- and intra- categorical information. A hierarchical model could be built to analyze users' visual preferences in different levels and their inter-level interactions. Finally (3) \textit{cross-platform information sharing:} cross-platform behavior analysis is a user-centric idea to explore the sharing and fine-tuning of user profiles across multiple platforms. This will be particularly useful for solving cold-start problems \cite{park2006naive} in many recommender systems. For example, one can use users' fine-grained interests learned from Pinterest to recommend friends or places in another social network.
\section{Conclusion}
To conclude, in this paper, we propose a user preference profiling framework that extracts signals with strong discriminative power to users' fine-grained preferences. Compared to previous work, the proposed framework is a hybrid one that takes advantages of Siamese Network and traditional CNN to directly extract similarity information from images. Our experimental results based on data from 5,790 Pinterest users show that the proposed method is able to characterize the intra-categorical interests of a user with a resolution that is beyond what a coarse-grained image classification can do. Our findings suggest that there is great potential in finer-grained user visual preference profiling, and we hope this paper will fuel future development of deeper and finer understanding of users' latent preferences and interests.
\section*{Acknowledgement}
We appreciate the anonymous reviewers for insightful comments. This research is partly funded by AOL-Program for Connected Experiences and further supported by the small data lab at Cornell Tech which receives funding from UnitedHealth Group, Google, Pfizer, RWJF, NIH and NSF.
\bibliographystyle{IEEEtran}
| {'timestamp': '2015-12-22T02:26:25', 'yymm': '1512', 'arxiv_id': '1512.06785', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06785'} | arxiv |
\section{Introduction}
The notion of bisimulation has been extensively used to characterize the equivalence between processes \cite{Mil89, Par81, San11}. Bisimulations are coinductive proofs of that equivalence, which is called the bisimilarity relation. Certainly, bisimilarity is a quite natural relation, as suggested by the existence of several different formulation of the notion of bisimulation, e.g., in terms of bisimulation games~\cite{Sti98}.
Up to bisimilarity, the semantics of processes is characterized by unordered trees without repeated (equivalent) branches, which are thus considered the canonical semantic model.
Therefore, two processes are equivalent if, and only if, they have the same semantic tree. But when two processes are not equivalent we have no way of expressing ``how different'' they are. Recently, several notions of bisimulation distance have been proposed, based on variants of the bisimulation game \cite{chr10_quantitative, amrs07, dlt08, ftl11}: while the original game imposes to the defender the obligation of replicating exactly any move by the attacker, in these variants the defender has the possibility of ``cheating'', by replying an attacker's move by choosing similar, but not equal, actions. However, when doing that, the defender have to pay a price according to the distance between the two involved actions.
This is a very suggestive path to follow when defining a bisimulation distance, and it comes with several efficient ways to compute it. Despite such desirable properties, we believe that alternative approaches are possible and worth being studied.
Previous works~\cite{rf12a, rf12b, rf14} by the first two authors of this paper contain several examples which mainly show that the ``classical'' distances based on variants of the bisimulation game are \emph{local}, in the sense that they only capture the difference between a single pair of executions of the two processes, thus failing in characterizing the distance between the processes in their entirety.
In the quest for a \emph{global} notion of distance, considering all executions at the same time, we have proposed a novel approach~\cite{rf12a, rf12b, rf14}: since trees express the bisimulation semantics, we looked for a natural distance between trees that defines what we called \emph{global bisimulation distance}.
For this purpose, we defined \emph{atomic transformations} between processes; then, a sequence of transformations provides an upper bound for the distance between the two processes at the two ends of the sequence.
This approach is suitable for comparing finite processes, but it is clearly inadequate when comparing infinite finitary processes with infinitely many differences. We are interested in obtaining sound bounds also in the latter case, whenever the series collecting all those differences converges. Instead of looking for a complex scenario based on the use of limits, we introduced in \cite{rf14} a coinductive framework which allows us to obtain bounds for those distances in a very simple way (coinduction is sometimes presented as an ``inductionless induction'' mechanism).
As we said before, classical bisimulation distances are easy to calculate, even (or we should better say, especially) in the quantitative cases (e.g., probabilistic \cite{bw05}, timed \cite{Bre05}), where calculus provides the machinery to obtain the corresponding fixed points. It is true that the computation of our (bounds for the) distance requires specific techniques in each case, but our coinductive approach benefits from the power of coinduction to accomplish this task.
In order to give a broader support to our approach, it was our intention to prove the continuity of our distance: we expected that whenever all the pairs of projections of two (possibly infinite) processes are at some fixed distance, the (full) processes themselves will be at that distance. Unfortunately, this paper tells an unfinished story: we were confident about obtaining a perhaps bit involved, but somehow ``standard'' proof, but our creature has revealed itself as an irresistible beast. Our, more and more, sophisticated attempts to domesticate it have crashed over and over, revealing new faces of the beast, whose actual existence remains uncertain. We all know how difficult is to disprove the existence of Nessy, Bigfoot, or E.T. Certainly, finding indisputable evidence of their existence would put an end to the mystery, but still we believe that this is impossible, as they simply do not exist \dots or do they?
Let us go with our story. It is not easy to tell unfinished stories, but we think that we have to do it, because we really enjoyed many exciting adventures in pursuing our quest and because we feel we might have paved the way for somebody else's success.
\section{Classic and global bisimulation distances} \label{ClassicalAndGlobal}
Our starting point will be the operational definition of processes as \emph{Labelled Transition Systems (lts)} over an alphabet $\mathds A$, which are tuples $(N,\mathit{succ})$, where $N$ is a set of states and $\mathit{succ}:N\rightarrow \mathcal{P}(\mathds{A}\times N)$. When we want to distinguish an initial state $n_0 \in N$, we write $(N,\mathit{succ},n_0)$. Sometimes we omit the component $\mathit{succ}$, simply considering $(N,n_0)$. Finite computations or \emph{paths}, are sequences $n_0a_1n_1\dots a_kn_k$ with $(a_{i+1},n_{i+1})\in \mathit{succ}(n_i)$ $\forall i \in\{0\dots k-1\}$. We denote the set of paths of an $lts$ $(N,n_0)$ by $Path(N,n_0)$.
\begin{definition}
We say that an lts $(N,n_0)$ is (or defines) a \emph{tree} $t$ if for all $n\in N$ there is a single path $n_0a_1n_1\dots a_jn_j$ with $n_j=n$.
Then, we say that each node $n_k$ is at \emph{level $k$} in $t$, and define $Level_k(t)=\{n\in N \mid n$ is at level $k$ in $t\}$. We define the \emph{depth} of $t$ as $depth(t)=sup\{l\in\mathds{N}\mid Level_l(t)\neq\emptyset\}\in \mathds{N}\cup\{\infty\}$. We denote by $Trees(\mathds{A})$ the class of trees on the alphabet $\mathds{A}$, and by $FTrees(\mathds{A})$, the subclass of finite trees.
\end{definition}
Every node $n$ of a tree $t=(N,n_0)$ induces a subtree $t_n=(N_n,n)$, where $N_n$ is the set of nodes $n^\prime_k\in N$ such that there exists a path $n^\prime_0a_1n^\prime_1\dots a_kn^\prime_k$ with $n^\prime_0=n$. We decompose any tree $t$ into the formal sum $\sum_{n_{1j}\in Level_1(t)} a_jt_{n_{1j}}$ (we denote the empty sum by {\bf 0}). Since our trees are unordered, by definition, this formal sum is also unordered.
For each tree $t\in Trees(\mathds{A})$, we define its \emph{first-level width}, that we represent by $||t||$, as $||t||=|Level_1(t)|$. We also define the \emph{first $k$-levels width of $t$}, denoted by $||t||_k$, as $||t||_k=max\{||t_n||\mid n\in \bigcup_{l < k} Level_l(t)\}$. \emph{Finitary trees} are those such that $||t||_k < \infty$, $\forall k \in \mathds{N}$. We denote by $FyTrees(\mathds{A})$ the collection of \emph{finitary trees} in $Trees(\mathds{A})$.
\begin{definition}\sloppy
Given an lts with initial state $(N,\mathit{succ},n_0)$, we define its unfolding, denoted by $\it{unfold}(N)$, as the tree $(\overline{N}, \overline{\mathit{succ}}, \overline{n_0})$, where $\overline{N}=Path(N,n_0)$, $\overline{\mathit{succ}}(n_0a_1\dots n_k)=\{(a,n_0a_1\dots n_k a n^\prime)\mid (a,n^\prime)\in \mathit{succ}(n_k)\}$, and $\overline{n_0}=n_0$. An lts is finitely branching when its unfolding is a finitary tree.
\end{definition}
\begin{definition}
Given a tree $t=(N,\mathit{succ},n_0)$ and $k\in\mathds{N}$, we define its $k$-th cut or projection, denoted by $\pi_k(t)$, as the restriction of $t$ to the nodes in $\bigcup_{l\leq k} Level_l(t)$:
\begin{center}
$\pi_k(t)=(\pi_k(N),\mathit{succ}_k,n_0)$, where $\pi_k(N)=\bigcup_{l\leq k} Level_l(t)$, $\mathit{succ}_k(n)=\mathit{succ}(n)$ if $n\in \bigcup_{l<k} Level_l(t)$, and $\mathit{succ}_k(n)=\emptyset$ if $n\in Level_k(t)$.
\end{center}
\end{definition}
In this paper, we focus on finitely branching lts, and thus on finitary trees.
Each finitary tree is univocally defined by the sequence of its projections: $\forall t,t^\prime\in FyTree(\mathds{A}) ((\forall k\in \mathds{N} \pi_k(t) \! = \! \pi_k(t^\prime)) \! \Rightarrow \! t \! = \! t^\prime)$.
We consider domains of actions $(\mathds{A},{\bf d})$, where ${\bf d}:\mathds{A}\times \mathds{A} \rightarrow \mathds{R}^+\cup\{\infty\}$ is a distance between actions, with ${\bf d}(a,b)={\bf d}(b,a)$, ${\bf d}(a,b)=0$ $\Leftrightarrow$ $a=b$, and ${\bf d}(a,c)+{\bf d}(c,b)\geq {\bf d}(a,b)$, $\forall a,b,c \in \mathds{A}$, where $+$ is extended to $\mathds{R}^+\cup\{\infty\}$ as usual. We assume that ${\bf d}(a,b)=\infty$ when the value ${\bf d}(a,b)$ is not specified.
When comparing pairs of processes, it is natural \cite{chr10_distance,ahm03,ftl11} to introduce a \emph{discount factor} $\alpha \in (0,1]$. Then, the differences in the $k$-th level of the compared trees are weighted by $\alpha^k$, following the idea that differences in the far future are less important than those in the near. As a consequence, it is possible to obtain finite distances when comparing two processes with infinitely many differences.
In \cite{rf12a}, we have presented, inter alia, an operational definition that allows us to obtain bounds for our global bisimulation distance between finite trees. These bounds are given by the cost of any transformation that turns one of the trees into the other. The following definition states which are the valid steps of those transformations and their costs. Roughly, any application of idempotency of $+$ has no cost, while the change of an action $a$ at level $k$ into another $b$, costs $\alpha^k{\bf d}(b,a)$.
Intuitively, in what follows we write $t\rightsquigarrow^1_{\alpha,d} t'$
meaning that there is a distance step (aka 1-step transformation) between $t$
and $t'$ (with discount factor $\alpha$) whose cost is at most $d$. We use the
superscript 1 to distinguish between the 1-step relation
$\rightsquigarrow^1_{\alpha,d}$ and its transitive closure
$\rightsquigarrow_{\alpha,d}$.
\begin{definition} \label{operational}
Given a domain of actions $(\mathds{A},{\bf d})$ and a discount factor $\alpha\in (0,1]$, we inductively define the distance steps on $FTrees(\mathds{A})$ by
\vspace{0.15cm}
$1.$ $d\geq 0$ $\Rightarrow$ $(t\rightsquigarrow^1_{\alpha,d} t+t$ $\wedge$ $t+t\rightsquigarrow^1_{\alpha,d} t)$.
\hfill $2.$ $d\geq {\bf d}(a,b)$ $\Rightarrow$ $at\rightsquigarrow^1_{\alpha,d} bt$.\hspace{2.5cm}
$3.$ $t\rightsquigarrow^1_{\alpha,d} t^\prime$ $\Rightarrow$ $t+t^{\prime\prime}\rightsquigarrow^1_{\alpha,d} t^\prime+t^{\prime\prime}$.
\hfill$4.$ $t\rightsquigarrow^1_{\alpha,d} t^\prime$ $\Rightarrow$ $at\rightsquigarrow^1_{\alpha,\alpha d} at^\prime$.\hspace{2.5cm}
\vspace{0.15cm}
We associate to each distance step its level. The level of any step generated by $1.$ or $2.$ is one; while if the level of the corresponding premise $t\rightsquigarrow^1_{\alpha,d} t^\prime$ is $k$, then the level of a step generated by $3.$ (resp. $4.$) is $k$ (resp. $k+1$).
Finally, we define the family of global distance relations $\langle\rightsquigarrow_{\alpha,d}\mid d \in \mathds{R}^+\rangle$, taking $t\rightsquigarrow_{\alpha,d} t^\prime$ if there exists a sequence $\mathcal{S}:=t=t^0\rightsquigarrow_{\alpha,d_1}^1 t^1 \rightsquigarrow_{\alpha,d_2}^1 t^2\rightsquigarrow_{\alpha,d_3}^1\dots \rightsquigarrow_{\alpha,d_n}^1 t^n=t^\prime,$ with $\sum_{i=1}^n d_i \leq d$.
\end{definition}
\section{The coinductive global bisimulation distance} \label{coinductive_section}
In order to extend our global distances to infinite trees, we have introduced in \cite{rf14} a general coinductive notion of distance. We formalize our definition in two steps. In the first one we introduce the rules that produce the steps of the \emph{coinductive transformations} between trees, starting from any family of triples $(t,t^\prime,d)$, with $t$, $t^\prime\in FyTrees (\mathds{A})$ and $d\in \mathds{R}^+$.
\begin{definition}[\cite{rf14}]\label{single_step}
Given a domain of actions $(\mathds{A},{\bf d})$, a discount factor $\alpha\in (0,1]$ and a family $\mathcal{D}\subseteq FyTrees(\mathds{A})\times FyTrees(\mathds{A})\times \mathds{R}^+$, we define the family of relations $\equiv_d^{\mathcal{D},\alpha}$, for $d \in \mathbb R^+$, by:
\begin{compactenum}
\item For all $d\geq 0$ we have (i) $(\sum_{j\in J} a_jt_j)+at+at \equiv_d^{\mathcal{D},\alpha} (\sum_{j\in J} a_jt_j)+at$ ,\\and (ii) $(\sum_{j\in J} a_jt_j)+at \equiv_d^{\mathcal{D},\alpha}(\sum_{j\in J} a_jt_j)+at+at$.
\item For all $d\geq {\bf d}(a,b)$ we have $(\sum_{j\in J} a_jt_j)+at\equiv_{d}^{\mathcal{D},\alpha} (\sum_{j\in J} a_jt_j)+bt$.
\item For all $(t,t^\prime,d)\in \mathcal{D}$ we have $(\sum_{j\in J} a_jt_j)+at\equiv_{d^\prime}^{\mathcal{D},\alpha} (\sum_{j\in J} a_jt_j)+at^\prime$ for all $d^\prime\geq \alpha d$.
\end{compactenum}
\noindent To simplify the notation, we write $\equiv_d$ instead of $\equiv_d^{\mathcal{D},\alpha}$, whenever $\mathcal{D}$ and $\alpha$ are clear from the context.
\end{definition}
We say that the steps generated by application of rules $1$ and $2$ in Def.~\ref{single_step} are \emph{first level steps}; while those generated by rule $3$ are \emph{coinductive steps}.
Inspired by the proof obligations imposed to bisimulations we introduce the coinductive proof obligations imposed to the (satisfactory) families of distances.
\begin{definition}[\cite{rf14}]\label{finitary_case}
Given a domain of actions $(\mathds{A},{\bf d})$ and a discount factor $\alpha\in (0,1]$, we say that a family $\mathcal{D}$ is an $\alpha$-coinductive collection of distances ($\alpha$-ccd) between finitary trees, if for all $(t,t^\prime,d)\in \mathcal{D}$ there exists a \emph{finite coinductive transformation sequence} $\mathcal{C}:=t=t^0\equiv_{d_1}t^1\equiv_{d_2}\ldots\equiv_{d_{n}}t^n=t^\prime$, with $d\geq\sum_{j=1}^n d_j$.
Then, when there exists an $\alpha$-ccd $\mathcal{D}$ with $(t,t^\prime,d)\in \mathcal{D}$, we will write $t\equiv_d^{\alpha}t^\prime$, and say that tree $t$ is at most at distance $d$ from tree $t^\prime$ wrt $\alpha$.
\end{definition}
\begin{example} \label{ejem_infinito}
Let us consider the domain of actions $(\mathds{N}, {\bf d})$, where ${\bf d}$ is the usual distance for numbers, and the trees $t_N=unfold(N)$ and $t_{N^\prime}=unfold(N^\prime)$, with $N=\{n_0,n_1\}$, $\mathit{succ}(n_0)=\{(0,n_0),(0,n_1)\}$ and $\mathit{succ}(n_1)=\emptyset$; and $N^{\prime}=\{n_0^{\prime},n_1^{\prime}\}$, $\mathit{succ}^\prime(n_0^{\prime})=\{(0,n_0^{\prime}),(1,n_1^{\prime})\}$ and $\mathit{succ}^\prime(n_1^{\prime})=\emptyset$. Then, we have $t_{N}\equiv^{\mathcal{D},1/2}_2 t_{N^{\prime}}$, using the family $\mathcal{D}=\{(t_N,t_{N^{\prime}},2)\}$. We can prove that this is indeed a $\frac{1}{2}$-ccd, by considering the sequence: $\mathcal{C}:=t_{N}\equiv^{\mathcal{D},1/2}_1 t_{N^{\prime\prime}}\equiv^{\mathcal{D},1/2}_1 t_{N^{\prime}}$, where $t_{N^{\prime\prime}}=unfold(N^{\prime\prime})$, with $N^{\prime\prime}=\{n_0^{\prime\prime},n_1^{\prime\prime},n_2^{\prime\prime},n_3^{\prime\prime}\}$, $\mathit{succ}^{\prime\prime}(n_0^{\prime\prime})=\{(1,n_1^{\prime\prime}),$ $(0,n_2^{\prime\prime})\}$, $\mathit{succ}^{\prime\prime}(n_1^{\prime\prime})=\emptyset$, $\mathit{succ}^{\prime\prime}(n_2^{\prime\prime})=\{(0,n_2^{\prime\prime}),(0,n_3^{\prime\prime})\}$ and $\mathit{succ}^{\prime\prime}(n_3^{\prime\prime})=\emptyset$.
\end{example}
It is immediate to see that our notion of distance has natural and pleasant properties such as the \emph{triangular transitivity}: for any discount factor $\alpha \in (0,1]$, whenever we have $t\equiv^{\alpha}_d t^\prime$ and $t^\prime\equiv^{\alpha}_{d^\prime} t^{\prime\prime}$, we also have $t\equiv^{\alpha}_{d+d^\prime}t^{\prime\prime}$.
Of course, our coinductive definition of the global bisimulation distance generalizes our operational definition for finite trees.
\begin{proposition} [\cite{rf14}]\label{coincidence_finite_coinductive}
For $t,t^\prime\in FTrees(\mathds{A})$, the operational (Def.~\ref{operational}) and the coinductive (Def.~\ref{finitary_case}) definition of global bisimulation distance between trees coincide, that means $t\equiv^{\mathcal{\alpha}}_d t^\prime \Leftrightarrow t\rightsquigarrow_{\alpha,d} t^\prime$.
\end{proposition}
\begin{proof}
$\underline{\Rightarrow|}$ We assume that $t\equiv^{\mathcal{\alpha}}_d t^\prime$
holds. This means that $(t,t^\prime,d)\in\mathcal{D}$ for some
$\alpha$-ccd $\mathcal{D}$, which in turn implies the existence of a finite
coinductive sequence
$\mathcal{C}:=t=t^0\equiv_{d_1}t^1\equiv_{d_2}\ldots\equiv_{d_{n}}t^n=t^\prime$,
with $\sum d_j \leq d$.
If $\mathcal{C}$ is the vacuous sequence ($n = 0$), then we have $t = t'$ and
$t\rightsquigarrow_{\alpha,d} t^\prime$ trivially holds.
Let us assume $n > 0$. We show that it is possible to ``unfold'' $\mathcal{C}$
into a sequence of distance steps, $\mathcal{S}$, proving that
$t\rightsquigarrow_{\alpha,d} t^\prime$.
It is enough to show that for a generic step $t^i\equiv_{d_{i+1}}t^{i+1}$ of
$\mathcal C$ there exists a sequence proving that $t^i
\rightsquigarrow_{\alpha,d_{i+1}} t^{i+1}$ (the complete sequence for $\mathcal C$
can be obtained by composition).
If $t^i\equiv_{d_{i+1}}t^{i+1}$ has been obtained by applying rule $1$ in
Def.~\ref{single_step} (we only consider the sub-case (i), the other case can
be dealt with in the same way), then we have
$t^i = t^i_1 + at_1 + at_1 \equiv_{d_{i+1}} t^i_1 + at_1 = t^{i+1}$, and applying
rules 1 and 3 in Def.~\ref{operational} we get
$t^i\rightsquigarrow_{\alpha,d_{i+1}} t^{i+1}$.
If $t^i\equiv_{d_{i+1}} t^{i+1}$ has been obtained by applying rule $2$ in
Def.~\ref{single_step}, then we have
$t^i = t^i_1 + at_1 \equiv_{d_{i+1}} t^i_1 + bt_1 = t^{i+1}$, and applying
rules 2 and 3 in Def.~\ref{operational} we get
$t^i\rightsquigarrow_{\alpha,d_{i+1}} t^{i+1}$.
If $t^i\equiv_{d_{i+1}} t^{i+1}$ has been obtained by applying rule $3$ in
Def.~\ref{single_step}, then we have
$t^i = t^i_1 + at_1 \equiv_{d_{i+1}} t^i_1 + at'_1 = t^{i+1}$, with $(t_1,t'_1,d')$
for some $d'$ such that $d_{i+1} \geq \alpha d'$.
We proceed by induction on the depth of $t^i$.
Notice that $depth(t^i)>0$ as there is no $t''$ such that
$t^i\equiv_{d_{i+1}} t''$ when $depth(t^i)=0$.
If $depth(t^i)=1$ (base case), then $t_1 = {\bf 0}$, and the only possible
witness for $(t_1,t'_1,d')$ is the vacuous coinductive sequence.
Thus, we have $t_1 = t'_1 = {\bf 0}$, and
$t_1\rightsquigarrow_{\alpha,d_{i+1}/\alpha} t'_1$ trivially holds.
By applying rules 4 and 3 in Def.~\ref{operational} we get
$t^i\rightsquigarrow_{\alpha,d_{i+1}} t^{i+1}$.
Finally, if $depth(t^i)>1$, then $t_1\rightsquigarrow_{\alpha,d'} t'_1$ holds by
inductive hypothesis, and applying rules 4 and 3 in Def.~\ref{operational} we
get $t^i\rightsquigarrow_{\alpha,\alpha d'} t^{i+1}$, which in turn, trivially
implies $t^i\rightsquigarrow_{\alpha,d_{i+1}} t^{i+1}$ (as $d_{i+1} \geq \alpha d'$).
$\underline{\Leftarrow|}$ Given a sequence of distance steps, $\mathcal{S}$, proving that $t\rightsquigarrow_{\alpha,d} t^\prime$, we can ``fold'' it into a coinductive sequence, $\mathcal{C}$, witnessing $t\equiv^{\alpha}_d t^\prime$. For each $(t,t^\prime,d)\in\mathcal{D}$ we consider the factorization of the sequence $\mathcal{S}$ and its reordering as done in \cite{rf14}. We get $t=\sum_{i\in I_0} a_it_i\rightsquigarrow_{\alpha,d_{02}} \sum_{i\in I_0}a_it^\prime_i\rightsquigarrow^1_{\alpha,d_{11}}\sum_{i\in I_1}a_it_i\rightsquigarrow_{\alpha,d_{12}}\sum_{i\in I_1} a_i t^\prime_i\rightsquigarrow^1_{\alpha,d_{21}} \dots \rightsquigarrow_{\alpha,d_{(k+1)2}} \sum_{i\in I_{k+1}}a_i t^\prime_i=t^\prime$, where for each sequence $\sum_{i\in I_j} a_it_i\rightsquigarrow_{\alpha,d_{j2}}\sum_{i\in I_j}a_it^\prime_i$ and each $i\in I_j$, we have $t_i\rightsquigarrow_{\alpha,d_{j2}^i/\alpha}t^\prime_i$ with $\sum_{i\in I_j} d_{j2}^i=d_{j2}$. Now, applying the induction hypothesis, we have $(t_i,t^\prime_i, d_{j2}^i/\alpha)\in \mathcal{D}$, for all $i\in I_j$, so that $\sum a_it_i\equiv^{\mathcal{D},\alpha}_{\alpha d_1} \sum a_it_i^1\equiv^{\mathcal{D},\alpha}_{\alpha d_2}\sum a_it^2_i\equiv^{\mathcal{D},\alpha}_{\alpha d_3}\dots \equiv^{\mathcal{D},\alpha}_{\alpha d_{|I_j|}}\sum a_it_i^{|I_j|}=\sum a_it^\prime_i$.
Therefore, each sequence $\sum_{i\in I_j} a_it_i\rightsquigarrow_{\alpha,d_{j2}^i}\sum_{i\in I_j}a_it^\prime_i$ at the factorization above can be substituted by a sequence of $|I_j|$ valid coinductive steps, getting a total distance $\sum_{j=0}^{k+1}\sum_{i\in I_j} d_{j1}^i + \sum_{j=0}^{k+1}\sum_{k=1}^{|I_j|} \alpha d_k=d$.
\end{proof}
Even if the result above only concerns finite trees, it reveals the duality between induction and coinduction. Of course, its consequences are much more interesting in the infinite case.
\begin{example}\label{ainfinito_binfinito}
Let $(\{ a,b \}, {\bf d})$ be a domain of actions such that ${\bf d}(a,b) = 1$
and let us consider the lts given by $N_{1,\infty}=\{n_0\}$, with $\mathit{succ}(n_0)=\{(a,n_0)\}$ and its unfolding $a^\infty$. In an analogous way, we obtain the tree $b^\infty$. We have $\pi_n(a^\infty)=a^n$, and clearly $a^\infty$ can be seen as the ``limit'' of its projections. Applying Def.~\ref{operational}, we obtain $a^n\rightsquigarrow_{1/2,2} b^n$ and thus $a^n\equiv^{1/2}_2 b^n$. We also have $a^\infty\equiv^{1/2}_2 b^\infty$, which can indeed be proved by means of the (trivial!) collection $\mathcal{D}=\{(a^\infty,b^\infty,2)\}$. We can check that $\mathcal{D}$ is an $\frac{1}{2}$-ccd using the coinductive sequence $\mathcal{C}:=a^\infty=aa^\infty\equiv^{\mathcal{D},1/2}_1ba^\infty\equiv^{\mathcal{D},1/2}_{\frac{1}{2}\cdot 2} bb^\infty=b^\infty$.
\end{example}
\section{On the continuity of the global bisimulation distance}
It is very simple to prove the following proposition, by introducing the notion of projections of $\alpha$-ccd's.
\begin{proposition}[\cite{rf14}]\label{ccd_projection}
For any $\alpha$-ccd $\mathcal{D}$, the projected family $\pi(\mathcal{D})=\{(\pi_n(t),\pi_n(t^\prime),d)\mid (t,t^\prime,d)\in \mathcal{D},\; n\in \mathds{N}\}$ is an $\alpha$-ccd. Hence, it holds $t \equiv^{\alpha}_d t^\prime \Rightarrow \pi_n(t)\equiv^{\alpha}_d \pi_n(t^\prime)$ for each
$n\in \mathds{N} $.
\end{proposition}
\begin{proof}
Let $\mathcal{C}:=t=t^0\equiv^{\mathcal{D},\alpha}_{d_1}\ldots\equiv^{\mathcal{D},\alpha}_{d_{k}} t^k=t^\prime$ be the coinductive sequence proving that $(t,t^\prime,d)\in \mathcal{D}$ satisfies the condition in order $\mathcal{D}$ to be an $\alpha$-ccd. Then each projected sequence $\pi_n(\mathcal{C}):=\pi_n(t)=\pi_n(t^0)\equiv^{\pi(\mathcal{D}),\alpha}_{d_1} \ldots \equiv^{\pi(\mathcal{D}),\alpha}_{d_{k}}\pi_n(t^k)=\pi_n(t^\prime)$ proves that $(\pi_n(t),\pi_n(t^\prime),d)\in\pi(\mathcal{D})$ satisfies the condition in order $\pi(\mathcal{D})$ to be an $\alpha$-ccd. It is clear that the projection under $\pi_n$ of any first level step in $\mathcal{C}$, is also a valid step in $\pi_n(\mathcal{C})$. Moreover, any coinductive step in $\mathcal{C}$ using $(t_1, t^{\prime}_1, d')\in \mathcal{D}$, can be substituted by the corresponding projected step, that uses $(\pi_{n-1}(t_1), \pi_{n-1}(t^{\prime}_1),d')\in \pi(\mathcal{D})$.
\end{proof}
\begin{remark}\label{projection_family}
Alternatively, we can consider for each $n\in\mathds{N}$ a family $\mathcal{D}_n=\pi_n(\mathcal{D})=\{(\pi_m(t),\pi_m(t^\prime),d)\mid (t,t^\prime,d)\in \mathcal{D},\; m\in \mathds{N}, m\leq n\}$, using the fact that the subtrees of a projection $\pi_n(t)$ are also projections $\pi_m(t^{\prime\prime})$ of subtrees $t^{\prime\prime}$ of $t$, for some $m<n$. These families satisfy $\pi_m(\mathcal{D})\subseteq \pi_n(\mathcal{D})$, whenever $m\leq n$.
\end{remark}
We conjecture that the converse of Prop.~\ref{ccd_projection}, asserting the continuity of our coinductive distance, is also valid. However, after several attempts have failed, or led us into a blind alley, we are now less confident of this result than we were before. We expected to be able to prove it by using the argument used in the proof of Prop.~\ref{ccd_projection}, in the opposite direction. If we would have a collection of ``uniform''\footnote{Uniformity here means that for any $n,k\in\mathds{N}$, with $k\geq n$, the steps corresponding to the first $n$ levels of any sequence $\mathcal{S}^k$ are always the same.} operational sequences $\mathcal{S}^n:=\pi_n(t)\rightsquigarrow_{\alpha,d}\pi_n(t^\prime)$, we could ``overlap'' all of them getting an ``infinite tree-structured sequence''. By ``folding'' it we would obtain the coinductive sequence proving that $t\equiv^{\alpha}_dt^\prime$. Next, a simple example.
\begin{example}[\cite{rf14}]\label{another_Ex}
Let us consider the trees $t=ac^\infty+ad^\infty$ and $t^\prime=bc^\infty+bd^\infty$, and the distance ${\bf d}$ defined by ${\bf d}(a,b)=4$, ${\bf d}(c,d)=1$. Then we have (the numbers above the arrows denote the distance step level, according to Def.~\ref{operational}; moreover, even if the arrows denote here 1-step transformations, we omit the superscript 1 for the sake of readability):
\vspace{-0.15cm}
\begin{center}
$\pi_1(t)=a+a\stackrel{\mbox{\tiny (1)}}{\rightsquigarrow}_{\frac{1}{2},0}a\stackrel{\mbox{\tiny (1)}}{\rightsquigarrow}_{\frac{1}{2},4}b\stackrel{\mbox{\tiny (1)}}{\rightsquigarrow}_{\frac{1}{2},0}b+b=\pi_1(t^\prime)$,
$\pi_2(t)=ac+ad\stackrel{\mbox{\tiny (2)}}{\rightsquigarrow}_{\frac{1}{2},\frac{1}{2} \cdot 1}ac+ac\stackrel{\mbox{\tiny (1)}}{\rightsquigarrow}_{\frac{1}{2},0}ac\stackrel{\mbox{\tiny (1)}}{\rightsquigarrow}_{\frac{1}{2},4}bc\stackrel{\mbox{\tiny (1)}}{\rightsquigarrow}_{\frac{1}{2},0}bc+bc\stackrel{\mbox{\tiny (2)}}{\rightsquigarrow}_{\frac{1}{2},\frac{1}{2} \cdot 1}bc+bd=\pi_2(t^\prime)$,
$\pi_3(t)=acc+add\stackrel{\mbox{\tiny (2)}}{\rightsquigarrow}_{\frac{1}{2},\frac{1}{2}\cdot 1} acc+acd\stackrel{\mbox{\tiny (3)}}{\rightsquigarrow}_{\frac{1}{2},\frac{1}{4}\cdot 1} acc+acc\stackrel{\mbox{\tiny (1)}}{\rightsquigarrow}_{\frac{1}{2},0} acc\stackrel{\mbox{\tiny (1)}}{\rightsquigarrow}_{\frac{1}{2},4}$
\hspace{1.5cm}$bcc\stackrel{\mbox{\tiny (1)}}{\rightsquigarrow}_{\frac{1}{2},0}bcc+bcc\stackrel{\mbox{\tiny (2)}}{\rightsquigarrow}_{\frac{1}{2},\frac{1}{2}\cdot 1} bcc+bdc\stackrel{\mbox{\tiny (3)}}{\rightsquigarrow}_{\frac{1}{2},\frac{1}{4}\cdot 1}bcc+bdd=\pi_3(t^\prime)$.
\end{center}
Now, if we consider the operational sequences, $\mathcal{S}^n$, relating $\pi_n(t)$ and $\pi_n(t^\prime)$, for any $n\in\mathds{N}$, we obtain $\pi_n(t)\rightsquigarrow_{\frac{1}{2},d_n}\pi_n(t^\prime)$, for some $d_n<6$.
Applying Prop.~\ref{coincidence_finite_coinductive} we can turn these operational sequences into equivalent coinductive ones, $\mathcal{C}^n$, thus proving $\pi_n(t)\equiv^{1/2}_{6}\pi_n(t^\prime)$, for all $n\in \mathds{N}$:
\vspace{-0.2cm}
\begin{center}
$\mathcal{C}^1:=a+a\equiv_{0}a\equiv_{4}b\equiv_{0}b+b$,
$\mathcal{C}^2:=ac+ad\equiv_{\frac{1}{2}}ac+ac\equiv_{0}ac\equiv_{4}bc\equiv_{0}bc+bc\equiv_{\frac{1}{2}}bc+bd$,
$\mathcal{C}^3:=acc+add\equiv_{\frac{1}{2}}acc+acd\equiv_{\frac{1}{4}}acc+acc\equiv_{0}acc\equiv_{4}bcc\equiv_{0}bcc+bcc\equiv_{\frac{1}{2}}bcc+bdc\equiv_{\frac{1}{4}}bcc+bdd$.
\end{center}
\end{example}
\begin{lemma}\label{borrar_niveles}
If $t\rightsquigarrow^1_{\alpha,d} t^\prime$ is a distance step of level $l$, then $\pi_k(t)\rightsquigarrow^1_{\alpha,d} \pi_k(t^\prime)$ is also a distance step of level $l$ for all $k\geq l$ .
Instead, if $l > k$ then we have $\pi_k(t)=\pi_k(t^\prime)$.
\end{lemma}
The continuity of our coinductive distance would mean that, whenever we have $\pi_n(t)\equiv^\alpha_d\pi_n(t^\prime)$ $\forall n\in\mathds{N}$, there should be a collection of ``uniform'' sequences proving these facts. Certainly, this is the case when we know in advance that $t\equiv^\alpha_d t^\prime$. Next, we define the projection of our operational sequences.
\begin{definition}
Given a sequence of distance steps $\mathcal{S}:=t=t^0\rightsquigarrow^1_{\alpha,d_1} t^1 \rightsquigarrow^1_{\alpha,d_2}\dots\rightsquigarrow^1_{\alpha,d_n}t^n=t^\prime$ with $d=\sum_{i=1}^n d_i$, for any $k\in \mathds{N}$ we define the sequence $\pi_k(\mathcal{S}):=\pi_k(t)=\pi_k(t^0)\rightsquigarrow^1_{\alpha,d_{i_1}} \pi_k(t^{i_1}) \rightsquigarrow^1_{\alpha,d_{i_2}} \dots \rightsquigarrow^1_{\alpha,d_{i_{l}}} \pi_k(t^{i_l})=\pi_k(t^\prime)$, where $\langle i_1,i_2,\dots,i_l\rangle$ is the sequence of indexes $i_j$ for which the level of the distance step $t^{i_j-1}\rightsquigarrow^1_{\alpha,d_{i_{j}}}t^{i_{j}}$ is less than or equal to $k$, while the rest of the steps are removed.
\end{definition}
\begin{proposition}
For any $k\in\mathds{N}$, and any sequence of distance steps $\mathcal{S}$, the projected sequence $\pi_k(\mathcal{S})$ is a sequence of distance steps, thus proving $\pi_k(t)\rightsquigarrow_{\alpha,\sum d_{i_j}} \pi_k(t^\prime)$. Therefore, we also have $\pi_k(t)\rightsquigarrow_{\alpha,d}\pi_k(t^\prime)$.
\end{proposition}
\begin{figure}
\begin{center}
\begin{tikzpicture}
\node(Cn) at (-2,1.2){$\mathcal{C}^n$};
\node(Sn) at (2,1.2){$\mathcal{S}^n$};
\node(Cm) at (-2,-0.95){$\mathcal{C}^m$};
\node(Sm) at (2,-0.95){$\mathcal{S}^m$};
\begin{scope}[every node/.style={font=\scriptsize\itshape}]
\path [->]
(Cn) edge node[auto,swap]{$\pi_m$}(Cm)
(Sn) edge node[auto]{$\pi_m$}(Sm)
(Cn) edge node[above=-1mm]{$unfold$} (Sn)
(Cm) edge node[auto]{$unfold$} (Sm)
;
\end{scope}
\end{tikzpicture}
\end{center}
\vspace{-0.5cm}
\caption{Relating projections of sequences}\label{diagrama}
\end{figure}
Now, let us start with a coinductive sequence $\mathcal{C}$ relating two (possibly infinite but finitary) trees $t$ and $t^\prime$.
\begin{corollary}
The projection of coinductive sequences and those of distance steps that the former induces, are related by the commutative diagram in Fig.~\ref{diagrama}. There we denote by $\mathcal{C}^n$ the projections of a coinductive sequence $\mathcal{C}$.
\end{corollary}
Note that all these coinductive sequences have exactly the ``same structure'', which is formalized by the fact that $\pi_m(\mathcal{C}^n)=\mathcal{C}^m$, for all $m\leq n$. As a consequence, if now we forget that we have already the original family $\mathcal{D}$ in Ex.~\ref{ainfinito_binfinito}, starting from the families $\mathcal{D}_n$ in Remark \ref{projection_family}, we could ``reverse'' the procedure by means of which they were defined, obtaining a single family $\mathcal{D}^\prime=\bigcup \mathcal{D}_n\cup\{(a^\infty,b^\infty,2)\}=\{(a^k,b^k,2)\mid k\leq \infty\}$, where we have added the ``limit'' triple $(a^\infty, b^\infty,2)$ because for all $k\in\mathds{N}$ $(\pi_k(a^\infty),\pi_k(b^\infty),2)=(a^k,b^k,2)\in \bigcup\mathcal{D}_n$. Now, we can see that $\mathcal{D}^\prime$ is indeed a $\frac{1}{2}$-ccd. In order to check the condition corresponding to $(a^\infty,b^\infty,2)$, we ``overlap'' the sequences $\mathcal{C}^n$ getting a sequence $\mathcal{C}^\prime$ constructed as follows:
From the first level step $a^n=aa^{n-1}\equiv^{\mathcal{D}_n,1/2}_{1}ba^{n-1}$ at each $\mathcal{C}^n$, we obtain the first level step $a^\infty=aa^\infty\equiv^{\mathcal{D}^\prime,1/2}_{1}ba^\infty$; this is followed by the coinductive step $ba^\infty\equiv^{\mathcal{D}^\prime,1/2}_{\frac{1}{2} \cdot 2}bb^\infty=b^\infty$, obtained just removing the projections from any of the coinductive steps $ba^{n-1}=\pi_n(ba^{\infty})\equiv^{\mathcal{D}_n,1/2}_{\frac{1}{2}\cdot 2}\pi_n(bb^\infty)=\pi_n(b^\infty)=b^n$.
The important fact about the construction above is that it can be applied to any collection of coinductive sequences that ``match each other''. We will call these collections \emph{telescopic}, because when we ``unfold'' their elements we obtain a sequence of operational sequences, where any of them is obtained from the previous one by adding some new intermediate steps, that always correspond to transformation steps at the last level of the compared trees (this reminds us the ``opening'' of a telescopic antenna).
\begin{definition}
Let $t,t^\prime\in FyTrees(\mathds{A})$ and let $(\mathcal{S}^n)_{n \in \mathds{N}}$ be a collection of operational sequences proving $\pi_n(t)\rightsquigarrow_{\alpha,d}\pi_n(t^\prime)$. We say that it is \emph{telescopic}\footnote{Certainly, these ``telescopic'' sequences correspond to the notion of inverse limit in domain theory or category theory. But since we only need a very concrete case of that quite abstract notion, we prefer to define it in an explicit way here.} if $\pi_{m}(\mathcal{S}^n)=\mathcal{S}^m$, for all $m,n \in \mathbb N$, with $m\leq n$.
\end{definition}
Any telescopic collection $(\mathcal{S}^n)_{n \in \mathds{N}}$, produces a ``limit'' coinductive sequence $\mathcal{C}$ proving $t\equiv^\alpha_d t^\prime$:
\begin{lemma}\label{lemita}
Let $(\mathcal{S}^n)_{n\in\mathds{N}}$ be a telescopic collection relating $t$ and $t^\prime$. We consider the associated factorization of each sequence in it: $\mathcal{S}^n:=\pi_n(t)=t^{n,0,1}\rightsquigarrow_{\alpha,d_{n02}} t^{n,0,2}\rightsquigarrow^1_{\alpha,d_{n11}}t^{n,1,1}\dots\rightsquigarrow^1_{\alpha,d_{nk1}}t^{n,k,1}\rightsquigarrow_{\alpha,d_{nk2}} t^{n,k,2}=\pi_n(t^\prime)$ where we alternate distance steps at the first level and global steps, that aggregate a sequence of steps at deeper levels. Then, for all $m\leq n$, $j\in\{1,\dots,k\}$ and $r\in\{1,2\}$, we have $t^{m,j,r}=\pi_m(t^{n,j,r})$.
\end{lemma}
\begin{proof}
Immediate, by definition of projections and telescopic collections.
\end{proof}
\begin{corollary}\label{cor}
For all $n\in\mathds{N}$, $j\in\{1, \dots, k\}$ and $r\in\{1,2\}$, we can decompose $t^{n,j,r}$ as above into $\sum_{i=1}^{I_{njr}} a_i t^{n,j,r}_i$, where the sequences $t^{n,j,1}\rightsquigarrow_{\alpha,d_{nj2}}t^{n,j,2}$ satisfy $I_{nj2}=I_{nj1}$ $\forall j\in\{1\dots k\}$,
and can be factorized into: $t^{n,j,1}=\sum a_it_i^{n,j,1}\rightsquigarrow_{\alpha,d_{nj2,1}}\sum a_it_i^{n,j,2,1}\dots\rightsquigarrow_{\alpha,d_{nj2,I_{nj2}}}\sum a_it_i^{n,j,2,I_{nj2}}=$ $\sum a_it^{n,j,2}_i=t^{n,j,2}$, where $t_i^{n,j,2,l}=t_i^{n,j,2}$ $\forall i\leq l$ and $t_i^{n,j,2,l}=t_i^{n,j,1}$ $\forall i>l$, and $\sum_{i=1}^{I_{nj2}} d_{nj2,i}=d_{nj2}$.
As a consequence, if we denote by $t^{\infty,j,r}$ the unique tree in $FyTree$ that satisfies $\pi_n(t^{\infty,j,r})=t^{n,j,r}$ $\forall n\in\mathds{N}$, we can decompose it into $\sum_{i=1}^{I_{j,r}}a_it_i^{\infty,j,r}$, and each collection $(\mathcal{S}^n_{j,i})_{n\in\mathds{N}}$ given by $\mathcal{S}^n_{j,i}:=\pi_n(t_i^{\infty,j,1})=t_i^{n,j,1}\rightsquigarrow_{\alpha,d_{nj2}}t_i^{n,j,2}=\pi_n(t^{\infty,j,2}_i)$ is indeed a telescopic collection relating $t_i^{\infty,j,1}$ and $t_i^{\infty,j,2}$.
\end{corollary}
\begin{proof}
Easy to check, by definition of projections and telescopic collections.
\end{proof}
\begin{theorem}\label{proyecciones}
Let $\mathcal{D}=\{(t,t^\prime,d)\mid \exists$ $(\mathcal{S}^n)_{n\in \mathds{N}}$ a telescopic collection relating $t$ and $t^\prime\}$, then $\mathcal{D}$ is an $\alpha$-ccd.
\end{theorem}
\begin{proof}
Using the notation in Lem.~\ref{lemita} and Cor.~\ref{cor} above, we can consider the coinductive sequence
\begin{center}
$t=t^{\infty,0,1}\equiv^{\mathcal{D},\alpha}_{d_{02}} t^{\infty,0,2}\equiv^{\mathcal{D},\alpha}_{d_{11}}t^{\infty,1,1}\equiv^{\mathcal{D},\alpha}_{d_{12}}\dots\equiv^{\mathcal{D},\alpha}_{d_{k2}}t^{\infty,k,2}=t^\prime,$
\end{center}
where $d_{j2}=sup_{n\in\mathds{N}}\{d_{nj2}\}$ and $d_{j1}=d_{nj1}$, $\forall n\in \mathds{N}$. It is clear that all the steps $t^{\infty,j,2}\equiv^{\mathcal{D},\alpha}_{d_{(j+1)1}}t^{\infty,j+1,1}$ are valid first level steps, while using Cor.~\ref{cor} we have that the steps $t^{\infty,j,1}\equiv^{\mathcal{D},\alpha}_{d_{j2}}t^{\infty,j,2}$ correspond to valid coinductive steps from $\mathcal{D}$. This is so because joining all the members of the telescopic sequences $(\mathcal{S}^n_{j,i})_{n\in\mathds{N}}$ with $j\in\{0\dots k\}$ fixed, we obtain a single telescopic sequence $(\mathcal{S}^n_{j})_{n\in\mathds{N}}$ relating $t^{\infty,j,1}=\sum_{i=1}^{I_{j,1}}a_it_i^{\infty,j,1}$ and $t^{\infty,j,2}=\sum_{i=1}^{I_{j,2}}a_it_i^{\infty,j,2}$.
\end{proof}
If for any $t,t^\prime\in FyTrees$
there would be only finitely many sequences proving each valid triple $t\rightsquigarrow_{\alpha,d}t^\prime$, then a classical compactness technique (or K\"onig's lemma, if you prefer) would immediately prove that whenever we have $\pi_n(t)\equiv^{\alpha}_{d}\pi_n(t^\prime)$ for any $n\in\mathds{N}$, we can obtain a telescopic collection of sequences proving all these facts. Then, the application of Th.~\ref{proyecciones} would conclude the continuity of our global bisimulation distance.
Unfortunately, this is not the case, because we can arbitrary enlarge any such sequence, adding dummy steps that apply the idempotency rule in one and the other directions. Even more, in some complicated cases in order to obtain some distances between two trees we need to consider sequences that include intermediate trees wider than the compared ones.
\begin{example}\label{ej1}
Let $\mathds{A}=\{1,2,3,4,5\}$ with the ``usual'' distance ${\bf d}(n,m)=|m-n|$, for all $m,n\in\mathds{A}$. Let us consider the trees $t=1(2+3+4+5)+1(1+2+3+4)$ and $t^\prime=1(1+2+4+5)$. Then, we have $t\rightsquigarrow_{1,3} t^\prime$, which can be obtained by means of the sequence $\mathcal{S}:=t\rightsquigarrow^{1}_{1,0}1(2+2+3+4+5)+1(1+2+3+4)\rightsquigarrow^{1}_{1,1} 1(1+2+3+4+5)+1(1+2+3+4)\rightsquigarrow^{1}_{1,0} 1(1+2+3+4+5)+1(1+2+3+4+4)\rightsquigarrow^{1}_{1,1} 1(1+2+3+4+5)+1(1+2+3+4+5)\rightsquigarrow^{1}_{1,0} 1(1+2+3+4+5)\rightsquigarrow^{1}_{1,1} 1(1+2+4+4+5)\rightsquigarrow^{1}_{1,0}1(1+2+4+5)=t^\prime$.
\end{example}
\begin{proposition}\label{prop_anchuras}
There exist $t,t^\prime\in FTrees(\mathds{A})$, with $t\rightsquigarrow_{\alpha,d} t^\prime$ and $||t||_m$, $||t^\prime||_m \leq k$ for some $m,k\in\mathds{N}$, for which it is not possible to obtain an operational sequence $\mathcal{S}$ witnessing $t\rightsquigarrow_{\alpha,d} t^\prime$ whose intermediate trees $t^{i}$ satisfy $||t^i||_m\leq k$.
\end{proposition}
\begin{proof}
For the trees $t$, $t^\prime$ in Ex.~\ref{ej1}, there is no sequence $\mathcal{S}$ proving $t\rightsquigarrow_{1,3}^{1} t^\prime$ that only includes intermediate trees $t^{\prime\prime}$ with $||t^{\prime\prime}||_2\leq 4\,$.
We have to transform the sets $A=\{2,3,4,5\}$ and $B=\{1,2,3,4\}$ into $C=\{1,2,4,5\}$. First of all, we need to unify $A$ and $B$, otherwise if we try to get $C$ from $A$ and $B$ independently it will cost more than $3$ units. In order to unify $A$ and $B$, we need at least a $2$ units payment getting one of the following intermediate sets: $C_1^{\prime}=\{1,2,3,4,5\}$, $C_2^{\prime}=\{1,2,3,4\}$, $C_3^{\prime}=\{2,3,4,5\}$ or $C_4^{\prime}=\{2,3,4\}$. Now, we see that $C_1^\prime$ is the only intermediate set that gives us the $3$ units cost given in Ex.~\ref{ej1}.
\noindent\underline {$C_2^\prime\rightsquigarrow_{1,2}C:$} Pay $1$ unit to add $5$, and another to ``erase'' $3$, so that the total cost would be $4$.
\noindent\underline {$C_3^\prime\rightsquigarrow_{1,2}C:$} Pay $1$ unit to add $1$, and another to ``erase'' $3$, so that the total cost would be $4$ again.
\noindent\underline {$C_4^\prime\rightsquigarrow_{1,3}C:$} Pay $1$ unit to add $1$, another to add $5$, and another to ``erase'' $3$; the total cost would be $5$.\end{proof}
Also, the following example shows us that in some cases the sequences at the telescopic sequences could be a bit involved. Even if for small values of $m$ the projections $\pi_m(t)$ and $\pi_m(t^\prime)$ could be ``quite close'', we need more elaborated sequences for relating them. Otherwise we would not be able to expand those sequences into others connecting $\pi_n(t)$ and $\pi_n(t^\prime)$, for larger values of $n$.
\begin{example}
We can check $ac+bd\rightsquigarrow_{1,2} ad+bc$ by using the sequence $\mathcal{S}:= ac+bd\rightsquigarrow^1_{1,1}bc+bd\rightsquigarrow^{1}_{1,1}bc+ad=ad+bc$, which corresponds to $\pi_1(\mathcal{S})=\mathcal{S}^1:= a$$+b\rightsquigarrow^1_{1,1}b$$+b\rightsquigarrow^1_{1,1} b$$+a=a+b$. Therefore, in this case, we cannot start with the trivial sequence $\mathcal{S}^{{\prime}1}:= a$$+b=b$$+a$, and moreover we need to take the order of ``summands'' into account, expressing the fact that we have really to change $a$ into $b$, and $b$ into $a$.
\end{example}
\section{Some partial results looking for continuity}
Ex.~\ref{ej1} shows us that sometimes we need to use intermediate trees containing subtrees that are wider than the corresponding ones in the two compared trees. However, we expected to prove that the width of those subtrees would be bounded by some (simple) function of the width of the subtrees at the same depth of the compared trees. We tried a proof by induction on the depth of the trees, whose base case should correspond to depth $1$.
We consider $1$-depth trees $t=\sum_{i=1}^n a_i$ and $t^\prime=\sum_{j=1}^m b_j$,
and the corresponding multisets of labels $A=\{a_1,\dots, a_n\}$ and $B=\{b_1,\dots, b_m\}$. Any step in a sequence $t\rightsquigarrow_{\alpha,d}t^\prime$ is, of course, a first level step and corresponds to the application of either idempotency, in any direction, or the relabeling rule. We can represent these sequences by means of a multi-stage graph. We formally denote these graphs by $(S,T,l,v)$, where
\begin{inparaenum}[$(i)$]
\item $S$ is partitioned into $\{S_j\}_{j=0, \ldots, m}$,
\item $l\mid_{S_0}:S_0\rightarrow A$ and $l\mid_{S_m}:S_m\rightarrow B$ are bijections, and
\item arcs in $T$ are of the form $(t,u)$, with $t\in S_i$ and $u\in S_{i+1}$ for some $i$, and correspond to any of the patterns in Fig.~\ref{Pasos_nodos}, with the application of a single non-identity pattern at each stage.
\end{inparaenum}
Then, the full cost $d$ of the sequence is just the sum of the costs of all the arcs in the graph.
\begin{definition}
We say that a multi-stage graph is
\begin{compactenum}
\item \emph{Totally sides connecting} (tsc) if for all $s_0\in S_0$ there exists a path connecting it with some $s_m\in S_m$, and, symmetrically, for all $s_m\in S_m$ there exists a path connecting it with some $s_0\in S_0$.
\item \emph{Totally both ways connected} (tbwc) if it is tsc and for each $j\in \{1, \ldots, m-1\}$ and each $s\in S_j$ there exist two arcs $(s^\prime,s), (s,s^{\prime\prime})\in T$.
\end{compactenum}
\end{definition}
\begin{figure}[t]
\begin{center}
\scriptsize{
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto]
\matrix [matrix of math nodes, column sep={1cm,between origins},row sep={0.5cm,between origins}]
{
\node(){};&\node (2) {c}; & \node (5) {c}; & \node () {};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};\\
\node(1){c};&\node () {}; & \node () {}; & \node (4) {c};&\node(){,};&\node(7){c};&\node(8){d};&\node(){,};&\node(9){c};&\node(10){c};\\
\node(){};&\node(3){c}; & \node (6) {c};& \node () {}; &\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};\\
\node(){}; & \node () {\hspace{1.1cm}Idempotency}; & \node () {};&\node(){};&\node(){};&\node(){};&\node(){\hspace{-.9cm}Relabeling};&\node(){};&\node(){};&\node(){};&\node(){\hspace{-3.3cm}Identity};\\
};
\begin{scope}[every node/.style={font=\scriptsize\itshape}]
\path [->]
(1) edge node[auto]{$0$}(2)
(1) edge node[auto,swap]{$0$}(3)
(5) edge node[auto]{$0$}(4)
(6) edge node[auto,swap]{$0$}(4)
(7) edge node[auto]{${\bf d}(c,d)$}(8)
(9) edge node[auto]{0}(10);
\end{scope}
\end{tikzpicture}}
\end{center}
\vspace{-0.3cm}
\caption{Arcs of the graph representing the transformation of single level trees.}\label{Pasos_nodos}
\end{figure}
\begin{proposition}\label{cota_primerpiso}
Let $t=\sum_{i=1}^n a_i$ and $t^\prime=\sum_{j=1}^m b_j$ as above. Then, whenever we have $t\rightsquigarrow_{\alpha,d}t^\prime$, we can prove this by means of a sequence that has at most $3(m+n-2)+1$ distance steps. Consequently, the widths of the trees along such a sequence are also bounded by that amount.
\end{proposition}
\begin{proof}
We consider the multi-stage graph $\mathcal{G}$ that represents the sequence $t\rightsquigarrow_{\alpha,d}t^\prime$. We observe that this graph is tsc, using this fact we obtain a ``compacted'' subgraph $\mathcal{H}$ (of the original graph $\mathcal{G}$) by selecting a subset of the nodes of $\mathcal{G}$ and disjoints paths connecting them. So that, ever node in $\mathcal{G}$-$\mathcal{H}$ is at most in one of theses paths.
We turn these paths into arcs of $\mathcal{H}$ whose cost is $d(c_i,c_j)$, where $c_i$, $c_j$ are the two extremes of the path. By applying the triangle inequality, we immediately obtain that this cost is no larger than the cost of the original path. Therefore, the full cost of $\mathcal{H}$ is no bigger than that of $\mathcal{G}$. The set of nodes in $\mathcal{H}$ is obtained in the following way:
\begin{compactitem}
\item First, we consider $a_1\in A$ and some reachable $b_{j1}\in B$ from it. We introduce both of them in $\mathcal{H}$, and also add the arc connecting them, as explained above.
\vspace{-0.15cm}
\begin{center}
\begin{tikzpicture}
\node at (-2,1.3) {$a^\prime_i$};
\node at (-2,1){$\bullet$};
\draw [dashed] (-1.8,1)--(-1.2,1);
\node at (-1,1.3) {$c^\prime_{ki}$};
\node at (-1,1) {$\bullet$};
\draw [dashed](-0.8,1)--(-0.2,1);
\node at (0,1) {$\circ$};
\draw [dashed](0.2,1)--(0.8,1);
\node at (1,1.3) {$c_k$};
\node at (1,1){$\bullet$};
\draw [dashed](1.2,1)--(1.8,1);
\node at (2,1){$\circ$};
\node at (3,1){$\bullet$};
\node at (3,1.3) {$c^{\prime\prime}_{ki}$};
\draw [dashed] (2.2,1)--(2.8,1);
\node at (4,1){$\bullet$};
\node at (4,1.3){$b^\prime_{ji}$};
\draw [dashed](3.2,1)--(3.8,1);
\node at (-2,-0.2) {$a_i$};
\node at (-2,-0.5){$\bullet$};
\draw [dashed] (-1.9,-0.45)--(-0.1,0.45);
\node at (-1,0) {$\circ$};
\node at (0,0.5) {$\circ$};
\draw [dashed](0.1,0.55)--(0.9,0.95);
\end{tikzpicture}
\end{center}
\vspace{-0.15cm}
\item Next, we consider each of the remaining $a_i\in A$ and we select again some $b_{ji}$ with which it is connected. We take the path in $\mathcal{G}$ connecting them, and if it does not cross any path in $\mathcal{G}$ that generated an arc in $\mathcal{H}$, then we proceed as in the first case. Otherwise, we consider the first arc $\langle c^\prime_{ki}, c^{\prime\prime}_{ki}\rangle$ in $\mathcal{H}$ ``traversed'' by the new path. If $c_{ki}$ is the common node to the two involved paths, then we add it to $\mathcal{H}$ and remove the arc $\langle c^\prime_{ki}, c^{\prime\prime}_{ki}\rangle$ adding instead two new arcs $\langle c^\prime_{ki}, c_{ki}\rangle$ and $\langle c_{ki}, c^{\prime\prime}_{ki}\rangle$, together with the arc $\langle a_i, c_{ki}\rangle$.
\end{compactitem}
Finally, we proceed in the same way, but going backwards in the graph, for every $b_j\in B$ that was not still reached from any $a_i\in A$. Clearly, at any stage of the construction we add two new arcs in the worst case, and besides we need an idempotency step each time we consider a path that crosses $\mathcal{H}$. This finally produces a sequence from $t$ to $t^\prime$ with at most $3(m+n-2)+1$ steps, whose cost is not bigger than that of the original sequence.
Since the width of the trees change at most one at any step, the results about the bound of these widths follows immediately.
\end{proof}
The important thing about the bounds obtained above, is that they only depend on the cardinality of the multisets $A$ and $B$, but no at all on the properties of the domain of actions $(\mathds{A}, \bf{d})$. Even more, we can extend this result to any two finite trees $t=\sum_{a\in A} at_a$ and $t^\prime=\sum_{b\in B} bt_b$: the size and complexity of the ``continuations'' $t_a$ and $t_b$ do not compromise the bound on the number of first level steps of a sequence relating $t$ and $t^\prime$, that bound only depends on $||t||_1$ and $||t^\prime||_1$.
\begin{proposition}\label{cota_total}
Let $t=\sum_{i=1}^n a_it_i$ and $t^\prime=\sum_{j=1}^m b_jt_j$ be two trees such that $t\equiv_{d}^{\alpha} t^\prime$. Then, we can prove this by means of a coinductive transformation sequence $\mathcal{C}$, that has at most $3(m+n-2)+1$ first level steps.
\end{proposition}
\begin{proof}
We observe that the result in Prop.~\ref{cota_primerpiso} could be obtained in exactly the same way if instead of a distance function on $A$, we would consider a relation $d\subseteq A\times A\times \mathds{R}^+$ that satisfies the properties that define ``bounds for a distance'' in $A$:
\begin{compactitem}
\item $\forall a\in A$ $d(a,a,d)$ $\forall d\in \mathds{R}^+$.
\item $d(a,b,d)$ $\Leftrightarrow$ $d(b,a,d)$.
\item $d(a,b,d_1) \wedge d(b,c,d_2)$ $\Rightarrow$ $d(a,c,d_1+d_2)$.
\end{compactitem}
Then, we consider the set of ``prefixed'' trees $\mathds{A}FTrees=\mathds{A}\times FTrees$, and we take $d_{\alpha}(at,bt^\prime,d_1+d_2)$ $\Leftrightarrow$ $d_1={\bf d}(a,b)\wedge t\rightsquigarrow_{\alpha,d_2/\alpha}t^\prime$. It is clear that for any distance $d$ on $A$, and any $\alpha \in \mathds{R}^`$, each such $d_\alpha$ defines bounds for a distance in $A$. Now, we can see each finite trees $t=\sum_{i=1}^n a_it_i$ as a $1$-depth trees $t=\sum_{i=1}^n\langle a_i,t_i\rangle$, for the alphabet $\mathds{A}FTrees$. For any $\alpha\in \mathds{R}^+$ we can consider the ``bound for a distance'' relation $d_\alpha$, and apply Prop.~\ref{cota_primerpiso} to conclude the proof.
\end{proof}
\subsection{An alternative proof of the bounds for the first level}
Even if the bounds obtained in Prop.~\ref{cota_primerpiso} are rather satisfactory we have been able to prove some tighter bounds by reducing the induced graph by means of local simplifications rules. We consider interesting to show this proof because they bring to light how we could proceed when transforming the trees all along the sequences (even if we have not been able to successfully use this ideas in order to fully prove the desired continuity result).
\begin{proposition} \label{prop:from_tsc_to_tbwc}
Any multi-stage graph that is tsc can be turned into a tbwc multi-stage graph
that is a subgraph of the original one.
\end{proposition}
\begin{proof}
We repeatedly remove any intermediate node which is not two ways connected, and it is clear that after any such removal the graph remains tsc.
\end{proof}
\begin{proposition} \label{pr}
\begin{compactenum}
\item The multi-stage graph associated to a sequence proving that $A\equiv^{\alpha}_dB$ is tbwc.
\item \label{segundo} Any subgraph of such a multi-stage graph, obtained by the removal of some internal nodes, that still remains tbwc, can also be obtained from some sequence proving $A\equiv^{\alpha}_d B$,
which will be shorter or have the same length than the initial sequence.
\end{compactenum}
\end{proposition}
\begin{proof}
(1) Trivial. (2) When removing an internal node we are possibly removing an application of idempotency that turns into a simple identity arc. In such a case, we can remove this stage of the sequence getting a shorter sequence still proving $A\equiv^{\alpha}_d B$.
\end{proof}
\begin{remark}
The result in Prop.~\ref{pr}.\ref{segundo} is true, not only if we remove nodes that are not both ways connected (in fact, there is no such in a tbwc multi-stage graph!), but also if we remove any subset of intermediate nodes, as far as the graph remains tsc. This is what we next use in order to reduce the size of the graph.
\end{remark}
\begin{definition}
We say that a tbwc multi-stage graph is a \emph{diabolo} if there exists some stage $i\in \{0\ldots m\}$ with $|S_i|=1$, such that:
\begin{inparaenum}[$(i)$]
\item for all $j<i$ and all $s_j\in S_j$, $|\{s^\prime \mid (s_j,s^{\prime})\in T\}|=1$, and
\item for all $j>i$ and all $s_j \in S_j$, $|\{s^\prime \mid (s^{\prime},s_j)\in T\}|=1$. We say that $s_i \in S_i$ is a center of the diabolo.
\end{inparaenum}
\end{definition}
\begin{figure} [t]
\begin{center}
\scriptsize{
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto]
\matrix [matrix of math nodes, column sep={1cm,between origins},row sep={0.5cm,between origins}]
{
\node(1){\bullet};&\node () {}; & \node (4) {\bullet};&\node(){};&\node(7){\bullet};&\node(9){\bullet};&\node(){};&\node(13){\bullet};&\node(){};&\node(){};&\node(16){\bullet};\\
\node(){};&\node (2) {\bullet}; &\node(){};&\node(6){\bullet};&\node(){};&\node(){};&\node(11){\bullet};&\node(){};&\node(14){\bullet};&\node(15){\bullet};&\node(){};\\
\node(3){\bullet};&\node(){};&\node(5){\bullet}; &\node(){};&\node(8){\bullet};&\node(10){\bullet};&\node(){};&\node(12){\bullet};&\node(){};&\node(){};&\node(17){\bullet};\\
};
\begin{scope}[every node/.style={font=\scriptsize\itshape}]
\path [-]
(1) edge (2)
(2) edge (3)
(2) edge (4)
(2) edge (5)
(6) edge (7)
(6) edge (8)
(9) edge (11)
(10) edge (11)
(12) edge (14)
(13) edge (14)
(14) edge (15)
(15) edge (16)
(15) edge (17);
\end{scope}
\end{tikzpicture}}
\end{center}
\caption{Schematic examples of diabolos}
\end{figure}
Next we prove that we can reduce any tbwc multi-stage graph into a disjoint union of diabolos. We will do it by removing some ``redundant'' arcs, in such a way that these removals do not destroy the \emph{tsc}
character of the graph.
\begin{definition}
\begin{compactenum}
\item We say that a sequence of consecutive arcs \vspace{-0.2cm}$$(s_j,s_{j+1}), (s_{j+1},s_{j+2})\ldots (s_{j+k-1},s_{j+k})\vspace{-0.2cm}$$ in a tsc graph is a \emph{join sequence} if:
\begin{inparaenum}[$(i)$]
\item for all intermediate nodes in the sequence $s_{j+l}$ with $l \in \{1, \ldots, k-1\}$, the two arcs in the sequence, $(s_{j+l-1}, s_{j+l})$ and $(s_{j+l},s_{j+l+1})$ are the only ones in $T$ that involve $s_{j+l}$; and
\item there are at least two other arcs $(s_j, s^{\prime})$ and $(s^{\prime\prime},s_{j+l})$ in $T$ that are not in the sequence.
\end{inparaenum}
\item We say that a node $s_j\in S_j$ is left-reducible (resp.\ right-reducible) if it can only be reached from a single node $s_0\in S_0$ (resp. $s_m\in S_m$), but there are several arcs $(s^\prime_{j-1},s_j)\in T$ (resp. $(s_j,s^\prime_{j+1})\in T$).
\end{compactenum}
\begin{center}
\scriptsize{
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto]
\matrix [matrix of math nodes, column sep={1cm,between origins},row sep={0.1cm,between origins}]
{
\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};\node(){};&\node () {}; & \node(){};&\node(4){\bullet};&\node(){};\\
\node(){};&\node () {}; & \node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};\\
\node(){};&\node(8){\bullet};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};\node(){};&\node () {}; & \node(){};&\node(){};&\node(){};\\
\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};\node(){};&\node () {}; & \node(){};&\node(){};&\node(){};\\
\node(){};&\node () {}; & \node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};\\
\node () {}; & \node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};\\
\node(6){\bullet};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};\node(1){\bullet};&\node () {}; & \node(3){\bullet};&\node(){};&\node(5){\bullet};\\
\node(){};&\node(7){\bullet};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};\node(){};&\node () {}; & \node(){};&\node(){};&\node(){};\\
\node(){};&\node(){};&\node(8bajo){\bullet};&\node(){};&\node(){};&\node(){};&\node(){};\node(){};&\node () {}; & \node(){};&\node(){};&\node(){};\\
\node(){};&\node(){};&\node(){};&\node(9){\bullet};&\node(){};&\node(){};&\node(){};\node(){};&\node () {}; & \node(){};&\node(){};&\node(){};\\
\node(){};&\node(){};&\node(){};&\node(){};&\node(10){\bullet};&\node(){};&\node(){};\node(){};&\node () {}; & \node(){};&\node(){};&\node(){};\\
\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};\node(){};&\node () {}; & \node(){};&\node(){};&\node(){};\\
\node(){};&\node () {}; & \node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};\\
\node(){};&\node(){};&\node(){};&\node(8bis){\bullet};&\node(){};&\node(){};&\node(){};\node(){};&\node () {}; & \node(){};&\node(4bis){\bullet};&\node(){};\\
\node(){};&\node () {}; & \node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};\\
\node(){};&\node () {}; & \node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};\\
\node(){};&\node () {}; & \node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};\\
\node(){};&\node () {}; & \node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};&\node(){};\\
\node(){};&\node(){\hspace{1.7cm}\mathit{Join\,\;Sequence}};&\node(){};&\node(){};&\node(){};&\node(){};\node(){};&\node () {}; & \node(){};&\node(){\hspace{-.5cm}\mathit{Left} \emph{-} \mathit{reducible\,\;Node}};&\node(){};\\
};
\begin{scope}[every node/.style={font=\scriptsize\itshape}]
\path [-]
(1) edge (3)
(3) edge (4)
(3) edge (4bis)
(4) edge (5)
(4bis) edge (5)
(6) edge (8)
(6) edge (7)
(7) edge (8bajo)
(8bajo) edge (9)
(9) edge (10)
(10) edge (8bis);
\end{scope}
\end{tikzpicture}}
\end{center}
\end{definition}
\begin{proposition} \label{eliminating_diamonds_joinsequence}
\begin{compactenum}
\item Whenever we have a join sequence in a tbwc graph, we can remove all its arcs and the intermediate nodes, preserving the tbwc property.
\item Whenever we have a left (resp.\ right)-reducible node $s_j$ in a tbwc, we can remove one of the arcs $(s^\prime_{j-1},s_j)$ reaching (resp. $(s_j,s^\prime_{j+1})$ leaving) the node, preserving the tsc property.
\end{compactenum}
\end{proposition}
\begin{proof}
(1) Clearly, after the removal the graph remains tbwc, due to the existence of the two ``lateral'' arcs $(s_j, s^{\prime}_{j+1})$ and $(s^\prime_{j+l-1},s_{j+l})$.
(2) It is clear that after the removal we have still another arc reaching (resp. leaving) the reducible node from the same side. This can be still used to reach the corresponding node $s_0\in S_0$ (resp. $s_m\in S_m$). And no other node in either $S_0$ and $S_m$ is affected by the removal.
\end{proof}
\begin{theorem}\label{reduce_to_collection_diabolo}
By removing some intermediate nodes we can reduce any tbwc multi-stage graph into another such graph (with smaller or equal total cost) which is the disjoint union of a collection of diabolos.
\end{theorem}
\begin{proof}
We start by reducing the graph applying Prop.~\ref{eliminating_diamonds_joinsequence}, until we cannot apply it anymore. We obtain a tsc graph
connecting the same sets of nodes $S_0$ and $S_m$, which can be turned into another tbwc (smaller) by applying Prop.\ref{prop:from_tsc_to_tbwc}. By abuse of notation, let us still denote by $S_1,\ldots, S_{m-1}$ the other stages of the graph.
\begin{compactitem}
\item First, we consider the connected components of the graph containing
exactly one node $s_0$ belonging to $S_0$.
These components are right-degenerated diabolos with $s_0$ as center.
Indeed, if this was not the case, then the component would still contain a
left-reducible node.
\item Now, let us consider a connected component containing a subset of nodes $\{s^1_0,\ldots, s^k_0\}\subseteq S_0$, with $k>1$.
It is not difficult to verify that for each $s^i_0$ ($1 \leq i \leq k$),
there is exactly one arc leaving $s_0^i$: otherwise, the connected component
would still contain a join sequence (due to the presence of multiple nodes in
$S_0$).
Using a similar argument, it is possible to prove that there can be only a single arc leaving each node in the following stages as well, until a stage $i$ is reached such that the component contains exactly one node $s_i\in S_i$.
Reasoning in a symmetric way from the right side (set $S_m$), it is eventually
possible to show that the considered component is a diabolo.
\end{compactitem}
Therefore, after the reduction, the graph is indeed the union of a family of disjoint diabolos.
\end{proof}
\begin{proposition}\label{size_diabolo}
\begin{compactenum}
\item \label{primero} A diabolo connecting two sets of nodes $S_0$ and $S_m$ satisfies $|S_i|\leq max\{|S_0|,|S_m|\}$ for each $i$.
\item Any disjoint union of diabolos connecting $S_0$ and $S_m$ satisfies $|S_i|\leq |S_0|+|S_m|$ for each $i$.
\item If the multi-stage graph corresponding to a sequence proving $A\equiv^\alpha_d B$ is a diabolo, then we can obtain another such sequence whose length will be at most $3(|A|+|B|-2)+1$.
\end{compactenum}
\end{proposition}
\begin{proof}
(1) Obvious. (2) We could think that this is an immediate consequence of \ref{primero}, but this is not always the case. Let us consider the disjoint union $S$ of two three-stages (degenerated) diabolos $S^1$ and $S^2$, with $|S^1_0|=1=|S^2_2|$; $|S^2_0|=8=|S^1_2|$; $|S^1_1|=5=|S^2_1|$. Then we have $S_0=S^1_0\cup S^2_0$, $S_1=S^1_1\cup S^2_1$, $S_2=S^1_2\cup S^2_2$ and therefore $|S_1|=10$, but $|S_0|=|S_2|=9$. As a consequence, the result would be wrong if we put $max$ instead of $+$. However, what we asserted is true in general: Let $S$ the disjoint union of a family of diabolos $S^j$ with $j\in\{1..k\}$, then we have $S_i=\bigcup_{j=1}^k S^j_i$, and as a consequence of \ref{primero}, $|S^j_i|\leq |S^j_0|+|S^j_m|$, and therefore $|S_i|=\sum_{j=1}^k |S^j_i|\leq \sum_{j=1}^k |S^j_0|+\sum_{j=1}^k |S^j_m|= |S_0|+|S_m|$.
(3) Whenever we have two relabeling steps at the same place, with no idempotency steps between them affecting that place, we can join them into a single relabeling step, without increasing the cost of the full transformation, because of triangular transitivity. As a consequence, we would have at most two relabeling steps for each idempotency step, and we have exactly $|A|+|B|-2$ idempotency steps at each diabolo. So we have, at the moment, at most $3(|A|+|B|-2)$ steps; possibly, we will need only one more relabeling step at the center of the diabolo. This gives us the bound $3(|A|+|B|-2)+1$.
\end{proof}
\begin{corollary} \label{size}
If we can prove $A\equiv^\alpha_d B$, then we can do it by means of a sequence whose intermediate sets satisfy $|S_i|\leq |A|+|B|$, and has at most $3(|A|+|B|-2)+1$ steps.
\end{corollary}
\begin{proof}
We apply Th.~\ref{reduce_to_collection_diabolo} to reduce the multi-stage graph corresponding to the sequence proving $A\equiv^\alpha_d B$. Then apply Prop.~\ref{size_diabolo} to get the bounds for the values $|S_i|$, and that for the number of steps.
\end{proof}
\subsection{Now we go down into the second level}
Once we have the base case of an inductive proof, we would like to proceed with the inductive case. When we thought that we had it, we decided to present first the particular case of the trees with only two levels, because its (bigger) simplicity would help the readers to understand the quite involved proof for the general case. Next we present the proof for this particular case.
Starting from $p=\sum_{i\in I}a_ip_i$ and $q=\sum_{j\in J}b_jq_j$, once we have proved our Cor.~\ref{size}, we can assume that the first level steps in the sequences proving $\pi_n(p)\equiv^\alpha_d \pi_n(q)$ are always the same and satisfy the bounds in the statement of Th.~\ref{reduce_to_collection_diabolo}. In order to study in detail the second level steps in these sequences, we need to see how the summands $p_i$ evolve along those sequences.
Once we had some bound for the width of any process $p^\prime$ obtained by the evolution of the summands $p_i$, and another one for the length of the subsequences producing their evolution, adding all these bounds and that corresponding to the first level, we would obtain the bound for the two first levels together.
The following Prop.~\ref{bounding_sequence} proves a preliminary result. It says that whenever we have a sequence proving $p\equiv^\alpha_d q$ with a ``limited number'' of first level steps, but $q$ contains summands $aq_i$ where $||q_i||$ is ``very large'', then we can prune these summands, getting some $q^\prime$ for which $p\equiv^\alpha_d q^\prime$ can be proved by means of a sequence that only contains processes $p^i$ for which $||p^i||_2$ is ``moderately large'', and for any process $q^{\prime\prime}$ ``between'' $q^\prime$ and $q$ (that means that $q^{\prime\prime}$ can be obtained by adding some branches to some subprocesses of $q^\prime$, and also $q$ can be obtained from $q^{\prime\prime}$ in this way) we also have $p\equiv^\alpha_d q^{\prime\prime}$. Again, in order to make easier the comprehension of the proposition, we first present a lemma that covers the particular case corresponding to intermediate stages of a sequence connecting two processes $p$ and $q$ with $||p||$ and $||q||$ ``small''.
\begin{lemma}\label{lem}
For any intermediate process $p^i$ in the sequence $\mathcal{C}$ proving $p=\sum_{i=1}^n a_ip_i\equiv^\alpha_d q=\sum_{j=1}^m b_jq_j$, we can decompose $p^i$ into $p^i=p^{i1}+p^{i2}$ in such a way that $||p^{i1}||\leq ||p||+||q||$, and we have a sequence $\mathcal{C}^\prime:=p\equiv^\alpha_{d_1}p^{i1}\equiv^\alpha_{d_2} q$ with $d=d_1+d_2$, which has at most $3(|I|+|J|-2)+1$ first level steps, and only uses intermediate processes $r=\sum_{k\in K} c_kr_k$ with $||r||\leq ||p||+||q||$.\\
Moreover, for any decomposition $p^{i2}=p^{i3}+p^{i4}$, we can obtain a sequence $\mathcal{C}^{\prime\prime}:=p\equiv^\alpha_{d_1}p^{i1}+p^{i3}\equiv^\alpha_{d_2} q$ which has at most $(3(|I|+|J|-2)+1)*(||p^{i3}||+1)$ first level steps, and only uses intermediate processes $r=\sum_{k\in K} c_kr_k$, with $||r||\leq ||p||+||q||+||p^{i3}||$.
\end{lemma}
\begin{proof}
The first part is in fact a new formulation of Th.~\ref{reduce_to_collection_diabolo}, observing that each node at the $i$-th stage of the multi-stage graph induced by $\mathcal{C}$ corresponds to a summand of the corresponding process $p^i$. When reducing the multi-stage graph, we are pruning some of these summands. Therefore, the obtained intermediate processes at the sequence $\mathcal{C}^\prime$ are the processes $p^{i1}$ of the searched decomposition of $p^i$. Then, the remaining summands in $p^{i2}$ correspond to the nodes from the $i$-th stage of the multi-stage graph that were removed when reducing it.
It is easy to see that any of these summands can be ``reset'' into the multi-stage graph by means of a path that will connect the corresponding node with the two sides of the original multi-stage graph. This requires $(3(|I|+|J|-2)+1)$ additional arcs, and therefore $(3(|I|+|J|-2)+1)$ more steps in the sequence $\mathcal{C}^{\prime\prime}$, while the width of the intermediate processes in it is increased at most by $1$, when adding each of those paths.
\end{proof}
\begin{proposition}\label{bounding_sequence}
For each $f\in\mathds{N}$, there is a constant $C_{2,f}$ such that if we have a sequence $\mathcal{C}$ proving $p\equiv^\alpha_d r$ with $f$ first level steps and $r=\sum_{k\in K} c_kr_k$, with $r_k=\sum_{l\in K_k} c_{k,l}r_{k,l}$, then we can obtain some $r^\prime=\sum_{k\in K} c_k r^\prime_k$ with $r^\prime_k=\sum_{l\in L_k} c_{k,l} r^\prime_{k,l}$, where $L_k\subseteq K_k$, with $|L_k|\leq 2^f ||p||$, whose intermediate processes $p^i$ are of the form $p^i=\sum a^i_jp^i_j$, with $p^i_j=\sum _{k\in K^i_j}b_kp^i_{j,k}$ and $|K^i_j|\leq 2^f ||p||$, and $length(S^\prime)\leq C_{2,f}$.\\
Moreover, taking $m\in\mathds{N}$, we also have a family of constants $C_{2,f,m}$ such that for any $r^{\prime\prime}=\sum c_kr^{\prime\prime}_k$ with $r^{\prime\prime}_k=\sum_{l\in L^\prime_k} c_{k,l}r_{k,l}$, where $L_k\subseteq L^\prime_k\subseteq K_k$, we can also prove $p\equiv^\alpha_d r^{\prime\prime}$, by means of a sequence $\mathcal{C}^{\prime\prime}$ whose intermediate processes $p^i$ satisfy $||p^i||_2\leq max\{2^f ||p||, |L^\prime_k|_{k\in K}\}$ and $length(S^{\prime\prime})\leq C_{2,f,max\{|L^\prime_k|_{k\in K}\}}$.
\end{proposition}
\begin{theorem}\label{step_bound_level2}
For all $k\in\{1,2\}$ and $w\in\mathds{N}$ there exists a bound $lb(k,w)\in\mathds{N}$ such that for all $p,q$ with $||p||_k$, $||q||_k\leq w$ and $p\equiv^\alpha_d q$ we can prove the latter by means of a sequence $\mathcal{C}^\prime$ that has no more than $lb(k,w)$ steps in each of its two first levels.
\end{theorem}
\begin{proof}
At the same time that the existence of the bound $lb(k,w)$ we will prove a bound $wb(k,w)$ for the width $||p^i||_2$ of any process $p^i$ along the $2$-unfolding of the sequence $\mathcal{C}^\prime$.\\
\underline{k=1} Th.~\ref{reduce_to_collection_diabolo} just states the result for this case, taking $wb(1,w)=2w$ and $lb(1,w)\leq 6w$. \\
\underline{k=2} Let $\mathcal{C}$ be a sequence proving $p\equiv^\alpha_d q$ which has less than $lb(1,w)$ steps at the first level. If $\mathcal{C}$ contains no first level step, then we have $p=\sum_{i=1}^n a_ip_i$, $q=\sum_{i=1}^n a_i q_i$ and $\mathcal{C}$ can be factorized into a collection of sequences $(\mathcal{C}_i^\prime)_{i=1}^n$ proving $p_i \equiv_{d_i} q_i$.
Then, we only need to apply Th.~\ref{reduce_to_collection_diabolo} to each of these sequences, so that we could take $wb(2,w)=2w$ and $lb(2,w)=2w*6w=12w^2$.\\
If $\mathcal{C}$ contains some first level step, we select any of them and divide the $2$-unfolding of $\mathcal{C}$ into $\mathcal{C}^1\circ \langle s \rangle\circ\mathcal{C}^2$, where by abuse of notation we identify the sequences and their $1$-unfolding. Let us consider the case in which the central step corresponds to a relabeling $ap_i^{\prime}\rightarrow bp_i^\prime$ (the other cases are analogous). Assume that $\mathcal{C}^1$ proves $p\equiv^\alpha_{d_1}p^\prime$ and $\mathcal{C}^2$ proves $q^\prime\equiv^\alpha_{d_3}q$, with $d=d_1+{\bf d}(a,b)+d_3$. We can apply Prop.~\ref{bounding_sequence} to both sequences, taking $\mathcal{C}^2$ in the opposite direction, getting $r^\prime$ and $r^{\prime\prime}$, with $\mathcal{C}^{\prime1}$ proving $p\equiv^\alpha_{d_1} r^\prime$ and $\mathcal{C}^{\prime2}$ proving $r^{\prime\prime}\equiv^\alpha_{d_3} q$, that have the same steps at the first level than $\mathcal{C}^1$ and $\mathcal{C}^2$, respectively, and only use intermediate processes $p^i$ with $||p^i||_2\leq2^{lb(1,w)-1}*w$. The result is also valid for any intermediate process between $r_1$ and $p^\prime$, and anyone between $r_2$ and $q^\prime$, but increasing the bounds in the adequate way. In particular, for the process $r_1+r_2$, we have $p\equiv^\alpha_{d_1} r_1+r_2$ and $r_1+r_2\equiv^\alpha_{d_3} q$, by means of two sequences that only include intermediate processes $p^i$ with $||p^i||_2\leq 2^{lb(1,w)}*w$. Joining these two sequences with the step $s$ we obtain the sequence $\mathcal{C}^\prime$. Adding the bounds for the corresponding lengths of the $2$-unfolding of the two sequences obtained by application of Prop.~\ref{bounding_sequence}, we obtain the bound $lb(2,w)$. To be more precise, the definitive value of $lb(2,w)$ will be the maximum of the bounds for the different cases (there are finitely many) considered above.
\end{proof}
Certainly, the proof is quite involved and difficult to follow, but it works in this case. Unfortunately, when we tried to develop it for the general case we discovered that some details failed, or at least cannot be justified in the same way. Let us roughly explain why: the argument used in Lemma~\ref{lem} looks for an small ``kernel'' $p^{i1}$ of any intermediate process along a sequence. Then Prop.~\ref{bounding_sequence} joins the kernels obtained when considering the two subsequences starting at any side of the original sequence and ending at any intermediate process. The second part of Lemma~\ref{lem} says us that we can get in this way a sequence satisfying the desired bounds. But when we are in a deeper level, a duplication (by using idempotency) at a lower level could cause an undesired increasing of the ``closure'' of the union of the two (one from each side) kernels. And this problem could appear over and over (at least, we are not able to prove that this is not the case). Therefore, we have to leave this problem open, at the moment, any help?
\section{Conclusions and future work}
The first two authors of this paper are involved in a detailed study of bisimulation distances, that will constitute in fact the forthcoming Ph.D. Thesis of the first one, supervised by the second. As we have already pointed out, while the global bisimulation distance we propose is more difficult to manage than other existing bisimulation distances, we claim that it provides a much more accurate measure of the differences between two processes. Moreover, our approach has many nice properties, and we still think that continuity with respect to projections is one of them. Even if we have not been able yet to present a full continuity proof, we think that, after having invested a great number of hours in this quest, time has come to present here the (partial) results we got so far.
We are now working on several extensions of our approach. In particular the modal interface framework \cite{lnw07, lv13, rbbclp11} is a quite suggestive one, where we are obtaining quite promising results. We are also interested in stochastic distances \cite{fpp11} and those based on logics \cite{dgjp04}. When considering probabilistic choices between branches associated with the same action, these two notions of distance \emph{do} capture global differences. However, this is not the case when choices between different actions are considered. It is our intention to provide a ``fully global'' probabilistic distance (covering also the latter case) that will extend our global distance to these frameworks. Finally, we recently started to consider interval temporal logics~\cite{beatcs11},
aiming at devising a suitable notion of global distance between interval models.
\bibliographystyle{eptcs}
| {'timestamp': '2015-12-23T02:02:48', 'yymm': '1512', 'arxiv_id': '1512.06944', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06944'} | arxiv |
\section{Introduction}
Vaccines against infectious diseases offer health benefits to society \cite{Orenstein,Witty} and have been instrumental in the prevention of conditions previously causing egregious burden to public health. Examples include the worldwide eradication of smallpox \cite{Weiss} and the extremely low incidence of tetanus, diphteria and congenital rubella syndrome in the Western world \cite{WHO3}. However, despite being frequently successful from a clinical point of view, vaccination programmes are often costly to apply. As a pre-requisite to their implementation, health interventions such as vaccines are thus increasingly subject to cost-effectiveness analyses (CEAs) \cite{WHO2,Briggs}.
The National Institute for Health and Care Excellence (NICE) is arguably the leading health technology assessment agency in the world. In the UK, NICE is responsible for providing guidance and advice on whether proposed interventions should be publicly funded. NICE has developed a set of criteria and guidelines that drive the analytic process of CEA \cite{NICE}. Crucially, these involve the explicit necessity of assessing the impact of parameter uncertainty on the decision making outcome, a process typically known as \textit{Probabilistic Sensitivity Analysis}~(PSA)~\cite{Briggs,Baio3,Baio2}.
In the UK, the appraisal of vaccines falls under the remit of the Joint Committee for Vaccines and Immunisations, an independent expert advisory committee to the ministers and health departments. Since 2009, the Health Protection Regulation obliges the Secretary of State to ensure that recommendations for national vaccination programmes are based on an assessment demonstrating cost-effectiveness \cite{JCVI}. However, there are currently no vaccine-specific guidelines for developing clinical or cost-effectiveness evidence.
One of the reasons for this circumstance is perhaps the intrinsic complexity of infectious disease modelling, which is typically performed through \textit{compartmental} models. These are highly complicated mathematical tools capable of simulating the natural history of disease infection and progression. More specifically, in pathogens transmissible among humans, these models need to account for population dynamics and \textit{herd immunity} \cite{Anderson3}. Due to lower infection prevalence, the introduction of vaccination induces a reduced risk of pathogen exposure. Only dynamic models are able to prevent incorrect predictions since they are suitable to incorporate these effects \cite{Pitman,Edmunds2}.
Dynamic compartmental models are usually fitted by solving systems of Ordinary Differential Equations (ODEs). While these usually deal with features such as herd immunity (and thus are considered the ``industry standard'' in infectious disease modelling), they are characterised by a notable computational effort. One important consequence is that, in most cases, epidemiological and economic modelling for infectious disease performed by means of ODEs is based on a deterministic framework. This is relevant because to perform a full PSA, it is necessary to quantify the joint uncertainty in the model parameters through a probabilistic model output. In the context of ODE models, sampling methods such as the Latin Hypercube Sampling \cite{McKay} can be used to add stochasticity, as shown in \cite{Blower,Jit,Jit2}. However, these are rather complex and computationally intensive. In addition, these models are prone to result in an incorrect outcome on the natural history of disease since parameter uncertainty is not accounted for directly in the corresponding model, but only in retrospect.
The difficulties in producing a probabilistic output of ODE systems might be one of the reasons why the \textit{International Society for Pharmacoeconomics and Outcomes Research} guideline for best modelling practice in infectious disease suggests that PSA is \textit{not} a fundamental component of health economic assessment~\cite{Pitman}. This recommendation is given in contrast with NICE and virtually any other disease area. As a consequence, most economic models for vaccines only consider deterministic sensitivity analysis, which is based on selecting a grid of ``plausible'' values for a subset of model parameters in order to assess the robustness of the decision-making process. This approach is however not recommended in general, as it fails to account for potential correlation among the parameters \cite{Briggs,Andronis,Baio2}.
An alternative compartmental specification is given by Markov models (MMs). MMs are used to model progression over time across a finite set of states. Although MMs can also be computationally intensive, it is generally feasible to make them fully probabilistic (e.g. using a Bayesian framework) or to use re-sampling methods such as the bootstrap to characterise the uncertainty in the model parameters. Perhaps for this reason, MMs are a very popular tool in health economic evaluation. Nevertheless, a major limitation in infectious disease modelling is that they are intrinsically static, i.e.\ they do not account for population~dynamics \cite{Brisson}.
With a view to simplifying the process of PSA in health economic models of interventions for infectious diseases, we introduce in this paper an extension to standard MMs. For simplification purposes, we term this a dynamic Bayesian MM and consider that the corresponding method of inference and not the model is Bayesian. We directly include the force of infection of the pathogen, which automatically accounts for time-dependent changes in prevalence and thus the effects of herd immunity, into the state allocation algorithm of a MM. In other words, the movement of susceptibles to the state of infection is directly represented by the dynamic force of infection. Our approach does not involve ODEs. The Bayesian framework with its probabilistic nature is highly flexible since it considers multiple sources of prior information in terms of evidence synthesis \cite{Spiegelhalter}. In addition, as an essential part of CEAs, PSA can be conducted in a straightforward manner.
The paper is structured as follows: Firstly, we describe compartmental models in widespread use for CEAs on interventions against infectious diseases. Secondly, we introduce our innovative approach. Thirdly, we compare the performance of a deterministic and a probabilistic ODE-based model to our methodology, using a case study of a chronic sexually transmitted infection. To contrast the three methodologies in practice, we compare the natural history of disease following calibration, and conduct CEAs including PSA, comparing a screening strategy to a hypothetical vaccine. Finally, we discuss advantages and disadvantages of ODE-based methodology in comparison to the dynamic Bayesian MM.
\section{Methods\label{ode}}
Compartmental models consist of a set $\mathcal{S}$ of mutually exclusive and exhaustive states describing disease infection and progression. We indicate the elements of $\mathcal{S}$ as $s=1,\ldots,S$. Members of a ``virtual'' population move across the states over a pre-specified time horizon.
Figure \ref{fig:SIODE} shows an example of a compartmental model incorporating the natural disease history of a chronic sexually transmitted infection (STI) with $S=5$ states. The assumptions encoded by this structure are that the whole population initially is in the state \textit{Susceptible} (indexed by $s=1$), from which a proportion can move to the state \textit{Infected} ($s=2$). Following this, people move to an \textit{Asymptomatic} state ($s=3$). A progression to the state \textit{Morbid} ($s=4$) induces the development of disease symptoms. The state \textit{Dead} ($s=5$) can be reached from any state; people die due to any cause or as a consequence of being in the state \textit{Morbid}. Compared to the average population, the latter have a higher risk of death. A transition from one state to another is defined according to \textit{transition parameters} \cite{Welton}. They are indicated as $\phi_{r,s}$, where $r,s\in \mathcal{S}$ represent the original and target state, respectively. People proliferate at a rate $\chi$, resulting in a replenishment of the pool of susceptibles at risk of contracting the infection.
\begin{figure}[H]
\centering
\includegraphics[width=\textwidth]{Figure1.png}
\caption{Model structure of a hypothetical chronic sexually transmitted infection consisting of five states. The arrows represent the possible transitions. These are governed by the parameters $\phi_{r,s}$ with indices $r,s\in\mathcal{S}$ representing origin and target states, respectively. The replenishment of the pool of susceptibles by newborns proceeds at a rate~$\chi$.}\label{fig:SIODE}
\end{figure}
Compartmental models may differ in two characteristics. The first is the specification of time. The most realistic option is to allow transitions among the states at any point in time $t>0$; this is a so-called ``continuous-time approach''. Alternatively, it is possible to assume that transitions occur in discrete time where only one transition is possible within a pre-defined time interval $\mathcal{I}_t = [t, t + \kappa)$, where $\kappa$ determines the corresponding interval width, commonly referred to as \textit{cycle}. Depending on the medical context, $\kappa$ can be specified in terms of daily, weekly, monthly or yearly~cycles. The second difference concerns the way in which population dynamics are considered: models including a force of infection which accounts for changes in prevalence are referred to as \textit{dynamic}, while those that include a fixed force of infection and thus ignore the effects of herd immunity are termed \textit{static}.
In addition, different approaches to model parameter specification exist, which may have major impact on the outcome of health economic evaluations. Depending on the methodology used, the induced computational effort might not allow the inclusion of probability distributions on all model parameters. In that case, the model parameters remain deterministic. Commonly, these are estimated through a relevant summary, e.g. mean, median or mode, obtained from available data. The point estimate is then used as a plug-in for the corresponding parameter. In contrast, if probabilistic effects are accounted for, parameter uncertainty is propagated through the infection~progression. While frequentist versions of this strategy exist (e.g.\ based on bootstrap), this type of modelling is most naturally handled within a Bayesian~paradigm.
\subsection{Ordinary Differential Equation models\label{odecase}}
ODE systems model the rate of change in the number of people within a given state in continuous time; thus, the corresponding parameters are transition \textit{rates} and we denote them as $\rho_{r,s}(t)$, with $r,s\in\mathcal{S}$ representing again the origin and target states, respectively. In principle, transition rates can depend on $t$, but do not necessarily have to. The number of people transitioning in each state at $t$ is multiplied by the corresponding transition rates to obtain the inflow and outflow to and from a state. The difference between the number of people entering and leaving a state corresponds to the derivative of the number of those in the respective state.
Back to our example, we define the vector $\bm{n}(t)=\left(n_1(t),\ldots,n_S(t)\right)'$, where $n_s(t)$ is the number of people in state $s$ at time $t$. The corresponding ODE system is given by the set of equations
\begin{equation}\label{ode_chronic}
\begin{split}
\frac{dn_1(t)}{dt}&=\chi[n_1(t)+n_2(t)+n_3(t)+n_4(t)]-\rho_{1,2}(t)n_1(t)-\rho_{1,5} n_1(t)\\
\frac{dn_2(t)}{dt}&=\rho_{1,2}(t)n_1(t)-\rho_{2,3} n_2(t)-\rho_{2,5} n_2(t)\\
\frac{dn_3(t)}{dt}&=\rho_{2,3} n_2(t)-\rho_{3,4} n_3(t)-\rho_{3,5} n_3(t)\\
\frac{dn_4(t)}{dt}&=\rho_{3,4} n_3(t)-\rho_{4,5} n_4(t)\\
\frac{dn_5(t)}{dt}&=\rho_{1,5} n_1(t)+\rho_{2,5} n_2(t)+\rho_{3,5} n_3(t)+\rho_{4,5} n_4(t).
\end{split}
\end{equation}
\noindent
The rate of change in the number of people in each state at each point in time $t$ is subject to population dynamics and exposure to sources of infection. The transition to the state of infection is determined by the dynamic force of infection of the pathogen, indicated by $\rho_{1,2}(t)$ in~(\ref{ode_chronic}). This is a function of the probability of pathogen transmission, partner acquisition rates and prevalence.
In a deterministic analysis of an ODE system, parameter uncertainty is not accounted for; as a consequence, the model outcome might be incorrect. Scenario analyses are often performed, for example by estimating the deterministic parameters through summary statistics at the extremes of the corresponding parameter distribution (e.g. lower or upper quantiles, minima or maxima). As mentioned earlier, this is not equivalent to the application of a full PSA.
Theoretically, it is possible to exclusively incorporate probabilistic parameters into an ODE-based model; for example, in a Bayesian context, uncertainty in the model parameters can be considered by means of probability distributions. The uncertainty is then propagated through the estimation procedure, which again generates a full distribution of outcomes. This type of model can be analysed using for instance Markov Chain Monte Carlo (MCMC) samplers such as \texttt{WinBUGS} \cite{WinBUGS}
or \texttt{Stan} \cite{stan}, a very promising tool, which in general performs extremely well with relatively complex systems. Both include ODE solvers and can be linked to the statistical programming language~\texttt{R}.
In realistic problems including a large number of states and complex structures, fully probabilistic ODE systems may be impractical since the model needs to be run for a large number of simulations to ensure convergence of each parameter and thus the ODEs have to be solved repeatedly for each parameter combination. The increase in the computational time is mainly induced by the length of the observation time horizon, the amount of probabilistic parameters, the complexity of contacts, and the number of differential equations. Consequently, complex ODE-based models which exclusively incorporate probabilistic model parameters are rare exceptions in the literature on infectious disease transmission modelling \cite{Bilcke}.
\subsection{Discrete-time Markov models\label{movementsMM}}
The main characteristic of MMs is the Markov assumption which implies that the transition to a future state is exclusively conditional on the current or previous state(s), but not on the full trajectory. However, the Markov assumption can be relaxed by accounting for covariates (e.g.\,age and sex) or for time-specific prevalence and population dynamics in the transition parameters.
As for ODE-based models, MMs can be implemented for continuous time. In this case, the two approaches differ in the way they describe the process of transitions. As suggested earlier, in the former, the rates of change are calculated dynamically through differentiation, while in the latter, the transitions are described by a static Markov process.
However, the vast majority of MMs in the health economic literature is based on a discrete-time approach \cite{Rosmalen}. In this case, members of the population move across the states according to a set of transition \textit{probabilities} only once per time interval (termed ``Markov cycle''). These probabilities can be arranged in a matrix $\bm{\Pi}=\left(\pi_{r,s}\right)$, whose elements represent the transition probabilities for movements from an original state $r$ to a target state $s$.
For the model structure of Figure \ref{fig:SIODE}, the transition probability matrix is defined as
\begin{equation*}\label{transprobmatrix}
\bm\Pi = \left(
\begin{array}{ccccc}
\pi_{1,1}& \pi_{1,2} & 0 & 0& \pi_{1,5}\\
0& \pi_{2,2}& \pi_{2,3} & 0& \pi_{2,5}\\
0& 0 & \pi_{3,3} & \pi_{3,4}& \pi_{3,5}\\
0& 0 & 0 & \pi_{4,4} & \pi_{4,5}\\
0& 0 & 0 & 0& 1\\
\end{array}
\right),
\end{equation*}
\noindent
implying that, for example, a susceptible either acquires the infection (with probability $\pi_{1,2}$), dies (with probability $\pi_{1,5}$), or remains susceptible, which occurs with probability $\pi_{1,1} = 1-\pi_{1,2}-\pi_{1,5}$.
If we define the vector $\bm{n}_t=\left(n_{1t},\ldots,n_{St}\right)'$, where $n_{st}$ is the number of people in state $s$ and at each time interval~$\mathcal{I}_t$, then transitions across the states from one time interval to the next are calculated as
\begin{equation}\label{allocation}
\bm{n}_{t+1}=\bm\Pi\bm{n}_t.
\end{equation}
MMs are relatively straightforward to implement and are commonly used to model the progression of non-communicable conditions such as cardiovascular disease and cancer. Therefore, they are established in the health economic literature and well-known to clinicians and decision makers. However, the process of pathogen transmission is not estimated correctly using standard MMs. A transition of susceptibles to the state of infection is commonly represented by a static transition parameter which does not consider changes in the population prevalence over time. These especially occur after the introduction of a preventive intervention such as vaccination into a fully susceptible population.
The predictions of static MMs on population prevalence are commonly incorrect (although notable exceptions include scenarios with very low vaccine coverage or pathogens that cannot be transmitted between humans, e.g.\ tetanus). In the worst case, the whole model outcome on infection prevalence and the related CEA can be incorrect, e.g.\ because of the impact of an unrecognised shift in the age of infection of childhood diseases. Some childhood diseases are relatively harmless in young children but prone to lead to serious health issues in adults. Incorrect predictions of static MMs on population health and induced costs, e.g.\ through hospitalisation and treatment, can have dire consequences \cite{Brisson}.
As for ODE-based models, a dynamic force of infection could be incorporated into the transition probabilities to account for the effects of herd immunity. However, to the best of our knowledge, dynamic Markov models are not commonly used in the health economics literature.
\subsection{Dynamic Bayesian Markov models\label{methodology}}
To overcome the limitations discussed above and with a view to extending the modelling framework for health economic evaluation of interventions in infectious disease, our main idea is to add a force of infection which depends on population dynamics and prevalence into a MM setting. As a consequence, the transition probabilities from the state \textit{Susceptible} to the state \textit{Infected} are directly defined by the dynamic force of infection. Specifically, we set up our model so that the force of infection is calculated separately within each cycle of the state allocation algorithm corresponding to (\ref{allocation}) as a function~of
\begin{itemize}
\item the probability of pathogen transmission per contact, which we indicate as $\beta$;
\item the rate of contacts between susceptible and infectious members of the population $\omega$; and
\item the time-dependent pathogen prevalence \[ \psi_t = \frac{I_t}{N_t}, \] where $I_t$ represents the number of people in the state of infection and, assuming that state $S$ indicates death, \[N_t=\sum_{s=1}^{S-1}n_{st}\] is the number of those alive at time interval $\mathcal{I}_t$.
\end{itemize}
The force of infection is recalculated at each Markov cycle as
\begin{equation}\label{forceinf2}
\lambda_t=\beta \omega \psi_t.
\end{equation}
Since $\omega$ is a rate, (\ref{forceinf2}) also results in a transition rate. Assuming that $\lambda_t$ remains constant within each time interval, the corresponding time-dependent transition probability for the discrete-time MM is estimated as
\begin{equation}
\pi_{\mbox{\tiny{1,2,t}}} = 1-\exp^{-\lambda_t}.\label{coop}
\end{equation}
The estimation is only approximate due to the competing risk of death and the assumption of uniformity within the intervals $\mathcal{I}_t$. This assumption is not likely to hold if the disease is characterised by very fast transmission, or when events associated with the infection are likely to occur in short periods of time. In these cases, it is perhaps advisable to reduce the length of the cycles $\kappa$ and the duration of the follow up.
The transition probability $\pi_{\mbox{\tiny{1,2,t}}}$ is multiplied by the proportion of the population in the state \textit{Susceptible} to provide an estimation of the contingent of movements to the state \textit{Infected}, effectively including dynamic, time-dependent changes in prevalence in the corresponding transitions.
The computational effort is reduced by fitting models that do not involve complex ODEs, while still allowing for mixing patterns within the population. Another potential advantage of the dynamic MM framework is that it is fairly simple to incorporate exclusively probabilistic model parameters, even if the model is complex with an extremely large number of parameters and states. In contrast, the related computational effort in a comparable ODE-based model would be extremely high.
A probabilistic approach is particularly relevant because, for obvious ethical and practical reasons, it is invariably difficult (if possible at all) to obtain and use experimental evidence to inform the pathogen transmission probability $\beta$ and the active contact rate $\omega$ --- arguably the crucial parameters. Often observational studies or expert opinions are the only available information with the consequence that large uncertainty remains over the most likely range, let alone the ``true'' value of the parameters. A Bayesian approach may provide great benefit in allowing this uncertainty to be fully propagated and perhaps in integrating different sources of evidence (e.g.\ using evidence synthesis \cite{Welton}); this indeed has been advocated for MMs in the health economics literature \cite{Welton,Cooperetal,Baio2}.
In a Bayesian dynamic MM setting, it is possible to assign prior distributions to the parameters $(\beta,\omega)$ to represent the state of science --- if data are available, these are updated into posterior distributions although it is possible to still propagate uncertainty in the priors even when no data on pathogen transmission or active contacts are observed. In addition, the quantity $\psi_t$ is estimated for each cycle as a function of transition probabilities, which can also be modelled using suitable distributions. This modelling process induces a probability distribution on $\psi_t$ and \textit{a fortiori} also on $\lambda_t$, which is defined as a function of the three random parameters $(\beta,\omega,\psi_t)$. Thus, the corresponding transition probabilities $\pi_{\mbox{\tiny{1,2,t}}}$ are modelled probabilistically, meaning that uncertainty in the population dynamics is propagated through the economic~model.
Another crucial aspect in infectious disease modelling (and more generally in statistical analysis) is that of calibration of the model output \cite{Gelman,Vanni}. The Bayesian framework enables the calibration of the numbers of people in the states directly in the state allocation algorithm, using available time series data for a specific time frame of follow-up. The corresponding details are explained in Section~\ref{accparun} and Appendix~\ref{cal}.
Finally and specifically for the purpose of economic evaluation, the dynamic BMM has the advantage that PSA can be performed ``for free'', once the model output is produced. In a Bayesian framework, the MCMC simulations for all the model parameters can be combined to obtain a full characterisation of the uncertainty in the decision-making process. This can be post-processed (e.g.\ using the \texttt{R} package \texttt{BCEA} \cite{BCEA}) to produce relevant summaries such as the cost-effectiveness plane, the cost-effectiveness acceptability curve and the analysis of the value of information (see Section~\ref{cea}).
\subsection{Case study\label{healthtrans}}
We consider again the fictional chronic STI described above and compare the dynamic Bayesian MM to both a deterministic and a Bayesian ODE system. We denote the three models as BMM, dODE and BODE, respectively. We evaluate whether our BMM produces results that are in line with the ``gold standard'' of the BODE. In the three models, we distinguish between sexes as well as high- and low-risk sexual behaviour. The duration of the follow up is set at 100 years, with a yearly Markov cycle length. We consider a population size of 1,000,000 and initially assume that 600 people are infected, whereas the remainder are susceptible. Males amount to 50\% and the high-risk group to 20\% of the population; the sex ratio in the two risk groups is constant. The proportion of infected people in both sexes and risk groups is identical. We account for sex-specific differences in sexual behaviour, assuming higher partner acquisition rates in males. The population size changes due to births and deaths. We conduct our analysis for two competing health-care interventions. We assume that in the \textit{status-quo}, screening takes place at intervals of five years at a pre-defined rate to enable an early detection of the STI. For simplicity, we assume that under the \textit{vaccination} scenario no screening takes place. We assume that the vaccine is only effective before initial STI infection; thus, susceptibles are vaccinated at a specified vaccine uptake rate at intervals of five years. Following STI diagnosis, treatment is provided in both~interventions.
In the dODE and BODE, the force of infection (transition rate from the state \textit{Susceptible} to the state \textit{Infected}) shown in (\ref{forceinf2}) has to be adjusted to account for the covariates sex and behaviour. In the BMM, the sex- and behavioural-specific transition probability is estimated by transforming this adjusted transition rate according to (\ref{coop}). Further details are given in Appendix~\ref{appforce}.
\subsubsection{Model parameters and related distributions\label{accparun}}
In addition to the probability of STI transmission $\beta$ and the partner acquisition rates $\omega_{vb}$, the model contains a variety of parameters such as those determining the screening and vaccine coverage, the unit costs of STI diagnostics and treatment and the health utilities, which are relevant in context of the cost-effectiveness analysis. We assign informative priors to transition parameters and costs (defined in monetary units of \textsterling) and utilities. We specify the distributional assumptions so that the outputs of the health economic evaluation are within reasonable~ranges. We assign informative or minimally-informative priors to the remaining parameters and update these through simulated individual-level and aggregate data into the corresponding posteriors. Using simulated data is reasonable since the case study is fictional. For example, we pretend that data on partner acquisition rates $\omega_{vb}$ are available from a large data registry. To infer $\omega_{vb}$, we update informative Gamma priors into the corresponding posteriors through Poisson-Gamma models. Beta-Binomial models are used to infer probabilities (e.g. the STI transmission probability \,$\beta$).
Table \ref{tab:param} shows an overview of the model parameters $\bm{\theta}=\{\omega_{vb},\chi,\beta,\pi_{r,s},\tau,\xi,\gamma,\sigma,\bm{c},u_s\}$. The means and 95\% credible intervals are rounded to two decimal places. However, the 95\% CI of the parameter $\chi$ is in fact defined as [0.009420;0.010596]. Since the BMM is based on a discrete-time approach, the corresponding transition probabilities are modelled using Beta distributions. In contrast, the transition rates of the continuous-time BODE are modelled using Gamma distributions. The transition probabilities for movements from the states \textit{Susceptible}, \textit{Infected} and \textit{Asymptomatic} to \textit{Dead} are assumed as identical; thus, only $\pi_{\mbox{\tiny{1,5}}}$ is shown.
The dODE is calibrated through a frequentist probabilistic calibration approach \cite{Vanni,vandeVelde3}, whereas the BODE and BMM are calibrated through Bayesian calibration approaches \cite{deAngelis,Welton2}. The first involves the calculation of goodness-of-fit statistics. The advantage of the latter is that the model parameters can be inferred by fitting the models to data directly (in one step). Further details are given in Appendix~\ref{cal}.
The dODE is estimated using a combination of the \texttt{R} packages \texttt{EpiModel} \cite{EpiModel} and \texttt{deSolve} \cite{deSolve}. As for the BMM and BODE, we estimate the model parameters using a MCMC procedure; we run two chains with a total of 1,000 simulations after convergence. We fit the BODE in \texttt{WinBUGS} through the ODE solver interface \texttt{WBDiff} \cite{WBDiff}. The BMM is estimated using \texttt{WinBUGS} and \texttt{JAGS} \cite{jags}, an alternative, established software to perform Gibbs sampling, in order to compare computational efficiency. We also consider the recently developed \texttt{Stan} \cite{stan}, yet another software for Bayesian analysis, based on a different MCMC algorithm; however, until the very latest releases, the built-in ODE solver experienced problems with stiff regions. The newest release (2.13) seems to have overcome this issue and thus \texttt{Stan} looks very promising for future developments.
The models are run on a Dell Latitude E6320 (Intel Core i5-2520M, 2x4GB DDR3 RAM, 500GB SATA HDD (2.5", 7200rpm)). The computation times are 4,480.19 seconds (around 1 hour 15 minutes) and 6,587.67~seconds (around 1 hour 50 minutes) for the dODE and BODE, respectively. Interestingly, the BMM runs much faster in \texttt{JAGS} (149.81~seconds) than in \texttt{WinBUGS} (449.42~seconds). This difference is perhaps due to the way in which the two programmes handle logical nodes, which are instrumental to defining the state allocation algorithm (see (\ref{allocation})). All run times include model calibration which considerably increases the computational effort in the ODE systems, but not for the BMM. Convergence is sufficiently achieved with a Potential Scale Reduction $\hat{R}<1.1$ in all model parameters \cite{Gelman}, and there are no issues with autocorrelation. The relevant model codes are presented in Appendix~\ref{Rcode}.
\begin{table}[H]
\fontsize{6.5}{8.5}\selectfont
\caption{Overview of the informative priors and the models used for updating informative and minimally-informative priors. The values are fictional and were chosen so as to produce most realistic prevalence outcome and cost-effectiveness results. \label{tab:param}}
\centering
\setlength{\tabcolsep}{1.5mm}
\begin{tabular}{lp{3cm}llrr}
\toprule
\textbf{Parameter}&\textbf{Description}&\textbf{Distribution/model BMM}&\textbf{Distribution/model BODE}&\textbf{Mean}&\textbf{95\% estimate}\\
\midrule
$\omega_{M\!H}$&Partner acquisition rate (high-risk males)& Poisson-Gamma model &equivalent to BMM &9.10&[8.77;9.29] \\
$\omega_{M\!L}$&Partner acquisition rate (low-risk males)& Poisson-Gamma model&equivalent to BMM &2.98& [2.82;3.12] \\
$\omega_{F\!H}$&Partner acquisition rate (high-risk females)& Poisson-Gamma model&equivalent to BMM &9.00&[8.71;9.26] \\
$\omega_{F\!L}$&Partner acquisition rate (low-risk females)& Poisson-Gamma model&equivalent to BMM &1.96& [1.86;2.09] \\
$\chi$&Proliferation parameter & Beta(1099.99, 108899)& Gamma(1111.1,111111.1)&0.01& [0.01;0.01]\\
$\beta$&STI transmission probability per partnership& Beta-Binomial model&equivalent to BMM&0.16& [0.15;0.16]\\
$\pi_{\mbox{\tiny{2,3}}}$&Transition parameter from state $2$ to state $3$& Beta(5119.2, 1279.8)& Gamma(25600,32000)&0.80& [0.79;0.81]\\
$\pi_{\mbox{\tiny{3,4}}}$&Transition parameter from state $3$ to state $4$& Beta(1842.66, 18631.34)& Gamma(2025,22500)&0.09& [0.09;0.09]\\
$\pi_{\mbox{\tiny{4,5}}}$&Transition parameter from state $4$ to state $5$& Beta(1535.96, 36863.04)& Gamma(1600,40000)&0.04& [0.04;0.04]\\
$\pi_{\mbox{\tiny{1,5}}}$&Transition parameter from state $1$ to state $5$& Beta(156.171, 312186.6)& Gamma(156.25,312500)&\textless0.01& [\textless0.01;\textless0.01]\\
$\eta$&Probability of STI diagnosis& Beta-Binomial model&equivalent to BMM&0.90& [0.88;0.92]\\
$\sigma$&Screening probability & Beta-Binomial model&equivalent to BMM&0.90& [0.87;0.92]\\
$\alpha$&Vaccine coverage parameter& Beta-Binomial model&equivalent to BMM&0.90& [0.87;0.92]\\
$\gamma$&Vaccine efficacy parameter& Beta-Binomial model&equivalent to BMM&0.90& [0.87;0.92]\\
$c_{screen}$&Unit cost of screening in~\textsterling&Lognormal(2.996, 0.693)& equivalent to BMM& 25.39& [5.19;77.53]\\
$c_{vac}$&Unit cost of vaccination in~\textsterling& Lognormal(5.011, 0.01)& equivalent to BMM& 150.02& [147.14;152.98]\\
$c_{test}$&Unit cost of STI test in~\textsterling& Lognormal(2.996, 0.03)& equivalent to BMM& 20.01& [18.83;21.19]\\
$c_{blood}$&Unit cost of blood test in \textsterling& Lognormal(3.401, 0.03)& equivalent to BMM& 30& [28.26;31.79]\\
$c_{treat}$&Unit cost of treatment in~\textsterling& Lognormal(8.517, 0.015)& equivalent to BMM& 4999.78& [4853.56;5149.24]\\
$c_{dis}$&Unit cost of disease treatment in~\textsterling& Lognormal(9.210, 0.01)& equivalent to BMM& 9999.95& [9802.97;10198.10]\\
$c_{gp}$&Unit cost of visit to general practitioner in~\textsterling& Lognormal(3.912, 0.02)& equivalent to BMM& 50.01& [48.08;52.01]\\
$u_2$&Health utility of infected (min=0, max=1)& Beta(1469.3, 629.7)& equivalent to BMM& 0.70& [0.68;0.72]\\
$u_3$&Health utility of asymptomatic (min=0, max=1)& Beta(1439.4, 959.6)& equivalent to BMM& 0.60& [0.58;0.62]\\
$u_4$&Health utility of morbid (min=0, max=1)& Beta(629.7, 1469.3)& equivalent to BMM& 0.30& [0.28;0.32]\\
\bottomrule
\end{tabular}
\end{table}
\section{Results}
\subsection{Natural history of disease\label{nathiscal}}
Figure \ref{fig:calstates} shows the outcome on the natural history of the fictional chronic STI following calibration. Only the results on high-risk females are displayed; those on high-risk males are comparable. The BMM produces results which are comparable to the ``gold standard'' of the BODE. The model outcome on the states \textit{Susceptible} and \textit{Morbid} of the BMM and BODE is basically identical, whereas the outcome of the BODE shows slightly higher estimates on the number of infected and asymptomatic high-risk females. The outcome on the number of susceptible and morbid high-risk females is higher in the dODE; in contrast, the outcome on those in the states \textit{Infected} and \textit{Asymptomatic} is lower when compared to the two Bayesian models. The ranges of the 95\% credible intervals of the BODE and BMM are similar, showing wider ranges in the BMM. The 97.5\% quantiles of the scenario analysis of the dODE are lower than the upper bounds of the 95\% CIs in the states \textit{Infected} and \textit{Asymptomatic} and higher in the states \textit{Susceptible} and \textit{Morbid}, whereas the 2.5\% quantiles are considerably lower than the lower bounds of the CIs (apart from the state \textit{Susceptible}).
\begin{figure}[H]
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=0.9\linewidth]{Figure2a.png}
\end{subfigure}
\hspace{0.1cm}
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=0.9\linewidth]{Figure2b.png}
\end{subfigure}
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=0.9\linewidth]{Figure2c.png}
\end{subfigure}
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=0.9\linewidth]{Figure2d.png}
\end{subfigure}
\caption[Model outcome on the number of people in the states following a systematic probabilistic calibration approach]{Calibration results on the number of high-risk females in the states \textit{Susceptible}, \textit{Infected}, \textit{Asymptomatic} and \textit{Morbid}. The results of the Bayesian models are similar, with a slightly higher number of high-risk females in the states \textit{Infected} and \textit{Asymptomatic} estimated by the Bayesian ODE-based model. In contrast, the deterministic ODE-based model results in a lower estimate on the number of high-risk females in the states \textit{Infected} and \textit{Asymptomatic}; however, the outcome on the state \textit{Morbid} is~reversed.\label{fig:calstates}}
\end{figure}
\subsection{Cost-effectiveness analysis\label{cea}}
We denote the unit costs and utilities as $c_{sti}$ and $u_s$, with indices $s$, $t$ and $i$ representing states \mbox{$s\in\{1,...,S\}$}, observation time points $t$ and interventions $i=1$ (status quo) and $i=2$ (vaccination). We assume decreasing utility values for more severe states. Costs are induced by screening, vaccination, a visit at the general practitioner and diagnostic tests. Following a positive STI diagnosis, further diagnostic tests and treatment are necessary. For all these quantities, the distributional assumptions are presented in Table \ref{tab:param}.
The overall costs per intervention are calculated as
\[C_i=\displaystyle\sum_{t=1}^T\sum_{s=1}^S\frac{c_{si}n_{sti}}{(1+\delta)^{t-1}},\]
where $n_{sti}$ are the number of people in state $s$ at time $t$ when intervention $i$ is applied and $\delta$ is the yearly discount rate. In both the continuous- and discrete-time approaches, the model output on the natural history of disease infection and progression is evaluated at pre-specified time points $t \in \{1,...,T\}$, where $T$ represents the end of follow-up. We discount both costs and benefits at a fixed yearly rate $\delta=0.03$, following ISPOR recommendations \cite{ISPOR}. Similarly, the overall utilities are computed as
\[U_i=\displaystyle\sum_{t=1}^T\sum_{s=1}^S\frac{u_{s}n_{sti}}{(1+\delta)^{t-1}}.\]
Overall costs and utilities define the monetary net benefit $\mbox{NB}_i(\bm{\theta})=kU_{i}-C_{i}$. The economic evaluation is performed by calculating suitable summaries such as the increment in mean cost $\Delta_c=C_{2}-C_{1}$ and the increment in mean effectiveness $\Delta_e=U_{2}-U_{1}$ between vaccination and the status-quo, or the incremental cost-effective\-ness ratio
\[\mbox{ICER}=\frac{\mbox{E}[\Delta_c]}{\mbox{E}[\Delta_e]}.\]
In the BMM and BODE, these quantities are estimated directly as function of the parameters, while in the dODE, we conduct a scenario analysis including the 2.5\% and 97.5\% quantiles of the ICER to evaluate the range of ``plausible'' results. A cut-off point of a \textit{willingness-to-pay} $k$ of approximately \pounds 20,000 -- \pounds 30,000 per QALY gained, adopted by NICE \cite{Rawlins}, is used as the benchmark of value for money.
As for PSA, it is usually based on: (\textit{i}) the analysis of the cost-effectiveness plane, depicting the joint probability distribution of $(\Delta_e,\Delta_c)$; (\textit{ii}) the cost-effectiveness acceptability curve \mbox{$\mbox{CEAC}=\Pr(k\Delta_e-\Delta_c>0)$}, which shows the probability that the reference intervention is cost-effective as a function of the willingness to pay $k$; and (\textit{iii}) the expected value of ``perfect'' information
\[ \mbox{EVPI} = \mbox{E}_{\bm\theta}\left[\max_i\mbox{NB}_i\left(\bm\theta\right)\right] - \max_i\mbox{E}_{\bm\theta} \left[\mbox{NB}_i\left(\bm\theta\right)\right], \]
which quantifies the maximum amount of money that the decision-maker should be willing to invest (\textit{e.g.} in a new study) in order to resolve parameter uncertainty and thus make a ``better'' decision. The probabilistic models can perform these analyses in a straightforward way, since these quantities are all functions of the model parameters and thus a full posterior distribution can be directly obtained.
The ICER of the dODE results in \textsterling \,7,203.416, ranging between \textsterling \,2,592.44 and \textsterling \,469,906 in the scenario analysis at the 2.5\% and 97.5\% quantiles. The ICERs of the probabilistic models are comparable to the dODE, resulting in \textsterling \,6,054.82 and \textsterling \,6,287.62 in the BODE and \mbox{BMM,~respectively.}
\mbox{Figure \ref{fig:ceaprobcal}} displays the cost-effectiveness plane. Each point of the MCMC simulation lies within the grey sustainability area, indicating that STI vaccination is cost-effective at a threshold of \textsterling \,25,000 when compared to STI screening. STI vaccination is deemed to be both more expensive and more effective than STI screening since all points are located in the upper right quadrant of the graph. The corresponding ICERs of the BMM and BODE are displayed as red and blue dots,~respectively.
\begin{figure}[H]
\centering
\includegraphics[width=0.95\textwidth]{Figure3.png}
\caption{The cost-effectiveness plane of the Bayesian ODE system and the Bayesian Markov model indicates that vaccination is both more expensive and more effective than the status quo. All points lie within the sustainability area~of cost-effectiveness. The ICERs of \textsterling \,6,054.82 (blue dot, BODE) and \textsterling \,6,287.62 (red dot, BMM) indicate cost-effectiveness of STI vaccination in comparison to STI screening at a threshold of \textsterling \,25,000. \label{fig:ceaprobcal}}
\end{figure}
Figure \ref{fig:psacali} shows the results of the CEACs and the population EVPIs of the two Bayesian models. The amount of uncertainty in the BMM is slightly larger than in the BODE; however, 80\% cost-effectiveness is clearly reached at the break-even points of the ICERs of both models. The population EVPI of the BMM at around \textsterling \,500,000,000 is higher than in the BODE, where it reaches a value of around \textsterling \,400,000,000. The higher EVPI value of the BMM is a consequence of the slightly larger amount of uncertainty. Thus, the value of additional research is higher in the~BMM.
\begin{figure}[H]
\centering
\begin{subfigure}{0.48\textwidth}
\centering
\includegraphics[width=\textwidth]{Figure4a.png}
\end{subfigure}
\begin{subfigure}{0.48\textwidth}
\centering
\includegraphics[width=\textwidth]{Figure4b.png}
\end{subfigure}
\caption{The cost-effectiveness acceptability curve and expected value of information of the Bayesian ODE system and the Bayesian Markov model are shown. The results of the BMM are displayed in grey, whereas those of the BODE are shown in black. The amount of parameter uncertainty is higher in the BMM. The CEACs in the left panel reach values of 80\% at a willingness-to-pay corresponding to the ICERs. The EVPIs for the whole population at around \textsterling \,500,000,000 and \textsterling \,400,000,000 in the BMM and BODE, respectively, are shown in the right~panel.\label{fig:psacali}}
\end{figure}
\section{Discussion}
In this paper we have presented a comparison of modelling methods for the economic evaluation of interventions in infectious disease. We acknowledge that ODE-based models have several advantages and consider the Bayesian ODE structure as ideal to combine transmission modelling with economic evaluation. However, the large computational burden associated with such strategies effectively acts as a barrier to the application of complex economic modelling in this area and possibly explains why the extensive application of PSA is limited in comparison to many other disease areas, in health~economics.
Our proposal of a dynamic Bayesian Markov model can be seen as an effective compromise between the ideal fully probabilistic ODE-based models and simpler structures that fail to account for time-dependent changes in prevalence and the effects of herd immunity. While providing a sparser temporal resolution in the way in which transmission is modelled, our methodology has the advantage of allowing a fully probabilistic analysis. This in turn means that standard economic analysis, including PSA, can be performed in a straightforward way. In addition, Markov models are a well established tool in health economics, which may facilitate the translation of the modellers' work to the regulators and assessors.
In the fictional example presented in this paper, our BMM performs just as well as the BODE, with seizable computational savings. Model predictions should always be calibrated, given time series or prevalence data are available. Systematic calibration approaches usually induce a considerably high computational effort. We could show that including a direct calibration approach in the Bayesian models, the BMM runs 44 times faster than the BODE.
From the technical point of view, constructing a BMM is relatively simple and does not require the use of specialised software --- in fact our analysis has been performed using \texttt{R} and \texttt{JAGS}, which are often used by statisticians and health economic modellers and thus by reviewers and advisers for health technology assessment agencies. This may again facilitate the communication of complex modelling assumptions and thus the economic assessment of complex interventions such as those based on vaccination programmes.
\section*{Acknowledgements}
Dr Gianluca Baio is partially funded by a research grant sponsored by Mapi.
\bibliographystyle{unsrt}
| {'timestamp': '2017-02-06T02:03:12', 'yymm': '1512', 'arxiv_id': '1512.06881', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06881'} | arxiv |
\section{Introduction}
\subsection{Background and Motivation}
The issue of identifiers is crucial in distributed computing~\cite{A80,NS93}. Indeed, the correct operation of deterministic protocols often relies on the assumption that each processor $u$ comes with with a unique \emph{identity}, $\mbox{\rm Id}(u)$~\cite{GHS}. Informally, in network computing, such an identity assignment is crucial for tackling two of the fundamental difficulties that are inherent to distributed computing, namely: (1) {\em symmetry breaking}, and (2) {\em topological information gathering}.
The use of identities for tackling the above two difficulties is illustrated well in the context of \emph{local} algorithms \cite{L92,L86}. Indeed, in the $\cal{LOCAL}$ model \cite{PelB00}, an algorithm that runs in $t$ communication rounds, assuming an identity assignment, can be viewed as composed of two parts: first, collecting at each node $u$, the ball $B(u,t)$ of radius $t$ around it (together with the inputs of nodes), and second, deciding the output at $u$ based solely on the information in $B(u,t)$. To achieve these two tasks, one should first obtain the ball $B(u,t)$, which may not be possible if the underlying graph is anonymous (i.e., without identities). Moreover, even if obtaining the ball is possible, e.g., if the structure of the graph allows it, the absence of unique identities given to the nodes may prevent the algorithm from breaking symmetry. For example, in the absence of unique identities, it is impossible to design a distributed deterministic coloring algorithm, even for the symmetric connected graph composed of two nodes only. In fact, to the best of our knowledge, all algorithms in the $\cal{LOCAL}$ model are designed assuming the presence of pairwise distinct identities or some other type of node-labeling or edge-labeling, including, e.g., sense of direction~\cite{BM09,HKP01,K09,LPR09,NS93,PS96}.
The seminal paper of Naor and Stockmeyer \cite{NS93} provides an important insight regarding the role of identities in local computation. Informally, they show that, even though identities are necessary, in many cases the actual values of identities is not crucial, and only their relative order matters. Specifically, \cite{NS93} shows that for a particular class of problems, called LCL (for \emph{Locally Checkable Languages}), if there exists a local algorithm that, for any identity assignment, constructs an instance of a problem in LCL in constant number of rounds, then there exists an \emph{order invariant}\footnote{Essentially, an order invariant algorithm uses the actual values of the identities only to impose an ordering between the nodes, that is, it behaves the same for any two identity assignments that preserve the total order between the nodes. For more details refer to \cite{NS93}.} algorithm for that problem that runs in the same number of rounds. LCL restricts its concern to graphs with constant maximum degree, and to problems with a constant number of inputs. The assumption on the size of the inputs of problems in LCL was shown necessary in \cite{HHRS12}, by exhibiting a natural problem that is locally checkable, has unbounded input size, can be solved in 1 round with identities, but cannot be solved in constant time by any order invariant algorithm. The role of identities can also be gauged by comparing their impact to that of ``orientation mechanisms''. For instance, G\"o\"os et al.~\cite{GHS12} have shown that for a large class of optimization problems, called PO-checkable problems, local algorithms do not benefit from any kind of identifiers: if a PO-checkable optimization problem can be approximated with a local algorithm, the same approximation factor can be achieved in anonymous networks if the network is provided with a port-numbering and an orientation.
The discussion above involved distributed
\emph{construction} tasks, including, e.g., graph
coloring~\cite{BM09,K09,L92,NS93,PS96}, maximal independent
set~\cite{L92,PS96}, and maximal matching~\cite{HKP01,LPR09}.
When it
comes to distributed \emph{decision} tasks~\cite{FKP11,FKPP12},
symmetry breaking issues do not however seem to play a
role. Informally, a decision task requires the nodes to ``collectively
decide'' whether the given instance (i.e., a graph with inputs to the
nodes) satisfies some specific properties. For instance, deciding
coloring requires, given a colored graph, to check whether this graph
is properly colored. The meaning of ``collectively decide'' is as
follows. On a legal instance, all nodes should output ``yes'', and on
an illegal one, at least one node should output ``no''. Note that it
is not really important whether this node is unique or not; hence, this
specification does not inherently require any symmetry
breaking. Therefore, assuming that each node $u$ can obtain the ball
$B(u,t)$, it makes sense that the assumption of having an identity
assignment may not be crucial for achieving correct decision.
\subsection{Model and Objectives}
We tackle the question of whether identities play a role in decision problems in the framework of the aforementioned ${\cal LOCAL}$ model~\cite{PelB00}, which is a standard distributed computing model capturing the essence of locality. Recall that, in this model, processors are nodes of a connected network $G=(V(G),E(G))$, have pairwise distinct identities, and have inputs. More formally, a {\em configuration} is a triplet $(G,\mbox{\rm\bf x},\mbox{\rm Id})$ where $G$ is a connected graph, every node $v\in V(G)$ is assigned as its {\em local input} a binary string $\mbox{\rm\bf x}(v)\in \{0,1\}^*$, and $\mbox{\rm Id}(v)$ denotes the identity of node $v$. (In some problems, the local input of every node is empty, i.e., $\mbox{\rm\bf x}(v)=\epsilon$ for every $v\in V(G)$, where $\epsilon$ denotes the empty binary string). Processors are woken up simultaneously, and computation proceeds over the input configuration $(G,\mbox{\rm\bf x},\mbox{\rm Id})$ in fault-free synchronous \emph{rounds} during which every processor exchanges messages of unlimited size with its neighbors in the underlying network $G$, and performs arbitrary individual computations on its data. In many cases, the running time of an algorithm is measured with respect to the size $n$ of $G$: the running time of an algorithm is defined as the maximum number of rounds it takes to terminate at all nodes, over all possible $n$-node networks. Similarly to \cite{HHRS12,NS93}, we consider algorithms whose running time is independent of the size of the network, that is they run in constant time.
Let $B(u,t)$ be the ball centered at $u$, of radius $t$, excluding the edges between two nodes at distance exactly $t$ from $u$. As mentioned before, without loss of generality, any algorithm running in time~$t=O(1)$ in the ${\cal LOCAL}$ model consists of:
\begin{enumerate}
\item Collecting (in $t$ rounds) at every node $u$ the structure of the ball $B(u,t)$ together with all the inputs $\mbox{\rm\bf x}(v)$ and identities $\mbox{\rm Id}(v)$ of these nodes, and,
\item Performing some individual computation at every node.
\end{enumerate}
We define the \emph{anonymous} ${\cal LOCAL}$ model similarly to the ${\cal LOCAL}$ model, except that nodes have no identities. More precisely, an input configuration in the anonymous ${\cal LOCAL}$ model is just a pair $(G,\mbox{\rm\bf x})$. An algorithm running in time~$t=O(1)$ in the anonymous ${\cal LOCAL}$ model consists of:
\begin{enumerate}
\item Getting at every node $u$ a snapshot of the structure of the ball $B(u,t)$ together with all the inputs of the nodes in this ball, and,
\item Performing some individual computation at every node.
\end{enumerate}
Note that the \emph{anonymous} ${\cal LOCAL}$ model does not explicitly involve communications between nodes. Instead, it implicitly assumes that the underlying network supports the snapshot operation.
Clearly, this model is not stronger than the ${\cal LOCAL}$ model, and possibly even strictly weaker, since a node $u$ can no longer base its individual computation on the identities of the nodes in the ball $B(u,t)$. One can think of various other ``anonymous'' models, i.e., which do not involve node identities. In particular, there is a large literature on distributed computing in networks without node identities, where symmetry breaking is enabled thanks to locally disjoint port numbers (see, e.g., \cite{FP11}). We consider the anonymous ${\cal LOCAL}$ model to isolate the role of node identities from other symmetry breaking mechanisms.\footnote{In some sense, the anonymous ${\cal LOCAL}$ model is the strongest model among all models without node identities. Indeed, there are network problems that can be solved in the anonymous ${\cal LOCAL}$ model which cannot be solved in the aforementioned model that is based on locally disjoint port numbers. A simple example is to locally detect the absence of a 3-node cycle.} Our aim is to compare the power of the anonymous ${\cal LOCAL}$ model with the standard ${\cal LOCAL}$ model in order to capture the impact of identities on local distributed decision.
Recall from~\cite{FKP11} that a {\em distributed language} is a decidable collection ${\cal L}$ of configurations. (Since an undecidable collection of configurations remains undecidable in the distributed setting too, we consider only decidable collections of configurations). A typical example of a language is
\[
\mbox{\tt Coloring}= \{(G,\mbox{\rm\bf x}) \;|\; \forall v\in V(G), \forall w\in N(v), \mbox{\rm\bf x}(v) \neq \mbox{\rm\bf x}(w)\}\ ,
\]
where $N(v)$ denotes the (open) neighborhood of $v$, that is, all nodes at distance exactly~1 from $v$. Still following the terminology from~\cite{FKP11}, we say that a distributed algorithm $A$ \emph{decides} a distributed language ${\cal L}$ if and only if for every configuration $(G,\mbox{\rm\bf x})$, every node of $G$ eventually terminates and outputs ``yes'' or ``no'', satisfying the following decision rules:
\begin{itemize}
\item
if $(G,\mbox{\rm\bf x})\in {\cal L}$, then each node outputs ``yes'';
\item
if $(G,\mbox{\rm\bf x})\notin {\cal L}$, then at least one node outputs ``no''.
\end{itemize}
In the (non-anonymous) ${\cal LOCAL}$ model, these two rules must be satisfied for every identity assignment. That is, all processes must output ``yes'' on a legal instance, independent of their identities. And, on an illegal instance, at least one node must output ``no'', for every identity assignment. Note that this node may potentially differ according to the identity assignment. Some languages can be decided in constant time (e.g., $\mbox{\tt Coloring}$), while others can easily be shown not to be decidable in constant time (e.g., ``is the network planar?''). In contrast to the above examples, there are some languages whose status is unclear. To elaborate on this, consider the particular case where it is required to decide whether the network belongs to some specified family ${\cal F}$ of graphs. If this question can be decided in a constant number of communication rounds, then this means, informally, that the family ${\cal F}$ can somehow be characterized by relatively simple conditions. For example, a family ${\cal F}$ of graphs that can be characterized as consisting of all graphs having no subgraph from $\cal C$, where $\cal C$ is some specified finite set of graphs, is obviously decidable in constant time. However, the question of whether a family of graphs can be characterized as above is often non-trivial. For example, characterizing cographs as precisely the graphs with no induced $P_4$, attributed to Seinsche~\cite{Seinsche74}, is not easy, and requires nontrivial usage of modular decomposition.
We are now ready to define one of our main subjects of interest, the classes $\mbox{\rm LD}$ and $\mbox{\rm LD}^*$. Specifically, $\mbox{\rm LD}$ (for \emph{local decision}) is the class of all distributed languages that can be decided by a distributed algorithm that runs in a constant number of rounds in the ${\cal LOCAL}$ model~\cite{FKP11}. Similarly, $\mbox{\rm LD}^*$, the anonymous version of $\mbox{\rm LD}$, is the class of all distributed languages that can be decided by a distributed algorithm that runs in a constant number of rounds in the anonymous ${\cal LOCAL}$ model. By definition, $\mbox{\rm LD}^*\subseteq \mbox{\rm LD}$. We conjecture that $$\mbox{\rm LD}^*=\mbox{\rm LD}.$$ In this paper, we provide several evidences supporting this conjecture. In addition, we investigate the \emph{non-deterministic} version of these classes, and prove that they coincide. More specifically, a distributed {\em verification} algorithm is a distributed algorithm $A$ that gets as input, in addition to a configuration $(G,\mbox{\rm\bf x})$, a global {\em certificate vector} $\mbox{\rm\bf y}$, i.e., every node $v$ of a graph $G$ gets as input two binary strings, an input $\mbox{\rm\bf x}(v)\in\{0,1\}^*$ and a certificate $\mbox{\rm\bf y}(v)\in\{0,1\}^*$. A verification algorithm $A$ verifies ${\cal L}$ if and only if for every input configuration $(G,\mbox{\rm\bf x})$, the following hold:
\begin{itemize}
\item if $(G,\mbox{\rm\bf x})\in {\cal L}$, then there exists a certificate $\mbox{\rm\bf y}$ such that every node outputs ``yes'';
\item if $(G,\mbox{\rm\bf x})\notin {\cal L}$, then for every certificate $\mbox{\rm\bf y}$, at least one node outputs ``no''.
\end{itemize}
Again, in the (non-anonymous) ${\cal LOCAL}$ model, these two rules must be satisfied for every identity assignment, but the certificates must be the same regardless of the identities.
We now recall the class $\mbox{\rm NLD}$, for \emph{non-deterministic local decision}, as defined in \cite{FKP11}: it is the class of all distributed languages that can be verified in a constant number of rounds in the ${\cal LOCAL}$ model. Similarly, we define $\mbox{\rm NLD}^*$, the anonymous version of $\mbox{\rm NLD}$, as the class of all distributed languages that can be verified in a constant number of rounds in the anonymous ${\cal LOCAL}$ model. By definition, $\mbox{\rm NLD}^*\subseteq \mbox{\rm NLD}$.
\subsection{Our Results}
In this paper, we give several evidences supporting the conjecture $\mbox{\rm LD}^*=\mbox{\rm LD}$. In particular, we show that it holds for languages defined on paths, with a finite set of input values. More generally, we show that the conjecture holds for \emph{hereditary} languages, that is, languages closed under node deletion. Regarding arbitrary languages, and arbitrary graphs, we prove that the conjecture holds assuming that every node knows an upper bound on the total number of nodes in the input graph. (This upper bound can be arbitrary, and may not be the same for all nodes).
Moreover, we prove that equality between non-anonymous decision and anonymous decision holds in the context of \emph{non-deterministic} local decision, where nodes are given certificates (independent of the identities, if they exist), and the decision consists in verifying these certificates. More precisely, we prove that $\mbox{\rm NLD}^*=\mbox{\rm NLD}$. This latter result is obtained by characterizing both $\mbox{\rm NLD}$ and $\mbox{\rm NLD}^*$.
\subsection{Related Work}
The question of how to locally decide (or verify) languages has
received quite a lot of attention recently.
Inspired by classical computation complexity theory,
it was suggested in \cite{FKP11} that the study of decision problems may lead to new
structural insights also in the more complex distributed computing setting.
Indeed, following that paper, which focused on the $\cal{LOCAL}$ model, efforts were made to form a fundamental
computational complexity theory for distributed decision problems in
various other aspects of distributed computing
\cite{FKP11,FP12,FRT11,FRT12}.
The classes LD, NLD and BPLD defined in \cite{FKP11} are
the distributed analogues of the classes P, NP and BPP, respectively.
The paper provides structural results,
developing a notion of local reduction and establishing completeness results.
One of the main results is the existence of a sharp threshold for randomization,
above which randomization does not help (at least for hereditary languages).
More precisely, the BPLD classes were classified into two:
below and above the randomization threshold.
In \cite{FKPP12}, the authors show that the hereditary assumption can be lifted if we restrict our attention
to languages on path topologies.
These two results from \cite{FKP11,FKPP12} are used in the current paper in a rather surprising manner.
The authors in \cite{FKPP12} then
``zoom''
into the spectrum of classes below the randomization threshold, and
defines a hierarchy of an infinite set of BPLD classes, each of which
is separated from the class above it in the hierarchy.
The precise knowledge of the number of nodes $n$ was shown in \cite{FKP11} to be of large impact on non-deterministic decision. Indeed, with such a knowledge
every language can be decided non-deterministically in the model of NLD. We note, however, that the knowledge of an arbitrary upper bound on $n$ (as assumed here in one of our results) seems to be a much weaker assumption, and, in particular, will not suffice for non-deterministically deciding all languages. In the context of construction problems, it was shown in \cite{KSV11} that in many case, the knowledge of $n$ (or an upper bound on $n$) is not essential.
The original theoretical basis for non-determinism in local
computation was laid by the theory of \emph{proof-labeling schemes} (PLS)~\cite{GS11,KK07,KKM11,KKP10}
originally defined in \cite{KKP10}. As mentioned,
this notion resembles the notion of NLD, but differs in the role identities play. Specifically, in PLS the designer of the algorithm may base the certificates'
(called labels in the terminology of PLS) construction on the given identity assignment. In contrast, in the model of NLD, the certificates must be the same regardless of the identities of nodes.
Indeed, this difference is significant: while every language can be verified by a proof labeling scheme, not every language belongs to NLD~\cite{FKP11}. These notions also bear some similarities to the notions of \emph{local computation with advice} \cite{DP12,FGIP07,FIP10,FKL07},
{\em local detection}~\cite{AKY97},
{\em local checking}~\cite{APV}, or {\em silent stabilization}~\cite{silent}.
In addition, as shown later on, the notion of NLD is related also to the theory of
{\em lifts} or {\em covers}~\cite{A80,Linial01}.
Finally, the classification of decision problems in distributed
computing has been studied in several other models. For example,
\cite{DHKKNPPW} and \cite{KKP11} study specific decision problems in
the $\cal{CONGEST}$ model. In \cite{KKM11}, the authors study MST verification in the PLS sense but under the $\cal{CONGEST}$ model of communication.
In addition, decision problems have been studied in the asynchrony discipline
too, specifically in the framework of {\em wait-free computation}
\cite{FRT11,FRT12} and {\em mobile agents computing} \cite{FP12}.
In the wait-free model, the main issues are not spatial constraints but timing
constraints (asynchronism and faults). The main focus of \cite{FRT12} is
deterministic protocols aiming at studying the power of the ``decoder'',
i.e., the interpretation of the results. While this paper essentially
considers the AND-checker (since a global ``yes'' corresponds to all processes
saying ``yes''), \cite{FRT12} deals with other interpretations,
including more values (not only ``yes'' and ``no''), with the objective of
designing checkers that use the smallest number of values.
\section{Deterministic Decision}
\label{sec:dd}
We conjecture that $\mbox{\rm LD}=\mbox{\rm LD}^*$. A support to this conjecture is that it holds for a large class of languages, namely for all \emph{hereditary} languages, that is languages closed under node deletion. For instance, $\mbox{\tt Coloring}$ and $\mbox{\tt MIS}$ are hereditary, as well as all languages corresponding to hereditary graph families, such as planar graphs, interval graphs, forests, chordal graphs, cographs, perfect graphs, etc.
\begin{theorem}\label{theo:LDhereditary}
$\mbox{\rm LD}^*=\mbox{\rm LD}$ for hereditary languages.
\end{theorem}
To prove the theorem, it is sufficient to show that $\mbox{\rm LD}\subseteq \mbox{\rm LD}^*$ for hereditary languages. This immediately follows from the statement and proof of Theorem~3.3 in~\cite{FKP11}. Indeed, let $A$ be a non-anonymous local algorithm deciding ${\cal L}$. This deterministic algorithm is in particular a randomized algorithm, with success probabilities $p=1$ for legal instances, and $q=1$ for illegal instance. That is, algorithm $A$ is a $(1,1)$-decider for ${\cal L}$, according to the definition in~\cite{FKP11}. Since ${\cal L}$ is hereditary, and since $p^2+q>1$, the existence of $A$ implies the existence of a specific deterministic anonymous local algorithm $D$ for ${\cal L}$. Indeed, the algorithm $D$ described in the proof of Theorem~3.3 in~\cite{FKP11} is in fact anonymous: it simply collects the ball $B(u,t)$ of radius $t$ around each node $u$ for some constant~$t$, and $u$ then decides ``yes'' or ``no'' according to whether $B(u,t)\in{\cal L}$ or not, regardless of the identities.
A similar proof, based on Theorem~4.1 in~\cite{FKPP12}, enables to establish the following:
\begin{theorem}\label{theo:LDpath}
$\mbox{\rm LD}^*=\mbox{\rm LD}$ for languages defined on the set of paths, with a finite set of input values.
\end{theorem}
Another evidence supporting the conjecture $\mbox{\rm LD}=\mbox{\rm LD}^*$ is that it holds assuming that nodes have access to a seemingly weak oracle. Specifically, this oracle, denoted ${\mbox{\bf N}}$, simply provides each node with an arbitrarily large upper bound on the total number of nodes in the actual instance.
(It is not assumed that all the upper bounds provided to nodes are the same). We denote by $\mbox{\rm LD}^{*\mbox{\bf N}}$ the class of languages that can be decided by an anonymous local algorithm having access to oracle $\mbox{\bf N}$, and we prove the following:
\begin{theorem}\label{theo:LD=LD}
$\mbox{\rm LD}^*\subseteq\mbox{\rm LD}\subseteq\mbox{\rm LD}^{*\mbox{\bf N}}$.
\end{theorem}
\begin{proof}
We just need to prove that $\mbox{\rm LD}\subseteq\mbox{\rm LD}^{*\mbox{\bf N}}$. Let ${\cal L}\in\mbox{\rm LD}$, and let $A$ be a local (non-anonymous) algorithm deciding ${\cal L}$. Assume that the running time of $A$ is $t$. We transform $A$ into an anonymous algorithm $A'$ deciding ${\cal L}$ in time $t$, assuming each node $u$ in a given input $G$ has an access to the oracle $\mbox{\bf N}$, i.e., it knows an arbitrary upper bound $n_u$ on the number of nodes in $G$.
Algorithm $A'$ works as follows. Each node $u$ collects the ball $B(u,t)$ of radius $t$ around it. Then, for every possible assignment of identities to the nodes of $B(u,t)$ taken from the range $[1,n_u]$, node $u$ simulates the behavior of the non-anonymous algorithm $A$ on the ball $B(u,t)$ with the corresponding identities. If, in one of these simulations, algorithm $A$ decides ``no'', then $A'$ decides ``no''. Otherwise, $A'$ decides ``yes''.
We now prove the correctness of $A'$. If the input $(G,\mbox{\rm\bf x})\in{\cal L}$, then $A$ accepts it for every identity assignment to the nodes of $G$. Therefore, since, for every node $u$, every possible identity assignment to the nodes of the ball $B(u,t)$ can be extended to an identity assignment to all the nodes of $G$, all the simulations of $A$ by $u$ return ``yes'', and hence $A'$ accepts ${\cal L}$ as well. On the other hand, if $(G,\mbox{\rm\bf x})\notin{\cal L}$ then $A$ rejects it for every identity assignment to the nodes of $G$. That is, for every identity assignment to the nodes of $G$, at least one node $u$ decides ``no''. (Note that, this node $u$ may be different for two different identity assignments). Let us fix one identity assignment $\mbox{\rm Id}$ to the nodes of $G$, in the range $[1,n]$, and let $u$ be one node that decides ``no'' for $\mbox{\rm Id}$. Let $B_{\mbox{\footnotesize $\mbox{\rm Id}$}}(u,t)$ be the ball $B(u,t)$ with the identities of the nodes given by $\mbox{\rm Id}$. In $A'$, since $u$ tries all possible identity assignments of the ball $B(u,t)$ in the range $[1,n_u]$ with $n\leq n_u$, in one of its simulations of $A$, node $u$ will simulate $A$ on $B_{\mbox{\footnotesize $\mbox{\rm Id}$}}(u,t)$. In this simulation, node $u$ decides ``no'', and hence algorithm $A'$ rejects ${\cal L}$ as well.
\qed
\end{proof}
Note that the inclusion $\mbox{\rm LD}\subseteq\mbox{\rm LD}^{*\mbox{\bf N}}$ holds when one imposes no restrictions on the individual sequential running time. However, the transformation of a (non-anonymous) local algorithm into an anonymous local algorithm as described in the proof of Theorem~\ref{theo:LD=LD} is very expensive in terms of individual computation. Indeed, the number of simulations of the original local algorithm $A$ by each node $u$ can be as large as $n_u \choose n_B$ where $n_u$ is the upper bound on $n$ given by the oracle $\mbox{\bf N}$, and $n_B$ is the number of nodes in the ball $B(u,t)$. This bound can be exponential in $n$ even if the oracle provides a good approximation of $n$ (even if it gives precisely $n$). It would be nice to establish $\mbox{\rm LD}\subseteq\mbox{\rm LD}^{*\mbox{\bf N}}$ by using a transformation not involving a huge increase in the individual sequential computation time.
\section{Non-deterministic Decision}
\label{sec:ndd}
In the previous section, we have seen several evidences supporting the conjecture that $\mbox{\rm LD}^*=\mbox{\rm LD}$, but whether it holds or not remains to be proved. In this section, we turn our attention to the non-deterministic variants of these two classes, and show that they coincide. More formally, we have:
\begin{theorem}\label{theo:NLD=NLD}
$\mbox{\rm NLD}^*=\mbox{\rm NLD}$.
\end{theorem}
\begin{proof}
To prove $\mbox{\rm NLD}^*=\mbox{\rm NLD}$, it is sufficient to prove $\mbox{\rm NLD}\subseteq\mbox{\rm NLD}^* $. To establish this inclusion, we provide a sufficient condition for $\mbox{\rm NLD}^*$-membership, and prove that it is a necessary condition for $\mbox{\rm NLD}$-membership.
Let $I=(G,\mbox{\rm\bf x})$ and $I'=(G',\mbox{\rm\bf x}')$ be two input instances. A \emph{homomorphism} from $I$ to $I'$ is a function $f:V(G)\to V(G')$ that preserves the edges of $G$ as well as the inputs to the nodes. Specifically,
\[
\{u,v\}\in E(G) \Rightarrow \{f(u),f(v)\}\in E(G'),\]
and $f$ maps every node $u\in V(G)$ to a node $f(u)\in V(G')$ satisfying $$\mbox{\rm\bf x}'(f(u))=\mbox{\rm\bf x}(u).$$ For instance, assuming the nodes have no inputs, and labeling the nodes of the $n$-node cycle $C_n$ by consecutive integers from 0 to $n-1$, modulo~$n$, then the map $f:C_8\to C_4$ defined by $f(u)=u\bmod 4$ is a homomorphism. The trivial map $g:C_8\to K_2$ defined by $g(u)=u\bmod 2$, where $K_2$ is the 2-node clique, is also a homomorphism. To establish conditions for $\mbox{\rm NLD}$- and $\mbox{\rm NLD}^*$-membership, we require the involved homomorphisms to preserve the local neighborhood of a node, and define the notion of \emph{$t$-local isomorphism}.
Let $t$ be a positive integer. We say that $I$ is $t$-local isomorphic to $I'$ if and only if there exists an homomorphism $f$ from $I$ to $I'$ such that, for every node $v\in V(G)$, $f$ restricted to $B_G(v,t)$ is an isomorphism from $B_G(v,t)$ to $B_{G'}(f(v),t)$. We call such a homomorphism $f$ a $t$-local isomorphism.
Note that a homomorphism is not necessarily a 1-local isomorphism. For instance, the aforementioned map $f:C_8\to C_4$ defined by $f(u)=u\bmod 4$ is a 1-local isomorphism, but the map $g:C_8\to K_2$ defined by $g(u)=u\bmod 2$ is not a 1-local isomorphism.
To be a 1-local isomorphism, a homomorphism should also insure isomorphism between the balls of radius~1. Also observe that any $t$-local isomorphism $f: G \to G'$ is onto (because if a node of $G'$ has no pre-image, then neither do its neighbors have a pre-image, since homomorphisms preserve edges, and so forth). To avoid confusion, it is thus useful to keep in mind that, informally, a $t$-local isomorphism goes from a ``larger'' graph to a ``smaller'' graph.
\begin{definition}
\label{def:lift}
For positive integer $t$, we say that ${\cal L}$ is \emph{$t$-closed under lift }if, for every two instances $I,I'$ such that $I$ is $t$-local isomorphic to $I'$, we have: $$I' \in{\cal L} \Rightarrow I \in {\cal L}.$$
\end{definition}
So, informally, Defintion~\ref{def:lift} states that, for a language ${\cal L}$ to be $t$-closed under lift, if a ``smaller'' instance $I'$ is in ${\cal L}$ then any ``larger'' instance $I$ that is a lift of $I'$, i.e., satisfying that $I$ is $t$-local isomorphic to $I'$, must also be in ${\cal L}$. The following lemma gives a sufficient condition for $\mbox{\rm NLD}^*$-membership.
\begin{lemma}\label{claim:sufficient}
Let ${\cal L}$ be a language. If there exists $t \geq 1$ such that ${\cal L}$ is $t$-closed under lift, then ${\cal L}\in\mbox{\rm NLD}^*$.
\end{lemma}
\begin{proofofclaim}
Let ${\cal L}$ be a language, and assume that there exists $t \geq 1$ such that ${\cal L}$ is $t$-closed under lift. We describe an anonymous non-deterministic local algorithm $A$ deciding ${\cal L}$, and performing in $t$ rounds. The certificate of each node $v$ is a triple $\mbox{\rm\bf y}(v)=(i,G',\mbox{\rm\bf x}')$ where $G'$ is an $n$-node graph with nodes labeled by distinct integers in $[1,n]=\{1,\dots,n\}$, $i\in[1,n]$, and $\mbox{\rm\bf x}'$ is an $n$-dimensional vector.
Informally, the certificates are interpreted by $A$ as follows. The graph $G'$ is supposed to be a ``map'' of $G$, that is, $G'$ is interpreted as an isomorphic copy of $G$. The integer $i$ is the label of the node in $G'$ corresponding to node $v$ in $G$. Finally, $\mbox{\rm\bf x}'$ is interpreted as the input of the nodes in $G'$.
The algorithm $A$ performs as follows. Every node $v$ gets $B_G(v,t)$, the ball of radius $t$ around it; hence, in particular, it collects all the certificates of all the nodes at distance at most $t$ from it. Then, by comparing its own certificate with the ones of its neighbors, it checks that the graph $G'$, and the input $\mbox{\rm\bf x}'$ in its certificate, are identical to the ones in the certificates of its neighbors. It also verifies consistency between the labels and the nodes in its ball of radius $t$. That is, it checks whether the labels and inputs in the certificate of the nodes in $B_G(v,t)$ are as described by its certificate. Whenever a node fails to pass any of these tests, it outputs ``no''. Otherwise it output ``yes'' or ``no'' according to whether $(G',\mbox{\rm\bf x}')\in{\cal L}$ or not, respectively. (This is doable because we are considering languages that are decidable in the usual sense of sequential computation).
We show that $A$ performs correctly. If $(G,\mbox{\rm\bf x})\in{\cal L}$, then by labeling the nodes in $G$ by distinct integers from~1 to $|V(G)|$, and by providing the node $v$ labeled $i$ with $\mbox{\rm\bf y}(v)=(i,G,\mbox{\rm\bf x})$, the algorithm $A$ output ``yes'' at all nodes, as desired. Consider now a instance $I=(G,\mbox{\rm\bf x})\notin{\cal L}$. Assume, for the purpose of contradiction that there exists a certificate $\mbox{\rm\bf y}$ leading all nodes to output ``yes''. Let $f:V(G) \to V(G')$ be defined by $f(v)=i$ where $i$ is the label of $v$ in its certificate. Since $\mbox{\rm\bf y}$ passes all tests of $A$, it means that (1) $\mbox{\rm\bf y}(v)=(i,G',\mbox{\rm\bf x}')$ where the instance $I'=(G',\mbox{\rm\bf x}')$ is the same for all nodes, (2) $f$ restricted to $B_G(v,t)$ is an isomorphism from $B_G(v,t)$ to $B_{G'}(f(v),t)$, for every node $v$, and (3) $(G',\mbox{\rm\bf x}')\in{\cal L}$. In view of (2), $I$ is $t$-local isomorphic to $I'$. Therefore, (3) implies that $I=(G,\mbox{\rm\bf x})\in{\cal L}$, because ${\cal L}$ is $t$-closed under lift. This is in contradiction with the actual hypothesis $(G,\mbox{\rm\bf x})\notin{\cal L}$. Thus, for each certificate $\mbox{\rm\bf y}$, there must exist at least one node that outputs ``no''. As a consequence, $A$ is a non-deterministic algorithm deciding ${\cal L}$, and thus ${\cal L}\in\mbox{\rm NLD}^*$.
\end{proofofclaim}
The following lemma shows that the aforementioned sufficient condition for $\mbox{\rm NLD}^*$-membership is a necessary condition for $\mbox{\rm NLD}$-membership.
\begin{lemma}\label{claim:necessary}
Let ${\cal L}$ be a language. If ${\cal L}\in\mbox{\rm NLD}$, then there exists $t \geq 1$ such that ${\cal L}$ is $t$-closed under lift.
\end{lemma}
\begin{proofofclaim}
Let ${\cal L}$ be a language in $\mbox{\rm NLD}$, and let $A$ be a non-deterministic (non-anonymous) local algorithm deciding ${\cal L}$. Assume, for the purpose of contradiction that, for any integer $t \geq 1$, ${\cal L}$ is \emph{not} $t$-closed under lift. That is, for any $t$, there exist two input instances $I,I'$ such that $I$ is $t$-local isomorphic to $I'$, with $I\notin{\cal L}$ and $I'\in{\cal L}$. Assume that $A$ runs in $t$ rounds. Without loss of generality, we can assume that $t\geq 1$. Let $I=(G,\mbox{\rm\bf x})\notin{\cal L}$ and $I'=(G',\mbox{\rm\bf x}')\in{\cal L}$ satisfying $I$ is $t$-local isomorphic to $I'$. Since $I'\in{\cal L}$, there exists a certificate $\mbox{\rm\bf y}'$ such that when $A$ is running on $I'$ with certificate $\mbox{\rm\bf y}'$, every node output ``yes'' for every identity assignment. Since $I$ is $t$-local isomorphic to $I'$, there exists an homomorphism $f:I\to I'$ such that, for every node $v\in G$, $f$ restricted to $B_G(v,t)$ is an isomorphism from $B_G(v,t)$ to $B_{G'}(f(v),t)$. Let $\mbox{\rm\bf y}$ be the certificate for $I$ defined by $\mbox{\rm\bf y}(v)=\mbox{\rm\bf y}'(f(v))$. Consider the execution of $A$ running on $I$ with certificate $\mbox{\rm\bf y}$, and some arbitrary identity assignment~$\mbox{\rm Id}$.
Since $A$ performs in $t$ rounds, the decision at each node $v$ is taken according to the inputs, certificates, and identities in the ball $B_G(v,t)$, as well as the structure of this ball. By the nature of the homomorphism $f$, and by the definition of certificate $\mbox{\rm\bf y}$, the structure, inputs and certificates of the ball $B_G(v,t)$, are identical to the corresponding structure, inputs and certificates of the ball $B_{G'}(f(v),t)$. Balls may however differ in the identities of their nodes. So, let $v_0$ be the node in $G$ deciding ``no'' for $(G,\mbox{\rm\bf x})$ with certificate $\mbox{\rm\bf y}$. There exists such a node since $I \notin {\cal L}$. Let $v'_0=f(v_0)$, and assign the same identities to the nodes in $B_{G'}(v'_0,t)$ as their corresponding nodes in $B_{G}(v_0,t)$. Arbitrarily extend this identities to an identity assignment $\mbox{\rm Id}'$ to the whole graph $G'$. By doing so, the two balls are not only isomorphic, but every node in $B_{G}(v_0,t)$ has the same input, certificate and identity as its image in $B_{G'}(v'_0,t)$. Therefore, the decision taken by $A$ at $v_0\in G$ under $\mbox{\rm Id}$ is the same as its decision at $v'_0\in G'$ under $\mbox{\rm Id}'$. This is in contradiction to the fact that $v_0$ decides ``no'' while $v'_0$ decides ``yes''.
\end{proofofclaim}
Lemmas~\ref{claim:sufficient} and~\ref{claim:necessary}~together establish the theorem.
\qed
\end{proof}
The proof of Lemma~\ref{claim:sufficient} also provides an upper bound on the size of the certificates for \emph{graph languages} in $\mbox{\rm NLD}$, that is, for languages in $\mbox{\rm NLD}$ with no input. (This includes, e.g., recognition of interval graphs, and recognition of chordal graphs). Indeed, given ${\cal L}\in\mbox{\rm NLD}$, Algorithm~$A$ in the proof of Lemma~\ref{claim:sufficient} verifies ${\cal L}$ using a certificate at each node which is essentially an isomorphic copy of the input instance $(G,\mbox{\rm\bf x})$, with nodes labeled by consecutive integers in $[1,n]$. If ${\cal L}$ is a graph language, then there is no input $\mbox{\rm\bf x}$, and thus the size of the certificates depends only on the size of the graph. More precisely, we have:
\begin{corollary}\label{cor:mlogn}
Let ${\cal L}\in\mbox{\rm NLD}$ be a graph language. There exists an algorithm verifying ${\cal L}$ using certificates of size $O(n^2)$ bits at each node of every $n$-node graph in ${\cal L}$.
\end{corollary}
We now argue that the above bound is tight, that is, we prove the following.
\begin{proposition}
There exists a graph language ${\cal L}\in\mbox{\rm NLD}$ such that every algorithm verifying ${\cal L}$ requires certificates of size $\Omega(n^2)$ bits.
\end{proposition}
\begin{proof}
Recall that \cite{KKP10} showed that there exists a graph language for which every proof labeling scheme (PLS) requires labels of size $\Omega(n^2)$ bits (the proof of this latter result appears in a detailed version \cite{KKP10b}).
Still in the context of PLS, \cite{GS11} showed that this lower bound holds for two {\em natural} graph families: specifically, \cite{GS11} showed that verifying symmetric graphs requires labels of size $\Omega(n^2)$ bits, and verifying non-3 colorable graphs requires almost the same size of labels, specifically, $\Omega(n^2/\log n)$ bits. Note that the certificate size required for verifying a language in $\mbox{\rm NLD}$ is at least as large as the minimum label size required for verifying the language via a proof labeling scheme.
Unfortunately, however, one cannot obtain our claim directly from the aforementioned results since it turns out that neither of the two graph languages (namely, symmetric graphs and non-3 colorable graphs) belongs to $\mbox{\rm NLD}$.
We therefore employ an indirect approach.
Specifically, consider a graph $G$. We say that $H$ is a {\em seed} of $G$ if there exists a 1-local isomorphism from $G$ to $H$.
Suppose ${\cal F}$ is a family of graphs. Let \textsf{Seed-${\cal F}$} denote the family of graphs $G$, for which there exists a seed of $G$ that belongs to ${\cal F}$.
Then, by definition, \textsf{Seed-${\cal F}$} is $1$-closed under lift. Indeed, assume that there is a 1-local isomorphism $g$ from $G'$ to $G$, and let $H\in {\cal F}$ be a seed of $G$ that belongs to ${\cal F}$. Then let $f$ be the 1-local isomorphism from $G$ to $H$. We have that $f\circ g$ is a 1-local isomorphism from $G'$ to $H$, because, for every $u\in V(G')$, $B_{G'}(u,1)$ is isomorphic to $B_G(g(u),1)$, which in turn is isomorphic to $B_H(f(g(u)),1)$. Thus $H$ is also a seed of $G'$. \textsf{Seed-${\cal F}$} is therefore in $\mbox{\rm NLD}$. Now, in the proof of corollary 2.2 in \cite{KKP10b}, the authors construct, for every integer $n$, a family ${\cal F}_n$ of $n$-node graphs that requires proof labels of size $\Omega(n^2)$. Note that for every prime integer $n'$, a graph $G$ of size $n'$ belongs to ${\cal F}_{n'}$ if and only if it belongs to
\textsf{Seed-${\cal F}_{n'}$}. Therefore, there exists a graph language, namely, \textsf{Seed-${\cal F}_{n}$}, that requires certificates of size $\Omega(n^2)$ bits (at least for prime $n$'s).
\qed
\end{proof}
\section{Conclusion}
Again, in this paper, we provide some evidences supporting the conjecture $\mbox{\rm LD}^*=\mbox{\rm LD}$. For instance, Theorem~\ref{theo:LD=LD} shows that if every node knows any upper bound on the number of nodes $n$, then all languages in $\mbox{\rm LD}$ can be decided in the anonymous ${\cal LOCAL}$ model. One interesting remark about the ${\cal LOCAL}$ model is that it is guaranteed that at least one node has an upper bound on $n$. This is for instance the case of the node with the largest identity. In the anonymous ${\cal LOCAL}$ model, however, there is no such guarantee. Finding a language whose decision would be based on the fact that one node has an upper bound on $n$ would disprove the conjecture $\mbox{\rm LD}^*=\mbox{\rm LD}$. Nevertheless, it is not clear whether such a problem exists.
In this paper, we also prove that $\mbox{\rm NLD}^*=\mbox{\rm NLD}$, that is, our conjecture holds for the non-deterministic setting. It is worth noticing that \cite{FKP11} proved that there exists an $\mbox{\rm NLD}$-complete problem under the local one-to-many reduction. It is not clear whether such a problem exists for $\mbox{\rm NLD}^*$. Indeed, the reduction in the completeness proof of \cite{FKP11} relies on the aforementioned guarantee that, in the ${\cal LOCAL}$ model, at least one node has an upper bound on $n$.
| {'timestamp': '2015-12-23T02:05:02', 'yymm': '1512', 'arxiv_id': '1512.06989', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06989'} | arxiv |
\section{The Ditto Algorithm} \label{sec:alg}
In this section we present \textsc{\algname}\xspace, an efficient algorithm to heuristically approximate the MDL optimal summary of the data.
In particular, it avoids enumerating all multivariate patterns, let alone all possible subsets of those. Instead, it considers a small but highly promising part of this search space by iterative bottom-up search for those patterns that maximally improve the description. More specifically, we build on the idea of \textsc{Slim}~\cite{smets:12:slim} and \textsc{sqs}~\cite{tatti:12:sqs}. That is, as candidates to add to our model, we only consider the most promising combinations of already chosen patterns -- as identified by their estimated gain in compression.
We give the pseudo code of \textsc{\algname}\xspace as Algorithm~\ref{alg:main}. We start with singleton code table $ST$ (line~\ref{ln:main:st}) and a set of candidate patterns of all pairwise combinations of singletons (line~\ref{ln:main:cand}). We then iteratively add patterns from the candidate set to code table $\mathit{CT}$ in $\textbf{Candidate Order}$: $\downarrow \mathit{estimated~gain}(X)$, $\downarrow \mathit{support}(X \mid D)$, $\downarrow ||X||$, $\downarrow L(X \mid \mathit{ST})$ and $\uparrow$ lexicographically (line~\ref{ln:main:co}). This order prefers the most promising candidates in terms of compression gain. When a new pattern improves the total encoded length $L(D, \mathit{CT})$ we keep it, otherwise we discard it (line~\ref{ln:main:l}). After acceptance of a new pattern we prune (line~\ref{ln:main:pr}) $\mathit{CT}$ and recursively test whether to add variations (line~\ref{ln:main:var}) of the accepted pattern in combination with its gap events. When all variations are tested recursively, we update the candidate set by combining $\mathit{CT} \times \mathit{CT}$ (line~\ref{ln:main:up}).
We give the details of each of these steps below, as well as explain how to gain efficiency through smart caching, and discuss the computational complexity of \textsc{\algname}\xspace.
\begin{algorithm}[t]
\caption{The \textsc{\algname}\xspace Algorithm}
\label{alg:main}
\begin{algorithmic}[1]
\INPUT The dataset $D$ and singleton code table $\mathit{ST}$
\OUTPUT An approximation to the \textbf{Minimal Pattern Set Problem}
\State $\mathit{CT} \gets \mathit{ST}$ \label{ln:main:st}
\State $\mathit{Cand} \gets \mathit{CT} \times \mathit{CT}$ \label{ln:main:cand}
\For{$X \in \mathit{Cand}$ in \textbf{Candidate Order}} \label{ln:main:co}
\If{$L(D, \mathit{CT} \oplus X) < L(D, \mathit{CT})$} \label{ln:main:l}
\State $\mathit{CT} \gets \textsc{Prune}(D, \mathit{CT} \oplus X)$ \label{ln:main:pr}
\State $\mathit{CT} \gets \textsc{Variations}(D, X, \mathit{CT})$ \label{ln:main:var}
\State $\mathit{Cand} \gets \mathit{CT} \times \mathit{CT}$ \label{ln:main:up}
\EndIf
\EndFor
\State {\bf return} $\mathit{CT}$
\end{algorithmic}
\end{algorithm}
\subsection{Covering}
As detailed in the previous sections, to compute $L(D, \mathit{CT})$, we first need to cover the data with $\mathit{CT}$. The \textsc{Cover} algorithm covers the data using the patterns as they are ordered in $\mathit{CT}$. To find the optimal cover we need to identify the cover order that leads to the smallest encoded length of the data. We do so greedily, by considering the pattern set in a fixed order. As our goal is to compress the data, we prefer patterns that cover many events with just a short code length. We hence define the \textbf{Cover Order} as follows: $\downarrow ||X||$, $\downarrow \mathit{support}(X \mid D)$, $\downarrow L(X \mid \mathit{ST})$ and $\uparrow$ lexicographically. It follows the intuition that we give preference to larger and more frequent patterns, for which we expect a higher compression gain, to cover the data first, as these maximise the likelihood of the cover.
\subsection{Candidates and Estimation}
Conceptually, at every iteration the set of candidates from which we can choose, consists of the Cartesian product of the code table with itself. Two patterns $X$ and $Y$ can be combined to form new candidate patterns. Each alignment of $X$ and $Y$ without gaps in either $X$, $Y$ and the resulting pattern, forms a new candidate, with the exception of alignments in which $X$ and $Y$ overlap. See Figure~\ref{fig:align} for an example.
\begin{figure}[t]
\begin{center}
\includegraphics[width=0.48\textwidth]{alignments}
\end{center}
\caption{The 4 possible candidate patterns constructed from different alignments of $X$ and $Y$.}
\label{fig:align}
\end{figure}
Selecting the candidate with the highest gain is very expensive -- we would need to cover the whole data for every candidate. Instead, we select the candidate with the highest \emph{estimated} gain -- which can be done much more efficiently. Intuitively, based on the estimated gain ($\Delta L'$) we only consider candidate patterns in a lazy fashion based on their usage and do not consider patterns with a lower usage than the current best candidate. For notational brevity, for a pattern $X \in \mathit{CT}$ we use $x = \mathit{usage}(X)$. Further, let $s$ be the total usage count of all patterns in $\mathit{CT}$, i.e.\ $s = \sum_{X \in \mathit{CT}} x$. For $\mathit{CT}' = \mathit{CT} \oplus Z$, we use $x'$ and $s'$ similarly. We estimate $z$, the usage of $Z$, optimistically as the minimum of the usages of $X$ and $Y$ -- and as $x/2$ when $X = Y$ (because the usage of $XX$ can not be higher). Formally, our gain estimate $\Delta L'(\mathit{CT} \oplus Z,D)$ of the true gain $\Delta L(\mathit{CT} \oplus Z,D)$ for adding pattern $Z = X \cup Y$ to $\mathit{CT}$ is as follows,
\begin{align}
\Delta L'(\mathit{CT}',\ D) =\ &\ \Delta L'(\mathit{CT}' \mid D) + \Delta L'(D \mid \mathit{CT}') \quad ,\\
\Delta L'(\mathit{CT}' \mid D)=\ &- L_\mathbb{N}(|Z|) - \sum_{l(Z)} \log(|A|)\\
&- \sum_{Z[i] \in Z}\sum_{z \in Z[i]} L(\mathit{code}_\mathit{p}(z \mid \mathit{ST})) \quad , \\
\Delta L'(D \mid \mathit{CT}')=\ &\ s \log s - s' \log s' + z \log z - x \log x\\
&+ x' \log x' - y \log y + y' \log y' \quad .
\end{align}
That is, the estimated gain of adding pattern $Z$ to $\mathit{CT}$ thus consists of the estimated gain in the size of the data, minus the increase in the size of $\mathit{CT}$. Note that, $\Delta L'$ is an estimate and for simplicity we ignore the effects of adding pattern $Z$ to code table $\mathit{CT}$ on the pattern and (no-)gap usages of patterns other than $X$ and $Y$.
\subsection{Pruning}
After the acceptance of a new pattern in our code table other patterns may have become redundant as their role may have been overtaken by the newer pattern. Therefore, each time a pattern $X$ is successfully added to the code table, we consider removing those $Y \in \mathit{CT}$ for which the usage decreased and hence the pattern code length increased. Algorithm~\ref{alg:pru} describes how a code table is pruned.
\begin{algorithm}
\caption{The \textsc{Prune} Algorithm}
\label{alg:pru}
\begin{algorithmic}[1]
\INPUT The dataset $D$ and a code table $\mathit{CT}$
\OUTPUT A pruned code table
\State $\mathit{Cand} \gets X \in \mathit{CT}$ with decreased usage \label{ln:pru:cand}
\For{$X \in \mathit{Cand}$ in \textbf{Prune Order}} \label{ln:pru:po}
\If{$L(D, \mathit{CT} \setminus X) < L(D, \mathit{CT})$} \label{ln:pru:l}
\State $\mathit{CT} \gets \mathit{CT} \setminus X$ \label{ln:pru:del}
\State $\mathit{Cand} \gets \mathit{Cand} \cup \{ Y \in \mathit{CT} \mid $ usage decreased$\}$ \label{ln:pru:up}
\EndIf
\State $\mathit{Cand} \gets \mathit{Cand} \setminus X$ \label{ln:pru:disc}
\EndFor
\State {\bf return} $\mathit{CT}$
\end{algorithmic}
\end{algorithm}
\subsection{Generating Pattern Variations}
To efficiently discover a large and diverse set of promising patterns -- without breadth-first-search, which takes long to find large patterns, and without depth-first-search, which would be prohibitively costly -- we consider \emph{variations} of each accepted pattern to the code table. That is, when a pattern leads to a gain in compression, we consider all ways by which we can extend it using events that occur in the gaps of its usages. This way we consider a rich set of candidates, plus speed up the search as we are automatically directed to patterns that actually exist in the data. Algorithm~\ref{alg:var} outputs a code table possibly containing variations of the lastly added pattern $Y$.
\begin{algorithm}
\caption{The \textsc{Variations} Algorithm}
\label{alg:var}
\begin{algorithmic}[1]
\INPUT The dataset $D$, a pattern $Y$ and a code table $\mathit{CT}$
\OUTPUT A code table possibly containing variations of $Y$
\State $\mathit{Cand} \gets Y \times \mathit{gap~events}(Y)$ \label{ln:var:cand}
\For{$X \in \mathit{Cand}$} \label{ln:var:loop}
\If{$L(D, \mathit{CT} \oplus X) < L(D, \mathit{CT})$} \label{ln:var:l}
\State $\mathit{CT} \gets \textsc{Prune}(D, \mathit{CT} \oplus X)$ \label{ln:var:pr}
\State $\mathit{CT} \gets \textsc{Variations}(D, X, \mathit{CT})$ \label{ln:var:var}
\EndIf
\State $\mathit{Cand} \gets \mathit{Cand} \setminus X$
\EndFor
\State {\bf return} $\mathit{CT}$
\end{algorithmic}
\end{algorithm}
For example, consider the dataset \{$a, b, a, b, c, a, c, a$\} where pattern \{$a, a$\} occurs twice with a gap of length one. After adding pattern \{$a, a$\} to $\mathit{CT}$ we consider the patterns \{$a, b, a$\} and \{$a, c, a$\} for addition to $\mathit{CT}$.
\newpage
\subsection{Faster Search through Caching}
The space of all possible multivariate patterns is extremely rich. Moreover, in practice many candidate patterns will not lead to any gain in compression. In particular, those that occur only very infrequently in the data are unlikely to provide us any (or much) gain in compression. We thus can increase the efficiency of \textsc{\algname}\xspace by allowing the user to impose a minimum support threshold for candidates. That is, only patterns $X$ will be evaluated if they occur at least $\sigma$ times in the data. To avoid time and again re-evaluating candidates of which we already know that they are infrequent, we cache these in a tree-based data structure. Only \emph{materialised} infrequent pattern are added to the tree. Future candidates are only materialised when none of its subsets are present in the tree, as by the a priori principle we know it can not be frequent~\cite{mannila:94:efficient}.
Even though this tree can theoretically grow very large, in practise it stays relatively small because we only consider a small part of the candidate space. That is, we only combine patterns we know to be frequent to form new candidate patterns. In practice, we found that \textsc{\algname}\xspace only has to cache up to a few thousand candidates. Using this tree we see speed ups in computation of 2 to 4 times, while also memory consumption is strongly reduced. For some datasets the difference is even bigger, up to an order of magnitude.
In this work we only consider keeping track of infrequent candidates. Note, however, that at the expense of some optimality in the search additional efficiency can be gained by also storing \emph{rejected} candidates in the tree. In both theory and practice, however, candidates rejected in one iteration may lead to compression gain later in the process~\cite{smets:12:slim}.
\subsection{Complexity}
The time complexity of \textsc{\algname}\xspace has a simple upper bound as follows. In the worst-case we cover the data for each frequent pattern from the set of all frequent patterns $\mathcal{F}$ in each iteration. Covering takes $O(|\mathit{CT}| \times ||D||)$ and the number of iterations is worst-case $O(\mathcal{|F|}$). Together, the worst-case time complexity is
\[O( |\mathcal{F}|^2 \times |\mathit{CT}| \times ||D||) \quad .\]
From the experiments in Section~\ref{sec:exp}, however, we will learn that this estimate is rather pessimistic. In practice the code table stays small ($|\mathit{CT}| \ll |\mathcal{F}|$), we only consider a subset of all frequent patterns and we do this greedily. In practice the runtime of \textsc{\algname}\xspace therefore stays in the order of seconds to minutes.
\section{Conclusion} \label{sec:con}
We studied the problem of mining interesting patterns from multivariate sequential data. We approached the problem from a pattern set mining perspective, by MDL identifying the optimal set of patterns as those that together describe the data most succinctly. We proposed the \textsc{\algname}\xspace algorithm for efficiently discovering high-quality patterns sets from data.
Experiments show that \textsc{\algname}\xspace discovers patterns planted in synthetic data with high accuracy. Moreover, it scales favourably with the length of the data, the number of attributes, and alphabet sizes. For real data, it discovers easily interpretable summaries that provide clear insight in the associations of the data.
As future work, building upon our results on the part-of-speech tagged text data, we are collaborating with colleagues from the linguistics department to apply \textsc{\algname}\xspace for analysis of semantically annotated text and for inferring patterns in morphologically rich languages.
\section{Discussion} \label{sec:dis}
Overall, the experiments show that \textsc{\algname}\xspace works well in practice. In particular, the experiments on synthetic data show that \textsc{\algname}\xspace accurately discovers planted patterns in random data for a wide variety of data and patterns dimensions. That is, \textsc{\algname}\xspace discovers the planted patterns regardless of their support, their size, and the number of planted patterns -- without discovering any spurious patterns. \textsc{\algname}\xspace also performed well on real data -- efficiently discovering characteristic multivariate patterns.
The results on the annotated text are particularly interesting; they give clear insight in non-trivial linguistic constructs, characterising the style of writing. Besides giving direct insight, these summaries have high downstream potential. One could, for example, use them for comparative analysis~\cite{budhathoki:15:diffnorm}. For example, for text identifying similarities and differences between authors, for sensor networks detecting and describing concept drift over time, and characterising differences between patients.
Although \textsc{\algname}\xspace performs very well in practice, we see ways to improve over it. Firstly, MDL is not a magic wand. That is, while our score performs rather well in practice, we carefully constructed it to reward structure in the form of multivariate patterns. It will be interesting to see how our score and algorithms can be adapted to work directly on real-valued data. Secondly, it is worth investigating whether our current encoding can be refined, e.g.\ using prequential codes~\cite{budhathoki:15:diffnorm}. A strong point of our approach is that we allow for noise in the form of gaps in patterns. We postulate that we can further reduce the amount of redundancy in the discovered pattern sets by allowing noise \emph{in the occurrences} of a pattern, as well as when we allow \emph{overlap} between the occurrences of patterns in a cover. For both cases, however, it is not immediately clear how to adapt the score accordingly, and even more so, how to maintain the efficiency of the cover and search algorithms.
Last, but not least, we are interested in applying \textsc{\algname}\xspace on vast time series. To accomodate, the first step would be to investigate parallelisation; the search algorithm is trivially parallelisable, as candidates can be generated and estimated in parallel, as is the covering of the data. More interesting is to investigate more efficient candidate generation schemes, in particular top-k mining, or lazy materialization of candidates.
Previous work has shown that MDL-based methods work particularly well for a wide range of data mining problems, including classification~\cite{vreeken:11:krimp,lam:14:seq} and outlier detection~\cite{smets:11:odd}. It will make for interesting future work to investigate how well \textsc{\algname}\xspace solves such problems for multivariate event sequences. Perhaps the most promising direction of further study is that of causal inference~\cite{vreeken:15:ergo}.
\section{Experiments} \label{sec:exp}
We implemented \textsc{\algname}\xspace in C++ and generated our synthetic data and patterns using Python. We make our code available for research purposes.\!\footnote{\url{http://eda.mmci.uni-saarland.de/ditto/}} All experiments were conducted on a 2.6 GHz system with 64 GB of memory.
For our experiments on real data we always set the minimum support threshold as low as feasible, unless domain knowledge suggests otherwise.
We evaluate \textsc{\algname}\xspace on a wide range of synthetic and real world data. As discussed in Sec.~\ref{sec:rel}, there exist no direct competitors to \textsc{\algname}\xspace. Traditional pattern mining and motif discovery methods `simply' mine all patterns satisfying some constraints. For summarising sequential data, most existing methods consider univariate data~\cite{tatti:12:sqs,lam:12:gokrimp}. The only summarisation approach for multivariate sequential data considers the special case where attributes are ordered (e.g.\ frequency bands)~\cite{bertens:14}, whereas we consider multivariate sequential data in general. We empirically compare \textsc{\algname}\xspace to \textsc{Sqs}~\cite{tatti:12:sqs}. We do so by applying \textsc{Sqs} to each univariate sequence $S^j \in D$, combining these results into one pattern set.
\subsection{Synthetic Data}
To validate whether \textsc{\algname}\xspace correctly identifies true multivariate sequential patterns from a dataset, we first consider synthetic data. In particular, we generate random data in which we plant a number of randomly generated patterns of different characteristics. Clearly, ideally the true patterns are recovered. Moreover, ideally no other, spurious patterns that are only due to noise are returned. To this end we perform an extensive set of experiments varying the number of events, the number of attributes and the alphabet size of the dataset, and the number, frequency and size of the planted patterns.
\subsubsection*{Data Generation}
As noted in Table~\ref{tab:syn}, for each experiment we generated $t(D)$ random multi-events on $|A|$ attributes (i.e.\ a total of $||D||$ events) with an alphabet size per attribute of $|\Omega_i|$. Further, after the data generation $|\P|$ patterns are planted, where each pattern $X$ has a size $||X||$, a 5\% chance on a gap between subsequent multi-events, and a support such that each pattern spans $\mathit{support}$\% of all events in the dataset. An example of an insertion of a pattern in a random dataset that does not lead to an actual occurrence of that pattern is when due to the gap chance the minimal window of the pattern contains too many gaps. We do not allow patterns to overwrite each other during generation, as this makes evaluation much more complicated -- i.e.\ it becomes unclear whether not recovering a pattern is an artefact of the search or of the data generation process. Further, only for experiments with 50 attributes, we prevented that pattern occurrences interleave and did not allow an event to be used in more than one pattern to assure that the planted patterns are actually present in the data. This restriction is justified because we are merely testing whether our algorithm is able to find multivariate patterns in multivariate data and without it patterns will easily crowd each other because of the high number of attributes.
\subsubsection*{Evaluation}
We evaluate the quality of the pattern set discovered by considering how close they represent the planted patterns. In particular, following~\cite{webb:14:selfsufs} we consider both exact ($=$) and subset ($\subset$) matches. Exact indicates that the pattern exactly corresponds with a planted pattern, whereas subset implies that it is only part of a planted pattern.
In addition, we consider how well the planted patterns are recovered; we report how many of the events of the ground truth pattern set $\P$ we can cover with the discovered patterns. The higher this ratio, the better this result. Last, we consider the gain in compression of the discovered model over the initial, Standard Code Table. The higher this number, the better -- the best score is attained when we recover all patterns exactly, and no further noise.
\subsubsection*{Results}
We first consider the traditional approach of mining all (closed) frequent multivariate patterns. We do so using the implementation of Tatti and Cule~\cite{tatti:11:multievent}. We use a minimal support of 90\% of the lower-support planted pattern. This choice is made to ensure that even when not all insertions of a pattern result in an actual occurrences, it can still be discovered. For the most simple synthetic dataset we consider, corresponding to the first row of Table~\ref{tab:syn}, this takes a few days, finally reporting a \emph{lower bound} of 14\,092\,944\,394 frequent patterns, and returning 6\,865 closed frequent patterns -- hardly a summary, knowing there are only 5 true patterns. In the remainder we therefore do not consider traditional pattern mining.
Next, we consider \textsc{\algname}\xspace and \textsc{Sqs}\xspace. We report the results in Table~\ref{tab:syn}. On the right hand side of the table we see that \textsc{\algname}\xspace recovers all planted patterns, and does not report a single spurious pattern (!). In all cases it recovers the ground truth model, and obtains the best possible gain in compression. Next to the exactly identified planted pattern sometimes it also identifies some subsets of the planted patterns. This is a result of the data generation, i.e. subsets are sometimes included in the code table when planted occurrences contain too many gaps to be covered with the exact pattern.
The patterns \textsc{Sqs}\xspace discovers, on the other hand, are only small univariate fragments of the ground truth, recovering roughly only 10\% to 30\% of the ground truth. The near-zero gains in compression corroborate it is not able to detect much structure.
Regarding runtime and scalability, \textsc{\algname}\xspace scales very favourably. Although \textsc{Sqs}\xspace is faster it considers only the much simpler case of univariate data and patterns. \textsc{\algname}\xspace requires seconds, up to a few minutes for the largest data, even for very low minimal support thresholds. Analysing the runtime of \textsc{\algname}\xspace in more detail show how well its heuristics work; most time is spent on computing the minimal windows for candidates, of which up to ten thousand are materialised. Only for a few hundred of these a full cover of the data is required to evaluate their contribution to the model. Smart implementation for computing the minimal windows of all candidates in one pass will hence likely speed up \textsc{\algname}\xspace tremendously.
\begin{table*}[h]
\centering
\caption{\textsc{\algname}\xspace discovers all planted patterns on all synthetic datasets, without picking up on noise. Given are the base statistics of the synthetic datasets, and the results of \textsc{Sqs}\xspace and \textsc{\algname}\xspace.
For \textsc{Sqs}\xspace and \textsc{\algname}\xspace we give the number of exactly recovered patterns ($=$) and the number of discovered patterns that are subsets of planted patterns ($\subset$). Further, we report how much of the ground truth is recovered ($R\%$), as well as the gain in compression over the singleton-only model ($L\%$), for both higher is better. Last, we give the runtime in seconds.}
\label{tab:syn}
\begin{tabular}{rrrr rrr rrrrr rrrrr}
\toprule
\multicolumn{4}{l}{\textbf{Data}} &
\multicolumn{3}{l}{\textbf{Planted Patterns}} &
\multicolumn{5}{l}{\textbf{\textsc{Sqs}\xspace}} &
\multicolumn{5}{l}{\textbf{\textsc{\algname}\xspace}} \\
\cmidrule(lr){8-12}
\cmidrule(lr){13-17}
\cmidrule(r){1-4}
\cmidrule(lr){5-7}
$||D||$ & $t(D)$ & $|A|$ & $|\Omega_i|$ &
$|\P|$ & $||X||$ & $\mathit{support}$ &
$=$ & $\subset$ & $R\%$ & $\Delta L\%$ & time &
$=$ & $\subset$ & $R\%$ & $\Delta L\%$ & time \\
\midrule
$100\,000$ & $10\,000$ & $10$ & $100$ & $5$ & 3--7 & $1\%$ & 0 & 1 & 9.5 & 0.1 & 3 & 5 & 0 & 100.0 & 3.0 & 2 \\
$100\,000$ & $10\,000$ & $10$ & $100$ & $5$ & \textbf{5}& $\mathbf{10\%}$ & 0 & 0 & 0 & 0 & 3 & 5 & 5 & 100.0 & 31.6 & 31 \\
$100\,000$ & $10\,000$ & $10$ & $\mathbf{1\,000}$ & $5$ & 3--7 & $1\%$ & 0 & 1 & 8.0 & 0 & 12 & 5 & 0 & 100.0 & 2.9 & 4 \\
$100\,000$ & $10\,000$ & $10$ & $100$ & $\mathbf{20}$ & 3--7 & $1\%$ & 0 & 9 & 19.5 & 0.9 & 4 & 20& 0 & 100.0 & 12.9 & 15\\
$500\,000$ & $10\,000$ & $\mathbf{50}$ & $100$ & $5$ & 3--7 & $1\%$ & 0 & 0 & 0 & 0 & 15 & 5 & 1 & 100.0 & 3.1 & 41\\
$500\,000$ & $\mathbf{50\,000}$ & $10$ & $100$ & $5$ & 3--7 & $1\%$ & 0 & 1 & 10.0 & 0.2 & 4 & 5 & 0 & 100.0 & 3.1 & 28 \\
$1\,000\,000$ & $\mathbf{100\,000}$ & $10$ & $100$ & $5$ & 3--7 & $1\%$ & 0 & 4 & 31.8 & 0.3 & 4 & 5 & 14& 100.0 & 3.3 & 374 \\
\bottomrule & & & & & & &
\end{tabular}
\end{table*}
\subsection{Real World Data}
As case studies we consider 4 datasets. An ECG sensor dataset, a structural integrity sensor dataset of a Dutch bridge, the text of the novel Moby Dick tagged with part-of-speech tags, and a multilingual text of an European Parliament resolution. See Table~\ref{tab:realprop} for their characteristics.
\begin{table*}[h]
\centering
\caption{Results on 4 real datasets. We give the basic statistics, as well as the number of patterns and relative gain in compression for both \textsc{Sqs}\xspace and \textsc{\algname}\xspace. The high compression gains show that \textsc{\algname}\xspace discovers much more relevant structure than \textsc{Sqs}\xspace.}
\begin{tabular}{l rrrrr rrr rrr}
\toprule
\multicolumn{6}{l}{\textbf{Data}} & \multicolumn{3}{l}{\textbf{\textsc{Sqs}\xspace}} & \multicolumn{3}{l}{\textbf{\textsc{\algname}\xspace}}\\
\cmidrule(r){1-5}
\cmidrule{7-9}
\cmidrule(l){10-12}
Dataset & $t(D)$ & $|D|$ & $|A|$ & $|\Omega|$ & $\mathit{support}$ & $|\P|$ & $\Delta L\%$ & time ($s$) & $|\P|$ & $\Delta L\%$ & time ($s$) \\
\midrule
ECG & $2\,999$ & 1 & 2 & 6 & 10 & 57 & 38.8 & 1 & 11 & \textbf{75.3} & 360 \\
Bridge & $5\,000$ & 1 & 2 & 10 & 100 & 21 & 58.8 & 1 & 22 & \textbf{76.3} & 325 \\
Moby Dick & $2\,248$ & 103 & 2 & 887 & 5 & 20 & 1.7 & 3 & 79 & \textbf{14.3}& 102 \\
Text & $5\,960$ & 115 & 3 & $4\,250$ & 10 & 35 & 1.6 & 12& 51 & \textbf{2.2} & 136 \\
\bottomrule &
\end{tabular}
\label{tab:realprop}
\end{table*}
\paragraph{ECG}
To investigate whether \textsc{\algname}\xspace can find meaningful patterns on real-valued time series we consider a well-known ECG dataset.\!\footnote{ECG -- \url{physionet.org/physiobank/database/stdb}}
For ease of presentation, and as our main goal is to show that \textsc{\algname}\xspace can discover multivariate patterns, we consider only two sensors.
As preprocessing steps we applied 3 transformations: we subsampled the data, we transformed it from absolute to relative, and we discretised it using SAX~\cite{lin:07:sax}.
For the subsampling we replaced each 5 subsequent values with their average, thus creating a sequence 5 times shorter. Thereafter, we transformed the absolute data into relative data by replacing each value by the difference of its successor and its own value. Lastly, we discretised each attribute into 3 intervals using \textsc{sax}\xspace.
Using a minimum support of 10, within 360 seconds \textsc{\algname}\xspace discovers a code table containing 11 non-singleton patterns that capture the main structure of the data. In Figure~\ref{fig:ecg-zoom} we plotted 2 occurrences of the top ordered pattern of this code table. This is a multivariate pattern which shows a very characteristic repeating structure in the data comprising a longer flat line ending with a peak on both attributes simultaneously. Showing the power of our pattern language, note that the pattern does not define any values on the second attribute for the first and second-last time steps (indicated with arrows in Figure~\ref{fig:ecg-zoom}), while it does on the first attribute. This flexibility allows us to use this multivariate pattern to describe a larger part of the data.
Like for the synthetic data, we also ran \textsc{Sqs}\xspace. Again we see that as it cannot reward multivariate structure it does not obtain competitive gains in compression. Close inspection shows it returns many small patterns, identifying consecutive values.
\begin{figure}[t]
\centering
\includegraphics[width=0.48\textwidth]{Fig8}
\caption{The top ordered pattern for the ECG data in the code table (left) and its first 2 occurrences in the data (right). The first time step of an occurrence is marked in green, subsequent ones in blue, and the last in red.
}
\label{fig:ecg-zoom}
\end{figure}
\newpage
\paragraph{Bridge}
\label{subsec:infra}
Next we consider the setting of monitoring the structural integrity of a bridge in the Netherlands.\!\footnote{Bridge -- \url{infrawatch.liacs.nl}} Amongst the collected sensor data are the strain, vibration and temperature. We selected 2 strain sensors (1 Hz) on consecutive pillars of the bridge and decomposed the signals into low, medium and high frequency components using techniques from \cite{vespier:12:timeseries}. We used the medium frequency components, after preprocessing, as our dataset.
As preprocessing, we transformed the absolute values into relative values by replacing each value by the difference of its successor and its own value. We then discretised each z-normalised attribute into 5 intervals using \textsc{sax}\xspace \cite{lin:07:sax}.
For a support threshold of 100, it takes \textsc{\algname}\xspace 325 seconds to discover a code table with 22 non-singleton patterns. Although only one more than \textsc{Sqs}\xspace at the same threshold, the patterns \textsc{\algname}\xspace discovers are more descriptive. That is, they are multivariate and larger, leading to a much higher gain in compression. Moreover, the patterns it discovers correctly show the correlation between the attributes, whereas the patterns \textsc{Sqs}\xspace discovers only identify univariate patterns.
\paragraph{Moby Dick}
For more interpretable results, we next evaluated on text data. In particular we considered the first chapter of the book Moby Dick, written by Herman Melville,\!\footnote{\url{www.gutenberg.org}} aligning the text with part-of-speech tags.\!\footnote{http://nlp.stanford.edu/software/tagger.shtml}\footnote{https://gate.ac.uk/wiki/twitter-postagger.html} That is, one attribute comprises a stream of the words used in the book; each sentence is regarded as a sequence. The other attribute contains the tags that identify the type and function of each of these words. For example,
\begin{center}
\begin{tabular}{lccc}
\textbf{attribute 1:} & VB & PRP & NNP\\
\textbf{attribute 2:} & Call & me & Ishmael\\
\end{tabular}
\end{center}
for which we will further use the following notation, where each time step is enclosed by curly brackets and the symbols for different attributes within a time step are divided by a comma: \{VB, Call\}\{PRP, me\}\{NNP, Ishmael\}. A short description for the part-of-speech tags in this example can be found in Table~\ref{tab:pos}.
With a support threshold of 5, it takes \textsc{\algname}\xspace 102 seconds to discover 79 non-singleton patterns. After studying the resulting pattern set we found that the identified patterns show highly intuitive multivariate structure. The highest ordered patterns together with examples of text fragments that match these patterns are shown in Table~\ref{tab:md}.
\begin{table}[h]
\centering
\caption{The highest ordered patterns in the code table for the Moby Dick dataset, together with example fragments of from the text which correspond to the patterns.}
\begin{tabular}{ll}
\textbf{Pattern} & \textbf{Example text fragments} \\
\{TO, to\}\{VB\}\{DT, a\}\{NN\} & to get a broom, to buy (him) a coat\\
\{DT, the\}\{JJ\}\{NN\} & the green fields, the poor poet\\
\{DT, a\}\{JJ\}\{NN\} & a mazy way, a hollow trunk \\
\{DT, the\}\{JJ\}\{NNS\} & the wild conceits, the old (sea-)captains\\
\{PRP, i\}\{RB\}\{VB\} & I quietly take, I always go\\
\{EX, there\}\{VBZ, is\} & there is\\
\end{tabular}
\label{tab:md}
\end{table}
\begin{table}[h]
\centering
\caption{A short description of the part-of-speech tags used in the examples in this paper for the Moby Dick experiment.
}
\begin{tabular}{ll}
\textbf{Tag} & \textbf{Explanation} \\
DT & Determiner \\
EX & Existential \emph{there} \\
JJ & Adjective\\
NN & Noun, singular or mass\\
NNP & Proper noun, singular\\
NNS & Noun, plural\\
PRP & Personal pronoun \\
RB & Adverb\\
TO & \emph{to} \\
VB & Verb, base form\\
VBZ & Verb, 3rd person singular present \\
\end{tabular}
\label{tab:pos}
\end{table}
Given the modest compression gain that \textsc{Sqs}\xspace obtains, see Table~\ref{tab:realprop}, it is clear there is not much structure in each of the attributes separately; \textsc{\algname}\xspace, however, is able to find a significant amount of multivariate structure.
\paragraph{Multilingual Text}
As a final experiment, to further corroborate whether \textsc{\algname}\xspace discovers meaningful and interpretable multivariate patterns, we consider mining patterns between the same text in different languages. To this end we collected a text in English, French and German from the European Parliament register of documents.\!\footnote{Text -- \url{www.europarl.europa.eu/RegistreWeb}} In this data we expect frequent combinations of words within one (or more) language(s), as well as (and of more interest), multivariate patterns in the form of translations between the languages. As a preprocessing step all text data was stemmed and stop words were removed. To keep the different languages aligned we regarded every paragraph as a subsequence and padded shorter aligned subsequences with sentinel events which are ignored by \textsc{\algname}\xspace. This ensures that the difference in length of the sentences in different languages will not lead to very big misalignments.
For a support threshold of 10, \textsc{\algname}\xspace takes 136 seconds to discover 51 non-singleton patterns. The highest ordered pattern, i.e.\ the one that aids compression most, is a translation pattern; it identifies the correct relation between the French word \emph{rel\`{e}ve}, the German phrase \emph{stellt fest dass} and the English word \emph{note}. Other high ordered patterns are the English \emph{EUR ($x$) million} and the German \emph{($x$) Millionen EUR}, and the words \emph{parliament}, \emph{Parlament} and \emph{parlement} in English, German and French, respectively.
The modest compression gain of \textsc{\algname}\xspace over \textsc{Sqs}\xspace, see Table~\ref{tab:realprop}, indicates this data is not very structured, neither univariately, nor multivariately. One of the reasons being the different order of words between different languages which results in very large gaps between translation patterns.
\section{Introduction} \label{sec:intro}
Most real sequential data is multivariate, as when we measure data over time, we typically do so over multiple attributes.
Examples include sensors in a network, frequency bands in seismic or ECG data, transaction records, and annotated text. In this paper we investigate how to succinctly summarise such data in terms of those patterns that are most characteristic for the data.
To capture these characteristics, our pattern language needs to be rich, i.e., patterns may span multiple aligned sequences (attributes) in which no order between these attributes is assumed and occurrences may contain gaps. For example, if we consider a sensor network, a pattern could be a characteristic set of values for multiple attributes at one point in time, or, more complex, a specific value for one sensor, temporally followed by certain readings of one or more other sensors. That is, patterns that are able to identify associations and correlations between one or multiple attributes.
Having such a rich pattern language has as immediate consequence that the well-known frequent pattern explosion hits particularly hard. Even for trivial data sets one easily finds enormous numbers of frequent patterns, even at modest minimal frequency thresholds~\cite{tatti:11:multievent}; the simplest synthetic dataset we consider contains only five true patterns, yet the \emph{lower bound} on the number of frequent patterns is more than a billion.
Clearly, returning collections of such magnitude is useless, as they cannot be inspected in any meaningful way. Rather, we want a small set of such patterns that collectively describe the data well. To find such sets, we employ the Minimum Description Length (MDL) principle \cite{grunwald:07:book}. This approach has a proven track record in the domain of transaction data mining \cite{vreeken:11:krimp,smets:12:slim} and has also been successfully applied to, e.g.\ sequential data \cite{tatti:12:sqs,lam:12:gokrimp}. Because complex multivariate sequential data is ubiquitous and correlation between multiple sequences can give much insight to domain experts, here we take this research further by defining a framework to summarise this data, while able to efficiently deal with the enormous space of frequent patterns. Note that, all real-valued time series can easily be discretised to fit our framework, for example using SAX~\cite{lin:07:sax}.
The humongous number of frequent patterns makes it intractable to discover a small set of characteristic patterns by post-processing the set of all frequent patterns; all the more because the MDL objective function on pattern sets is neither monotone nor sub-modular. Hence we introduce a heuristic algorithm, called \textsc{\algname}\xspace,\!\footnote{The ditto mark (") is used in lists to indicate that an item is repeated, i.e., a multivariate pattern.} that mines characteristic sets of patterns directly from the data. In a nutshell, \textsc{\algname}\xspace mines good models by iteratively adding those patterns to the model that maximally reduce redundancy. That is, it iteratively considers the current description of the data and searches for patterns that most frequently occur one after the other, and considers the union of such pairs as candidates to add to the model. As such, \textsc{\algname}\xspace focusses on exactly those patterns that are likely to improve our score, pruning large parts of the search space, and hence only needs seconds to mine high-quality summaries.
Our extensive empirical evaluation of \textsc{\algname}\xspace shows it ably discovers succinct summaries that contain the key patterns of the data at hand, and, importantly, that it does not pick up on noise. An example of what we discover includes the following. When applied to the novel Moby Dick by Herman Melville, on the topic of whaling, the summary \textsc{\algname}\xspace discovers consists of meaningful non-trivial linguistic patterns including ``$\langle \text{noun} \rangle \text{ of the } \langle \text{noun} \rangle$", e.g.\ ``Man of the World'', and ``the $\langle \text{noun} \rangle$ of", as used in "the ship of (somebody)". These summaries hence give clear insight in the writing style of the author(s). Besides giving direct insight, the summaries we discover have high downstream potential. One could, for example, use them for comparative analysis~\cite{budhathoki:15:diffnorm}. For example, for text identifying similarities and differences between authors, for sensor networks detecting and describing concept drift over time, and characterising differences between patients. Such analysis is left for future work, as we first have to be able to efficiently discover high quality pattern-based summaries from multivariate sequential data. That is what we focus on in this paper.
The remainder of this paper is organised as follows. We first cover preliminaries and introduce notation in Section~\ref{sec:pre}. In Section~\ref{sec:the} we formally introduce the problem. Section~\ref{sec:alg} gives the details of the \textsc{\algname}\xspace algorithm. We discuss related work in Section~\ref{sec:rel}, and empirically evaluate our score in Section~\ref{sec:exp}. We round up with discussion and conclusions in Sections~\ref{sec:dis} and \ref{sec:con}, respectively.
\section*{Acknowledgments}
The authors wish to thank Kathrin Grosse for her help with and analysis of the part-of-speech tagged text experiments.
Roel Bertens and Arno Siebes are supported by the Dutch national program COMMIT.
Jilles Vreeken is supported by the Cluster of Excellence ``Multimodal Computing and Interaction'' within the Excellence Initiative of the German Federal Government.
\balance
\bibliographystyle{abbrv}
\section{Preliminaries and Notation} \label{sec:pre}
As data type we consider databases $D$ of $|D|$ multivariate event sequences $S \in D$, all over attributes $A$.
We assume that the set of attributes is indexed, such that $A_i$ refers to the $i^{th}$ attribute of $D$.
A multivariate, or \emph{complex}, event sequence $S$ is a bag of $|A|$ univariate event sequences, $S = \{S_1, \ldots, S_{|A|}\}$. An event sequence $S_i \in \Omega_i^n$ is simply a sequence of $n$ events drawn from discrete domain $\Omega_i$, which we will refer to as its \emph{alphabet}. An event is hence simply an attribute--value pair. That is, the $j^{\mathit{th}}$ event of $S^i$ corresponds to the value of attribute $A_i$ at time $j$. We will write $\Omega$ for the union over these attribute alphabets, i.e.\ $\Omega = \displaystyle \cup_{i \in |A|} \Omega_i$.
By $||S||$ we indicate the number of events in a multivariate sequence $S$, and by $t(S)$ the length of the sequence, i.e.\ the number of time steps. We will refer to the set of events at a single time step $j$ as a \emph{multi-event}, writing $S[j]$ for the $j^{\mathit{th}}$ multi-event of $S$. To project a multivariate event sequence $S$ onto an individual attribute, we write $S^j$ for the univariate event sequence on the $j^{th}$ attribute, and analogously define $D^j$. For completeness, we define $||D|| = \sum_{S \in D} ||S||$ for the total number of events, and $t(D) = \sum_{S} t(S)$ for the total number of time steps in $D$.
Our framework fits both categorical and transaction (item set) data. With categorical data the number of events at each time step is equal to the number of attributes.
For simplicity, w.l.o.g., we consider categorical data in the remainder.
As patterns we consider partial orders of multi-events, i.e. sequences of multi-events, allowing for gaps between time steps in their occurrences. By $t(X)$ we denote the \emph{length} of a pattern $X$, i.e.\ the number of time steps for which a pattern $X$ defines a value.
In addition, we write $||X||$ to denote the \emph{size} of a pattern $X$, the total number of values it defines, i.e.\ $ \sum_{X[i] \in X} \sum_{x \in X[i]} 1$. For example, in Figure~\ref{fig:pat} it holds that $||X|| = 4$ and $t(X) = 3$.
We say a pattern $X$ is \emph{present} in a sequence $S \in D$ of the data when there exists an interval $[t_{start}, \cdots, t_{end}]$ in which all multi-events $X[i] \in X$ are contained in the order specified by $X$, allowing for gaps in time. That is, $\forall_{X[i] \in X} \exists_{j \in [start,end]} X[i] \subseteq S[j]$, and $k \ge j+1$ for $X[i] \subseteq S[j]$ and $X[i+1] \subseteq S[k]$. A singleton pattern is a single event $e \in \Omega$ and $\P$ is the set of all non-singleton patterns. A minimal window for a pattern is an interval in the data in which a pattern occurs which can not be shortened while still containing the whole pattern~\cite{tatti:09:signifeps}. In the remainder of this paper when we use the term pattern occurrence we always expect it to be a minimal window.
Further, we use $\occs(X,S)$ for the disjoint set of all occurrences of $X$ in $S$.
Figure~\ref{fig:pat} shows examples of two categorical patterns occurring both with and without gaps.
\begin{figure}[h]
\begin{center}
\includegraphics[width=0.48\textwidth]{Fig1}
\end{center}
\caption{Patterns $X$ and $Y$ occurring with ($D_{\mathit{gap}}$) and without ($D_{\mathit{no\ gap}}$) gaps in the data.}
\label{fig:pat}
\end{figure}
Our method operates on categorical data. To find patterns in continuous real-valued time series we first have to discretise it. \textsc{sax}\xspace \cite{lin:07:sax} is a celebrated approach for doing so, and we will use it in our experiments -- though we note that any discretisation scheme can be employed. This ordinal data can either be represented by absolute values per time step, or by relative values that represent the difference between each pair of subsequent values. These relative values describe the changes in the data rather than the exact values -- by which different types of patterns can be discovered.
\section{Related Work} \label{sec:rel}
The first to use MDL to summarise transaction data were Siebes et al.\ \cite{siebes:06:item}, resulting in \textsc{Krimp} \cite{vreeken:11:krimp}. It shifted focus from the long-standing goal of mining collections of patterns that describe the set of all frequent patterns, e.g.\ closed \cite{pasquier:99:discovering} frequent patterns, to a \emph{pattern set} that describes the data.
Similar to the transaction data domain, summarisation of sequential data also developed from frequent pattern mining. For sequential data, the key types of patterns studied are frequent subsequences~\cite{pei:04:pspan}, and frequent episodes~\cite{agrawal:95:mining,mannila:97:discovery}. As with all traditional pattern mining approaches, redundancy is also a key problem when mining sequential patterns~\cite{wang:04:bide,he:11:dasfaa}. To this end, Tatti and Vreeken \cite{tatti:12:sqs} proposed to instead approximate the MDL-optimal summarisation of event sequence data using serial episodes. Their method \textsc{Sqs} deals with many challenges inherent to this type of data, such as the importance of the order of events and the possibility for patterns to allow gaps in their occurrences -- aspects we build upon and extend. Other methods exist, but either do not consider \cite{bathoorn:06:freqpatset,mannila:00:global} or do not punish gaps \cite{lam:12:gokrimp,lam:14:seq} with optimal codes. None of these methods consider, or are easily extended to multivariate sequential data.
One of the first to consider multivariate sequential patterns, by searching for multi-stream dependencies, were Oates et al.\ \cite{oates:96:structure}. Tatti and Cule~\cite{tatti:11:multievent} formalised how to mine the set of closed frequent patterns from multivariate sequential data, where patterns allow simultaneous events. In \cite{wu:13:utility} the mining of high utility sequential patterns is studied, where they allow simultaneous events. Chen et al.\ \cite{chen:10} and Moerchen et al.\ \cite{morchen:07} study mining interval-based patterns, where frequency is determined by how often univariate patterns co-occur within a given interval. All these methods are traditional pattern mining techniques in the sense that they return all patterns that pass an interestingness threshold.
Whereas traditional pattern mining techniques often only consider discrete data, there does exist extensive literature on mining patterns in continuous valued time series. These patterns are often called `motifs' \cite{lin:02:motifs,chiu:03:motifs}. For computational reasons, many of these methods first discretise the data~\cite{lin:07:sax}. Most motif discovery algorithms consider only univariate data. Example proposals for motif discovery in a multivariate setting include that by Tanaka et al.\ \cite{tanaka:05:mdlmotif}, who first transform the data into one dimension before the pattern discovery process and do not consider gaps, and by \cite{minnen:07:detecting}, who do not allow patterns to temporally overlap even if they span different dimensions and do not consider variable-length motifs. More recently Vespier et al.\ \cite{vespier:13:mcm}, mine characteristic multi-scale motifs in sensor-based time series but aim at mining all motifs, not a succinct summary.
To the best of our knowledge there are no methods yet to summarise \emph{multivariate} sequential data, other than regarding each attribute separately or with restrictions on the pattern language \cite{bertens:14}. In this work we introduce \textsc{\algname}\xspace to discover important sequential associations between attributes by mining succinct summaries using rich multivariate patterns.
\section{Theory} \label{sec:the}
In this section we give a brief introduction to the MDL principle, we define our objective function, and analyse the complexity of the optimization problem.
\subsection{MDL Introduction}\label{sec:the:mdl}
The Minimum Description Length principle (MDL) \cite{grunwald:07:book} is a method for inductive inference that aims to find the best model for the data. It is based on the insight that any regularity in the data can be used to compress the data and the more we can compress, the more regularity we have found. More formally, given a set of models $\mathcal{M}$, the best model $M \in \mathcal{M}$ is the one that minimises
\[
L(M) + L(D \mid M)
\]
where $L(M)$ is the length of the description of $M$, and $L(D \mid M)$ is the length of the description of the data.
To use MDL, we have to define how our model looks and how we can use it to describe the data. That is, we need to be able to encode and decode the data using our model.
\subsection{MDL for Multivariate Sequential Data} \label{sec:the:score}
As models for our data we consider code tables ($\mathit{CT}$) \cite{vreeken:11:krimp,tatti:12:sqs}; these are simple four-column look-up tables (or, dictionaries) between patterns on the left hand side, and associated codes on the right hand side. In this paper we consider three types of codes, i.e.\ pattern codes, gap codes and fill codes. We will explain the use of these below, in Section~\ref{subsec:enc} and Example~2.
Loosely speaking, whenever we read a pattern code $\mathit{code}_\mathit{p}(X \mid \mathit{CT})$ we know we can start to decode the events of pattern $X$. A fill code $\mathit{code}_\mathit{f}(X \mid \mathit{CT})$ tells us we can decode the next time step of pattern $X$, whereas a gap code $\mathit{code}_\mathit{g}(X \mid \mathit{CT})$ tells us there is a gap in this occurrence of pattern $X$. To fill such a gap we read the next pattern code. Note that, our approach thus allows for patterns to interleave. For readability, we do not write $\mathit{CT}$ wherever clear from context.
To make sure we can encode any multivariate event sequence over $\Omega$, we require that a code table at least contains all singleton events.
Next, we will describe how to use these code tables to cover and encode a dataset. Further, we define how to compute $L(\mathit{CT})$ and $L(D \mid \mathit{CT})$ and we conclude with our formal problem definition.
\subsubsection{Covering} \label{subsec:cover}
A cover determines where we use each pattern when encoding a dataset and also where gaps in patterns occur. More formally, a cover $\C$ defines the set of all pattern occurrences that are used to cover the complete dataset. Therefore, if one of the events from pattern occurrence $o$ is already covered by another pattern occurrence $o' \in \C$ we say that the occurrence $o$ \emph{overlaps} with the current cover $\C$, i.e. $\C \cap o \neq \emptyset$, which we do not allow.
As we are after the minimal description, we want to use optimal codes. Clearly, the more often a code is used, the shorter it should be. This, however, creates a non-trivial connection between how often a pattern is used to describe part of the data, and its code length. This, in turn, makes the complete optimisation process, and in particular that of finding a good cover of the data given a set of patterns non-trivial. For the univariate case, we showed~\cite{tatti:12:sqs} that when we know the optimal code lengths we can determine the optimal cover by dynamic programming, and that we can approximate the optimal cover by iteratively optimising the code lengths and the cover. Although computationally expensive, for univariate data this strategy works well. For multivariate data, naively seen the search space grows enormously. More importantly, it is not clear how this strategy can be generalised, as now the usages of two patterns are allowed to temporally overlap as long as they do not cover the same events. We therefore take a more general and faster greedy strategy.
To cover a dataset we need the set of patterns from the first column of a code table $\mathit{CT}$, which we will refer to as $\CS$ (Patterns and Singletons). In Algorithm~\ref{alg:cov} we specify our \textsc{Cover} algorithm, which iterates through $\CS$ in a pre-specified order that we will detail later. For each pattern $X$ the algorithm greedily covers all occurrences that do not overlap with already covered data, and have fewer than $t(X)$ gaps. To bound the number and size of gaps we only allow occurrences where the number of gap positions is smaller than the length of the pattern itself. This avoids gap codes becoming cheaper than fill codes, by which occurrences with more gaps would be preferred over compact occurrences. This process continues until all data is covered. In Figure~\ref{fig:toy1} we show in 3 steps how a $\CS$ is used to cover the example dataset.
\vspace{0.5em}\noindent\textit{Example 1.} In Algorithm~\ref{alg:cov}, we start with an empty cover, corresponding to an uncovered dataset as in the top left of Fig~\ref{fig:toy1}. Next, we cover the data using the first pattern from the $\CS$ (line 1). For each occurrence of the pattern \{$\mev{a}{d}$\} (line 2), we add it to our cover (line 4) when it does not overlap previously added elements and has a limited number of gaps (line 3). In Step 1 of Fig~\ref{fig:toy1} we show the result of covering the data with the pattern \{$\mev{a}{d}$\}. We continue to do the same for the next pattern \{$h,e$\} in $\mathit{CT}$. This gives us the cover as shown in Step 2. With only the singleton patterns left to consider in $\mathit{CT}$ there is only one way to complete our cover by using them for all so far uncovered events. Now all events in the dataset are covered, thus we can break out of our loop (line 6) and return the final cover of Step 3 in Fig.~\ref{fig:toy1} (line 7).
\begin{figure}[t]
\begin{center}
\includegraphics[width=0.48\textwidth]{Fig2}
\end{center}
\caption{Sample data $D$, code table $\mathit{CT}$, and cover $\C$.
}
\label{fig:toy1}
\end{figure}
\begin{algorithm}[t]
\caption{The \textsc{Cover} Algorithm}
\label{alg:cov}
\begin{algorithmic}[1]
\INPUT A sequence $\S$, a set of patterns $\CS$, and $\C=\emptyset$
\OUTPUT A cover $\C$ of $\S \in D$ using $\CS$
\For{each $X \in \CS$ in order} \Comment{see Sec.~\ref{sec:alg} for order}
\ForAll{$o \in \occs(X,S)$} \Comment{all occurrences of $X$}
\If{$\C \cap o = \emptyset$ { \textbf{and} } $t(o) < 2 t(X)$ }
\State $\C \gets \C \cup o$
\EndIf
\EndFor
\If{$\C$ completely covers $\S$}
\State \textbf{break}
\EndIf
\EndFor
\State {\textbf{return}} $\C$
\end{algorithmic}
\end{algorithm}
\subsubsection{Encoding} \label{subsec:enc}
A cover $\C$ specifies how the data will be encoded. Conceptually, we can decompose it into a pattern code stream and a gap code stream. The pattern stream $\Cp$ contains a sequence of pattern codes, $\mathit{code}_\mathit{p}(X)$ for pattern $X \in \mathit{CT}$, used to describe the data, whereas the gap code stream $\Cg$ consists of codes $\mathit{code}_\mathit{g}(X)$ and $\mathit{code}_\mathit{f}(X)$ indicating whether and where a pattern instance contains gaps or not.
To encode a dataset we traverse our dataset from left-to-right and top-to-bottom and each time we encounter a new pattern in our cover we add the code for this pattern to $\Cp$. When moving to the next multi-event in the dataset we add for each pattern, that we already encountered but not yet completely passed by, a gap or fill code to $\Cg$. We choose a gap code for a pattern if the current multi-event does not contain any event from the pattern or a fill code if it does. We are finished when we have encoded all multi-events in the data.
\vspace{0.5em}\noindent\textit{Example 2.} In Figure~\ref{fig:toy2} we show how a cover is translated to an encoding. To encode the first multi-event we first add $\mathit{code}_p(a)$ and then $\mathit{code}_p(Y)$ to $\Cp$. For the second multi-event we add $\mathit{code}_p(X)$ to $\Cp$ and $\mathit{code}_\mathit{g}(Y)$ to $\Cg$, because event $e$ from pattern $Y$ does not yet occur in this multi-event. For the third multi-event we add $\mathit{code}_p(a)$ to $\Cp$, and $\mathit{code}_\mathit{g}(X)$ and $\mathit{code}_\mathit{f}(Y)$ to $\Cg$. Code $\mathit{code}_\mathit{g}(X)$ marks the gap for pattern $X$ and $\mathit{code}_\mathit{f}(Y)$ indicates that event $e$ from pattern $Y$ does occur in this multi-event. The fourth multi-event results in the addition of $\mathit{code}_p(Y)$ to $\Cp$ and $\mathit{code}_\mathit{f}(X)$ to $\Cg$, where the latter marks the presence of event $b$ from pattern $X$ in this multi-event. For the last multi-event we add $\mathit{code}_p(a)$ to $\Cp$ and $\mathit{code}_\mathit{f}(Y)$ to $\Cg$, which completes the encoding.
\begin{figure}[h]
\begin{center}
\includegraphics[width=0.48\textwidth]{Fig3}
\end{center}
\caption{The encoding of the dataset given a cover and $\mathit{CT}$. See Example~2 for more details.}
\label{fig:toy2}
\end{figure}
Using $\Cp$ and $\Cg$ we can compute the actual codes to construct the code table $\mathit{CT}$ corresponding to $\CS$ used to cover the data. We will encode the data using optimal prefix codes~\cite{cover:06:elements}, the length of which we can compute by Shannon entropy. In our case this means that the length of an optimal pattern code for pattern $X$ is the negative log-likelihood of a pattern in the cover \cite{grunwald:07:book}, that is
\[
L(\mathit{code}_\mathit{p}(X \mid \mathit{CT})) = - \log \bigg( \frac{\mathit{usage}(X)}{\sum_{Y \in \mathit{CT}} \mathit{usage}(Y)} \bigg) \quad ,
\]
where $\mathit{usage}(X)$ is the number of times a pattern $X$ is used to describe the data, i.e.\ $\mathit{usage}(X) = |\{Y \in \Cp | Y = \mathit{code}_\mathit{p}(X)\}|$.
Gap and fill code lengths are computed similarly, corresponding to the negative log-likelihood of these codes within the usages of the corresponding pattern. That is, we have
\[
L(\mathit{code}_\mathit{g}(X \mid \mathit{CT})) = - \log \bigg( \frac{\mathit{gaps}(X)}{\mathit{gaps}(X) + \mathit{fills}(X)} \bigg) \quad ,
\]
\[
L(\mathit{code}_\mathit{f}(X \mid \mathit{CT})) = - \log \bigg( \frac{\mathit{fills}(X)}{\mathit{gaps}(X) + \mathit{fills}(X)} \bigg) \quad .
\]
where $\mathit{gaps}(X)$ and $\mathit{fills}(X)$ are the number of times a gap, resp.\ fill-code of pattern $X$ is used in the cover of the data, i.e.\ $\mathit{gaps}(X) = |\{Y \in \Cg \mid Y = \mathit{code}_\mathit{g}(X)\}|$ and analogue for $\mathit{fills}(X)$.
\subsubsection{Encoded Length of Data Given Code Table} \label{sec:enc-db}
Now that we have determined the cover and encoding scheme, we can formalise the calculation of the encoded length of the data given the $CT$. This encoded length is the sum of the encoded length of following terms: the pattern stream, the gap stream, the number of attributes, the number of sequences and the length of each sequence. Formally, we have
\begin{align}
L(D \mid \mathit{CT}) =\ & L(\Cp \mid \mathit{CT}) + L(\Cg \mid \mathit{CT}) + L_{\mathbb{N}}(|A|)\\
&+ L_\mathbb{N}(|D|) + \sum_{S\in D} L_\mathbb{N}(|S|)
\quad ,
\end{align}
where $L_\mathbb{N}$ is the MDL optimal Universal code for integers~\cite{grunwald:07:book} and the encoded length of the pattern and gap stream are simply the code lengths of all codes in the streams,
\begin{align}
L(\Cp \mid \mathit{CT}) =\ \sum_{X \in \mathit{CT}} & \mathit{usage}(X) L(\mathit{code}_\mathit{p}(X))\\
L(\Cg \mid \mathit{CT}) =\ \sum_{X \in \mathit{CT}}^{t(X)>1} & \big[ \mathit{gaps}(X) L(\mathit{code}_\mathit{g}(X))\\
&\ + \mathit{fills}(X) L(\mathit{code}_\mathit{f}(X)) \big] \quad .
\end{align}
\subsubsection{Encoded Length of Code Table} \label{sec:enc-ct}
The encoded length of the code table consists of the following parts. For each attribute $A_j$ we encode the number of singletons and their support in $D^j$. Then we encode the number of non-singleton patterns in the code table, the sum of their usages, and then using a strong number composition their individual usages. Last, we encode the patterns themselves using $L(X \in \mathit{CT})$. We hence have
\begin{align}
L(\mathit{CT} \mid \C) =\ & \sum_{j \in |A|}{\bigg( L_\mathbb{N}(|\Omega_j|) + \log \binom{|D^j|}{|\Omega_j|}\bigg)}\\
&\ + L_\mathbb{N}(|\P| + 1) + L_\mathbb{N}(\mathit{usage}(\P) + 1)\\
&\ + \log \binom{\mathit{usage}(\P)}{|\P|} + \sum_{X \in \P} L(X \in \mathit{CT}) \quad .
\end{align}
For the encoded length of a non-singleton pattern $X \in \mathit{CT}$ we have
\begin{align}
L(X \in \mathit{CT}) =\ & L_\mathbb{N}(t(X))\ + L_\mathbb{N}(\mathit{gaps}(X) + 1)\\
&\ +\ \sum_{t(X)} \log(|A|) + \sum_{x \in X} L(\mathit{code}_\mathit{p}(x \mid \mathit{ST})) \quad ,
\end{align}
where we first encode its length, and its total number of gaps -- note that we can derive the total number of fills for this pattern from these two values. As $L_\mathbb{N}$ is defined for integers $z \geq 1$, we apply a $+1$ shift wherever $z$ can be zero~\cite{grunwald:07:book}.
Then, per time step, we encode for how many attributes the pattern defines a value, and what these values are using the singleton-only, or Standard Code Table ($\mathit{ST}$). For the encoded length of an event given the $\mathit{ST}$ we have
\begin{align}
L(\mathit{code}_\mathit{p}(x \mid \mathit{ST})) = -\log \bigg( \frac{\mathit{support}(x \mid D)}{||D||} \bigg) \quad ,
\end{align}
which is simply the negative log-likelihood of the event under an independence assumption.
\subsection{Formal Problem Definition}
Loosely speaking, our goal is to find the most succinct description of the data. By MDL, we define the optimal set of patterns for the given data as the set for which the optimal cover and associated optimal code table minimise the total encoded length. As such we have the following problem definition.
\vspace{0.5em}
\noindent\textbf{Minimal Pattern Set Problem} \emph{Let $\Omega$ be a set of events and let $D$ be a multivariate sequential dataset over $\Omega$, find the minimal set of multivariate sequential patterns $\P$ and cover $\C$ of $D$ using $\P$ and $\Omega$, such that the encoded length $L(\mathit{CT}, D) = L(\mathit{CT} \mid \C) + L(D \mid \mathit{CT})$ is minimal, where $\mathit{CT}$ is the code-optimal code table for $\C$.}
\vspace{0.5em}
Let us consider how complex this problem is.
Firstly, the number of possible pattern sets (with a maximum pattern length of $n$) is
\[
\sum_{k=1}^{2^{|\Omega|^{n}} - |\Omega| - 1} \binom{2^{|\Omega|^{n}} - |\Omega| - 1}{k} \quad .
\]
Secondly, to use a pattern set to cover the data we also need to specify the order of the patterns in the set. That is, we need to find the optimal order for the elements in the pattern set to find the one that minimises the total encoded length. The total number of ways to cover the dataset using one of the possible ordered pattern sets is
\[
\sum_{k=1}^{2^{|\Omega|^{n}} - |\Omega| - 1} \binom{2^{|\Omega|^{n}} - |\Omega| - 1}{k} \times (k + |\Omega|)! \quad .
\]
Moreover, unfortunately, it does not show submodular structure nor (weak) (anti-)monotonicity properties by which we would be able to prune large parts of it. Hence, we resort to heuristics.
| {'timestamp': '2016-02-11T02:09:22', 'yymm': '1512', 'arxiv_id': '1512.07056', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.07056'} | arxiv |
\section{Introduction}
Wearable sensors have widespread applications in academic, industrial and medical fields. Examples of some current uses are fall detection in medical or home settings \cite{ozdemir2014}, and Human Activity Recognition (HAR) for smart health-monitoring systems \cite{mannini2010}.
A substantial amount of research has been done with professional on-body wearable sensors. However, these devices are usually large, impractical or inconvenient for general commercial purposes. One viable alternative is smartphone sensors. Smartphones are equipped with accelerometers and gyroscopes, which provide rich motion data on their users. Although these sensors are less accurate than professional ones, the prevalence and convenience of smartphones suggests their potential for far-reaching applications. Possible benefits include a decreased need for human supervision in medical settings, more complex human-machine interaction, and complex activity recognition on smartphone applications.
Our objective is an offline implementation of smartphone motion data classification that has comparable classification accuracy and computational efficiency with current techniques, and does not require domain knowledge of HAR.
In this paper, we propose a method based on Dynamic Time Warping (DTW). DTW has recently been widely used and integrated with other methods such as decision trees \cite{rodriguez2004interval} in machine learning. Although DTW suffers from high computational costs and Dynamic Time Warping Distance (DTWD) is not a distance metric because it lacks the triangle inequality, DTW still has the potential to be a feasible answer to the above task by providing a flexible, easily interpretable time series similarity measure. By modifying DTW to improve on computational efficiency and similarity measure accuracy, we proceed to use it for motion data clustering, activity template construction and classification for our problem. Each template is the time series average representing a cluster. It has the benefit of providing visual representations of a human activity and does not require HAR knowledge for construction.
As such, the primary contributions of this paper are:
\begin{enumerate}
\item Modification of DTW as a similarity measure for time series,
\item Procedure for template extraction in place of feature extraction.
\end{enumerate}
Our implementation enhances the quality of prediction, avoids high dimensionality, and is robust to noise. For demonstration, we use real human activity data, as well as synthetic data constructed from human activity data.
In Section \ref{sec: related work}, we proceed by discussing existing methods for classifying human activities using feature extraction, hierarchical divide-and-conquer strategies, and multi-modal-sequence classification. Section \ref{sec: definitions} formally defines Dynamic Time Warping and Section \ref{sec: dtwsubseq} describes our proposed modifications to increase prediction accuracy. Section \ref{sec: tempclass} discusses our template selection and classification approach which utilizes the modified DTW. In Sections \ref{sec: data} and \ref{sec: results}, we apply our algorithm to both real world data and synthetic data. Finally, in Section \ref{discussion} and onwards, we compare the results of our algorithm with existing algorithms, and conclude.
\section{Related Work}
\label{sec: related work}
Considerable work has been done on classifying human activities. We consolidate works on both professional on-body sensors and smartphone sensors, while taking note that data from the latter may need different pre-processing steps due to higher noise tendencies. Furthermore, on-body sensors can be placed at more assigned locations on the body such as arms and ankles, and may include more components such as magnetometer \cite{ozdemir2014}.
An essential step in many papers is feature extraction. Popular features for such tasks include mean, standard deviation, maximum, peak-to-peak, root-mean-square, and correlation between values of modality axes \cite{varkey2012}. Another suggested option is using autoregressive modeling to form augmented-feature vectors \cite{khan2010}.
Following feature extraction, algorithms used for classification include Hidden Markov Models \cite{mannini2010}, Support Vector Machines \cite{varkey2012}, Multi-layer Perceptron, Naive Bayes, Bayesian Network, Decision Table, Best-First Tree, and K-star \cite{dernbach2012}. Although the strategy can increase classification accuracy, it requires manual grouping of the activities into meaningful categories. Comparative study across these algorithms has also been done \cite{altun2010comparative}.
While feature extraction is quite popular in HAR for achieving high accuracy rates, there are a few problems with feature extraction. First, it is dependent on domain expertise as achieving high accuracy through feature extraction is only possible with the correct features. Second, feature extraction is prone to high dimensionality as a large number of features are needed. Finally computing some of these features such as autoregression coefficients can be computationally intensive.
Current DTW methods on HAR involve aligning human behavior in video data \cite{sempena2011}. These methods use a generalized time warping mechanism to extend DTW to aligning multi-modal sequences \cite{zhou2012}. While our proposed method discussed in Section \ref{sec: dtwsubseq} uses DTW, we recognize that we cannot translate these methods directly for our approach since the data modality is different, and sequences extracted from video data may have different properties from raw sensor readings.
\section{Definitions}
\label{sec: definitions}
In this section, we state our definition and assumptions of time series. We also introduce DTW.
\subsection{Time Series}
\label{sec:TS}
A p-dimensional multivariate time series\\ $X_i = \{X_i(t_l) \in \mathbb{R}^p$; $l =1,\ldots,m \}$ is a sequence of data points where:
\begin{enumerate}
\item $t_l<t_{l'}$ for $l<l'$, \\
\item $t_l \in T=[a,b]$, $\forall l=1,\ldots,m$, \\
\item $X_i(t) \in \mathbb{R}^p, \forall t \in T$.
\end{enumerate}
We assume our training and test data are time series satisfying the assumptions above, with the additional condition that $\Delta t_i = t_i - t_{i-1} = \frac{b-a}{m-1}$. We assume that all series have the same length as observed in most data sets, but the following DTW algorithms can be easily extended to the alternate case.
In the rest of this paper, we will refer to the length of a time series as $m$ and the dimension of each point in the time series as $p$.
\subsection{Dynamic Time Warping (DTW)}
\label{sec: DTW}
DTW is an algorithm for computing the distance and alignment between two time series. It is used in applications such as speech recognition, and video activity recognition \cite{sempena2011}.
\begin{definition} \cite{muller2007}
\label{def: path}
A warping path is a sequence $w=(w_1,\dots,w_{|w|})$ where for $k \in \{1,\dots,|w|\}$, $w_k=(p_k,q_k)$ with $p_k,q_k \in \{1,\dots m\}$, satisfying the following conditions:
\begin{enumerate}
\item Boundary condition: $w_1=(1,1)$, $w_{|w|}=(m,m)$
\item Monotonicity condition: $\{p_k\}_{k=1}^{|w|}$, $\{q_k\}_{k=1}^{|w|}$ are monotonously non-decreasing sequences
\item Continuity condition: \\$w_{k+1}-w_k \in \{(1,0),(0,1),(1,1)\}$\\ for $k \in \{1,\dots,|w|-1\}$
\end{enumerate}
\end{definition}
For simplicity, we write $w=(p,q)$ as a path in accordance with Definition \ref{def: path}
\begin{definition}
\label{def: cost}
For time series $X_i$ and $X_j$ with distance matrix $D$ as calculated in Algorithm \ref{DTW}, for a path $w=(p,q)$, we define the cost $c$ as:
$$
c(w) = \sum_{k=1}^{|w|}D[p_k,q_k]
$$
\end{definition}
\begin{definition}
\label{def: dtwdef}
The Dynamic Time Warping Distance (DTWD) is the sum of the pointwise distances along the optimal path $w^*$, for the cost function defined in Definition \ref{def: cost}.
$$
w^* = \argmin_w c(w), \quad \text{DTWD}\left(X_i,X_j\right) = c(w^*) = D[m,m].
$$
\end{definition}
DTW can be optimized through a bandwidth parameter $bw$, where it computes only values of the matrix close to the diagonal. This version of DTW is called FastDTW \cite{salvador2007toward}. Algorithm \ref{DTW} denotes the procedure to compute DTWD$\left(X_i,X_j; bw\right)$. A small bandwidth should be employed if the two time series demonstrate the same shape and frequency, since a smaller bandwidth brings the computational time closer to $O(m)$.
\begin{algorithm}
\caption{Fast DTW}
\label{DTW}
\KwData{time series $X_i, X_j$, bandwidth bw}
\KwResult{DTWD$\left(X_i,X_j;bw\right)$}
Initialize distance matrix $D = 0_{m\times m}$
$D[1, 1] = |X_i(1)-X_j(1)| $
\For{$s \in \{2,\dots,m\}$}{ $D[s,1] = D[1,s] = \infty$}
\For{$ s\in \{2,\dots,m\}$}{
\For{$t \in \{\max(2, s-bw),\min(m,s+bw)\}$}{
cost=$\min{\left(D[s-1,t],D[s,t-1],D[s-1,t-1]\right)}$
\begin{align*}
D[s,t] =& \left|X_i\left(s\right) - X_j\left(t\right)\right| + \mbox{cost}
\end{align*}
}
}
\textbf{return} $D[m,m]$
\vspace{4mm}
\end{algorithm}
One time series $X_j$ can be aligned to another $X_i$ by using the optimal path defined in Definition \ref{def: dtwdef}. The basic concept of DTW alignment is illustrated in Figure~\ref{fig:1}. DTW first creates a matrix $D$ of pointwise distances depicted as a black and white grid in the image on the right. The algorithm then runs through $D$ from the first index (bottom left) to the last index (top right), enumerates all paths $w$, and finds an optimal warping path $w^*$ as specified in Definition \ref{def: dtwdef}. The optimal warping path is shown as the darkened line in the image on the right, and the alignment between the two series is shown in the image on the left. The algorithm also returns the sum of the pointwise distances along the optimal path \cite{gorecki2015}.
\begin{figure}[h]
\centering
\includegraphics[scale=0.5]{DTWpic.jpg}
\caption{DTW image from \cite{gorecki2015} showing the alignment procedure. The two original time series shown on the left (dotted) and bottom (solid) of the image on the right are shown aligned on the left image according to the optimal path shown as the dark black line on the right.}
\label{fig:1}
\end{figure}
Algorithm \ref{align} is used to align two time series. The algorithm first computes all paths from the distance matrix D, obtains the optimal path, and updates $X_j$ according to that path.
\begin{algorithm}
\caption{Alignment Algorithm using DTWD}\label{align}
\KwData{time series $X_i, X_j$, distance matrix D}
\KwResult{time series $X_j$ aligned to $X_i$}
\For{$ s\in \{2,\dots,m\}$}{
\For{$t \in \{\max(2, s-bw),\min(m,s+bw)\}$}{
\If{$D[s][t-1] \leq D[s-1][t] \text{ and } D[s][t-1] \leq D[s-1][t-1]$}{
$\text{path}[s][t] = (s, t-1)$}
\eIf{$D[s-1][t] \leq D[s-1][t-1]$}
{$\text{path}[s][t] = (s-1, t)$}
{$\text{path}[s][t] = (s-1, t-1)$}
}
}
$w^* = \{\}$\\
\For{$s \in \{1,\dots m\}, t \in \{1, \dots m\}$}{
$w^* = w^* \cup \left\{\underset{s,t}{\argmin}\text{ path}[s][t]\right\}$
}
\For{$p \in w^*$}{
$X_j\left(p[0]\right) = X_j\left(p[1]\right)$
}
\textbf{return} $X_j$
\vspace{4mm}
\end{algorithm}
\iffalse
\begin{enumerate}
\item Initialize $\mathbf{D}$ as a matrix of 0s.
\item Repeat for all $i=1:m$, $j=1:n$.
\begin{enumerate}
\item Compute $cost = s_i - t_j$
\item Compute $update = \min{\left(\mathbf{D}\left[i-1,j\right],\mathbf{D}\left[i-1,j-1\right],\mathbf{D}\left[i,j-1\right]\right)}$
\item Set $\mathbf{D}\left[i,j\right] = cost + update$
\end{enumerate}
\item The DTWD is $D\left[m,n]$.
\end{enumerate}
\begin{algorithm}
\caption{Fast Dynamic Time Warping}\label{DTW}
\KwData{$X_i, X_j$,window size bw}
\KwResult{DTWD$\left(X_i,X_j\right)$}
\State Initialize $D = \mathbf{0_{m\times m}}$
\For{$s \in \{2,\dots,m-$bw$\}$}{ \State $D[s,1] = D[1,s] = \infty$}
\For{$ s\in \{1,\dots,m\}$}{
\For{$t \in \{\max(0, bw-m+s),\min(m,m-t+s)\}$}{
update$=\min{\left(D[s-1,t],D[s,t-1],D[s-1,t-1]\right)}$
\begin{align*}
D[s,t] =& \left|X_i\left(s\right) - X_j\left(t\right)\right| \\
+& \text{update}
\end{align*}
}
}
\State \textbf{return} $D[m,m]$
\end{algorithm}
\fi
\section{Subsequence DTW (DTWsubseq)}
\label{sec: dtwsubseq}
An apparent drawback of DTWD is the overstatement of the dissimilarity between two copies of a time series when one copy is horizontally displaced. DTW cannot match the ends of the two copies without incurring a cost. For instance, a sine curve and cosine curve can be obtained from the same sinusoidal function due to sampling from a long series, but DTWD returns a positive value. This limits the functionality of DTWD as a similarity measure.
To alleviate this, we propose a modification to DTW based on subsequence matching \cite{giorgino2009}. We relax the boundary condition that the optimal path must start at the bottom left $D[1,1]$ and end at the top right $D[m,m]$ of the distance matrix $D$.
Computing all possible paths is computational expensive. To induce computational savings, we introduce a displacement window parameter $dw$, which is the maximum horizontal displacement of the samples. We restrict our search to paths that start and end within the window defined by $dw$. This parameter can be empirically estimated through the distribution of a common landmark in the data. For periodic data, the natural displacement window is the period.
We view similar time series as those having similar shape and frequency. Therefore, at each displacement $k$, we truncate both input series, $X_i$ and $X_j$, to the same length. To obtain a distance with respect to the original length, for the truncated series, $X^k_i$ and $X^k_j$, the resulting DTWD$\left(X^k_i,X^k_j\right)$ is weighed proportionately to their length by
$$
DTWD^k\left(X_i,X_j\right) = \frac{m}{m-k+1}DTWD\left(X^k_i,X^k_j\right)
$$
DTWsubseq, displayed below in Algorithm \ref{DTWsubseq}, is further optimized by imposing a bandwidth as in Fast DTW.
\begin{algorithm}[h]
\caption{Fast DTWsubseq}
\label{DTWsubseq}
\KwData{time series $X_i, X_j$, displacement window dw, bandwidth bw}
\KwResult{DTWsubseqD$\left(X_i,X_j;dw,bw\right)$}
Initialize $optD = \infty$
\For{$k \in \{1,\dots,dw\}$}{
$X^k_i = X_i[k:m]$ \\
$X^k_j = X_j[1:m-k+1]$ \\
$D_k = DTWD^k\left(X_i,X_j;bw\right)$ \\
\If{$D_k<optD$}{$optD = D_k$}
}
\textbf{return} $optD$
\vspace{4mm}
\end{algorithm}
\section{Template Selection and Classification}
\label{sec: tempclass}
\subsection{Overview}
As discussed in Section \ref{sec: related work}, the standard approach to HAR classification first extracts features from the motion data time series, then classifies using these features with well-established algorithms. Working with the raw data in the time domain is preferable if it is sufficiently capable of capturing information about the data. We propose a method based on DTWsubseq and hierarchical clustering, which avoids intensive feature extraction, and can alleviate many of the problems with feature extraction discussed in Section \ref{sec: related work}.
Our approach to classification is to use the training data to build time series templates representing each activity, and subsequently classify the test data according to their similarity to these templates using DTWsubseqD. This type of template-based method is robust to speed and style variations of the subjects' motions, and potentially requires less training data than feature-based methods \cite{sempena2011}.
Before giving details of how to construct templates, we present a general diagram of the full classification procedure illustrated in Figure \ref{fig:workflow}.
\begin{figure}[h]
\centering
\includegraphics[scale=0.25]{Procedure.png}
\caption{Breakdown of the template selection and classification method}
\label{fig:workflow}
\end{figure}
\subsection{Cluster}
For each activity, we use the training set to build clusters. There are two main parts of the clustering step:
\begin{enumerate}
\item Computing the distance matrix by finding the DTWsubseqD between all pairs of points in each activity,
\item Forming clusters in hierarchical clustering by calculating distance between two clusters $C_i$ and $C_j$ is calculated as $$d(C_i,C_j) = \max_{s\in C_i,t\in C_j} DTWsubseqD(s,t),$$ and removing flat clusters by restricting pairwise distances within a cluster to be below $$cut \times \max_{C_i,C_j}d(C_i,C_j).$$
\end{enumerate}
We use hierarchical clustering as our clustering algorithm because of its flexibility in being able to perform with any similarity measure. Decreasing the parameter $cut$ increases the number of clusters for each activity. We show results for different values of $cut$ in Section \ref{sec: results}.
\subsection{Build Templates}
After computing clusters for each activity, we compute the average of a set of time series. We consider two methods for selecting templates: DTW Pointwise Averaging (DPA) and DTW Barycenter Averaging (DBA).
We provide the algorithm for DPA in Algorithm \ref{DPA} and brief descriptions of DBA.
DPA is a straightforward method for computing the average of a set of time series. The algorithm first finds the point with minimum distance to all other time series, aligns each time series to that point, and finally calculates a pointwise average.
\begin{algorithm}
\caption{DTW Pointwise Averaging}\label{DPA}
\KwData{Clusters $C_1, \dots, C_n$}
\KwResult{Templates $T_1,\dots, T_n$}
\For{$i \in \{1,\dots,n\}$}{
$t^* = \underset{t}{\min}\underset{x \in C_i}{\sum}DTWsubseqD\left(x,t\right)$\\
\For{$x \in C_i$}{
$\text{align}(t^*,x)$\\
$T_i = \|C_i\|^{-1} \underset{x \in C_i}{\sum}x$
}
}
\textbf{return} $T_1,\dots, T_n$
\vspace{4mm}
\end{algorithm}
\iffalse
\begin{enumerate}
\item Find $t^*$, the time series in the cluster with minimum distance to all other time series.
\item Repeat for each cluster.
\begin{enumerate}
\item Align* the remaining time series in the cluster to $t^*$.
\item Compute the pointwise average of all time series.
\end{enumerate}
\item The averages for all clusters are the templates.
\end{enumerate}
\fi
DBA is a global method that calculates an average series that minimizes the sum of squared DTW distances to all series in the cluster. In each iteration of the algorithm,
\begin{enumerate}
\item Conduct DTW between the average series and each series in the cluster, and extract associations between the coordinates of the pair.
\item For each coordinate $\alpha$ of the average series, update the corresponding value as the mean corresponding to all coordinates associated with $\alpha$.
\end{enumerate}
Details of the DBA algorithm can be found in \cite{petitjean2011}. DBA is more computationally intensive than DPA, but DBA has been shown to improve classification accuracy in centroid-based methods \cite{petitjean2014}, and hence is included for comparison.
In the aligning and averaging portions of both algorithms, we used DTW instead of DTWsubseq because DTW would return similar warping paths while maintaining the length of the input series.
\subsection{Classify}
\label{classify}
For each training and test sample, we first compute DTWsubseqD to each template. This provides a vector of distances, which is the same size as the number of templates, for each sample. We treat this vector of distances as a feature vector, and proceed by running a dimensionality reduction algorithm (such as PCA) and a classifier (such as SVM) on the DTWsubseqD vectors.
\section{Real World Data and Simulations}
\label{sec: data}
\subsection{UCI HAR Data}
The dataset contains a total of 10,299 samples from 30 subjects conducting six activities in a lab: 3 dynamic activities (walking, walking upstairs, walking downstairs) and 3 static activities (sitting, standing, lying). We used 7,352 samples for training, and the remaining 2,947 samples for testing.
Each reading (time series) is six dimensional with dimensions corresponding to acceleration (in ms${^{-2}}$), and angular velocity (in s$^{-1}$) in the x-y-z axis. The range for the acceleration is $[-1,1]$ and the range for angular velocity is $[-3,3]$.
This data set is already preprocessed as provided by applying noise filters and then sampled in fixed-width sliding windows of 2.56 sec and 50\% overlap (128 readings/window) \cite{anguita2013}. Figure \ref {fig:curves} depicts some curves after preprocessing.
\begin{figure}
\centering
\begin{tabular}{c c}
\includegraphics[scale=0.2]{dynamic_acc0.png} & \includegraphics[scale=0.2]{dynamic_gyr0.png}\\
{\scriptsize Dynamic Activities Acceleration} & {\scriptsize Dynamic Activities Angular Velocity } \\
\includegraphics[scale=0.2]{static_acc0.png} & \includegraphics[scale=0.2]{plot2_gyr.png} \\
{\scriptsize Static Activities Acceleration } & {\scriptsize Static Activities Angular Velocity }
\end{tabular}
\caption{A sample of pre-processed curves from the UCI HAR dataset. Each figure contains 3 plots corresponding to the x,y, and z axis (top to bottom). The top pair of plot has 3 curves corresponding to the dynamic activities: walking (blue), walking upstairs (green), walking downstairs (red), and the bottom pair of plots has 3 curves corresponding to the static activities: sitting (blue), standing (green), lying (red).}
\label{fig:curves}
\end{figure}
Due to the method of sampling, many of the resulting shortened curves in the static activity category are flat curves with no activity, and mis-informative for classification. Since these flat curves provide no additional information, we have removed them. A multidimensional time series will be considered as a flat curve if all of its dimensions are flat. A dimension of the time series is flat if its range (maximum value - minimal value) falls within the 5\% quantile of all ranges of that dimension across all time series. Figure \ref{fig:flat} depicts some curves which have been removed.
\begin{figure}
\centering
\begin{tabular}{c c}
\includegraphics[scale=0.2]{xTrainF_acc5.png} & \includegraphics[scale=0.2]{xTrainF_gyr5.png}\\
{\scriptsize Activity 3 Acceleration} & {\scriptsize Activity 3 Angular Velocity } \\
\iffalse
\includegraphics[scale=0.2]{xTrainF_acc4.png} & \includegraphics[scale=0.2]{xTrainF_gyr4.png} \\
{\scriptsize Activity 4 Acceleration } & {\scriptsize Activity 4 Angular Velocity } \\
\includegraphics[scale=0.2]{xTrainF_acc5.png} & \includegraphics[scale=0.2]{xTrainF_gyr5.png} \\
{\scriptsize Activity 5 Acceleration } & {\scriptsize Activity 5 Angular Velocity }
\fi
\end{tabular}
\caption{A sample of flat curves removed from the UCI dataset from the sitting activity. Each figure contains 3 plots corresponding to the x,y, and z axis (top to bottom). }
\label{fig:flat}
\end{figure}
\subsection{Synthetic Data}
This dataset is created to test the ability of our proposed method to classify time series belonging to new subjects, in the event of noise that may be present in this type of usage of smartphone sensors. In the simulation, we consider short bursts of noise in the observations, due to reasons such as jerky motions, sudden shifts of the sensor, and sensor noise.
Training data is generated from one dimension ($Acc_x$, Acceleration in the x-axis) of a random template, computed from the UCI HAR dataset, from each of the following activities: walking, walking upstairs, walking downstairs, sitting. This can be taken to represent the motion of one subject. Test data is generated from a different random template for each activity, to simulate motions from a different subject.
The training set has a total of 800 samples, 200 for each activity. The test set has 200 samples, 50 for each activity. Each sample is created from the template in the following manner:
\begin{enumerate}
\item $Acc_x$ of the template is extracted and normalized to zero mean and unit variance
\item Concatenate the template to length 256
\item Perform FFT on the resulting series
\item Generate a normally distributed $\mathcal{N}(0,5)$ random vector of length 10 and add it to a random location of the FFT
\item Perform IFFT and retrieve the real part of the result
\item Sample a series of length 128
\end{enumerate}
Figure \ref{fig:syn2} contains two plots corresponding to training and test samples for the same activity. Two curves are plotted to show the effects of adding noise. Each reading (time series) is a one dimensional acceleration (in ms${^{-2}}$). The range for the acceleration is $[-4,4]$.
\begin{figure}
\centering
\begin{tabular}{c c}
\includegraphics[scale=0.2]{Syn2_acc0.png} & \includegraphics[scale=0.2]{Syn2_test_acc0.png}\\
{\scriptsize Training Sample for Walking} & {\scriptsize Test Sample for Walking}
\end{tabular}
\caption{Training and Test Samples from the Synthetic Dataset for Walking}
\label{fig:syn2}
\end{figure}
\section{Results}
\label{sec: results}
In this section, we present the results on the UCI HAR dataset and synthetic data.
We examine templates generated by our method, and additionally study the benefit obtained from using different values of the $cut$ parameter in the clustering stage. We plot templates corresponding to different clusters in the same activity to demonstrate the performance of our clustering and template construction methods. Templates are shown in Figure \ref{fig:templates} and \ref{fig:templatesyn} for both DBA and DPA for the UCI dataset, and synthetic dataset.
\begin{figure}
\centering
\begin{tabular}{c c}
\includegraphics[scale=0.2]{xTrainC_DBA_acc0cluster0.png} & \includegraphics[scale=0.2]{xTrainC_DBA_gyr0cluster0.png}\\
{\scriptsize DBA Cluster 1 Acceleration} & {\scriptsize DBA Cluster 1 Angular Velocity } \\
\includegraphics[scale=0.2]{xTrainC_DPA_acc0cluster0.png} & \includegraphics[scale=0.2]{xTrainC_DPA_gyr0cluster0.png} \\
{\scriptsize DPA Cluster 1 Acceleration } & {\scriptsize DPA Cluster 1 Angular Velocity } \\
\includegraphics[scale=0.2]{xTrainC_DBA_acc0cluster1.png} & \includegraphics[scale=0.2]{xTrainC_DBA_gyr0cluster1.png} \\
{\scriptsize DBA Cluster 2 Acceleration } & {\scriptsize DBA Cluster 2 Angular Velocity } \\
\includegraphics[scale=0.2]{xTrainC_DPA_acc0cluster1.png} & \includegraphics[scale=0.2]{xTrainC_DPA_gyr0cluster1.png} \\
{\scriptsize DPA Cluster 2 Acceleration } & {\scriptsize DPA Cluster 2 Angular Velocity }
\end{tabular}
\caption{UCI HAR Data: Plots for templates constructed from two clusters for walking. Both DBA and DPA are shown for comparison. Each figure contains 3 plots corresponding to the x,y, and z axis (top to bottom).}
\label{fig:templates}
\end{figure}
\begin{figure}
\centering
\begin{tabular}{c c}
\includegraphics[scale=0.20]{Syn2_DBA_acc0cluster0.png} & \includegraphics[scale=0.20]{Syn2_DBA_acc0cluster1.png}\\
{\scriptsize DBA Cluster 1 } & {\scriptsize DBA Cluster 2 } \\
\includegraphics[scale=0.20]{Syn2_DPA_acc0cluster0.png} & \includegraphics[scale=0.20]{Syn2_DPA_acc0cluster1.png} \\
{\scriptsize DPA Cluster 1 } & {\scriptsize DPA Cluster 2}
\end{tabular}
\caption{Synthetic Data: Plots for templates constructed from two clusters for walking $Acc_x$. Both DBA and DPA are shown for comparison.}
\label{fig:templatesyn}
\end{figure}
Classification accuracy is presented in Tables
\ref{lab:accuracyUCI}
and \ref{lab:accuracySyn}. Each table shows the accuracy for all four combinations of distance method (DTW, DTWsubseq) and averaging method (DPA, DBA), and two different values of the $cut$ parameter (0.25, 0.5).
\begin{table}[h!]
\centering
\begin{tabular}{c|c|c}
cut & DTWsubseq with DPA & DTWsubseq with DBA\\
\hline
0.5 & 0.789 (0.946) & 0.777 (0.941)\\
0.25 & 0.838 (0.974) & 0.855 (0.977) \\
\multicolumn{3}{c}{\vspace{5mm}}\\
cut & DTW with DPA & DTW with DBA \\
\hline
0.5 & 0.781 (0.943) & 0.797 (0.937) \\
0.25 & 0.841 (0.966) & 0.860 (0.977)
\end{tabular}
\vspace{4mm}
\caption{Test Accuracy for DTW and DTWsubseq UCI HAR Dataset. Numbers in parentheses are the accuracies after combining all static activities into one activity.}
\label{lab:accuracyUCI}
\end{table}
\begin{table} [h!]
\centering
\begin{tabular}{c|c|c}
cut& DTWsubseq with DPA & DTWsubseq with DBA \\
\hline
0.5& 0.650 & 0.640 \\
0.25& 0.700 & 0.655 \\
\multicolumn{3}{c}{\vspace{5mm}}\\
cut \hspace{-4mm}&\hspace{6mm} DTW with DPA \hspace{0mm} & DTW with DBA \\
\hline
0.5 & 0.615 & 0.620 \\
0.25 & 0.615 & 0.580
\end{tabular}
\vspace{4mm}
\caption{Test Accuracy for DTW and DTWsubseq Synthetic Dataset.}
\label{lab:accuracySyn}
\end{table}
\section{Discussion}
\label{discussion}
\subsection{Comparison with Feature Extraction}
We benchmark our procedure against standard feature extraction methods. We computed 568 features using mean, standard deviation, correlation, RMSE from \cite{varkey2012}, Energy \cite{ravi2005}, average absolute difference \cite{kwapisz2011activity}, largest 5 FFT magnitudes, autocorrelation, kurtosis, skew from \cite{altun2010comparative}, autoregression coefficients \cite{khan2010}, and number of zeros for the original time series, and first difference time series. We also computed the mean, standard deviation, kurtosis, and skew for the magnitudes of the FFT \cite{anguita2013}.
We performed standard classification on these features using PCA for dimensionality reduction and linear SVM as a classifier (same as in Section \ref{classify}). The results for classification on both synthetic data and the UCI dataset are shown in Table \ref{tab:accf}.
\begin{table}[h]
\centering
\begin{tabular}{c | c }
UCI Feature & Synthetic Feature \\
\hline \\
0.890 (0.965) & 0.67
\end{tabular}
\vspace{4mm}
\caption{Accuracy using Feature Extraction. Number in parentheses is the accuracy after combining all static activities into one activity.}
\label{tab:accf}
\end{table}
Before comparing accuracy, we comment on a few advantages our method has over feature extraction. First, our methods have the natural advantage that no domain knowledge is required, compared to the importance of extracting the correct features. In order to achieve high accuracy using feature extraction, a large number of features need to be extracted (over 500). To achieve comparable accuracy, using DTW-DBA with cut $= 0.25$ our method builds around $220$ templates, less than half the number of features. Second, some features such as autocorrelation increase with the length of the time series, and almost all features increase with $p$, the dimension of each point. The dimensionality of our method is only influenced by the number of templates, which can be fixed through the $cut$ parameter. Third, our method has reduced computational complexity compared to feature extraction. Fast DTW has complexity $O(m)$, whereas most features have computational complexity at least $O(m)$, and some features such as autoregression coefficients have computational complexity $\Omega\left(m^2\right)$.
\subsection{UCI HAR Data}
Figure \ref{fig:templates} shows that our clustering scheme performs reasonably well in grouping differently-shaped curves. Both template methods are able to capture the shape of the data. In fact, the DPA and DBA templates appear very similar to one another.
Judging from the classification accuracy results in Table \ref{lab:accuracyUCI}, for both $cut = 0.5$ and $0.25$, DTW performs better with DBA, achieving 0.797 over 0.781 and 0.860 over 0.841 respectively. When $cut = 0.25$, DTWsubseq also does better with DBA, with accuracy 0.855 over 0.838. But when $cut = 0.5$, DTWsubseq performs better with DPA, achieving 0.789 over 0.777.
One possible reason why DBA did not consistently work better is that the starting average sequence in DPA is initialized using the same similarity measure (DTWD, DTWsubseqD) as is used for clustering. The starting average sequence in DBA is initialized with a random candidate in the cluster, as suggested in the original paper \cite{petitjean2011}.
It's possible that with a few modifications, such as picking the right initializing series for DBA, DTWsubseq-DBA with $cut = 0.5$ could achieve higher accuracy as it performs well in distinguishing between static and dynamic activities. It makes only 22 classification errors between static and dynamic activities, comparable to DTWsubseq-DPA, and has comparable accuracy when considering 4 activities as shown in parentheses in Table \ref{lab:accuracyUCI}.
The effects of lowering the $cut$ threshold are clear-cut. As expected, lowering the threshold (and increasing the number of clusters) increased accuracy . With original DTW we see an increase in accuracy from 0.781 to 0.841 with DPA, and subsequently up to 0.86 with DBA. Using DTWsubseq, we see an increase with DBA, and a smaller increase with DPA. This may primarily be due to overfitting. Decreasing cut from 0.5 to 0.25 increase the number of templates from around 50 to over 500.
The highest accuracy our method achieved was 0.860 using DTW-DBA with $cut = 0.25$, which is comparable to the feature extraction method which had a test accuracy of 0.890. One possibility is that the flat curves in static activities have not been sufficiently removed. The static activity curves usually have a spike, then remain flat. As some flat portions still remain in our training and test sets, all 3 static activities contain flat templates and hence induce high classification error within themselves. This is evidenced by the confusion matrix for DTW-DBA shown in Table \ref{cm} where there are lots of mis-classifications between activities 3-5, especially for activity 5.
\begin{table}[h]
{\small \begin{center}
\hspace{17mm} Predicted
$$\text{Actual } \kbordermatrix{
& 0 & 1 & 2 & 3 & 4 & 5 \\
0 & 462 & 26 & 8 & 0 & 0 & 0\\
1 & 3& 460 & 8 & 0 & 0 & 0\\
2 & 0 & 1 & 419 & 0 & 0 & 0\\
3 & 0& 1& 0& 182& 32& 5\\
4 & 2& 0& 1& 71& 258& 5\\
5 & 0& 0 &0 & 75& 63& 71
}
$$
\end{center}
}
\caption{Classification by DTWsubseq-DBA and $\text{cut}= 0.25$. Activities are labeled as follows: 0- walking, 1 - walking upstairs, 2 - walking downstairs, 3 - sitting, 4 - standing, 5 - lying}
\label{cm}
\end{table}
However, we find that our methods are capable of performing better than feature extraction when we circumvent the issue of the flat templates. Looking at the values in parenthesis in Table \ref{lab:accuracyUCI} where we perform a 4-category classification of walking, walking upstairs, walking downstairs and static activities, all our methods with $cut = 0.25$ outperforms feature extraction's 0.965 accuracy. DTW-DBA and DTWsubseq-DBA perform the best with 0.977.
Summarizing the results of our method on the UCI HAR dataset, compared with benchmark feature extraction method, we see that our accuracy rates are similar for six activities and better for four activities. Within our template-based methods, we see that there is no clear improvement using DPA versus DBA, and there is a slight overall improvement using DTWsubseq over DTW. Finally, we see that in all cases decreasing the $cut$ parameter increases accuracy.
\subsection{Synthetic Data}
Our synthetic data experiments reflect the satisfactory performance of our methods in the event of noisy data and new test subjects not present in the training phase.
Comparing template construction, Figure \ref{fig:templatesyn} shows that templates created using DBA are significantly more robust to sporadic noise than those created by DPA. The samples in Figure \ref{fig:templatesyn} are created from a single time series and modified by adding noise at a small region of the curve. DBA successfully accounts for this, as its template is identical to all curves at points other than the noisy region, and its shape matches the noisy region fairly well. On the other hand, DPA fails to capture the identical shape of the curve as it underestimates the magnitudes of the peaks and troughs.
However, because the test data is constructed from a different template (simulating a different person), DBA overfits to the training data. All methods with DPA perform similarly or better than with DBA. With DPA instead of DBA, DTWsubseq achieves 0.650 over 0.640 with $cut=0.5$, and 0.700 over 0.655 with $cut=0.25$.
DTW performs similarly with DPA and DBA with 0.615 and 0.620 respectively, and better with DPA for $cut=0.25$ obtaining 0.615 over 0.580.
The $cut$ threshold follows similar trends as in the UCI dataset, except that $cut=0.25$ for DTW-DBA achieves lower accuracy than $cut=0.5$. This is likely due to overfitting as the number of templates created was around 400.
Our method achieves the highest accuracy using DTWsubseq-DPA with $cut = 0.25$ (0.700), 3\% higher than that of feature extraction (0.67). This gives good indication that our method is potentially suitable for real-world applications, since it is more robust to noise than feature extraction, and is better at generalizing to data from new test subjects.
Summarizing the results of our method on the synthetic dataset, we see our method achieves higher accuracy than benchmark feature extraction. Within the template-based methods, we again see that there is no clear improvement using DPA versus DBA, but there is an improvement using DTWsubseq over DTW. Finally, we see that in almost all cases, decreasing the $cut$ parameter increases accuracy as expected.
\subsection{Summary of Results}
We summarize the accuracy results obtained using our algorithm for clarity in Table \ref{lab:summary}. We see that our algorithm's accuracy is comparable to feature extraction's, and performs better in most cases.
\begin{table} [h!]
\centering
\begin{tabular}{c|c|c}
&Accuracy on six activities & Accuracy on four activities \\
\hline
UCI HAR & 0.860 (0.890) & 0.977 (0.965) \\
Synthetic & N/A & 0.700 (0.67)
\end{tabular}
\vspace{4mm}
\caption{Summary Table for Best template selection algorithm vs. feature extraction. Feature extraction accuracy is shown in parentheses.}
\label{lab:summary}
\end{table}
\section{Conclusion}
\label{sec: conclusion}
In this paper, we presented modifications to DTW as a more accurate time series similarity measure, as well as a template-based approach for Human Activity Recognition. Through experiments on both real data and synthetic data, we show that our approach gives comparable and sometimes even better classification accuracy than the most common method of feature extraction. As compared to feature extraction on real data, our approach has comparable overall test accuracy, and better accuracy within activities in the dynamic category. For the synthetic data, it achieved higher accuracy, indicating robustness to noise and the ability to classify data from new test subjects. This is an especially useful feature for real-life implementations of such classification algorithms, for instance on a smartphone app.
Furthermore, the application of our approach extends beyond HAR, as long as the data set satisfies our definition of multi-dimensional time series. Since the template-based approach allows us to extract features without domain knowledge, it can be readily applied to these new datasets, unlike feature extraction methods which requires careful determination of useful features to achieve good accuracy.
\iffalse
Time series-based classification and feature-based methods, each with their benefits and drawbacks, have been used to classify human activities. In this paper, we proposed and evaluated a multi-stage process for classifying human activities by directly comparing the time series.. Using synthetic examples and a real data set, we demonstrate the applicability of our approach in its ability to achieve high accuracy rates close to 90\%, its potential to achieve higher computational efficiency.
\fi
\section{Future Work}
\label{sec: future}
We plan to improve our activity recognition and template usage in several ways. Potential directions include: modifying DTW to learn more complex activities, cross validating parameters in hierarchical clustering and DTW such as $cut$ or bandwidth $bw$ to increase prediction accuracy, removing redundant templates and limiting overfitting, and creating synthetic data from templates which can increase predictive power, or be used in place of real-world data.
Since the work presented in this paper is not specific to HAR applications, we also plan to apply and evaluate our algorithm on sequential data in other domains of research.
\iffalse
| {'timestamp': '2015-12-22T02:25:36', 'yymm': '1512', 'arxiv_id': '1512.06747', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06747'} | arxiv |
\section{Introduction}\label{sec:intro}
A \emph{cut} of a graph $G=(V(G),E(G))$ is a partition of $V(G)$ into two subsets $S, \bar{S}$ where $\bar S=V(G)\setminus S$. The \emph{cut-set} of $(S,\bar{S})$ is the set of edges of $G$ with exactly one endpoint in $S$. The maximum cardinality cut problem ($\maxcut$) is to find a cut with a maximum size cut-set, of a given graph.
$\maxcut$ remains $\nph$ when restricted to the following graph classes: chordal graphs, undirected path graphs, split graphs, tripartite graphs, co-bipartite graphs \cite{Bodlaender00onthe}, unit disk graphs \cite{DK2007} and total graphs \cite{Guruswami1999217}. On the other hand, it was shown that $\maxcut$ can be solved in polynomial-time in planar graphs \cite{hadlock1975finding}, in line graphs \cite{Guruswami1999217}, and the class of graphs factorable to bounded treewidth graphs \cite{Bodlaender00onthe}.
Proper interval graphs are not necessarily planar. They are not necessarily line graphs either, since the graph $\bar{A}$ consisting of 6 vertices is a proper interval graph, but a forbidden subgraph of line graphs \cite{Beineke1970129}. In \cite{BES15-MaxCut-JOCOSpecialIssue}, we have shown that co-bipartite chain graphs are not factorable to bounded treewidth graphs. Since co-bipartite chain graph are proper interval graphs, this result holds for them too. Therefore, the above mentioned results do not imply a polynomial-time algorithm for proper interval graphs.
Despite the existence of polynomial-time algorithms for some subclasses of proper interval graphs (split indifference graphs \cite{Bodlaender2004} and co-bipartite chain graphs \cite{BES15-MaxCut-JOCOSpecialIssue}), the complexity of $\maxcut$ in proper interval graphs was open. In this work, we generalize the dynamic programming algorithm in \cite{BES15-MaxCut-JOCOSpecialIssue} to proper interval graphs using the bubble model of proper interval graphs introduced in \cite{HMP09}.
\section{Preliminaries}\label{sec:prelim}
\input{Preliminaries}
\section{Algorithm for Proper Interval Graphs}
\input{DynamicProgramming}
\bibliographystyle{abbrvwithurl}
| {'timestamp': '2015-12-23T02:01:13', 'yymm': '1512', 'arxiv_id': '1512.06893', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06893'} | arxiv |
\subsubsection{Definitions}
For the sake of self-containedness, we begin by a review of standard
notions of homological algebra (see {\it e.g.} \cite{Weibel} for further details).
In the litterature, chain complexes are often defined as a sequence of
${\mathds F}_2$--spaces ${(C_i)}_{i \in {\mathds Z}}$ which are all zero but
a finite number of them, together with a collection
of maps either all of the form $\partial_i : C_i \rightarrow C_{i+1}$
or all of the form $\partial_{i} : C_i \rightarrow C_{i-1}$.
Another way to describe them is to consider the direct sum
$C :=\operatornamewithlimits{\oplus}\limits_{i \in {\mathds Z}} C_i$ and regard the collection of maps
${(\partial_i)}_{i \in {\mathds Z}}$ as a graded endomorphism of $C$. In the present paper,
we shall adopt the latter approach.
\begin{defi}\label{def:ChainComplex}
A linear map $\partial\in{\textnormal{End}}(C)$, for some ${\mathds F}_2$--space $C$, is $2$--nilpotent
if it satisfies $\partial^2=0$.\\
An $\varepsilon$--chain complex ${\chain{C}}$, for $\varepsilon=\pm1$, is a $2$--nilpotent
map $\partial\in{\textnormal{End}}(C)$
such that
\begin{itemize}
\item $C$ is ${\mathds Z}$--graded, that is decomposes into
$C:=\operatornamewithlimits{\oplus}\limits_{i\in{\mathds Z}}C_i$;
\item $\partial$ increases the degree by exactly
$\varepsilon$, that is ${\textnormal{Im}}(\partial_{|C_i})\subset C_{i+\varepsilon}$ for every $i\in{\mathds Z}$.
\end{itemize}
If ommited and unless otherwise specified, $\varepsilon$ shall be assumed to
be equal to $1$.\\
Since $C$ is finite-dimensional,
there is only a finite
number of degrees $i$ such that $C_i \neq \{0\}$.
The {\em support} of a chain
complex is the smallest interval $\{a,a+1,\ldots,b\}$ of integers such that
$C_i = \{0\}$ for
$i<a$ or $i>b$ and the value $b-a+1$ is called the {\em length} of the
chain complex.\\
A basis ${\mathcal B}$ for ${\chain{C}}$ is the data of a basis for
each non zero space $C_i$, that is an identification of $C_i$ with a
power of ${\mathds F}_2$.
\end{defi}
\begin{nota}\label{not:Complex}
Chain complexes shall be represented as
\[
\xymatrix{
\cdots \ar[r]^-{\partial_{i-2}} & C_{i-1} \ar[r]^-{\partial_{i-1}} & C_{i} \ar[r]^-{\partial_{i}} &
C_{i+1} \ar[r]^-{\partial_{i+1}} & C_{i+2} \ar[r]^-{\partial_{i+2}} & \cdots
}.
\]
In explicit cases given with a basis, $C_i$ shall be represented by dots, one for each
generator, and $\partial_i$ shall be represented by edges joining
a generator $x$ to the elements of $\partial_i(x)$. For instance, the following
picture:
\[
\vcenter{\hbox{$\xymatrix@!0 @R=1cm @C=2.5cm{
&\bullet\ar@{-}[r]\ar@{-}[dr]&\bullet\ar@{-}[dr]&\\
\bullet\ar@{-}[ur]\ar@{-}[r]\ar@{-}[dr]&\bullet\ar@{-}[ur]\ar@{-}[dr]&\bullet\ar@{-}[r]&\bullet\\
&\bullet\ar@{-}[ur]\ar@{-}[r]&\bullet\ar@{-}[ur]&
}$}}
\]
represents the complex $\xymatrix{\textrm{Span}(w_1) \ar[r]^-{\partial_0} &
\textrm{Span}(x_1,x_2,x_3) \ar[r]^-{\partial_1} & \textrm{Span}(y_1,y_2,y_3)
\ar[r]^-{\partial_2} & \textrm{Span}(z_1)}$, where
$\textrm{Span}$ denotes the vector space spanned by the given generators
and where
$\partial_0 (w_1) =
x_1+x_2+x_3$, $\partial_1 (x_1,x_2,x_3) = (y_1+y_2, y_1+y_3, y_2+y_3)$ and
$\partial_2(y_1)=\partial_2(y_2)=\partial(y_3) =z_1$.
\end{nota}
\begin{defi}\label{def:Dual}
For any $\varepsilon$--chain complex ${\chain{C}}$, we define its dual ${\chain{C}}^*$
as the $(-\varepsilon)$--chain complex $\partial^*\in{\textnormal{End}}(C^*)$ defined by
$C^*:=\operatornamewithlimits{\oplus}\limits_{i\in{\mathds Z}}{\textnormal{Hom}}(C_i,{\mathds F}_2)$ and $\partial^*(\varphi)=\varphi\circ\partial$
for every $\varphi\in C^*$.
We say that a chain complex is \emph{symmetric} if it is isomorphic,
as a chain complex, to its dual.
\end{defi}
\begin{prop}\label{prop:DualTranspose}
If ${\mathcal B}$ is a basis for a $\varepsilon$--chain complex
${\chain{C}}$, then ${\textnormal{Mat}}_{{\mathcal B}^*}(\partial^*)={}^t{\textnormal{Mat}}_{\mathcal B}(\partial)$.
\end{prop}
\begin{remarque}
If $\chain{C}$ is given with a basis, then the maps $\partial_i$ can be given
by their matrices. Using the identification
between an ${\mathds F}_2$--space and its dual mentionned in the Notation
section, $\chain{C}^*$ can be seen as the chain complex obtained by
reversing all the arrows and transposing all the matrices.\\
Furthermore, over ${\mathds F}_2$, Proposition \ref{prop:DualTranspose} is
proven by noting that, for every generators $x$ and $y$,
\[
y\in\partial(x)\ \Longleftrightarrow\
y^*\big(\partial(x)\big)\neq0\ \Longleftrightarrow\ \partial^*(y^*)(x)\neq0\
\Longleftrightarrow\
x^*\in\partial^*(y^*).
\]
So, if $\chain{C}$ is given using Notation \ref{not:Complex}, then $\chain{C}^*$ is obtained by reading
the graph from right to left.
\end{remarque}
\begin{defi}
For ${\chain{C}}$ any $\varepsilon$--chain complex, we define its
homology groups $H_\bullet({\chain{C}}):=\operatornamewithlimits{\oplus}\limits_{i\in{\mathds Z}}H_i({\chain{C}})$ by
$H_i({\chain{C}}):=\fract{{\textnormal{Ker}}(\partial_i)}/{{\textnormal{Im}}(\partial_{i-\varepsilon})}$.
For any $x\in{\textnormal{Ker}}(\partial)$, we denote by $[x]$ its image in $H_\bullet({\chain{C}})$.
\end{defi}
\begin{defi}
If ${\chain{C}}$ is a $\varepsilon$--chain complex given with a basis ${\mathcal B}$, then, for each $i\in{\mathds Z}$ we denote by
\begin{itemize}
\item $n_i({\chain{C}}):=\dim(C_i)$ and define the \emph{length} of
$\chain{C}$ as $n_\chain{C}:=n_0(\chain{C})$;
\item $k_i({\chain{C}}):=\dim\big(H_i({\chain{C}})\big)$ and define the \emph{dimension} of
$\chain{C}$ as $k_\chain{C}:=k_0(\chain{C})$;
\item $d_i({\chain{C}}):=\min\big\{|x|\ \big|\ [x]\in
H_i({\chain{C}})\setminus\{0\}\big\}$ and define the \emph{minimum distance} of
$\chain{C}$ as $d_\chain{C}:=d_0(\chain{C})$;
\item $w_i({\chain{C}}):=\max\big\{|x|\ \big|\ x \textrm{ row of }{\textnormal{Mat}}_{\mathcal B}(\partial_i)\big\}$ and define the \emph{weight} of
$\chain{C}$ as $w_\chain{C}:=w_0(\chain{C})$.
\end{itemize}
\end{defi}
\begin{remarque}\label{rem:Dependances}
The above parameters have only a relative dependency with regard to
the basis. Indeed, $w_{\chain{C}}$ depends on the entire ${\mathcal B}$, $d_{\chain{C}}$
depends only on its restriction ${\mathcal B}_{|C_{0}}$, $n_{\chain{C}}$ and $k_{\chain{C}}$ are independant of ${\mathcal B}$. \end{remarque}
\subsubsection{Operations on chain complexes}
\begin{defi}
Let ${\chain{C}}$ and ${\chain{D}}$ be two
$\varepsilon$--chain complexes. We define their direct sum ${\chain{C}}\oplus{\chain{D}}$ as the $\varepsilon$--chain
complex $\partial_{\chain{C}}\oplus\partial_{\chain{D}}\in{\textnormal{End}}\Big(\operatornamewithlimits{\oplus}\limits_{i\in{\mathds Z}}\big(C_i\oplus
D_i\big)\Big)$.
\end{defi}
\begin{prop}
Let ${\chain{C}}$ and ${\chain{D}}$ be two $\varepsilon$--chain complexes
given with basis. Then
\begin{itemize}
\item $\big({\chain{C}}\oplus{\chain{D}}\big)^*\cong{\chain{C}}^*\oplus{\chain{D}}^*$;
\end{itemize}
and for each $i\in{\mathds Z}$,
\begin{itemize}
\item $H_i({\chain{C}}\oplus{\chain{D}})\cong H_i({\chain{C}})\oplus H_i({\chain{D}})$;
\item $n_i({\chain{C}}\oplus{\chain{D}})=n_i({\chain{C}})+n_i({\chain{D}})$,
$k_i({\chain{C}}\oplus{\chain{D}})=k_i({\chain{C}})+k_i({\chain{D}})$,
$d_i({\chain{C}}\oplus{\chain{D}})=\min\big(d_i({\chain{C}}),d_i({\chain{D}})\big)$
and
\item $w_i({\chain{C}}\oplus{\chain{D}})=\max\big(w_i({\chain{C}}),w_i({\chain{D}})\big)$.
\end{itemize}
\end{prop}
\begin{proof}
All the statements, except the one on minimum distances and the one on
weights, are classical results of homological algebra.
For the statement on minimum distances, let $x \in C_i$ and $y \in D_i$ be homologically non trivial
elements of minimum weight. Then $(x,0)$ and $(0,y) \in C_i \oplus D_i$
are homologically non trivial, so
$d_i({\chain{C}}\oplus{\chain{D}})\leq\min\big(d_i({\chain{C}}),d_i({\chain{D}})\big)$.
Conversely, every homologically non trivial
element $(a,b) \in C_i \oplus D_i$ is such that either $a$ or $b$
is homologically non trivial and its weight is hence larger than either
the weigth of
$(x,0)$ or of $(0, y)$.
For the statement on weights, consider the maps $\partial_{\chain{C}, i} : C_i
\rightarrow C_{i+1}$ and $\partial_{\chain{D}, i} : D_i \rightarrow D_{i+1}$.
Let $M_{\chain{C}, i}$ and $M_{\chain{D}, i}$ be their matrix representations.
Then, the map $\partial_{\chain{C} \oplus \chain{D}, i} : C_i \oplus D_i \rightarrow C_{i+1}\oplus D_{i+1}$ is represented by the matrix:
\[
\begin{pmatrix}
M_{\chain{C}, i} & 0 \\
0 & M_{\chain{D}, i}
\end{pmatrix}
\]
which yields the result on the maximum weight of the rows.
\end{proof}
In particular, we emphasize the fact that adding a direct
summand given with its own basis and which has null homology does not
affect the parameters except the length which is increased
consequently.
But conversely, detecting and removing a direct summand may alter the
minimum distance if the basis does not respect the direct sum decomposition.
\begin{defi}
Let ${\chain{C}}$ and ${\chain{D}}$ be two
$\varepsilon$--chain complexes. We define the tensor product ${\chain{C}}\otimes{\chain{D}}$ as the $\varepsilon$--chain
complex
${\textnormal{Id}}_C\otimes\partial_{\chain{D}}+\partial_{\chain{C}}\otimes{\textnormal{Id}}_D\in{\textnormal{End}}\Big(\operatornamewithlimits{\oplus}\limits_{i\in{\mathds Z}}\big(\operatornamewithlimits{\oplus}\limits_{r\in{\mathds Z}}(C_r\otimes
D_{i-r})\big)\Big)$.
\end{defi}
\begin{prop}\label{prop:ProductParameters}
Let ${\chain{C}}$ and ${\chain{D}}$ be two $\varepsilon$--chain complexes. Then
\begin{itemize}
\item $\big({\chain{C}}\otimes{\chain{D}}\big)^*\cong{\chain{C}}^*\otimes{\chain{D}}^*$;
\end{itemize}
and for each $i\in{\mathds Z}$,
\begin{itemize}
\item $H_i({\chain{C}}\otimes{\chain{D}})\cong\operatornamewithlimits{\oplus}\limits_{r\in{\mathds Z}}\big(H_r({\chain{C}})\otimes
H_{i-r}({\chain{D}})\big)$ (K\"unneth formula);
\item $n_i({\chain{C}}\otimes{\chain{D}})=\displaystyle{\sum_{r\in{\mathds Z}}}n_r({\chain{C}}).n_{i-r}({\chain{D}})$,
$k_i({\chain{C}}\otimes{\chain{D}})=\displaystyle{\sum_{r\in{\mathds Z}}}k_r({\chain{C}}).k_{i-r}({\chain{D}})$;
\item if ${\chain{C}}$ and ${\chain{D}}$ were given with bases
${\mathcal B}_\chain{C}$ and ${\mathcal B}_\chain{D}$, then
${\mathcal B}_\chain{C}\otimes{\mathcal B}_\chain{D}$ provides a basis for
$\chain{C}\otimes\chain{D}$ such that
$w_i({\chain{C}}\otimes{\chain{D}})=\max\big\{w_j(\chain{C}) +
w_k (\chain{D})\big| j+k = i\big\}$.
\end{itemize}
\end{prop}
\begin{proof}
The statements on duals, homologies and lengths are classical results of homological algebra.
The statement on weights follows from
${\textnormal{Mat}}_{{\mathcal B}_\chain{C}\otimes{\mathcal B}_\chain{D}}(\partial_{\chain{C}\otimes\chain{D}})$
being obtained as a sum of Kronecker products of the form
${\textnormal{Mat}}_{{\mathcal B}_\chain{C}}(\partial_{\chain{C}}) \otimes \textrm{Id}$ and
$\textrm{Id} \otimes {\textnormal{Mat}}_{{\mathcal B}_\chain{D}}(\partial_{\chain{D}})$.
\end{proof}
The isomorphism of K\"unneth formula, proven for instance in \cite[Thm
3.6.3]{Weibel}\footnote{noting that, since we are working over a
field, any module is flat and hence
Tor is zero}, is actually induced from maps defined at the chain
complex level. It induces hence the following proposition which shall
be needed further in the proof of Lemma \ref{lem:Th}.
\begin{prop}\label{prop:TechKunneth}
If, for each $r\in{\mathds Z}$, $x^r_1,\ldots x^r_{j_r}\in C_r$ and
$y^r_1,\ldots y^r_{j'_r}\in D_r$ induce basis for, respectively,
$H_r(\chain{C})$ and $H_r(\chain{D})$, then, for every $i\in{\mathds Z}$, the elements of the form
$x_j^{r}\otimes y_{j'}^{i-r}$ induce a basis for $H_i(\chain{C}\otimes\chain{D})$.
\end{prop}
\begin{remarque}
Evaluating $d_i({\chain{C}}\otimes{\chain{D}})$ is less
straightforward and it shall be the aim of Section \ref{sec:Th}.
\end{remarque}
\subsubsection{Short complexes and reduction}
\label{sec:Reduction}
In this paper, we shall be mostly interested in length 3 portions of chain
complex centered around degree zero. This motivates the following definitions.
\begin{defi}\label{def:ShortEtc}
A chain complex ${\chain{C}}$ is said to be a \emph{short complex}
if it has a support contained in $\{-1,0,1\}$. It is hence of the
following form:
$\xymatrix{C_{-1}\ar[r]^-{\partial_{-1}}&C_{0}\ar[r]^-{\partial_{0}}&C_{1}}$.
The chain complex is said to be \emph{balanced}
if it has non trivial
homology only in degree zero.
A balanced short complex is said to be \emph{reduced}. For a short
complex, being reduced is equivalent to require
$\partial_{-1}$ to be injective and $\partial_{0}$ to be surjective. So the chain complex is of the
form $\xymatrix{C_{-1}\ar@{^(->}[r] & C_{0} \ar@{->>}[r] &
C_{1}}$. Equivalently, it consists in requiring that
$\dim\big(H_{0}({\chain{C}})\big)=\dim(C_{0})-\dim(C_{-1})-\dim(C_{1})$.
Note that a short complex $\xymatrix{
C_{-1} \ar[r]^{\partial_{-1}} & C_0 \ar[r]^{\partial_0} & C_1}$ is symmetric if
and only if $C_{-1}\simeq
C_1^*$ and $\partial_0 = \partial_{-1}^*$.
\end{defi}
Any chain complex $\chain{C}$ can be turned into a short one by truncating the
degrees higher than 1 and lower than $-1$. More precisely, by shifting
beforehand the
degree, one can extract any length
3 portion of $\chain{C}$.
However, the result is generally not balanced, even if $\chain{C}$ was.
There is nonetheless a reduction process to turn a short complex into
a reduced one (almost) without altering its parameters.
Indeed, if
${\chain{C}}:=\xymatrix{C_{-1}\ar[r]^{\partial_{-1}}&C_{0}\ar[r]^(.45){\partial_{0}}&C_{1}}$
is given with a basis ${\mathcal B}$, and if ${\chain{D}}$
is obtained from ${\chain{C}}$ by removing all redundant rows
of ${}^t{\textnormal{Mat}}_{\mathcal B}(\partial_{-1})$ and/or ${\textnormal{Mat}}_{\mathcal B}(\partial_{0})$ and by modifying
$C_{-1}$ and $C_{1}$ consequently, then $\chain{D}$ is reduced and it is mostly a consequence of
Remark \ref{rem:Dependances} that $n_{\chain{D}}=n_{\chain{C}}$, $k_{\chain{D}}=k_{\chain{C}}$,
$d_{\chain{D}}=d_{\chain{C}}$ and $w_{\chain{D}}\leq
w_{\chain{C}}$. From a linear algebraic point of view, it consists in replacing $C_{-1}$
by a complement space for ${\textnormal{Ker}}(\partial_{-1})$ spanned by vectors of ${\mathcal B}$, and replacing $C_1$ by
its quotient under a complement space of ${\textnormal{Im}}(\partial_0)$ spanned by vectors of ${\mathcal B}$.
This process is however non canonical
since it requires the choice of complement spaces, or equivalently, the
choice of the redundant rows to be removed.
As a conclusion, any length 3 portion of a chain complex can be
grading-shifted so it is centred in
degree zero, and then the above (non canonical) reduction process can turn
it into a reduced complex without altering the
parameters, except the weight which may even be decreased.
\begin{remarque}\label{rem:AltReduc}
Adding ${\textnormal{Ker}}(\partial_{-1})$ in degree $-2$ and ${\textnormal{Coker}}(\partial_0)$ in degree
2 is another way to turn a short complex into a balanced one. The
chain complex is then of length five. This provides a
balancing
process which is canonical
and which preserves all the parameters. However, for length reasons, we shall consider in this paper, only
the (non canonical) reduction process, and not the (canonical)
balancing one.
\end{remarque}
\subsubsection{Rougher lower bounds for the minimal distance of tensor
products}
\begin{cor}\label{cor:DMinBound}
If ${\chain{C}}$ is a chain complex satisfying the hypothesis of Lemma \ref{lem:Th}, then $d_{\chain{C}}\geq \left\lceil\frac{N}{K}\right\rceil$.
\end{cor}
\begin{proof}
Apply Lemma \ref{lem:Th} with the reduced complex
${\chain{D}}:=\xymatrix{0\ar[r]&{\mathds F}_2\ar[r]&0}$.
\end{proof}
\begin{remarque}
Applied to the case ${\textnormal{Im}}(\partial_{-1})=0$, Corollary \ref{cor:DMinBound}
provides also a lower bound for the minimum distance of a classical
code. In this context, the statement essentially follows from the
remark that, if an element $c$ of a code has a non trivial scalar
product with a vector $\omega$, then $c$ has at least one non
trivial entry shared with $\omega$. Now, with the notation of Section
\ref{sec:Th} and for $j_0$ such that $g_{j_0}\in c$, $c$ has at least one non trivial entry in common with
each of the $N$ elements of $\Omega_{j_0}$. But each of these entries can appear at
most $K$ times. It follows that $c$ has at least $\frac{N}{K}$ non
trivial entries.
\end{remarque}
\begin{remarque}\label{rk:LaLoose}
One may cherish the hope to provide an LDPC family of CSS codes with
minimum distances growing faster than the square root of the
lengths by applying Corollary \ref{cor:DMinBound} to evaluate
the minimum distance of a CSS code $\qcode C$ as some $\frac{N}{K}$. This is however doomed to fail. Indeed, if stacking the
elements of $\Omega$ into a matrix and counting, column by column,
the number $V$ of non trivial entries, we obtain $V\leq n_\qcode
CK$; but on the other hand, counting $V$ row by row, we obtain
$V\geq Nd_{\chain C^*}$ since, as noticed in Remark
\ref{rk:CohomNonTriv}, elements of $\Omega$ are non trivial
cohomology classes. It follows that $\frac{N}{K}d_{\chain C^*}\leq
n_\qcode C$. In particular, if $\frac{N}{K}$ is close enough to
$d_\chain C$, we obtain $d_\chain Cd_{\chain C^*}\lesssim n_\qcode C$
and hence $d_\qcode C=\min(d_\chain C,d_{\chain
C^*})\lesssim\sqrt{n_\qcode C}$.
\end{remarque}
\begin{cor}\label{cor:dProd}
If ${\chain{C}}$ and ${\chain{D}}$ are two chain complexes such that one
of them is balanced, then
\[
\max(d_{\chain{C}},d_{\chain{D}})\leq
d_{{\chain{C}}\otimes{\chain{D}}}\leq d_{\chain{C}} d_{\chain{D}}.
\]
\end{cor}
\begin{proof}
The right hand side is a direct consequence of Proposition
\ref{prop:TechKunneth}. The left hand one is obtained by applying
Lemma \ref{lem:Th}
with $N = K = 1$; this always holds when $\Omega_{j_0}$ is a singleton.
\end{proof}
As we shall see in several examples, the upper bound is
sharp.
On the contrary, the lower bound is not, except in some trivial cases.
\begin{prop}\label{prop:NonSharp}
If ${\chain{C}}$ and ${\chain{D}}$ are two chain complexes such
that
$\chain{C}:\xymatrix{C^{-1}\ar@{^(->}[r]^-{\partial_{-1}}&C_0\ar@{->>}[r]^-{\partial_0}&C_1}$
is balanced and $\partial_0$ is non zero on every elements of the basis of
$C_0$, then $d_{{\chain{C}}\otimes{\chain{D}}}\geq 2d_{\chain{D}}$.
\end{prop}
\begin{proof}
With the notation of Section \ref{sec:Th}, we consider, for each
$j_0\in\Inter{1}{r}$, $\Omega_{j_0}:={\textnormal{Ker}}_{j_0}^{\mathrlap{\hspace{.02cm}\perp}\bigcirc}$. It can actually be
described as $\omega_{j_0}+{\textnormal{Ker}}(\partial_0) ^\perp$
with $\omega_{j_0}$
any element in ${\textnormal{Ker}}_{j_0}^{\mathrlap{\hspace{.02cm}\perp}\bigcirc}$.\\
Now, for any $i\in\Inter{1}{n_0}$, there is at least one element
$f_i\in{\textnormal{Ker}}(\partial_0)^\perp$ such that $\langle f_i,b_i\rangle=1$, otherwise $b_i$
would be contained in
$\big({\textnormal{Ker}}(\partial_0) ^\perp\big)^\perp\cong{\textnormal{Ker}}(\partial_0)$ and $\partial_0(b_i)$
would be zero.
But, as a generator, $b_i\in
f_i$, and the map $\big(x\mapsto x+f_i\big)$
induces a bijection between the elements in $\Omega_{j_0}$ which
contain $b_i$ and those who do not. It follows that
${\textnormal{overlap}}(\Omega_{j_0})=\frac{1}{2}|\Omega_{j_0}|$ and the statement is proved
using Lemma \ref{lem:Th}.
\end{proof}
\begin{remarque}
Similar results can be obtained for $q$--ary CSS codes. In this case
we would get $d_{\chain C \otimes \chain D} \geq \frac{q}{q-1} \max (d_{\chain C}, d_{\chain D})$.
\end{remarque}
\begin{remarque}
The lower bound in Corollary \ref{cor:dProd} can hence be sharp only
if $\partial_0$ vanishes on some generator. If this generator is not in
the image of $\partial_{-1}$, then $d_\chain{C}=1$ and
$d_{\chain{C}}d_{\chain{D}}=\max(d_{\chain{C}},d_{\chain{D}})$. If
it does, then $\chain{C}$ is the direct sum of a chain complex with
a (useless) summand
of the form
$\xymatrix{\textrm{Span}\big(b'_i\big)\ar@{^(->>}[r]&\textrm{Span}(b_i)\ar[r]&0}$,
where $b'_i$ is the unique preimage of $b_i$; and this summand can be removed
without altering the minimum distance.
It follows that the lower bound of Corollary \ref{cor:dProd} is sharp if and only if it is equal to
the upper bound.
\end{remarque}
Corollary \ref{cor:dProd} and Proposition \ref{prop:NonSharp} have the
following consequence for the (reduced) tensor product of CSS codes.
\begin{cor}\label{cor:minor_times_2}
If $\qcode{C}$ and $\qcode{D}$ are two CSS codes described by
matrices which have no columns of zeros, then
\[
2\max(d_{\qcode{C}},d_{\qcode{D}})\leq
d_{\qcode{C}\otimes_{r}\qcode{D}}.
\]
\end{cor}
In Section \ref{sec:Steane}
we shall see an example where $d_{{\qcode{C}}\otimes{\qcode{D}}}=\left(2+\frac{1}{3}\right)\max(d_{\qcode{C}},d_{\qcode{D}})< d_{\qcode{C}} d_{\qcode{D}}$.
\begin{remarque}
For chain complexes, the minimum distance of a tensor product is
bounded above by the product of the minimum distances of the
summands but, because of the interplay with dual chain complexes, this does not hold anymore for CSS codes. An example is given by Tillich--Zémor
construction, presented in Section \ref{sec:TZ}.
\end{remarque}
\subsubsection{Parameters of iterated tensor powers}
\begin{cor}\label{cor:ParamTensor}
Let $\qcode{C}$ be the CSS code associated to ${\chain{C}}:=\xymatrix{{\mathds F}_2^{b_1}\ar@{^(->}[r]& {\mathds F}_2^a\ar@{->>}[r]&{\mathds F}_2^{b_2}}$,
where $a,b_1,b_2\in{\mathds N}$.
If $\chain{C}$ and ${\chain{C}}^*$ satisfy both
the hypothesis of Lemma \ref{lem:Th} for the same integers
$N,K\in{\mathds N}^*$, then $\big({\qcode{C}}^{\otimes\ell}\big)_{\ell\in{\mathds N}}$
is a family of CSS codes with
parameters
\[
\left\llbracket\ \sim\frac{1}{2}\sqrt{\frac{a+2\sqrt{b_1b_2}}{\pi\ell \sqrt{b_1b_2}}}\left(a+2\sqrt{b_1b_2}\right)^\ell \ ;\
(a-b_1-b_2)^\ell \ ;\ \geq \left(\frac{N}{K}\right)^\ell \ ;\ \leq a\ell \ \right\rrbracket.
\]
In particular, the family is logarithmically LDPC and
the minimum distance grows strictly faster than the
$\frac{\log(a+2\sqrt{b_1b_2})}{\log N-\log K}$-th power of the length.
\end{cor}
\begin{proof}
The statement on
\begin{itemize}
\item the length follows from an adaptation of the proofs of Prop. 4.1,
A.1 and A.2 in \cite{Audoux}, details can be found in Appendix \ref{appendix:A};
\item the dimension is a direct consequence of Künneth formula;
\item the bound on the minimum distance follows from an inductive use of
Lemma \ref{lem:Th};
\item the weight follows from an inductive use of Proposition
\ref{prop:ProductParameters} and the fact that $b_1,b_2\leq a$,
which is a consequence of the reducedness of $\chain{C}$.
\end{itemize}
\vspace{-.4cm}
\end{proof}
Corollary \ref{cor:ParamTensor} can be improved by using the reduced
notion of tensor powers defined in Section \ref{sec:CSSpowers}:
parameters $k$ and $d$ are kept untouched, parameter $w$ is possibly
reduced and parameter $n$ is significantly reduced. To avoid making
the text cumbersome, we only state here the
case $b=b_1=b_2$, but the
general statement is given in Appendix \ref{appendix:B}.
\begin{cor}\label{cor:ParamTensorReduc}
Let $\qcode{C}$ be the CSS code associated to ${\chain{C}}:=\xymatrix{{\mathds F}_2^{b}\ar@{^(->}[r]& {\mathds F}_2^a\ar@{->>}[r]&{\mathds F}_2^{b}}$,
where $a,b\in{\mathds N}$. If $\chain{C}$ and ${\chain{C}}^*$ satisfy both
the hypothesis of Lemma \ref{lem:Th} for the same integers
$N,K\in{\mathds N}^*$, then for every $\ell\in{\mathds N}$,
${\qcode{C}}^{\otimes_r\ell}$ is a CSS code with
parameters
\[
\left\llbracket\ \frac{2(a+b)^\ell+(a-2b)^\ell}{3}\ ;\ (a-2b)^\ell \
;\ \geq \left(\frac{N}{K}\right)^\ell \ ;\ \leq a\ell \ \right\rrbracket.
\]
This provides a family
logarithmically LDPC with a minimum distance which grows at least as the $\frac{\log(a+b)}{\log N-\log K}$-th power of the length.
\end{cor}
\begin{proof}
Compared to Corollary \ref{cor:ParamTensor}, only the statement on
lengths needs a further proof.
We set ${\chain{C}}_1:={\chain{C}}$ and define recursively ${\chain{C}}_\ell$
as the tensor product of ${\chain{C}}$ with the reduction of
${\chain{C}}_{\ell-1}$. We define the sequences of integers $(a_\ell)_{\ell\in{\mathds N}^*}$ and
$(b_\ell)_{\ell\in{\mathds N}^*}$ by
${\chain{C}}_\ell=:\xymatrix{{\mathds F}_2^{b_\ell}\ar@{^(->}[r]&{\mathds F}_2^{a_\ell}\ar@{->>}[r]&{\mathds F}_2^{b_\ell}}$. Developping
${\chain{C}}_\ell\otimes {\chain{C}}$ and using Künneth formula to say that the
homology is trivial except in degree zero, we obtain the
following --- for simplicity, we have written only the dimensions of the
different spaces --- where the second line corresponds to the result
after reduction:
\[
\vcenter{\hbox{$\xymatrix@!0 @R=1cm @C=2.2cm{
0\ar[r]&bb_\ell\ar[r]&ab_\ell+ba_\ell\ar[r]&aa_\ell+2bb_\ell\ar[r]\ar@{->>}[rd]&ab_\ell+ba_\ell\ar[r]&bb_\ell\ar[r]&0\\
&&ab_\ell+ba_\ell-bb_\ell\ar@{^(->}[ru]&&ab_\ell+ba_\ell-bb_\ell&&
}$}}.
\]
It follows that
$\left(\!\!\begin{array}{c}a_{\ell+1}\\b_{\ell+1}\end{array}\!\!\right)=A
\left(\!\!\begin{array}{c}a_{\ell}\\b_{\ell}\end{array}\!\!\right)$
with
$A=\left(\!\!\begin{array}{cc}a&2b\\b&a-b \end{array}\!\!\right)=\left(\!\!\begin{array}{cc}1&-2\\1&1\end{array}\!\!\right)^{-1}\left(\!\!\begin{array}{cc}a-2b&0\\0&a+b\end{array}\!\!\right)
\left(\!\!\begin{array}{cc}1&-2\\1&1\end{array}\!\!\right)$, and hence
that
$\left(\!\!\begin{array}{c}a_{\ell}\\b_{\ell}\end{array}\!\!\right)=A^{\ell-1}\left(\!\!\begin{array}{c}a\\b\end{array}\!\!\right)=\displaystyle{\frac{1}{3}}\left(\!\!\begin{array}{c}2(a+b)^\ell+(a-2b)^\ell
\\(a+b)^\ell-(a-2b)^\ell\end{array}\!\!\right)$.
\end{proof}
\begin{remarque}
The value $\left(\frac{N}{K}\right)^\ell$ given as a lower bound for
$d_\ell$ in
Corollaries \ref{cor:ParamTensor} and \ref{cor:ParamTensorReduc} can
actually be sharpened into
$\bigg\lceil\!\!\cdots\!\!\Big\lceil\big\lceil\frac{N}{K}\big\rceil\frac{N}{K}\Big\rceil\frac{N}{K}\cdots\bigg\rceil$. It
provides, in general, a slightly better constant.
\end{remarque}
Proposition \ref{prop:NonSharp} together
with either Corollary \ref{cor:ParamTensor} or
\ref{cor:ParamTensorReduc} imply that, by considering its tensor
powers, any CSS code, even the poorest one as soon as it is not
{unreasonable},
provides a logarithmically LDPC family with a
minimum distance tending
to infinity:
\begin{cor}\label{cor:NonTrivial}
If $\qcode{C}=\left(\mathbf{H}_X,\mathbf{H}_Z\right)$ is a CSS code
such that none of $\mathbf{H}_X$ or $\mathbf{H}_Z$ has a zero column,
then the families $\left(\qcode{C}^{\otimes\ell}\right)_{\ell\in{\mathds N}}$
and $\left(\qcode{C}^{\otimes_r\ell}\right)_{\ell\in{\mathds N}}$ are
logarithmically LDPC with
$d_{\qcode{C}^{\otimes\ell}},d_{\qcode{C}^{\otimes_r\ell}}\geq
2^\ell$ for every $\ell\in{\mathds N}^*$.
\end{cor}
In particular, and even if a CSS code has no quantum degeneracy,
i.e. its quantum minimum distance is not larger than the minimum
of the distances of the two classical codes defining it,
for a large enough $ \ell$, its $\ell$--th iterated power does.
\begin{remarque}
The previous statement assert that the row weight of the $\ell$--th
iterated tensor power ${\mathcal C}^{\otimes \ell}$ (or ${\mathcal C}^{\otimes_r
\ell}$) has a row weight which is linear in $\ell$ and hence
logarithmic in the code length. Very similar arguments would show
that the column weights, which are related to the number of
stabilizers acting non trivially on a given qubit, are also in $O
(\ell)$ and hence logarithmic in the code length.
\end{remarque}
\subsubsection{Unknot codes}
The diagrams used in \cite{Audoux} to define the unknot codes are not
iterated connected sums of a given diagram. However, their Khovanov
chain complexes is isomorphic to that of the following diagrams
\[
\dessin{2.5cm}{NewUnknot}
\]
which are iterated connected sums.
It follows that the chain complexes underlying unknot codes are the $\ell$-th tensor power of
\[
\vcenter{\hbox{$\xymatrix@!0 @R=.35cm @C=2.5cm{
&\bullet\ar@{-}[rddd]&\\
&&\\
&\bullet\ar@{-}[rddd]&\\
\bullet\ar@{-}[ruuu]\ar@{-}[ru]\ar@{-}[rd]&&\bullet\\
&\bullet\ar@{-}[ru]\ar@{-}[rd]&\\
\bullet \ar@{-}[ru]\ar@{-}[rd]\ar@{-}[rddd]&&\bullet\\
&\bullet\ar@{-}[ruuu]&\\
&&\\
&\bullet\ar@{-}[ruuu]&
}$}}.
\]
We denote the generators in the middle degree, from top to bottom, by
positive integers from 1 to 5.
Using the subset
notation described in the Notation section, the homology is generated by
$14$. Since
the chain complex is symmetric, it is sufficient to use Corollary \ref{cor:ParamTensor} with
$\Omega_{14}:=\big\{12,45\big\}$ to obtain
back the parameters
$\param{\frac{3^{2\ell+1}}{\sqrt{8\pi\ell}}}{1}{2^\ell}{3\ell}$.
Using Corollary \ref{cor:ParamTensorReduc}, it can be improved into a
family with asymptotical parameters $\param{\frac{2. 7^\ell}{3}}{1}{2^\ell}{3\ell}$.
\subsubsection{Unlink codes}
The diagrams considered in \cite{Audoux} to define unlink codes are
iterated connected sums of the following diagram
\[
\dessin{1.95cm}{Unlink0}
\]
so the associated chain complexes are iterated tensor powers of
\[
\vcenter{\hbox{$\xymatrix@!0 @R=.35cm @C=2.5cm{
&\bullet\ar@{-}[rddd]&\\
&&\\
&\bullet\ar@{-}[rd]&\\
\bullet\ar@{-}[ruuu]\ar@{-}[ru]\ar@{-}[rd]\ar@{-}[rddd]&&\bullet\\
&\bullet\ar@{-}[ru]&\\
&&\\
&\bullet\ar@{-}[ruuu]&
}$}}.
\]
We denote the generators in the middle degree, from top to bottom, by
positive integers from 1 to 4.
Using the subset
notation,
the homology is generated by
$12$ and $13$, and using Corollary \ref{cor:ParamTensor} with
$\Omega_{12}:=\big\{24,13\big\}$ and $\Omega_{13}:=\big\{34,12\big\}$, we obtain
back the parameters
$\param{\sqrt{\frac{3}{2\pi\ell}}6^\ell}{2^\ell}{2^\ell}{4\ell}$.
Using Corollary \ref{cor:ParamTensorReduc}, it can be improved into a
family with asymptotical parameters $\param{\frac{2}{3}5^\ell}{2^\ell}{2^\ell}{4\ell}$.
\begin{remarque}
Forgetting its Khovanov origin, the above family can
be extended to a two-parameters family defined as the $\ell$-th tensor power
of
\[
\vcenter{\hbox{$\xymatrix@!0 @R=.35cm @C=2.5cm{
&\bullet\ar@{-}[rddddd]&\\
&&\\
&\bullet\ar@{-}[rddd]&\\
&&\\
&\raisebox{.1cm}{$\vdots$}&\\
\bullet\ar@{-}[ruuuuu]\ar@{-}[ruuu]\ar@{-}[rddd]\ar@{-}[rddddd]&2r\textrm{
generators}&\bullet\\
&\raisebox{-.2cm}{$\vdots$}&\\
&&\\
&\bullet\ar@{-}[ruuu]&\\
&&\\
&\bullet\ar@{-}[ruuuuu]& }$}}.
\]
From a coding theoretic point of view, the corresponding
CSS code is symmetric and associated to the
code $\code{C} \subseteq \code{C}^{\perp}$ where $\code{C}$
is the repetition code and $\code{C}^{\perp}$ is the parity
code.
The homology is generated by $\big\{1i\ |\ i\in\Inter{2}{2r-1}\big\}$ and, using
Corollary \ref{cor:ParamTensorReduc} with
$\Omega_{1i}:=\bigg\{i(2r),\operatornamewithlimits{\prod}\limits_{\substack{j=1\\j\neq i}}^{2r-1}j\bigg\}$,
we obtain codes with asymptotical parameters
$\param{\frac{2}{3}(2r+1)^\ell}{(2r-2)^\ell}{2^\ell}{2r\ell}$ when
$r$ is fixed and $\ell$ tends to infinity.
\end{remarque}
\subsubsection{From 2--nilpotent maps to chain complexes}\label{sec:2nilpo->chain}
Let $\qcode{C}$ be a CSS code described by a 2--nilpotent map
$\partial_C\in{\textnormal{End}}(C)$. From the chain complex point of view, $\qcode{C}$ is
also the CSS code associated to
\[
\chain{C}:=\xymatrix{C\ar[r]^-{\partial_C}&C\ar[r]^-{\partial_C}&C},
\]
which can be reduced into
\[
\xymatrix{C_-\ar@{^(->}[r]^-{\partial_C}&C\ar@{->>}[r]^-{\partial_C}&C_+},
\]
where $C=:C_-\oplus {\textnormal{Ker}}(\partial_C)$ and $C_+:=\fract{C}/{C'_+}$ with $C:=C'_+\oplus {\textnormal{Im}}(\partial_C)$.
We set
$\pi_C:C\to C_-$ the projection along ${\textnormal{Ker}}(\partial_C)$, $p_C:C\to C_+$ the
canonical projection and
$\partial_C^{-1}$ the inverse map of $\partial_C:C_-\to C_+$.
We set similar notation for $\qcode{D}$, another CSS code described
by a 2--nilpotent map.
The length 3 middle part of $\chain{C}\otimes_r\chain{D}$ is equal to
\[
\vcenter{\hbox{$\xymatrix@!0 @R=.7cm @C=3cm{
&C_-\otimes D_+\ar[rd]^-{\partial_C\otimes{\textnormal{Id}}_D}\ar@{}[dd]|\bigoplus&\\
C_-\otimes D\ar[ru]^-{{\textnormal{Id}}_C\otimes\partial_D}\ar[rd]^-{\partial_C\otimes{\textnormal{Id}}_D}\ar@{}[dd]|\bigoplus&&C\otimes D_+\ar@{}[dd]|\bigoplus\\
&C\otimes D\ar[ru]^-{{\textnormal{Id}}_C\otimes\partial_D}\ar[rd]^-{\partial_C\otimes{\textnormal{Id}}_D}\ar@{}[dd]|\bigoplus&\\
C\otimes D_-\ar[ru]^-{{\textnormal{Id}}_C\otimes\partial_D}\ar[rd]^-{\partial_C\otimes{\textnormal{Id}}_D}&&C_+\otimes D\\
&C_+\otimes D_-\ar[ru]^-{{\textnormal{Id}}_C\otimes\partial_D}&
}$}}.
\]
It can be decomposed as the direct sum
$\chain{P}_1\oplus\chain{P}_2\oplus\chain{P}_3$, where
\begin{itemize}
\item $\chain{P}_1$ is the chain subcomplex defined as $\textrm{Span}\left(
\vcenter{\hbox{$\xymatrix@!0 @R=.7cm @C=3cm{
&w\otimes x\ar[rd]\ar@{}[dd]|\oplus&\\
u\otimes v\ar[ru]\ar[rd]\ar@{}[dd]|\oplus&&0\ar@{}[dd]|\oplus\\
&\partial_C(w)\otimes{\partial_D^{-1}}(x)\ar[ru]\ar[rd]\ar@{}[dd]|\oplus&\\
0\ar[ru]\ar[rd]&&0\\
&0\ar[ru]&
}$}}
\right)$,
that is, as the direct summand
$C_-\otimes D$ in degree $-1$; as the space spanned by elements of the
form $\big(w\otimes
x \big)\oplus \big (\partial_C(w)\otimes\partial_D^{-1}(x) \big)\oplus0\in \big (C_-\otimes
D_+\big)\oplus \big (C\otimes D \big)\oplus \big (C_+\otimes
D_-\big)$ for some $w\in C_-$ and $x\in D_+$, in degree 0; and as zero
in degree 1;
\vspace{.5cm}
\item $\chain{P}_2$ is the chain subcomplex defined as $\textrm{Span}\left(\vcenter{\hbox{$\xymatrix@!0 @R=.7cm @C=3cm{
&\pi_C(w)\otimes p_D(x)\ar[rd]\ar@{}[dd]|\oplus&\\
\pi_C(u)\otimes v\ar[ru]\ar[rd]\ar@{}[dd]|\oplus&&y\otimes
p_D(z)\ar@{}[dd]|\oplus\\
&w\otimes x\ar[ru]\ar[rd]\ar@{}[dd]|\oplus&\\
u\otimes \pi_D(v)\ar[ru]\ar[rd]&&p_C(y)\otimes z\\
&p_C(w)\otimes \pi_D(x)\ar[ru]&
}$}}\right)$;
\vspace{.5cm}
\item $\chain{P}_3$ is the chain subcomplex defined as $\textrm{Span}\left(\vcenter{\hbox{$\xymatrix@!0 @R=.7cm @C=3cm{
&0\ar[rd]\ar@{}[dd]|\oplus&\\
0\ar[ru]\ar[rd]\ar@{}[dd]|\oplus&&0\ar@{}[dd]|\oplus\\
&0\ar[ru]\ar[rd]\ar@{}[dd]|\oplus&\\
0\ar[ru]\ar[rd]&&y\otimes z\\
&w\otimes x\ar[ru]&
}$}}\right)$.
\end{itemize}
It is easily checked that $H_0(\chain{P}_1)\cong
H_0(\chain{P}_3)\cong\{0\}$ and that $\chain{P}_2$ is isomorphic, as a
chain complex, to
\[
\xymatrix@!0@C=4cm{
C\otimes D_-+C_-\otimes D\ar[r]^-{{\textnormal{Id}}_C\otimes\partial_D+\partial_C\otimes{\textnormal{Id}}_D}&C\otimes D
\ar[r]^-{{\textnormal{Id}}_C\otimes\partial_D+\partial_C\otimes{\textnormal{Id}}_D}&\fract{C\otimes
D}/{C'_+\otimes D'_+}
},
\]
which is a partially reduced form of the chain complex associated to
$\partial_C\boxtimes\partial_D$. In
degree 0, the isomorphism is nothing but the projection $\psi$ onto
the central summand $C\otimes D$.
As a consequence, we obtain that $H(\partial_C\boxtimes\partial_D)\cong
H_0(\chain{C}\otimes_r\chain{D}) \cong
H_0(\chain{C}\otimes\chain{D}) \cong
H_0(\chain{C})\otimes H_0(\chain{D})\cong H(\partial_C)\otimes H(\partial_D)$. The homological product can hence be seen as a
subcomplex of the tensor product that contains all the homology. This
provides a substantial reduction of the length, but the variation of
the minimum
distance is, again, more difficult to estimate. However, the criterion
for a lower bound given in Theorem \ref{thm:main} still holds.
\begin{theo}\label{theo:mainBH}
Let $\qcode{C}$ be a CSS code defined by a $2$--nilpotent map
$\partial_{\qcode{C}}$, and let $g_1, \ldots, g_k\in {\textnormal{Ker}}(\partial)$ and $g_1^*, \ldots, g_k^*\in{\textnormal{Im}}(\partial)^\perp$
be such that
\[
{\textnormal{Ker}}(\partial) = {\textnormal{Im}}(\partial) \oplus
\textrm{Span}(g_1, \ldots, g_k)
{\rm ,} \quad
{\textnormal{Im}}(\partial)^\perp={\textnormal{Ker}}(\partial)^\perp \oplus
\textrm{Span}(g_1^*, \ldots, g_k^*)\quad {\rm and}\quad
\forall i,j, \langle
g_i^*, g_j \rangle = \delta_{ij}.
\]
If, for any $j_0 \in \{1, \ldots , k\}$, there exist $\Omega_{j_0} \subseteq
g_{j_0}^* + {\textnormal{Ker}}(\partial)^\perp$ and $\Omega'_{j_0} \subseteq g_{j_0} +
{\textnormal{Im}}(\partial)$, with $|\Omega_{j_0}|,\ |\Omega'_{j_0}| \geq N$
and ${\textnormal{overlap}} (\Omega_{j_0}),\ {\textnormal{overlap}} (\Omega'_{j_0}) \leq K$. Then,
for any CSS code $\qcode{D}$ defined by a $2$--nilpotent map, we have
$$
d_{\qcode{C} \boxtimes \qcode{D}} \geq \left\lceil \frac N K d_{\qcode{D}}
\right\rceil \cdot
$$
\end{theo}
\begin{proof}
Let $\chain{C}$ and $\chain{D}$ denote the chain complexes
underlying $\qcode{C}$ and $\qcode{D}$.
Lemma \ref{lem:Th} gives a lower bound for the weight of
homologically non trivial elements in the kernel of
$\partial_{\chain{C}\otimes\chain{D}}$. In particular, it holds for
elements in $\chain{P}_2$, and $\psi$ provides a one-to-one
correspondence between them and
homologically non trivial elements in the kernel of
$\partial_{\chain{C}\boxtimes\chain{D}}$. However, the map $\psi$ does not
preserve the weight. Nonetheless, using notation from Section
\ref{sec:Th}, $\psi(x_0)$ is actually equal to
$\displaystyle{\sum_{j=1}^{n_0}b_i\otimes\mathfrak{b}_i}$ so its weight is
$\displaystyle{\sum_{j=1}^{n_0}|\mathfrak{b}_i|}$, and this is precisely the
part of $|x_0|$ which is
bounded below in the proof of Lemma \ref{lem:Th}.
\end{proof}
\begin{cor}\label{cor:mainCorBH}
If $\qcode{C}$ and $\qcode{D}$ are CSS codes described by $2$--nilpotent
matrices which have no columns of zeros, then
\[
2\max(d_{\qcode{C}},d_{\qcode{D}})\leq d_{\qcode{C}\boxtimes\qcode{D}}.
\]
\end{cor}
\subsubsection{From chain complexes to 2--nilpotent maps}\label{sec:chain->nilpo}
Forgetting the grading provides a canonical way to produce a
2--nilpotent map from any chain complex. We explain now how the
tensor product of two chain complexes can be seen as extracted from the
homological product of the associated 2--nilpotent maps.
This actually corresponds to the case of 2--nilpotent
maps given with a basis such that their matrices are block-subdiagonal
with two subdiagonal blocks.
Given a CSS code $\qcode C$ associated to a chain complex
\[
{\chain{C}} =\xymatrix{\cdots \ar[r] & C_i\ar[r]^-{\partial_i}
&C_{i+1}\ar[r] ^-{\partial_{i+1}}& \cdots}
\]
where the $C_i$'s are all $\{0\}$ but finitely many of them,
we can define $C := \operatornamewithlimits{\oplus}\limits_{i \in {\mathds Z}} C_i$ and $\partial_C := \operatornamewithlimits{\oplus}\limits_{i \in {\mathds Z}}
\partial_i$.
The map $\partial_C$ is 2--nilpotent and it is easily checked that
\[
\fract{{\textnormal{Ker}} (\partial_C)}/{{\textnormal{Im}} (\partial_C)} = H_{\bullet}(\chain C) = \operatornamewithlimits{\oplus}\limits_{i \in {\mathds Z}} H_i (\chain C).
\]
In particular, $\fract{\ker (\partial_C)}/{{\textnormal{Im}} (\partial_C)}\cong H_0 (\chain C)$
whenever $\chain{C}$ is balanced.
If $\chain{C}$ and $\chain{D}$ are two reduced complexes,
then $\xymatrix{C\otimes D\ar[r]^-{\partial_C\boxtimes\partial_D}&C\otimes
D\ar[r]^-{\partial_C\boxtimes\partial_D}&C\otimes D}$ decomposes into the direct sum
$\operatornamewithlimits{\oplus}\limits_{i\in{\mathds Z}}\big\{\chain{C}\otimes\chain{D}\big\}_i$, where
$\big\{\chain{C}\otimes\chain{D}\big\}_i$ is the length three
truncature of $\chain{C}\otimes\chain{D}$ centered in degree i. They
all have null homology except for the summand $i=0$ which actually correponds to the central
part of $\chain{C}\otimes\chain{D}$. Moreover, any basis induced from
basis on $\chain{C}$ and $\chain{D}$ respects this direct sum decomposition. It follows
that $k_{\chain{C}\boxtimes\chain{D}}=k_{\chain{C}\otimes\chain{D}}$
and $d_{\chain{C}\boxtimes\chain{D}}=d_{\chain{C}\otimes\chain{D}}$.
Besides, it is easily checked that
$n_{\chain{C}\boxtimes\chain{D}}=n_{\chain{C}}n_{\chain{D}}$. Consequently,
for
$\chain{C}:=\xymatrix{{\mathds F}_2^{b_1}\ar@{^(->}[r]&{\mathds F}_2^a\ar@{->>}[r]&{\mathds F}_2^{b_2}}$
a reduced complex defining a CSS code $\qcode{C}$,
the iterated powers $\qcode{C}^{\boxtimes\ell}$, $\qcode{C}^{\otimes\ell}$ and
$\qcode{C}^{\otimes_r\ell}$ have same dimensions and minimum distances
but differents lengths, which are respectively $(a+b_1+b_2)^\ell$, $O {\left(
\frac{{(a+2\sqrt{b_1b_2})}^\ell}{\sqrt{\ell}} \right)}$ and $O {\left({(a+\sqrt{b_1b_2})}^\ell\right)}$.
\subsubsection{Comparison between tensor and homological powers}
There are two natural notions of product for CSS codes, namely tensor and homological ones, and we have observed how
to switch from one to the other.
They both generate LDPC families when used iteratively.
It is natural to question whether a construction is better than the
other. The answer is actually negative, and the qualities of the family of
codes obtained by iterated tensor or homological powers depend on the
initial descriptive type of the input codes:
\begin{itemize}
\item {\it if the input code is described by a $2$--nilpotent map},
then one can see it as coming from a chain complex with repeated
space and map. In this situation,
the homological powers of the original $2$--nilpotent map provide
shorter codes with same dimensions than the tensoriel
powers. Moreover, the control of the minimum distances provided by the
present paper is equal for both.
\item {\it if the input code is described by a general complex}, then
one can consider the underlying $2$--nilpotent map by
forgetting the grading. In this situation, the tensor powers of the original chain complex provide
shorter codes with same dimensions and minimum distances, hence better
relative parameters, than the homological powers.
\end{itemize}
A good philosophy should hence be to stick to the original nature of
the
inputs and use homological products when dealing with 2--nilpotent maps
and tensor products when dealing with chain complexes.
\subsubsection{The projective plane}
The projective plane $\P^2 ({\mathds F}_q)$ is defined as the set of
lines of ${\mathds F}_q^3$ passing through the origin. Let us remind classical
facts of this finite geometry:
\begin{prop}\label{prop:basics_finite_geom}
\begin{enumerate}[(i)]
\item[]
\item The plane contains $q^2 + q + 1$ point and $q^2 + q + 1$ lines.
\item\label{it:basics_incidence}
Every line contains $q+1$ points and every point is contained in
$q+1$ lines.
\item Every two distinct points are contained in a unique line and every two
distinct lines meet at a unique point.
\end{enumerate}
\end{prop}
Note that each of the above statements express the principle of
duality in projective planes, which swaps point and lines
and reverses inclusions.
\begin{exemple}
For $q=2$, the projective plane is also called {\em Fano plane}.
It contains 7 points and 7 lines and the point/line incidence structure
is usually represented by the picture given in Figure~\ref{fig:fano}
in which the 6 lines and the circle represent the 7 lines of $\P^2 ({\mathds F}_2)$.
\end{exemple}
\begin{figure}[!h]
\[
\dessin{2.5cm}{fano_plane}
\]
\caption{The projective plane $\P^2 ({\mathds F}_2)$.}
\label{fig:fano}
\end{figure}
Additionally we consider the {\em affine charts} of the projective plane.
\begin{defi}
An affine chart of $\P^2 ({\mathds F}_q)$ is the complement of a line.
\end{defi}
Let us list some properties of affine charts.
\begin{prop}\label{prop:prop_of_charts}
\begin{enumerate}[(i)]
\item[]
\item An affine chart is isomorphic to the affine plane over ${\mathds F}_q$;
in particular it contains $q^2$ elements.
\item\label{it:charts_orth_lines}
Let $L$ be a line in $\P^2 ({\mathds F}_q)$ and $U$ an affine chart. Then,
\begin{itemize}
\item either $L$ is the complement of $U$ and hence $L \cap U = \emptyset$;
\item or $L \cap U$ is an affine line and hence has $q$ elements.
\end{itemize}
In particular, since $q$ is even, the number of points of $L \cap U$
is always even.
\item The number of affine charts of $\P^2 ({\mathds F}_q)$ equals the number of lines
and hence equals $q^2 +q +1$.
\end{enumerate}
\end{prop}
\subsubsection{Classical codes associated to projective planes
in characteristic $2$}
We construct two \emph{binary} codes
associated to the projective space $\P^2 ({\mathds F}_q)$, with length $|\P^2 ({\mathds F}_q)| = q^2+q+1$.
Vectors of ${\mathds F}_2^{q^2+q+1}$ can be regarded as subsets of
$\P^2 ({\mathds F}_q)$ and we shall freely speak of either vectors
or subsets of $\P^2 ({\mathds F}_q)$.
From this point of view, the canonical inner product
on ${\mathds F}_2^{q^2+q+1}$ can be given a geometric interpretation since, for $S,S' \subseteq \P^2({\mathds F}_q)$:
$$
\langle S, S'\rangle = |S \cap S'| \mod 2.
$$
We introduce the codes
\begin{itemize}
\item $\code{C}_{{\rm lines}}(s)$, spanned by lines of $\P^2 ({\mathds F}_q)$;
\item $\code{C}_{{\rm planes}}(s)$, spanned by the affine charts of $\P^2 ({\mathds F}_q)$.
\end{itemize}
\begin{warning}
We want to stress the fact that, even though the projective spaces are
defined over ${\mathds F}_q$, the associated classical codes, and hence the
quantum codes to follow, are defined over ${\mathds F}_2$.
\end{warning}
The dimension of $\code{C}_{{\rm lines}} (s)$ is well--known.
\begin{prop}[{\cite{Smith}}]
\label{prop:dim_clines}
For all $s > 0$, we have $\dim_{{\mathds F}_2} \big(\code{C}_{{\rm lines}} (s)\big) = 3^s+1$.
\end{prop}
\begin{prop}
\label{prop:proj_class_codes}
For all $s \geq 1$,
\begin{enumerate}[(i)]
\item\label{it:cplanes1} $\code{C}_{{\rm planes}} (s) \subseteq \code{C}_{{\rm planes}} (s)^{\bot}$;
\item\label{it:cplanes2} $\code{C}_{{\rm planes}} (s) \subseteq \code{C}_{{\rm lines}}(s)$;
\item\label{it:cplanes3} $\code{C}_{{\rm planes}} (s) \subseteq \code{C}_{{\rm lines}} (s)^{\bot}$;
\item\label{it:lines_not_in_cplane} $\code{C}_{{\rm lines}} (s) = \code{C}_{{\rm planes}} (s)
\oplus \textrm{Span} (L)$ for every line $L \subseteq \P^2 ({\mathds F}_q)$;
\item\label{it:dim_cplanes} $\dim \big(\code{C}_{{\rm lines}} (s)\big) - \dim \big(\code{C}_{{\rm planes}} (s)\big) = 1$.
\end{enumerate}
\end{prop}
\begin{proof}
To prove (\ref{it:cplanes1}), note first that an affine chart has an even
number of points and hence is orthogonal to itself. Let $A_1, A_2$ be two
distinct affine charts. Then, there exist two distinct
lines $L_1, L_2$ such that
if we denote by ${^c X}$ the complement of a subset $X$ of $\P^2 ({\mathds F}_q)$,
then
$$
A_1 = {^c L_1} \quad {\rm and} \quad
A_2 = {^c L_2}.
$$
Thus,
$$
{ A_1 \cap A_2} = {^c ( L_1 \cup L_2)}
$$
Next, since $L_1, L_2$ are distinct to each other,
$|L_1 \cup L_2| = 2q+1$ and hence
$$
\langle A_1, A_2 \rangle \equiv |A_1 \cap A_2| \equiv |\P^2 ({\mathds F}_q)| - |L_1 \cup L_2| \equiv q^2 - q \equiv 0
\mod 2.
$$
To prove (\ref{it:cplanes2}), consider an affine chart $A$ and let $L$
be the line such that $A = {^c L}$. Let $P \in L$ be a point and $L_1, \ldots , L_q$ be all the lines containing $P$
but $L$. Then
$$
A = L_1 + \cdots + L_q.
$$
Indeed, every point $Q \in A$ is in exactly one of the $L_i$'s.
Moreover, the $L_i$'s all meet at $P$ which is the only point
in ${^c A}$ contained in the union of $L_i$'s. Since the number of the
$L_i$'s is $q$ and hence is even, then $P \notin L_1 + \cdots + L_q$.
This proves that every affine chart is a sum of lines.
Point (\ref{it:cplanes3}) is a direct consequence of Proposition~\ref{prop:prop_of_charts}(\ref{it:basics_incidence}).
To prove (\ref{it:lines_not_in_cplane}), denote by $\mathbf{1}$ the all-one
vector $(1, \ldots, 1)$. Then for all affine chart $A$, there
is a line $L$ such that ${^c A} = L$.
In terms of vectors, we get $A = L + \mathbf{1}$.
Then, let $L, L'$ be two lines of $\P^2 ({\mathds F}_q)$ and $A,A'$
be respectively the affine charts ${^c L}$ and ${^c L'}$, then
$$
L + L' = L + L' + \mathbf{1} + \mathbf{1} = A + A'.
$$
Thus,
$$
L = A+A'+L'.
$$
So far, we prove that every line $L'$ of $\P^2 ({\mathds F}_q)$ is a sum
of $L$ and an element of $\code{C}_{{\rm planes}}(s)$. This proves that
$$
\code{C}_{{\rm lines}} (s) = \code{C}_{{\rm planes}} (s) + \textrm{Span} (L).
$$
But $\langle L,L\rangle \equiv |L|
\equiv 1 \mod 2$, so $L \notin \code{C}_{{\rm lines}}^{\bot}$ and it follows hence,
from~(\ref{it:cplanes1}), that $L \notin \code{C}_{{\rm planes}} (s)$.
Finally, (\ref{it:lines_not_in_cplane}) is a direct consequence of
(\ref{it:dim_cplanes}).
\end{proof}
\begin{remarque}
Actually, $\code{C}_{{\rm planes}} (s)$ is nothing but
the {\em even subcode} of $\code{C}_{{\rm lines}} (s)$ i.e. the subcodes of
vectors of even weight.
\end{remarque}
\subsubsection{Quantum CSS codes from the projective plane in characteristic $2$}
\begin{defi}
We define $\textrm{QFG}(s)$ as the quantum code of length $q^2 + q + 1$
associated to $\code{C}_{{\rm planes}} (s) \subseteq \code{C}_{{\rm lines}} (s)$.
\end{defi}
After reduction, the corresponding chain complex is
$$
\chain{C}_\textrm{FG}(s):=\xymatrix{\relax
{\mathds F}_2^{3^s} \ar@{^(->}[r] & {\mathds F}_2^{2^{2s}+2^s+1} \ar@{->>}[r] & {\mathds F}_2^{2^{2s}+2^s-3^s}.
}
$$
Indeed, Proposition~\ref{prop:proj_class_codes}(\ref{it:dim_cplanes})
together with Proposition~\ref{prop:dim_clines}
assert that $\dim_{{\mathds F}_2} \big(\code{C}_{{\rm planes}} (s)\big) = 3^s$.
\begin{remarque}
The code $\textrm{QFG}(1)$ is nothing
but the $\llbracket 7, 1, 3 \rrbracket$ Steane code.
This fact is actually well--known, since the Steane code
is known to be constructed from the Hamming code and its dual
while the Hamming code is already known to be the code $\code{C}_{{\rm lines}} (1)$
spanned by the lines of $\P^2 ({\mathds F}_2)$.
\end{remarque}
\begin{lemme}
Let $\Omega$ be the set of lines of $\P^2 ({\mathds F}_q)$. We have
$$\Omega \subset \code{C}_{{\rm lines}} (s) \setminus \code{C}_{{\rm planes}} (s)
\quad {\rm and}\quad
\Omega \subset \code{C}_{{\rm planes}}(s)^{\bot} \setminus \code{C}_{{\rm lines}} (s)^{\bot}.$$
\end{lemme}
\begin{proof}
The first inclusion is a direct consequence of
Proposition~\ref{prop:proj_class_codes}(\ref{it:lines_not_in_cplane}).
From Proposition~\ref{prop:prop_of_charts}(\ref{it:charts_orth_lines})
every line of $\P^2 ({\mathds F}_q)$ is in $\code{C}_{{\rm planes}} (s)^{\bot}$. But
a line $L$ is not in $\code{C}_{{\rm lines}}(s)^{\bot}$. Indeed, let $L'$
be a line distinct from $L$, then
$\langle L, L' \rangle \equiv |L \cap L'| \equiv 1 \mod 2$.
\end{proof}
\begin{lemme}\label{lem:QFG_size_Omega}
$|\Omega| = q^2 +q +1$ and ${\textnormal{overlap}}(\Omega) = q+1$.
\end{lemme}
\begin{proof}
It is a direct consequence of Proposition~\ref{prop:basics_finite_geom}.
\end{proof}
\begin{prop}
For every $s \geq 1$, the family of iterated tensor powers $\textrm{QFG}(s)^{\otimes \ell}$ has
parameters
{$$
\param{\sim\frac{K_s}{\sqrt{\ell}} {\left(\left(2^{2s} + 2^s +1\right) + 2 \left(2\sqrt{3}\right)^s\sqrt{1+\left(\textrm{\scriptsize $\frac{1}{2}$}\right)^s-\left(\textrm{\scriptsize $\frac{3}{4}$}\right)^s}\right)}^\ell}{1}{\geq {\left(2^s+\frac{1}{2^s+1}\right)}^{\ell}}{\leq (2^{2s}+2^s+1)\ell}
$$}
for some constant $K_s$ depending only on $s$ and the family of iterated
reduced tensor powers $\textrm{QFG}(s)^{\otimes_r \ell}$ has parameters
{$$
\param{\sim K'_s {\left(\left(2^{2s} + 2^s +1\right) + \left(2\sqrt{3}\right)^s\sqrt{1+\left(\textrm{\scriptsize $\frac{1}{2}$}\right)^s-\left(\textrm{\scriptsize $\frac{3}{4}$}\right)^s}\right)}^\ell}{1}{\geq {\left(2^s+\frac{1}{2^s+1}\right)}^{\ell}}{\leq (2^{2s}+2^s+1)\ell}
$$}
for some constant $K'_s$ depending only on $s$.
\end{prop}
\begin{proof}
The minimum distance is a consequence of Lemma~\ref{lem:QFG_size_Omega}
and Corollary~\ref{cor:cor_of_main}.
The other parameters are obtained using Corollary~\ref{cor:ParamTensor}
and Proposition~\ref{prop:length_reduced_asym}.
\end{proof}
\subsubsection{Cyclic codes}
Here we recall very classical facts about cyclic codes. For further
details we refer the reader to \cite[Chapter 7]{SloaneMcWilliams}.
A binary {\em cyclic code} $\code{C} \subseteq {\mathds F}_2^n$ is a code which is stable
under the action of the automorphism
$$\function{\sigma}{{\mathds F}_2^n}{(x_0, \ldots, x_{n-1})}{{\mathds F}_2^n}{(x_{n-1},x_0 \ldots, x_{n-2}).}$$
\noindent In what follows we identify ${\mathds F}_2^n$ and $\fract {{\mathds F}_2[X]}/{(X^n-1)}$
using the ${\mathds F}_2$--linear isomorphism
$$
\left\{\begin{array}{ccc}
\fract {{\mathds F}_2[X]}/{(X^n-1)} &\overset{\sim}{\longrightarrow}& {\mathds F}_2^n \\
f = f_0 + f_1 X + \cdots + f_{n-1}X^{n-1} & \longmapsto &
(f_0, \ldots,f_{n-1})
\end{array}\right.
$$
and we define the weight of
a polynomial as the number of its nonzero coefficents.
Using this identification, the automorphism $\sigma$ corresponds in
$\fract {{\mathds F}_2[X]}/{(X^n-1)}$ to the multiplication by $X$.
A code $\code{C}\subset \fract {{\mathds F}_2[X]}/{(X^n-1)}$ is hence cyclic if
it is stable under the multiplication by $X$, that is if it is an ideal. Since ${\mathds F}_2 [X]$ is a principal ideal ring,
the ideals of $\fract {{\mathds F}_2[X]}/{(X^n-1)}$ are in one-to-one correspondence
with the divisors of $X^n-1$.
Given $h \in {\mathds F}_2 [X]$ such that $h ~|~ X^n-1$, the code $\code{Cyc} (h)$ is defined
as the code corresponding to the ideal generated by $h$.
It is well--known that this code has dimension $n-{\textnormal{deg}} (h)$.
The polynomial $h$ is referred to as a {\em generating polynomial}
of the code. It is unique up to multiplication by an invertible element
of $\fract {{\mathds F}_2[X]}/{(X^n-1)}$. Note that if $h_1 ~|~ h_2 ~|~ X^n-1$,
then $\code{Cyc}(h_2) \subseteq \code{Cyc}(h_1)$.
The dual of a cyclic code is cyclic and its generating polynomial can
be obtained as follows. Given a polynomial $f \in \fract {{\mathds F}_2[X]}/{(X^n-1)}$
we define
$$
\bar{f} := X^{{\textnormal{deg}} f}f\left(\frac 1 X\right),
$$
and referred to as the {\em reciprocal polynomial} of $f$. Over ${\mathds F}_2$, $X^n - 1$
is equal to its reciprocal polynomial so, if $f~|~X^n-1$, then $\bar{f}~|~X^n-1$.
Let $h$ be the polynomial such that $\bar{f}h = X^n-1$, then
$$
\code{C}(f)^{\bot} = \code{C}(h).
$$
\subsubsection{A construction of CSS codes}
The case $n = 2^s$ is actually never considered in the study of classical cyclic codes since,
in that case, the polynomial $X^n-1$ is completely inseparable and all the
constructions based on choosing divisors of $X^n-1$ having a prescribed set
of roots, such as BCH codes (see for instance \cite[Chapter 9]{SloaneMcWilliams}),
are not possible.
But oddly enough, this is precisely the case which shall lead to
interesting families
of CSS codes defined by iterated tensor powers.
In this situation $X^{2^s}-1 = (X-1)^{2^s}$ and hence the divisors of $X^n-1$
are of the form $(X-1)^r$ for all $r\in \{0, \ldots , 2^s\}$.
The corresponding cyclic codes are thus $\code{Cyc} \big((X-1)^r\big)$. Such a code
has dimension $n-r$ and
\[
{\code{Cyc}\big((X-1)^{r}\big)}^{\bot} = \code{Cyc} \big ((X-1)^{n-r}\big).
\]
\begin{defi}
For any $r<n$, we define $\textrm{QCC}(n,r)$ as the CSS code of dimension
$1$ associated to the pair of codes
$\code{Cyc}\big((X-1)^r\big) \subseteq
\code{Cyc}\big((X-1)^{r-1}\big)$.
If $g_{r} : {\mathds F}_2^{n-r} \rightarrow {\mathds F}_2^n$ and
$g_{n-r+1} : {\mathds F}_2^{r-1} \rightarrow {\mathds F}_2^n$ are, respectively,
generating maps for $\code{Cyc} \big((X-1)^{r}\big)$ and
$\code{Cyc}\big((X-1)^{r-1}\big)^{\bot} =
\code{Cyc}\big((X-1)^{n-r+1}\big)$,
then $\textrm{QCC}(n,r)$ is also defined as the CSS code associated to
$$
\chain{C}_\textrm{Cyc}:=\xymatrix{\relax {\mathds F}_2^{n-r} \ar@{^(->}[r]^-{g_r}
& {\mathds F}_2^n \ar@{->>}[r]^-{g_{n-r+1}^*} & {\mathds F}_2^{r-1}}.
$$
\end{defi}
\begin{lemme}\label{lem:binary_weight}
Let $r \leq n$ be a non negative integer. Then, the weight of $(X-1)^r \in
{\mathds F}_2[X]$ equals $2^{\textrm{w}_2(r)}$, where $\textrm{w}_2(r)$
denotes the {\em binary weight} of $r$, i.e. the weight of its decomposition
in base $2$.
\end{lemme}
\begin{proof}
We prove it by induction on $\textrm{w}_2(r)$. If $\textrm{w}_2 (r) = 1$,
then $r = 2^a$ for some non negative integer $a$ and $(X-1)^{2^a} = X^{2^a}-1$
has weight $2$. For $\textrm{w}_2(r) > 1$ then let $a :=
\lceil \log_2(r)\rceil$. Then $r = 2^a + r'$ where $r' < 2^a$ and
$\textrm{w}_2(r') = \textrm{w}_2(r)-1 $. By induction, the weight of
$(X-1)^{r'}$ equals $2^{\textrm{w}_2(r')}$. Hence
$$
(X-1)^r = (X-1)^{2^a}(X-1)^{r'} = X^{2^a} (X-1)^{r'} + (X-1)^{r'}.
$$
Since $r' < 2^a$, the polynomials $X^{2^a} (X-1)^{r'}$
and $(X-1)^{r'}$ have no common monomials and hence, the weight of
$(X-1)^r$ is twice that of $(X-1)^{r'}$. This concludes the proof.
\end{proof}
\begin{prop}
For every $\ell\in{\mathds N}$, the $\ell$--th tensor power of $\textrm{QCC}(n,r)$ has
dimension 1 and minimum distance at least $2^{\ell(s- w)}$,
where $w = \max \big({\rm w}_2(r-1), {\rm w}_2(n-r)\big)$.
\end{prop}
\begin{proof}
To prove the statement, we apply Corollary \ref{cor:cor_of_main} with
\begin{align*}
\Omega & := \left\{X^i (X-1)^{r-1} \mod (X-1)^n \ \big|\ i \in \{0, \ldots, n-1\}\right\} \\
\Omega'& := \left\{X^i (X-1)^{n-r} \mod (X-1)^n \ \big|\ i \in \{0, \ldots, n-1\}\right\}.
\end{align*}
Both sets have cardinality $n = 2^s$, and their respective overlaps are
\[
{\textnormal{overlap}} (\Omega) = {\rm w}_2(r-1) \qquad {\rm and} \qquad
{\textnormal{overlap}} (\Omega') = {\rm w}_2(n-r).
\]
Indeed, stacking the elements of $\Omega$, we obtain a circulant
matrix whose column weight equals the row weight.
But the latter is given by Lemma~\ref{lem:binary_weight}.
This concludes the proof.
\end{proof}
\begin{cor}\label{cor:param_QCycl}
For $n = 2^s$ and $r = 2^{\frac s 2} = \sqrt{n}$, where $s$ is an
even integer, the family
of iterated tensor powers $\textrm{QCC}(n,r)^{\otimes\ell}$ has parameters
$$
\param{\sim\frac{K_n}{\sqrt{\ell}}{\left(n+2n^{\frac{3}{4}}\left(1- \frac{1}{\sqrt{n}}\right)\right)}^\ell}{1}{\geq {\sqrt{n}}^\ell}{\leq \sqrt{n}\ \ell}
$$
for some constant $K_n$ depending only on $n$
and the family
of iterated reduced tensor powers $\textrm{QCC}(n,r)^{\otimes\ell}$ has parameters
$$
\param{\sim K'_n {\left(n + n^{\frac 3 4}\left(1-\frac{1}{\sqrt{n}}\right) \right)}^\ell}{1}{\geq {\sqrt{n}}^\ell}{\leq \sqrt{n}\ \ell}
$$
for some constant $K_n'$ depending only on $n$.
\end{cor}
\begin{proof}
We have $r-1 = 1+2+\cdots + 2^{\frac s 2 - 1}$
and $n - r = 2^s - 2^{\frac s 2} = 2^{\frac s 2}(2^{\frac s 2} - 1) = 2^{\frac s 2}
(1+2+ \cdots + 2^{\frac s 2 -1})$.
It follows that ${\rm w}_2 (r-1) = {\rm w}_2 (n-r) = \frac s 2$. The
minimum distance is thus a consequence of
Corollary~\ref{cor:cor_of_main} and the length a consequence of Corollary~\ref{cor:ParamTensor}
and Proposition~\ref{prop:length_reduced_asym}.
\end{proof}
\section*{Introduction}
\input{0.1.Introduction}
\subsection*{Organization}
\input{0.2.Organization}
\subsection*{Notation}
\input{0.3.Notation}
\subsection*{Acknowledgements}
\input{0.4.Acknowledgement}
\section{Some background}
\label{sec:Background}
\subsection{Chain complexes}
\label{sec:ChainComplexes}
\input{1.1.ChainComplexes}
\subsection{Classical codes}
\label{sec:ClassicalCodes}
\input{1.2.ClassicalCodes}
\subsection{CSS codes}
\label{sec:CSS}
\input{1.3.CSSCodes}
\section{Tensor products of CSS codes}
\label{sec:Main}
\subsection{Definitions}
\label{sec:CSSpowers}
\input{2.1.CSSProduct}
\subsection{A minimum distance result}
\label{sec:Th}
\input{2.2.Lemma}
\subsection{Some direct consequences}
\label{sec:Consequences}
\input{2.3.DirectConsequences}
\section{Reinterpretation of known results}
\label{sec:KnownResults}
\subsection{Tillich--Zemor codes}
\label{sec:TZ}
\input{3.1.TillichZemor}
\subsection{Khovanov codes}
\label{sec:Khovanov}
\input{3.2.Khovanov}
\subsection{Product of Steane $\llbracket7;1;3\rrbracket$ codes}
\label{sec:Steane}
\input{3.3.Steane}
\subsection{Bravyi--Hastings homological product}
\label{sec:BH}
\input{3.4.BravyiHastings}
\section{New families of codes}
\label{sec:NewFamilies}
\input{4.0.Intro_new_families}
\subsection{Quantum finite geometry codes}
\label{sec:QFG}
\input{4.2.QFG}
\subsection{Quantum cyclic codes}
\label{sec:QCyclic}
\input{4.3.QCyclic}
\subsection{Quantum Reed--Muller codes}
\label{sec:QRM}
\input{4.1.QRM}
\bibliographystyle{amsalpha}
| {'timestamp': '2017-11-03T01:09:18', 'yymm': '1512', 'arxiv_id': '1512.07081', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.07081'} | arxiv |
\section{Introduction}
This article focuses on a microscopic study of a simulation tool for pedestrian flow. The object of the study is a simulation of one rather small room with one exit and one multiple entrance, which may be considered as one segment of a large network. The behaviour of pedestrians in such environment has been studied by our group by means of variety experiments~\cite{BukHraKrb2015TGF,BukHraKrb2014Procedia} from the view of the boundary induced phase transition (this has been studied theoretically for Floor-Field model in~\cite{EzaYanNis2013JCA}). Observing data from these experiments we have found out that each participant has different ability to push through the crowd. Therefore, this article is motivated by the aim to mimic such behaviour by simple cellular model, which may be applied in simulations of apparently heterogeneous scenarios as~\cite{KleWas2014LNCS,SpaGeoSir2014LNCS}.
The original model is based on the Floor-Field Model~\cite{BurKlaSchZitPhysicaA2001,KirSch2002PhysicaA,Kretz2007PhD} with \emph{adaptive time-span}~\cite{BukHraKrb2014LNCS} and \emph{principle of bonds}~\cite{HraBukKrb2013JCA}. The adaptive time span enables to model heterogeneous stepping velocity of pedestrians; the principle of bonds helps to mimic collective behaviour of pedestrians in lines. It is worth noting that there is a variety of modifications of the Floor-Field model capturing different aspects of pedestrian flow and evacuation dynamics. Quite comprehensive summary can be found in~\cite{SchChoNis2010}.
In this article we focus on the solution of conflicts, which accompany all cellular models with parallel update, i.e., when more agents decide to enter the same site/cell. In such case, one of the agents can be chosen at random to win the conflict, the randomness can be executed proportionally to the hopping probability of conflicting agents~\cite{BurKlaSchZitPhysicaA2001}. The unresolved conflicts play an important role in models of pedestrian evacuation. The aim to attempt the same cell may lead to the blocking of the motion. This is captured by the friction parameter $\mu$ denoting the probability that none of the agent wins the conflict. An improvement is given by the friction function~\cite{YanKimTomNisSumOhtNish2009PRE}, which raises the friction according to the number of conflicting agents.
In our approach we introduce an additional property determining the agent's ability to win conflicts, which may be understood as agent's aggressiveness. This characteristics has been inspired by the analyses of repeated passings of pedestrians through a room under various conditions from free flow to high congestion. As will be shown below, this characteristics significantly affects the time spent by individual agents in the room, which is referred to as the \emph{travel time}. Similar heterogeneity in agents behaviour has been used in~\cite{JiZhouRan2013PhysicaA}, where the ``aggressiveness'' has been represented by the willingness to overtake.
\section{Experiment}
The introduction of the aggressiveness as an additional model parameter is motivated by the microscopic analyses of the experimental data from the experiment ``passing-through'' introduced in~\cite{BukHraKrb2014Procedia}. The set-up of the experiment is shown in Figure~\ref{fig:setting}. Participants of the experiment were entering a rectangle room in order to pass through and leave the room via the exit placed at the opposite wall to the entrance.
\begin{figure}[h!]
\begin{center}
\hfill\includegraphics[height=.27\textwidth]{CP92_fig1a}\hfill
\includegraphics[height=.27\textwidth]{CP92_fig1b}\hfill\phantom{x}
\end{center}
\caption{Taken from~\cite{BukHraKrb2014Procedia}. Left: Experimental setting the experiment, a = 7.2~m, b = 4.4~m. After the passage through the exit, participant returned to the area Y waiting for another entry. Right: sketch of pedestrian's hat used for automatic image recognition.}
\label{fig:setting}
\end{figure}
The inflow rate of pedestrians has been controlled in order to study the dependence of the phase (free flow or congested regime) on the inflow rate $\alpha$. In order to keep stable flow through the room, pedestrians were passing the room repeatedly during all runs of the experiment.
Each participant has been equipped by a hat with unique binary code. The automatic image recognition enables us not only to restore the pedestrians trajectories but more over to assign all trajectories to individual participants. This enables the study of individual properties of the pedestrians under a bride scale of conditions, since for each participant there are 20 to 40 records of their passings.
One of the investigated quantities is the travel-time $TT=T_\mathrm{out}-T_\mathrm{in}$ denoting the length of the interval a pedestrian spent in the room between the entrance at $T_\mathrm{in}$ and the egress at $T_\mathrm{out}$. To capture the pedestrians behaviour under variety of conditions, the travel time is investigated with respect to the average number of pedestrians in the room $N_\mathrm{mean}$ defined as
\begin{equation}
\label{eq:Nmean}
N_\mathrm{mean}=\frac{1}{T_\mathrm{out}-T_\mathrm{in}}\int_{T_\mathrm{in}}^{T_\mathrm{out}}N(t)\mathrm{d}t\,,
\end{equation}
where $N(t)$ stands for the number of pedestrians in the room at time $t$.
Figure~\ref{fig:TT-Nmean} shows the scatter plot of all pairs $(N_\mathrm{mean},TT)$ gathered over all runs of experiment and all participants.
\begin{figure}
\centering
\includegraphics[scale=.8]{CP92_fig2}
\caption{Scatter plot of the travel time $TT$ with respect to the occupancy $N_\mathrm{mean}$ extracted from the experiment. Three participants are highlighted. Their travel time is approximated by the piecewise linear model. We can see that Ped. 2 has lower desired velocity in free regime but higher ability to push through the crowd in comparison to Ped. 4.}
\label{fig:TT-Nmean}
\end{figure}
The reaction of participants on the occupancy of the room significantly differs. There are two basic characteristics of that can be extracted: the mean travel time in the free-flow regime (0 - 7 pedestrians) and the slope of the travel-time dependence on the number of pedestrians in the congested regime (10 - 45 pedestrians). The former is given by the desired velocity, the latter reflects the ability to push through the crowd, referred to as the aggressiveness. This observation corresponds to the piece-wise linear model for each pedestrian
\begin{equation}
\label{eq:plm}
TT=\frac{S}{v_0(i)} + \mathbf{1}_{\{N>7\}}(N-7) \cdot \mathrm{slope}(i) + \mathrm{noise}\,
\end{equation}
where $S=7.2$~m, $v_0(i)$ is the free-flow velocity of the pedestrian $i$, $\mathrm{slope}(i)$ is the unique coefficient of the linear model for pedestrian $i$. The breakpoint $N=7$ depends from the room geometry. The weighted mean of the $R^2$ value of the model~(\ref{eq:plm}) is 0.688.
Detailed description of the experiment and its analyses has been presented at the conference TGF 15 and will be published in the proceedings~\cite{BukHraKrbTGF15}. Videos capturing the exhibition of the aggressive behaviour are available at \url{http://gams.fjfi.cvut.cz/peds}.
\section{Model Definition}
The model adapts the principle of the known Floor-Field cellular model. The playground of the model is represented by the rectangular two-dimensional lattice $\mathbb{L}\subset\mathbb{Z}^2$ consisting of cells $x=(x_1,x_2)$. Every cell may be either occupied by one agent or empty. Agents are moving along the lattice by hopping from their current cell $x\in\mathbb{L}$ to a neighbouring cell $y\in\mathcal{N}(x)\subset\mathbb{L}$, where the neighbourhood $\mathcal{N}(x)$ is Moore neighbourhood, i.e.,
$
\mathcal{N}(x)=\left\{y \in \mathbb{L};~\max_{j=1,2}|x_{j}-y_{j}|\leq1\right\}\,.
$
\subsection{Choice of the New Target Cell}
Agents choose their target cells $y$ from $\mathcal{N}(x)$ stochastically according to probabilistic distribution $P\left(y\mid x; \mathrm{~state~of~} \mathcal{N}(x)\right)$, which reflects the ``attractiveness'' of the cell $y$ to the agent. The ``attractiveness'' is expressed by means of the static field $S$ storing the distances of the cells to the exit cell $E=(0,0)$, which is the common target for all agents. For the purposes of this article, the euclidean distance has been used, i.e., $S(y)=\sqrt{|y_{1}|^2+|y_{2}|^2}$. Then it is considered
$P(y \mid x)\propto\exp\{-k_SS(y)\}$, for $y\in\mathcal{N}(x)$. Here $k_S\in[0,+\infty)$ denotes the parameter of sensitivity to the field $S$.
The probabilistic choice of the target cell is further influenced by the occupancy of neighbouring cells and by the diagonality of the motion. An occupied cell is considered to be less attractive, nevertheless, it is meaningful to allow the choice of an occupied cell while the principle of bonds is present (explanation of the principle of bonds follows below). Furthermore, the movement in diagonal direction is penalized in order to suppress the zig-zag motion in free flow regime and support the symmetry of the motion with respect to the lattice orientation.
Technically this is implemented as follows. Let $O_{x}(y)$ be the identifier of agents occupying the cell $y$ from the point of view of the agent sitting in cell $x$, i.e. $O_{x}(x)=0$ and for $y\neq x$ $O_{x}(y)=1$ if $y$ is occupied and $O_{x}(y)=0$ if $y$ is empty. Then $P(y\mid x)\propto(1-k_OO_x(y))$, where $k_O\in[0,1]$ is again the parameter of sensitivity to the occupancy ($k_O=1$ means that occupied cell will never be chosen). Similarly can be treated the diagonal motion defining the diagonal movement identifier as $D_{x}(y)=1$ if $(x_{1}-y_{1})\cdot(x_{2}-y_{2})\neq0$ and $D_{x}(y)=0$ otherwise. Sensitivity parameter to the diagonal movement is denoted by $k_D\in[0,1]$ ($k_D=1$ implies that diagonal direction is never chosen).
The probabilistic choice of the new target cell can be than written in the final form
\begin{equation}
\label{eq:Pxy}
P(y\mid x)=\frac{\exp\big\{-k_{S}S(y)\big\}\big(1-k_{O}O_{x}(y)\big)\big(1-k_{D}D_{x}(y)\big)}{\sum_{z\in\mathcal{N}(x)}\exp\big\{-k_{S}S(z)\big\}\big(1-k_{O}O_{x}(z)\big)\big(1-k_{D}D_{x}(z)\big)}\,.
\end{equation}
It is worth noting that the site $x$ belongs to the neighbourhood $\mathcal{N}(x)$, therefore the equation~(\ref{eq:Pxy}) applies to $P(x\mid x)$ as well.
\subsection{Updating Scheme}
The used updating scheme combines the advantages of fully-parallel update approach, which leads to necessary conflicts, and the asynchronous clocked scheme~\cite{CorGreNew2005PhysicaD} enabling the agents to move at different rates.
Each agent carries as his property the \emph{own period} denoted as $\tau$, which represents his desired duration between two steps, i.e., the agent desires to be updated at times $t=k\tau$, $k\in\mathbb{Z}$. Such principle enables to model different velocities of agents, but undesirably suppresses the number of conflicts between agents with different $\tau$. To prevent this, we suggest to divide the time-line into isochronous intervals of the length $h>0$. During each algorithm step $k\in\mathbb{Z}$ such agents are updated, whose desired time of the next actualization lies in the interval $\big[kh,(k+1)h\big)$. A wise choice of the interval length $h$ in dependence on the distribution of $\tau$ leads to the restoration of conflicts in the model. It worth noting that we use the concept of adaptive time-span, i.e., the time of the desired actualization is recalculated after each update of the agent, since it can be influenced by the essence of the motion, e.g., diagonal motion leads to a time-penalization, since it is $\sqrt{2}$ times longer. For more detail see e.g.~\cite{BukHraKrb2014LNCS}. This is an advantage over the probabilistic approach introduced in~\cite{BanCroViz2015TGF}.
\subsection{Principle of Bonds}
The principle of bonds is closely related to the possibility of choosing an occupied cell. An agent who chooses an occupied cell builds a bond to the agent sitting in the chosen cell. This bond lasts until the motion of the blocking agent or until the next activation of the bonded agent. The idea is that the bonded agents attempt to enter their chosen cell immediately after it becomes empty.
\subsection{Aggressiveness and Solution of Conflicts}
The partially synchronous updating scheme of agents leads to the kind of conflicts that two ore more agents are trying to enter the same cell. This occurs when more agents choose as their target cell the same cell, or when more agents are bonded to the same cell, which becomes empty. The mechanism of the conflict solution is the same in both cases. Each agent carries an information about his ability to ``win'' conflicts which is here referred to as aggressiveness and denoted by letter $\gamma\in[0,1]$. The conflict is always won by agents with highest $\gamma$.
If there are two or more agents with the highest $\gamma$, the friction parameter $\mu$ plays a role. In this article we assume that the higher is the aggressiveness $\gamma$, the less should be the probability that none of the agents wins the conflict. Therefore, the conflict is not solved with probability $\mu(1-\gamma)$ (none of the agents move). With complement probability $1-\mu(1-\gamma)$ the conflict resolves to the motion of one of the agents. This agent is chosen randomly with equal probability from all agents with involved in the conflict having the highest $\gamma$. The mechanism of the friction can be easily modified. An example of conflict solution is depicted in Figure~\ref{fig:conflict}.
\begin{figure}
\centering
\includegraphics[scale=1]{CP92_fig3}
\caption{Conflict solution for $\gamma_1<\gamma_2$. Left: More aggressive wins the conflict over two less aggressive. Right: The conflict of two more aggressive can resolve by the blocking of the movement.}
\label{fig:conflict}
\end{figure}
\section{Impact of the Aggressiveness Element}
The effect of the aggressiveness has been studied by means of the simulation. Results stressed in this article come from the simulations with parameters given by Table~\ref{tab:param}. The values of $\tau$ and $\gamma$ are distributed among agents uniformly and independently on each other.
\begin{table}
\caption{Values of parameters used for simulation.}
\label{tab:param}
\centering
\begin{tabular}{p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}}
\hline
$k_S$ \centering & \centering $k_O$ & \centering $k_D$ &\centering $h$ & \centering $\mu$ & \centering $\tau$ & ~~~~$\gamma$\\
3.5 \centering &\centering 1 & \centering 0.7 & \centering 0.1~s &\centering 0.5 & \centering $\left\{.25, .4\right\}$ & ~~$\{0,1\}$\\
\hline
\end{tabular}
\end{table}
The simulation set-up has been designed according to the experiment, i.e., the room of the size $7.2~\mathrm{m} \times 4.4~\mathrm{m}$ has been modelled by the rectangular lattice 18 sites long and 11 sites wide. The size of one cell therefore corresponds to $0.4~\mathrm{m}\times 0.4~\mathrm{m}$. The exit is placed in the middle of the shorter wall, the open boundary is modelled by a multiple entrance on the opposite wall. New agents are entering the lattice stochastically with the mean inflow rate $\alpha$~[pedestrians/second]. The inflow rate is a controlled parameter. For more detailed description of the simulation we refer the reader to~\cite{BukHra2014LNCS}.
It has been shown that such system evinces the boundary induced phase transition from the free flow (low number of agents in the lattice) to the congestion regime (high number of pedestrians in the lattice) via the transient phase (number of pedestrians fluctuating between the low and high value). Therefore, wise choice of different inflow rates $\alpha$ covering the all three phases, enables us to study the dependence of the travel time $TT$ on the average number of agents in the lattice $N_\mathrm{mean}$. When simulating with parameters from Table~\ref{tab:param}, the correct choice of inflow rate is $\alpha\in[1,3]$.
Figure~\ref{fig:TT-N} shows the dependence of the travel time $TT=T_\mathrm{out}-T_\mathrm{in}$ on the average number of agents in the lattice $N_\mathrm{mean}$ calculated according to~(\ref{eq:Nmean}). Measured data consisting of pairs $(N_\mathrm{mean},TT)$ are aggregated over simulations for inflow rate values $\alpha\in\{1, 1.5, 1.8, 2.0, 2.3, 2.7, 3.0\}$; for each inflow $\alpha$ twenty runs of the simulation have been performed. Each run simulates 1000~s of the introduced scenario starting with empty room. Agents were distributed into four groups according their own period $\tau$ and aggressiveness $\gamma$, namely ``fast aggressive'' ($\tau=0.25$, $\gamma=1$), ``fast calm'' ($\tau=0.25$, $\gamma=0$), ``slow aggressive'' ($\tau=0.4$, $\gamma=1$), and ``slow calm'' ($\tau=0.4$, $\gamma=0$).
\begin{figure}[htb]
\includegraphics[width=\textwidth]{CP92_fig4}
\caption{Dependence of the mean travel time $TT$ on the average occupancy $N_\mathrm{mean}$ for each group of agents. Gray lines represent the quantiles of the travel time regardless to the groups. Top: heterogeneity in both, $\gamma$ and $\tau$. Bottom left: heterogeneity in $\tau$. Bottom right: heterogeneity in $\gamma$.}
\label{fig:TT-N}
\end{figure}
In the graph of the Figure~\ref{fig:TT-N} we can see the average travel time for each group calculated with respect to the occupancy of the room. It is evident that for low occupancy up to 10 agents in the room the mean travel time for each group levels at a value corresponding to the free flow velocity given by the own updating period. For the occupancy above 20 agents in the lattice, the linear growth of the mean travel time with respect to $N_\mathrm{mean}$ is obvious. Furthermore, the average travel time for fast-calm corresponds to the travel time of slow aggressive. The Figure~\ref{fig:TT-N} shows two auxiliary graphs presenting the dependence of $TT$ on $N_\mathrm{mean}$ for systems with homogeneity in $\gamma$ (left) or in $\tau$ (right). From the graphs we can conclude that the heterogeneity in aggressiveness $\gamma$ reproduces the desired variance in the slope of the graph without the non-realistic high variance in free flow generated by the heterogeneity of own updating frequency.
The influence is even more evident from the graph in Figure~\ref{fig:TT-Tout} representing a plot of all travel time entries with respect to the time of the exiting $T_\mathrm{out}$. Right graph shows the box-plots of the travel time for four groups measured after 500~s from the initiation, i.e., in the steady phase of the system. We can see that in this view, the aggressiveness plays more important role that the desired velocity of agents.
\begin{figure}
\includegraphics[width=\textwidth]{CP92_fig5}
\caption{Left: Development of travel time $TT$ in time for one run of the simulation. The value $TT$ is plotted against the time of the exit $T_\mathrm{out}$ to ensure that values corresponding to the same time stem from similar conditions near the exit. Inflow rate $\alpha=3$~ped/s. The agent group is indicated by the color. Right: Box-plots of the travel time for entries with $T_\mathrm{in}>500$~s (i.e. in the steady state).}
\label{fig:TT-Tout}
\end{figure}
\section{Conclusions and Future Work}
The article introduced a parameter of aggressiveness as an additional characteristics of agents in the Floor-Field model with adaptive time. This parameter is understood as an ability to win conflicts. Therefore the heterogeneity of agents is given by their desired velocity (determined by the own period $\tau$) and their ability to win conflicts referred to as the aggressiveness.
The simulation study shows that the aggressiveness has significant influence in the regime with high occupation of the room, i.e., in the dense crowd, and on the other hand has no effect in the free flow, as desired. The linear dependence of the travel time on the number of pedestrians in the agents neighbourhood seems to be a good tool how to measure the ability of agents/pedestrians to push through the crowd. The independence of this ability on the desired velocity of agents is very important to mimic the aspect that some ``fast'' pedestrians can be significantly slowed down by the crowd while some ``slow'' pedestrians can push through the crowd more effectively.
We believe that such feature can be very useful in the simulation of the evacuation or egress of large complexes as e.g. football stadiums, where the less aggressive pedestrians (parents with children, fragile women) can be slowed down and leave the facility significantly later than the average. The model reproduces this aspect even in the case of the homogeneity in own period $\tau$.
In the future we plan to study this aspect in more detail. Mainly we would like to focus on the joint distribution of the desired velocity $\tau$ and the aggressiveness $\gamma$ among the population and study its impact by means of the proposed model.
\subsection*{Acknowledgements.} This work was supported by the Czech Science Foundation under grants GA13-13502S (P. Hrab\'ak) and GA15-15049S (M. Buk\'a\v cek). Further support wa provided by the CTU grant SGS15/214/OHK4/3T/14.
\bibliographystyle{splncs03}
| {'timestamp': '2015-12-23T02:06:33', 'yymm': '1512', 'arxiv_id': '1512.07038', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.07038'} | arxiv |
\section{Introduction}
\label{sec:intro}
Strategies are well described in the framework of sequential games, aka. games in
extensive forms with perfect information. In this paper, we describe rational strategies
leading to divergence.\footnote{In this paper we use ``divergence'' instead of
``escalation'' since it is somewhat dual convergence a concept which plays a key
role in what follows.} Indeed
divergence understands that the games, the strategies and the strategy profiles are
infinite. We present the notion of infinite strategy profiles
together with the logical framework to reason on those objects, namely coinduction.
\section{Decisions in Finite Strategy Profiles}
\label{sec:fin_Strat_Prof}
To present strategy reasoning, we use one of the most popular framework, namely
\emph{extensive games with perfect information} (\cite{osborne04a} Chapter 5 or \cite{shaun04:_game_theor}) and we
adopt its terminology. In particular we call \emph{strategy profile} an
\emph{organized} set of strategies, merging the decisions of the agents. This
organization mimics this of the game and has the same structure as the game
itself. They form the set\footnote{To be correct, we should say the \emph{``they
form the coalgebra''}.} \textsf{StratProf}. By \emph{``organized''}, we mean
that the strategic decisions are associated with the nodes of a tree which correspond
to positions where agents have to take decisions. In our approach strategy profiles
are first class citizens and games are byproduct. In other words, strategy profiles
are defined first and extensive games are no more than strategy profiles where all
the decisions have been erased. Therefore we will only speak about strategy
profiles, keeping in mind the underlying extensive game, but without giving them a
formal definition\footnote{A direct definition of games is possible, but is not necessary in
this paper.}. For simplicity and without loss of generality, we consider only
dyadic strategy profiles (i.e.; double choice strategy profiles) , that are strategy profiles with only two choices at each
position. Indeed it is easy to figure out how multiple choice extensive strategy
profiles can be represented by double choice extensive strategy profiles. We let the
reader imagine such an embedding. Therefore, we consider a set of choices:
$\mathsf{Choice} = \{1,2\}$.
Along the paper, our examples need only a set of two agents: $\mathsf{Agent} =
\{\All, \textsf{B}\}$. In this paper we use coinduction and corecursion as basic tools for
reasoning correctly about and defining properly infinite objects. Readers who want
to know more about those concepts are advised to read introductory
papers~\cite{jacobs12:_introd_coalg,DBLP:journals/tcs/Rutten00}, while specific
applications to infinite strategy profiles and games are introduced in
\cite{lescanne14:_intel}.
\begin{definition}
A \emph{finite strategy profile} is defined \emph{by induction} as follows:
\begin{itemize}
\item either given a \emph{utility assignment} $u$ (i.e., a function $u:
\mathsf{Agent} "->" \ensuremath{\mathbb{R}}$) $\prof{u}$ is a \emph{finite strategy profile}, which
corresponds to an ending position.
\item or given an \emph{agent} $a$, a \emph{choice} $c$ and two \emph{finite strategy profiles} $s_1$ and
$s_2$, $\prof{a, c, s_1, s_2}$ is a \emph{finite strategy profile}.
\end{itemize}
\end{definition}
For instance, a strategy profile can be drawn easily with the convention that $1$ is
represented by going down and $2$ is represented by going right. The chosen
transition is represented by a double arrow
$\xymatrix@C=10pt{\ar@[blue]@{=>}@/^.3pc/[rr]&&}$. The other transition is
represented by a simple arrow $\xymatrix@C=10pt{\ar@/^.3pc/[rr]&&}$. For instance
\begin{displaymath}
\xymatrix@C=10pt{
&\ar@{.>}[r]& *++[o][F]{\mbox{\footnotesize \textsf{A}}} \ar@[blue]@{=>}@/^1pc/[rr]^2 \ar@/^/[d]^1
&&*++[o][F]{\mbox{\footnotesize \textsf{B}}} \ar@/^1pc/[rr]^2 \ar@[blue]@{=>}@/^/[d]^1 && 0,5\\
&&1,0.5&&2,1
}
\end{displaymath}
is a graphic representation of the strategy profile \[s_{`a} = \prof{\All, 2,
\prof{\All"|->"1,\textsf{B}"|->"0.5},\prof{\textsf{B},1,\prof{\All"|->"2,\textsf{B}"|->"1},\prof{\All"|->"0,\textsf{B}"|->"5}}}.\]
From a finite strategy profile, say $s$, we can define a \emph{utility
assignment}, which we write $\widehat{s}$ and which we define as
follows:
\begin{itemize}
\item $\widehat{\prof{u}} = u$
\item $\widehat{\prof{a,c,s_1,s_2}} = \mathbf{case~} c \mathbf{~of~} 1
"->"\widehat{s_1} \mid 2 "->" \widehat{s_2}$
\end{itemize}
For instance $\widehat{s_{`a}}(\All) = 2$ and $\widehat{s_{`a}}(\textsf{B}) = 1$.
We define an equivalence $s=_g s'$ among finite strategy profiles, which we read as \emph{``$s$ and $s'$
\emph{have the same (underlying) game}''}.
\begin{definition}
We say that two strategy profiles $s$ and $s'$ \emph{have the same game} and we
write $s=_g s'$ iff by induction
\begin{itemize}
\item either $s=\prof{u}$ and $s'=\prof{u}$
\item or $s=\prof{a,c,s_1,s_2}$ and $s'=\prof{a',c',s_1',s_2'}$ and $a=a'$,
$s_1=_g s_1$ and $s_2=_g s_2'$.
\end{itemize}
\end{definition}
We can define a family of finite strategy profiles that are of interest for decisions.
First we start with \emph{backward induction}. Following~\cite{vestergaard06:IPL},
we consider `backward induction', not as a reasoning method, but as a predicate that
specifies some strategy profiles.
\begin{definition}[Backward induction]
A finite strategy profile $s$ is \emph{backward induction} if it satisfies the predicate
$\mathsf{BI}$, where $\mathsf{BI}$ is defined recursively as follows:
\begin{itemize}
\item $\mathsf{BI}(\prof{u})$, i.e., by definition an ending position is `backward induction'.
\item $\mathsf{BI}(\prof{a, 1, s_1, s_2}) \ "<=>"\ \mathsf{BI}(s_1) \wedge \mathsf{BI}(s_2) \wedge \widehat{s_1}
\ge \widehat{s_2}$.
\item $\mathsf{BI}(\prof{a, 2, s_1, s_2}) \ "<=>"\ \mathsf{BI}(s_1) \wedge
\mathsf{BI}(s_2) \wedge \widehat{s_2} \ge \widehat{s_1}$.
\end{itemize}
\end{definition}
In other words, a strategy profile which is not an ending position is `backward
induction' if both its direct strategy subprofiles are and if the choice leads to a
better utility, as shown by the comparison of the utility assignments to the direct
strategy subprofiles. The two following strategy profiles are `backward
induction'~\cite{osborne04a}(Example~158.1)
\begin{displaymath}
\xymatrix@C=10pt{
&\ar@{.>}[r]& *++[o][F]{\mbox{\footnotesize \textsf{A}}} \ar@/^1pc/[rr]^2 \ar@[blue]@{=>}@/^/[d]^1
&&*++[o][F]{\mbox{\footnotesize \textsf{B}}} \ar@/^1pc/[rr]^2 \ar@[blue]@{=>}@/^/[d]^1 && 2,1\\
&&1,2&&0,1
}
\qquad
\xymatrix@C=10pt{
&\ar@{.>}[r]& *++[o][F]{\mbox{\footnotesize \textsf{A}}} \ar@[blue]@{=>}@/^1pc/[rr]^2 \ar@/^/[d]^1
&&*++[o][F]{\mbox{\footnotesize \textsf{B}}} \ar@[blue]@{=>}@/^1pc/[rr]^2 \ar@{->}@/^/[d]^1 && 2,1\\
&&1,2&&0,1
}
\end{displaymath}
An agent is rational if she makes a choice dictated by backward induction and if she
keeps being rational in the future. We write this predicate $\ensuremath{\mathsf{Rat}_{f}}$ where the index
$f$ insists on finiteness making it distinct from the predicate $\ensuremath{\mathsf{Rat}_{\infty}}$ on infinite
strategy profiles.
\begin{definition}[Rationality for finite strategy profiles]\label{def:rat}
The predicate $\ensuremath{\mathsf{Rat}_{f}}$ is defined recursively as follows:
\begin{itemize}
\item $\ensuremath{\mathsf{Rat}_{f}}(\prof{u})$,
\item $\ensuremath{\mathsf{Rat}_{f}}(\prof{a, c, s_1, s_2}) "<=>" `E \prof{a, c, s_1', s_2'}`: \mathsf{StratProf},$~\\
\hspace*{.5\textwidth}\parbox{.5\textwidth}{\begin{itemize}
\item $\prof{a, c, s_1', s_2'} =_g\prof{a, c, s_1, s_2}$
\item $\mathsf{BI}(\prof{a, c, s_1', s_2'})$
\item $\ensuremath{\mathsf{Rat}_{f}}(s_c)$
\end{itemize}}
\end{itemize}
\end{definition}
Then we can state a variant of Aumann theorem~\cite{aumann95} saying that backward
induction coincides with rationality.
\begin{theorem}
\begin{math}
`A s`:\mathsf{StratProf}, \ensuremath{\mathsf{Rat}_{f}}(s) "<=>" \mathsf{BI}(s).
\end{math}
\end{theorem}
\section{Decisions in Infinite Strategy Profiles}
\label{sec:inf_Strat_Prof}
We extend the concept of backward induction and the concept of rationality to
infinite strategy profiles. For that, we replace induction by
coinduction.\footnote{For readers not familiar with coinduction and not willing
to read~\cite{jacobs12:_introd_coalg} or~\cite{DBLP:journals/tcs/Rutten00}, we advise her to
pretend just that corecursive definitions define infinite objects and coinduction
allows reasoning specifically on their infinite aspects, whereas recursive definition define
finite objects and induction allows reasoning on their finite aspects.} Notice that we mix up
recursive and corecursive definitions, and that we reason sometime by induction and
sometime by coinduction. Therefore we advise the reader to be cautious and to pay
attention to when we use one or the other.
\ifLONG
\footnote{Notice that not all the authors
are as cautious. For instance, Hargreaves-Heap and Varoufakis write
(\cite{shaun04:_game_theor} p.27) ``\emph{The idea [of common knowledge] reminds
one what happens when a camera is pointing to a television screen that conveys the
same image recorded by the same camera:} an infinite self-reflection''. Indeed
\emph{common knowledge} is typically inductive whereas \emph{infinite
self-reflection} is typically coinductive.}
\fi
We write $\mathsf{InfStratProf}$
the set of finite or infinite strategy profiles.
\begin{definition}
The set \emph{finite or infinite strategy profiles} $\mathsf{InfStratProf}$ is
defined \emph{corecursively} as follows:
\begin{itemize}
\item either given a \emph{utility assignment} $u$, then $\prof{u}`:
\mathsf{InfStratProf}$, which corresponds to an ending position.
\item or given an \emph{agent} $a$, a \emph{choice} $c$ and two \emph{strategy
profiles} $s_1`:\mathsf{InfStratProf}$ and $s_2`:\mathsf{InfStratProf}$, then
$\prof{a, c, s_1, s_2}`: \mathsf{InfStratProf}$.
\end{itemize}
\end{definition}
We cannot define the utility assignments on all infinite strategy profiles, only on
those on which the utility can be ``computed''. The strategy profiles on which
utility assignments are defined are called \emph{convergent}, since when one follows
the path indicated by the choices one ``converges'', that is that one gets to an
ending position, i.e., a position where utilities are actually attributed. The
predicate \emph{convergent} is defined by induction, meaning that, on $s$, after
finitely many steps following the choices of $s$ an ending position is reached.
``Finitely many steps'' is a finite aspect and this is why we use an inductive
definition.
\begin{definition}[Convergent]
Saying that $s$ is \emph{convergent} is written $\conv{s}$. $\conv{s}$ is defined
by induction as follows:
\begin{itemize}
\item $\conv{\prof{u}}$ or
\item if $\conv{s_1}$ then $\conv{\prof{a,1, s_1, s_2}}$ or
\item if $\conv{s_2}$ then $\conv{\prof{a,2, s_1, s_2}}$ or
\end{itemize}
\end{definition}
On convergent strategy profiles we can assign utilities. The resulting function is
written $\hat{s}$ when applied to a strategy profile $s$.
\begin{definition}[Utility assignment]
$\hat{s}$ is defined corecursively on every strategy profile.
\begin{displaymath}
\begin{array}{lll}
\textit{~when~} &s = \prof{u} &\quad \widehat{s} \quad =\quad f\\
\textit{~when~} & s = \prof{a,1,s_1,s_2} &\quad \widehat{s} \quad = \quad \widehat{s_1} \qquad \\
\textit{~when~} & s = \prof{a,2,s_1,s_2} & \quad\widehat{s} \quad = \quad\widehat{s_2} \qquad
\end{array}
\end{displaymath}
\end{definition}
The function $\hat{`.'}$ has to be specified on an infinite object and this is why we
use a corecursive definition.
\begin{proposition}
If $\conv{s}$, then $\hat{s}$ returns a value.
\end{proposition}
Actually convergent strategy profiles are not enough as we need to know the utility
assignment not only on the whole strategy profile but also on strategy subprofiles.
For that, we need to insure that from any internal position we can reach an ending
position, which yields that on any position we can assign a utility. We call
\emph{always-convergent} such a predicate\footnote{Traditionally $\Box$ is the
notation for the modality (i.e., the predicate transformer) \emph{always}.} and we
write it $\Conv{}$.
\begin{definition}[Always-convergent]~\label{def:al-conv}
\begin{itemize}
\item $\Conv{\prof{u}}$ that is that for whatever $u$, $\prof{u}$ is always-convergent
\item $\Conv{\prof{a,c, s_1, s_2}}$ if
\begin{itemize}
\item $\prof{a,c, s_1, s_2}$ is convergent (i.e., $\conv{\prof{a,c, s_1, s_2}}$),
and
\item $s_1$ is always-convergent (i.e., $\Conv{s_1}$), and
\item $s_2$ is always-convergent (i.e., $\Conv{s_2}$).
\end{itemize}
\end{itemize}
\end{definition}
\begin{proposition}
$\Conv{s} \quad "=>" \quad \conv{s}.$
\end{proposition}
$s_{\Box 2}$ in Figure~\ref{fig:alwr} is a typically non convergent strategy profile,
wherever $s_{1 2 \Box 2}$ in the same figure is a typically convergent and not
always-convergent strategy profile.
\begin{figure}[htb!]
\centering
\doublebox{\parbox{\iffullpage .65\textwidth\else .85\textwidth\fi}{ \begin{center} \begin{math}
\begin{array}{ccc}
\xymatrix@C=10pt{
&\ar@{.>}[r]& *++[o][F]{\mbox{\footnotesize \textsf{A}}} \ar@[blue]@{=>}@/^1pc/[rr]^2 \ar@/^/[d]^1
&&*++[o][F]{\mbox{\footnotesize \textsf{B}}} \ar@[blue]@{=>}@/^1pc/[ll]^2 \ar@/^/[d]^1 \\
&&1,0&&0,1
}
&\qquad
\xymatrix@C=10pt{
&\ar@{.>}[r]& *++[o][F]{\mbox{\footnotesize \textsf{A}}} \ar@/^/[r]^2 \ar@[blue]@{=>}@/^/[d]^1
&*++[o][F]{\mbox{\footnotesize \textsf{B}}} \ar@[blue]@{=>}@/^/[r]^2 \ar@/^/[d]^1
& *++[o][F]{\mbox{\footnotesize \textsf{A}}} \ar@[blue]@{=>}@/^1pc/[rr]^2 \ar@/^/[d]^1
&&*++[o][F]{\mbox{\footnotesize \textsf{B}}} \ar@[blue]@{=>}@/^1pc/[ll]^2 \ar@/^/[d]^1 \\
&&0,1&1,0&0,1&&1,0
}\\\\
s_{\Box 2} & s_{1 \Box 2}
\end{array}
\end{math}
\end{center}
}
}
\caption{Two examples of strategy profiles}
\label{fig:alwr}
\end{figure}
Using the concept of always-convergence we can generalize the notion of backward
induction to this that the tradition calls \emph{subgame perfect
equilibrium}~\cite{selten65:_spiel_behan_eines_oligop_mit} and which we write here
\textsf{SPE}. In short \textsf{SPE} is a corecursive generalization of \textsf{BI}.
First we define an auxiliary predicate.
\begin{definition}[\textsf{PE}]
\[
\begin{array}{ll}
\mathsf{PE}(s) \quad "<=>" \quad \Conv{s}\ &\wedge\ s = \prof{a, 1, s_1, s_2} "=>"
\widehat{s_1}(a) \ge \widehat{s_2}(a)\\
& \wedge\ s = \prof{a, 2, s_1, s_2} "=>"
\widehat{s_2}(a) \ge \widehat{s_1}(a)
\end{array}
\] %
\end{definition}
We define \emph{SPE} as \emph{always}-\textsf{PE}. In other words, a strategy
profile $s$ is a subgame perfect equilibrium if $\Box\mathsf{PE}(s)$.
$\Box$ applies to a predicate.
\begin{definition}[Always]~\label{def:box}
Given a predicate $P$, the predicate $\Box P$ is defined corecursively as follows.
\begin{itemize}
\item if $P(\prof{u})$ then $\Box P(\prof{u})$ and
\item if $\Box P(s_1)$, $\Box P(s_2)$ and $P(\prof{a,c,s_1,s_2})$ then $\Box P(\prof{a,c,s_1,s_2})$
\end{itemize}
\end{definition}
Formally \emph{SPE} is $\Box \mathsf{PE}$. Besides we may notice that the notation
used for always-convergence (Definition \ref{def:al-conv}) is consistent with
Definition~\ref{def:box}. Now thanks to \textsf {SPE} we can give a notion of
rationality for infinite strategy profiles. Like for finite strategy profiles we
define \underline{corecursively}, this time, an equivalence $s=_g s'$ on infinite
strategy profiles (read $s$ and $s'$ \emph{have the same game}). Two strategy
profiles have the same game if at each step, they have the same agent and their
respective direct strategy subprofiles have the same game and only the choices differ.
\begin{definition}
We say that two strategy profiles $s$ and $s'$ \emph{have the same game} and we
write $s=_g s'$ iff corecursively
\begin{itemize}
\item either $s=\prof{u}$ and $s'=\prof{u}$
\item or $s=\prof{a,c,s_1,s_2}$ and $s'=\prof{a',c',s_1',s_2'}$ and $a=a'$,
$s_1=_g s_1$ and $s_2=_g s_2'$.
\end{itemize}
\end{definition}
\begin{definition}[Rationality for finite or infinite strategy profiles]
$\ensuremath{\mathsf{Rat}_{\infty}}$ is defined \emph{corecursively} as follows.
\begin{itemize}
\item $\ensuremath{\mathsf{Rat}_{\infty}}(\prof{u})$,
\item $\ensuremath{\mathsf{Rat}_{\infty}}(\prof{a, c, s_1, s_2}) "<=>"
`E \prof{a, c, s_1', s_2'}`: \mathsf{InfStratProf}, \\
\hspace*{.2\textwidth}\prof{a, c, s_1', s_2'} =_g\prof{a, c, s_1, s_2} \wedge \mathsf{SPE}(\prof{a, c, s_1', s_2'}) \wedge
\ensuremath{\mathsf{Rat}_{\infty}}(s_c)$
\end{itemize}
\end{definition}
The reader may notice the similarity with Definition~\ref{def:rat} of rationality for
finite games. The difference is twofold: the definition is corecursive instead of
recursive and \textsf{BI} has been replaced by \textsf{SPE}. Let us now define a
predicate that states the opposite of convergence~\footnote{People used to coinduction
know why it is better to define \emph{divergence} directly instead of defining it
as the negation of convergence.}
\begin{definition}[Divergence]
$\diverg{s}$ is defined corecursively as follows:
\begin{itemize}
\item if $\diverg{s_1}$ then $\diverg{\prof{a,1,s_1,s_2}}$,
\item if $\diverg{s_2}$ then $\diverg{\prof{a,2,s_1,s_2}}$.
\end{itemize}
\end{definition}
$s_{\Box 2}$ in Figure~\ref{fig:alwr} is a typical divergent strategy profile. The
main theorem of this paper can then be stated, saying that there exists a strategy
profile that is both divergent and rational.
\medskip
\doublebox{\parbox{.85\textwidth}{
\begin{theorem}[Risk of divergence]
$`E s`:\mathsf{InfStratProf}, \ensuremath{\mathsf{Rat}_{\infty}}(s) \ \wedge\ \diverg{s}$.
\end{theorem}
}}
\ifLONG
\medskip
Witnesses of divergent and rational strategy profiles will be given in
Section~\ref{sec:ompede} and
Section~\ref{sec:twoex}.
\fi
\section{Extrapolating the centipede}
\label{sec:oopede}
As an illustration of the above concepts, we show, in this section, two simple
extensions to infinity of a folklore example. The centipede has been proposed by
Rosenthal~\cite{rosenthal81:_games_of_perfec_infor_predat}. Starting from a wording
suggested by Aumann~\cite{aumann95} we study two infinite generalization\footnote{The
reason why we call them \emph{\ensuremath{\infty}pede} and
\emph{\ensuremath{`w}pede}.}. Wikipedia~\cite{wiki:centipede} says:
\begin{quotation}
Consider two players: Alice and Bob. Alice moves first. At the start of the game,
Alice has two piles of coins in front of her: one pile contains 4 coins and the
other pile contains 1 coin. Each player has two moves available: either \textbf{"take"} the
larger pile of coins and give the smaller pile to the other player or \textbf{"push"} both
piles across the table to the other player. Each time the piles of coins pass
across the table, the quantity of coins in each pile doubles.
\end{quotation}
\begin{figure}[tbh!]
\centering
\doublebox{\parbox{\textwidth}{
\iffullpage
\begin{displaymath}
\xymatrix@C=12pt{
&\ar@{.>}[r]& *++[o][F]{\Al}\flr{r}&*++[o][F]{\Be}\flr{r}&*++[o][F]{\Al}\flr{r}&*++[o][F]{\Be}\fld{r}&*++[o][F]{\Al}\flr{r}&*++[o][F]{\Be}\fld{r}%
&*++[o][F]{\Al}\flr{r} &*++[o][F]{\Be}\flr{r}&*++[o][F]{\Al}\flr{r} &\ar@{.>}@/^/[r]^r&\\
&4,1&2,8&16,4&8,32&64,16&32,128&64,256&512,128&256,1024&&}
\end{displaymath}
\else
\begin{tiny}
\begin{displaymath}
\xymatrix@C=22pt{
\ar@{.>}[r]& *++[o][F]{\Al}\flr{r}&*++[o][F]{\Be}\flr{r}&*++[o][F]{\Al}\flr{r}&*++[o][F]{\Be}\fld{r}&*++[o][F]{\Al}\flr{r}&*++[o][F]{\Be}\fld{r}%
&*++[o][F]{\Al}\flr{r} &\ar@{.>}@/^/[r]^1\ar@{.>}@/^/[d]^2&\\
&4,1&2,8&16,4&8,32&64,16&32,128&64,256&512,128&&}
\end{displaymath}
\end{tiny}
\fi
}}
\caption{A sketch of a strategy profile of the \ensuremath{\infty}pede{}.}
\label{fig:ABAB}
\end{figure}
\subsection{The \ensuremath{\infty}pede}
\label{sec:infpede}
$P_{\infty}(s)$ is a set of strategy profiles extending the strategy profiles of the
centipede. Such an infinite strategy profile can only be is sketched on
Figure~\ref{fig:ABAB} . Actually proposing an infinite extension of the centipede is
quite natural for two reasons. First there is no natural way to make the game
finite. Indeed in the definition of the game, nothing precise is said about its end,
when no player decides to take a pile. For instance, Wikipedia~\cite{wiki:centipede}
says:
\begin{quotation}
The game continues for a fixed number of rounds or until a player decides to end
the game by pocketing a pile of coins.
\end{quotation}
We do no know what the utilities are in the end position described as ``a fixed
number of rounds''. Since $\All$ started, we can assume that the end after a fixed
number of rounds is $\textsf{B}$'s turn and that there are outcomes like:
\begin{enumerate}
\item $\textsf{B}$ receives $2^{n+1}$ coins and $\All$ receives $2^{n+3}$ coins like for
the previous $\textsf{B}$ rounds and that is all.
\item $\textsf{B}$ chooses between
\begin{enumerate}
\item receiving $2^{n+1}$ coins whereas $\All$ receives $2^{n+3}$ or
\item sharing with $\All$, each one receiving $2^{n+2}$.
\end{enumerate}
\item Both $\All$ and $\textsf{B}$ receive nothing.
\end{enumerate}
Moreover the statement \emph{``Each player has two moves available: either
\textbf{``take''} ... or \textbf{push}...''} is not true, in the ending position.
We are not hair-splitting since the end positions are the initializations of the
(backward) induction and must be defined as precisely as the induction step. Ending
with 2.(b) does not produce the same backward induction as the others.
Let us consider the strategy profiles
\begin{eqnarray*}
p_n &=& \prof{\All, 1, \prof{\All"|->"2^{2n+2},\textsf{B}"|->"2^{2n}},`p_n}\\
`p_n &=& \prof{\textsf{B}, 1, \prof{\All"|->"2^{2n+1},\textsf{B}"|->"2^{2n+3}}, p_{n+1}}
\end{eqnarray*}
In words, the $p_n$'s and the $`p_n$'s are the strategy subprofiles of the \ensuremath{\infty}pede{}
in which Alice and Bob stop always. Notice that
\begin{center}
\begin{math}
\widehat{p_n}(\All) = 2^{2n+2} \qquad \widehat{p_n}(\textsf{B}) = 2^{2n}
\end{math}
\begin{math}
\widehat{`p_n}(\All) = 2^{2n+1} \qquad \widehat{`p_n}(\textsf{B}) = 2^{2n+3}
\end{math}
\end{center}
\begin{theorem}~
\begin{enumerate}
\item $`A n`:\ensuremath{\mathbb{N}}, \mathsf{SPE} (p_n) \wedge \mathsf{SPE}(`p_n)$,
\item $`A s`:\mathsf{InfStratProf}, s =_g p_0 \wedge \mathsf{SPE}(s) \quad "<=>" s = p_0$.
\end{enumerate}
\end{theorem}
In other words, all the $p_n$'s and the $`p_n$'s are `backward induction'. Moreover
for the \ensuremath{\infty}pede{}, $p_0$ is the only `backward induction'. strategy profile.
\begin{proof}
One can easily prove that for all $n$, $\Conv{p_n}$ and $\Conv{`p_n}$.
Assuming $\mathsf{SPE} (`p_n)$ and $\mathsf{SPE} (p_{n+1})$ (coinduction) and since
\begin{displaymath}
\widehat{\prof{\All"|->"2^{2n+2},\textsf{B}"|->"2^{2n}}(\All)\ge \widehat{`p_n}(\All)}
\end{displaymath}
we conclude that
\begin{math}
\mathsf{SPE}(\prof{\All, 1, \prof{\All"|->"2^{2n+2},\textsf{B}"|->"2^{2n}},`p_n})
\end{math}
that is $\mathsf{SPE}(p_n)$. The proof of $\mathsf{SPE}(`p_n)$ is similar.
For the proof of 2. we notice that in a strategy profile in $\mathsf{SPE}$ with the same game
as $p_0$,
there is no strategy subprofile such that the agent chooses $2$ and the next agent
chooses $1$. Assume the strategy subprofile is $s_n = \prof{\All,2, \prof{\All"|->"2^{2n+2},\textsf{B}"|->"2^{2n}},
\prof{\textsf{B},1,\prof{\All"|->"2^{2n+1},\textsf{B}"|->"2^{2n+3}},`s_n}}$. ans that $\mathsf{SPE}(s_n)$ and $\mathsf{SPE}(`s_n)$. If it would be
the case and if we write $t = \prof{\All"|->"2^{2n+2},\textsf{B}"|->"2^{2n}}$ and
$t'=\prof{\textsf{B},1,\prof{\All"|->"2^{2n+1},\textsf{B}"|->"2^{2n+3}},`s_n}$, we notice that
$\hat{t}(A)=2^{2n+2}> \widehat{t'}(A) = 2^{2n+1}$. This is in contradiction with $\mathsf{SPE}(s_n)$.
\end{proof}
We deduce that the
strategy profile $d_0$, which diverges, is not in $\ensuremath{\mathsf{Rat}_{\infty}}$ and more generally there
is no strategy profile in $\ensuremath{\mathsf{Rat}_{\infty}}$ for the \ensuremath{\infty}pede.
\begin{eqnarray*}
d_n &=& \prof{\All, 2,\prof{\All"|->"2^{2n+2},\textsf{B}"|->"2^{2n}},`p_n}\\
`d_n &=& \prof{\textsf{B}, 2, \prof{\All"|->"2^{2n+1},\textsf{B}"|->"2^{2n+3}}, p_{n+1}}
\end{eqnarray*}
\begin{figure}[th!]
\centering
\doublebox{\parbox{\textwidth}{
\iffullpage
\begin{displaymath}
\xymatrix{
*++[o][F]{\Al}\fld{r}&*++[o][F]{\Be}\fld{r}&*++[o][F]{\Al}\fld{r}&*++[o][F]{\Be}\fld{r}&*++[o][F]{\Al}\fld{r}&*++[o][F]{\Be}\fld{r}%
&*++[o][F]{\Al}\fld{r} &*++[o][F]{\Be}\fld{r}&*++[o][F]{\Al}\fld{r} &\ar@{.>}@/^/[r]^r&\\
4,1&2,8&16,4&8,32&64,16&32,128&64,256&512,128&256,1024&&}
\end{displaymath}
\begin{displaymath}
\xymatrix{
*++[o][F]{\Al}\flr{r}&*++[o][F]{\Be}\flr{r}&*++[o][F]{\Al}\flr{r}&*++[o][F]{\Be}\flr{r}&*++[o][F]{\Al}\flr{r}&*++[o][F]{\Be}\flr{r}%
&*++[o][F]{\Al}\flr{r} &*++[o][F]{\Be}\flr{r}&*++[o][F]{\Al}\flr{r} &\ar@{.>}@/^/[r]^r&\\
4,1&2,8&16,4&8,32&64,16&32,128&64,256&512,128&256,1024&&}
\end{displaymath}
\else
\begin{tiny}
\begin{displaymath}
\xymatrix@C=22pt{
\ar@{.>}[r]& *++[o][F]{\Al}\fld{r}&*++[o][F]{\Be}\fld{r}&*++[o][F]{\Al}\fld{r}&*++[o][F]{\Be}\fld{r}&*++[o][F]{\Al}\fld{r}&*++[o][F]{\Be}\fld{r}%
&*++[o][F]{\Al}\fld{r} &\ar@{.>}@/^/[r]^1\ar@{.>}@/^/[d]^2&\\
&4,1&2,8&16,4&8,32&64,16&32,128&64,256&512,128&&}
\end{displaymath}
\begin{displaymath}
\xymatrix@C=22pt{
\ar@{.>}[r]& *++[o][F]{\Al}\flr{r}&*++[o][F]{\Be}\flr{r}&*++[o][F]{\Al}\flr{r}&*++[o][F]{\Be}\flr{r}&*++[o][F]{\Al}\flr{r}&*++[o][F]{\Be}\flr{r}%
&*++[o][F]{\Al}\flr{r} &\ar@{.>}@/^/[r]^1\ar@{.>}@/^/[d]^2&\\
& 4,1&2,8&16,4&8,32&64,16&32,128&64,256&512,128&&}
\end{displaymath}
\end{tiny}
\fi
}}
\caption{Strategy profiles $p_0$ and $d_0$ of the \ensuremath{\infty}pede{}.}
\label{fig:infped}
\end{figure}
\subsection{The \ensuremath{`w}pede}
\label{sec:ompede}
We know\footnote{Usually agents do not believe this. See~\cite{lescanne14:_intel} for
a discussion of the beliefs of the agents w.r.t. the infiniteness of the world.} that \emph{``trees
don't grow to the sky''}. In our case this means that there is a natural number
$`w$ after which piles cannot be doubled.footnote{People speak of \emph{limited
payroll}.} In other words, after $`w$, the piles keep the same size $2^{`w}$.
An example of strategy profile is sketched on Figure~\ref{fig:omped}. In this family
of strategy profiles, which we write $P_{`w}$ , the utilities stay stable after the
$`w^{th}$ positions. Every \emph{always-convergent} strategy profile of $P_{`w}$,
such that agents \textbf{push} until $`w$ is in \textsf{SPE}. We conclude the
existence of rational divergent strategy profiles in $P_{`w}$. In other words in the
$\ensuremath{`w}pede$ there is a risk of divergence.
\begin{figure}[ht]
\newcommand{\oped}{%
\begin{displaymath}
\xymatrix{
\ar@{.>}[r]& *++[o][F]{\Al}\flr{r}&*++[o][F]{\Be}\flr{r}&*++[o][F]{\Al}\flr{r}&*++[o][F]{\Be}\flr{r}&\ar@[blue]@{:>}@/^/[r]%
&*++[o][F]{\Al}\flr{r} &*++[o][F]{\Be}\fld{r}&*++[o][F]{\Al}\fld{r} &\\
&4,1&2,8&16,4&8,32&&2^{`w},2^{`w}&2^{`w},2^{`w}&2^{`w},2^{`w}&&}%
\end{displaymath}
}
\centering
\doublebox{\parbox{\textwidth}{
\iffullpage
\oped
\else
\begin{tiny}
\oped
\end{tiny}
\fi
}}
\caption{A `backward induction` strategy profile for the \ensuremath{`w}pede{}.}
\label{fig:omped}
\end{figure}
\begin{theorem}
$`E s `: P_{`w}, \ensuremath{\mathsf{Rat}_{\infty}}(s) \wedge \diverg{s}.$
\end{theorem}
One may imagine that divergence is when optimistic agents hope a reverse of the
tendency.
\paragraph*{Comments:}
The \ensuremath{`w}pede{} example is degenerated, but it is interesting in two respects. First,
it shows a very simple and naive case of rational divergence. Second it shows that
cutting the infinite game, case 2. (b) is the most natural way, with a equilibrium in
which agents \textbf{take} until the end.
\section{Two examples}
\label{sec:twoex}
\paragraph{$0,1$ strategy profiles}
$0,1$ strategy profiles are strategy profiles with the shape of an infinite ``comb''
in which the utilities are $0$ for the agent who quits and $1$ for the other agent.
It can be shown~\cite{DBLP:conf/calco/Lescanne13} that strategy profiles where one
agent continues always and the other quits infinitely often (in other words the other
agent never continues always) are in \textsf{SPE}. For this reason, the strategy profile where
both agents continue always is in $\ensuremath{\mathsf{Rat}_{\infty}}$, which shows that divergence is rational.
\paragraph{The dollar auction}
The \emph{dollar auction} is a well known
game~\cite{Shubik:1971,leininger89:_escal_and_cooop_in_confl_situat,oneill86:_inten_escal_and_dollar_auction}. Its
strategy profiles have the same infinite comb shape as the $0,1$ strategy
profiles, the \ensuremath{\infty}pede{} and the \ensuremath{`w}pede{}
with the sequence of pairs of utilities:
\begin{footnotesize}
\begin{center}
\begin{math}
(0,100)\ (95,0)\ (-5,95)\ (90,-5) \ (-10,90)\ (85,-10)\ \ldots\ (-5n,100-5n) \
(100-5(n+1),-5n)\ \ldots
\end{math}
\end{center}
\end{footnotesize}
and corresponds to an auction in which the bet of the looser is not returned to her.
We have shown~\cite{DBLP:journals/acta/LescanneP12} that the dollar auction may
diverge with rational agents. People speak of \emph{escalation} in this case. The
divergent strategy profile of the dollar auction is in $\ensuremath{\mathsf{Rat}_{\infty}}$.
\section{Reflection}
\label{sec:refl}
\ifLONG
\rightline{\parbox{4.8cm}{\begin{it} Je est un autre\end{it}
\begin{it} (I is another\end{it})}}%
\rightline{\emph{Arthur Rimbaud} (1854-1891) }
\medskip
\fi
Examples like the dollar auction or the $0,1$ raise the following question: ``How is
it possible in an escalation that the agents do not see that they are entering a
hopeless process?''. The answer is ``reflection''. Indeed, when reasoning, betting
and choosing, the agents should leave the world where they live and act in order to
observe the divergence. If they are wise, they change their beliefs in an infinite
world as soon as they realize that they go nowhere~\cite{stanovich09:_two}. This
ability is called reflection and is connected to observability, from the theoretical
computer science point of view, which is itself connected to coalgebras and to
coinduction~\cite{jacobs12:_introd_coalg}. In other words, agents should leave the
environment in which they are enclosed and observe themselves.\ifLONG Like the poet, they
should be able to claim \emph{``I is another''} whom I consider as an object.\fi
\section{Singularities and divergence}
\label{sec:sing}
Divergence is called singularity, bubble, crash, escalation, or turbulence according
to the context or the scientific field. In mechanics this is considered as a
topics by itself. Leonardo da Vinci's drawings \ifLONG (Fig.~\ref{fig:turbh} left)\fi show that he considered early turbulence and
vortices and only Reynolds during the XIX$^{\textrm{th}}$ century studied it from a
scientific point of view. In many other domains, phenomena of this family are
rejected from the core of the field, despite they have been observed experimentally.
Scientists, among them mainstream economists~\cite{colander04:_chang_face_mains_econom}, prefer
smoothness, continuity and equilibria~\cite{Neoclass_Ecoc} and they often claim that
departing from this leads to ``paradoxes''~\cite{Shubik:1971}.
In~\cite{DBLP:journals/corr/abs-1112-1185}, we surveyed Zeno of Elea's paradox from
the point of view of coinduction, as well as Weierstrass
function~\cite{weierstrass72}, the first mathematical example showing discontinuity
at the infinite. Here we would like to address two other cases.
\ifLONG
\begin{figure}[htb!]
\centering
\includegraphics[width=0.25\columnwidth]{Etudes_turbulences_Leonard_de_Vinci.jpg}
\qquad\qquad
\includegraphics[height=0.35\columnwidth]{Black_hole.jpg}
\caption{Da Vinci's drawings (left) and a artist view of a blackhole (right)
{\tiny Wikimedia commons}}
\label{fig:turbh}
\end{figure}
\fi
In 1935, that is one year before his famous article in the \emph{Proceedings of the
London Mathematical Society}~\cite{Turing:1936:CNA}, Alan Turing wrote a
paper~\cite{turing35:_first_comput_number_compt_rendues} presenting his result for a
publication in the Proceedings of the French Academy of Science. In this paper he
calls ``nasty'' a machine that terminates and ``nice'' a machine that does not
terminate, showing his positive view of non terminating computations.\footnote{Notice
that he changed his terminology
in~\cite{turing35:_first_comput_number_compt_rendues} and calls ``circular'' the
terminating machine and ``circular-free'' the non terminating machine.}
In 1795, Laplace published his book \emph{Exposition du Syst\`{e}me du Monde} and
proposed the first clear vision of the notion of blackhole\ifLONG (Fig.~\ref{fig:turbh} right)\fi, but probably in order not
to hurt his contemporaries, he found wiser to remove this presentation from the third
edition of his book. Then we had to wait Schwartzschild in 1915, few months after
the publication by Einstein of the general theory of relativity, for a second
proposal of the concept of blackhole. But at that time the general relativity was
not yet fully accepted as were not blackholes. Only recently, at the end of the last
century, the general relativity has been considered as ``the'' theory of gravitation and
there is no more doubt on the existence of blackholes. Since blackholes are
singularities in gravitation, they are for the general theory of relativity the
equivalent of divergent strategy profiles for game theory.
\subsection*{Contribution of this paper}
Unlike previous presentations of similar
results~\cite{DBLP:journals/acta/LescanneP12,DBLP:conf/calco/Lescanne13,} here we
focus on the concept of strategy profile which is central for the those of
convergence, of divergence and of equilibrium and is more targeted for a workshop on
\emph{strategy reasoning}. Moreover we introduce the \emph{\ensuremath{`w}pede{}} (a new
infinite version of the centipede) and \emph{``divergent'' strategy profiles} are
those that where called ``escalation'' in previous literature. This terminology seems
better fitted for its duality with convergence.
\section{Conclusion}
\label{sec:conclusion}
We have shown that strategy profiles in which no fixed limit is set must be studied
as infinite objects using coinduction and corecursion. In these infinite objects,
the risk of divergence is real and should be considered seriously.
\nocite{DBLP:conf/mfcs/HonsellLR12}
| {'timestamp': '2015-12-23T02:05:39', 'yymm': '1512', 'arxiv_id': '1512.07010', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.07010'} | arxiv |
\section{Introduction}
Recently, count data modelling becomes very popular in many areas like Insurance, Ecology, Environmental Science, Health etc., because of larger variance is than mean. To model such situations standard models like Poisson , negative binomial, geometric distribution are not enough, which makes researchers to generalize, extend or modify these standard models preserving the fundamental properties like uni modality, log concavity, infinite divisibility, over dispersion(under dispersion) of standard distributions. Some of such generalization you can find in Jain and Consul(1971), Philippou and Georghiou(1983), Tripahti et al.(1987). However researchers still continuing to propose new generalization of these standard distributions. Chakraborty (2015) gave a comprehensive survey on method and construction of generating discrete analogue of continuous distribution. \\
Because of the applications and elegant and mathematical tractable distributional form geometric distribution attracts many research for count data modeling. In last 6 years, many generalization of geometric distribution have been appear in the literature using mainly three methodology, (i) Discretizing the continuous distribution (ii) Mixed Poisson(mixing poisson parameter with continuous distribution) Methodology and (iii) taking discrete Analogue of continuous distribution over real line.(see definition () in section). Connection of many generalized geometric distributions obtained by utilizing these three methods have been briefly presented in Figure 1,2 and 3.
\begin{figure}
\begin{center}
\includegraphics[scale=.5]{pmfd}
\caption{Connection of different generalized geometric distribution, obtained by discretization method, with standard geometric distribution.}
\end{center}
\end{figure}
\begin{figure}
\begin{center}
\includegraphics[scale=.5]{pmfmp}
\caption{Connection of different generalized geometric distribution, obtained by Mixed-Poisson method, with standard geometric distribution.}
\end{center}
\end{figure}
\begin{figure}
\begin{center}
\includegraphics[scale=.5]{pmfda}
\caption{Connection of different generalized geometric distribution, obtained by discrete analogue method, with standard geometric distribution.}
\end{center}
\end{figure}
In this article we propose another generalization of \textit{``geometric distribution''} and possessing many properties like, unimodality, log concavity, infinite divisibility, closed form of moments estimator and estimator obtained using proportion of zeros and mean. Moreover the proposed distribution can also be viewed as discrete analogue of weighted exponential distribution by Gupta and Kundu(2009) and Weighted version of geometric distribution (see Patil and Rao(1977, 1978), Rao(1985)), in fact we proposed our distribution using the later. The weight function proposed in this paper is $w(x)=1-q^{\alpha(x+1)}$, where $\alpha$ is the shape parameter the parameter $q$ comes from the definition of geometric distribution. The theoretical and practical aspect of this new family is discussed. Interestingly, from the proposed distribution, some new characterizations for Geometric Distribution are shown. The paper is structured as follows, after definitions and basic distributional properties discussed in section 2, we present various results associated with proposed model in section 3. Then in Section 4 we present some characterisations of geometric distribution from the proposed model. In section 5 we consider statistical issues of parameter estimation. In the subsequent section it is shown that generated models give good fit for real data set.
\section{Definition and Distributional Properties}
Let $X$ be a geometric rv defined as $p_X(x)=(1-q)q^x,$ for $x=0,1,2,3,\cdots$, then for non-negative weight function $w(x)=1-q^{\alpha(x+1)}$, let $Y$ represents the weighted geometric rv having PMF
\begin{equation} \label{e1}
p_Y(y)=\frac{w(y)p_X(y)}{E(w(X))}=\frac{(1-q^{\alpha(y+1)})(1-q)q^y}{E(1-q^{\alpha(X+1)})}
\end{equation}
where
\[
E(W(X))=E(1-q^{\alpha(X+1)})=\sum\limits_{x=0}^{\infty} (1-q^{\alpha(x+1)})(1-q)q^x=\frac{1-q^\alpha}{1-q^{\alpha+1}}
\]
Thus, from (\ref{e1}) we have
\begin{equation} \label{e2}
p_Y(y)= \frac{(1-q)(1-q^{\alpha+1})}{(1-q^{\alpha})}q^{y}(1-q^{\alpha(y+1)}) \quad;\quad y=0,1,\cdots
\end{equation}
Henceforth, we call rv defined in (\ref{e2}) as \textit{Weighted Geometric Distribution} and denote it as $Y \sim \mathcal{WG}(\alpha,q)$, where $0<q<1$ and $\alpha>0$. It can be observed straightly that as $\alpha \rightarrow \infty $, $q^{\alpha} \rightarrow 0$, hence the proposed PMF(\ref{e2}) reduces to geometric distribution with PMF
\begin{equation*}
p_y=(1-q)q^y, \qquad y \in \mathcal{N}_0
\end{equation*}
Further the ratio of the two probabilities can be written as
\begin{equation} \label{e3}
\frac{p_{y+1}}{p_y}=\frac{q \left(1-q^{\alpha(y+2)}\right)}{\left(1-q^{\alpha(y+1)}\right)}, \qquad y=0,1, \cdots
\end{equation}
with $p_0=(1-q)(1-q^{\alpha+1})$.
As the parameters $0<q<1$ and $\alpha>0$, we can observe that, $1-q^{\alpha(y+1)}<1-q^{\alpha(y+2)}<\cdots$, increases with $y$ so that the ratio of probabilities in (\ref{e3}) decreases with increase in $y$, and hence the distribution is unimodal. Moreover, because $p^2_y>p_{y+1}p_{y-1}$ for all $y$, the distribution is log-concave and strongly unimodal (see Keilson and Gerber 1971). Therefore, $\mathcal{WG}(\alpha,q)$ has all moments. For different values of parameters $\alpha$ and $q$, the PMF of $\mathcal{WG}(\alpha,q)$ is presented in Figure 1.\\
As it has been noted that, $\mathcal{WG}(\alpha,q)$ is log-concave and unimodal, it implies that there exist a variable $y^*$ (mode) that satisfies the following equation
\begin{eqnarray*} \label{}
\begin{cases} p_{y+1} \ge p_y \qquad & \forall \quad y\le y^*, \\
p_{y+1} \le p_y \qquad & \forall \quad y\ge y^*,
\end{cases}
\end{eqnarray*}
hence under certain constraints on parameters we obtained the mode of $\mathcal{WG}(\alpha,q)$ as follows, for $0<q<1/2$ and $\alpha>0$ the mode of $\mathcal{WG}(\alpha,q)$ is at origin, whereas for $1/2<q<1$ and $\alpha> \log_q\left(\frac{1-q}{q}\right)$ the mode is at $\left[\log_q\left(\frac{1-q}{1-q^{\alpha+1}} \right)^{1/\alpha}\right]$. If $\left[\log_q\left(\frac{1-q}{1-q^{\alpha+1}} \right)^{1/\alpha}\right]$ is an integer, then there are joint modes at $\left[\log_q\left(\frac{1-q}{1-q^{\alpha+1}} \right)^{1/\alpha}\right]$ and $1+\left[\log_q\left(\frac{1-q}{1-q^{\alpha+1}} \right)^{1/\alpha}\right]$. Here $[.]$ denotes the integral part. \\
\begin{figure}
\begin{center}
\includegraphics[scale=.50]{pmf}
\caption{PMF plot of $\mathcal{WG}$ distribution for different values of parameters $\alpha$ and $q$.}
\end{center}
\end{figure}
\noindent Moreover, by using series expansion(see, e.g., Graham et al., 1989, formula (7.46), p. 337)
\begin{equation*}
\sum\limits_{y=0}^{\infty}y^nq^y= \sum\limits_{y=1}^{\infty}S(n,y)\frac{y!q^y}{(1-q)^{1+y}}
\end{equation*}
\noindent where,
\begin{equation*}
S(n,y)=\frac{1}{y!}\sum\limits_{j=0}^{y-1}(-1)^j\binom{y}{j}(y-j)^n
\end{equation*}
is the Stirling number of the second kind, the $n^{th}$ raw moment of $\mathcal{WG}(q,\alpha)$ is as follows
\begin{align*}
\mathbb{E}(Y^n)=&\frac{(1-q)(1-q^{\alpha+1})}{1-q^\alpha}\sum\limits_{y=0}^{\infty} y^n q^y\left(1-q^{\alpha(y+1)}\right) \\
=&\frac{(1-q)(1-q^{\alpha+1})}{1-q^\alpha}\left(\sum\limits_{y=0}^{\infty} y^n q^y -q^{\alpha}\sum\limits_{y=0}^{\infty} y^n q^{(\alpha+1)y}\right)\\
=&\frac{(1-q)(1-q^{\alpha+1})}{1-q^\alpha} \left(\sum\limits_{y=1}^{\infty}S(n,y)\frac{y!q^y}{(1-q)^{1+y}}-q^\alpha \sum\limits_{y=1}^{\infty}S(n,y)\frac{y!q^{(\alpha+1)y}}{(1-q^{\alpha+1})^{1+y}} \right)
\end{align*}
Thus the mean and variance of $\mathcal{WG}(q,\alpha)$ are as follows.
\begin{equation}
\begin{aligned} \label{e9}
\mathbb{E}(Y)=&-2+\frac{1}{1-q}+\frac{1}{1-q^{1+\alpha}} \\
\mathbb{V}(Y)=& q\left(\frac{1}{(1-q)^{2}}+\frac{q^{\alpha}}{(1-q^{1+\alpha})^{2}} \right)
\end{aligned}
\end{equation}
\noindent Since
\begin{equation*}
\begin{aligned}
\frac{\partial}{\partial q}\mathbb{E}(Y)&=\frac{1}{(1-q)^2}+\frac{q^{\alpha } (1+\alpha )}{\left(1-q^{1+\alpha }\right)^2}>0, \\
\frac{\partial}{\partial \alpha}\mathbb{E}(Y)&=\frac{q^{1+\alpha}\log(q)}{\left(1-q^{1+\alpha}\right)^2} <0
\end{aligned}
\end{equation*}
\noindent Thus mean of $\mathcal{WG}(\alpha,q)$ distribution decreases as $\alpha$ increases and increases as $q$ increases. \\
\noindent The moment generating function(MGF) of a rv $Y \sim \mathcal{WG}(\alpha,q)$ can easily be computed from definition $\mathbb{M}_{Y}(t)=\mathbb{E}(e^{Yt})$ and is given by following expression.
\begin{equation} \label{e8}
\mathbb{M}_{Y}(t)=\frac{(1-q)(1-q^{1+\alpha})}{(1-e^{t}q)(1-e^{t}q^{1+\alpha})}
\end{equation}
\noindent The survival and hazard rate function of $\mathcal{WG}(\alpha,q)$ is given by the following expressions respectively:
\begin{equation} \label{e4}
\bar{F}_Y(y;\alpha,q)=\frac{q^y \left(1-q^{(1+y) \alpha }-q^{1+\alpha }+q^{1+\alpha +y \alpha }\right)}{1-q^{\alpha }}
\end{equation}
and
\begin{equation} \label{e5}
h(y;\alpha,q)=\frac{(1-q)\left(1-q^{\alpha +1}\right)\left(1-q^{\alpha(y+1)}\right)}{\left(1-q^{(1+y) \alpha }-q^{1+\alpha }+q^{1+\alpha +y \alpha }\right)}
\end{equation}
It can be seen that the hazard function is an increasing function of $y$ and approaches $(1-q)$ as $y \rightarrow \infty$. Moreover, hazard function increases with faster rate for lower value of $q$ as well as for higher value of $\alpha.$ \\
\\
The reversed hazard rate function (RHR) and the Second failure rate function(SRF)are given by the following equations respectively:
\begin{equation} \label{e6}
h^{*}(y)= \frac{P(Y=y)}{F_{Y}(y)} =\frac{(q-1)q^y(-1+q^{\alpha+1})(1-q^{\alpha(y+1)})}{-1+q^{\alpha}+q^y(1-q^{\alpha+1}+(q-1)q^{\alpha+y{(\alpha+1)}}}
\end{equation} \\
and
\begin{align}
\nonumber r^{*}(y)=&\log\left\lbrace\frac{S_{Y}(y)}{S_{Y}(y+1)}\right\rbrace \\
=&\log\left\lbrace\frac{-1+q^{\alpha+1}+(1-q)q^{\alpha(1+y)}}{-1+q^{\alpha+1}+(1-q)q^{\alpha(2+y)}}\right\rbrace
\end{align}
\section{Some Results}
\noindent \textbf{Theorem 1:} The negative binomial distribution $\mathcal{NB}(2,q)$ will be a limiting case of $\mathcal{WG}(\alpha,q)$ distribution as $\alpha \rightarrow 0$.\\
\textit{Proof:} The proof is straight forward after trivial steps. \\
\noindent In last few decades, many methods were proposed in the literature to define discrete distributions which are discrete analogue of continuous rv(comprehensive survey of these methods can be seen in Chakraborty(2015)). Thus in order to explore the connection between continuous distribution with $WGD(q,\alpha)$, we make use of following method define as follows\\
\noindent \textbf{Definition 1:} A rv $Y$ is said to be discrete analogue of continuous rv $X$ if its PMF is defined as
\[p(y)=f_X(y)/\sum\limits_{r=0}^{\infty}f(r) \qquad \text{for} \quad y=0,1,\cdots \]
\noindent \textbf{Theorem 2:} If $X \sim \mathcal{WED}(\alpha,\lambda)$, then the rv $Y$ using definition(1), follows $\mathcal{WG}(\alpha,e^{-\lambda})$ distribution. \\
\textit{Proof:} Let $X \sim \mathcal{WED}(\alpha,\lambda)$ with pdf
\[
f_X(x)=\frac{\alpha}{\alpha+1}\lambda e^{-\lambda x}(1-e^{\alpha \lambda x}) \qquad \text{for} \quad x>0
\]
then the discrete analogue of $X$ with PMF
\[
p(y)=\frac{f_X(y)}{\sum\limits_{r=0}^{\infty}f_X(r)}= \frac{e^{-\lambda y}(1-e^{\alpha \lambda y})}{\sum\limits_{r=0}^{\infty}e^{-\lambda r}(1-e^{\alpha \lambda r})} =\frac{(1-e^{-\lambda})(1-e^{-\lambda(\alpha+1)})}{(1-e^{-\lambda\alpha})} e^{-\lambda y}(1-e^{\alpha \lambda y})
\]
Hence by assuming $e^{-\lambda}=q$, we get the result. \hfill $\Box$\\
\noindent \textbf{Stochastic representations:} In the following theorem, stochastic representations of $\mathcal{WG}(q,\alpha)$ distribution are shown, which can be useful for generating random number and characterization results we will be using later \\
\noindent \textbf{Theorem 3:} Let $Y_i, i=1,2$ be independent and identically distributed(iid) rvs with PMF, $p_{Y}(y)$ and distribution function (DF) $F_{Y}(y)$. For any positive integer $\alpha$, let $Y$ denotes the conditional rv $Y_1$ given $\left(\alpha(Y_{1}+1)\ge Y_{2}+1\right)$. Then
\begin{enumerate}
\item[(a)] the PMF of $Y$ is
\begin{equation} \label{e10}
p_{Y}(y)=\frac{1}{P\left(Y_{2}+1\le\alpha(Y_{1}+1)\right)}p_{Y_1}(y)F_{Y_2}\left(\alpha(y+1)-1\right); \quad\quad y=0,1,\cdots
\end{equation}
\item[(b)] $Y\sim \mathcal{WG}(\alpha,q)$ distribution if $Y_{i}, i=1,2$ are iid geometric rv.
\end{enumerate}
\noindent \textit{Proof:} $(a)$ Let $Y_{1}$ and $Y_{2}$ are two i.i.d. discrete rv
\begin{align} \nonumber
\nonumber p_{X}(y)=& P(Y_{1}=y|Y_{2}+1\leq \alpha(Y_{1}+1)) \\
\nonumber =&\frac{P(Y_{1}=y \bigcap Y_{2}+1\leq\alpha(Y_{1}+1))}{P(Y_{2}+1\leq \alpha(y_{1}+1))} \\
\nonumber =&\frac{P(Y_{1}=y)P(Y_{2}+1\leq \alpha(y+1))} {P(Y_{2}+1\leq \alpha(Y_{1}+1))} \\
=&\frac{1}{P(Y_{2}+1\le\alpha(Y_{1}+1))}p_{Y_1}(x)F_{Y_2}(\alpha(y+1)-1) \label{e11}
\end{align}
$(b)$ Considering $Y_i \sim Geo(q)$ for $i=1,2$, and using theorem $3(a)$, we get
\begin{equation} \label{e12}
p_{Y}(y)=\frac{(1-q)q^{y}(1-q^{\alpha(y+1)})}{P(Y_{2}+1\leq \alpha(Y_{1}+1))}
\end{equation}
further,
\begin{equation*}
\begin{aligned}
P(Y_{2}+1\leq \alpha(Y_{1}+1))=&\sum_{x=0}^{\infty} \sum_{y=0}^{\alpha(x+1)-1}(1-q)q^{x}(1-q)q^{y} \\
=&(1-q)^{2}\left(\sum_{x=0}^{\infty}q^{x}
\left(\sum_{y=0}^{\alpha(x+1)-1}q^{y}\right)\right) \\
=&(1-q)\left(\sum_{x=0}^{\infty}q^{x}(1-q^{\alpha(x+1)})\right) \\
=& (1-q)\left(\sum_{x=0}^{\infty}q^{x}-\sum_{x=0}^{\infty}
q^{x(\alpha+1)+\alpha}\right) \\
=& (1-q)\left(\frac{1}{1-q}-\frac{q^{\alpha}}{1-q^{\alpha+1}}\right) \\
P(Y_{2}+1\leq \alpha(Y_{1}+1))=& \left( \frac{1-q^{\alpha}}{1-q^{\alpha+1}}\right),
\end{aligned}
\end{equation*}
substituting the above result in \ref{e12}, we get the desired result. \hfill $\Box$\\
\noindent \textbf{Theorem 4:} Suppose $X$ and $Z$ be two dependent rvs with joint PMF given as
\begin{equation} \label{e13}
p_{X,Z}(x,z)=
\begin{cases}
(1-q)(1-q^{z})q^{z(x+1)} \,\,\, & \text{for} \,\, x=0,1,2,\cdots, \\
& \quad \,\,\, z=1,\cdots \\
0 & \text{otherwise}
\end{cases}
\end{equation}
Then rv $Y$ defined as $Z-1|X<\alpha$ follows $\mathcal{WG}(\alpha,q)$ distribution. \\
\noindent \textit{Proof:} Let $X$ and $Z$ are two discrete random variables, where $X$ depends on $Z$, with the joint PMF as given below
\begin{equation*}
p_{X,Z}(x,z)=(1-q)(1-q^{z})q^{z(x+1)} \quad;\quad x=0,1,2, \text{and} \quad z=1,2,\cdots
\end{equation*}
Then the marginal probability mass function of $X$ is given as
\begin{align} \label{e14}
\nonumber P_{X}(x)=&\sum_{z=1}^{\infty}
(1-q)(1-q^{z}) q^{z(x+1)} \\
=&\frac{1-q}{1-q^{x+1}}-\frac{1-q}{1-q^{x+2}}; \quad x=0,1,\cdots
\end{align}
Further,
\begin{eqnarray} \label{e15}
\nonumber P(Y=y)&=& P(Z=y+1 |X <\alpha) \\
\nonumber &=&\frac{P(Z=y+1 \cap X <\alpha)}{P(X <\alpha))}\\
\nonumber &=&\frac{\sum_{x=0}^{\alpha-1}P(Z=y+1\cap X<\alpha)}{P(X<\alpha)} \\
\nonumber &=&\frac{\sum_{x=0}^{\alpha-1}(1-q)(1-q^{y+1})q^{(y+1)(x+1)}}{P(X<\alpha)} \\
&=& \frac{(1-q)(1-q^{\alpha(y+1)})q^{y+1}}{P(X<\alpha)}
\end{eqnarray}
\noindent using (\ref{e14}),
\[
P(X<\alpha)=\sum_{x=0}^{\alpha-1}P(Y=y)=\sum_{y=0}^{\alpha-1}\left(\frac{1-q}{1-q^{1+x}}-\frac{1-q}{1-q^{2+x}}\right)= \frac{q(1-q^{\alpha})}{(1-q^{\alpha+1})}
\]
hence, by substituting in (\ref{e15}), we get
\begin{flalign*}
&& P(Y=y)= \frac{(1-q)(1-q^{\alpha+1})q^{y}(1-q^{\alpha
(y+1)})}{(1-q^{\alpha})} && \Box
\end{flalign*}
Analogue to weighted exponential distribution, we can interpreted above as the discrete hidden truncation model. Suppose $Z$ and $X$ are two correlated discrete rvs with the joint PDF (\ref{e13}) and we can not observe $X$, but we can observe $Z-1$ if $X < \alpha$, then the observed sample can be regarded as drawn from a distribution with the PDF given in $(\ref{e2})$. \\
\noindent \textbf{Theorem 5:} If $ U $ and $ V $ are independent geometric rvs distributed with parameter $q$ and $q^{\alpha+1}$ respectively, then $U+V \sim \mathcal{WG}(\alpha,q)$. \\
\textit{Proof:} Since $U$ and $V$ are independent geometric rvs with parameters $q$ and $q^{\alpha+1}$.
Therefore
\begin{align} \nonumber
\mathbb{M}_{U+V}(t)&=\mathbb{M}_{U}(t)\mathbb{M}_{V}(t)\\
&=\frac{(1-q)(1-q^{1+\alpha})}{(1-e^{t}q)(1-e^{t}q^{1+\alpha})} \label{e16}
\end{align}
which is same as the MGF of $\mathcal{WG}(\alpha,q)$ given in equation $(\ref{e8})$.
Hence by uniqueness theorem of moment generating functions we conclude that $U+V \sim \mathcal{WG}(\alpha,q)$. \\
\noindent \textbf{Corollary 1:} If $U_i \overset{i.i.d.}{\sim} Geo(q^{1/n})$ and $V_i \overset{i.i.d.}{\sim} \textit{Geo}(q^{\frac{\alpha+1}{n}})$ be two independent samples, then
\begin{equation*}
U_{(1)}+V_{(1)} \sim \mathcal{WG}(q,\alpha)
\end{equation*}
\noindent where $U_{(1)}=\min_{i\le 1 \le n}U_i$ and $V_{(1)}=\min_{i\le 1 \le n}V_i$. \hfill $\Box$\\
\\
\noindent The result of Theorem 5, can further be extended to obtained new generalized negative binomial distribution, and for its construction, let $X_1$ and $X_2$ follows independent Negative Binomial with parameters $(r,q)$ and $(r,q^{\alpha+1})$ respectively, then the pmf of rv $Y=X_1+X_2$ obtained using convolution definition as follows
\begin{align*}
P(Y=y)&=\sum\limits_{x=0}^{y}p_{X_1}(y-x)p_{X_2}(x), \text{for} \quad y=0,1,2,\cdots \\
&=\sum\limits_{x=0}^{y}\binom{r+x-1}{x}\binom{r+y-x-1}{z-x}(1-q)^r q^{y-x}(1-q^{\alpha+1})^r(q^{\alpha+1})^{x}\\
&=(1-q)^r(1-q^{\alpha+1})^r q^{y} \sum\limits_{x=0}^{y}\binom{r+x-1}{x}\binom{r+y-x-1}{y-x} q^{\alpha x}\\
P(Y=y)&=(1-q)^r(1-q^{\alpha+1})^r q^{y} \binom{r+y-1}{y} \,_2F_1\left(r,-y;-r-y+1;q^{\alpha}\right)
\end{align*}
We can call the above PMF as \textbf{weighted negative binomial distribution} with parameters $(r,\alpha,q).$
\subsection {Infinite Divisibility}
Since the geometric distribution is infinitely divisible, hence it can be seen, in light of theorem 5, that $Y \sim \mathcal{WG}(\alpha,q)$ distribution is also infinitely divisible. Moreover, by factorization property of geometric law(feller,1957)
\[
Y \stackrel{D}{=}Y_{n1}+Y_{n2}+\cdots+Y_{nn} \qquad \qquad n=1,2,\cdots
\]
where $Y_{ij}=U_{i1}+U_{i2}$ where $U_{i1}$ and $U_{i2}$ are independent negative binomial random variate with parameters $(1/n,q)$ and $(1/n,q^{\alpha+1})$ respectively.
\noindent A canonical representation of $\mathcal{WG}$ characteristic funciton(c.f.) follows from L\'evy-Khintchine theorem stated as
A complex values function $\varphi$ defined on $\mathbb{R}$ is an infinite divisible c.f. iff $\log \varphi$ admits the representation
\begin{equation} \label{ecf}
\log \varphi(t)=i \gamma t+\int\limits_{-\infty}^{\infty}\left(e^{i t x}-1-\frac{itx}{1+x^2}\right)\frac{1+x^2}{x^2}dG(x)
\end{equation}
where $\gamma \in \mathbb{R}$, $G$ is bounded, non-decreasing, right continuous function on $\mathbb{R}$ such that $G(-\infty)=0$ and $G(\infty)<\infty$.\\
\noindent According to (\ref{e16}),c.f. of $\mathcal{WGD}$ can be written as
\begin{equation*}
\varphi(t)=\mathbb{M}_Y(i t)= \frac{(1-q)(1-q^{1+\alpha})}{(1-e^{i t}q)(1-e^{it}q^{1+\alpha})}
\end{equation*}
which after factorisation represent in the form
\begin{equation} \label{cf}
\log \varphi(t)= \sum\limits_{k=1}^{\infty}(e^{i t k}-1)\frac{q^k+q^{(\alpha+1)k}}{k}.
\end{equation}
Taking $\gamma=\sum\limits_{k=1}^{\infty}\frac{q^k+q^{(\alpha+1)k}}{1+k^2}$ and $G(.)$ to be non decreasing function with jumps of magnitude $\frac{k}{k^2+1}\left(q^k+q^{(\alpha+1)k}\right)$ at $k=0,1,2,\cdots$, we see that $\log \varphi(t)$ has a unique representation as given in (\ref{ecf}). Hence we conclude that $\mathcal{WGD}(q,\alpha)$ is infinitely divisible.
\section{Characterisation of Geometric Distribution using $\mathcal{WG}(\alpha,q)$ Distribution}
Following three theorems gives an alternate way of characterisation of geometric distribution which can also be viewed as simultaneous characterisation of $\mathcal{WG}(\alpha,q)$ and geometric distribution.\\
\noindent \textbf{Theorem 6} Suppose $Y_1$ and $Y_2$ are i.i.d. discrete r.v.s with support $N_0$ and for $\alpha \ge 1$, suppose the
conditional r.v. $Y = Y_1|((Y_1+1) \ge \alpha(Y_2 +1))$ follows $\mathcal{WG}(\alpha,q)$ given at (\ref{e2}). Then the distribution of $Y_1$ is \textit{Geo}($q$).\\
\noindent \textit{Proof:} By equation (\ref{e10}) we have for all $\alpha \ge 1$ and $y \in N_0$,
\[
f(y) F(\alpha(y+1)-1)=C(\alpha) \frac{(1-q)(1-q^{\alpha+1})}{(1-q^\alpha)}q^y\left(1-q^{\alpha(y+1)}\right)
\]
where $c(\alpha)=P(Y_2+1 \le \alpha(Y_1+1)).$ In particular for $\alpha =1$ we have for all $y \in N_0$
\begin{equation}
f(y)F(y)=C(1)(1-q^2)q^y(1-q^{y+1}) =C^*q^y(1-q^{y+1})
\end{equation}
Then for $y=0$. we get $f^2(0)=C^*(1-q)$.
Further for $y=1$, we have $f(1)\left(f(0)+f(1)\right)=C^*q(1-q^2).$ Writing $\theta_1=\frac{f(1)}{f(0)}$, we observe $\theta_1(1+\theta_1)=q(1+q)$. For this quadratic equation in $\theta_1$ the two solutions are $q$ and $-(1 + q)$ of which the second being negative is invalid. Thus $f(1) = qf(0)$.
We claim $f(y) = q^y f(0)$ for all $y \in N_0$. Note that it holds for $y = 0, 1$. Suppose this holds for $y = 1, 2, \cdots n$. We shall prove that it holds for $y = n + 1$. \\
From (19) we have
\[
f(n+1)F(n+1)=C^*q^{n+1}\left( 1-q^{n+2}\right)
\]
i.e \\
\[
\theta_{n+1}\left( \sum\limits_{y=0}^{n}\theta_y +\theta_{n+1}\right)= \frac{C^*q^{n+1}(1-q^{n+2})}{f^2(0)},
\]
where $\theta_k=\frac{f(k)}{f(0)}$, $k=0,1,\cdots,n+1$. Thus we have by the induction hypothesis,
\begin{equation}
\theta_{n+1}\left( \sum\limits_{y=0}^{n}q_y +\theta_{n+1}\right)=q^{n+1} \left(\sum\limits_{y=0}^{n+1}q^y \right)
\end{equation}
For the quadratic equation (20) in $\theta_{n+1}$, $q^{n+1}$ is a solution and the other solution is $-\sum\limits_{y=0}^{n+1}q^y$ which is not valid. Thus for all $y \in N_0$, $f(y)=f(0)q^y$. This gives $f(0)=1-q$ and hence the r.v. $Y_1$ follows $Geo(q)$. $\Box$ \\
\noindent \textbf{Theorem 7:} Suppose $Y$ and $Z$ are two rvs such that $Y$ and $Z-1$ are $N_0$ valued with the conditional random
variable $Y$ given $Z = z$ having $Geo(q^Z)$ and the conditional distribution of $Z-1$ given $Y <\alpha $ having $\mathcal{WG}(\alpha,q)$, where $\alpha$ being a positive integer and $0 < q < 1$. Then $Z-1$ follows $Geo(q)$.\\
\noindent \textit{Proof:} By assumption
\[
P(Y=y|Z=z)=(1-q^z)q^{zy}, \qquad \text{for} \quad y=0,1,2,\cdots
\]
and
\[ P(Z-1=x|Y<\alpha)=A(\alpha,q)q^x(1-q^{\alpha(x+1)})
\]
where $A(\alpha,q)=\frac{(1-q)(1-q^{\alpha+1})}{(1-q^\alpha)}$. Then for $x\in N_0$
\[
P(Z-1=x|Y<\alpha)=\frac{P(Z=x+1 \cap Y \le \alpha-1)}{P(Y \le \alpha-1)}=A(\alpha,q)q^x(1-q^{\alpha(x+1)})
\]
\begin{eqnarray*}
\frac{P(Z=x+1)P(Y \le \alpha-1|Z=x+1)}{P(Y \le \alpha -1)}&=& A(\alpha,q)q^x(1-q^{\alpha(x+1)}) \\
\frac{P(Z=x+1)(1-q^{\alpha(x+1)})}{P(Y \le \alpha -1)}&=&A(\alpha,q)q^x(1-q^{\alpha(x+1)}) \\
P(Z=x+1)&=&A^*(\alpha,q)q^x
\end{eqnarray*}
where $A^*(\alpha,q)=A(\alpha,q)P(Y<\alpha)$. Hence $Z-1$ follows $Geo(q)$. \quad \qquad \quad $\Box$\\
\noindent \textbf{Theorem 8} Suppose $Y$ is a rv with support $N_0$ and probability generating function $\mathbb{P}_Y(t)$ and the corresponding weighted distribution with weight function $w(t) = 1-q^{\alpha(t+1)}$ is $\mathcal{WG}(\alpha,q)$, $\alpha \ge 1, 0 < q < 1$. Then $Y$ follows $Geo(q)$. \\
\textit{Proof:} Note that $\mathbb{E}(w(Y))=1-q^\alpha \mathbb{P}(q^\alpha)$. Then the weighted distribution of $Y$ corresponding to the weight function $w(t)$ is given by \\
\begin{equation} \label{e19}
q(y)=\frac{(1-q)(1-q^{\alpha(y+1)})}{1-q^\alpha \mathbb{P}(q^\alpha)} P(Y=y)
\end{equation}
But by hypothesis
\begin{equation} \label{e20}
q(y)=\frac{(1-q)(1-q^{\alpha+1})}{(1-q^\alpha)}q^y(1-q^{\alpha(y+1)})
\end{equation}
Thus from (\ref{e19}) and (\ref{e20}) we get
\[
P(Y=y)=C(\alpha,q)(1-q)q^y.
\]
For $Y$ to be a proper r.v. it is necessary that $C(\alpha; q)$ = 1 and hence $Y \sim Geo(q)$.
\section{Estimation}
In this section we discuss various methods of estimation of parameters $\alpha$ and $q$.
\subsection{Moment Estimators}
The Method of Moments(MM) estimators are obtained by equating the sample mean and sample variance $M_1=\frac{1}{n}\sum\limits_{i=1}^{n}x_i$ and $M_2=\frac{1}{n}\sum\limits_{i=1}^{n}(x_i-\bar{x})^2$ with the population moments defined in (6) and (7) respectively as
\begin{equation*}
M_1=\frac{\tilde{q}}{1-\tilde{q}}+\frac{\tilde{q}^{{\tilde{\alpha}+1}}}{1-\tilde{q}^{\tilde{\alpha}+1}} , \qquad M_2=\frac{\tilde{q}}{(1-\tilde{q})^2}+\frac{\tilde{q}^{{\tilde{\alpha}+1}}}{(1-\tilde{q}^{\tilde{\alpha}+1})^2}
\end{equation*}
Hence, by solving the above equations we get moment estimators of $\tilde{q}$ and $\tilde{\alpha}$ in the closed form as
\begin{equation}
\begin{aligned}
\tilde{q}=&\frac{2M_1+M_1^2-M_2+\sqrt{2M_2-M_1^2-2 M_1}}{2+3M_1+M_1^2-M_2} \\
\tilde{\alpha}=& \log_{\tilde{q}}\left( \frac{(1-\tilde{q})M_1-\tilde{q}}{(1-\tilde{q})(M_1+1)-\tilde{q}}\right)-1
\end{aligned}
\end{equation}
\subsection{Estimator based on proportion of zeros and ones(MP)}
If $p_0, p_1$ be the known observed proportion of $0's$ and $1's$ in the sample given as
\begin{equation*}
p_0=(1-\breve{q})(1-\breve{q}^{\breve{\alpha}+1}),\qquad p_1=(1-\breve{q})(1-\breve{q}^{\breve{\alpha}+1})\breve{q}(1+\breve{q}^{\breve{\alpha}})
\end{equation*}
solving the above equations the closed form solution for $\breve{\alpha}$ and $\breve{q}$ is
\begin{equation}
\begin{aligned}
\breve{q}=&\frac{p_1+\sqrt{4 p_0^2-4 p_0^3-4 p_0 p_1+p_1^2}}{2 p_0} \\
\breve{\alpha}=& \log_{\breve{q}}\left(\frac{p_1}{\breve{q}p_0}-1 \right)
\end{aligned}
\end{equation}
\subsection{Maximum Likelihood Estimation}
Let $(x_1,x_2,\cdots,x_n)$ be $n$ random observations from $\mathcal{WG}(\alpha,q)$. Then the $\log$-likelihood function$(l=\log L(q,\alpha |x))$ for this sample is given by
\begin{equation}
l= n \log(1-q)+n \log(1-q^{\alpha+1})-n \log(1-q^{\alpha})+\log{q}\sum_{i=1}^{n}x_i +\sum_{i=1}^{n} \log(1-q^{\alpha(x_i +1)})
\end{equation}
Therefore the $\log$-likelihood equations are given as follows.
\begin{equation} \label{e25}
\frac{\partial l}{\partial q}=-\frac{n}{1-q}+\frac{nq^{\alpha-1}\alpha}{1-q^{\alpha}}-\frac{nq^{\alpha}(1+\alpha)}{1-q^{1+\alpha}}+\frac{\sum_{i=1}^{n}x_i}{q}-\sum_{i=1}^{n}\frac{q^{\alpha(1+x_i)-1}\alpha (1+x_i)}{1-q^{\alpha (1+x_i)}}
\end{equation}
\begin{equation} \label{26}
\frac{\partial l}{\partial \alpha}=\frac{n q^{\alpha} \log q}{1-q^{\alpha}}-\frac{n q^{1+\alpha}\log q}{1-q^{1+\alpha}}-\sum_{i=1}^{n}\frac{q^{\alpha(1+x_i)}(1+x_i)\log q}{1-q^{\alpha(1+x_i)}}
\end{equation}
As the above equations could not give closed solution for the parameter. We solve the above equation by numerical methods using the initial value of parameter obtained from either Moment estimator or by Method of Proportion.
\\
The second order partial derivatives are given as follows
\begin{align*}
\frac{\partial^{2} \log L}{\partial q^{2}}&=\left. -\frac{n}{(1-q)^2}+\frac{nq^{\alpha-2}(\alpha-1)\alpha}{1-q^{\alpha}}+\frac{nq^{-2+2\alpha}\alpha^{2}}{(1-q^{\alpha})^2}\right.\\
& \quad \left.-\frac{nq^{\alpha-1}\alpha (1+\alpha)}{1-q^{1+\alpha}}-\frac{nq^{2\alpha}(1+\alpha)^2}{(1-q^{1+\alpha})^2}-\frac{\sum_{i=1}^{n}x_i}{q^2} \right.\\
&\quad \left. +\sum_{i=1}^{n}\left( -\frac{q^{-2+2\alpha(1+x_i)}\alpha^{2}(1+x_i)^2}{(1-q^{\alpha(1+x_i)})}-\frac{q^{-2+\alpha(1+x_i)}\alpha(1+x_i)(-1+\alpha(1+x_i))}{1-q^{\alpha(1+x_i)}}\right) \right. \\
\frac{\partial^{2} \log L}{\partial \alpha^{2}}&= \left. \frac{nq^{2\alpha}\log q^2}{(1-q^{\alpha})^2}+\frac{nq^{\alpha}\log q^{2}}{1-q^{\alpha}}-\frac{nq^{2+2\alpha}\log q^2}{(1-q^{1+\alpha})^2} -\frac{nq^{1+\alpha}\log q^{2}}{1-q^{1+\alpha}}\right.\\
& \quad \left.+ \sum_{i=1}^{n}\left(-\frac{q^{2\alpha(1+x_i)}\log q^{2}(1+x_i)^2}{(1-q^{\alpha(1+x_i)})^2}-\frac{q^{\alpha (1+x_i)}\log q^{2}(1+x_i)^2}{(1-q^{\alpha(1+x_i)})}\right)\right. \\
\frac{\partial^{2}\log L}{\partial q \partial \alpha} &= \left. \frac{n q^{\alpha-1}}{1-q^{\alpha}}-\frac{nq^{\alpha}}{1-q^{1+\alpha}}+\frac{nq^{-1+2\alpha}\alpha \log q}{(1-q^\alpha)^2}+\frac{n q^{-1+\alpha}\alpha \log q}{1-q^{\alpha}}\right. \\
& \quad \left.-\frac{n q^{1+2\alpha}(1+\alpha)\log q}{(1-q^{1+\alpha})^2}-\frac{nq^{\alpha}(1+\alpha)\log q}{1-q^(1+\alpha)} \right. \\
&\quad +\sum_{i=1}^{n}\left(\frac{q^{-1+\alpha(1+x_i)}(1+x_i)\alpha \log q (1+x_i)^2}{(1-q^{\alpha (1+x_i)})}-\frac{q^{-1+2\alpha(1+x_i)}\alpha \log q (1+x_i)^2}{(1-q^{\alpha(1+x_i)})^2} \right. \\
&\quad \left.\qquad \quad -\frac{q^{-1+\alpha(1+x_i)}\alpha \log q (1+x_i)^2}{1-q^{\alpha(1+x_i)}}\right)
\end{align*}
\noindent The Fisher's information matrix of $(q,\alpha)$ is
\begin{equation*}
\mathbf{J_y}= \begin{bmatrix}
-\mathbb{E}\left(\frac{\partial^2l}{\partial q^2}\right)&-\mathbb{E}\left(\frac{\partial^2l}{\partial q \partial \alpha}\right) \\
-\mathbb{E}\left(\frac{\partial^2l}{\partial \alpha \partial q}\right)&-\mathbb{E}\left(\frac{\partial^2l}{\partial \alpha^2}\right)
\end{bmatrix}
\end{equation*}
which can be approximate and written as
\begin{equation*}
\mathbf{J_y} \approx \begin{bmatrix}
J_{11} &J_{12} \\
J_{21}&J_{22}
\end{bmatrix}=\begin{bmatrix}
\frac{\partial^2l}{\partial q^2}\big|_{\hat{q},\hat{\alpha}}&\frac{\partial^2l}{\partial q \partial \alpha}\big|_{\hat{q},\hat{\alpha}} \\
\\
\frac{\partial^2l}{\partial \alpha \partial q}\big|_{\hat{q},\hat{\alpha}}&\frac{\partial^2l}{\partial \alpha^2}\big|_{\hat{q},\hat{\alpha}}
\end{bmatrix}
\end{equation*}
where $\hat{q}$ and $\hat{\alpha}$ are the maximum likelihood estimators of $q$ and $\alpha$ respectively. Also, as $n \to \infty$ limiting distribution of $\sqrt{n}\left(q-\hat{q},\alpha-\hat{\alpha}\right)$ distributed as bivariate normal with mean vector 0 and variance-covariance matrix
\begin{equation}
\mathbf{J}^{-1}=\frac{1}{J_{11}J_{22}-J_{12}J_{21}} \begin{pmatrix}
J_{11} & J_{12}\\
J_{21}& J_{22}
\end{pmatrix}
\end{equation}
\section{Data Analysis}
In this section we apply $\mathcal{WG}(q,\alpha)$ distribution to two data sets. The fist data is from Klugman et al.(2012) represents number of claims made by an automobile insurance policyholders. Whereas the second data set is also from (Klugman 2012) gives information about number of hospitalizations per family member per year. Here we apply method of maximum likelihood to estimate the parameter of our model using maxlik() function in R with initial value taken from method of moment discussed in section(5.1). The variance to mean ratio for dataset 1 and 2 are 1.357 and 1.075 respectively, which give clear sign of over dispersion. Hence, $\mathcal{WG}$ could be one of the possible choices. Further the list of distributions presented in Table (1) which are used for comparative study for data sets. Table (2) and (1) present the details of fitting of $\mathcal{WG}$ and other distributions. Comparative measure like chi-square$\left(\chi^2=\sum_{i}(O_i-E_i)^2/E_i\right)$ test and the corresponding $p-value$ are being used. \\
\begin{table}[]
\centering
\caption{DetailS of distributions used in data analysis for comparative study.}
\small\addtolength{\tabcolsep}{-4pt}
\begin{tabular}{lr}
\hline
Distribution Name & Distributional form \\ \hline
Negative Binomial $(\mathcal{NB})$ & \multirow{3}{*}{$\binom{r+y-1}{y}p^r(1-p)^y$} \\
Johnson(2005) & \\
&\\
Poisson Lindley $(\mathcal{PL})$ & \multirow{3}{*}{$\frac{\theta^2(y+\theta+2)}{(1+\theta)^3}$} \\
Shankaran (1970) & \\
& \\
Generalized Gemometric $(\mathcal{GGD})$ & \multirow{3}{*}{$\frac{\alpha \theta^y(1-\theta)}{\left(1-\bar{\alpha}\theta^y\right)\left(1-\bar{\alpha}\theta^{y+1}\right)}$} \\
G\'omez (2010) & \\
&\\
New Generalized Poisson Lindley $(\mathcal{NGPL})$ & \multirow{3}{*}{$\frac{\theta ^2}{(\theta +\alpha)(1+\theta)^{x+1}}\left(1+\frac{\alpha (x+1)}{(1+\theta )}\right)$} \\
Bhati et al.(2015) & \\
&\\
Poisson -Inverse Gaussian $(\mathcal{PIG})$ & \multirow{3}{*}{$\frac{1}{y!}\sqrt{\frac{2\phi }{\pi}}e^{\phi /\mu } \left(\frac{\phi \mu^2}{2\mu^2+\phi }\right)^{-\frac{1}{4}+\frac{y}{2}} K_{\frac{1}{2}-y}\left(\sqrt{2\phi +\frac{\phi ^2}{\mu ^2}}\right)$} \\
&\\
Willmot(1987) &\\
&\\
New Discrete Distribution $(\mathcal{ND})$ & \multirow{3}{*}{$\frac{\log(1-\alpha \theta^y)-\log(1-\alpha \theta^{y+1})}{\log(1-\alpha)}$} \\
Gomez et al.(2011) & \\
& \\
Discrete Generalized Exponential $(\mathcal{DGE})$ & \multirow{3}{*}{$(1-q^{y+1})^\alpha-(1-q^{y})^{\alpha} $} \\
Nekoukhou et al.(2012) & \\
& \\ \cline{1-2}
\end{tabular}
\end{table}
\begin{table}[]
\centering
\small\addtolength{\tabcolsep}{-4pt}
\caption{Number of claims in automobile insurance}
\begin{tabular}{llrrrrr} \hline
& {Observed} & \multicolumn{5}{c}{Expected frequency} \\ \hline
Count & frequency & $\mathcal{PL}$ & $\mathcal{NB}$ & $\mathcal{GGD}$ & $\mathcal{NGPL}$ & $\mathcal{WG}$ \\ \hline
0 & 1563 & 1569.53 & 1564.54 & 1563.67 & 1564.57 & 1564.27 \\
1 & 271 & 256.34 & 264.58 & 266.37 & 264.28 & 265.12 \\
2 & 32 & 41.34 & 39.44 & 38.69 & 39.69 & 39.05 \\
3 & 7 & 6.6 & 5.66 & 5.48 & 5.59 & 5.62 \\
$\ge$4 & 2 & 1.19 & 0.78 & 0.79 & 0.87 & 0.94 \\ \hline
& 1875 & 1875 & 1875 & 1875 & 1875 & 1875 \\ \hline
\multicolumn{2}{l}{parameter(s)(\textbf{$\Theta$})} & $\theta$ & $(r, p)$ & ($\alpha$, $\theta$) & ($\alpha$, $\theta$) & ($q$, $\alpha$) \\
\multicolumn{2}{l}{Estimates$(\hat{\Theta})$} & 5.89 & (1.309, 0.871) & (1.212, 0.141) & (8.835, 7.874) & (0.143, 0.874) \\
\multicolumn{2}{l}{S.E.$(\hat{\Theta})$} & 0.32 & (1.081, 0.214) & (0.226, 0.029) & (2.601, 0.439) & \textbf{(0.023, 0.707)} \\
\multicolumn{2}{l}{($df$,$\chi^2_{df}$-value)} & (4, 3.874) & (3, 3.610) & (3, 3.597) & (3, 3.489) & \textbf{(3, 2.935)} \\
\multicolumn{2}{l}{p-value} & 0.4231 & 0.4332 & 0.4632 & 0.481 & \textbf{0.569 }\\ \hline
\end{tabular}
\end{table}
\begin{table}[]
\centering
\small\addtolength{\tabcolsep}{-4pt}
\caption{Number of claims in automobile insurance}
\begin{tabular}{llrrrrr} \hline
& {Observed} & \multicolumn{5}{c}{Expected frequency} \\ \hline
Count & frequency & $\mathcal{ND}$ & $\mathcal{NB}$ & $\mathcal{PIG}$ & $\mathcal{DGE}$ & $\mathcal{WG}$ \\ \hline
0 & 2659 & 2659.02 & 2659.06 & 2658.97 & 2660.62 & 2659.04 \\
1 & 244 & 243.79 & 243.64 & 244.02 & 242.456 & 243.738 \\
2 & 19 & 19.52 & 19.65 & 19.24 & 19.2681 & 19.5579 \\
$\ge$ 3 & 2 & 1.65 & 1.63 & 1.75 & 1.643192 & 1.65801 \\ \hline
& 2924 & 2924 &2924 & 2924 & 2924 & 2924 \\ \hline
\multicolumn{2}{l}{parameter(s)(\textbf{$\Theta$})} & $(\alpha,\theta)$ & $(r, p)$ & ($\phi$, $\mu$) & ($\alpha$, $q$) & ($q$, $\alpha$) \\
\multicolumn{2}{l}{Estimates$(\hat{\Theta})$} & (−0.341,0.079) & (1.314,0.93) & (0.127,0.098) & (1.147.079) & (0.078,0.696) \\
\multicolumn{2}{l}{S.E.$(\hat{\Theta})$} & (0.673,0.018) & (0.652,0.032) & (0.065,0.006) & (0.256,0.016) & (0.023,0.984) \\
\multicolumn{2}{l}{($df$,$\chi^2_{df}$-value)} & (1, 0.08) & (1, 0.09) & (1, 1.02) & (1, 0.092) & (1, 0.08) \\
\multicolumn{2}{l}{p-value} & 0.7773 & 0.7641 & 0.3125 & 0.76164 & 0.7773\\ \hline
\end{tabular}
\end{table}
\section{Conclusion}
In this paper, we propose a new generalization of geometric distribution which can also be viewed as a discrete version of weighted exponential distribution. We have derived some distributional properties of the proposed model and also we present three results on characterisation of geometric distribution from the proposed model. Unlike with other generalizations of geometric distribution, closed form expressions for estimation methods viz. method of moment and method of proportion are obtained. Proposed model give better fit for automobile insurance data. Some reliability properties of the proposed model can be looked as further work. Moreover a new extension of negative binomial distribution have also presented in the proposed work, which can further be explored.
\section*{Acknowledgement}
The authors are thankful to Prof. M. Sreehari for bringing our attention to characterisation section and particularly proof of Theorem 6 and to Prof. R. Vasudeva, for his critical reading and discussion.
| {'timestamp': '2016-02-08T02:09:55', 'yymm': '1512', 'arxiv_id': '1512.07139', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.07139'} | arxiv |
\section{Introduction}
\label{sec:introduction}
In previous publications it was shown how a triple knowledge graph (KG) can be represented as a multiway array (tensor) and how a statistical model can be formed by deriving latent representations of generalized entities. Successful models are, e.g., RESCAL~\cite{nickel_three-way_2011}, Translational Embeddings Models~\cite{bordes_learning_2011}, Neural Tensor Models~\cite{socher_reasoning_2013} and the multiway neural networks as used in~\cite{dong_knowledge_2014}.
In these publications KGs were treated as static: A KG grew more links when more facts became available but the ground truth value associated with a link was considered time invariant.
In this paper we address the issue of KGs where triple states depend on time. In the simplest case this might consider simple facts like ``Obama is president of the United States'', but only from 2008-2016. Another example is a patient whose status changes from sick to healthy or vice versa. Most popular KGs like Yago~\cite{suchanek_yago:_2007}, DBpedia~\cite{auer_dbpedia:_2007}
Freebase~\cite{bollacker_freebase:_2008} and the Google Knowledge Graph~\cite{singhal_introducing_2012} have means to store temporal information.
Without loss of generality, we assume that changes in the KG always arrive in form of events, in the sense that the events are the gateway to the KG. For a given time step, events are described by a typically very sparse event triple graph, which contains facts that change some of the triples in the KG, e.g., from \textit{True} to \textit{False} and vice versa. KG triples which do not appear in the event graph are assumed unchanged.
An example might be the statement that a patient has a new diagnosis of diabetes, which is an information that first appears as an event in the event graph but is then also transmitted to the KG. Other events might be a prescription of a medication to lower the cholesterol level, the decision to measure the cholesterol level and the measurement result of the cholesterol level; so events can be, e.g., actions, decisions and measurements. In a similar way as the KG is represented as a KG tensor, the event graphs for all time steps can be represented as an event tensor. Statistical models for both the KG tensor and the event tensor can be derived based on latent representations derived from the tensor contents.
Although the event tensor has a representation for time, it is by itself not a prediction model. Thus, we train a separate prediction model which estimates future events based on the latent representations of previous events in the event tensor and the latent representations of the involved generalized entities in the KG tensor. In this way, a prediction can, e.g., use both background information describing the status of a patient and can consider recent events. Since some future events will be absorbed into the KG, by predicting future events, we also predict likely changes in the KG and thus obtain a model for the evolution of the KG as well.
The paper is structured as follows. The next section discusses related work.
In Section~\ref{sec:tensors} we review statistical KG models based on latent representations of the involved generalized entities.
In Section~\ref{sec:events} we discuss the event tensor and its latent representations.
In Section~\ref{sec:markov} we demonstrate how future events can be estimated using a prediction model that uses latent representations of the KG model and the event model as inputs.
In the applications of this paper in Section~\ref{sec:exper}, we consider patients and their changing states, users and their changing movie preferences and weather stations and their changing signal statistics.
In the latter we show how ---in addition to event data--- sensory data can be modeled.
Section~\ref{sec:concl} contains our conclusions and discusses extensions.
\section{Related Work}
\label{sec:related}
There is a wide range of papers on the application of data mining and machine learning to KGs. Data mining attempts to find interesting KG patterns~\cite{berendt2002towards,rettinger2012mining,paulheim2014data}. Some machine learning approaches attempt to extract close-to deterministic dependencies and ontological constructs~\cite{maedche2001ontology,fanizzi2008dl,lehmann2009dl}. The paper here focuses on \emph{statistical} machine learning in KG where representation learning has been proven to be very successful.
There is considerable prior work on the application of tensor models to temporal data, e.g., EEG data, and overviews can be found in~\cite{kolda_tensor_2009} and~\cite{morup}. In that work, prediction is typically not in focus, but instead one attempts to understand essential underlying temporal processes by analysing the derived latent representations.
Some models consider a temporal parameter drift. Examples are the BPTF~\cite{DBLP:conf/sdm/XiongCHSC10}, and
~\cite{DBLP:journals/tkdd/DunlavyKA11}. Our model has a more expressive dynamic by explicitly considering recent histories. Markov properties in tensor models were considered in~\cite{RendleFS10,rendle_factorization_2010}. In that work quadratic interactions between latent representations were considered. The approach described here is more general and also considers multiway neural networks as flexible function approximators.
Our approach can also be related to the
neural probabilistic language
model~\cite{bengio1}, which coined the term \emph{representation learning}. It can be considered an event model where the occurrence of a word is predicted based on most recent observed words using a neural network model with word representations as inputs. In our approach we consider that several events might be observed at a time instance and we consider a richer family of latent factor representations.
There is considerable recent work on dynamic graphs~\cite{DBLP:conf/kdd/LeskovecKF05,DBLP:journals/sigkdd/OMadadhainHS05,DBLP:conf/kdd/SunFPY07,DBLP:conf/wsdm/RossiGNH13} with a strong focus on the Web graph and social graphs. That work is not immediately applicable to KGs but we plan to explore potential links as part of our future work.
\section{The Knowledge Graph Model}
\label{sec:tensors}
With the advent of the Semantic Web~\cite{berners-lee_semantic_2001}, Linked Open Data~\cite{berners-lee_linked_2006}, Knowledge Graphs (KGs)~\cite{suchanek_yago:_2007,auer_dbpedia:_2007,bollacker_freebase:_2008,singhal_introducing_2012},
triple-oriented knowledge representations have gained in popularity.
Here we consider a slight extension to the subject-predicate-object triple form by adding the value
($e_s, e_p, e_o$; \textit{Value}) where \textit{Value} is a function of $s, p, o$ and can be the truth value of the triple or it can be a measurement. Thus \textit{(Jack, likes, Mary; True)} states that Jack likes Mary,
and \textit{(Jack, hasBloodTest, Cholesterol; 160)} would indicate a particular blood cholesterol level for Jack. Note that $e_s$ and $e_o$ represent the entities for subject index $s$ and object index $o$. To simplify notation we also consider $e_p$ to be a generalized entity associated with predicate type with index $p$.
A machine learning approach to inductive inference in KGs is based on the factor analysis of its adjacency tensor $\underline{X}$
where the tensor element $x_{s, p, o}$ is the associated \textit{Value} of the triple ($e_s, e_p, e_o$). Here $s = 1, \ldots, S$, $p = 1, \ldots, P$, and $o = 1, \ldots, O$.
One can also define a second tensor $\underline{\Theta}^{KG}$ with the same dimensions as $\underline{X}$. It contains the natural parameters of the model and the connection to $\underline X$. In the binary case one can use a Bernoulli likelihood with
$P(x_{s, p, o} | \theta^{KG}_{s, p, o} ) \sim
\textrm{sig}(\theta^{KG}_{s, p, o})$, where
$\textrm{sig}(arg) = 1/(1+\exp(-arg))$ is the logistic function. If $x_{s, p, o}$ is a real number than we can use a Gaussian distribution with $P(x_{s, p, o} | \theta^{KG}_{s, p, o} ) \sim {\mathcal{N}}(\theta^{KG}_{s, p, o}, \sigma^2)$.
In representation learning, one assigns an $r$-dimensional latent vector to the entity $e$ denoted by
$
\mathbf{a}_e = (a_{e, 0}, a_{e, 1}, \ldots, a_{e, r})^T
$.
We then model using one function
\[
\theta^{KG}_{s, p, o} = f^{KG}(\mathbf{a}_{e_s}, \mathbf{a}_{e_p}, \mathbf{a}_{e_o})
\]
or, using one function for each predicate,
\[
\theta^{KG}_{s, p, o} = f^{KG}_p(\mathbf{a}_{e_s}, \mathbf{a}_{e_o}) .
\]
For example, the RESCAL model~\cite{nickel_three-way_2011} is
\[
\theta^{KG}_{s, p, o} = \sum_{k=1}^r \sum_{l=1}^r R_{p, k, l} a_{e_s,k} a_{e_o,l} ,
\]
where $R \in \mathbb{R}^{P \times r \times r}$ is the core tensor.
In the multiway neural network model~\cite{dong_knowledge_2014} one uses
\[
\theta^{KG}_{s, p, o} = \textrm{NN} (\mathbf{a}_{e_s}, \mathbf{a}_{e_p}, \mathbf{a}_{e_o})
\]
where $\textrm{NN}$ stands for a neural network and where the inputs are concatenated. These approaches have been used very successfully to model large KGs, such as the Yago KG, the DBpedia KG and parts of the Google KG. It has been shown experimentally that models using latent factors perform well in these high-dimensional and highly sparse domains. For a recent review, please consult~\cite{nickel2015}.
We also consider an alternative representation.
The idea is that the latent vector stands for the tensor entries associated with the corresponding entity. As an example, $\mathbf{a}_{e_{s}}$ is the latent representation for all values associated with entity $e_s$, i.e., $x_{s, :, :}$. \footnote{If an entity can also appear as an object ($o: e_o = e_s$), we need to include
$x_{:, :, o}$. }
It is then convenient to
assume that one can calculate a so-called $M$-map of the form
\begin{equation}\label{eq:map}
\mathbf{a}_{e_{s}} = M^{\textit{subject}} x_{s, :, :} .
\end{equation}
Here $M^{\textit{subject}} \in \mathbb{R}^{r \times (P O)}$ is a mapping matrix to be learned and $x_{s, :, :}$ is a column vector of size $PO$.\footnote{The $M$ matrices are dense but one dimension is small ($r$), so in our settings we did not run into storage problems. Initial experiments indicate that random projections can be used in case that computer memory becomes a limitation.} For multilinear models it can be shown that such a representation is always possible; for other models this is a constraint on the latent factor representation. The advantage now is that the latent representations of an entity can be calculated in one simple vector matrix product, even for new entities not considered in training.
We can define similar maps for all latent factors. For a given latent representation we can either learn the latent factors directly, or we learn an $M$-matrix.
The latent factors, the $M$-matrices, and the parameters in the functions can be trained with penalized log-likelihood cost functions described in the Appendix.
\section{The Event Model}
\label{sec:events}
Without loss of generality, we assume that changes in the KG always arrive in form of events, in the sense that the events are the gateway to the KG. For a given time step, events are described by a typically very sparse event triple graph, which contains facts that change some of the triples in the KG, e.g., from \textit{True} to \textit{False} and vice versa. KG triples which do not appear in the event graph are assumed unchanged.
Events might be, e.g.,
\textit{do a cholesterol measurement}, the event \textit{cholesterol measurement}, which specifies the value or the order \textit{take cholesterol lowering medicine}, which determines that a particular medication is prescribed followed by dosage information.
At each time step events form triples which form a sparse triple graph and which specifies which facts become available.
The event tensor is a four-way tensor $\underline Z$ with $(e_s, e_p, e_o, e_t; \textit{Value})$ and tensor elements $z_{s, p, o, t}$. We have introduced the generalized entity $e_t$ to represent time. Note that the characteristics of the KG tensor and the event tensor are quite different. $\underline X$ is sparse and entries rarely change with time. $\underline Z$ is even sparser and nonzero entries typically ``appear'' more random. We model
\[
\theta^{event}_{s, p, o} = f^{event} (\mathbf{a}_{e_s}, \mathbf{a}_{e_p}, \mathbf{a}_{e_o}, \mathbf{a}_{e_t}) .
\]
Here, $\mathbf{a}_{e_t}$ is the latent representation of the generalized entity $e_t$.
Alternatively, we consider a personalized representation of the form
\[
\theta^{\textit{pers-event}, s=i}_{p, o} = f^{\textit{pers-event}} (\mathbf{a}_{e_p}, \mathbf{a}_{e_o}, \mathbf{a}_{e_s=i, t}) .
\]
Here, we have introduced the generalized entity $e_{s, t}$ for a subject $s=i$ at time $t$ which stands for all events of entity $s=i$ at time $t$.
Since representations involving time need to be calculated online, we use M-maps of the form
\[
\mathbf{a}_{e_{s, t}} = M^{\textit{subject, time}} z_{s, :, :, t}
\]
The cost functions are again described in the Appendix.
\section{The Prediction Model}
\label{sec:markov}
\subsection{Predicting Events}
Note that both the KG-tensor and the event tensor can only model information that was observed until
time $t$ but it would not be easy to derive predictions for future events, which would be of interest, e.g., for decision support. The key idea of the paper is that events are predicted using both latent representations of the KG and latent representations describing recently observed events.
In the prediction model we estimate future entries in the event tensor ${\underline Z}$. The general form is
\[
\theta^{\emph{predict}}_{s, p, o, t} =
f^{\emph{predict}}(\emph{args}) \;\;\; \textrm{or }\;\;\; \theta^{\emph{predict}}_{s, p, o, t} =
f^{\emph{predict}}_{p, o}(\emph{args})
\]
where the first version uses a single function and the latter uses a different function for each $(p,o)$-pair.\footnote{The different functions can be realized by the multiple outputs of a neural network.} Here, $\emph{args}$ is from the sets of latent representations from the KG tensor and the event tensor.
An example of a prediction model is
\[
\theta^{\textit{predict}}_{s, p, o, t} =
f^{\textit{predict}}_{p, o}( \mathbf{a}_{e_{s}}, \mathbf{a}_{e_{s, t}}, \mathbf{a}_{e_{s, t-1}}, \ldots, \mathbf{a}_{e_{s, t-T}}) .
\]
where the prediction is based on the latent representations of subject, object and predicate from the KG-tensor and of the time-specific representations from the event tensor.
Let's consider an example. Let $(e_{s}, e_p, e_o, e_t; \textit{Value})$ stand for
(\textit{Patient, prescription, CholesterolMedication, Time; True}).
Here, $\mathbf{a}_{e_{s}}$ is the profile of the patient, calculated from the KG model. Being constant, $\mathbf{a}_{e_{s}}$ assumes the role of parameters in the prediction model.
$\mathbf{a}_{e_{s, t}}$ describes all that \emph{so far} has happened to the patient at the same instance in time $t$ (e.g., on the same day).
$\mathbf{a}_{e_{s, t-1}}$ describes all that happened to the patient at the last instance in time and so on.
We model the functions by a multiway neural network with weight parameters $W$ exploiting the great modeling flexibility of neural networks. The cost function for the prediction model is
\begin{equation}\label{eq:cost}
\textrm{cost}^{\textit{predict}} =
- \sum_{z_{s, p, o, t} \in \underline{{Z}}} \log P(z_{s, p, o, t} | \theta^{\textit{predict}}_{s, p, o, t}
(A, M, W))
\end{equation}
\[+ \lambda_{A} \| A \|_F^2 + \lambda_{W} \| W \|_F^2 + \lambda_{M} \| M \|_F^2 .
\]
$A$ stands for the parameters in latent representation and $M$ stands for the parameters in the $M$-matrices. For a generalized entity for which we use an $M$-matrix, we penalize the entries in the $M$-matrix; for a generalized entity for which we directly estimate the latent representation we penalize the entries in the corresponding latent terms in $A$.
Here, $\| \cdot \|_F$ is the Frobenius norm and $\lambda_{A}\ge 0$, $\lambda_{M}\ge 0$ and $\lambda_{W}\ge 0$ are regularization parameters.
\subsection{Predicting Changes in the KG}
In our model, each change in the status of the KG is communicated via events. Thus each change in the KG first appears in the event tensor and predictions of events also implies predictions in the KG. The events that change the KG status are transferred into the KG and the latent representations of the KG, i.e., $\mathbf{a}_{e_{s}}, \mathbf{a}_{e_{p}}, \mathbf{a}_{e_{o}}$, are re-estimated regularly (Figure~\ref{fig:TMs}).
\begin{figure}[ht]
\centering
\includegraphics[width=0.6\columnwidth]{transfer.png}
\caption{%
The figure shows an example where the event tensor is predicted from the representations of the events in the last two time steps and from the KG representation. The dotted line indicate the transfer of observed events into the KG.
}
\label{fig:TMs}
\end{figure}
\subsection{More Cost Functions}
Associated with each tensor model and prediction model, there is a cost function (see Appendix). In our experiments we obtained best results, when we used the cost function of the task we are trying to solve. In the most relevant prediction task we thus use the cost function in Equation~\ref{eq:cost}. On the other hand, we obtained faster convergence for the prediction model if we initialize latent representations based on the KG model.
\section{Experiments}
\label{sec:exper}
\begin{figure}[ht]
\centering
\includegraphics[width=0.8\columnwidth]{Folie1.png}
\caption{%
The prediction model for the clinical data.
}
\label{fig:archs1}
\end{figure}
\begin{figure}[ht]
\centering
\includegraphics[width=0.8\columnwidth]{Folie2.png}
\caption{%
The prediction model for the recommendation data.
}
\label{fig:archs2}
\end{figure}
\begin{figure}[ht]
\centering
\includegraphics[width=0.8\columnwidth]{Folie3.png}
\caption{%
The prediction model for the sensor data. $\textbf{a}_{e_s}$ is directly estimated without using an $M$-mapping.
}
\label{fig:archs3}
\end{figure}
\subsection{Modeling Clinical Data}
\label{sec:patient}
\begin{table*}[!htbp]
\caption[Table caption text]{Scores for next visit predictions. AUPRC stands for Area Under Precision-Recall Curve. AUROC stands for Area Under ROC Curve. \textit{ET} stands for our proposed model that uses only past event information but no information from the KG. }
\centering
\begin{tabular}{lcccc}
\hline\rule{0pt}{12pt}
& {\hskip 0.05cm} AUPRC {\hskip 0.05cm} & AUROC {\hskip 0.05cm} & Time (hours) \\
\hline \\ [-1.8ex]
\emph{ET} & {\hskip 0.05cm} 0.574 $\pm$ 0.0014 {\hskip 0.05cm} & 0.977 $\pm$ 0.0001 {\hskip 0.05cm} & 6.11 \\
Logistic Regression & {\hskip 0.05cm} 0.554 $\pm$ 0.0020 {\hskip 0.05cm} & 0.970 $\pm$ 0.0005 {\hskip 0.05cm} & 4.31 \\
KNN & {\hskip 0.05cm} 0.482 $\pm$ 0.0012 {\hskip 0.05cm} & 0.951 $\pm$ 0.0002 {\hskip 0.05cm} & 17.74 \\
Naive Bayes & {\hskip 0.05cm} 0.432 $\pm$ 0.0019 {\hskip 0.05cm} & 0.843 $\pm$ 0.0015 {\hskip 0.05cm} & 39.1 \\
Constant predictions & {\hskip 0.05cm} 0.350 $\pm$ 0.0011 {\hskip 0.05cm} & 0.964 $\pm$ 0.0001 {\hskip 0.05cm} & 0.001 \\
Random & {\hskip 0.05cm} 0.011 $\pm$ 0.0001 {\hskip 0.05cm} & 0.5 {\hskip 0.05cm} & - \\
\hline\rule{0pt}{12pt}
\end{tabular}
\label{table:table_exp1}
\end{table*}
The study is based on a large data set collected from patients that
suffered from kidney failure. The data was collected in
the Charit\'{e} hospital in Berlin and it is the largest data collection of its kind in Europe. Once the kidney has failed, patients face
a lifelong treatment and periodic visits to the clinic for the rest of their
lives.
After the
transplant has been performed, the patient receives immunosuppressive therapy
to avoid the rejection of the transplanted kidney. The patient must be controlled
periodically to check the status of the kidney, adjust the treatment and take
care of associated diseases, such as those that arise due to the
immunosuppressive therapy.
The dataset contains every event that happened to each
patient concerning the kidney failure and all its associated events:
prescribed medications, hospitalizations, diagnoses, laboratory tests, etc. ~\cite{Lindemann2007,Schroeter2010}. The database started being recorded
more than 30 years ago and it is composed of dozens of tables with more than 4000 patients that
underwent a renal transplant or are waiting for it. For example, the
database contains more than 1200 medications that have been prescribed more
than 250000 times, and the results of more than 450000 laboratory analyses.
This is particularly important for the estimation of drug-drug interactions (DDI) and
adverse drug reactions (ADR) in patients after renal transplant.
We work with a subset of the variables available in the dataset. Specifically, we model medication prescriptions, ordered lab tests and lab test results.
We transformed the tables into an event oriented representation where the subject is the patient and where time is a patient visit. We encoded the lab results in a binary format representing normal, high, and low values of a lab measurement, thus \textit{Value} is always binary.
The prediction model is
\[
\theta^{predict}_{s, p, o, t} =
f^{predict}_{p, o}(
{\mathbf{a}}_{e_{s}},
{\mathbf{a}}_{e_t},
{\mathbf{a}}_{e_{s,t}},
{\mathbf{a}}_{e_{s, t-1}}, \ldots,
{\mathbf{a}}_{e_{s, t-T}} ) .
\]
Note that we have a separate function for each $(p,o)$-pair.
$ {\mathbf{a}}_{e_{s}}$ are patient properties as described in the KG.
$\mathbf{a}_{e_{s, t}}$ represents all events known that happened at visit $t$ for the patient (e.g., the same visit for which we want to make a prediction).
$\mathbf{a}_{e_{s, t-1}}$ represents all events for the patient at the last visit, etc.
${\mathbf{a}}_{e_t}$ stands for the latent representation of all events at visit $t$ for all patients and can model if events are explicitly dependent on the time since the transplant.
Regarding the input window, we empirically found that $T=6$ is optimal.
The architecture is shown in Figure~\ref{fig:archs1}.
The first experiment consisted of predicting the events that will happen to patients in their next visit to the clinic given the events that were observed in the patients' previous visits to the clinic (i.e. by using the events that occurred to the patient from $\mathbf{a}_{e_{s, t}}$ until $\mathbf{a}_{e_{s, t-6}}$). The experiment was performed 10 times with different random splits of the patients. Thus we truly predict performance on patients which were not considered in training!
Table~\ref{table:table_exp1} shows how our proposed model outperforms the baseline models.
The ``constant predictor'' always predicts for each event the occurrence
rate of such event (thus the most common event is given
the highest probability of happening, followed by the second
most common event, and so on).
Note that we are particularly interested in the Area Under Precision-Recall Curve score due to the high sparsity of the data and our interest in predicting events that will actually happen, as opposed to the task of predicting which events will not be observed. In the last column of Table I we also report the time that it took to train for each model with the best set of hyperparameters in the first random split.
Next we repeat the experiment including the KG-representation of the patient, which contains static variables of the patient such as blood type and gender, i.e., $ {\mathbf{a}}_{e_{s}}$, and also used ${\mathbf{a}}_{e_t}$.
Table \ref{table:table_exp4} shows the improvement brought by the inclusion of the KG representation. The last row in Table \ref{table:table_exp4} shows the result of making the predictions just with the KG representation of the patient (i.e. without the past event information), demonstrating clearly that information on past events is necessary to achieve best performance.
\begin{table}[ht]
\caption[Table caption text]{Scores for full visit predictions with and without the information in the KG. AUPRC stands for Area Under Precision-Recall Curve. AUROC stands for Area Under ROC Curve. \textit{ET+KG} stands for our proposed model that uses past event information and information from the KG. \emph{ET} only uses past event data and \emph{KG} only uses KG data.}
\centering
\begin{tabular}{lcccc}
\hline\rule{0pt}{12pt}
& {\hskip 0.3cm} AUPRC {\hskip 0.3cm} & AUROC {\hskip 0.3cm} \\
\hline \\ [-1.8ex]
\textit{ET+KG} & {\hskip 0.3cm} 0.586 $\pm$ 0.0010 {\hskip 0.3cm} & 0.979 $\pm$ 0.0001 {\hskip 0.3cm} \\
\textit{ET} & {\hskip 0.3cm} 0.574 $\pm$ 0.0014 {\hskip 0.3cm} & 0.977 $\pm$ 0.0001 {\hskip 0.3cm} \\
\textit{KG} & {\hskip 0.3cm} 0.487 $\pm$ 0.0016 {\hskip 0.3cm} & 0.974 $\pm$ 0.0002 {\hskip 0.3cm} \\
\hline\rule{0pt}{12pt}
\end{tabular}
\label{table:table_exp4}
\end{table}
\subsection{Recommendation Engines}
\label{sec:recommendation}
We used data from the MovieLens project with 943 users and 1682 movies.\footnote{http://grouplens.org/datasets/movielens/}
In the KG tensor we considered the triples
\textit{(User, rates, Movie; Rating)}. For the event tensor, we considered
the quadruples
\textit{(User, watches, Movie, Time; Watched)} and \textit{(User, rates, Movie, Time; Rating)}.
Here, $\textit{Rating} \in \{1, \ldots, 5 \}$ is the score the user assigned to the movie and $\textit{Watched} \in \{0, 1\}$ indicates if the movie was watched and rated at time $t$.
\textit{Time} is the calendar week of the rating event.
We define our training data to be 78176 events in the first 24 calender weeks and the test data to be 2664 events in the last 7 weeks. Note that in both datasets there are only 738 users since the remaining 205 users watched and rated their movies only in the test set.
It turned out that the movie ratings did not show dependencies on past events, so they could be predicted from the KG model alone with
\[
\theta^{predict}_{s, \textit{rates}, o, t} =
f^{predict}_{\textit{rates}, o}( {\textbf{a}}_{e_{s}}) .
\]
We obtained best results by modeling the function with a neural network with 1682 outputs (one for each movie).
The user specific data was centered w.r.t. to their average and a numerical 0 would stand for a neutral \textit{rating}. We obtain an RMSE score of 0.90 $\pm$ 0.002 which is competitive with the best reported score of 0.89 on this data set~\cite{rendle_factorization_2010}. But note that we predicted \textit{future ratings} which is more difficult than predicting randomly chosen test ratings, as done in the other studies. Since we predict ordinal ratings, we used a Gaussian likelihood model.
Of more interest in this paper is to predict if a user will decide to watch a movie at the next time step. We used a prediction model with
\[
\theta^{predict}_{s, \textit{watches}, o , t } =
\]
\[
f^{predict}_{\textit{watches}, o}(
{\mathbf{a}}_{e_{s}},
{\mathbf{a}}_{e_t},
{\mathbf{a}}_{e_{\textit{s, t}}}, {\mathbf{a}}_{e_{s, t-1}}, \ldots, {\mathbf{a}}_{e_{s, t-T}}
) .
\]
Here, $\mathbf{a}_{e_{s}}$ stands for the profile of the user as represented in the KG.
$\mathbf{a}_{e_t}$ stands for the latent representation of all events at time $t$ and can model seasonal preferences for movies.
$\mathbf{a}_{e_{s, t}}$ stands for the latent representation of all movies that the user watched at time $t$. The architecture is shown in Figure~\ref{fig:archs2}.
When training with only the prediction cost function we observe an AUROC an score of 0.728 $\pm$ 0.001.
We then explored sharing of statistical strength by optimizing jointly the $M$-matrices using all three cost functions $\textrm{cost}^\textit{KG}, \textrm{cost}^\textit{event}$ and $\textrm{cost}^\textit{predict}$ and obtained a significant improvement with an AUROC score of 0.776 $\pm$ 0.002.
For comparison, we considered a pure KG-model
and achieved an AUROC score of 0.756 $\pm$ 0.007. Thus the information on past events leads to a small (but significant) improvement.
\subsection{Sensor Networks}
\label{sec:sensor}
\begin{table}[ht]
\caption[Table caption text]{Mean Squared Error scores for predicting multivariate sensor data 20 time steps ahead.}
\centering
\begin{tabular}{lccc}
\hline\rule{0pt}{12pt}
Model & {\hskip 0.3cm} MSE {\hskip 0.3cm} \\
\hline \\ [-1.8ex]
Pred1 & {\hskip 0.3cm} 0.135 $\pm$ 0.0002 {\hskip 0.3cm} \\
Pred2 & {\hskip 0.3cm} 0.139 $\pm$ 0.0002 {\hskip 0.3cm} \\
Pred3 & {\hskip 0.3cm} 0.137 $\pm$ 0.0002 {\hskip 0.3cm} \\
Feedforward Neural Network & {\hskip 0.3cm} 0.140 $\pm$ 0.0002 {\hskip 0.3cm} \\
Linear Regression & {\hskip 0.3cm} 0.141 $\pm$ 0.0001 {\hskip 0.3cm} \\
Last Observed Value & {\hskip 0.3cm} 0.170 {\hskip 0.3cm} \\
\hline\rule{0pt}{12pt}
\end{tabular}
\label{table:table_sensor_results}
\end{table}
In our third experiment we wanted to explore if our approach is also applicable to data from sensor networks.
The main difference is now that the event tensor becomes a sensor tensor with subsymbolic measurements at all sensors at all times.
Important research issues for wind energy systems concern the accurate wind profile prediction, as it plays an important role in planning and designing of wind farms. Due to the complex intersections among large-scale geometrical parameters such as surface conditions, pressure, temperature, wind speed and wind direction, wind forecasting has been considered a very challenging task. In our analysis we used data from the Automated Surface Observing System (ASOS) units that are operated and controlled cooperatively in the United States by the NWS, FAA and DOD\footnote{http://www.nws.noaa.gov/asos/}. We downloaded the data from the Iowa Environmental Mesonet (IEM)\footnote{https://mesonet.agron.iastate.edu/request/asos/1min.phtml}. The data consists of 18 weather stations (the \textit{Entities}) distributed in the central US, which provide measurements every minute. The measurements we considered are wind strength, wind direction, temperature, air pressure, dew point and visibility coefficient (the \textit{Attributes}).
In the analysis we used data from 5 months from April 2008 to August 2008.
The original database consists of 18 tables one for each station.
The event tensor is now a sensor tensor with
quadruples \textit{(Station, measurement, SensorType, Time; Value)}, where \textit{Value} is the sensor measurement for sensor \textit{SensorType} at station \textit{Station} at time \textit{Time}. The KG-tensor is a long-term memory and maintains a track record of sensor measurement history.
As the dataset contains missing values we only considered the periods in which the data is complete. This results in a total of 130442 time steps for our dataset. In order to capture important patterns in the data and to reduce noise, we applied moving average smoothing using a Hanning window of 21 time steps.
We split the data into train-, validation- and test set. The first four months of the dataset where used for training, and the last month as test set. 5 \% of the training data where used for validation.
We considered three different prediction models with Gaussian likelihood functions, each with different latent representations at the input. The first model (Pred1) is
\[
\theta^{predict}_{s, p, o, t} =
f^{predict}_{p, o}
( {\mathbf{a}}_{e_{s}},
{\mathbf{a}}_{e_{s, t-1}},
{\mathbf{a}}_{e_{s, t-2}}, \ldots,
{\mathbf{a}}_{e_{s, t-T}} )
\]
where
${\mathbf{a}}_{e_{s, t}}$
stands for all measurements of station $e_s$ at time $t$ and ${\mathbf{a}}_{e_{s, t-1}},
{\mathbf{a}}_{e_{s, t-2}}, \ldots,
{\mathbf{a}}_{e_{s, t-T}}$ can be considered a short term memory.
${\mathbf{a}}_{e_{s, t-1}}$
represents all measurements for station $s$ between $t-T-1$ and $t-1$, i.e., and can represent complex sensor patterns over a longer period in time. Since measurements take on real values, a Gaussian likelihood model was used.
The second model (Pred2) is
\[
\theta^{predict}_{s, p, o, t} =
f^{predict}_{p, o}
(
{\mathbf{a}}_{e_{s, t-1}},
\ldots,
{\mathbf{a}}_{e_{s, t-T}},
{\mathbf{a}}_{e_{t-1}},
\ldots,
{\mathbf{a}}_{e_{t-T}}
) .
\]
Here, ${\mathbf{a}}_{e_t} $ stands the latent representation of all measurements in the complete network at time $t$.
And finally the third model (Pred3) combines the first two models and uses the combined sets of inputs.
The architecture of Pred3 is shown in Figure~\ref{fig:archs3}.
In our experiments we considered the task of predicting 20 time steps into the future. All three models performed best with $T = 10$ and the rank of the latent representations being 20.
Table \ref{table:table_sensor_results} summarizes the results of the three prediction models together with three baseline models. The most basic baseline is to use the last observed value of each time series as a prediction. More enhanced baseline models are linear regression and feedforward neural networks using the previous history
$z_{s, :, :, t-1}, z_{s, :, :, t-2}, \ldots, z_{s, :, :, t-T}$
of all time series of a station $s$ as input.
The experiments show that all three prediction models outperform the baselines. Pred1, which adds the personalization term for each sensor shows the best results. Pred2 performs only slightly better than the feedforward neural network. However, we assume that in sensor networks with a stronger cross correlation between the sensors, this model might prove its strength. Finally, the result of Pred3 shows that the combination of the multiple latent representations is too complex and does not outperform Pred1.
\section{Conclusions and Extensions}
\label{sec:concl}
We have introduced an approach for modeling the temporal evolution of knowledge graphs and for the evolution of associated events and signals. We have demonstrated experimentally that models using latent representations perform well in these high-dimensional and highly sparse dynamic domains in a clinical application, a recommendation engine and a sensor network application. The clinical application is explored further in a funded project~\cite{Tresp2013,Crist2015}.
As part of future work we plan to test our approach in general streaming frameworks which often contain a context model, an event model and a sensor model, nicely fitting into our framework. In~\cite{tresp2015learning} we are exploring links between the presented approach and cognitive memory functions.
In general, we assumed a unique representation for an entity, for example we assume that ${\mathbf{a}}_{e_{s}}$ is the same in the prediction model and the semantic model.
Sometimes it makes sense to relax that assumption and only assume some form of a coupling. \cite{larochelle2008zero,bengio2013representation,bengio2012deep} contain extensive discussions on the transfer of latent representations.
\bibliographystyle{plain}
| {'timestamp': '2015-12-23T02:01:21', 'yymm': '1512', 'arxiv_id': '1512.06900', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.06900'} | arxiv |
\section{Introduction}
\section{Introduction}
The advantages of using process algebras for the performance modeling and
evaluation of concurrent systems due to their feature of compositionality
have been widely recognized (see~\cite{Hil,BB,Pri1,Her,tcs,BD} and the
references therein).
Particularly simple and successful has been the extension of
standard process algebras with time delays whose duration follows
an exponential probability distribution, called Markovian
process algebras (see e.g.~\cite{Hil,BB,Pri1,Her,BHK}).
The ``timed'' behavior of systems specified with
a Markovian process algebra can be represented by a continuous
time Markov chain (CTMC), that is a simple continuous
time stochastic process where, in each time point, the future behavior
of the process is completely independent of its past behavior.
Due to their simplicity CTMCs can be analyzed
with standard mathematical techniques and software tools (see e.g.~\cite{Ste})
for deriving performance measures of systems.
The semantics of all Markovian process algebras previously introduced in the literature is defined in {\it labeled operational semantics} style, that is where transitions are labeled with actions (representing potential of communication) and transitions representing actual communications are produced by matching action transitions of parallel processes.
In this paper we present a technique that allows us, for the first time, to develop semantics for Markovian process algebra
in {\it reduction} style (see for instance the reduction semantics of $\pi$-calculus \cite{SW,MilPi}), that is where transitions are not labeled with actions and are directly produced by
readjusting the structure of terms via a {\it structural congruence relation}: such a relation is endowed
with commutative and associative laws that allow communicating processes to get syntactically adjacent to each other so
to directly produce reduction transitions. Reduction semantics is also commonly used, in that convenient for defining semantics of complex languages, see for example \cite{JO}.
Markovian process algebras extend usual process algebras with probabilistic exponentially distributed time durations denoted by rates $\lambda$ (positive real numbers), where $\lambda$ is the parameter of the exponential distribution. Defining a semantics for such algebras, so to derive CTMCs from system specifications, requires dealing with transitions labeled by rates $\lambda$. With respect to standard process algebra semantics this poses a problem: we have to take into account the multiplicity of several identical transitions, that is transitions with the same rate and source and target terms.
The simplest way to deal with this problem (see~\cite{Hil}) is counting the number of different possible inferences of the same transition so to determine its multiplicity.
However this can be done only for semantic definitions that do not infer transitions by means of a structural congruence relation $\equiv$ on terms, that is via the classical operational rule of closure w.r.t. $\equiv$ that makes it possible to infer a transition $P \arrow{\alpha} Q'$ from $Q \arrow{\alpha} Q'$ whenever $P \equiv Q$.
This because, supposing that common laws like $P \equiv P | \nil$ are considered, the presence of such a rule causes the same transition to be inferred in an infinite number of ways even in the case of just one occurrence of a Markovian delay (e.g. consider $P$ just being a single Markovian delay and the congruence law above). On the other hand
using a structural congruence relation is a useful mechanism that is commonly used, for instance, when defining reduction semantics of non-basic process algebras such as the $\pi-$calculus (to compute reductions due to communication while inferring transitions, as we already mentioned).
Another similar way used in the literature to deal with Markovian transition multiplicity
is to explicitly introduce a mechanism to differently identify multiple execution of identical Markovian delays by introducing some kind of identifier that typically expresses syntactical position of the delay in the term (for example it is called a ``location'' in the case of the position with respect to the parallel operator) and whose syntax is dependent on the operators used in the language (see, for instance, \cite{GHR,Pri1}).
Again, since Markovian transitions are, roughly, identified by indicating the path (left/right at every node) in the syntax tree of the term, this solution is not compatible with inferring transition by means of a structural congruence relation with the
commutative and associative laws (which are fundamental, e.g., to define a reduction semantics for the $\pi-$calculus). This because term structure is readjusted at need during transition inference.
Finally, techniques exploiting the representation of Markovian transitions collectively as a distribution over a target state space (a traditional approach in the context of probabilistic transition systems, see Giry functor \cite{Giry} and its generalizations, for instance \cite{SL, DEP, VR}) have been used in \cite{DLLM} and in \cite{KS} for any Markovian process algebra whose operational rules are in a Markovian extension of the GSOS rule format.
These techniques are crucially based on collectively inferring Markovian transitions performable at a certain syntactical level
(e.g. in $P\, |\, Q$) from transitions performable at lower levels (e.g. from all Markovian transitions performable by $P$
and by $Q$). Therefore, they are, again, not compatible with using structural congruence $\equiv$ (with
commutative and associative laws) during the inference of transitions, as caused by the operational rule of closure w.r.t. $\equiv$ mentioned above, which is not in the GSOS format of \cite{KS} (the approach in \cite{KS} cannot be used in the presence of such a rule, which is fundamental in reduction semantics). Since there is not a fixed stratification of transition inference, different transitions can be inferred by readjusting the structure of terms via the commutative and associative laws of structural congruence in different ways. For instance, given a term $P | (Q | R)$ it can be that the term needs to be readjusted into $(P | Q) | R$ to infer a reduction due to a communication between $P$ and $Q$ and to $(P | R) | Q$ to infer a reduction due to a communication between $P$ and $R$. So we cannot fix a stratification of transition inference, that is first {\it collectively} inferring all transitions of $(Q | R)$ and then use them to infer all transitions of
$P | (Q | R)$.
\subsection{The Main Idea}
In this paper we show how to define semantics for Markovian process algebras in the presence of transitions inferred by means of structural congruence, which also easily allows us to deal with a recursion operator: the possibility of expressive cycling behavior is fundamental for steady state based performance analysis.
This will make it possible to define, for the first time, the semantics of a Markovian process algebra
(we will use a simple Markovian version of $\pi-$calculus) via reduction semantics instead of labeled operational semantics, as
done in all above mentioned approaches.
Moreover our technique is such that the presence of Markovian delays in the process algebra does not cause a significant modification of the process algebra semantics, in that most of the burden is concentrated in a couple of additional rules which are independent of the particular operators used by the algebra. More precisely, we do not have to introduce an explicit (operator dependent) mechanism to distinguish multiple occurrences of actions as in \cite{GHR,Pri1}, or to intervene
in the semantics of every operator
as in \cite{DLLM} or to separately define, by induction on term syntax, how rate distribution is calculated using (total) rate information attached to rules as in \cite{KS} (which also does not cope with recursion).
But more importantly, this opens the new possibility to introduce Markovian delays in complex languages like that of \cite{JO} without the need to completely change the semantics from reduction style to labeled style.
The idea is to introduce stochastic names (that can be seen as names for stochastic variables) and stochastic binders (binders for such names). Stochastic names are used in process algebra prefixes and numerical rates $\lambda$ are assigned by the corresponding stochastic binder. In essence (a set of) stochastic binders act as a (probabilistic/stochastic) scheduler: they use names attached to prefixes to collectively quantify them. In this way, {\it assuming that all prefixes are associated with a different stochastic name}, rate values replace stochastic names upon binding and multiplicity is correctly taken into account because prefixes with the same rates are anyhow distinguished by having different stochastic names.
But how to guarantee that prefixes are given different stochastic names? The idea is to consider a specification language where prefixes are, as usual, associated with numerical rates $\lambda$ and then to turn them (by a law of structural congruence) into stochastic names that are immediately bound with a stochastic binder assigning the rate $\lambda$. Then, with the usual rules of binder extrusion, we impose that, before binders can be evaluated, they must be all lifted to the outermost syntactical level by structural congruence. As a consequence we have the guarantee (due to the requirement of $\alpha$-conversion related to binder extrusion) that every prefix is assigned a distinguished stochastic name. Note that recursion is dealt with in the correct way as well, because, as we will see, recursions need to be unfolded in order to perform the lift of the binders.
\subsection{Plan of the Paper}
In this paper we consider a simple extension of the $\pi-$calculus with Markovian delays, where for the sake of simplicity, Markovian delays are expressed separately from standard actions as in the Interactive Markov Chains approach of \cite{Her}.
We first define the semantics of this calculus in labeled operational semantics style (we use the early semantics of the $\pi-$calculus) according to the classical approach of \cite{GHR,Pri1}, that is using an explicit (operator dependent) mechanism to distinguish multiple occurrences of Markovian delays.
We then apply our technique based on stochastic names and binders to provide a reduction semantics for the very same
process algebra.
We finally assess the correctness of our approach by showing that a theorem similar to the Harmony Lemma in \cite{SW}
(or the one in \cite{MilPi}) holds true, that is: stochastic and standard reductions of reduction semantics are in correspondence with $\tau$ and Markovian delay transitions of the labeled operational semantics and, thus,
the underlaying Interactive Markov Chains.
In particular, in Sect. 2 we present the Markovian $\pi-$calculus and its labeled operational semantics defined according to the ``classical'' technique. In Sect. 3 we present the reduction semantics for the Markovian $\pi-$calculus. In Sect. 4 we conclude the paper by further discussing related work
and future extensions of the technique. Finally,
Appendix \ref{App} includes a long proof for a proposition (whose proof structure is described in the paper body).
The work in this paper is based on the technical report \cite{TechRep}.
\section{Classical Approach}\label{Classical}
We consider $\pi-$calculus with constant definitions (as in \cite{MPW}) extended with Markovian delay prefixes (following the approach in \cite{Her}). Markovian delays are thus simply represented by $(\lambda)$ prefixes, where $\lambda$ is the
rate of a Markovian distribution.
As usual in the context of Markovian process algebra (see e.g. \cite{Pri1}) we consider recursion by constant definitions (as done for the standard $\pi-$calculus e.g. in \cite{MPW}) and not by a bang operator. Moreover, as usual, we assume recursion to be (weakly) guarded. In this way we avoid terms like $A \eqdef A | (\lambda).P$ for which we would not get a finite cumulative rate for the outgoing Markovian transitions of A.
Let $x,y,\dots$ range over the set $\calx$ of channel names and
$\lambda$ range over the set $\real^+$ of rate values (representing rates of Markovian distributions).
\begin{definition}\label{MDCalcDef}
The syntax of terms $P, Q, \dots$ is:
$$\begin{array}{lll}
P & ::= & M \mid P | P' \mid (\nu x) P \mid A(x_1, \dots, x_n) \\
M & ::= & \nil \mid \alpha.P \mid M + M' \\
\alpha & ::= & \overline{x}\lap y \rap \mid x(y) \mid \tau \mid ({\lambda})
\end{array}
$$
We take $\calp$ to be the set of terms $P,Q, \dots$ generated by this syntax.
\end{definition}
We abbreviate $x_1, \dots, x_n$ with $\tilde{x}$ and we assume a given set of constant definitions $A(\tilde{x}) \eqdef P$.
Technically we assume that for every constant $A (\tilde{x}) \eqdef P$ the following holds true. We can, starting from $P$ and by performing a finite number of successive substitutions of constants $B(\tilde{y})$ for their defining term $Q\{\tilde{y}/\tilde{x}\}$ (assuming $B(\tilde{x}) \eqdef Q$) reach a term $P'$ where every constant occurs in $P'$ in the scope of a prefix operator ($A$ is weakly guarded defined, see \cite{MPW}).
\subsection{Labeled Operational Semantics}
Concerning the labeled operational semantics we consider the early semantics of the $\pi-$calculus (see e.g. \cite{SW}) and,
concerning Markovian delays, the classical approach of \cite{Pri1}, i.e. using an explicit (operator dependent) mechanism to distinguish multiple occurrences.
The operational semantics is thus defined by a transition system with two kind of transitions:
\begin{itemize}
\item The classical $\pi-$calculus early semantics labeled transitions, defined in Table~\ref{PiRules} (we assume, as usual, symmetric rules to be also included, the meaning of labels and the definition of functions $n$ (names), $bn$ (bound names) and $fn$ (free names) to be the standard one, see, e.g., \cite{SW} and $\mu,\eta$ to range over sets including all standard labels), and
\item Markovian transitions, defined in Table~\ref{ProofRules}, that
are labeled with pairs $\lambda,id$ where: $\lambda$ is the rate of the Markovian delay being executed and $id$ is a unique identifier.
An identifier $id$ is a string over the alphabet $\{ +_0,+_1,|_0,|_1 \}$ and represents the syntactical position of the delay in the syntax tree of the term (the path in the tree). Notice that $\eta$ (differently from $\mu$) also ranges over labels $\lambda,id$ of Markovian transitions, whose definition, thus, includes also the involved rules of Table~\ref{PiRules}.
\end{itemize}
\begin{table}[t]
$
\begin{array}{ccc}
\multicolumn{3}{c}{
\tau.P \arrow{\tau} P \hspace{1cm} \overline{x}\lap y \rap .P \arrow{\overline{x} y} P \hspace{1cm}
x(y).P \arrow{x w} P\{w/y\} } \\[.2cm]
\hspace{1cm} & \infr{ P \arrow{\mu} P'}{P + Q \arrow{\mu} P' } &
\infr{ P \arrow{\mu} P'}{P | Q \arrow{\mu} P'|Q } \hspace{.3cm}
bn(\mu) \cap fn(Q) = \emptyset \\
& \infr{ P \arrow{\overline{x}y} P' \hspace{.5cm} Q \arrow{x y} Q'}
{P | Q \arrow{\tau} P'|Q' }
&
\infr{ P \arrow{\overline{x}(y)} P' \hspace{.5cm} Q \arrow{x y} Q'}
{P | Q \arrow{\tau} (\nu x) P'|Q' } \hspace{.3cm} y \notin fn(Q) \\
\multicolumn{3}{c}{
\infr{ P \arrow{\eta} P'}{(\nu x) P \arrow{\eta} (\nu x) P' } \hspace{.2cm}
x \notin n(\eta)
\hspace{.5cm}
\infr{ P \arrow{\overline{x}y} P'}{(\nu y) P \arrow{\overline{x}(y)} P' } \hspace{.2cm}
y \neq x
\hspace{.5cm}
\infr{ P\{\tilde{y}/\tilde{x}\} \arrow{\eta} P'}{ A(\tilde{y}) \arrow{\eta} P' } \hspace{.2cm}
A(\tilde{x}) \eqdef P
}
\end{array}
$\\
\caption{Standard Rules}\label{PiRules}
\end{table}
\begin{table}[t]
$
\begin{array}{c}
(\lambda).P \arrow{\lambda,\varepsilon} P \\[.2cm]
\infr{ P \arrow{\lambda,id} P'}{P + Q \arrow{\lambda,+_0 \, id} P' } \hspace{.8cm}
\infr{ Q \arrow{\lambda,id} Q'}{P + Q \arrow{\lambda,+_1 \, id} Q' } \hspace{.8cm}
\infr{ P \arrow{\lambda,id} P'}{P | Q \arrow{\lambda,|_0 \, id} P'|Q } \hspace{.8cm}
\infr{ Q \arrow{\lambda,id} Q'}{P | Q \arrow{\lambda,|_1 \, id} P|Q' } \\
\end{array}
$\\
\caption{Identified Markovian Transitions}\label{ProofRules}
\end{table}
The labeled transition system arising from the semantics of a term $P$ has states with both outgoing Markovian
and standard transitions (Interactive Markov Chain) and has to be interpreted as in \cite{Her}.
In particular the Markovian transitions performable in states that also have outgoing $\tau$ transitions are considered to be pre-empted (maximal progress assumption where ``$\tau$'' are instantaneous) and a system is considered to be complete if it cannot undergo further communication with the environment,
i.e. it can perform only $\tau$ and Markovian transitions.
This is expressed by the notion of Markovian Bisimulation considered in \cite{Her}. We first define the total rate
$\gamma(P,P')$ of transiting from state $P$ to $P'$ with Markovian transitions as
$\gamma(P,P') = \sum_{P \arrow{\lambda,id} P'} \lambda$.
This is extended to sets of states in the usual way: $\gamma(P,Set)=\sum_{P' \in Set} \gamma(P,P')$.
We can now consider the Markovian bisimulation as in \cite{Her} (see \cite{Her} for weak bisimulation definition abstracting, when possible, from $\tau$ transitions).
\begin{definition}\label{strongbis}
An equivalence relation $\calb$ on $\calp$ is a strong bisimulation
iff $P \calb Q$ implies for all $\mu$ and all equivalence classes $C$ of $\calb$
\begin{itemize}
\item $P \arrow{\mu} P'$ implies $Q \arrow{\mu} Q'$ for some $Q'$ with $Q' \calb P'$
\item $P \not\!\!\arrow{\tau}$ implies $\gamma(P,C)=\gamma(Q,C)$
\end{itemize}
Two processes $P$ and $Q$ are strongly bisimilar, written $P \sim Q$,if they are
contained in some strong bisimulation.
\end{definition}
\section{Reduction Semantics for Markovian Delays}
\label{MDCalc}
In this section we use our technique based on symbolic representation of rates via stochastic names and stochastic binders
to give a semantics in reduction style for the Markovian $\pi-$calculus of Section \ref{Classical}.
\subsection{Stochastic Names and Stochastic Binders}
\label{MDExt}
We now extend the syntax of terms $P, Q, \dots$ by {\it adding} stochastic names and stochastic binders.
We use
$q,q',\dots \in \calq\caln$ to range over names used to express symbolically
stochastic information for delays.
$\theta,\theta',\dots$ ranges over $\calx \cup \calq \caln$.
\begin{definition}\label{ExtCalcDef}
We take $\calp_{ext}$ to be the set of terms $P,Q, \dots$ generated by the syntax in Definition \ref{MDCalcDef}, where
we add
``$(\nu q \rightarrow\! \lambda)P$''
to the possible instantiations of $P$, and
``$(q)$''
to the possible instantiations of $\alpha$ prefixes.
\end{definition}
$(\nu q \rightarrow\! \lambda)$ is a stochastic binder for name $q$ used by a delay, that associates value $\lambda$ to it.
In the following we use $(\nu x \rightarrow\! \varepsilon)$ to stand for
$(\nu x)$, i.e. the standard $\pi$-calculus binder, which does not associate any value to $x$,
This will allow us to write $(\nu \theta \rightarrow\! \widehat{\,\lambda})$ to stand for any binder (stochastic or classical) by assuming
$\widehat{\,\lambda},\widehat{\,\lambda'\!}$ to range over $\real^+ \cup \{ \epsilon \}$.
Notice that we will used $\calp_{ext}$ terms over the extended syntax to define the semantics of $\calp$ terms in
reduction style. As we will see, for every state of the semantics we will always have a congruent term which belongs to $\calp$.
The definition of structural congruence follows.
\subsection{Structural Congruence Relation}
\label{MDConRel}
\begin{table}[t]
\centerline{$
\begin{array}{llll}
(\nu \theta \rightarrow\! \!\widehat{\,\lambda})P \;| \; Q & \equiv & (\nu \theta \rightarrow\! \!\widehat{\,\lambda})(P | Q) & \mbox{if} \; \theta \notin fn(Q) \\
(\nu \theta \rightarrow\! \!\widehat{\,\lambda})(\nu \theta' \rightarrow\! \!\widehat{\,\lambda'\!})P & \equiv &
(\nu \theta' \rightarrow\! \!\widehat{\,\lambda'\!})(\nu \theta \rightarrow\! \!\widehat{\,\lambda})P & \mbox{if} \; \theta \neq \theta' \\
(\nu \theta \rightarrow\! \!\widehat{\,\lambda})\nil & \equiv &
\nil \\
(M_1 + M_2) + M_3 & \equiv & M_1 + (M_2 + M_3) & \\
M + N & \equiv & N + M \\
M + \nil & \equiv & M \\
(P_1 | P_2) | P_3 & \equiv & P_1 | (P_2 | P_3) & \\
P | Q & \equiv & Q | P \\
P | \nil & \equiv & P \\
A(\tilde{y}) & \equiv & P\{\tilde{y}/\tilde{x}\} & \mbox{if} \; A(\tilde{x}) \eqdef P \\
\end{array}\\[.2cm]
$}
\caption{Standard Structural Congruence Laws (with quantified binders)}\label{ConLaws}
\end{table}
We consider a structural congruence relation over processes in $\calp_{ext}$ defined as usual by a set of laws. We consider the standard laws in Table~\ref{ConLaws} (where we just add the possible presence of quantification in binders)
and, in addition, the following law:
$$
\begin{array}{llll}
(\lambda).P + M& \equiv & (\nu q \rightarrow\! \lambda)(\,(q).P + M) & \mbox{if} \;q \notin fn(M,P) \\
\end{array}
$$
As usual, alpha renaming inside processes, concerning any name $\theta$ and its binder $(\nu \theta \rightarrow\! \!\widehat{\,\lambda})$
is assumed.
Concerning use of parentheses when writing terms in the laws above, we assume binding to take precedence over parallel and prefix to take precedence over sum.
\subsection{Operational Semantics}
\label{MDOpSem}
We now define the semantics of the process algebra of Definition \ref{MDCalc} in reduction style.
As we will see besides standard reduction transitions (defined with standard rules), we have two other kinds
of transitions representing stochastic execution. Transitions labeled with a stochastic delay name which are treated
similarly as standard reduction transitions and stochastic transitions (that are generated when a stochastic binder is applied at the top level).
The latter lead from a term to a {\it rate distribution} over terms.
We consider rate distributions $\sigma$ describing how a state can be reached from another one by performing a Markovian transition.
\begin{definition}
A rate distribution
$\sigma$ over a set $S$ is a {\it non-empty} finite multiset over $\real^+ \times S$, i.e.
a multiset of pairs $(\lambda, e)$, with $\lambda \in \real^+$ and $e \in S$.
We use $RDist(S)$ to denote the set of rate distributions over $S$.
\end{definition}
Due to usage of the structural congruence relation, it will be convenient to use
rate distributions $\sigma$ over congruence classes of terms, i.e. $RDist(\calp_{ext}/\!\equiv)$.
The operational semantics is defined in terms of three transition relations:
\begin{itemize}
\item Standard reductions~\cite{MilPi} that represent action execution,
leading from a term to another term and denoted by $P \arrow{} P'$.
\item Transitions similar to standard reductions~\cite{MilPi} that represent delay executions and just differ from reductions in that they are additionally labeled with the name $q$ associated to the delay: their quantification is symbolical in that the name of the delay is included and not the actual rate. They are denoted by $P \arrow{q} P'$.
\item Stochastic transitions leading from a term to a rate distribution on congruence classes of terms.
They are denoted denoted by $P \arrow{} \sigma$, where $\sigma \in RDist(\calp_{ext}/\!\equiv)$.
\end{itemize}
\begin{table}[t]
$\begin{array}{c}
(q).P+M \arrow{q} P
\hspace{1cm}
\mbox{} \tau.P+M \arrow{} P
\hspace{1cm}
\mbox{} x(z).P+M \; | \; \overline{x}\lap y \rap.Q+N \arrow{} P\{y/z\} \; | \; Q \\[.4cm]
\infr{ P \arrow{\!\widehat{q}} P'}{P | Q \arrow{\!\widehat{q}} P'|Q } \hspace{.5cm}
\infr{ P \arrow{\!\widehat{q}} P'}{(\nu \theta \rightarrow\! \!\widehat{\,\lambda}) P \arrow{\!\widehat{q}} (\nu \theta \rightarrow\! \!\widehat{\,\lambda}) P'} \hspace{.2cm} \theta \neq q
\hspace{.5cm}
\infr{ P \equiv Q \hspace{.3cm} Q \arrow{\!\widehat{q}} Q' \hspace{.3cm} Q' \equiv P'}{P \arrow{\!\widehat{q}} P'}
\end{array}$\\
\caption{Standard Rules for Reductions and Symbolically Quantified Transitions}\label{RedRules}
\end{table}
The first two relations are collectively defined as the smallest subset of $\calp_{ext} \times (\calq\caln \cup {\varepsilon}) \times \calp_{ext}$ (where $\varepsilon$ labeled reductions represent the standard ones of~\cite{MilPi}) satisfying the operational rules in Table~\ref{RedRules}, where
$\!\widehat{q} \in \calq\caln \cup \{ \varepsilon \}$.
With respect to the usual ones of~\cite{MilPi}, the rules in Table~\ref{RedRules} only differ for including a rule for delay prefix and for considering names $q \in \calq\caln$ as possible reduction labels (and rates $\lambda$ possibly associated to binders).
Stochastic $P \arrow{} \sigma$ transitions are
defined as the smallest subset of $\calp_{ext} \times RDist(\calp_{ext}/\!\equiv)$ satisfying the operational rules
in Table~\ref{StoRules},
where we assume $(\nu q \rightarrow\! \lambda)\sigma = \lmp (\lambda,[(\nu q \rightarrow\! \lambda)P]_{\equiv}) \mid (\lambda,[P]_{\equiv}) \in \sigma \rmp$.\footnote{We use
$\lmp$ and $\rmp$ to denote multiset parentheses, $\cup$ to denote multiset union.}
Notice that even if the (Sto2) rule includes a negative
premise the operational semantics is well-defined in that
the inference of transitions can be stratified (see, e.g., \cite{Gro}).
The idea behind the semantics is that $\arrow{} \sigma$ transitions can be generated only for terms
that are (re)organized by the structural congruence in such a way that
stochastic binders (actually binding a delay) are the outermost operators, thus they can correctly evaluate
the multiset of Markovian transitions leaving a state from symbolic delay transitions (each of which is guaranteed to have a different name).
\begin{table}[t]
$
\begin{array}{cc}
\multicolumn{2}{c}{
(Sto1) \hspace{.2cm} \infr{P \arrow{} \sigma \hspace{.5cm} P \arrow{q} P'}
{(\nu q \rightarrow\! \lambda) P \arrow{} (\nu q \rightarrow\! \lambda) \sigma \cup \lmp (\lambda,[(\nu q \rightarrow\! \lambda)P']_{\equiv}) \rmp}} \\
(Sto2) \hspace{.2cm} \infr{P \narrow{} \sigma \hspace{.5cm} P \arrow{q} P'}
{(\nu q \rightarrow\! \lambda) P \arrow{} \lmp (\lambda,[(\nu q \rightarrow\! \lambda)P']_{\equiv}) \rmp} & \hspace{.5cm}
(StoCong) \hspace{.2cm} \infr{ P \equiv Q \hspace{.5cm} Q \arrow{} \sigma}{P \arrow{} \sigma}
\end{array}
$\\
\caption{Rules for Stochastic Transitions}\label{StoRules}
\end{table}
\begin{example}
Consider $P = (5).A | (5).A$ and $A \eqdef (5).A$ we have that $P \equiv (\nu q \rightarrow\! 5) (q).A | (\nu q \rightarrow\! 5)(q).A \equiv (\nu q \rightarrow\! 5)(\nu q' \rightarrow\! 5) ((q).A | (q').A)$ hence $P$ performs a $\sigma$ transition with $\sigma = \lmp (5,[(5).A | (5).A]_{\equiv}) , (5,[(5).A | (5).A]_{\equiv}) \rmp$, i.e. it is a multiset including two occurrences of the same pair.
\end{example}
The transition system of terms can be represented in a finitary way by resorting to equivalence
classes $[P]_{\equiv} \in \calp_{ext}/\!\equiv$. This will be important when deriving, as done in Section \ref{Classical} for
the labeled operational semantics, the underlying Interactive Markov Chain.
\begin{definition}\label{TransClass}
Let $P,P' \in \calp_{ext}$. $[P]_{\equiv} \arrow{\!\widehat{q}} [P']_{\equiv}$ whenever $P \arrow{\!\widehat{q}} P'$.
Let $P \in \calp_{ext}$ and $\sigma \in RDist(\calp_{ext}/\!\equiv)$.
$[P]_{\equiv} \arrow{} \sigma$ whenever $P \arrow{} \sigma$.
\end{definition}
The above is well-defined because congruent terms $P$ have the same transitions (rule of closure w.r.t. congruence in each of Tables~\ref{RedRules} and~\ref{StoRules}).
Notice that it is also possible to define directly transitions of equivalence classes, instead of resorting to a definition
like Definition \ref{TransClass}, by putting equivalence classes directly into rules, e.g. for parallel
\cws{8}{4}
\infr{ [P]_{\equiv} \arrow{\!\widehat{q}} [P']_{\equiv}}{[P | Q]_{\equiv} \arrow{\!\widehat{q}} [P' | Q]_{\equiv} }
}
This would also make the two rules of closure w.r.t. congruence in each of Tables~\ref{RedRules} and~\ref{StoRules} no longer needed (working directly with classes yields the same effect).
Let us now analyze properties of transitions of terms $P \in \calp$ (that is terms belonging to the restricted syntax of Definition~\ref{MDCalcDef}).
First of all we have that they cannot perform $\arrow{q}$ transitions.
\begin{proposition
Let $P \in \calp$. There is no $P' \in \calp_{ext}$, $q \in \calq\caln$ such that $P \arrow{q} P'$.
\begin{proof}
A direct consequence of the fact that for any $Q \equiv P$, with $P \in \calp$, we have that, due to the laws of $\equiv$, all delay prefixes $(q)$ occurring in $Q$ are bound (rules for binders do not allow transition labeled with the bound name to be inferred).
\end{proof}
\end{proposition}
The following proposition shows that Markovian transitions are well-defined, i.e. roughly that, no matter the order in which we choose to solve the stochastic binders, the $\sigma$ transition performed is the same.
\begin{proposition}\label{UniqueProp
Let $P \in \calp$ and $P \arrow{} \sigma$. We have $P \arrow{} \sigma'$ implies $\sigma = \sigma'$.
\begin{proof}
The complete formal proof is quite involved and is presented in Appendix \ref{App}. In the following we just present the structure of the proof in some detail and the main ideas.
Let $n$ be the number of unguarded syntactical occurrences of
Markovian delay prefixes inside $P$. Formally $n$ is evaluated as follows: $P'$ is obtained from $P$
by performing a finite number of successive substitutions of constants so that all constants occur weakly guarded in $P'$
(always possible because recursion is guarded, see Section \ref{MDCalc}); $n$ is the number of Markovian delay prefixes that
occur in $P'$ not in the scope of a prefix operator.
Since $P \arrow{} \sigma$ we must have $n \geq 1$.
We first show, by induction on $k$, with $0 \leq k \leq n$ ($k=0$ being the base case), that the following statement holds true (see Appendix \ref{App} for details on the induction proof).
Let $q_1$, \dots, $q_k$ be any set of distinguished names.
There exists $Q$ such that $P \equiv (\nu q_1 \rightarrow\! \lambda_1) \dots (\nu q_k \rightarrow\! \lambda_k) Q$ (consider $P \equiv Q$ in the case $k =0$) and $\forall i, 1 \leq h \leq k \ldotp Q \arrow{q_h}$.
Moreover for any such $Q$, we have, supposing $\forall h, 1 \leq h \leq k \ldotp Q \arrow{q_h} P'_h$, that:
\begin{itemize}
\item $Q$ includes a unique free unguarded syntactical occurrence of $(q_h)$ $\forall h, 1 \leq h \leq k$ (this reduces to true for the base case $k=0$).
\item If $k<n$, for any $q$ distinguished from $q_h$ $\forall h, 1 \leq h \leq k$, there exist $Q',\lambda$ such that $Q \equiv (\nu q \rightarrow\! \lambda) Q'$ and $Q' \arrow{q}$, i.e. $Q \arrow{} \sigma$ for some $\sigma$.
Moreover, any such $Q'$ includes unique free unguarded syntactical occurrences of $(q_h)$ $\forall h, 1 \leq h \leq k$ and,
supposing $\forall h, 1 \leq h \leq k \ldotp Q' \arrow{q_h} P''_h$, we have that $(\nu q \rightarrow\! \lambda) P''_h \equiv P'_h$.
\item If, instead, $k=n$ there is no $Q',q,\lambda$ such that $Q \equiv (\nu q \rightarrow\! \lambda) Q'$ and $Q' \arrow{q}$, i.e. $Q \not \arrow{} \sigma$.
\end{itemize}
Considering case $k=n$ of the above, we have that, given distinguished names $q_1$, \dots, $q_n$, there exists $P'$ such that $P \equiv (\nu q_1 \rightarrow\! \lambda_1) \dots (\nu q_n \rightarrow\! \lambda_n) P'$ and $\forall i, 1 \leq h \leq n \ldotp P' \arrow{q_h}$.
Moreover for any such $P'$ we have that $P'$ includes a unique free unguarded syntactical occurrence of $(q_i)$ $\forall i, 1 \leq i \leq n$.
We then show, by induction on the length of inference chains (see Appendix \ref{App}), that inferring a $\sigma$ transition from $P$ (where
$q_1$ is the name of the binder used to infer $\sigma$ in the last rule used in the inference chain and so on and so forth in depth until $q_n$ where the chain of binder applications begins with the (Sto2) rule) entails singling out one of such terms $P'$
and that, supposing $\forall h, 1 \leq h \leq n \ldotp P' \arrow{q_h} P'_h$,
the inferred $\sigma$ is such that $$\sigma = \lmp (\lambda_1,[(\nu q_1 \rightarrow\! \lambda_1) \dots (\nu q_n \rightarrow\! \lambda_n) P'_1]_{\equiv}) \rmp \cup \dots \cup \lmp (\lambda_n,[(\nu q_1 \rightarrow\! \lambda_1) \dots (\nu q_n \rightarrow\! \lambda_n) P'_n]_{\equiv}) \rmp$$
Notice that this value does
not depend on the choice of the $P'_h$ such that $P' \arrow{q_h} P'_h$ in that,
since $P'$ includes a unique free unguarded syntactical occurrence of $(q_h)$, possible terms $P'_h$ are all related by $\equiv$ (and, in general, $P \equiv Q$ implies $(\nu q \rightarrow\! \lambda) P \equiv (\nu q \rightarrow\! \lambda) Q$ for any $P, Q, q$ and $\lambda$).
From this fact we can derive that the $\sigma$ inferred is the same for any possible inference chain of a $\sigma$ transition from $P$,
i.e. that no matter the order in which delay prefixes are bound, the same rate
distribution is obtained.
This because, considered $\sigma'$ derived
with another inference chain, such an inference would determine a $P''$ such that $P \equiv (\nu q'_1 \rightarrow\! \lambda'_1) \dots (\nu q'_n \rightarrow\! \lambda'_n) P''$ and $\forall i, 1 \leq i \leq n \ldotp P'' \arrow{q'_i}$. It is immediate to verify that there exists a permutation $k_i$, with $1 \leq i \leq n$, such that, by alpha-conversion we
can write $(\nu q'_1 \rightarrow\! \lambda'_1) \dots (\nu q'_n \rightarrow\! \lambda'_n) P''$ as $(\nu q_{k_1} \rightarrow\! \lambda_{k_1}) \dots (\nu q_{k_n} \rightarrow\! \lambda_{k_n}) P'''$ where for $P'''$ it holds $P''' \equiv P'$. Thus $\sigma' = \lmp (\lambda_{k_1},(\nu q_{k_1} \rightarrow\! \lambda_{k_1}) \dots (\nu q_{k_n} \rightarrow\! \lambda_{k_n}) P''_{k_1}]_{\equiv}) \rmp \cup \dots \cup \lmp (\lambda_{k_n},[(\nu q_{k_1} \rightarrow\! \lambda_{k_1}) \dots (\nu q_{k_n} \rightarrow\! \lambda_{k_n}) P''_{k_n}]_{\equiv}) \rmp$, where $\forall i, 1 \leq i \leq n$ we have $P''_{k_i} \equiv P'_{k_i}$
because $P'$ includes a unique free unguarded syntactical occurrence of $(q_i)$ $\forall i, 1 \leq i \leq n$.
$\sigma' = \sigma$ by reordering of the binders, of the members of the multiset union and from the fact that $P \equiv Q$ implies $(\nu q \rightarrow\! \lambda) P \equiv (\nu q \rightarrow\! \lambda) Q$ for any $P, Q, q$ and $\lambda$.
\end{proof}
\end{proposition}
Moreover, from terms in $\calp$ we always reach terms in $\calp$ modulo congruence.
\begin{proposition
Let $P \in \calp$ and $P' \in \calp_{ext} $ such that $P \arrow{} P'$ or $P \arrow{} \sigma$ and $\exists \lambda$ such that $(\lambda, [P']_{\equiv}) \in \sigma$. There exists $P'' \in \calp$ such that $P'' \equiv P'$.
\begin{proof}
For any $Q \equiv P$ with $P \in \calp$ we have: all delay prefixes $(q)$ occurring in $Q$ are bound and every stochastic binder can bind at most a single delay prefix $(q)$.
It is easy to verify that this property is preserved by reductions $Q \arrow{} Q'$ or transitions $Q \arrow{} \sigma$ for which $\exists \lambda$ such that $(\lambda, [Q']_{\equiv}) \in \sigma$, i.e. for any such $Q'$ the same property holds true.
For instance performing the $\sigma$ transition causes the corresponding stochastic binder to not bind any delay prefix
in the target state.
Any $Q'$ satisfying the property above can be shown to be $\equiv$ to a term of $P$ by just removing stochastic binders not binding any delay prefix and by turning stochastic binder binding a single delay prefix $(q)$ into a Markovian delay
prefix.
\end{proof}
\end{proposition}
A consequence of the above propositions is that, given $P \in \calp$, we can represent the semantics of $P$ as a labeled transition system whose initial state is
$[P]_{\equiv}$ and, in general, states (congruence classes reachable from $[P]_{\equiv}$) are $[P']_{\equiv}$ such that $P' \in \calp$ (such classes always have a representative in $\calp$).
In particular, concerning the underlying
Interactive Markov Chain, see Section~\ref{Classical}, we have that
\begin{itemize}
\item the rate $\gamma([P]_{\equiv},[P']_{\equiv})$ of transiting from state $[P]_{\equiv}$ to state $[P']_{\equiv}$ is: \\ $\sum_{(\lambda,[P']_{\equiv}) \in \sigma} \lambda \cdot \mu_{\sigma}(\lambda,[P']_{\equiv})$ if $[P]_{\equiv} \arrow{} \sigma$ for some $\sigma$; $0$ otherwise\footnote{We assume an empty sum to yield $0$. Given a multiset $m$, $\mu_{m}(e)$ denotes the number of occurrences of element $e$ in $m$.}\\[-.35cm]
\item $\tau$ transitions of the Interactive Markov Chain are standard reductions.
\end{itemize}
The above also provides a definition of bisimulation over states of $P \in \calp$ by applying it to Definition \ref{strongbis} (and to other equivalences in \cite{Her}).
Obviously the reduction semantics yields a closed system interpretation (i.e. corresponding to labeled operational semantics where all actions are assumed to be bound at the top level), thus the obtained Interactive Markov Chain
is just labeled with $\tau$ actions as for all Interactive Markov Chains corresponding to complete (and not partial) systems, which are commonly the ones to be analyzed for performance.
In the following we formalize this correspondence. In the classical setting this has been done for the $\pi-$calculus, see, e.g.,
Harmony Lemma in \cite{SW} or \cite{MilPi}. Here we extend this result to Markovian delays.
\begin{theorem}[Harmony]
Let $P \in \calp$. We have:
\begin{itemize}
\item $P \arrow{} P'$ iff $P \arrow{\tau} \! \equiv P'$
\item $P \arrow{} \sigma$ for some $\sigma$ iff $P \arrow{\lambda,id} P'$ for some $\lambda$, $id$ and $P'$. Moreover in the case both hold true, we have that $\forall P' \in \calp$
$$\sum_{(\lambda,[P']_{\equiv}) \in \sigma} \lambda \cdot \mu_{\sigma}(\lambda,[P']_{\equiv}) = \sum_{P \arrow{\lambda,id} \equiv P'} \lambda$$
\end{itemize}
\begin{proof} Here we will present in detail the proof of the second item (the first item is standard in that reduction and $\tau$ transitions are derived via standard rules, see, e.g. the Harmony Lemma in \cite{SW}).
Let $n$ be the number of unguarded syntactical occurrences of
Markovian delay prefixes inside $P$ (see proof of Proposition \ref{UniqueProp}
for a formal definition of $n$).
We have that
$P \arrow{} \sigma$ for some $\sigma$ iff $n >0$ (the ``if'' part is obvious, see proof of Proposition \ref{UniqueProp}
for the ``only if'').
Moreover we also obviously have that
$P \arrow{\lambda,id} P'$ for some $\lambda$, $id$ and $P'$ iff $n >0$.
Assumed $n>0$, we consider term $Q$ obtained from $P$
by performing a finite number of successive substitutions of constants so that all constants occur weakly guarded in $Q$
(always possible because recursion is guarded, see Section \ref{MDCalc}).
Notice that since $P \equiv Q$ we have $Q \arrow{} \sigma$.
Moreover it is immediate to verify that for each $Q'$ such that
$Q \arrow{\lambda,id} Q'$ there exists $P'$, with $P' \equiv Q'$, such that $P \arrow{\lambda,id} P'$;
and viceversa.
Given distinguished names $q_1$, \dots, $q_n$, let $Q'$ and rates $\lambda_i$, $1 \leq i \leq n$, with $Q'$ including a unique free unguarded syntactical occurrence of each $(q_i)$ $\forall i, 1 \leq i \leq n$, be such that $Q' \{\lambda_i/q_i \mid 1 \leq i \leq n \} =Q$. We have that $Q \equiv (\nu q_1 \rightarrow\! \lambda_1) \dots (\nu q_n \rightarrow\! \lambda_n) Q'$ (by extruding stochastic binders up to the top level).
Moreover $\forall h, 1 \leq h \leq n$, let $Q_h$ be $Q' \{ \lambda_i/q_i \mid 1 \leq i \leq n \wedge i \neq h \}$.
We have that $Q \equiv (\nu q_h \rightarrow\! \lambda_h) Q_h$ (by extruding the stochastic binder $q_h$ up to the top level).
We now resort to classical correspondence of transitions between reduction and labeled semantics.
We have: $Q_h \arrow{q_h} Q'_h$ iff $Q \arrow{\lambda_h,id_h} Q''_h$ with $Q''_h \! \equiv Q'_h$.
This is proved in a completely analogous way as for the Harmony Lemma in \cite{SW}, since, both unbound $(q_h)$ prefixes for
the reduction semantics in this paper and $(\lambda)$ for the labeled semantics in this paper have the same behavior as $\tau$ prefixes for standard reduction and labeled semantics (they are just ``consumed'' in the target state with no other effects).
Considered $Q'$ we have that $Q' \arrow{q_h} Q'''_h$ with $Q'_h \equiv (\nu q_1 \rightarrow\! \lambda_1) \dots (\nu q_n \rightarrow\! \lambda_n) Q'''_h$ (see proof of Proposition \ref{UniqueProp}
), hence
$\sigma = \lmp (\lambda_1,[(\nu q_1 \rightarrow\! \lambda_1) \dots (\nu q_n \rightarrow\! \lambda_n) Q'''_1]_{\equiv}) \rmp \cup \dots \cup \lmp (\lambda_n,[(\nu q_1 \rightarrow\! \lambda_1) \dots (\nu q_n \rightarrow\! \lambda_n) Q'''_n]_{\equiv}) \rmp$.
Thus, considered the set $I$ of the indexes $h$, with $1 \leq h \leq n$, such that $[(\nu q_1 \rightarrow\! \lambda_1) \dots (\nu q_n \rightarrow\! \lambda_n) Q'''_h]_{\equiv} = [P']_{\equiv}$ we have $\sum_{(\lambda,[P']_{\equiv}) \in \sigma} \lambda \cdot \mu_{\sigma}(\lambda,[P']_{\equiv}) = \sum_{h \in I} \lambda_h$.
Moreover $I$ is also the set of indexes $h$ such that $Q''_h \equiv P'$, because $Q''_h \equiv (\nu q_1 \rightarrow\! \lambda_1) \dots (\nu q_n \rightarrow\! \lambda_n) Q'''_h$. Therefore, since $h \neq h'$ implies $id_h \neq id_{h'}$,
we also have $\sum_{P \arrow{\lambda,id} \equiv P'} \lambda = \sum_{Q \arrow{\lambda,id} \equiv P'} \lambda = \sum_{h \in I} \lambda_h$.
\end{proof}
\end{theorem}
\section{Conclusion}
We start by considering (other) related work. As already mentioned this paper is based on a (quite dated) technical report \cite{TechRep} where the idea of stochastic names and stochastic binders has been introduced, but applied to a slightly more complicate Markovian Process Algebra with respect to the one presented here. In particular, while here we consider a process algebra where Markovian delays and standard actions are separated prefixes (by following the simple approach of \cite{Her}), in \cite{TechRep} we apply our technique to a process algebra where Markovian rates are assigned to standard actions,
which become ``durational'' actions (as in \cite{Hil,Pri1,BB}). Such Markovian process algebras are slightly more complex in that the problem of calculating the rate of a synchronized action (out of the rate of the synchronizing actions and the so-called
apparent rates, that is the total rate of the actions of the same type as the synchronizing ones that are collectively performable by one of the processes involved in the synchronization) come into play. The particular way in which such rates are calculated
strictly depends on a fixed structure for the syntax tree for the parallel operators in the term
(calculating the rates of the synchronizations performable at a certain syntactical level,
for instance in $P\, |\, Q$, from the rates of the transitions performable at lower levels in $P$ and $Q$) and therefore
is not compatible with a semantics in reduction style. This does not mean that there are no meaningful ways
for defining rates of synchronized actions in reduction semantics (see \cite{TechRep} and future work below), but different calculations of apparent rates must be adopted that make parallel composition associative \cite{TechRep,KS}, thus yielding different values for the rates.
The more simplified setting adopted in this paper, instead, allowed us to provide a theorem of consistency with the labeled
operational semantics and to show our approach based on stochastic names and stochastic binders, in its essence, to be correct.
We also would like to mention the approach in the recently appeared paper \cite{CM}. Even if the version of Stochastic $\pi-$calculus presented in \cite{CM} considers a congruence relation on terms, it defines semantics via a labeled operational semantics (and not semantics in reduction style), thus not exploiting congruence while inferring transitions
(which, for instance, would allow terms to be synchronized to get next to each other and then produce a reduction). In particular \cite{CM} deals with multiplicity following an approach like that of \cite{DLLM}. It is also worth noting that in \cite{CM}
binders that are very similar to the stochastic binders in this paper (and in \cite{TechRep}) are used, but for a different aim. Here rate values inside binders are used to associate a numerical value to a name representing symbolically a duration for the aim of distinguishing multiple transitions (with the same rate). In \cite{CM}, where multiplicity is dealt with as in \cite{DLLM}, they are used instead to associate rates directly to action names in order to be able to express a novel feature: the ability to pass around actions with a bound name but with an explicit associated rate value.
The similarity in the binder representation would maybe make it possible to apply the technique in this paper to produce
a reduction semantics for the expressive algebra in \cite{CM} in an overall harmonic approach.
As a final remark, we would like to observe that the approach introduced in this paper, that allows us to independently identify each Markovian delay without introducing an explicit identification mechanism (but by exploiting extrusion and stochastic binders) is applicable also in the case of generally distributed durations where the identification mechanism is necessary to generate clock names (to uniquely relate start of delays with termination of delays), see, for instance, \cite{tcs,BD}. In this case the generally distributed delays would be considered as stochastic binders assigning a general distribution $f$ and immediately binding a delay start prefix followed by a delay termination prefix, both decorated with the same stochastic name that is bound by the binder.
As future work we consider the application of the technique in this paper to produce semantics in reduction style in Markovian process algebra with rates associated to actions (using, for instance, the mass action law as in \cite{TechRep} so to have associativity of parallel, see \cite{KS}, or the generative/reactive approach of \cite{BB}, that can be adopted in the context of an associative parallel and whose rate calculation is compatible with inferring transitions via a congruence relation) and in process algebra with probabilistic choices and generally distributed durations \cite{tcs,BD}.
\subparagraph*{Acknowledgements}
We would like to thank Luca Cardelli and Davide Sangiorgi for the fruitful comments and suggestions.
{\small
| {'timestamp': '2015-12-23T02:08:04', 'yymm': '1512', 'arxiv_id': '1512.07098', 'language': 'en', 'url': 'https://arxiv.org/abs/1512.07098'} | arxiv |
\section{Introduction}
Associative memory is defined in psychology as the ability to remember (link) many sets, called memories, of unrelated items. Prompted by a large enough subset of items taken from one memory, an animal or computer with an associative memory can retrieve the rest of the items belonging to that memory. The diverse human cognitive abilities which involve making appropriate responses to stimulus patterns can often be understood as the operation of an associative memory, with the ``memories'' often being distillations and consolidations of multiple experiences rather than merely corresponding to a single event.
The intuitive idea of associative memory can be described using a ``feature space''. In a mathematical model abstracted from neurobiology, the presence (or absence) of each particular feature $i$ is denoted by the activity (or lack of activity) of a model neuron $v_i$ due to being directly driven by a feature signal. If there are $N_f$ possible features, there can be only at most $N_f^2$ distinct connections (synapses) in a neural circuit involving only these neurons. Typical cortical synapses are not highly reliable, and can store only a few bits of information\footnote{For instance, a recent study \citep{bromer2018long} reports the information content of individual synapses ranging between $2.7$ and $4.7$ bits, based on electron microscopy imaging, see also \citep{bartol2015nanoconnectomic}. These numbers refer to the structural accuracy of synapses. There is also electrical and chemical noise in synaptic currents induced by the biophysical details of vesicle release and neurotransmitter binding. The unreliability of the fusion of pre-synaptic vesicles (containing neurotransmitter) with the pre-synaptic neuron membrane is the dominant source of trial-to-trial synaptic current variation \citep{allen1994evaluation}. This noise decreases the electrical information capacity of individual synapses from the maximal value that the synaptic structure would otherwise provide.}. The description of a particular memory requires roughly $N_f$ bits of information. Such a system can therefore store at most $\sim N_f$ unrelated memories. Artificial neural network models of associative memory (based on attractor dynamics of feature neurons and understood through an energy function) exhibit this limitation even with precise synapses, with limits of memory storage to less than $\sim 0.14 N_f$ memories \citep{Hopfield82}.
Situations arise in which the number $N_f$ is small and the desired number of memories far exceeds $\sim N_f$, see some examples from biological and AI systems in Section \ref{sec: Examples of Problems}. In these situations the associative memory model of \citep{Hopfield82} would be insufficient, since it would not be able to memorize the required number of patterns. At the same time, models of associative memory with large storage capacity considered in our paper, can easily solve these problems.
The starting point of this paper is a machine learning approach to associative memory based on an energy function and attractor dynamics in the space of $N_f$ variables, called Dense Associative Memory \citep{Krotov_Hopfield_2016}. This idea has been shown to dramatically increase the memory storage capacity of the corresponding neural network \citep{Krotov_Hopfield_2016, Demircigil} and was proposed to be useful for increasing robustness of neural networks to adversarial attacks \citep{Krotov_Hopfield_2018}. Recently, an extension of this idea to continuous variables, called modern Hopfield network, demonstrated remarkably successful results on the immune repertoire classification \citep{Immune}, and provided valuable insights into the properties of attention heads in Transformer architectures \citep{Hochreiter}.
Dense Associative Memories or modern Hopfield networks, however, cannot describe biological neural networks in terms of true microscopic degrees of freedom, since they contain many-body interaction terms in equations describing their dynamics and the corresponding energy functions. To illustrate this point consider two networks: a conventional Hopfield network \citep{Hopfield82} and a Dense Associative Memory with cubic interaction term in the energy function (see Fig. \ref{two-body}). In the conventional network the dynamics is encoded in the matrix $T_{ij}$, which represents the strengths of the synaptic connections between feature neurons $i$ and $j$. Thus, this network is manifestly describable in terms of only two-body synapses, which is approximately true for many biological synapses. In contrast, a Dense Associative Memory network with cubic energy function naively requires the synaptic connections to be tensors $T_{ijk}$ with three indices, which are harder, although not impossible, to implement biologically. Many-body synapses become even more problematic in situations when the interaction term is described by a more complicated function than a simple power (in this case the Taylor expansion of that function would generate a series of terms with increasing powers).
\begin{figure}[t]
\begin{center}
\includegraphics[width = 0.61\linewidth]{interactions.pdf}
\end{center}
\caption{Two binary networks consisting of three neurons $\sigma_1, \sigma_2, \sigma_3 = \{\pm 1\}$. On the left is the classical Hopfield network \citep{Hopfield82} with the matrix $T_{ij} = \sum_\mu \xi_{\mu i}\xi_{\mu j}$ being the outer product of memory vectors (see section \ref{sec: Mathematical Formulation} for the definitions of notations). In this case the matrix $T_{ij}$ is interpreted as a matrix of synaptic connections between cells $i$ and $j$. On the right is a Dense Associative Memory network of \citep{Krotov_Hopfield_2016} with cubic interaction term $F(x) = x^3$. In this case the corresponding tensor $T_{ijk} = \sum_\mu \xi_{\mu i} \xi_{\mu j} \xi_{\mu k}$ has three indices, thus cannot be interpreted as a biological synapse, which can only connect two~cells. }\label{two-body}
\end{figure}
Many-body synapses typically appear in situations when one starts with a microscopic theory described by only two-body synapses and integrates out some of the degrees of freedom (hidden neurons). The argument described above based on counting the information stored in synapses in conjunction with the fact that modern Hopfield nets and Dense Associative Memories can have a huge storage capacity hints at the same solution. The reason why these networks have a storage capacity much greater than $N_f$ is because they do not describe the dynamics of only $N_f$ neurons, but rather involve additional neurons and synapses.
Thus, there remains a theoretical question: what does this hidden circuitry look like? Is it possible to introduce a set of hidden neurons with appropriately chosen interaction terms and activation functions so that the resulting theory has both large memory storage capacity (significantly bigger than $N_f$), and, at the same time, is manifestly describable in terms on only two-body synapses?
The main contributions of this current paper are the following. First, we extend the model of \citep{Krotov_Hopfield_2016} to continuous state variables and continuous time, so that the state of the network is described by a system of non-linear differential equations. Second, we couple an additional set of $N_h$ ``complex neurons'' or ``memory neurons'' or hidden neurons to the $N_f$ feature neurons. When the synaptic couplings and neuron activation functions are appropriately chosen, this dynamical system in $N_f+N_h$ variables has an energy function describing its dynamics. The minima (stable points) of this dynamics are at the same locations in the $N_f$ - dimensional feature subspace as the minima in the corresponding Dense Associative Memory system. Importantly, the resulting dynamical system has a mathematical structure of a conventional recurrent neural network, in which the neurons interact only in pairs through a two-body matrix of synaptic connections. We study three limiting cases of this new theory, which we call models A, B, and C. In one limit (model A) it reduces to Dense Associative Memory model of \citep{Krotov_Hopfield_2016} or \citep{Demircigil} depending on the choice of the activation function. In another limit (model B) our model reduces to the network of \citep{Hochreiter}. Finally, we present a third limit (model C) which we call Spherical Memory model. To the best of our knowledge this model has not been studied in the literature. However, it has a high degree of symmetry and for this reason might be useful for future explorations of various models of large associative memory and recurrent neural networks in machine learning.
For the purposes of this paper we defined ``biological plausiblity'' as the absence of many-body synapses. It is important to note that there other aspects in which our model described by equations (\ref{dynamical equations}) below is biologically implausible. For instance, it assumes that the strengths of two physically different synapses $\mu\rightarrow i$ and $i\rightarrow\mu$ are equal. This assumption is necessary for the existence of the energy function, which makes it easy to prove the convergence to a fixed point. It can be relaxed in equations (\ref{dynamical equations}), which makes them even more biological, but, at the same time, more difficult to analyse.
\section{Mathematical Formulation}\label{sec: Mathematical Formulation}
In this section, we present a simple mathematical model in continuous time, which, on one hand, permits the storage of a huge number of patterns in the artificial neural network, and, at the same time, involves only pairwise interactions between the neurons through synaptic junctions. Thus, this system has the useful associative memory properties of the AI system, while maintaining conventional neural network dynamics and thus a degree of biological plausibility.
\begin{figure}[t]
\begin{center}
\includegraphics[width = 0.54\linewidth]{architecture.pdf}
\end{center}
\caption{An example of a continuous network with $N_f=5$ feature neurons and $N_h=11$ complex memory (hidden) neurons with symmetric synaptic connections between them.}\label{neurons_fig}
\vspace{-0.5cm}
\end{figure}
The spikes of action potentials in a pre-synaptic cell produce input currents into a postsynaptic neuron. As a result of a single spike in the pre-synaptic cell the current in the post-synaptic neuron rises instantaneously and then falls off exponentially with a time constant $\tau$. In the following the currents of the feature neurons are denoted by $v_i$ (which are enumerated by the latin indices), and the currents of the complex memory neurons are denoted by $h_\mu$ ($h$ stands for hidden neurons, which are enumerated by the greek indices). A simple cartoon of the network that we discuss is shown in Fig.\ref{neurons_fig}. There are no synaptic connections among the feature neurons or the memory neurons. A matrix $\xi_{\mu i}$ denotes the strength of synapses from a feature neuron $i$ to the memory neuron $\mu$. The synapses are assumed to be symmetric, so that the same value $\xi_{i \mu} = \xi_{\mu i}$ characterizes a different physical synapse from the memory neuron $\mu$ to the feature neuron $i$. The outputs of the memory neurons and the feature neurons are denoted by $f_\mu$ and $g_i$, which are non-linear functions of the corresponding currents. In some situations (model A) these outputs can be interpreted as activation functions for the corresponding neurons, so that $f_\mu = f(h_\mu)$ and $g_i = g(v_i)$ with some non-linear functions $f(x)$ and $g(x)$. In other cases (models B and C) these outputs involve contrastive normalization, e.g. a softmax, and can depend on the currents of all the neurons in that layer. In these cases $f_\mu = f(\{h_\mu\})$ and $g_i = g(\{v_i\})$. For the most part of this paper one can think about them as firing rates of the corresponding neurons. In some limiting cases, however, the function $g(v_i)$ will have both positive and negative signs. Then it should be interpreted as the input current from a pre-synaptic neuron. The functions $f(h_\mu)$ and $g(v_i)$ are the only nonlinearities that appear in our model. Finally, the time constants for the two groups of neurons are denoted by $\tau_f$ and $\tau_h$. With these notations our model can be written~as
\begin{equation}
\begin{cases}
\tau_f \frac{d v_i}{dt} = \sum\limits_{\mu=1}^{N_h} \xi_{i \mu} f_\mu - v_i +I_i \\
\tau_h \frac{d h_\mu}{dt} = \sum\limits_{i=1}^{N_f} \xi_{\mu i} g_i - h_\mu
\end{cases}\label{dynamical equations}
\end{equation}
where $I_i$ denotes the input current into the feature neurons.
The connectivity of our network has the structure of a bipartite graph, so that the connections exist between two groups of neurons, but not within each of the two groups. This design of a neural network is inspired by the class of models called Restricted Boltzmann Machines (RBM) \citep{Smolensky}. There is a body of literature studying thermodynamic properties of these systems and learning rules for the synaptic weights. In contrast, the goal of our work is to write down a general dynamical system and an energy function so that the network has useful properties of associative memories with a large memory storage capacity, is describable only in terms of manifestly two-body synapses, and is sufficiently general so that it can be reduced to various models of this class previously discussed in the literature. We also note that although we use the notation $v_i$ ($v$ stands for visible neurons), commonly used in the RBM literature, it is more appropriate to think about $v_i$ as higher level features. For example the input to our network can be a latent representation produced by a convolutional neural network or a latent representation of a BERT-like system \citep{devlin2018bert} rather than raw input data. Additionally, our general formulation makes it possible to use a much broader class of activation functions (e.g. involving contrastive or spherical normalization) than those typically used in the RBM literature. Also, the relationship between Dense Associative Memories and RBMs has been previously studied in \citep{Barra, Agliari}. We also note that a Hopfield network with exponential capacity was studied in \citep{chaudhuri2019bipartite}, but their construction requires specifically engineered memory vectors and cannot be applied to general arbitrary memory vectors.
Mathematically, equations (\ref{dynamical equations}) describe temporal evolution of two groups of neurons. For each neuron its temporal updates are determined by the inputs from other neurons and its own state (the decay term on the right hand side of the dynamical equations). For this reason, an energy function for this system is expected to be represented as a sum of three terms: two terms describing the neurons in each specific group, and the interaction term between the two groups of neurons. We have chosen the specific mathematical form of these three terms so that the energy function decreases on the dynamical trajectory. With these choices the energy function for the network (\ref{dynamical equations}) can be written as
\begin{equation}
E(t) = \Big[\sum\limits_{i=1}^{N_f} (v_i-I_i) g_i - L_v \Big] + \Big[\sum\limits_{\mu=1}^{N_h} h_\mu f_\mu - L_h \Big] - \sum\limits_{\mu, i} f_\mu \xi_{\mu i} g_i \label{energy}
\end{equation}
Here we introduced two Lagrangian functions $L_v(\{v_i\})$ and $L_h(\{h_\mu\})$ for the feature and the hidden neurons. They are defined through the following equations, so that derivatives of the Lagrangian functions correspond to the outputs of neurons
\begin{equation}
f_\mu = \frac{\partial L_h}{\partial h_\mu},\ \ \ \ \text{and}\ \ \ \ g_i = \frac{\partial L_v}{\partial v_i} \label{Lagrangian_def}
\end{equation}
With these notations expressions in the square brackets in (\ref{energy}) have a familiar from classical mechanics structure of the Legendre transform between a Lagrangian and an energy function. By taking time derivative of the energy and using dynamical equations (\ref{dynamical equations}) one can show (see Appendix A for details) that the energy monotonically decreases on the dynamical trajectory
\begin{equation}
\frac{dE(t)}{dt}= - \tau_f \sum\limits_{i,j=1}^{N_f} \frac{d v_i}{dt} \frac{\partial^2 L_v}{\partial v_i \partial v_j} \frac{d v_j}{dt} - \tau_h \sum\limits_{\mu,\nu = 1}^{N_h} \frac{d h_\mu}{dt} \frac{\partial^2 L_h}{\partial h_\mu \partial h_\nu} \frac{d h_\nu}{dt} \leq 0\label{energy_decrease}
\end{equation}
The last inequality sign holds provided that the Hessian matrices of the Lagrangian functions are positive semi-definite.
In addition to decrease of the energy function on the dynamical trajectory it is important to check that for a specific choice of the activation functions (or Lagrangian functions) the corresponding energy is bounded from below. This can be achieved for example by using bounded activation function for the feature neurons $g(v_i)$, e.g. hyperbolic tangent or a sigmoid. Provided that the energy is bounded, the dynamics of the neural network will eventually reach a fixed point, which corresponds to one of the local minima of the energy function\footnote{There is also a border case possibility that the dynamics cycles without decreasing the energy (limit cycle), but this requires that the Hessian matrix in (\ref{energy_decrease}) has a zero mode everywhere along the trajectory. This border case possibility should be checked for a specific choice of the activation functions.}.
The proposed energy function has three terms in it: the first term depends only on the feature neurons, the second term depends only on the hidden neurons, and the third term is the ``interaction'' term between the two groups of neurons. Note, that this third term is manifestly describable by two-body synapses - a function of the activity of the feature neurons is coupled to another function of the activity of the memory neurons, and the strength of this coupling is characterized by the parameters $\xi_{\mu i}$. The absence of many-body interaction terms in the energy function results in the conventional structure (with unconventional activation functions) of the dynamical equations (\ref{dynamical equations}). Each neuron collects outputs of other neurons, weights them with coefficients $\xi$ and generates its own output. Thus, the network described by equations (\ref{dynamical equations}) is biologically plausible according to our definition (see Introduction).
Lastly, note that the memory patterns $\xi_{\mu i}$ of our network (\ref{dynamical equations}) can be interpreted as the strengths of the synapses connecting feature and memory neurons. This interpretation is different from the conventional interpretation, in which the strengths of the synapses is determined by matrices $T_{ij} = \sum_\mu \xi_{\mu i}\xi_{\mu j}$ (see Fig. \ref{two-body}), which are outer products of the memory vectors (or higher order generalizations of the outer products).
\section{Effective Theory for Feature Neurons}
In this section we start with the general theory proposed in the previous section and integrate out hidden neurons. We show that depending on the choice of the activation functions this general theory reduces to some of the models of associative memory previously studied in the literature, such as classical Hopfield networks, Dense Associative Memories, and modern Hopfield networks. The update rule in the latter case has the same mathematical structure as the dot-product attention \citep{bahdanau2014neural} and is also used in Transformer networks \citep{vaswani2017attention}.
\subsection{Model A. Dense Associative Memory Limit.}\label{sec:modelA}
Consider the situation when the dynamics of memory neurons $h_\mu$ is fast. Mathematically this corresponds to the limit $\tau_h\rightarrow 0$. In this case the second equation in (\ref{dynamical equations}) equilibrates quickly, and can be solved as
\begin{equation}
h_\mu = \sum\limits_{i=1}^{N_f} \xi_{\mu i} g_i\label{steady state}
\end{equation}
Additionally, assume that the Lagrangian functions for the feature and the memory neurons are additive for individual neurons
\begin{equation}
L_h = \sum\limits_\mu F(h_\mu),\ \ \ \ \text{and}\ \ \ \ L_v = \sum\limits_i G(v_i)\label{additive models def}
\end{equation}
where $F(x)$ and $G(x)$ are some non-linear functions. In this limit we set $G(x)=|x|$. Since, the outputs of the feature neurons are derivatives of the Lagrangian (\ref{Lagrangian_def}), they are given by the sign functions of their currents,which gives a set of binary variables that are denoted by $\sigma_i$
\begin{equation}
\sigma_i= g_i = g(v_i)= \frac{\partial L_v}{\partial v_i}= Sign\big[v_i\big]
\end{equation}
Since $G(v_i) = |v_i|$ the only term that survives in the first square bracket in equation (\ref{energy}) is the one proportional to the input current $I_i$. The first term in the second bracket of equation (\ref{energy}) cancels the interaction term because of the steady state condition (\ref{steady state}). Thus, in this limit the energy function (\ref{energy}) reduces to
\begin{equation}
E(t)= -\sum\limits_{i=1}^{N_f} I_i \sigma_i - \sum\limits_{\mu=1}^{N_h} F\Big(\sum\limits_i\xi_{\mu i} \sigma_i \Big)
\end{equation}
If there are no input currents $I_i=0$ this is exactly the energy function for Dense Associative Memory from \citep{Krotov_Hopfield_2016}. If $F(x)=x^n$ is a power function, the network can store $N_{\text{mem}}\sim N_f^{n-1}$ memories, if $F(x)=\exp(x)$ the network has exponential storage capacity \cite{Demircigil}. If power $n=2$ this model further reduces to the classical Hopfield network \citep{Hopfield82}.
It is important to emphasize that the capacity estimates given above express the maximal number of memories that the associative memory can store given the dimensions of the input, but assuming no limits on the number of hidden neurons. In all the models considered in this work this capacity is also bounded by the number of those hidden neurons so that $N_{\text{mem}}\leq N_h$. With this constraint the capacity of model A with power function $F(x) = x^n$ should be written as
\begin{equation}
N_{\text{mem}}\sim \min(N_f^{n-1}, N_h)
\end{equation}
In many practical applications (see examples in Section \ref{sec: Examples of Problems}) the number of hidden neurons can be assumed to be larger than the bound defined by the dimensionality of the input space $N_f$. It is for this class of problems that Dense Associative Memories or modern Hopfield networks offer a powerful solution to the capacity limitation compared to the standard models of associative memory \citep{Hopfield82, Hopfield84}.
Lastly, for the class of additive models (\ref{additive models def}), which we call models A, the equation for the temporal evolution of the energy function reduces to
\begin{equation}
\frac{dE(t)}{dt}= - \tau_f \sum\limits_{i=1}^{N_f} \Big(\frac{d v_i}{dt}\Big)^2 g(v_i)' - \tau_h \sum\limits_{\mu=1}^{N_h} \Big(\frac{d h_\mu}{dt}\Big)^2 f(h_\mu)' \leq 0
\end{equation}
Thus, the condition that the Hessians are positive definite is equivalent to the condition that the activation functions $g(v_i)$ and $f(h_\mu)$ are monotonically increasing.
Additionally, in Appendix B, we show how standard continuous Hopfield networks \citep{Hopfield84} can be derived as a limiting case of the general theory (\ref{dynamical equations},\ref{energy}).
\subsection{Model B. Modern Hopfield Networks Limit and Attention Mechanism.}
Models B are defined as models having contrastive normalization in the hidden layer. Specifically we are interested in
\begin{equation}
L_h = \log\Big(\sum\limits_\mu e^{h_\mu}\Big),\ \ \ \ \text{and}\ \ \ \ L_v = \frac{1}{2} \sum\limits_i v_i^2
\end{equation}
so that $L_v$ is still additive, but $L_h$ is not. Using the general definition of the activation functions (\ref{Lagrangian_def}) one obtains
\begin{equation}
\begin{split}
&f_\mu = \frac{\partial L_h}{\partial h_\mu} = \text{softmax}(h_\mu) = \frac{e^{h_\mu}}{\sum\limits_\nu e^{h_\nu}}\\
&g_i = \frac{\partial L_v}{\partial v_i} = v_i \label{modern Hopfield net limit}
\end{split}
\end{equation}
Similarly to the previous case, consider the limit $\tau_h\rightarrow 0$, so that equation (\ref{steady state}) is satisfied. In this limit the energy function (\ref{energy}) reduces to (currents $I_i$ are assumed to be zero)
\begin{equation}
E = \frac{1}{2}\sum\limits_{i=1}^{N_f} v_i^2 - \log\Big(\sum\limits_\mu \exp(\sum\limits_i \xi_{\mu i} v_i) \Big)
\end{equation}
This is exactly the energy function studied in \citep{Hochreiter} up to additive constants (inverse temperature $\beta$ was assumed to be equal to one in this derivation). Notice that we used the notations from \citep{Krotov_Hopfield_2016}, which are different from the notations of \citep{Hochreiter}. In the latter paper the state vector $v_i$ is denoted by $\xi_i$ and the memory matrix $\xi_{\mu i }$ is denoted by the matrix $\mathbf{X^T}$.
Making substitutions (\ref{modern Hopfield net limit}) in the first equation of (\ref{dynamical equations}), using steady state condition (\ref{steady state}), and setting input current $I_i=0$ results in the following effective equations for the feature neurons, when the memory neurons are integrated out
\begin{equation}
\tau_f \frac{d v_i}{dt} = \sum\limits_{\mu=1}^{N_h} \xi_{i \mu} \text{softmax}\Big(\sum\limits_{j=1}^{N_f} \xi_{\mu j} v_j\Big) - v_i
\end{equation}
This is a continuous time counterpart of the update rule of \citep{Hochreiter}. Writing it in finite differences gives
\begin{equation}
v_i^{(t+1)} = v_i^{(t)} +\frac{dt}{\tau_f} \Big[ \sum\limits_{\mu=1}^{N_h} \xi_{i \mu} \text{softmax}\Big(\sum\limits_{j=1}^{N_f} \xi_{\mu j} v_j^{(t)}\Big) - v_i^{(t)}\Big] \end{equation}
which for $dt = \tau_f$ reduces to
\begin{equation}
v_i^{(t+1)} = \sum\limits_{\mu=1}^{N_h} \xi_{i \mu} \text{softmax}\Big(\sum\limits_{j=1}^{N_f} \xi_{\mu j} v_j^{(t)}\Big)
\end{equation}
This is exactly the update rule derived in \citep{Hochreiter}, which, if applied once, is equivalent to the familiar dot-product attention \citep{bahdanau2014neural} and is also used in Transformer networks \citep{vaswani2017attention}.
The derivation of this result in \citep{Hochreiter} begins with the energy function for a Dense Associative Memory model with exponential interactions $F(x) = exp(x)$. Then it is proposed to take a logarithm of that energy (with a minus sign) and add a quadratic term in the state vector $v_i$ to ensure that it remains finite and the energy is bounded from below. While this is a possible logic, it requires a heuristic step - taking the logarithm, and makes the connection with Dense Associative Memories less transparent. In contrast, our derivation follows from the general principles specified by equations (\ref{dynamical equations},\ref{energy}) for the specifically chosen Lagrangians.
It is also important to note, that the Hessian matrix for the hidden neurons has a zero mode (zero eigenvalue) for this limit of our model.
\subsection{Model C. Spherical Memory.}
Models C are defined as having spherical normalization in the feature layer. We are not aware of a discussion of this class of associative memory models in the literature. Specifically,
\begin{equation}
L_h = \sum\limits_\mu F(h_\mu),\ \ \ \ \text{and}\ \ \ \ L_v = \sqrt{\sum_i v_i^2}
\end{equation}
so that $L_h$ is additive, but $L_v$ is not. Using the general definition of the activation functions (\ref{Lagrangian_def}) one obtains
\begin{equation}
\begin{split}
&f_\mu = F'(h_\mu) \\
&g_i = \frac{\partial L_v}{\partial v_i} = \frac{v_i}{\sqrt{\sum_j v_j^2}}
\end{split}\label{div_normalization}
\end{equation}
Equations (\ref{dynamical equations}) for model C are given by ($I_i$ is assumed to be zero)
\begin{equation}
\begin{cases}
\tau_f \frac{d v_i}{dt} = \sum\limits_{\mu=1}^{N_h} \xi_{i \mu} f(h_\mu) - \alpha v_i \\
\tau_h \frac{d h_\mu}{dt} = \sum\limits_{i=1}^{N_f} \xi_{\mu i} g_i - h_\mu
\end{cases}
\end{equation}
Notice, that since the Hessian matrix for the feature neurons has a zero mode proportional to $v_i$ in this model,
\begin{equation}
M_{ij} = \frac{\partial^2 L_v}{\partial v_i \partial v_j} = \frac{1}{\big(\sum\limits_k v_k^2\big)^{3/2}} \Big[\delta_{ij} \sum\limits_l v_l^2 - v_i v_j\Big], \ \ \ \ \text{so that}\ \ \sum\limits_j M_{ij}v_j = 0,
\end{equation}
we can write an arbitrary coefficient $\alpha$, which can be equal to zero, in front of the decay term for the feature neurons. Taking the limit $\tau_h\rightarrow 0$ and excluding $h_\mu$ gives the effective energy
\begin{equation}
E(t) = -\sum\limits_\mu F\bigg(\sum\limits_i \xi_{\mu i} \frac{v_i}{\sqrt{\sum_j v_j^2}} \bigg)
\end{equation}
and the corresponding effective dynamical equations
\begin{equation}
\tau_f \frac{dv_i}{dt} = \sum\limits_\mu \xi_{i\mu} f\bigg[ \sum\limits_j \xi_{\mu j} \frac{v_j}{\sqrt{\sum_k v_k^2}} \bigg] - \alpha v_i
\end{equation}
It is also important to notice that the activation function $g_i$ that appears in equation (\ref{div_normalization}) implements a canonical computation of divisive normalization widely studied in neuroscience \citep{carandini2012normalization}. Divisive normalization has also been shown to be beneficial in deep CNNs and RNNs trained on image classification and language modelling tasks \citep{ren2016normalizing}.
\section{A Few Examples of Large Associative Memory Problems}\label{sec: Examples of Problems}
In this section we provide some examples of problems in AI and biology which may benefit from thinking about them through the lens of associative memory.
{\bf Pattern memorization.} Consider a small gray scale image $64\times 64$ pixels. If one treats the intensity of each pixel as an input to a feature neuron the standard associative memory \citep{Hopfield82} would be able to only memorize approximately $0.14\cdot4096\approx 573$ distinct patters. Yet, the number of all possible patterns of this size that one can imagine is far bigger. For instance, Kuzushiji-Kanji dataset \citep{clanuwat2018deep} includes over 140,000 characters representing 3832 classes with most of the characters recognizable by humans. A well educated Japanese person can recognize about 3000-5000 character classes, which means that those classes are represented in his/her memory. In addition, for many characters a person would be able to complete it if only a portion of that character is shown. Moreover, possible patterns of $64\times64$ pixels are not necessarily Kanji characters, but also include digits, smileys, emojis, etc. Thus, the overall number of patterns that one might want to memorize is even bigger.
In the problem of {\bf immune repertoire classification}, considered in \citep{Immune}, the number of immune repertoire sequences (number of memories in the modern Hopfield network) is $N\gg10000$, while the size of the sequence embedding dimension $d_k=32$, or $N_f=32$ using the notations of this current paper. The ability to solve this problem requires the associative memory used in the aforementioned paper to have a storage capacity much larger than the dimensionality of the feature space.
{\bf Cortical-hippocampal system.} The hippocampus has long been hypothesised to be responsible for formation and retrieval of associative memories, see for example \citep{rolls2018storage, treves1994computational}. Damage to the hippocampus results in deficiencies in learning about places and memory recognition visual tasks. For instance \citep{parkinson1988selective} reports deficiencies in object-memory tasks, which require a memory of an object and the place where that object was seen. One candidate for associative memory network in the hippocampus is the CA3 area, which consists of a large population of pyramidal neurons, approximately $3\cdot10^5$ in the rat brain \citep{amaral1989three}, and $2.3\cdot10^6$ \citep{seress1988interspecies} in human, in conjunction with an inhibitory network that keeps the firing rates under control. There is a substantial recurrent connectivity among the pyramidal neurons \citep{rolls2018storage}, which is necessary for an associative memory network. There are also several classes of responses of those neurons in behaving animals, one class being place cells \citep{o1971hippocampus}. In addition to place cells \citep{ferguson2011inside} report existence of cells in the hippocampus that do not respond in experiments designed to drive place cells, but presumably are useful for other tasks. One possible way of connecting the mathematical model proposed in this paper with the existing anatomical network in the brain is to assume that some of the pyramidal cells in CA3 correspond to the feature neurons in our model, while the remaining pyramidal cells are the memory neurons. For example, place cells are believed to emerge as a result of aggregating inputs from the grid cells and environmental features, e.g. landmark objects, environment boundaries, visual and olfactory cues, etc., \citep{moser2015place}. Thus, it is tempting to think about them as memory neurons (which aggregate information from feature neurons to form a stable memory) in the proposed model.
Another area of the hippocampus potentially related to the mathematical model described in this paper is the area CA1, which, in addition to receiving inputs from CA3, also receives inputs directly from the entorhinal cortex, and projects back to it. In this interpretation pyramidal cells of the CA1 would be interpreted as the memory neurons in our mathematical model, while the cells in the layer III of the entorhinal cortex would be the feature neurons. The feedback projections from CA1 go primarily to layer V of the entorhinal cortex \citep{rolls2018storage}, but there are also projections to layers II and III \citep{witter2017architecture}. While it is possible to connect the proposed mathematical model of Dense Associative Memory with existing networks in the hippocampus, it is important to emphasize that the hippocampus is involved in many tasks, for example imagining the future \citep{hassabis2007patients}, and not only in retrieving the memories about the past. For this reason it is difficult at present to separate the network motifs responsible for memory retrievals from the circuitry required for other functions.
{\bf Human color vision} has three dimensions so that every color sensation can be achieved by mixing three primary lights \citep{mollon2003origins}. From the neuron's perspective every color is detected by three kinds of cone photoreceptors ($N_f=3$) in the retina, so that the degree of excitation of each photoreceptor is described by a continuous number. Most people know many colors with names for them (e.g. red, orange, yellow, green, blue, indigo, violet, pink, lavender, copper, gold, etc.), descriptions for others. e.g. "the color of the sky". Experimentally, humans can distinguish about $10^6$ different colors \citep{masaoka2013number}, although may not be able to ``memorize'' all of them. See also \citep{meister2015dimensionality} for the discussion of this problem. Thus, if one thinks about this system as an associative memory for color discrimination, the model of \citep{Hopfield82} and its extensions with $O(N_f)$ storage capacity would be inadequate since they can only ``remember'' a few colors. It is important to emphasize that the memories of the colors are stored in higher areas of the brain, while the color sensation is conveyed to the brain through the cone cells in the retina. Thus, in this example there are many intermediate neurons and synapses between in feature neurons and memory neurons. For this reason it is only appropriate to think about this example as a direct associative memory if all these intermediate neurons and synapses are integrated out from this system.
\section{Discussion and Conclusions}
We have proposed a general dynamical system and an energy function that has a large memory storage capacity, and, at the same time, is manifestly describable in terms of two-body synaptic connections. From the perspective of neuroscience it suggests that Dense Associative Memory models are not just mathematical tools useful in AI, but have a degree of biological plausibility similar to that of the conventional continuous Hopfield networks \citep{Hopfield84}. Compared to the latter, these models have a greater degree of psychological plausibility, since they can store a much larger number of memories, which is necessary to explain memory-based animal behavior.
We want to emphasize that the increase in the memory storage capacity that is achieved by modern Hopfield networks is a result of unfolding the effective theory and addition of (hidden) neurons. By adding these extra neurons we have also added synapses. Coming back to the information counting argument that we presented in the introduction, the reason why these unfolded models have a larger storage capacity than the conventional Hopfield networks with the same number of input neurons is because they have more synapses, but each of those synapses has the same information capacity as in the conventional case.
From the perspective of AI research our paper provides a conceptually grounded derivation of various associative memory models discussed in the literature, and relationships between them. We hope that the more general formulation, presented in this work, will assist in the development of new models of this class that could be used as building components of new recurrent neural network architectures.
\section*{Acknowledgements} We are thankful to J.~Brandstetter, S.~Hochreiter, M.~Kopp, D.~Kreil, H.Ramsauer, D.~Springer, and F.~Tang for useful discussions.
\section*{Appendix A}
In this appendix we show a step by step derivation of the change of the energy function (\ref{energy}) under dynamics (\ref{dynamical equations}). Time derivative of the energy function can be expressed through time derivatives of the neuron's activities $v_i$ and $h_\mu$ (the input current $I_i$ is assumed to be time-independent in the calculation below). Using the definition of the functions $f_\mu$ and $g_i$ in (\ref{Lagrangian_def}) one can obtain
\begin{equation}
\begin{split}
\frac{dE}{dt} &= \sum\limits_{i,j} \big(v_i - I_i\big) \frac{\partial^2 L_v}{\partial v_i \partial v_j} \frac{d v_j}{dt} + \sum\limits_{\mu,\nu} h_\mu \frac{\partial^2 L_h}{\partial h_\mu \partial h_\nu} \frac{d h_\nu}{dt} \\ &- \sum\limits_{\mu, \nu} \frac{dh_\nu}{dt} \frac{\partial^2 L_h}{\partial h_\nu \partial h_\mu} \Big(\sum\limits_i \xi_{\mu i} g_i\Big) -\sum\limits_{i, j} \frac{dv_j}{dt} \frac{\partial^2 L_v}{\partial v_j \partial v_i} \Big(\sum\limits_\mu \xi_{i\mu} f_\mu \Big) =\\& - \sum\limits_{i,j} \frac{dv_j}{dt}\frac{\partial^2 L_v}{\partial v_j \partial v_i} \Big[ \sum\limits_\mu \xi_{i\mu} f_\mu + I_i - v_i \Big] - \sum\limits_{\mu,\nu} \frac{dh_\nu}{dt} \frac{\partial^2 L_h}{\partial h_\nu \partial h_\mu}\Big[ \sum\limits_i \xi_{\mu i} g_i - h_\mu \Big] =\\& - \tau_f \sum\limits_{i,j=1}^{N_f} \frac{d v_i}{dt} \frac{\partial^2 L_v}{\partial v_i \partial v_j} \frac{d v_j}{dt} - \tau_h \sum\limits_{\mu,\nu = 1}^{N_h} \frac{d h_\mu}{dt} \frac{\partial^2 L_h}{\partial h_\mu \partial h_\nu} \frac{d h_\nu}{dt} \leq 0
\end{split}
\end{equation}
In the last equality sign the right hand sides of dynamical equations (\ref{dynamical equations}) are used to replace expressions in the square brackets by the corresponding time derivatives of the neuron's activities. This completes the proof that the energy function decreases on the dynamical trajectory described by equations (\ref{dynamical equations}) for arbitrary time constants $\tau_f$ and $\tau_h$ provided that the Hessians for feature and memory neurons are positive semi-definite.
\section*{Appendix B. The limit of standard continuous Hopfield networks.}
In this section we explain how the classical formulation of continuous Hopfield networks \citep{Hopfield84} emerges from the general theory (\ref{dynamical equations},\ref{energy}). Continuous Hopfield networks for neurons with graded response are typically described by the dynamical equations
\begin{equation}
\tau_f \frac{d v_i}{dt} = \sum\limits_{j=1}^{N_f}T_{ij} g_j - v_i + I_i
\label{class_Hopfield_net_contin_eqn}
\end{equation}
and the energy function
\begin{equation}
E = -\frac{1}{2}\sum\limits_{i,j=1}^{N_f} T_{ij} g_i g_j - \sum\limits_{i=1}^{N_f} g_i I_i + \sum\limits_{i=1}^{N_f} \int\limits^{g_i} g^{-1}(z)dz
\label{class_Hopfield_net_contin_energy}
\end{equation}
where, as in Section \ref{sec:modelA}, $g_i = g(v_i)$, and $g^{-1}(z)$ is the inverse of the activation function $g(x)$.
According to our classification, this model is a special limit of the class of models that we call models A, with the following choice of the Lagrangian functions
\begin{equation}
L_v = \sum\limits_{i=1}^{N_f}\int\limits^{v_i} g(x) dx,\ \ \ \ \ \text{and}\ \ \ \ \ L_h = \frac{1}{2} \sum\limits_{\mu=1}^{N_h} h_\mu^2
\end{equation}
that, according to the definition (\ref{Lagrangian_def}), lead to the activation functions
\begin{equation}
g_i = g(v_i), \ \ \ \ \ \text{and}\ \ \ \ \ f_\mu = h_\mu
\end{equation}
Similarly to Section \ref{sec:modelA}, we integrate out the hidden neurons to demonstrate that the system of equations (\ref{dynamical equations}) reduces to the equations on the feature neurons (\ref{class_Hopfield_net_contin_eqn}) with $T_{ij} = \sum\limits_{\mu=1}^{N_h} \xi_{\mu i }\xi_{\mu j}$. The general expression for the energy (\ref{energy}) reduces to the effective energy
\begin{equation}
E = -\frac{1}{2} \sum\limits_{i,j=1}^{N_f} T_{ij} g_i g_j - \sum\limits_{i=1}^{N_f} g_i I_i +\sum\limits_{i=1}^{N_f} \Big( v_i g_i - \int\limits^{v_i} g(x)dx \Big)\label{class_Hopfield_net_contin_energy_effective}
\end{equation}
While the first two terms in equation (\ref{class_Hopfield_net_contin_energy}) are the same as those in equation (\ref{class_Hopfield_net_contin_energy_effective}), the third terms look superficially different. In equation (\ref{class_Hopfield_net_contin_energy_effective}) it is a Legendre transform of the Lagrangian for the feature neurons, while in (\ref{class_Hopfield_net_contin_energy}) the third term is an integral of the inverse activation function. Nevertheless, these two expressions are in fact equivalent, since the derivatives of a function and its Legendre transform are inverse functions of each other. The easiest way to see that these two terms are equal explicitly is to differentiate each one with respect to $v_i$. The results of these differentiations for both expressions are equal to $v_i g(v_i)'$. Thus, the two expressions are equal up to an additive constant. This completes the proof that the classical Hopfield network with continuous states \citep{Hopfield84} is a special limiting case of the general theory (\ref{dynamical equations}, \ref{energy}).
| {'timestamp': '2021-04-29T02:04:45', 'yymm': '2008', 'arxiv_id': '2008.06996', 'language': 'en', 'url': 'https://arxiv.org/abs/2008.06996'} | arxiv |
\section{#1 \footnotesize (#2)}}
%
\def\mathop{}\!\mathrm{d}{\mathop{}\!\mathrm{d}}
\def\ip#1{\left\langle#1\right\rangle}
\DeclareMathOperator\vect{vec}
\def\pderiv#1#2{\frac{\partial#1}{\partial#2}}
\newcommand\Var[2][]{%
\ifx\relax\detokenize{#1}\relax%
\mathop{\mathrm{Var}}%
\else%
\mathop{\mathrm{Var}}\limits_{#1}%
\fi%
\left[#2\right]%
}
\newcommand\Ex[2][]{%
\ifx\relax\detokenize{#1}\relax%
\mathop{{\mathbb{E}}}%
\else%
\mathop{{\mathbb{E}}}\limits_{#1}%
\fi%
\left[#2\right]%
}
\wacvfinalcopy
\ifwacvfinal
\def\assignedStartPage{1}
\fi
\ifwacvfinal
\usepackage[breaklinks=true,bookmarks=false]{hyperref}
\else
\usepackage[pagebackref=true,breaklinks=true,colorlinks,bookmarks=false]{hyperref}
\fi
\ifwacvfinal
\setcounter{page}{\assignedStartPage}
\else
\pagestyle{empty}
\fi
\def\mbox{\tt\raisebox{-.5ex}{\symbol{126}}}{\mbox{\tt\raisebox{-.5ex}{\symbol{126}}}}
\begin{document}
\title{Adaptive Signal Variances: CNN Initialization Through Modern Architectures}
\author{Takahiko Henmi, Esmeraldo Ronnie Rey Zara, Yoshihiro Hirohashi, Tsuyoshi Kato\\
Faculty of Science and Technology, Gunma University\\
Kiryu, Tenjin-cho 1-5-1, 376-8515, Japan\\
{\tt\small [email protected]}
}
\maketitle
\begin{abstract}
Deep convolutional neural networks (CNN) have achieved the unwavering confidence in its performance on image processing tasks. The CNN architecture constitutes a variety of different types of layers including the convolution layer and the max-pooling layer. CNN practitioners widely understand the fact that the stability of learning depends on how to initialize the model parameters in each layer. Nowadays, no one doubts that the de facto standard scheme for initialization is the so-called Kaiming initialization that has been developed by He et al. The Kaiming scheme was derived from a much simpler model than the currently used CNN structure having evolved since the emergence of the Kaiming scheme. The Kaiming model consists only of the convolution and fully connected layers, ignoring the max-pooling layer and the global average pooling layer. In this study, we derived the initialization scheme again not from the simplified Kaiming model, but precisely from the modern CNN architectures, and empirically investigated how the new initialization methods perform compared to the de facto standard ones that are widely used today.
\end{abstract}
\section{Introduction}
Deep convolutional neural networks (CNN) have established an unshakable confidence in its power for computer vision including image classification~\cite{Kleinberg-icml18a,Szegedy-cvpr15a,Simonyan-iclr15a}, object detection~\cite{Girshick-iccv15a,ItoSatSan18}, segmentation~\cite{Kaiming-cvpr16a}, and retrieval tasks~\cite{ShengyongDing-patcog15a}. In the past decade, its impressive performance has attracted attention not only of many academic researchers but also a huge number of industrial companies dominating the world. These days it is hard to find a top racer who does not exploit a deep CNN in world-wide computer vision competitions~\cite{Russakovsky-ilsvrc15}.
The predecessor of the current deep CNN structures is the so-called LeNet that is the first neural network developed by LeCun et al~\cite{LeCun-nips89a}. LeNet constitutes the convolution layer and fully connected layer. The hyperbolic tangent function~\cite{LeCunBOM12} is used for activation. LeNet bears a resemblance to primate's visual cortex~\cite{Hubel68a}. The current deep CNN structures made more artificial compared to LeNet. The activation function is now replaced by ReLU~\cite{NairHinton-icml10} in the modern structure. The fully connected layer is often replaced by the global average pooling~\cite{NairHinton-icml10} in order to suppress the overfitting caused by the excessive flexibility of the fully connected layer.
The power of the deep CNN has been enhanced by increasing the capacity of the model, although the deeper structure often sacrifices the numerical stability of optimization. Compared to the hyperbolic tangent or the sigmoid activation functions, the use of ReLU activation may more likely avoid the vanishing gradient problem~\cite{Hochreiter-iju98,NairHinton-icml10}. Compared to the batch gradient descent, the stochastic gradient descent may avoid bad local minima and saddle points with help of its perturbation effect~\cite{Kleinberg-icml18a}. However, these two techniques are not good enough to achieve a stable convergence.
Due to the high non-convexity of the empirical risk function, how to initialize the model parameters including weights and biases affects the stability of optimization. In AlexNet, all the weight parameters are initialized using the zero-mean normal distribution with a constant variance parameter $0.1^{2}$, and all the initial bias parameters are set to one \cite{Krizhevsky2012a}. Glorot et al~\cite{Glorot-icai10a} proposed an initialization method adaptive to the network structure. Their method is referred to as the Xavier method. They regard the network parameters as random variables to derive their initialization method. The result of their analysis is that the inverse of the variance parameter for the zero-mean normal should be the average of the numbers of input units and output units for each layer. In Glorot's model, the hyperbolic tangent function is assumed to be used for activation in every layer, which does not match the fact that the activation function has been replaced to ReLU or its variants and the hyperbolic tangent and the sigmoid activation have been disposed in most of the currently used CNN structures.
At present, the \textit{de facto} standard initialization method is the Kaiming method that was proposed by He et al~\cite{Kaiming-iccv15}. They substituted the ReLU function to the activation function and analyzed the random network in the fashion similar to Glorot et al's analysis. Kaiming method enables us to train deeper structures stably which cannot be optimized by Xavier method. However, Kaiming method is still much simplified compared to the greatly evolved current CNN model. Their model does not account for the subsampling layers such as the max pooling layer and the global average pooling layer, which gives rise to two questions; (i) Is it possible to derive an initialization method from a more precise CNN model? (ii) How does the gradient descent work when using a more precise initialization model?
In this paper, we propose a new initialization method which takes account the subsampling layers, whether it is the max pooling or the global average pooling layer. We show that this proposed initialization method adopts a more precise CNN structure that analyzes the signal variances for the forward and backward signals. We show that this proposed method is an extension of the Kaiming method, includes all its basic components and takes into account the padding operation.
We empirically investigate how the new initialization method performs compared to the de facto standard ones that are widely used today.
\section{Related Work}
The most popular initialization methods are the Xavier method and the Kaiming method. Both of them are derived from random networks drawn from normal distributions. Similar random models have long been used to understand optimization and generalization of deep neural structures so far.
The difficulty of the analysis of neural networks lie in the non-convex empirical risks. The alternative is the convex formulation of the empirical risk that is the network without hidden layers. Conventional linear models such as the logistic regression, the support vector machine and their kernelized models belong to the network without hidden layers. All local minima of such networks are global minima, which eliminates the dependency on the initial solution~\cite{Venturi-jmlr19,YuanzhiLi-arxiv17}. In contrast, deep structures suffer from many local minima, which means that starting the gradient descent from different initial guesses yields different solutions.
The reason why many theoretical works employed the normal distributions is from its strong connection with Gaussian process~\cite{Neal-book12,JaehoonLee-iclr18a,Koriyama-ast20a,Blomqvist-mlkdd20}. Some researches considered over-parameterized models in which all the local minima approach to zero meaning that they all are nearly a global minimum~\cite{SimonDu-nips18,DifanZou-arxiv18a}.
Another advantage of over-parameterization is that the gradient descent rapidly converges to a local minimum because any of the approximately initialized solutions are near to the local minimum in such a model~\cite{DifanZou-arxiv18a}. However, such a model consumes a large space complexity, which requires expensive computational resources for choosing an over-parameterized CNN structure. Some theoretical studies attempt to understand the global landscape of the empirical risk function~\cite{LiangShiyu-icm18a}. They assume a single hidden layer, although many reports empirically showed that deeper structures perform better than shallow structure for computer vision~\cite{Kaiming-cvpr16a}.
Thus, the CNN structures practically trainable with a reasonable computational resource differ far away from the models assumed in theoretical works. In contrast, our analysis yields a practical method, yet the assumption used in this study is realistic.
\begin{figure*}
\centering
\begin{tabular}{ll}
(a) Convolution & (b) Fully Connected
\\
\includegraphics[width=.45\linewidth]{001-formulation-convolution.eps}
&
\includegraphics[width=.45\linewidth]{002-formulation-fully-connected.eps}
\\
\\
(c) Activation function & (d) Pooling operations
\\
\includegraphics[width=.45\linewidth]{003-formulation-activation.eps}
&
\includegraphics[width=.45\linewidth]{004-formulation-pooling.eps}
\end{tabular}
\caption{Our CNN model.
Panel (a) depicts a convolution operation that computes
a unit $u_{i}^{(\ell)}$ in $\ell$th layer.
The $i$th unit is in $c(i,\ell)$th channel.
The convolution takes a part of signals in ${\mathbf{z}}^{(\ell-1)}\in M_{\ell}$.
The part is specified by a index set $\vs(\ell,i)$.
Panel (b) depicts a fully connected layer that is
a special case of the convolution operation
where $\vs(\ell,i)=[M_{\ell}]$.
Panel (c) explains an activation function $f_{\ell}$
such as sigmoid and ReLU. Activation functions
transform signals component-wise.
In the panel (d), the max pooling and the average
pooling, denoted by $g_{\ell}$, are explained.
Pooling functions aggregates a part of signals ${\mathbf{v}}^{(\ell)}\in M'_{\ell}$.
The sub-vector is specified by the index set ${\mathbf{t}}(\ell,i)$.
\label{fig:formulation-visualized}}
\end{figure*}
\begin{table*}[t!]
\caption{Notation used for describing the forward propagation.
\label{tab:fornot} }
\centering
\begin{tabular}{rl}
\\
\hline
Symbol & Description
\\
\hline \hline
$C_{\ell} \in{\mathbb{N}}$ & Number of channels.
\\
$S_{\ell} \in{\mathbb{N}}$ & Receptive field size.
\\
$c(\ell,i)\in[C_\ell]$ & Channel containing $i$th unit.
\\
${\mathbf{a}}(\ell,i)\subseteq[S_\ell]$ & Index set for convolution kernel.
\\
$\vs(\ell,i)\subseteq[M_{\ell-1}]$ & Index set of units fed to the convolution operation
producing $u_{i}^{(\ell)}$. $|\vs(\ell,i)|=|{\mathbf{a}}(\ell,i)|$.
\\
$M^\prime_\ell\in{\mathbb{N}}$ & Number of units just after convolution.
\\
$f_\ell:{\mathbb{R}}\to{\mathbb{R}}$ & Activation function.
\\
$T_\ell\in{\mathbb{N}}$ & Size of aggregation region.
\\
$g_\ell:{\mathbb{R}}^{T_{\ell}}\to{\mathbb{R}}$ & Pooling function.
\\
${\mathbf{t}}(\ell,i)\subseteq[M^\prime_\ell]$ & Aggregation region.
The subsets divides $[M^\prime_\ell]$ exclusively. $|{\mathbf{t}}(\ell,i)|=T_{\ell}$.
\\
$M_{\ell}\in{\mathbb{N}}$ & Size of signals ${\mathbf{z}}^{(\ell)}$.
\\
\hline
\end{tabular}
\end{table*}
\begin{table*}[t!]
\caption{Notation used for describing the backward propagation.
\label{tab:backnot} }
\centering
\begin{tabular}{rl}
\\
\hline
Symbol & Description
\\
\hline \hline
$J_\ell\in{\mathbb{N}}$ & Size of backward weights for convolution.
\\
${\tilde{\mathbf{w}}}_{c}^{(\ell)}\in{\mathbb{R}}^{J_\ell}$ & Backward weights for convolution.
\\
$\tilde{C}_{\ell}\in{\mathbb{N}}$ & Number of backward weights for convolution.
\\
$\tilde{c}(\ell,i)\in[\tilde{C}_\ell]$ & Channel index of backward weights.
\\
${\mathbf{h}}(\ell,i)\subseteq[J_\ell]$ & Index set of backward weights for convolution.
\\
${\mathbf{j}}(\ell,i)\subseteq[M^\prime_\ell]$ & Index set of backward signals for convolution.
$|{\mathbf{j}}(\ell,i)|=|{\mathbf{h}}(\ell,i)|$.
\\
$d(\ell,i)\in[M_\ell]$ & Unit index propagating a backward signal to $i$th unit in pooling.
\\
\hline
\end{tabular}
\end{table*}
\newcommand{\includegraphics[width=1em]{005-checked.eps}}{\includegraphics[width=1em]{005-checked.eps}}
\newcommand{\includegraphics[width=1em]{006-checked-shiro.eps}}{\includegraphics[width=1em]{006-checked-shiro.eps}}
\begin{table}[t!]
\centering
\caption{%
Comparison with the existing methods. %
The models deriving the existing methods do not include some components of CNN, although the model in this study expresses the CNN more precisely by fully containing all components of CNN. FC and Conv are the abbreviations of the fully connected layer and the convolution layer, respectively. The Kaiming model contains the convolution layer, although the padding operation is not considered. \label{tbl:compare-init}}
\begin{center}
\begin{tabular}{|c|c|c|c|c|}
\hline
Methods & FC & ReLU & Conv & Pooling \\
\hline
Xavier & \includegraphics[width=1em]{005-checked.eps} & & & \\
\hline
Kaiming & \includegraphics[width=1em]{005-checked.eps} & \includegraphics[width=1em]{005-checked.eps} & \includegraphics[width=1em]{006-checked-shiro.eps} & \\
\hline
Proposed & \includegraphics[width=1em]{005-checked.eps} & \includegraphics[width=1em]{005-checked.eps} & \includegraphics[width=1em]{005-checked.eps} & \includegraphics[width=1em]{005-checked.eps} \\
\hline
\end{tabular}
\end{center}
\end{table}
\section{CNN Models}\label{sec:cnnmdl}
In this section, we re-formulate CNN structures to clarify the range of the CNN extensions we account for in this study. Usually, CNN is expressed as a chain of many different types of components such as the convolution layer, the activation unit, the pooling layer, and the fully connected layer. In our formulation, every layer, named \emph{Conv+Pool} layer is homogeneous and capable to perform convolution, activation, and pooling. As seen later, the Conv+Pool layer can express the convolution layer without the pooling operation, the global average layer as well as the fully connected layer. Hereinafter, we may refer to the Conv+Pool layer as a layer.
When using CNN for image processing tasks, two-dimensional convolution is performed. For speech recognition, the number of dimensions of the convolution operation is one \cite{Kalchbrenner-acl14}. In general, input signals and intermediate signals traversing in CNN are tensors. The order of tensors expressing signals depends on the applications. To make the notation simpler and to unify the formulations for any order of tensors, all signals are unfolded into a vector in our formulation.
\subsection{Forward Signals}
Let $L$ be the number of the Conv+Pool layers in a CNN structure.
The $\ell$th layer has weight parameters
${\mathbf{W}}^{(\ell)}:=\left[{\mathbf{w}}_{1}^{(\ell)},\dots,{\mathbf{w}}_{C_{\ell}}^{(\ell)}\right]^\top\in{\mathbb{R}}^{C_{\ell}\times S_{\ell}}$
and bias parameters
${\mathbf{b}}^{(\ell)}:=\left[b_{1}^{(\ell)},\dots,b_{C_{\ell}}^{(\ell)}\right]^\top\in{\mathbb{R}}^{C_{\ell}}$.
The $\ell$th Conv+Pool layer transforms the signal ${\mathbf{z}}^{(\ell-1)}\in{\mathbb{R}}^{M_{\ell-1}}$ fed to the layer, and conveys the transformed signal to the next layer.
The input signals of the entire structure ${\mathbf{z}}^{(0)}$ are first fed to the first layer
and finally signals ${\mathbf{z}}^{(L)}\in{\mathbb{R}}^{M'_{L}}$ are transmitted as
shown in Figure~\ref{fig:forbacksig}(a).
\begin{figure*}
(a) Forward signals
\begin{tsaligned}
{\mathbf{z}}^{(0)}\in{\mathbb{R}}^{M_{0}}
&
\stackrel{\text{Conv}}{\mapsto}
{\mathbf{u}}^{(1)}\in{\mathbb{R}}^{M'_{1}}
\stackrel{\text{Act}}{\mapsto}
{\mathbf{v}}^{(1)}\in{\mathbb{R}}^{M'_{1}}
\stackrel{\text{Pool}}{\mapsto}
{\mathbf{z}}^{(1)}\in{\mathbb{R}}^{M_{1}}
\stackrel{\text{Conv}}{\mapsto} \cdots
\\
& \stackrel{\text{Conv}}{\mapsto}
{\mathbf{u}}^{(L-1)}\in{\mathbb{R}}^{M'_{L-1}}
\stackrel{\text{Act}}{\mapsto}
{\mathbf{v}}^{(L-1)}\in{\mathbb{R}}^{M'_{L-1}}
\stackrel{\text{Pool}}{\mapsto}
{\mathbf{z}}^{(L-1)}\in{\mathbb{R}}^{M_{L-1}}
\stackrel{\text{Conv}}{\mapsto}
{\mathbf{u}}^{(L)}\in{\mathbb{R}}^{M'_{L}}.
\end{tsaligned}
(b) Backward signals.
\begin{tsaligned}
\Delta {\mathbf{u}}^{(L)}\in{\mathbb{R}}^{M'_{L}}
&
\stackrel{\text{}}{\mapsto}
\Delta {\mathbf{z}}^{(L-1)}\in{\mathbb{R}}^{M_{L-1}}
\stackrel{\text{}}{\mapsto}
\Delta {\mathbf{v}}^{(L-1)}\in{\mathbb{R}}^{M'_{L-1}}
\stackrel{\text{}}{\mapsto}
\dots
\\
&
\stackrel{\text{}}{\mapsto}
\Delta {\mathbf{z}}^{(1)}\in{\mathbb{R}}^{M_{1}}
\stackrel{\text{}}{\mapsto}
\Delta {\mathbf{v}}^{(1)}\in{\mathbb{R}}^{M'_{1}}
\stackrel{\text{}}{\mapsto}
\Delta {\mathbf{u}}^{(1)}\in{\mathbb{R}}^{M'_{1}}.
\end{tsaligned}
\caption{Forward signals and backward signals. The first forward signal ${\mathbf{z}}^{(0)}$ is the input of CNN such as an RGB image. In that case, $M_{0}$ is three times the number of pixels in the RGB image. For the application of multi-category classification, $M^{\prime}_{L}$. \label{fig:forbacksig}}
\end{figure*}
For convenience of notation,
we add two signal vectors in the last layer,
${\mathbf{v}}^{(L)}:={\mathbf{u}}^{(L)}$ and ${\mathbf{z}}^{(L)}:={\mathbf{v}}^{(L)}$.
The following equations \eqref{eq:def:layer-conv},
\eqref{eq:def:layer-act}, and
\eqref{eq:def:layer-pool}, respectively,
express the operations of convolution,
activation, and pooling:
\begin{align}
\label{eq:def:layer-conv}
u^{(\ell)}_i&=\left<{\mathbf{w}}^{(\ell)}_{c(\ell,i),{\mathbf{a}}(\ell,i)},
{\mathbf{z}}^{(\ell-1)}_{\vs(\ell,i)}\right>+b^{(\ell)}_{c(\ell,i)},
\\
\label{eq:def:layer-act}
v^{(\ell)}_i&=f_\ell\left(u^{(\ell)}_i\right),
\\
\label{eq:def:layer-pool}
z^{(\ell)}_{i}&=g_\ell\left({\mathbf{v}}^{(\ell)}_{{\mathbf{t}}(\ell,i)}\right).
\end{align}
where we have used the notation described in Table~\ref{tab:fornot}.
Therein,
${\mathbf{w}}^{(\ell)}_{c(\ell,i),{\mathbf{a}}(\ell,i)}$ is a subvector of
${\mathbf{w}}_{c(\ell,i)}^{(\ell)}\in{\mathbb{R}}^{S_{\ell}}$ with its entries
specified by a set of indices ${\mathbf{a}}(\ell,i)$;
the symbol $z^{(\ell)}_{i}$ is the $i$th entry of the transformed signal ${\mathbf{z}}^{(\ell)}$;
the symbol ${\mathbf{z}}^{(\ell-1)}_{\vs(\ell,i)}$ is a subvector of the signal ${\mathbf{z}}^{(\ell-1)}$
with entries corresponding to a set of indices~$\vs(\ell,i)\subseteq [S_{\ell}]$.
Each operation is detailed in Section~\ref{sec:detailed-formulation}.
Here, brief descriptions are given.
\begin{itemize}
%
\item \textbf{Convolution: }
In case that the previous layer has a single channel,
the convolution operation
for obtaining the signals sent to the channel $c$ in the next layer
can be expressed as the inner-product between a kernel
${\mathbf{w}}_{c}^{(\ell)}\in{\mathbb{R}}^{S_{\ell}}$ and a subvector of the fed signal ${\mathbf{z}}^{(\ell-1)}$.
In case that the previous layer has $C_{\ell-1}$ channels,
the vector ${\mathbf{w}}_{c}^{(\ell)}\in{\mathbb{R}}^{S_{\ell}}$ is the concatenation
of $C_{\ell-1}$ kernels.
For the majority entries in ${\mathbf{u}}^{(\ell)}\in{\mathbb{R}}^{}$.
the index set for the kernel in \eqref{eq:def:layer-conv}
is set to ${\mathbf{a}}(\ell,i)=[S_{\ell}]$.
For representing the \emph{padding},
the index set is setting to a subset ${\mathbf{a}}(\ell,i)\subsetneq[S_{\ell}]$.
See Figure~\ref{fig:formulation-visualized}(a).
%
\item \textbf{Activation: }
A typical choice for the function $f_{\ell}:{\mathbb{R}}\to{\mathbb{R}}$ is ReLU.
Function $f_{\ell}$ is the identity function for the layer without activation.
See Figure~\ref{fig:formulation-visualized}(c).
%
\item \textbf{Pooling: }
Function $g_{\ell}:{\mathbb{R}}\to{\mathbb{R}}$ performs subsampling by aggregating a part of entries in the nonlinearly transformed signals ${\mathbf{u}}^{(\ell)}\in{\mathbb{R}}^{M'_{\ell}}$. The subsampling part is specified by the index set ${\mathbf{t}}(\ell,i)\subset[M'_{\ell}]$.
See Figure~\ref{fig:formulation-visualized}(d).
\end{itemize}
The fully connected layer is a special case of the Conv+Pool layer,
which can be shown by letting ${\mathbf{a}}(\ell,i):=[M_{\ell}]$ and $\vs(\ell,i):=[M_{\ell}]$
and by setting $f_{\ell}$ and $g_{\ell}$ to the identity function.
See Figure~\ref{fig:formulation-visualized}(b).
\subsection{Backward Signals}
CNN is trained by minimizing the empirical risk $E$ with respect to the model parameters ${\mathbf{\theta}}=({\mathbf{W}}^{(\ell)},{\mathbf{b}}^{(\ell)})_{\ell\in[L]}$. The stochastic gradient descent applied to neural networks is called the back-propagation algorithm that conveys the signals $\Delta{\mathbf{z}}_{i}^{(\ell)}$ in the backward direction, as
shown in Figure~\ref{fig:forbacksig}(b), where we have defined
the backward signals as
\begin{tsaligned}
\Delta{\mathbf{z}}^{(\ell-1)}=\pderiv{E}{{\mathbf{z}}^{(\ell-1)}},
~
\Delta{\mathbf{u}}^{(\ell)}=\pderiv{E}{{\mathbf{u}}^{(\ell)}},
~
\Delta{\mathbf{v}}^{(\ell)}=\pderiv{E}{{\mathbf{v}}^{(\ell)}},
\end{tsaligned}
The backward signals are conveyed with the following recursive expressions:
\begin{align}
\label{eq:formulation:conv-backward}
\Delta z^{(\ell-1)}_i&=\left<
{\tilde{\mathbf{w}}}^{(\ell)}_{\tilde{c}(\ell,i),{\mathbf{h}}(\ell,i)},
\Delta{\mathbf{u}}^{(\ell)}_{{\mathbf{j}}(\ell,i)}\right>,\\
\Delta u^{(\ell)}_i&=\Delta v^{(\ell)}_i
\pderiv{v^{(\ell)}_i}{u^{(\ell)}_i},\\
\Delta v^{(\ell)}_i&=\Delta z^{(\ell)}_{d(\ell,i)}
\pderiv{z^{(\ell)}_{d(\ell,i)}}{v^{(\ell)}_i},
\end{align}
where we have used the notation described in Table~\ref{tab:backnot}. In Section ~\ref{sec:detailed-formulation}, we describe the details on how the back propagation rules are derived from the standard tensor representation of the CNN structure.
\section{Initialization Methods}
In this section, we present two new methods for initializing the model parameters ${\mathbf{\theta}}=({\mathbf{W}}^{(\ell)},{\mathbf{b}}^{(\ell)})_{\ell\in[L]}$. Following the Xavier and Kaiming methods, the initial values are set to random numbers generated with zero-mean normal distributions:
\begin{tsaligned}\label{eq:init-probmdl}
w^{(\ell)}_{i,j}\sim{\mathcal{N}}(0,\sigma^2_{w^{(\ell)}}),\quad
b^{(\ell)}_i\sim{\mathcal{N}}(0,\sigma^2_{b^{(\ell)}}).
\end{tsaligned}
Notice that the variance parameters of the weight parameters and the bias parameters in the same layer are common.
The existing methods assume that the model parameters approximately follow the distribution~\eqref{eq:init-probmdl} during the gradient descent.
\subsection{Variances of Signals}
\label{ss:var-sig}
Under the assumption~\eqref{eq:init-probmdl}, the variances of the forward and backward signals can be analyzed. In order to avoid signal vanishing or signal explosion, the existing methods determine the two initialization parameters, $\sigma^2_{w^{(\ell)}}$ and $\sigma^2_{b^{(\ell)}}$ so that the variances of the forward or backward signals are kept approximately equal. Along this line, we developed an initialization method. The difference from the existing methods is that a more precise CNN structure is adopted to analyze the signal variances.
Below we present recursive expressions of the signal variances and then the new initialization methods. The details of the derivations are given in Section~\ref{sec:variance}.
\textbf{Variances of forward signals: }
Let us denote the variance of, $u_{i}^{(\ell)}$, $i$th unit in the $\ell$th layer by $q^{(\ell)}_{i}$. Suppose that, for the previous layer (i.e. $(\ell-1)$th layer), each signal in ${\mathbf{u}}^{(\ell-1)}$ follows independently according to an identical distribution ${\mathcal{N}}(0,q^{(\ell-1)})$ where $q^{(\ell-1)}$ is the average of $M'_{\ell-1}$ quantities $q^{(\ell-1)}_{1},\dots, q^{(\ell-1)}_{M'_{\ell}}$. If assuming that $q^{(\ell)}_{i}= q^{(\ell)}$ for all units in $\ell$th layer, we have that:
\begin{tsaligned}\label{eq:var-forward}
q^{(\ell)}=\sigma^2_{b^{(\ell)}}
+\sigma^2_{w^{(\ell)}}q^{(\ell-1)}\tau_{\ell-1}
\frac{1}{M^\prime_\ell}\varepsilon_\ell,
\end{tsaligned}
where $\tau_{\ell}$ is a constant defined as
\begin{tsaligned}
\tau_{\ell}
:=
T_\ell\int_0^\infty
s^2\phi(s)\Phi(s)^{T_\ell-1} d s
\end{tsaligned}
if $g_{\ell}$ is the max pooling function, and
\begin{tsaligned}
\tau_{\ell}
:=
\frac{1}{2T_\ell}
\left(1+\frac{T_\ell-1}{\pi}\right)
\end{tsaligned}
if $g_{\ell}$ is the average pooling function.
Therein, $T_\ell$ is the size of the pooling range;
$\phi,\Phi$ is the normal density function and its cumulative;
the definition of $\varepsilon_{\ell}$ is the total number of connections between the $(\ell-1)$th and $\ell$th layers.
Let us verify how appropriate the assumptions and the approximations used to derive \eqref{eq:var-forward}.
The quantities $q^{(\ell)}_{1},\dots, q^{(\ell)}_{M'_{\ell}}$ are not necessarily be equal to each other (i.e. $q^{(\ell)}_{i}\ne q^{(\ell)}_{j}$ for $i\ne j$), although most of $q^{(\ell)}_{i}$ are equal to each other when the image size is enough large. The normality assumption is justified if channels in the layer are many.
\textbf{Variances of backward signals: }
Assume that each signal in $\Delta{\mathbf{z}}^{(\ell)}$ is identically and independently drawn according to ${\mathcal{N}}(0,r^{(\ell)})$ and that the statistical independence between $\Delta z^{(\ell)}_{d(\ell,j)}$ and $\partial z^{(\ell)}_{d(\ell,j)}/\partial u^{(\ell)}_j$ for $j\in{\mathbf{j}}(\ell,j)$. Under this assumption, we obtain that
\begin{tsaligned}\label{eq:var-backward}
r^{(\ell-1)}=\sigma^2_{w^{(\ell)}}r^{(\ell)}
\gamma_\ell\frac{1}{M_{\ell-1}}\varepsilon_\ell
\end{tsaligned}
where $\gamma_{\ell}$ is defined as
\begin{tsaligned}
\gamma_{\ell}
:=
\frac{2^{T_\ell}-1}{T_\ell2^{T_\ell}}
\end{tsaligned}
if $g_{\ell}$ is the max pooling function, and
\begin{tsaligned}
\gamma_{\ell}
:=
\frac{1}{2T_\ell^2}
\end{tsaligned}
if $g_{\ell}$ is the average pooling function.
\subsection{Proposed Initialization Methods}
\label{ss:proposed-meth}
The above observations lead to the methods for maintaining the variances of the signals. Here, we choose the initial bias parameters to ${\mathbf{b}}^{(\ell)}=0$, corresponding to $\sigma_{b^{(\ell)}}^{2}=0$, and $q^{(0)}=r^{(L)}=1$. With these additional conditions, it can be seen that the two following methods, respectively, keep $q^{(\ell)}=1$ and $r^{(\ell)}=1$ for all layers.
\begin{oframed}
\textbf{ASV Forward Method:}
\begin{equation}
\label{eq:init-forward}
\sigma^2_{w^{(\ell)}}=\frac{M^\prime_\ell}{\tau_{\ell-1}\varepsilon_\ell}.
\end{equation}
\end{oframed}
\begin{oframed}
\textbf{ASV Backward Method:}
\begin{equation}
\label{eq:init-backward}
\sigma^2_{w^{(\ell)}}=\frac{M_{\ell-1}}{\gamma_\ell\varepsilon_\ell}.
\end{equation}
\end{oframed}
\begin{table*}[t!]
\centering
\caption{
Structure of 34-layer architecture. In this model, Max Pooling is used in layer $\ell = 1$, Global Average Pooling is used in the last layer of the feature extraction $\ell = 33$ and stride is used in the other convolution layers to change the resolution of feature map.
\label{tab:arch}}
\begin{tabular}{|c|}
\hline
Component \verb|InputBlock|($c$)\\
\hline
Conv(7x7,channels=$c$,padding=3,stride=2),\\
MaxPool(3x3,padding=1,stride=2)\\
\hline
\end{tabular}\\\vspace{1ex}
\begin{tabular}{|c|}
\hline
Component \verb|ConvBlock|($c,s=1$)\\
\hline
Conv(3x3,channels=$c$,padding=1,stride=$s$),\\
Conv(3x3,channels=$c$,padding=1,stride=1)\\
\hline
\end{tabular}\\\vspace{1ex}
\begin{tabular}{|c|c|l|}
\hline
$\ell$-th Layer&Output Shape&34-layer Architecture\\
\hline
\hline
&(3,224,224) &Input Image\\
\hline
1&(64,112,112)&\verb|InputBlock|($c=64$)\\
\hline
$2$--$7$&(64,56,56) &\verb|ConvBlock|($c=64$)$\times3$\\
\hline
$8$--$15$&(128,28,28)&\verb|ConvBlock|($c=128,s=2$)\\
&&\verb|ConvBlock|($c=128$)$\times3$\\
\hline
$16$--$27$&(256,14,14)&\verb|ConvBlock|($c=256,s=2$)\\
&&\verb|ConvBlock|($c=256$)$\times5$\\
\hline
$28$--$33$&(512,7,7)&\verb|ConvBlock|($c=512,s=2$)\\
&&\verb|ConvBlock|($c=512$)$\times2$\\
&(512,1,1) &Global Average Pooling\\
\hline
$34$&10 &Linear\\
\hline
\hline
&$2.11\times10^7$&Number of Parameters\\
\hline
\end{tabular}
\end{table*}
\section{Discussions}
Table~\ref{tbl:compare-init} compares the proposed initialization method with the two existing methods, the Kaiming and Xavier methods.
The proposed method is an extension of the Kaiming method by including all basic components in the model, as shown below. First we discuss the forward method. Here we assume that the convolution operation performs without padding. Let the kernel size be $k\times k\times d$. Then, $|\vs(\ell,i)|=k^{2}d$. Because the Kaiming method ignores the pooling layer, we further assume that the structure does not have any pooling layer. This can be realized in our model by setting all $g_{\ell}$ to the identity function, yielding $T_{\ell}=1$ and thereby $\tau_{\ell}=1/2$. Under these assumptions, we can then re-write the forward initialization method~\eqref{eq:init-forward} as
\begin{tsaligned}
\sigma^2_{w^{(\ell)}}
=\frac{M^\prime_\ell}{\tau_{\ell-1}\varepsilon_\ell}
=\frac{2M^\prime_\ell}{M^\prime_\ell\cdot k^2d}
=\frac{2}{k^2d}
\end{tsaligned}
This concludes that the proposed forward method coincides with the Kaiming's forward method.
For the backward method, we use a similar assumption to fit our model to the Kaiming's simplified model. Let $d'$ be the number of channels of the next layer. Then, $|{\mathbf{j}}(\ell,i)|=k^2d^\prime$ and $\gamma_\ell=1/2$. We observe that the number of forward connections equals to the number of backward connections, we have $\varepsilon_\ell=\sum_{i=1}^{M_{\ell-1}}|{\mathbf{j}}(\ell,i)|$. Under these assumptions, the backward method can be rewritten as
\begin{tsaligned}
\sigma^2_{w^{(\ell)}}
=\frac{M_{\ell-1}}{\gamma_\ell\varepsilon_\ell}
=\frac{2M_{\ell-1}}{M_{\ell-1}k^2d^\prime}
=\frac{2}{k^2d^\prime}
\end{tsaligned}
implying that our backward method is equal to the Kaiming's backward method.
The proposed methods behaves as follows.
For a convolution layer with padding, a less number of signals are fed to the convolution operation applied to the corner or the border of images. More precisely, the cardinality of $\vs(\ell,i)$ for the corner or the border is smaller than that for other areas, and so $\varepsilon_{\ell}$, which increases $\sigma_{w^{(\ell)}}^{2}$. Meanwhile, the Kaiming method does not consider the padding operation, which causes the difference between the proposed and Kaiming methods.
We next observe the behaviors of the two types of pooling layers in the forward analysis. For a layer equipped with the max pooling, a larger $T_{\ell}$ yields a larger $\tau_{\ell}$, making smaller $\sigma_{w^{(\ell)}}^{2}$ of the proposed initialization method~\eqref{eq:init-forward}. Actually, the maximum of multiple random variables with zero mean has a larger second moment than that of the individual random variable. The proposed forward method can suppress the effect by setting $\sigma_{w^{(\ell)}}^{2}$ to a smaller value.
For a layer having the average pooling, a larger $T_{\ell}$ gets $\tau_{\ell}$ smaller and thereby the variance parameter determined by the initialization method, say $\sigma_{w^{(\ell)}}^{2}$, is increased. In general, taking the average of random variables with zero mean yields a smaller signal variance. The proposed forward method compensates this effect by giving a larger variance parameter $\sigma_{w^{(\ell)}}^{2}$.
We finally see how the proposed backward method behaves for the two types of pooling layers. For the max pooling operation, as $T_{\ell}$ is larger, $\tau_{\ell}$ is smaller, increasing $\sigma_{w^{(\ell)}}^{2}$ as in \eqref{eq:init-backward}. In the backward propagation, only the winner unit propagates the signal to the shallower layers, that decreases the signal variance in the shallower layer. To keep the backward signal variance to be equal to one, the proposed backward method gives a larger variance parameter $\sigma_{w^{(\ell)}}^{2}$.
For the average pooling operation, the proposed backward method increases $\sigma_{w^{(\ell)}}^{2}$ as $T_{\ell}$ increases, because a larger $T_{\ell}$ increases a smaller $\gamma_{\ell}$. For the average pooling operation, a backward signal is divided evenly and sent back to the units in the previous layer, decreasing the backward signal variance. The proposed backward method compensates this effect by setting $\sigma_{w^{(\ell)}}^{2}$ to a larger value.
\begin{table*}[t!]
\centering
\caption{Validation accuracies of 34-layer architecture using different initialization methods for various learning rates. For each learning rate $lr$, each initialization method provides an initial value for the model. The numerical values in the table represent the highest accuracy rate in a span of 1000 epochs. The numbers in italics indicate the best value in each initialization method and the bold face numbers represent the best performance for the entire table.
\label{tab:acc.g2}}
\begin{tabular}{l}
(a) Car
\\
\begin{tabular}{|c|c|c|c|c|c|}
\hline
34-layer &
\multicolumn{5}{|c|}{Initialization Methods} \\
\hline
Learning & \multirow{2}{*}{Xavier} &Kaiming &Kaiming & ASV & ASV \\
Rate ($lr$)& &(forward)&(backward)&(forward)&(backward)\\
\hline
\hline
$10^{-3}$&15.78&15.78&15.78&15.78&15.78\\
$10^{-4}$&15.78&15.78&15.78&15.78&\textbf{\textit{81.49}}\\
$10^{-5}$&\textit{71.95}&\textit{70.52}&\textit{73.10}&\textit{72.74}&63.85\\
$10^{-6}$&40.17&52.58&50.93&51.15&52.30\\
\hline
\end{tabular}
\\ \\
(b) Food
\\
\begin{tabular}{|c|c|c|c|c|c|}
\hline
34-layer &
\multicolumn{5}{|c|}{Initialization Methods} \\
\hline
Learning & \multirow{2}{*}{Xavier} &Kaiming &Kaiming & ASV & ASV \\
Rate ($lr$)& &(forward)&(backward)&(forward)&(backward)\\
\hline
\hline
$10^{-3}$&10.60&10.60&10.60&10.60&10.60\\
$10^{-4}$&69.36&\textit{75.72}&69.36&\textit{76.49}&\textbf{\textit{78.81}}\\
$10^{-5}$&\textit{72.83}&69.17&\textit{69.75}&69.75&66.28\\
$10^{-6}$&60.89&65.51&66.28&65.13&62.81\\
\hline
\end{tabular}
\\ \\
(c) Fungi
\\
\begin{tabular}{|c|c|c|c|c|c|}
\hline
34-layer &
\multicolumn{5}{|c|}{Initialization Methods} \\
\hline
Learning & \multirow{2}{*}{Xavier} &Kaiming &Kaiming & ASV & ASV \\
Rate ($lr$)& &(forward)&(backward)&(forward)&(backward)\\
\hline
\hline
$10^{-3}$&24.61&24.61&24.61&24.61&24.61\\
$10^{-4}$&\textit{65.23}&\textit{68.16}&66.02&\textit{67.97}&\textbf{\textit{69.73}}\\
$10^{-5}$&62.11&65.62&\textit{66.99}&64.06&64.45\\
$10^{-6}$&52.93&59.77&56.45&61.33&56.84\\
\hline
\end{tabular}
\\
\end{tabular}
\end{table*}
\begin{figure}
\centering
\begin{tabular}{l}
\includegraphics[width=0.9\linewidth]{007-chart-init-variance.eps}
\end{tabular}
\caption{Graph comparing parameters $\sigma_{w^{(\ell)}}$ used for initialization for 34-layer architecture. The number after the $\#$ represents the layer number $\ell$, with some layers grouped together. It can be seen that the proposed backward method gives a larger variance, especially on the layers where a stride or pooling is applied wherein in these layers, the resolution of the feature map changes. \label{fig:initstd}}
\end{figure}
\section{Experiments}
We carried out computational experiments to investigate how the differences of the initialization methods affect the stochastic gradient descent of deep convolutional structures.
The proposed initialization methods were examined on three public datasets: Car, Food, and Fungi. Each of the three datasets are divided into ten categories yielding ten output units in the last layer of the deep convolutional layer for multi-category classification. The three datasets comprise three-channel color images. The images were clipped, resized to $224\times 224$ pixels and normalized to allow us to examine the proposed method using exactly same neural architectures (Table~\ref{tab:arch}) for the three different datasets. Data augmentation was not performed in the gradient descent process. The first dataset Car is available in VMMRdb~\cite{vmmrdb2017}. Seventy-five percent of the data was randomly selected for training and the rest was used for validation. The second dataset Food is a subset of iFood 2019~\cite{kaur2019foodx}. The dataset was divided into two datasets of 90\% and 10\%, each of which was used for training and validation, respectively. The last dataset Fungi was prepared by extracting the super-category Fungi in the hierarchical categorization of iNaturalist 2019 in ~\cite{iNaturalistdb} and its exclusive subsets of 75\% and 25\% were used for training and validation.
As shown in Table~\ref{tab:arch}, the model architecture used in the experiments on the above three datasets has a 34-layer deep structure that consists of the max-pooling layers, the convolutional layer with padding, the global averaging layers, and the fully connected layer. The cross-entropy loss was used for the loss function. One thousand epochs of the gradient descent based on Adam were implemented with the mini-batch size 64. The learning rate was varied with four values $10^{-6},10^{-5},10^{-4},10^{-3}$. The two proposed methods were compared with the \textbf{Kaiming forward} method, \textbf{Kaiming backward} method, and \textbf{Xavier} method. We refer to the proposed forward and backward methods as \textbf{ASV forward} and \textbf{ASV backward} methods, respectively. For ASV backward method, learning is stabilized by taking the smaller value of the variance parameter \eqref{eq:init-backward} and three times the value derived without the pooling operations. The classification accuracies on the validation set were assessed during training, and the highest one is reported. ReLU function is used as the activation function in all layers and no activation function is used for the output layer.
Table~\ref{tab:acc.g2}a shows the classification accuracies on the dataset Car. ASV backward achieved the highest accuracy 81.49\%. The accuracy was recorded when using $10^{-4}$ as the learning rate. The accuracy obtained by each of the other methods with the learning rate of $10^{-5}$ was the highest among the accuracies with different learning rates. The proposed backward method successfully trained the deep network stably with a larger learning rate $10^{-4}$, although the other methods suffered from the plateau phenomenon at the same learning rate. Comparing the two ASV methods, the backward method performed better than the forward method on the dataset Car as well as on the other two datasets as shown in Table \ref{tab:acc.g2}b and \ref{tab:acc.g2}c. The backward method is derived so that the variances of the backward signals are maintained, which is a more direct approach for preventing the signal vanishing and the signal explosion compared to the forward method. We conjecture that the reason why the same phenomenon was not observed for the Kaiming forward and backward methods is because the two methods were derived from a too simplified variance model. A prominent difference between the ASV backward method and the ASV forward method appears when the resolution of the feature map is changed by the sub-sampling operation. Our theory suggests that a larger variance affects such layers better, and ASV backward method can make the variance larger (See Figure~\ref{fig:initstd}), which leads to better performance. Meanwhile, the Kaiming variance model ignores the sub-sampling operation. Kaiming backward method derived from the Kaiming variance model that cannot capture the variance change caused by the resolution change.
In addition to the 34-layer architecture, the initialization methods were tested with a deeper 50-layer architecture presented in Table~\ref{tab:arch-f50}. Details on the implementation of this experiment can be seen in Appendix~\ref{sec:addexp}. Table~\ref{tab:acc-f50} reports the validation accuracies on the dataset Car. ASV backward method performed best, although the accuracy is slightly worse than that from the 34-layer architecture. This suggests that the proposed method works successfully with deeper convolutional structures. To get a better performance with deeper structures, it may be required to combine the proposed methods with other heuristics to avoid overfitting such as data augmentation, although we did not implement them because the purpose of the experiments is investigation of the effects coming from different initialization methods by removal of other factors.
\section{Conclusion and Future Work}
Using CNN in various image processing tasks requires practitioners to understand that proper initialization of the model parameters is crucial to the stability of learning. With a proper initialization method, it can determine the outcome of training and testing process. In this paper, we have shown a re-formulation of the CNN structure to introduce our proposed initialization methods which take into account all the components of CNN, including the ReLU activation function, fully connected layer, convolution layer and pooling operations. The proposed initialization methods, not only supports the CNN structure theoretically, these methods as well made significant improvements to the recognition performance demonstrated in the experimental results.
While ASV initialization method produces an impressive result under the CNN structure for these specific datasets, there are more neural network structures that the ASV initialization method has not supported yet theoretically. If the proposed initialization method were to be extended to other neural networks, it might show promising results.
{\small
\bibliographystyle{ieee_fullname}
| {'timestamp': '2020-09-01T02:07:07', 'yymm': '2008', 'arxiv_id': '2008.06885', 'language': 'en', 'url': 'https://arxiv.org/abs/2008.06885'} | arxiv |
\section{Introduction}
The ongoing COVID-19 pandemic has already provided numerous instances of robotics being used to
assist agencies with the detection and care of infected populations and prevent further transmission\cite{yang20}. Robots are also enabling industry,
educational institutions, and individuals to cope with the unique consequences of
sheltering-in-place restrictions and workplace absenteeism.
%
The purpose of this paper is to document the reported uses and perform a preliminary analysis.
This analysis is expected to provide guidance to policy makers and roboticists who
are interested in increasing the immediate use of robots. It is also expected to provide a basis for further research and development of robots suitable for future pandemics and disasters.
The paper relies on 262 reports taken from weekly searches between March 27 and July 4, 2020 of press reports, social media including YouTube, Twitter, and Facebook using three search engines: google.com, social-search.com, and talkwalker.com. The description section and the comment section of the social media videos were also scraped manually to obtain additional links LinkedIn was searched manually. The searches used the following keywords and phrases: COVID, COVID19, COVID-19 robot, COVID19 Robots, COVID 19 Drone, COVID 19 UAS, COVID Drone, COVID UAS, ``COVID-19 and Robots", ``Use of Robots for COVID-19", ``Use of Robots for the present pandemic", and ``COVID-19 Robot uses". The scientific literature was also searched. A preliminary content analysis was performed resulting in 203 instances of robots in actual use for COVID-19 related activities in 33 countries:
Belgium,
Chile,
China,
Cyprus,
Denmark,
Estonia,
France,
Germany,
Ghana,
Greece,
Honduras,
India,
Ireland,
Italy,
Japan,
Jordan,
Lithuania,
Mexico,
Netherlands,
Nigeria,
Philippines,
Rwanda,
Singapore,
South Korea,
Spain,
Sweden,
Taiwan,
Thailand,
Tunisia,
Turkey,
UAE,
US, and
the UK.
The reliance on press reports and social media may mean some applications are over- or under-represented; for example, a novel animal-like robot that is used in only a few
locations for prototyping may receive more attention than commercially available disinfecting robots
used in hundreds of hospitals. Another limitation is that the search relied on queries in English; fortunately many non-English social media postings used English keywords such as ``robot" and contained pictures or videos. Despite the inherent incomplete nature of the reports, they indicate the general types of applications
and stakeholders (e.g., hospitals, private industry, individuals), which roboticists and policy makers can use to guide future development.
The article is organized as follows. Section~\ref{sec:taxonomy} presents a novel taxonomy of applications partitioned into six categories representing distinct use cases, stakeholders, and work envelopes. Each of the subsequent six sections describes the use cases for each category in more detail. Section~\ref{sec:findings} then discusses three sets of findings on how robots are used, what modality of robot (ground or air) is used and why, and the role of autonomy as a control scheme. The article concludes with topics for further research in autonomy, human-robot interaction, and adaptability.
\section{Methodology}
\label{sec:methodology}
The 262 reports from the weekly searches were copied into PDF and entered into a master spreadsheet, the master spreadsheet was divided into subsets of data for different analyses. This article considers only the subset of the data that captures actual robot use versus ethical concerns or general discussions.
Content analysis of the 262 reports produced 203 instances of a specific robot explicitly stated as being used for an application due to COVID-19 or a specific robot that would be used by a specific date for a COVID-19 related application (e.g., a purchase order had been placed for disinfection robots to cope with demand). The instances did not include robots proposed for use or demonstrated in a laboratory; the robots had to be in use or in trials situated in the work environment. The report did not have to name the robot to be included if there was a video or image of the robot. When the robot was not specified, the media was inspected in order to try to recognize the robot or spot a logo. In some cases, the report had links to the manufacturer or showed logos; if the name of the company was identified, the company’s website, as well their LinkedIn page, as manually scraped in order to attempt to match the robot in the report.
Duplicate reports were combined into a single instance, as several robot stories were re-posted or covered by multiple news agencies. A single report could contain descriptions of multiple robots for different use cases, in which case the report produced multiple instances. For example, there were two reports that documented the use of the LHF-connect robot for healthcare workers telepresence, patient and family socializing, as well as quarantine socializing; hence the reports produced 3 instances with one instance each in \textit{healthcare workers telepresence} and \textit{patient and family socializing} under \textit{Clinical Care} and \textit{quarantine socializing} under \textit{Non-Hospital} care respectively.
\section{Taxonomy}
\label{sec:taxonomy}
\begin{figure*}[htbp]
\centerline{\includegraphics[width=\textwidth]{Applications.pdf}}
\caption{203 instances of robot use for COVID-19 applications organized into six categories and by modality, with brown representing ground robots and blue, aerial robots.}
\label{fig}
\end{figure*}
Figure 1 provides a graphical representation of the 203 instances grouped into
six applications by stakeholder and general work domain. The representation builds on a prior taxonomy introduced in \cite{conversation}. The advantage of grouping by stakeholder and work domain is that it makes it easier to consider three factors that influence the design of the robot: its work envelope (e.g., whether the work envelope is indoors or outdoors), how it is adopted (e.g., government agencies have different procurement procedures than private industry or individuals), and the human-robot interaction (e.g., are the users specialists or taken from the general population).
The instances within a category are further subdivided
into subcategories to reflect differences in mission, work envelope, and socio-technical organization. Each application category is described in more detail in the following sections.
Figure 1 also shows the number of instances based on modality. At this time, only ground and aerial modalities have been reported. Of the 203 instances, 119 are ground and 84 are aerial.
\section{Public Safety}
\textit{Public Safety} was the largest set of uses (74), with 56 instances using SUAS and 18 ground robots. The category consists of applications by law enforcement, emergency medical, and public works departments that may be coordinated with public health officials. The applications impact
the general population in public spaces. These public spaces can be outdoors, either urban areas or recreational areas, or indoors, such as subways. Normally these public spaces would be populated with citizens, which would impose safety constraints, but it appeared from the reports that most public spaces were either empty due to shelter-in-place restrictions or there were sparse collections of citizens. The applications in \textit{Public Safety}
are subject to jurisdictional polices and regulations. Additional regulations, such as aviation
restrictions on small unmanned aerial systems, may be present. In some cases, aviation restrictions in some countries were likely waived to permit operation in urban areas. The use of robots
provided greater, and more timely, task coverage, high efficiencies than manual operations, and protected government workers from exposure.
The largest reported use within \textit{Public Safety} was for enforcement of quarantine restrictions, primarily where law enforcement officers patrolled with SUAS (33) or ground robots (2) to detect the presence of large groups. In some cases, the robots were equipped with speakers and flew or drove close enough for the officers to give verbal warnings.
The second largest use case was for disinfecting public spaces (25). SUAS for agricultural spraying were adapted to spray disinfectant in urban areas and large indoor facilities, while foggers were mounted on bomb squad or police ground robots.
Ground and aerial robots were also used to attempt to identify whether a person in a public space was infected with coronavirus using thermal sensing (7), though the accuracy of such methods are in doubt CITE. Robots were also used to broadcast public service announcements about COVID-19 and social distancing (6). In one case, a SUAS was used to monitor traffic flow \textbf{WHY?}
\section{Clinical Care}
\textit{Clinical Care} was the second largest set of uses (46), all with ground robots. The
category represents applications related to the diagnosis and acute healthcare of patients with coronavirus, These were generally in a large hospital, or affiliated clinic, setting, where the hospital was presumed to have a reliable wireless network and information technology support. The applications impact
the healthcare workers and support staff (i.e., janitors) and small segments of the general
population (i.e., patients and family members). The area of application were inside hospitals, with the diversity in waiting areas, treatment rooms, patient rooms, but also included entrances and parking garages where healthcare workers might be exposed. Applications
are subject to public health, public health insurers, and hospital-specific polices and regulations.
Some policies and regulations may apply to robots if they are being used as medical devices for direct healthcare. However, the larger impact on robotics is whether the costs of acquiring and using robots can be reimbursed by insurers; if the insurers do not permit robots, then hospitals have less financial incentive to use them.
The use of robots protected healthcare workers by enabling them to work remotely, allowed them to delegate unskilled tasks such as meal delivery and disinfection, and to cope with surges in demand.
The largest reported use with \textit{Clinical Care} was for healthcare telepresence (16). This set of uses included use of teleoperation by doctors and nurses to interact with patients for diagnosis and treatment. 2 of the instances showed physical interaction, mostly to press sensors on the patient. 3 instances were physically invasive and the result of prior research in medical robotics. The robots were either commercially available or adapted from commercially available bases.
The second largest reported use was for rapidly disinfecting the hospital or clinic (13). The majority of robots used UVC light to perform a gross disinfection followed by a human wiping down surfaces likely to have been missed. Several models of this type of robot were already commercially available and in use for preventing hospital acquired infections.
The third largest use was for prescription and meal dispensing (11), whereby carts navigated autonomously through a hospital. As with disinfection, these types of robots were already commercially available but their visibility and use increased as a means of coping with the surge in patients and the need to free the healthcare workers to spend more time on direct and compassionate care.
The three other applications of robots for clinical care related activities were: use of telepresence robots in processing the intake of patients and handling families, essentially protecting the receptionists and clerks, (3) and in enabling families to remote visit patients (2); and in automating inventory management for a hospital floor (1).
\section{Continuity of Work and Education}
\textit{Continuity of Work and Education} was the third largest set of uses (27), primarily
with ground robots (23) and 4 instances of SUAS. The
category represents applications where private industry and education leverage robotics for their enterprises, The work domain varied widely, from agriculture to classrooms.
The applications impact small segments of the population, and the area of application was varied.
The use of robots protected the workforce by enabling them to work remotely, allowed
companies to delegate or automate tasks in order to cope with surges in demand, especially
for warehouses, or to cope with workforce reductions due to illness.
Within \textit{Continuity of Work and Education}, the largest use was for sanitation of the workplace or school (11), leveraging the disinfection robots developed for hospitals. Telepresence
(7) and warehouse (5) robots were also leveraged. Robots were also used as assistants in construction of new hospitals (2), to automate facility security (1) and agriculture (1) given the loss of personnel to extended illness.
\section{Quality of Life}
\textit{Quality of Life} was fourth (22), split between
SUAS (13) and some ground robots (9). The
captures how individuals are using robot-based services or applying personal robotics for day-to-day activities such as shopping and maintaining social connections. The work domain varied widely, from urban to rural.
The applications involved small segments of the population, spanning the spectrum of human-robot interaction from no interaction (e.g., packages dropped off at the individual's residence) to immersive interaction (e.g., socializing through robots).
The area of application was varied, with delivery robots working in urban and suburban areas and robots used for socialization in public venues or in homes.
The use of robots allowed individuals to maintain the quality of life while complying with quarantining or sheltering in place restrictions.
The largest use within Quality of Life was delivery (13). Delivery robots provided either food (8) or non-food purchases (5), where food delivery tended to use small platforms for a mission of transporting items for a single family. SUAS were more common (8) than ground robots (5). Social activities (9) was almost as large as delivery and split between SUAS (5) and ground robots (4). The use of robots for socializing reflecting great creativity, with individuals using a SUAS to ask another person out on a date and to walk a dog.
\section{Laboratory and Supply Chain Automation}
The fifth largest use of robots was for
\textit{Laboratory and Supply Chain Automation} was fifth (21), split between ground robots (11) and SUAS (10). Robots in this category were employed by private companies using robotics to support healthcare operations, either in hospitals, non-hospital facilities, or testing laboratories.
The uses occurred in a wide range of work envelopes, including flying through urban areas, navigating through hospitals, and operating in manufacturing work cells. The interactions were
generally limited to humans trained to use the robots.
The use of robots served two functions. One was to decrease the time for COVID-19 testing by reducing the time
spent transporting samples between clinics and the diagnostic laboratories, reducing the time
for delivery of reagents, and automating the test processes. The other was to protect healthcare workers by reducing exposure to coronavirus, either by robots handling biohazards or by making or cleaning PPE.
The largest reported uses within the \textit{Laboratory and Supply Chain Automation} category was
for delivery (13) and transportation of infectious materials (3). Stationary robots were used for manufacturing or decontaminating PPE (3) or laboratory automation (2). SUAS dominated the two transportation-oriented use cases (10 out of 16), leveraging the platforms used for delivery of food and non-food purchases to individuals.
\section{Non-Hospital Care}
The sixth largest use of robots was for
\textit{Non-Hospital Care} (13), and almost exclusively with ground robots (12). Robots in this category cover uses for non-acute care or diagnostics in nursing homes, temporary quarantine facilities, in-home healthcare providers, and corporate clinics; note that these settings seem similar to clinical care but have different missions, standards, economics, and stakeholders from acute care of infected.
The uses occurred primarily in indoor setting mirroring \textit{Clinic Care} and the instance of off-site
testing mirrored \textit{Clinical Care}. The robots were used by healthcare workers and the general population, especially an elderly population.
The use of robots was primarily to protect the elderly from exposure to coronavirus or to enable public health officials to handle the surge in quarantined individuals being housed in hotels or camps.
\section{Findings}
\label{sec:findings}
While a complete analysis of the data is beyond the scope of this article, the
data gathered offers insights into how robots are used, what modality of robot (ground
or air) is used and why, and the role of autonomy as a control scheme.
\subsection{Uses}
The data shows that ground and aerial robots have an notable impact beyond direct clinical care, as only 46 of the 203 instances (22.66\%) were for \textit{Clinical Care}. This suggests that robotics is reaching
a level of adoption and that industry and the public are accepting robots in the workplace,
social arenas, and the home.
The largest reported use was for \textit{Public Safety} (74), as compared to \textit{Clinical Care} (46). This could reflect
the visibility of public safety applications which, by definition, appear in view of the public, though
the low cost and availability of consumer SUAS most likely contributed to agencies innovating
creative uses.
Delivery or transportation uses were pervasive, appearing in \textit{Clinical Care}, \textit{Quality of Life}, \textit{Laboratory and Supply Chain Automation}, and \textit{Non-Hospital Care}. This is interesting because of the differences in how
robots are adopted and by whom and suggests that delivery can become a general purpose application.
Delivery or transportation indoors relied on ground robots (18), while outdoor movements
saw more use of aerial platforms (17) than ground (13).
\subsection{Modality}
The data suggests that while ground robots are used more frequently (119), SUAS are
also emerging as important (84). SUAS seem to have an advantage as many platforms were commercially available and are built for general use, especially to carry different payloads, while ground robots were specialized for the
application, especially disinfection, dispensing, and delivery.
104 different models of robots were identified, of which 82 were determined to be commercially available or already existed as a prototype, 11 were modifications to existing robots, 11 were built from scratch, and in 52 instances the origin of the robot could not be determined.
The three most commonly used robots were the DJI Mavic 2 Enterprise UAS Duo (11 instances), TEMI UGV (9), and MMC UAS (6).
The 82 models of robots that were reported as being commercially available were predominately ground robots (66 models), with 16 models of UAS.
The 66 models of commercially available ground robots were:
Temi (9),
Xenex Light strike germ zapping robot (5),
Double Robotics (4),
Chloe (2),
CloudMinds Robot (2),
Keenon Robotics Peanut (2),
Pudu Tech Robot (2),
Spot (2),
Tru-D (2),
Ubtech Robotics Robot (2),
6 River Systems (1),
Ana’s “Newme” Robot (1),
Ava Robotics (1),
Avid Bots Neo (1),
Beam Pro (1),
Beep's Navya (1),
BrainCorp Robot (1),
Breezy One (1),
Disinfection robot by Seoul Digital Foundation and Korea Robot Promotion agency (1),
EVA Robot (1),
Geek+ (1),
Germ Falcon (1),
Guangzhou Gosuncn Robot Co robot (1),
Intelligent Sterilization Robot (1),
InTouch Vici (1),
Ivo (1),
Jingdong Logistics Intelligent Distribution Robot (1),
Kindred SORT (1),
Knightscope (1),
Lions Bot (1),
Miso Robotics (1),
Modai (1),
Moxi (1),
Ninja, University of Bangkok (1),
Nuro R2 (1),
Opentrons OT-2 liquid handling robot (1),
Pepper (1),
P-Guard (1),
Postmate (1),
Promobot (1),
Qianxi Robot Catering (1),
REV-1 (1),
Robot for Care (1),
Seit-UV (1),
Seoul Digital Foundation and the Korea Robot Industry Promotion Agency Waste Disposal Robot (1),
Shanghai TMiRob (1),
Siasun Robot (1),
Skytron UV Robot (1),
Starship Robot (1),
Sunburst UV Bots (1),
Tally (1),
Thermal temperature detection Robot by Seoul Digital Foundation and Korea Robot Promotion agency (1),
Tommy Robot (1),
Unity Drive Innovation (1),
UVD Robot (1),
Vaporized Hydrogen Peroxide Robot (1),
Vision Semicon (1),
White Rhino Auto Company (1),
Whiz (1),
Xiangdi (1),
Xiaofan Robot (1),
Zenplace’s Robot (1),
Zen Zoe Robot (1),
Zhiping (1),
Zorabots (1), and
Zorabot James(1).
The 16 models of commercially available aerial robots were:
DJI Mavic 2 Enterprise Duo (11),
MMC (4),
Alphabet's Drone Delivery (2),
Flytrex (2),
Manna Aero's drone (2),
Terra Drone Corporation drone (2),
Zipline (2),
DJI Phantom (1),
DJI Mavic Pro (1),
Everdrone (1),
HTX Robotics (1),
Solent Transport (1), and
Threod drone (1).
Verge Aero (1),
Wing (1), and
XAG (1),
Of the 11 models of robots that were reported as being modified for the COVID-19 application, seven were aerial vehicles and four were ground robots.
The following were the 8 models of existing aerial robots that were modified:
DJI MG-1P (2),
MMC (2),
Alpha Drone Technology (1),
Eagle Hawk (1).
Hexa XL and Agras MG-1 (1),
Netra Pro (1), and
XAG (1).
The following were the four models of existing ground robots that were modified:
AIS K9 (1),
Soochow University spraying robot (1),
Turtle Bot Variant (1), and
Youibot (1).
The 11 models of ground robots built from scratch were:
KARMI-Bot (3),
LHF-Connect (3),
Lego Bot to dispense sanitizer (2),
Amazon’s disinfection robot (1),
Cleantech-J1 (1),
Guangzhou Institute of Respiratory Health and the Shenyang Institute of Automation’s throat swab robot (1),
Pinto Robot (1),
Tsinghua University’s robot (1),
University of California Berkeley's Innovative Genomics Institute’s testing automation (1).
University of Southern Denmark 3D printed robot (1), and
XDBOT (1 instance),
The overall top three most commonly used models of robots
were DJI SUAS models which accounted for 16 instances in 2 categories and 5 subcategories, with the Mavic 2 Enterprise Duo model used in 11 of the 16 instances,
TEMI ground robot which accounted for 9 instances in 3 categories and 7 subcategories,
and
MMC SUAS which accounted for 6 instances in 2 categories and 5 subcategories, Note that the most frequently used robots were used for different applications and missions, showing the value of general purpose platforms for disasters. See Figure~\ref{fig:robots}. DJI and MMC are made by Chinese companies, while TEMI is made by an Israeli company.
\begin{figure}
\centering
\begin{subfigure}[b]{0.3\textwidth}
\centering
\includegraphics[width=\textwidth]{DJI.png}
\caption{DJI Mavic 2 Enterprise}
\label{fig:dji}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.3\textwidth}
\centering
\includegraphics[width=\textwidth]{Temi.png}
\caption{Robot TEMI}
\label{fig:temi}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.3\textwidth}
\centering
\includegraphics[width=\textwidth]{Mmcdrone.png}
\caption{MMC}
\label{fig:mmc}
\end{subfigure}
\caption{The three most commonly used robots reported: a) DJI Mavic 2 Enterprise, b) TEMI, and c) MMC (images from manufacturer's Website) }
\label{fig:robots}
\end{figure}
For \textit{ Public Safety}, 15 of the 56 UAS instances deployed were commercially available, 9 instances were UAS with modifications, and the commercial maturity of UAS in 32 instances were unknown. DJI drones and Micromulti copter (MMC) and were the most common. Different models of DJI drones accounted for 14 instances across 3 subcategories: Quarantine Enforcement, Disinfecting Public Spaces, and Public Service Announcements. MMC were used in 5 instances across 4 subcategories: Quarantine Enforcement, Disinfecting Public Spaces, Identification of Infected, and Monitoring Traffic Flow.
Fifteen of the 18 instances with ground robots used commercially available UGVs, 1 used modified robots, and the commercial maturity of UGVs in 2 instances was unknown.
For \textit{Clinical Care}, 32 of the 46 UGV instances deployed were commercially available, 2 instances were UGVs with modifications, 9 instances were UGVs built from scratch, and the commercial maturity of UGVs in 3 instances were unknown. Double Robotics Tele-presence robot and KARMI-Bot were the most common. Double Robotics Tele-presence robot accounted for 3 instances across 3 subcategories: Healthcare Workers Telepresence, Patient Intake and visitors, and Patient and Family Socializing. KARMI-Bot accounted for 3 instances across 3 subcategories: Healthcare Workers Telepresence, Disinfecting Point of care, and Prescription and Meal Dispensing.
For \textit{Continuity of Work and Education}, 16 of the 23 UGV instances deployed were commercially available, 1 instance was UGV with modifications, 5 instances were UGVs built from scratch, and the commercial maturity of UGVs in 1 instance was unknown. Xenex LightStrike Germ-Zapping Robot accounted for two instances across 1 subcategory: Sanitation at Work/School. 1 of the 4 instances with aerial vehicles used commercially available UAVs, and the commercial maturity of UAVs in 3 instances were unknown. XAG agricultural drone was the commercially available UAV deployed accounting for 1 instance in 1 subcategory: Agriculture.
For \textit{Quality of Life}, 10 of the 13 UAS instances deployed were commercially available, and the commercial maturity of UAS in 3 instances were unknown. DJI drones, Flytrex, Manna's Aero Drone and Alphabet's drone were the most common. DJI drones accounted for 2 instances across 2 subcategories: Interpersonal Socializing, and Other Personal Activities. Flytrex, Manna's Aero Drone and Alphabet's accounted for 2 instances each across 2 subcategories: Delivery Food, and Delivery Non-food Purchases. 6 of the 9 instances with ground robots used commercially available UGVs, and the commercial maturity of UGVs in 3 instances were unknown.
For \textit{Laboratory and Supply Chain Automation}, 9 of the 11 UGV instances deployed were commercially available, 1 instance was UGV built from scratch, and the commercial maturity of UGVs in 1 instance was unknown. 8 of the 10 UAS instances deployed were commercially available, and the commercial maturity of UAS in 2 instances were unknown. Terra Drone Corporations drone was the most common one. It accounted for 2 instances across 2 subcategories: Delivery, and Infectious Mat. Handling.
For \textit{Non-Hospital Care}, 10 of the 12 UGV instances deployed were commercially available, 1 instance was UGV built from scratch, and the commercial maturity of UGVs in 1 instance was unknown. Robot Temi was the most common one. It accounted for 6 instances across 4 subcategories: Delivery to Quarantined, Quarantine Socializing, Off-site testing and Testing-care in Nursing Homes. The commercial maturity the one UAS instance was unknown.
\subsection{Control Scheme}
The 203 instances reflected three types of control: automation (74), teleoperation (105), and taskable agency (24).
Taskable agency instances were often semi-autonomous, where only a portion of the mission was delegated
to the robot. As examples, consider i) a person wheels the robot into a room and then the robot performs the rest of the disinfection or ii) a meal delivery robot brings a meal to the door of a patient, but the nurse has to take the tray to the patient is too weak. This incomplete
autonomy leads to hidden manpower costs because a person has to supervise or work with the robot, but the use of such robots can still provide a savings in time to complete tasks,
reduced the effort and fatigue of workers, and protect workers from exposure.
Teleoperation was used in 17 out of 30 application subcategories:
quarantine enforcement,
disinfection of public spaces,
identification of infected,
public service announcements,
monitoring traffic flow,
healthcare telepresence,
patient intake and visitors,
patient and family socializing,
telepresence (work or school),
sanitation at work,
construction,
security
attend public social events,
interpersonal socializing,
other personal activities,
quarantined socializing, and
off-site testing(Non-hospital care)
Of the 17 subcategories using teleoperation, 9 are remote presence applications where the human would wish to stay in the loop in order to apply their unique expertise or skills; have a rich, unscripted
interaction; and provide compassionate care:
healthcare telepresence,
patient intake and visitors,
patient and family socializing,
telepresence (work or school),
attend public social events,
interpersonal socializing,
other personal activities,
quarantined socializing, and
off-site testing. These applications may benefit from increased intelligence
to make teleoperation easier but the human would not be eliminated.
Automation or autonomy was used in 19 of the 30 application subcategories:
disinfecting public spaces,
public service announcements,
disinfecting point of care,
prescription and meal dispensing,
patient intake and visitors,
inventory,
agriculture,
food delivery,
delivery non-food purchases,
sanitation of work or school,
warehouse automation,
interpersonal socializing,
delivery (laboratory-related),
manufacture or decontaminate PPE,
laboratory automation,
delivery to quarantined,
off-site testing,
testing,care in nursing homes, and
handling infectious materials. While autonomy and automation exists, the control schemes
may be subject to further improvements, such as faster navigation in more cluttered environments
with dynamic obstacles, and general reliability and safety.
Six subcategories had both autonomous and teleoperation instances, suggesting that autonomy is the ultimate goal
for a control scheme those applications:
disinfecting public spaces,
public service announcements,
patient intake and visitors,
sanitation at work,
interpersonal socializing, and
off-site testing
These application subcategories appear to be ripe for advances in artificial intelligence.
\section{Conclusions}
The 203 instances of robots being used explicitly to cope with the COVID-19 pandemic indicate that robots are being broadly used in all aspects of work and life, not just for clinical care. The robots protect, not replace, healthcare and public safety workers by allowing them to work at a distance as well as handle the surge in duties and missions. The robots being used by businesses and individuals enable individuals to continue work and education, reduce the productivity impact of ill workers, protect at-risk populations in assisted-living facilities, and maintain social relationships.
The data suggests areas for further research in autonomy, human-robot interaction, and adaptability.
While seven of the applications appear to be remote presence (LIST HERE) and thus would never eliminate the
human, there are opportunities for increased intelligence to reduce the cognitive and training demands on the users. Likewise the autonomous uses were
still relatively limited. The instances suggest that more work is needed in no particular order:
\begin{itemize}
\item navigation and coverage of public spaces- large, irregular, partial known with human presumably absent,
\item navigation and coverage of cluttered indoor spaces where humans may be present,
\item manipulation, both coarse (grasping for delivery) and dexterous (for patient care, handling instrumentation, retrieving inventory, etc.),
\item physical HRI (especially intrusive medical testing), and
\item computer vision for manipulation, inventory, recognizing individuals, etc.
\end{itemize}
Improved human-robot interaction is important, especially for i) interfaces for
teleoperation by incidental users and the general population to accomplish mundane task and
ii) social interaction.
The data also suggests that more research and development is needed for adaptable ground
robots. General purpose small unmanned aerial vehicles were rapidly re-purposed for new uses quarantine enforcement, disinfection, construction, and social interactions but ground robots showed less innovation. This analysis did not consider the attributes that lead stakeholders to adopt robotic innovations and there does not appear to be a model of responsible robotics innovation to guide reactive research and development for disasters; additional research on these topics is also warranted.
The dataset is available upon request and data is updated and summaries are posted periodically to roboticsForInfectiousDiseases.org.
\section*{Acknowledgment}
This work was supported by the National Science Foundation under Grant No. IIS-2032729; the opinions, findings,and conclusions or recommendations expressed are those of the author(s) and do not necessarily reflect the views of the National Science Foundation. It was conducted through the Center for Robot-Assisted Search and Rescue, a not for profit 501(c)(3) organization. The authors would like to thank Dr. Hao Su for his help in identifying occurrences in the scientific literature.
\bibliographystyle{./IEEEtran}
| {'timestamp': '2020-08-18T02:19:47', 'yymm': '2008', 'arxiv_id': '2008.06976', 'language': 'en', 'url': 'https://arxiv.org/abs/2008.06976'} | arxiv |
\section{Introduction} \label{sec:intro}
The multi-server M/M/m queue arises in the performance analysis of such systems as: call centers, manufacturing, communications networks, multicore
computers, and multithreaded software applications.
Unfortunately, those who should be applying M/M/m models to the performance analysis of their designs and architectures are often not schooled in
applied probability theory. This situation cries out for a more intuitive approach to understanding multi-server queues---along the
lines of the algebraic approach used to develop the residence time for an M/M/1 queue~\cite{qsp,Gunther1998}.
However, this apparently simple objective has proved more difficult than one might reasonably expect.\footnote{The situation is reminiscent of one that Kepler must have faced in going from circular to elliptic orbits. Introducing even a modest amount of eccentricity causes profound complications for expressing and calculating the circumference of an ellipse. Subsequently, others developed a variety of approximations.}
A previous attempt to meet this goal was based on our {\em morphing model}
approximation to M/M/m~\cite{Gunther2005,Gunther2017}. The residence time formula in the morphing model is simpler mathematically and more
intuitive than the exact solution based on the original Erlang C function~\cite[Eq. 5]{Erlang1917}.
Nonetheless, it is only an approximation. A similar approach, but one that produces the exact solution, has remained desirable.
Here, we present a method that achieves the desired goal.
Our approach arises from a confluence of several observations that had been overlooked previously.
In particular:
\begin{enumerate*}[{(i)}]
\item we focus on the mean waiting time $W_m$, rather than the residence time $R_m$ (as was done in the morphing model),
\item $W_m$ can be expressed as a transformation of $\mathcal{R}_1$: a fast M/M/1 residence time,
\item the transformation function $\Phi_B$ takes us from the Erlang B function to the Erlang C function,
\item since these are probability functions, $\Phi_B$ must exist on the interval $[0,1]$, and therefore
\item it cannot be defined in terms of queue attributes, such as unbounded queue length.
\end{enumerate*}
These observations, taken collectively, then allow us to reprise the logic of the previous morphing derivation to arrive at the exact waiting time
and residence time formul\ae\ for an M/M/m queue.
The structure of this paper is as follows.
In Section~\ref{sec:mm1}, we review the algebraic treatment of the M/M/1 queue.
Section~\ref{sec:morphing} reviews the morphing model, that transforms $m$ parallel M/M/1 queues into a single fast M/M/1 queue, in
agreement with the residence time characteristics of an M/M/m queue.
The morphing transformation function $\phi_\rho$, which is a finite geometric series in the server utilization $\rho$, produces only an approximate solution for $R_m$.
Section~\ref{sec:mmm} returns to the original problem but, replaces $\phi_\rho$ with $\Phi_B$ to recover the exact $R_m$.
\section{Algebraic M/M/1} \label{sec:mm1}
The iron law of residence time is
\begin{equation}
R = S + W \label{eqn:ironlaw}
\end{equation}
where $S$ is the mean service time and $W$ the mean waiting time.
The waiting time for M/M/1 can be viewed as being the due to the number of customers in the system, $Q$,
ahead of you when you join the queue, i.e., $W=QS$.
Furthermore, the number of customers in the system
can be determined from Little's law, $Q=\lambda R$, where $\lambda$ is the mean arrival rate.
Substituting Little's law into \eqref{eqn:ironlaw} produces
\begin{align*}
R &= S + QS \\
&= S + (\lambda R) S \\
&= S + R (\lambda S) \\
&= S + R \, \rho \label{eqn:rtime}
\end{align*}
where we have denoted the server utilization by $\rho = \lambda S$.
A final rearrangement yields
\begin{equation}
R_1 = \dfrac{S}{1-\rho} \label{eqn:mm1R}
\end{equation}
which is the canonical expression for the M/M/1 residence time~\cite{qsp,Gunther1998} but, derived here without resorting to
the usual applied probability theory found in standard texts~\cite{Kleinrock,Allen,Robertazzi,Bertsekas,Gross}.
The subscript in \eqref{eqn:mm1R} has been introduced to distinguish the number of servers, $m$, in the queueing facility for later comparisons.
Notice the restriction $\rho < 1$ in \eqref{eqn:mm1R} to prevent the queue length from becoming infinite (unstable queue).
\begin{rem}
Although \eqref{eqn:mm1R}---and similar equations that appear throughout---relates mean values of the respective metrics, it is not a so-called
operational law~\cite{qsp} because these metrics depend on the underlying statistical distribution.
\end{rem}
\section{Morphing M/M/m} \label{sec:morphing}
We would like to apply the same algebraic treatment to an M/M/2 queue and ultimately, its M/M/m generalization,\footnote{It is noteworthy that~\cite{qsp} does not derive or discuss the equivalent of the M/M/m queue.} especially for more practical applications~\cite{Bertsekas,Gunther2007} and pedagogic purposes~\cite{Classes}.
\begin{rem}
It is important to note that the arrival rate $\lambda$ needs to be doubled for $m=2$ if the capacity of both servers is to be fully utilized.
Since neither server can be more than 100\% busy, the corresponding server utilization has to be defined as $\rho = \haf \lambda S$ in order
that $\rho < 1$.
\end{rem}
\noindent
Since $\rho^2 <<1$, we expect $R_2 < R_1$ if the denominator in \eqref{eqn:mm1R} is replaced by $1-\rho^2$, viz.,
\begin{equation}
R_2 = \dfrac{S}{1-\rho^2} \label{eqn:mm2R}
\end{equation}
Moreover, we can interpret $\rho^2$ as representing the smaller probability that both servers are busy simultaneously.
Indeed, \eqref{eqn:mm2R} agrees with the exact solution based on the Erlang's C function~\cite{Erlang1917}.
Generalizing this observation led to the {\em morphing model}~\cite{Gunther2005,Gunther2017}
\begin{equation}
R_m(\phi) = \bigg( \dfrac{S}{1-\rho} \bigg) \, \phi_\rho \label{eqn:rmorph}
\end{equation}
where
\begin{equation}
\phi_\rho = \dfrac{1-\rho}{1-\rho^m} \label{eqn:fmorph}
\end{equation}
is the sum of a finite geometric series and
\begin{equation}
\rho = \dfrac{\lambda S}{m} < 1 \label{eqn:utilC}
\end{equation}
is the per-server utilization.
\begin{table}[ht]
\caption{Correction terms for the morphing approximation \eqref{eqn:fmorph}} \label{tab:coefffs}
\begin{tabular}{l|l}
\hline
\multicolumn{1}{c|}{$\mathbf{m}$} & \multicolumn{1}{c}{Integer polynomials $\mathbf{P_m(\rho)}$ }\\
\hline
1 & $- \rho + 1$ \\
2 & $- \rho^2 + 1$ \\
3 & $3 \rho ^3+\rho ^2-2 \rho -2$ \\
4 & $8 \rho ^4+4 \rho ^3-3 \rho ^2-6 \rho -3$ \\
5 & $125 \rho ^5+75 \rho ^4-20 \rho ^3-84 \rho ^2-72 \rho -24$\\
6 & $-54 \rho ^6-36 \rho ^5+30 \rho ^3+35 \rho ^2+20 \rho +5$\\
7 & $16807 \rho ^7+12005 \rho ^6+2058 \rho ^5-7350 \rho ^4-10920 \rho ^3-8280 \rho ^2-3600 \rho -720$\\
8 & $16384 \rho ^8+12288 \rho ^7+3584 \rho ^6-5376 \rho ^5-10080 \rho ^4-9240 \rho ^3-5355 \rho ^2-1890 \rho -315$\\
\hline
\end{tabular}
\end{table}
\noindent
Equation \eqref{eqn:rmorph} formally captures the idea that an M/M/m queue is load-dependent in such a way that it
can be regarded as ``morphing'' between two types of virtual queueing facilities:
\begin{description}
\item[Very low load:] M/M/m acts like a set of $m$ parallel M/M/1 queues with very little waiting-line formation.
\item[Very heavy load: ] M/M/m becomes a single M/M/1 queue with a server that is $m$ times faster than a parallel queue server.
\end{description}
\noindent
According to \eqref{eqn:rmorph}, adding another server ($m=3$) corresponds to a residence time given by
\begin{equation*}
R_3(\phi)= \dfrac{S}{1-\rho^3} \label{eqn:rmorph3}
\end{equation*}
which is incorrect. The exact expression, based on the Erlang C function \eqref{eqn:myC}, is
\begin{equation}
R_3 = S + \dfrac{3 \rho ^3 \; S}{2 + 2 \rho + \rho^2 + 3 \rho^3} \label{eqn:react3}
\end{equation}
The difficulty with \eqref{eqn:react3}, however, is that it cannot be further simplified, and
the algebraic form is completely inscrutable by comparison with the morphing model. All intuition is lost.
Part of the trouble stems from the fact that finite $m$ introduces a truncated exponential series
and, unlike \eqref{eqn:fmorph} in the morphing model, there is no simple closed-form expression.
Thus, we are stuck on the horns of a dilemma: the morphing model is much more intuitively appealing (particularly for pedagogy) but it is only an approximation.
On a beneficial note, although \eqref{eqn:rmorph} is an approximation, the error
\begin{equation}
\Delta R_m(\phi) < \dfrac{\ln(m^{1/4})}{1 + \ln(m)}
\end{equation}
\noindent
is bounded above by 25\% for extremely large $m$ values ~\cite{Gunther2017}. In practice, the error is typically
between 5\% and 10\% and
that makes the morphing model useful for quick engineering estimates~\cite{Gunther2007}.
Different approximations for M/M/m queue metrics have been reported by others. See e.g.,~\cite{saka, seidmann}.
One way out of this dilemma is to find the {\em correction factor} that takes us from \eqref{eqn:rmorph} to the exact solution.
Indeed, the corrected version of \eqref{eqn:rmorph} can be written as~\cite{Gunther2017}
\begin{equation}
R_m = \dfrac{S}{1 - \bigg| \dfrac{c_m}{P_{m-1}(\rho)} \bigg| \, \rho^m} \label{eqn:rcorrectd}
\end{equation}
where $P_{m-1}(\rho)$ is the deflated polynomial associated with
\begin{equation*}
P_m(\rho) = c_{m} \, \rho^{m} + \ldots + c_3 \, \rho^3 + c_2 \, \rho^2 + c_1 \, \rho + c_0 \label{eqn:poly}
\end{equation*}
Example integer coefficients, $c_m$, are shown in Table~\ref{tab:coefffs} for $m=1,2,\ldots 8$.
Clearly, the correction polynomials are just as complicated as the terms in the exact Erlang C function
so, not much progress has been achieved by comparison with the morphing model.
The denominator in \eqref{eqn:fmorph}, when analytically continued to complex $\rho$, has zeros that correspond to roots of unity
that lie on the circumference of the unit disk in Fig.~\ref{fig:szego}.
Conversely, zeros of the corrected denominator in \eqref{eqn:rcorrectd} lie on the interior of the unit disk.
As $m$ increases, those zeros move further away from the circumference and converge on the
Szeg\H{o} bound~\cite{Gunther2017,Pritsker1997}.
Even without understanding the mathematical construction, Fig.~\ref{fig:szego} offers a striking visualization of the complexity with which we are dealing.
\begin{figure}[!ht]
\centering
\captionsetup{width=0.8\linewidth}
\includegraphics[scale=0.5]{\figs/roots-256.pdf}
\caption{Zeros ({\em dots}) of the polynomials in Table~\ref{tab:coefffs} for \mbox{$m=1,2,3,\ldots,256$}.
Zeros of the morphing approximation ({\em green dots}) lie symmetrically on the circumference of the unit disk. Zeros of the corrected solutions ({\em blue dots}) lie in the interior of the unit disk and converge on the tear-drop shaped Szeg\H{o} bound ({\em red curve}).} \label{fig:szego}
\end{figure}
\section{Algebraic M/M/m} \label{sec:mmm}
Progress toward an algebraic derivation of the exact solution, while at the same time adhering to the objectives of Sections~\ref{sec:intro} and~\ref{sec:mm1}, can be made by noting that
the mathematical limitations of the morphing construction (and why it is only an approximation)
can be attributed to the following assumptions:
\begin{enumerate}
\item Modifying $R$, rather than $W$, is the wrong starting point. \label{item:pointW}
\item Unlike M/M/1, both $W_m$ and $R_m$ are state-dependent.
\item The low-traffic limit corresponds to $m$ delay servers, not parallel M/M/1 queues. \label{item:pointB}
\end{enumerate}
The last point refers to the assumption that the morphing transformation \eqref{eqn:rmorph} assumes $m$ parallel M/M/1 queues,
with mostly empty waiting lines, in low-traffic limit, whereas there are no waiting states at low load.
With assumption~\ref{item:pointW} in mind, we now turn our attention to the canonical exact form of the
M/M/m waiting time~\cite{Gunther2005,Kleinrock,Allen,Robertazzi}
\begin{equation}
W_m = \dfrac{C(m,\rho) \, S}{m (1-\rho)} \label{eqn:wm}
\end{equation}
Here, $C(m,\rho)$ is the well-known Erlang C function\footnote{Arnold Allen has described using \eqref{eqn:myC} to calculate the Erlang C function as an unnatural act.}, which we write as
\begin{equation}
C(m,a) = \dfrac{A_m}{(1-\rho) \, S_k+ A_m} \label{eqn:myC}
\end{equation}
with $a = m\rho$, $A_m = a^m / m!$ and $S_k = \sum_k^{m-1} a^k / k!$.
We want to determine $C(m,\rho)$ by means of a less abstract procedure than that found in either Erlang's original paper~\cite{Erlang1917} or
standard queueing theory texts~\cite{Kleinrock,Allen,Robertazzi}.
The main idea is to reprise the approach used to derive the morphing model but,
instead of $\phi_\rho$ defined by \eqref{eqn:fmorph}, replace it with
an ansatz transformation function $\Phi_B(m,\rho)$ to derive the the equivalent of $C(m,\rho)$ in a more intuitive way.
Once we determine the equivalent of $C(m,\rho)$, the M/M/m waiting time is defined by \eqref{eqn:wm}, and
the corresponding residence time $R_m$ follows from \eqref{eqn:ironlaw}.
\def0.6{0.6}
\begin{figure}[htbp]
\centering
\captionsetup{width=0.8\linewidth}
\includegraphics[scale=0.6]{\figs/sequence-1.pdf}
\caption{A fraction $B\lambda$ of offered calls is rejected and lost from the system when all $m$ servers become instantaneously busy.
The traffic intensity $a = \lambda S$ can be arbitrarily large.} \label{fig:qseq1}
\end{figure}
\subsection{Visual development} \label{sec:qviz}
In this section we adopt the teletraffic parlance of Erlang's paper~\cite{Erlang1917}.
We could start with a pure delay center, i.e., M/M/$\infty$, where
calls arrive with mean Poisson rate $\lambda$ and are serviced by an infinite number of servers, each having a mean exponentially-distributed service period $S$.
Since a call always finds an available operator, no waiting occurs and the mean time spent in the system is simply $R_m=S$.
However, with assumption~\ref{item:pointB} in mind, it is more appropriate to start with an M/M/m/m queue that has a
finite number of servers but still no waiting states allowed.
That restriction causes calls to be lost from the system with probability $B = B(m,\rho)$, as depicted in Fig.~\ref{fig:qseq1}.
Thus, the queue length can never exceed $m$ calls in service.
This is the Erlang {\em loss model}~\cite{Kleinrock,Allen,Robertazzi,Bertsekas,Gross} with $B$ being
Erlang's B function~\cite[Eq. 1]{Erlang1917}. Following the notation in \eqref{eqn:myC}, we write it as
\begin{equation}
B(m,a) = \dfrac{A_m}{S_k+ A_m} \label{eqn:myB}
\end{equation}
An M/M/m queue, on the other hand, has waiting states.\footnote{A.K. Erlang called them ``waiting arrangements'' rather than a queue. Callers would presumably wait on the line for the operator to finally connect their call manually instead of hanging up.}
In order to include those additional states, we first introduce a ``bucket'' in Fig.~\ref{fig:qseq2} to capture the $B\lambda$ rejected calls.
These captured calls are placed in an ordered list, i.e., callers take a number.
The bucket does not change the operation of the M/M/m/m queue in any way.
\begin{figure}[htbp]
\centering
\captionsetup{width=0.8\linewidth}
\includegraphics[scale=0.6]{\figs/sequence-2.pdf}
\caption{A bucket is introduced to capture the rejected calls as an ordered list. Callers take a number.} \label{fig:qseq2}
\end{figure}
Defining
\begin{equation}
\mathcal{R}_1 = \dfrac{S/m}{1 - \rho} \label{eqn:wmr1}
\end{equation}
to represent the M/M/1 residence time \eqref{eqn:mm1R} but with an $m$-times faster service facility,
\eqref{eqn:wm} can be rewritten as
\begin{equation}
W_m = \mathcal{R}_1 \; \Phi_B \label{eqn:ansatzC}
\end{equation}
where $\Phi_B$ is a transformation to be determined.
Equation \eqref{eqn:ansatzC} says that the M/M/m waiting time can be regarded as a proportion
of the fast residence time $\mathcal{R}_1$. That fraction is given by $\Phi_B$.
Equation \eqref{eqn:ansatzC} is on the same logical footing as \eqref{eqn:rmorph} in the morphing model.
Next, the servers in Fig.~\ref{fig:qseq2} are repositioned behind the bucket (with respect to the direction of traffic flow).
Consequently, the bucket now collects {\em all} incoming calls since there can be no rejected calls.
This is the first significant differece from Figs.~\ref{fig:qseq1} and~\ref{fig:qseq2}.
In this configuration, the bucket would accumulate calls indefinitely, due to the fact that none are being serviced, and
the state-space would therefore become infinite.
\begin{figure}[!ht]
\centering
\captionsetup{width=0.8\linewidth}
\includegraphics[scale=0.6]{\figs/sequence-3.pdf}
\caption{Next, the servers in Fig.~\ref{fig:qseq2}.are repositioned behind the bucket.
The bucket now collects all incoming calls, not just rejected calls, but none are being serviced.} \label{fig:qseq3}
\end{figure}
To avoid the ``overflow'' problem in Fig.~\ref{fig:qseq3}, the bucket has a hole drilled into its base such that calls can be serviced from it in FIFO order.
This is the second significant change. It corresponds to the {\em Erlang C function} in terms of how it relates to the
Erlang B function.
Moreover, new arrivals are appended to the ordered list of calls already in the bucket, which is equivalent to joining the tail of a waiting line.
With servicing restored, the mean number of requests in the bucket reaches steady-state equilibrium and
the number of waiting calls becomes bounded. That number, in turn, determines the mean waiting time $W_m$ in the queue of Fig.~\ref{fig:qseq4}.
\begin{figure}[ht]
\centering
\captionsetup{width=0.8\linewidth}
\includegraphics[scale=0.6]{\figs/sequence-4.pdf}
\caption{To service the collected calls, the bucket has a hole drilled into its base such that calls are serviced in FIFO order.
New arrivals are appended to the ordered list of calls already in the bucket.
The traffic intensity is now bounded above by $a = m$.} \label{fig:qseq4}
\end{figure}
\begin{rem}[Utilization]
There is a constraint on the per-server utilization $\rho$ in both an M/M/m/m queue and an M/M/m queue.
Since the effective arrival rate at the M/M/m/m servers, due lost calls in Fig.~\ref{fig:qseq1}, is only $(1 - B)\lambda$, the per-server utilization is
\begin{equation}
\rho = (1 - B) \, \dfrac{a}{m} < 1 \label{eqn:rhoB}
\end{equation}
and only approaches 100\% busy at large traffic intensities.
With the leaking bucket in place (Fig.~\ref{fig:qseq4}), $B = 0$ so, the per-server utilization becomes
\begin{equation}
\rho =\dfrac{a}{m} < 1 \label{eqn:rhoC}
\end{equation}
which means that $a < m$, in order to maintain queue stability.
\end{rem}
The difference between \eqref{eqn:rhoB} and \eqref{eqn:rhoC} is shown in Fig.~\ref{fig:Butil}. Arriving calls in
Figs.~\ref{fig:qseq1} and~\ref{fig:qseq2} are Poisson distributed, and that introduces a tendency toward longer inter-arrival periods, relative to the mean $S$.
On the other hand, an available M/M/m server instantaneously retrieves the next call from the head of the waiting line
(the hole in the bucket of Fig.~\ref{fig:qseq4}) and thus, it saturates more rapidly.
\begin{figure}[ht]
\centering
\captionsetup{width=0.8\linewidth}
\includegraphics[scale=0.5]{\figs/plot-EB-util.pdf}
\caption{The per-server utilization in M/M/m/m only approaches 100\% busy as the traffic intensity $a$ becomes very large.
M/M/m per-server utilization saturates more rapidly.} \label{fig:Butil}
\end{figure}
\subsection{Ansatz transformation} \label{sec:ansatz}
The progression from Fig.~\ref{fig:qseq1} to Fig.~\ref{fig:qseq4} essentially extends the queueing states from a finite state-space in M/M/m/m to
an infinite state-space in M/M/m.
We need to include the waiting calls of Fig.~\ref{fig:qseq4} into the transformation function of \eqref{eqn:ansatzC}.
We know from both M/M/1 and the morphing model that unbounded waiting states are generally identified with the infinite geometric series
\begin{equation}
\dfrac{1}{1 - \rho} = 1 + \rho + \rho^2 + \rho^3 + \ldots \label{eqn:geoseries}
\end{equation}
familiar in many queue-theoretic formul\ae.
Equation \eqref{eqn:geoseries} provides a clue as to how we might define $\Phi_B$, starting with $B$ in Fig.~\ref{fig:qseq1} but,
also including those waiting states.
However, we cannot define $\Phi_B$ in the same way as \eqref{eqn:geoseries}
because Erlang C in \eqref{eqn:myC} is a probability function that satisfies the following conditions:
\begin{enumerate}
\item $C(m,a) \in [0,1]; ~\text{for}~m = 1,2,3,\ldots ~\text{and}~ a \geq 0$.
\item $C(m=1,a)$ is linear-rising in Fig.~\ref{fig:EC}, as expected for M/M/1. For $a > 1$, Erlang C is constant, i.e., \mbox{$C(1,a) = 1$}, since the server remains saturated at 100\% busy. Of course, in this region, an M/M/1 queue becomes unstable.
\item More generally, $C(m,a)$ is convex up to $a=m$.
\item In the low traffic limit $a \rightarrow 0$, we assume $C \simeq B$ (cf. Fig.~\ref{fig:EB}),
and similarly for our tranformation function, $\Phi_B \simeq B$.
\item In the heavy traffic limit $a \rightarrow m$, we know $C \rightarrow 1$, which suggests $\Phi_B \rightarrow B/B$.
\end{enumerate}
These considerations lead to the following anzatz for $\Phi_B$:
\begin{equation}
\Phi_B = \dfrac{B(m,\rho)}{1 - [1 - B(m,\rho)] \, \rho} \label{eqn:phiB}
\end{equation}
Example expressions of \eqref{eqn:phiB} are shown in Table~\ref{tab:examples}.
\begin{figure}[ht]
\begin{subfigure}[b]{0.5\textwidth}
\begin{center}
\includegraphics[scale=0.45]{\figs/plot-EB.pdf}
\end{center}
\caption{Blocked call probability, B(m,a)} \label{fig:EB}
\end{subfigure}
~
\begin{subfigure}[b]{0.5\textwidth}
\begin{center}
\includegraphics[scale=0.45]{\figs/plot-EC.pdf}
\end{center}
\caption{Probability that call waits, C(m,a)} \label{fig:EC}
\end{subfigure}
\caption{Erlang B and C curves as functions of the traffic intensity $a=\lambda S$.} \label{fig:erlangplotz}
\end{figure}
To further substantiate the choice of \eqref{eqn:phiB}, we consider the light and heavy traffic limits
\begin{equation}
W_m = \left\{
\begin{array}{ll}
0 & \text{as} ~\rho = \epsilon \quad \text{(very light traffic)} \\
\mathcal{R}_1 &\text{as} ~\rho =1-\epsilon \quad \text{(very heavy traffic)}
\end{array}
\right. \label{eqn:wmlimits}
\end{equation}
where $\epsilon$ is a vanishingly small quantity.
\subsection{Light traffic}
Under very low load, $\rho = \epsilon$, the waiting time \eqref{eqn:ansatzC} becomes
\begin{equation*}
W_m = \dfrac{S/m}{1 - \epsilon} \bigg[ \dfrac{B(m,\epsilon)}{1 - [1 - B(m,\epsilon)] \epsilon} \bigg]
\end{equation*}
Since $B(m,\rho) \simeq 0$ when $\rho = \epsilon$, $W_m$ vanishes.
Substituting into \eqref{eqn:ironlaw}, the residence time is $R_m = S$, which also corresponds to Fig.~\ref{fig:qseq1} in the low-traffic limit.
\subsection{Heavy traffic}
Under very high load, $\rho = 1-\epsilon$, and \eqref{eqn:ansatzC} becomes
\begin{equation}
W_m = \dfrac{S/m}{1 - (1 - \epsilon)} \bigg[ \dfrac{B(m,1 - \epsilon)}{1 - [1 - B(m,1 - \epsilon)] (1 - \epsilon)} \bigg] \label{eqn:wheavy}
\end{equation}
From Fig.~\ref{fig:EB}, we see $B(m,\rho) \ll B(m,a)$ and thus, for a given value of $\rho$ and $m$, $B(m,\rho)$ can be replaced by
a constant $\delta < 1$. Applying this to \eqref{eqn:wheavy} produces
\begin{align}
W_m &= \dfrac{S}{m \epsilon} \bigg[ \dfrac{\delta}{1 - [1 - \delta] (1 - \epsilon)} \bigg] \nonumber \\
&= \dfrac{S}{m \epsilon} \bigg[ \dfrac{\delta}{1 - (1 - \delta - \epsilon - \delta \epsilon) } \bigg] \nonumber \\
&= \dfrac{S}{m \epsilon} \label{eqn:wepsilon}
\end{align}
where we have invoked the additional reasonable assumption $\delta \gg \epsilon$. Finally, \eqref{eqn:wepsilon} becomes
\begin{equation*}
W_m = \dfrac{S}{m(1 - \rho)} = \mathcal{R}_1
\end{equation*}
which is identical to \eqref{eqn:wmr1}, viz., an $m$-speed M/M/1 server:
a result that is also in agreement with the {\em morphing model} of Section~\ref{sec:morphing}.
As expected, it also corresponds to \eqref{eqn:wm} under heavy traffic
since Erlang C reaches probability one as $\rho$ approaches 100\% busy.
\begin{table}[ht]
\begin{adjustwidth}{-1cm}{}
\caption{Examples of $\Phi_B(m,a)$ with $a=m\rho$.} \label{tab:examples}
\begin{equation*}
\begin{array}{c | l | l | l}
\hline
\mathbf{m} & \multicolumn{1}{c|}{ \mathbf{B(m,a)} } & \multicolumn{1}{c|}{ \mathbf{ [1 - (1 - B(m,a)) \rho]^{-1} } } & \multicolumn{1}{c}{ \mathbf{\Phi_B(m,a)} } \\
\hline
1 & \frac{\rho }{1+\rho } & 1+\rho & \rho \\[6pt]
2 & \frac{2 \rho ^2}{1+2 \rho (1+\rho )} & \frac{1 + 2 \rho+ 2\rho^2}{1+\rho } & \frac{2 \rho ^2}{1+\rho } \\[6pt]
3 & \frac{9 \rho ^3}{2+3 \rho (2+3 \rho (1+\rho ))} & \frac{2 + 6 \rho+ 9 \rho^2 + 9 \rho^3}{2+ \rho (4+3 \rho )} & \frac{9 \rho ^3}{2+\rho (4+3 \rho )} \\[12pt]
4 & \frac{32 \rho ^4}{3+4 \rho (3+2 \rho (3+4 \rho (1+\rho )))} & \frac{3+4 \rho (3+2 \rho (3+4 \rho (1+\rho )))}{3+\rho (9+4 \rho (3+2 \rho ))} & \frac{32 \rho ^4}{3+\rho (9+4 \rho (3+2 \rho ))} \\[12pt]
5 & \frac{625 \rho ^5}{24+5 \rho (24+5 \rho (12+5 \rho (4+5 \rho (1+\rho ))))} & \frac{24+5 \rho (24+5 \rho (12+5 \rho (4+5 \rho (1+\rho ))))}{24+\rho (96+5 \rho (36+5 \rho (8+5 \rho )))} & \frac{625 \rho ^5}{24+\rho (96+5 \rho (36+5 \rho (8+5 \rho )))} \\[12pt]
6 & \frac{324 \rho ^6}{5+6 \rho (5+3 \rho (5+\rho (10+3 \rho (5+6 \rho (1+\rho )))))} & \frac{5+6 \rho (5+3 \rho (5+\rho (10+3 \rho (5+6 \rho (1+\rho )))))}{5+\rho (25+6 \rho (10+3 \rho (5+\rho (5+3 \rho ))))} & \frac{324 \rho ^6}{5+\rho (25+6 \rho (10+3 \rho (5+\rho (5+3 \rho ))))}\\[12pt]
\hline
\end{array}
\end{equation*}
\end{adjustwidth}
\end{table}
\section{Numerics}
Our purpose here has been to offer a more intuitive derivaton of M/M/m queueing metrics, not to promote \eqref{eqn:phiB} as a
computational device. Computing \eqref{eqn:phiB} is equivalent to computing \eqref{eqn:myC}.
However, if one should want to use $\Phi_B(m,a)$ for calculations or other instruction, then
it is clear that $B(m,a)$ has to be evaluated first.
Rather than using \eqref{eqn:myB} which, to paraphrase Arnold Allen: is hardly more ``natural'' than \eqref{eqn:myC},
Erlang B can more easily be computed using the iterative algorithm~\cite{pdsc} in listing~\ref{list:eB}.
\begin{lstlisting}[language=R, basicstyle=\footnotesize, columns=flexible, keepspaces=true, caption={R code to compute the Erlang B function}, label=list:eB]
erlangB <- function(m, a) {
eB <- a / (1 + a)
if(m == 1) { return(eB) }
for(k in 2:m) {
eB <- eB * a / (a * eB + k)
}
return(eB)
}
\end{lstlisting}
If R, or similar statistical software, is already being employed,
one can make direct use of the Poisson PMF (probability mass function) and CDF (cumulative distribution function) to simplify the code in listing~\ref{list:eB2}.
\begin{lstlisting}[language=R, basicstyle=\footnotesize, columns=flexible, keepspaces=true, caption={Compute Erlang B from the Poisson PMF and CDF}, label=list:eB2]
erlangB <- function(m, a) {
return(dpois(m, a) / ppois(m, a))
}
\end{lstlisting}
Example calculations computed in this way are summarized in Table~\ref{tab:numerics}.
\begin{table}[htp]
\caption{Example M/M/m metrics with mean service time $S=1$~\cite{Erlang1917}} \label{tab:numerics}
\small
\begin{adjustwidth}{-0.75cm}{}
\begin{tabular}{rrlllllll}
\hline
m & \multicolumn{1}{c}{a} & \multicolumn{1}{c}{$B(m,a)$} & \multicolumn{1}{c}{Poisson} & \multicolumn{1}{c}{$\Phi_B$} &
\multicolumn{1}{c}{$C(m,a)$} & \multicolumn{1}{c}{$W_m$} & \multicolumn{1}{c}{$R_m$} & \multicolumn{1}{c}{$R_m(\phi)$}\\
\hline
1 & 0.75 & 0.42857143 & 0.42857143 & 0.75000000 & 0.75000000 & 3.00000000 & 4.000000 & 4.000000\\
2 & 1.50 & 0.31034483 & 0.31034483 & 0.64285714 & 0.64285714 & 1.28571429 & 2.285714 & 2.285714\\
3 & 2.25 & 0.24720244 & 0.24720244 & 0.56775701 & 0.56775701 & 0.75700935 & 1.757009 & 1.729730\\
4 & 3.00 & 0.20610687 & 0.20610687 & 0.50943396 & 0.50943396 & 0.50943396 & 1.509434 & 1.462857\\
8 & 6.00 & 0.12187578 & 0.12187578 & 0.35698109 & 0.35698109 & 0.17849054 & 1.178491 & 1.111251\\
16 & 12.00 & 0.06041259 & 0.06041259 & 0.20457386 & 0.20457386 & 0.05114346 & 1.051143 & 1.010124\\
32 & 24.00 & 0.02209487 & 0.02209487 & 0.08288545 & 0.08288545 & 0.01036068 & 1.010361 & 1.000100\\
\hline
\end{tabular}
\end{adjustwidth}
\end{table}%
\section{Conclusion}
The goal of algebraically deriving the exact residence time for an M/M/m queue---motivated by the same approach to
M/M/1---has finally been achieved here.
Several subtle observations are needed to enable this result:
\begin{enumerate*}[(a)]
\item focus on the waiting time $W_m$, rather than the residence time $R_m$,
\item make M/M/m/m the starting point (rather than parallel M/M/1 queues),
\item the diagrams in Figs.~\ref{fig:qseq1}--\ref{fig:qseq4} aid development of the ansatz $\Phi_B$,
\item $\Phi_B$ must conform to a probability function, and
\item equation \eqref{eqn:phiB} modifies the fast residence time $\mathcal{R}_1$, not $R_1$
\end{enumerate*}
These observations also facilitated reprising the morphing model derivation to verify our ansatz.
Equation \eqref{eqn:phiB} can also be derived formally from \eqref{eqn:myC} and \eqref{eqn:myB} but,
their respective starting points rely on conventional applied probability theory methods, which it has been our objective to avoid.
Indeed, the same expression for the Erlang C function is known in the literature~\cite{Allen,Robertazzi}, especially for the purpose of programmatic
computation.
| {'timestamp': '2020-08-18T02:14:06', 'yymm': '2008', 'arxiv_id': '2008.06823', 'language': 'en', 'url': 'https://arxiv.org/abs/2008.06823'} | arxiv |
\section{Delayed-Aggregation Algorithm}
\label{sec:algo}
\begin{figure*}[t]
\centering
\begin{minipage}[t]{0.65\columnwidth}
\centering
\includegraphics[width=\columnwidth]{ops_reduction}
\caption{MAC operation reduction in the MLP by delayed-aggregation. The MAC count reductions come from directly operating on the input points as opposed to aggregated neighbors.}
\label{fig:overall_ops_red}
\end{minipage}
\hspace{5pt}
\begin{minipage}[t]{0.65\columnwidth}
\centering
\includegraphics[width=\columnwidth]{layer_ops}
\caption{Layer output size distribution as a violin plot with and without delayed-aggregation. High and low ticks denote the largest and smallest layer outputs, respectively.}
\label{fig:layer_mem_red}
\end{minipage}
\hspace{5pt}
\begin{minipage}[t]{0.65\columnwidth}
\centering
\includegraphics[width=\columnwidth]{pointnet_dist}
\caption{Time distribution across ${\mathcal{N}}$, ${\mathcal{A}}$, and ${\mathcal{F}}$ in PointNet++ (s) with and without delayed-aggregation. Note that delayed-aggregation would also allow ${\mathcal{N}}$ and ${\mathcal{F}}$ to be executed in parallel.}
\label{fig:pointnet_dist}
\end{minipage}
\end{figure*}
We introduce delayed-aggregation, a primitive for building efficient point cloud networks (\Sect{sec:algo:algo}). Delayed-aggregation improves the compute and memory efficiencies of point cloud networks without degrading accuracy (\Sect{sec:algo:eff}). We show that aggregation emerges as a new bottleneck in new networks, motivating dedicated hardware support (\Sect{sec:algo:bn}).
\subsection{Algorithm}
\label{sec:algo:algo}
We propose a new framework for building efficient point cloud algorithms. The central idea is to delay aggregation until \textit{after} feature computation so that features are extracted on individual input points rather than on aggregated neighbors. Delayed-aggregation has two benefits. First, it allows neighbor search and feature computation, the two time-consuming components, to be executed in parallel. Second, feature computation operates on input points rather than aggregated neighbors, reducing the compute and memory costs.
\paragraph{Delayed-Aggregation} The key insight is that feature extraction (${\mathcal{F}}$) is \textit{approximately distributive} over aggregation (${\mathcal{A}}$). For an input point $\mathbf{p}_i$ and its corresponding output $\mathbf{p}_o$:
\begin{align}
\mathbf{p}_o = {\mathcal{F}}({\mathcal{A}}({\mathcal{N}}(\mathbf{p}_i),~~\mathbf{p}_i)) \approx {\mathcal{A}}({\mathcal{F}}({\mathcal{N}}(\mathbf{p}_i)),~{\mathcal{F}}(\mathbf{p}_i))
\label{eq:fdist}
\end{align}
Fundamentally, \Equ{eq:fdist} holds because the MLP in ${\mathcal{F}}$ is approximately distributive over subtraction in ${\mathcal{A}}$. Specifically, applying an MLP to the difference of two matrices is approximately equivalent to applying an MLP to both matrices and then subtract the two resulting matrices. The approximation is introduced by the non-linearity in the MLP (e.g., ReLU):
\begin{align}
& \phi(\phi(
\begin{bmatrix}
\mathbf{p}_1 - \mathbf{p}_i \\
... \\
\mathbf{p}_k - \mathbf{p}_i
\end{bmatrix}
\times W_1) \times W_2) \approx \nonumber \\
& \phi(\phi(
\begin{bmatrix}
\mathbf{p}_1 \\
... \\
\mathbf{p}_k
\end{bmatrix}
\times W_1 \times W_2)) - \phi(\phi(
\begin{bmatrix}
\mathbf{p}_i \\
... \\
\mathbf{p}_i
\end{bmatrix}
\times W_1 \times W_2))
\label{eq:mlpdist}
\end{align}
\noindent where $\mathbf{p}_1, ..., \mathbf{p}_k$ are neighbors of $\mathbf{p}_i$, $W_1$ and $W_2$ are the two weight matrices in the MLP (assuming one hidden layer), and $\phi$ is the non-linear activation function. Without $\phi$, the distribution of MLP over subtraction is precise. In actual implementation, the computation on $[\mathbf{p}_i~~...~~\mathbf{p}_i]^\intercal$ is simplified to operating on $\mathbf{p}_i$ once and scattering the result $K$ times.
Critically, applying this distribution allows us to decouple ${\mathcal{N}}$ with ${\mathcal{F}}$. As shown in \Equ{eq:fdist} and \Equ{eq:mlpdist}, ${\mathcal{F}}$ now operates on original input points, i.e., $\mathbf{p}_i$ and ${\mathcal{N}}({\mathbf{p}_i})$ (a subset of the input points, too) rather than the normalized point values ($\mathbf{p}_k - \mathbf{p}_i$), which requires neighbor search results. As a result, we could first apply feature computation on all input points. The computed features are then aggregated later.
\paragraph{Walk-Through} We use the first module in PointNet++ as an example to walk through the new algorithm. This module consumes 1024 ($N_{in}$) input points, among which 512 undergo neighbor search. Thus, the module produces 512 ($N_{out}$) output points. The input feature dimension is 3 ($M_{in}$) and the output feature dimension is 128 ($M_{out}$). \Fig{fig:newalgo} shows this module implemented with delayed-aggregation.
We first compute features (${\mathcal{F}}$) from all 1024 points in the input point cloud and store the results in the Point Feature Table (PFT), a $1024 \times 128$ matrix. Every PFT entry contains the feature vector of an input point. Meanwhile, neighbor searches (${\mathcal{N}}$) are executed in parallel on the input point cloud, each returning 32 neighbors of a centroid. The results of neighbor search are stored in a Neighbor Index Table (NIT), a $512 \times 32$ matrix. Each NIT entry contains the neighbor indices of an input point. In the end, the aggregation operation (${\mathcal{A}}$) aggregates features in the PFT using the neighbor information in the NIT. Note that it is the features that are being aggregated, not the original points.
Each aggregated matrix ($32 \times 128$) is reduced to the final feature vector ($1 \times 128$) of an output point. If reduction is implemented by a max operation as is the common case, aggregation could further be delayed after reduction because subtraction is distributive over max: $max(\mathbf{p}_1 - \mathbf{p}_i, \mathbf{p}_2 - \mathbf{p}_i) = max(\mathbf{p}_1, \mathbf{p}_2) - \mathbf{p}_i$. This optimization avoids scattering $\mathbf{p}_i$, reduces the subtraction cost, and is mathematically precise.
\subsection{First-Order Efficiency Analysis}
\label{sec:algo:eff}
Compared with the original implementation of the same module in \Fig{fig:baselinealgo}, the delayed-aggregation algorithm provides three benefits. First, neighbor search and the MLP are now executed in parallel, hiding the latencies of the slower path.
Second, we significantly reduce the MAC operations in the MLP. In this module, the original algorithm executes MLP on 512 $32 \times 3$ matrices while the new algorithm executes MLP only on one $1024 \times 3$ matrix. \Fig{fig:overall_ops_red} shows the MAC operation reductions across all five networks. On average, delayed-aggregation reduces the MAC counts by 68\%.
Third, delayed-aggregation also reduces the memory traffic because the MLP input is much smaller. While the actual memory traffic reduction is tied to the hardware architecture, as a first-order estimation \Fig{fig:layer_mem_red} compares the distribution of per-layer output size with and without delayed-aggregation. The data is shown as a violin plot. Delayed-aggregation reduces the layer output sizes from 8 MB\textasciitilde 32 MB to 512 KB\textasciitilde 1 MB, amenable to be buffered completely on-chip.
By directly extracting features from the input points, our algorithm unlocks the inherent data reuse opportunities in point cloud. Specifically in this example, \texttt{P3} is a neighbor of both \texttt{\underline{P1}} and \texttt{\underline{P2}}, but could not be reused in feature computation by the original algorithm because \texttt{P3}'s normalized values with respect to \texttt{\underline{P1}} and \texttt{\underline{P2}} are different. In contrast, the MLP in our algorithm directly operates on \texttt{P1}, whose feature is then reused in aggregation, \textit{implicitly} reusing \texttt{P1}.
\subsection{Bottleneck Analysis}
\label{sec:algo:bn}
\begin{figure}
\centering
\includegraphics[width=\columnwidth]{runtime_dist}
\caption{Both absolute (left $y$-axis) and relative (right $y$-axis) aggregation times increase with delayed-aggregation.}
\label{fig:runtime_dist}
\end{figure}
While delayed-aggregation reduces the compute costs and memory accesses, it also significantly increases the aggregation time. Using PointNet++ as an example, \Fig{fig:pointnet_dist} compares the execution time distribution across the three operations (${\mathcal{N}}$, ${\mathcal{A}}$, and ${\mathcal{F}}$) with and without delayed-aggregation. The error bars denote one standard deviation in the measurement. The feature extraction time significantly decreases, and the neighbor search time roughly stays the same --- both are expected. The aggregation time, however, significantly increases.
\Fig{fig:runtime_dist} generalizes the conclusion across the five networks. The figure compares the absolute (left $y$-axis) and relative (right $y$-axis) aggregation time in the original and new algorithms. The aggregation time consistently increases in all five networks. Since neighbor search and feature computation are now executed in parallel, aggregation overhead contributes even more significantly to the overall execution time. On average, the aggregation time increases from 3\% to 24\%.
Aggregation time increases mainly because aggregation involves irregular gather operations~\cite{kirk2016programming}, which now operate on a much larger working set with delayed-aggregation. For instance, in PointNet++'s first module (\Fig{fig:newalgo}), aggregation originally gathers from a 12 KB matrix but now gathers from a 512 KB matrix, which is much larger than the L1 cache size (48 KB -- 96 KB\footnote{To our best knowledge, Nvidia does not publish the L1 cache size for the mobile Pascal GPU in TX2 (GP10B~\cite{gp10b}). We estimate the size based on the L1 cache size per SM in other Pascal GPU chips~\cite{pascaluarch} and the number of SMs in the mobile Pascal GPU~\cite{tx2spec}}) in the mobile Pascal GPU on TX2.
The working set size increases significantly because aggregation in new algorithms gathers data from the PFT, whose dimension is $N_{in} \times M_{out}$, whereas the original algorithms gather data from the input point matrix, whose dimension is $N_{in} \times M_{in}$. $M_{out}$ is usually several times greater than $M_{in}$ in order to extract higher-dimensional features. In the example above, $M_{out}$ is 128-D whereas $M_{in}$ is 3-D.
\section{Architectural Support}
\label{sec:arch}
\begin{figure}[t]
\centering
\includegraphics[width=\columnwidth]{soc}
\caption{The \textsc{Mesorasi}\xspace SoC builds on top of today's SoCs consisting of a GPU and a DNN accelerator (NPU). Neighbor search executes on the GPU and feature extraction executes on the NPU. \textsc{Mesorasi}\xspace augments the NPU with an aggregation unit (AU) to efficiently execute the aggregation operation. The AU structures are shaded (colored).}
\label{fig:soc}
\end{figure}
\begin{figure*}[t]
\centering
\includegraphics[width=2.1\columnwidth]{grouping}
\caption{Aggregation unit. The NIT buffer is double-buffered from the DRAM. The Address Generation logic simply fetches addresses already buffered in the NIT and sends them to the PFT buffer controller. The PFT buffer is organized as B independently addressed single-ported SRAMs. It could be thought of as an optimized version of a traditional B-banked, B-ported SRAM, because it does not need the crossbar that routes data from banks to ports (but does need the crossbar to route an address to the corresponding bank). The PFT buffer is connected to the NPU's global buffer. Each bank produces one word (Wr) per cycle. The shift registers hold up to $M_{out}$ words, where $M_{out}$ is the output feature vector size. The top shift register holds the result of reduction, and the bottom shift register holds the feature vector of a centroid.}
\label{fig:groupinghw}
\end{figure*}
This section describes \textsc{Mesorasi}\xspace, our hardware design that efficiently executes point cloud algorithms developed using delayed-aggregation. \textsc{Mesorasi}\xspace extends existing DNN accelerators with minor augmentations while leaving the rest of the SoC untouched. We start from an overview of \textsc{Mesorasi}\xspace and its workflow (\Sect{sec:arch:ov}), followed by a detailed description of the architecture support (\Sect{sec:arch:aug}).
\subsection{Overall Design}
\label{sec:arch:ov}
We assume a baseline SoC that incorporates a GPU and an NPU, as with emerging mobile SoCs such as Nvidia Xavier~\cite{xaviersoc}, Apple A13~\cite{applea13}, and Microsoft HPU~\cite{hpuaicore}. Point cloud algorithms are a few times faster when an NPU is available to accelerate MLP compared to running only on the GPU (\Sect{sec:eval:res}). Thus, an NPU-enabled SoC represents the trend of the industry and is a more optimized baseline.
\paragraph{Design} \Fig{fig:soc} shows how \textsc{Mesorasi}\xspace augments the NPU in a generic SoC. In \textsc{Mesorasi}\xspace, the GPU executes neighbor search (${\mathcal{N}}$) and the NPU executes feature extraction (${\mathcal{F}}$), i.e., the MLP. In addition, \textsc{Mesorasi}\xspace augments the NPU with an Aggregation Unit (AU) to efficiently execute the aggregation operation (${\mathcal{A}}$). As shown in \Sect{sec:algo:bn}, aggregation becomes a bottleneck in our new algorithms and is inefficient on the GPU. AU minimally extends a generic NPU architecture with a set of principled memory structures and datapaths.
\textsc{Mesorasi}\xspace maps ${\mathcal{N}}$ to the GPU because neighbor search is highly parallel, but does not map to the specialized datapath of an NPU. Alternatively, an SoC could use a dedicated neighbor search engine (NSE)~\cite{Kuhara2013An, xu2019tigris}. We use the GPU because it is prevalent in today's SoCs and thus provides a concrete context to describe our design. We later show that delayed-aggregation could achieve even higher speedups in a futurist SoC where an NSE is available to accelerate neighbor search (\Sect{sec:eval:nse}). In either case, \textsc{Mesorasi}\xspace does not modify the internals of the GPU or the NSE.
\paragraph{Work Flow} Point cloud algorithms with delayed-aggregation work on \textsc{Mesorasi}\xspace as follows. The input point cloud is initially stored in the DRAM. The CPU configures and triggers the GPU and the NPU simultaneously, both of which read the input point cloud. The GPU executes the KNN search and generates the Neighbor Index Table (NIT), which gets stored back to the DRAM. Meanwhile, the NPU computes features for input points and generates the Point Feature Table (PFT). The AU in NPU combines the PFT with the NIT from the memory for aggregation and reduction, and eventually generates the output of the current module.
In some algorithms (e.g., PointNet++), neighbor searches in all modules search in the original 3-D coordinate space, while in other algorithms (e.g., DGCNN) the neighbor search in module $i$ searches in the output feature space of module ($i-1$). In the latter case, the current module's output is written back to the memory for the GPU to read in the next module.
Our design modifies only the NPU while leaving other SoC components untouched. This design maintains the modularity of existing SoCs, broadening the applicability. We now describe the AU augmentation in NPU in detail.
\subsection{Aggregation Unit in NPU}
\label{sec:arch:aug}
Aggregation requires irregular gather operations that are inefficient on GPUs. The key to our architectural support is the specialized memory structures co-designed with customized data structure partitioning, which provide efficient data accesses for aggregation with a little area overhead.
Algorithmically, aggregation iterates over the NIT's $N_{out}$ entries until NIT is exhausted. Each NIT entry contains the $K$ neighbor indices of a centroid $\mathbf{p}$. The aggregation operation first gathers the $K$ corresponding entries (feature vectors) from the PFT ($N_{in} \times M_{out}$). The $K$ feature vectors are then reduced to one ($1 \times M_{out}$) vector, which subtracts $\mathbf{p}$'s feature vector to generate the output feature for $\mathbf{p}$.
\Fig{fig:groupinghw} shows the detailed design of the aggregation unit. The NIT is stored in an SRAM, which is doubled-buffered in order to limit the on-chip memory size. The PFT is stored in a separate on-chip SRAM connected to the NPU's global buffer (which stores the MLP weights and input/output). This allows the output of feature extraction to be directly transferred to the PFT buffer without going through the DRAM. Similarly, the aggregation output is directly written back to the NPU's global buffer, as the aggregation output of the current module is the input to the feature extraction in the next module.
To process each NIT entry, the Address Generation Unit (AGU) uses the $K$ indices to generate $K$ addresses to index into the PFT buffer. Due to the large read bandwidth requirement, the PFT buffer is divided into $B$ independently addressable banks, each of which produces 1 word per cycle.
Each cycle, the PFT buffer produces $B$ words, which enters the reduction unit. In our current design, the reduction unit implements the max logic as is the case in today's point cloud algorithms. The output of the max unit, i.e., the max of the $B$ words, enters a shift register (the top one in \Fig{fig:groupinghw}). Ideally, the number of banks $B$ is the same as the number of neighbors $K$ and the $K$ addresses fall into different banks. If so, the shift register is populated with the $1 \times M_{out}$ vector after $M_{out}$ cycles. The AGU then reads $\mathbf{p}$'s feature vector from the PFT buffer and stores it in another shift register (the bottom one in \Fig{fig:groupinghw}). The two shift registers perform an element-wise subtraction as required by aggregation. The same process continues until the entire NIT is exhausted.
\paragraph{Multi-Round Grouping} In reality, reading the neighbor feature vectors takes more than $M_{out}$ cycles because of two reasons. First, $K$ could be greater than $B$. The number of banks $B$ is limited by the peripheral circuits overhead, which increases as $B$ increases. Second, some of the $K$ addresses could fall into the same bank, causing bank conflicts. We empirically find that an LSB-interleaving reduces bank conflicts, but it is impossible to completely avoid bank conflict at runtime, because the data access patterns in point cloud are irregular and could not be statically calculated -- unlike conventional DNNs and other regular kernels.
We use a simple multi-round design to handle both non-ideal scenarios. Each round the AGU would attempt to identify as many unconflicted addresses as possible, which is achieved by the AGU logic examining each address modulo $B$. The unconflicted addresses are issued to the PFT buffer, whose output enters the max unit to generate a temporary output stored in the shift register. The data in the shift register would be combined with the PFT output in the next round for reduction. This process continues until all the addresses in an NIT buffer entry are processed.
An alternative way to resolve bank-conflict would be to simply ignore conflicted banks, essentially approximating the aggregation operation. We leave it to future work to explore this optimization and its impact on the overall accuracy.
\begin{figure}[t]
\centering
\includegraphics[width=\columnwidth]{colpart}
\caption{Column-major partitioning of PFT to reduce PFT buffer size (4 partitions in this example). Each time the PFT buffer is filled with only one partition. Since reduction (max) is applied to each column independently, the column-major partitioning ensures that all the neighbors of a centroid are present in the PFT buffer for aggregation.}
\label{fig:colpart}
\end{figure}
\paragraph{PFT Buffer Design} One could think of the PFT buffer as a $B$-banked, $B$-ported SRAM. Traditionally, heavily ported and banked SRAMs are area inefficient due to the crossbar that routes each bank's output to the corresponding issuing port~\cite{weste2015cmos}. However, our PFT buffer is much simplified \textit{without} the crossbar. This is by leveraging a key observation that the outputs of all the PFT banks are consumed by the max unit, which executes a \textit{commutative} operation, i.e., $max(a, b)=max(b, a)$. Thus, the output of each bank need not be routed to the issuing port so long as the requested data is correctly produced. This design optimization greatly reduces the area overhead (\Sect{sec:eval:area}).
One might be tempted to reuse the NPU's global buffer for the PFT buffer to save chip area. After all, the PFT \textit{is} MLP's output, which is stored in the global buffer. However, physically sharing the two SRAM structures is difficult, mainly because of their different design requirements. Global buffer contains MLP weights and layer inputs, accesses to which have regular patterns. As a result, NPU global buffers are usually designed with very few ports (e.g., one)~\cite{jouppi2017datacenter, armmlproc} while using a wide word. In contrast, accesses to the PFT are irregular as the neighbors of a centroid could be arbitrary spread in the PFT. Thus, the PFT buffer must be heavily-ported in order to sustain a high bandwidth requirement.
\paragraph{PFT Partitioning} To hold the entire PFT, the buffer must hold $N_{out} \times M_{out}$ features, which could be as large as 0.75~MB in some networks (e.g., DGCNN). Since the PFT buffer adds area overhead, we would like to minimize its size.
We partition the PFT to reduce the PFT buffer size. Each time, the PFT buffer is filled with only one partition. One straightforward strategy is the row-major partitioning, where the PFT buffer holds only a few rows of the PFT. However, since a centroid's neighbors could be arbitrarily spread across different PFT rows, row-major partitioning does not guarantee that all the neighbors of a centroid are present in the PFT buffer (i.e., in the same partition) for aggregation.
Instead, our design partitions the PFT column-wise, where each partition contains several columns of the PFT. \Fig{fig:colpart} illustrates the idea with 4 partitions. In this way, aggregation of a centroid is divided into four steps, each step aggregating only one partition. The column-major partitioning ensures that, within each partition, the neighbors of a centroid are available in the PFT buffer. Since reductions (max) of different columns are independent, the four intermediate reduction results can simply be concatenated in the end.
With column-wise partitioning, each NIT entry is accessed multiples times---once per aggregation step. Thus, a smaller PFT buffer, while reducing the area overhead, would also increase the energy overhead. We later quantify this resource vs. energy trade-off (\Sect{sec:eval:sen}).
\section{Background}
\label{sec:bck}
\paragraph{Point Cloud} A point cloud is an unordered set of points in the 3D Cartesian space. Each point is uniquely identified by its $<x$, $y$, $z>$ coordinates. While point cloud has long been used as a fundamental visual data representation in fields such as 3D modeling~\cite{alliez2017culture} and graphics rendering~\cite{gross2011point, levoy1985use, rusinkiewicz2000qsplat, pfister2000surfels}, it has recently received lots of attention in a range of emerging intelligent systems such as autonomous vehicles~\cite{geiger2012we}, robotics~\cite{whitty2010autonomous}, and AR/VR devices~\cite{stets2017visualization}.
\paragraph{Point Cloud Analytics} Similar to conventional visual analytics that analyzes images and videos, point cloud analytics distill semantics information from point clouds. Examples include object detection~\cite{geiger2012we}, semantics segmentation~\cite{behley2019semantickitti}, and classification~\cite{wu20153d}. While image and video analytics have been well-optimized, point cloud analytics require different algorithms and are much less optimized.
Point cloud algorithms operate by iteratively extracting features of each point. Conventional point cloud algorithms use ``hand-crafted'' features such as FPFH~\cite{rusu2009fast} and SHOT~\cite{tombari2010unique}. Recent deep learning-based algorithms use learned features and have generally out-performed conventional algorithms~\cite{chen2016eyeriss}. This paper thus focuses on deep learning-based algorithms.
We focus on deep learning-based algorithms that directly manipulate raw point clouds. Other data representations such as 2D projections of 3D points and voxelization suffer from low accuracy and/or consume excessively high memory~\cite{liu2019point}.
\section{Conclusion}
\label{sec:conc}
With the explosion of 3D sensing devices (e.g., LiDAR, stereo cameras), point cloud algorithms present exciting opportunities to transform the perception ability of future intelligent machines. \textsc{Mesorasi}\xspace takes a systematic step toward efficient point cloud processing. The key to \textsc{Mesorasi}\xspace is the delayed-aggregation primitive that decouples neighbor search with feature computation and significantly reduces the overall workload. Hardware support maximizes the effectiveness of delayed-aggregation. The potential gain is even greater in future SoCs where neighbor search is accelerated.
\section{Evaluation}
\label{sec:eval}
We first show \textsc{Mesorasi}\xspace adds little hardware overhead (\Sect{sec:eval:area}) while achieving comparable accuracy against original point cloud networks (\Sect{sec:eval:acc}). We then demonstrate the efficiency gains of \textsc{Mesorasi}\xspace on different hardware platforms (\Sect{sec:eval:gpu} -- \Sect{sec:eval:nse}), followed by sensitivity studies (\Sect{sec:eval:sen}).
\subsection{Area Overhead}
\label{sec:eval:area}
\textsc{Mesorasi}\xspace introduces only minimal area overhead with the minor AU augmentations. The main overhead comes from the 88 KB additional SRAM required for the PFT buffer and the NIT buffer. Compared to the baseline NPU, the additional hardware introduces less than 3.8\% area overhead (\SI{0.059}{\mm\squared}), which is even more negligible compared to the entire SoC area (e.g., \SI{350}{\mm\squared} for Nvidia Xavier~\cite{xaviersochotchips} and \SI{99}{\mm\squared} for Apple A13~\cite{applea13}).
Our custom-designed PFT buffer avoids the crossbar connecting the banks to the read ports by exploiting the algorithmic characteristics (\Sect{sec:arch:aug}). Since our PFT buffer is heavily banked (32) and ported (32) and each bank is small in size (2 KB), the additional area overhead introduced by the crossbar would have been high. Specifically, the area of the PFT buffer now is \SI{0.031}{\mm\squared}, but the crossbar area would be \SI{0.064}{\mm\squared}, which is now avoided.
\subsection{Accuracy}
\label{sec:eval:acc}
Overall, \textsc{Mesorasi}\xspace matches or out-performs the original algorithms. We train all seven networks with delayed-aggregation from scratch until the accuracy converges. \Fig{fig:app_acc} compares our accuracy with that of the baseline models, which we choose the better of the reported accuracies in the original papers or accuracies from training their released code. Overall, \textsc{Mesorasi}\xspace leads to at most 0.9\% accuracy loss in the case of PointNet++ (c) and up to 1.2\% accuracy gain in the case of F-PointNet. This shows that, while delayed-aggregation approximates the original algorithms, the accuracy loss could be recovered from training. Delayed-aggregation could be used as a primitive to build accurate point cloud algorithms.
We find that fine-tuning the model weights trained on the original networks has similar accuracies as retraining from scratch. However, directly using the original weights without retraining leads to a few percentages of accuracy loss, which is more significant when the non-linear layers use batch normalization, which perturbs the distributive property of matrix multiplication over subtraction more than ReLU.
\begin{figure}[t]
\centering
\includegraphics[width=\columnwidth]{pcloud_accuracy}
\caption{The accuracy comparison between networks trained with delayed-aggregation and the original networks.}
\label{fig:app_acc}
\end{figure}
\subsection{Results on GPU}
\label{sec:eval:gpu}
\begin{figure}
\centering \includegraphics[width=\columnwidth]{gpu_speedup_energy}
\caption{Speedup and energy reduction of the delayed-aggregation algorithm and the limited version of the algorithm on the mobile Pascal GPU on TX2.}
\label{fig:sw_speedup_energy}
\end{figure}
We first show that our delayed-aggregation algorithm readily achieves significant speedups on today's GPU \textit{without} hardware support. \Fig{fig:sw_speedup_energy} shows the speedup and energy reduction of \textsc{Mesorasi}\xspace on the Pascal GPU on TX2.
As a comparison, we also show the results of a limited version of delayed-aggregation, where only the matrix-vector multiplication (MVM) part of an MLP is hoisted before aggregation (Ltd-\textsc{Mesorasi}\xspace). The limited delayed-aggregation algorithm is inspired by certain Graph Neural Network (GNN) implementations such as GCN~\cite{gcnpytorch, fey2019pytorchgeo, wang2019deep} and GraphSage~\cite{graphsagetf}. Note that by hoisting only the MVM rather than the entire MLP, Ltd-\textsc{Mesorasi}\xspace is precise since MVM is linear. We refer interested readers to the wiki page of our code repository~\cite{mesorasiwiki} for a detailed comparison between our delayed-aggregation and GNN's limited delayed-aggregation.
On average, \textsc{Mesorasi}\xspace achieves $1.6\times$ speedup and 51.1\% energy reduction compared to the original algorithms. In comparison, the limited delayed-aggregation algorithm achieves only $1.3\times$ speedup and 28.3\% energy reduction. Directly comparing with Ltd-\textsc{Mesorasi}\xspace, \textsc{Mesorasi}\xspace has $1.3\times$ speedup and 25.9\% energy reduction. This is because the limited delay-aggregation, in order to be precise, could be applied to only the first MLP layer. By being approximate, \textsc{Mesorasi}\xspace does not have this constraint and thus enables larger benefits; the accuracy loss could be recovered through fine-tuning (\Fig{fig:app_acc}). \textsc{Mesorasi}\xspace has similar performance as Ltd-\textsc{Mesorasi}\xspace on DGCNN (c), LDGCNN, and DensePoint, because these three networks have only one MLP layer per module.
Although delayed-aggregation allows neighbor search and feature extraction to be executed in parallel, and our implementation does exploit the concurrent kernel execution in CUDA, we find that neighbor search and feature extraction in actual executions are rarely overlapped. Further investigation shows that this is because the available resources on the Pascal GPU on TX2 are not sufficient to allow both kernels to execute concurrently. We expect the speedup to be even higher on more powerful mobile GPUs in the future.
Overall, networks in which feature computation contributes more heavily to the overall time, such as PointNet++ (c) and F-PointNet (\Fig{fig:motivation-dist}), have higher MAC operation reductions (\Fig{fig:overall_ops_red}), and thus have higher speedups and energy reductions. This confirms that the improvements are mainly attributed to optimizing the MLPs in feature computation.
\subsection{Speedup and Energy Reduction}
\label{sec:eval:res}
\begin{figure}[t]
\centering
\subfloat[Speedup. Higher is better.]{
\label{fig:hw_speedup} \includegraphics[width=\columnwidth]{hw_speedup} }
\\
\vspace{-5pt}
\subfloat[Normalized energy. Lower is better.]{
\label{fig:hw_energy}
\includegraphics[width=\columnwidth]{hw_energy} }
\caption{Speedup and energy reduction of \sys{\textsc{Mesorasi}\xspace-SW} and \sys{\textsc{Mesorasi}\xspace-HW} over the baseline (GPU+NPU), which is twice as fast and consumes one-third of the energy compared to the GPU, indicating an optimized baseline to begin with.}
\label{fig:hw_speedup_energy}
\end{figure}
\textsc{Mesorasi}\xspace also improves the performance and energy consumption of emerging mobile SoCs with a dedicated NPU. \Fig{fig:hw_speedup} and \Fig{fig:hw_energy} show the speedup and the normalized energy consumption of the two \textsc{Mesorasi}\xspace variants over the NPU+GPU baseline, respectively.
\paragraph{Software} The delayed-aggregation algorithm alone without AU support, i.e., \sys{\textsc{Mesorasi}\xspace-SW}, has a $1.3\times$ speedup and 22\% energy saving over the baseline. The main contributor of the improvements is optimizing the MLPs in feature computation. \Fig{fig:systolic_speedup} shows the speedups and energy savings of the delayed-aggregation algorithm on feature computation. On average, the feature computation time is reduced by $5.1\times$ and the energy consumption is reduced by 76.3\%.
The large speedup on feature computation does not translate to similar overall speedup, because feature computation time has already been significantly reduced by the NPU, leaving less room for improvement. In fact, our GPU+NPU baseline is about 1.8$\times$ faster (\Fig{fig:hw_speedup}) and consumes 70\% less energy compared to the GPU (\Fig{fig:hw_energy}). The increased workload of aggregation also adds to the overhead, leading to overall lower speedup and energy reduction than on GPU.
\paragraph{Hardware} With the AU hardware, \sys{\textsc{Mesorasi}\xspace-HW} boosts the speedup to $1.9 \times$ (up to $3.6\times$) and reduces the energy consumption by 37.6\% (up to $92.9\%$). DGCNN (s) has the least speedup because it has the least aggregation time (\Fig{fig:runtime_dist}), thus benefiting the least from the AU hardware.
\Fig{fig:perf_details} shows the speedup and energy reduction of aggregation over the baseline (which executes aggregation on the GPU). Overall, \sys{\textsc{Mesorasi}\xspace-HW} reduces the aggregation time by $7.5\times$ and reduces the energy by 99.4\%. The huge improvements mainly come from using a small memory structure customized to the data access patterns in aggregation.
\begin{figure}[t]
\centering
\captionsetup[subfigure]{width=0.5\columnwidth}
\subfloat[\small{Feature computation.}]
{
\includegraphics[width=.48\columnwidth]{systolic_speedup}
\label{fig:systolic_speedup}
}
\subfloat[\small{Aggregation.}]
{
\includegraphics[width=.48\columnwidth]{group_speedup}
\label{fig:group_speedup}
}
\caption{Speedup and energy savings on feature computation and aggregation.}
\label{fig:perf_details}
\end{figure}
On average, 27\% (max 29\%) of PFT buffer accesses are to serve previous bank conflicts. The total time spent on PFT buffer accesses is 1.5$\times$ of the ideal case without bank conflicts. Empirically we do not observe pathological cases.
The AU's speedup varies across networks. For instance, the speedup on PointNet++ (c) is over 3$\times$ higher than that of F-PointNet. This is because the speedup decreases as bank conflict increases; bank conflicts occur more often when neighbor search returns more neighbors. The neighbor searches in PointNet++ (c) mostly return 32 neighbors, whereas neighbor searches in F-PointNet return mostly 128 neighbors, significantly increasing the chances of bank conflicts. This also explains why PointNet++ (c) has overall higher speedup than F-PointNet (\Fig{fig:hw_speedup}).
\subsection{Results with Neighbor Search Engine (NSE)}
\label{sec:eval:nse}
From the evaluations above, it is clear that the improvements of \textsc{Mesorasi}\xspace will ultimately be limited by the neighbor search overhead, which \textsc{Mesorasi}\xspace does not optimize and becomes the ``Amdahl's law bottleneck.''
To assess the full potential of \textsc{Mesorasi}\xspace, we evaluate it in a futuristic SoC that incorporates a dedicated neighbor search engine (NSE) that accelerates neighbor searches. We implement a recently published NSE built specifically for accelerating neighbor searches in point cloud algorithms~\cite{xu2019tigris}, and incorporate it into our SoC model. On average, the NSE provides over 60$\times$ speedup over the GPU. Note that the NSE is \textit{not} our contribution. Instead, we evaluate the potential speedup of \textsc{Mesorasi}\xspace if an NSE is available.
The speedup of \textsc{Mesorasi}\xspace greatly improves when neighbor search is no longer a bottleneck. \Fig{fig:nse_speedup} shows the speedups of \sys{\textsc{Mesorasi}\xspace-SW} and \sys{\textsc{Mesorasi}\xspace-HW} on the NSE-enabled SoC. On average, \sys{\textsc{Mesorasi}\xspace-SW} achieves $2.1\times$ speedup and \sys{\textsc{Mesorasi}\xspace-HW} achieves $6.7\times$ speedup. The two DGCNN networks have particularly high speedups because neighbor search contributes heavily to their execution times (\Fig{fig:motivation-dist}).
\begin{figure}
\centering
\includegraphics[width=\columnwidth]{nse_speedup}
\caption{\sys{\textsc{Mesorasi}\xspace-SW} and \sys{\textsc{Mesorasi}\xspace-HW} speedup over an NSE-enabled SoC (GPU+NPU+NSE), which is 4.0$\times$ faster than the GPU by accelerating both MLP and neighbor search.}
\label{fig:nse_speedup}
\end{figure}
\subsection{Sensitivity Study}
\label{sec:eval:sen}
The evaluations so far are based on one hardware configuration. We now study how the improvements vary with different hardware resource provisions. In particular, we focus on two types of hardware resources: the baseline NPU and the AU augmentation. Due to the page limit, we show only the results of PointNet++ (s). The general trend holds.
\paragraph{NPU} We find that \textsc{Mesorasi}\xspace has higher speedups when the NPU is smaller. \Fig{fig:sa_profile} shows how the speedup and normalized energy of \sys{\textsc{Mesorasi}\xspace-HW} over the baseline vary as the systolic array (SA) size increases from $8 \times 8$ to $48 \times 48$. As the SA size increases, the feature extraction time decreases, and thus leaving less room for performance improvement. As a result, the speedup decreases from 2.8$\times$ to 1.2$\times$.
Meanwhile, the energy reduction increases from 17.7\% to $23.4\%$. This is because a large SA is more likely throttled by memory bandwidth, leading to overall higher energy.
\paragraph{AU} We find that the AU energy consumption is sensitive to the NIT and PFT buffer sizes. \Fig{fig:au_profile} shows the AU energy under different NIT and PFT buffer sizes. The results are normalized to the nominal design point described in \Sect{sec:exp} (i.e., a 64 KB of PFT and a 12 KB NIT).
The energy consumption increases as the PFT and NIT buffer sizes decrease. In an extremely small setting with an 8 KB PFT buffer and a 3 KB NIT buffer, the AU energy increases by 32$\times$, which leads to a 5.6\% overall energy increase. This is because a smaller PFT buffer leads to more PFT partitions, which increases NIT buffer energy since each NIT entry must be read once per partition. Meanwhile, a smaller NIT requires more DRAM accesses, whose energy dominates as the PFT buffer becomes very small. On the other extreme, using a 256 KB PFT buffer and a 96 KB NIT buffer reduces the overall energy by 2.0\% while increasing the area overhead by 4$\times$. Our design point balances energy saving and area overhead.
\begin{figure}[t]
\centering
\begin{minipage}[t]{0.48\columnwidth}
\centering
\includegraphics[width=\columnwidth]{systolic_profile}
\caption{Sensitivity of the speedup and energy to the systolic array size.}
\label{fig:sa_profile}
\end{minipage}
\hspace{2pt}
\begin{minipage}[t]{0.48\columnwidth}
\centering
\includegraphics[width=\columnwidth]{au_profile}
\caption{Sensitivity of AU energy consumption to the NIT/PFT buffer sizes.}
\label{fig:au_profile}
\end{minipage}
\end{figure}
\section{Experimental Setup}
\label{sec:exp}
\paragraph{Hardware Implementation} We develop RTL implementations for the NPU and its augmentations for the aggregation unit (AU). The NPU is based on the systolic array architecture, and consists of a $16 \times 16$ PE array. Each PE consists of two input registers, a MAC unit with an accumulator register, and simple trivial control logic. This is identical to the PE in the TPU~\cite{jouppi2017datacenter}. Recall that MLPs in point cloud networks process batched inputs (\Fig{fig:baselinealgo}), so the MLPs perform matrix-matrix product that can be efficiently implemented on a systolic array. The NPU's global buffer is sized at 1.5 MB and is banked at a 128 KB granularity.
The PFT buffer in the AU is sized at 64 KB with 32 banks. The NIT buffer is doubled-buffered; each buffer is implemented as one SRAM bank sized at 12 KB and holds 128 entries. The NIT buffer produces one entry per cycle. Each entry is 98 Bytes, accommodating 64 neighbor indices (12 bits each). Each of the two shift registers is implemented as 256 flip-flops (4-byte each). The datapath mainly consists of 1) one 33-input max unit and 256 subtraction units in the reduction unit, and 2) 32 32-input MUXes in the AGU.
The design is clocked at 1 GHz. The RTL is implemented using Synposys synthesis and Cadence layout tools in TSMC 16nm FinFET technology, with SRAMs generated by an Arm memory compiler. Power is simulated using Synopsys PrimeTimePX, with fully annotated switching activity.
\paragraph{Experimental Methodology} The latency and energy of the NPU (and its augmentation) are obtained from post-synthesis results of the RTL design. We model the GPU after the Pascal mobile GPU in the Nvidia Parker SoC hosted on the Jetson TX2 development board~\cite{tx2spec}. The SoC is fabricated in a 16 nm technology node, same as our NPU. We directly measure the GPU execution time as well as the kernel launch time. The GPU energy is directly measured using the built-in power sensing circuity on TX2.
The DRAM parameters are modeled after Micron 16 Gb LPDDR3-1600 (4 channels) according to its datasheet~\cite{micronlpddr3}. DRAM energy is calculated using Micron's System Power Calculators~\cite{microdrampower} using the memory traffic, which includes: 1) GPU reading input point cloud, 2) NPU accessing MLP kernels and activations each layer, and 3) GPU writing NIT and NPU reading NIT. Overall, the DRAM energy per bit is about 70$\times$ of that of SRAM, matching prior work~\cite{Yazdanbakhsh2018GAN, gao2017tetris}.
The system energy is the aggregation of GPU, NPU, and DRAM. The overall latency is sum of GPU, NPU, and DRAM minus: 1) double buffering in the NPU, and 2) parallel execution between neighbor search on GPU and feature computation on NPU. Due to double-buffering, the overall latency is dominated by the compute latency, not memory.
\begin{table}
\caption{Evaluation benchmarks.}
\resizebox{\columnwidth}{!}{
\renewcommand*{\arraystretch}{1}
\renewcommand*{\tabcolsep}{10pt}
\begin{tabular}{ cccc }
\toprule[0.15em]
\textbf{\specialcell{Application\\Domains}} & \textbf{\specialcell{Algorithm}} & \textbf{Dataset} & \textbf{Year} \\
\midrule[0.05em]
\specialcell{Classification} & \specialcell{PointNet++ (c)\\DGCNN (c)\\LDGCNN\\DensePoint} & ModelNet40 & \specialcell{2017\\2019\\2019\\2019} \\
\midrule[0.05em]
\specialcell{Segmentation} &
\specialcell{PointNet++ (s)\\DGCNN (s)} & ShapeNet & \specialcell{2017\\2019} \\
\midrule[0.05em]
\specialcell{Detection} & \specialcell{F-PointNet} & KITTI & \specialcell{2018} \\
\bottomrule[0.15em]
\end{tabular}
}
\label{tab:eval_app}
\end{table}
\paragraph{Software Setup} \Tbl{tab:eval_app} lists the point cloud networks we use, which cover different domains for point cloud analytics including object classification, segmentation, and detection. The networks cover both classic and recent ones (2019).
For classification, we use four networks: PointNet++~\cite{qi2017pointnet++}, DGCNN~\cite{wang2019dynamic}, LDGCNN~\cite{zhang2019linked}, and DensePoint~\cite{liu2019densepoint}; we use the ModelNet40~\cite{wu20153d} dataset. We report the standard overall accuracy metric. To evaluate segmentation, we use the variants of PointNet++ and DGCNN specifically built for segmentation, and use the ShapeNet dataset~\cite{shapenet2015}. We report the standard mean Intersection-over-Unit (mIoU) accuracy metric. Finally, we use F-PointNet~\cite{qi2018frustum} as the object detection network. We use the KITTI dataset~\cite{geiger2012we} and report the geometric mean of the IoU metric (BEV) across its classes.
We optimize the author-released open-source version of these networks to obtain stronger software baselines. We: 1) removed redundant data duplications introduced by \texttt{tf.tile}; 2) accelerated the CPU implementation of an important kernel, 3D Interpretation (\texttt{three\_interpolate}), with a GPU implementation; 3) replaced the Farthest Point Sampling with random sampling in PointNet++ with little accuracy loss; 4) replaced the Grouping operation (\texttt{group\_point}) with an optimized implementation (\texttt{tf.gather}) to improve the efficiency of grouping/aggregation. On TX2, our baseline networks are 2.2$\times$ faster than the open-source versions.
\paragraph{Baseline} We mainly compare with a generic NPU+GPU SoC without any \textsc{Mesorasi}\xspace-related optimizations. Compared to the baseline, our proposal improves both the software, i.e., the delayed-aggregation algorithm as well as hardware, i.e., the aggregation unit (AU) augmentations to the NPU.
\paragraph{Variants} To decouple the contributions of our algorithm and hardware, we present two different \textsc{Mesorasi}\xspace variants:
\begin{itemize}
\item \sys{\textsc{Mesorasi}\xspace-SW}: delayed-aggregation without AU support. Neighbor search and aggregation execute on the GPU; feature computation executes on the NPU.
\item \sys{\textsc{Mesorasi}\xspace-HW}: delayed-aggregation with AU support. Neighbor search executes on the GPU; aggregation and feature computation execute on the NPU.
\end{itemize}
\section{Introduction}
\label{sec:intro}
In recent years, we have seen the explosive rise of intelligent machines that operate on \textit{point clouds}, a fundamental visual data representation that provides a direct 3D measure of object geometry, rather than 2D projections (i.e., images). For instance, Waymo’s self-driving cars carry five LiDAR sensors to gather point clouds from the environment in order to estimate the trajectory over time and to sense object depths~\cite{waymolidar}. Augmented Reality (AR) development frameworks such as Google's ARCore enable processing point clouds for localization (SLAM) and scene understanding~\cite{arcore}. While point cloud algorithms traditionally use ``hand-crafted'' features~\cite{rusu2009fast, tombari2010unique}, they are increasingly moving towards learned features using deep learning~\cite{qi2017pointnet++, wang2019dynamic}, which poses significant efficiency challenges.
We present \textsc{Mesorasi}\xspace\footnote{\textipa{[me-s"@ra-z\=e]} Between two vision modes. \textit{meso}-: in the middle; from Ancient Greek \textmu$\acute{\varepsilon}$\textsigma\textomikron\textvarsigma. \textit{orasi}: vision; from Greek $\acute{o}$\textrho\textalpha\textsigma\texteta.}, an algorithm-architecture co-designed system that simultaneously improves the performance and energy efficiency of point cloud algorithms without hurting the accuracy. \textsc{Mesorasi}\xspace applies algorithmic and architectural optimizations that exploit characteristics unique to point cloud. Critically, our algorithmic optimizations can directly benefit software running on commodity GPUs without hardware support. Minor augmentations to contemporary DNN accelerators (NPU) unlock further improvements, widening the applicability of \textsc{Mesorasi}\xspace.
We start by understanding the characteristics of point cloud algorithms. They inherit the key idea of conventional image/video processing algorithms (e.g., CNNs): extracting features from local windows (neighborhoods) iteratively and hierarchically until the final output is calculated. However, since points in a point cloud are arbitrarily spread in the 3D space, point cloud algorithms require explicit neighbor search and point aggregation operations (as opposed to direct memory indexing) before the actual feature computation.
This leads to two fundamental inefficiencies. First, the three key steps---neighbor search, aggregation, and feature computation---are serialized, leading to long critical path latency. In particular, neighbor search and feature computation dominate the execution time. Second, feature computation operates on aggregated neighbor points, which are inherently redundant representations of the original points, leading to massive memory and computation redundancies.
We propose \textit{delayed-aggregation}, a new algorithmic primitive for building efficient point cloud networks. The key idea is to delay aggregation after feature computation by exploiting the \textit{approximately distributive} property of feature computation over aggregation. In this way, feature computation operates directly on original input points rather aggregated neighbors, significantly reducing the compute cost and memory accesses. In addition, delayed-aggregation breaks the serialized execution chain in existing algorithms, overlapping neighbor search and feature computation---the two performance bottlenecks---to hide long latencies.
To maximize the benefits of delayed-aggregation, we propose minor extensions to conventional DNN accelerators. We find that delayed-aggregation increases the overhead of aggregation, which involves irregular gather operations. The hardware extension co-designs an intelligent data structure partitioning strategy with a small but specialized memory unit to enable efficient aggregation. Our hardware extensions are integrated into generic DNN accelerators without affecting the rest of a mobile Systems-on-a-Chip (SoC).
We evaluate \textsc{Mesorasi}\xspace on a set of popular point cloud algorithms and datasets. On the mobile Pascal GPU on TX2, a representative mobile platform today, the delayed-aggregation algorithm alone without hardware support achieves 1.6$\times$ speedup and 51.1\% energy reduction while retaining the accuracy (-0.9\% loss to 1.2\% gains). We implement and synthesize the \textsc{Mesorasi}\xspace hardware support in a 16nm process node and integrate it into a state-of-the-art SoC that incorporates a GPU and an NPU. With 3.8\% area overhead to the NPU (\textless 0.05\% of a typical SoC area), \textsc{Mesorasi}\xspace achieves up to 3.6$\times$ speedup, which increases to 6.7 on a futuristic SoC with a dedicated neighbor search accelerator.
The artifact is publicly available at \url{https://github.com/horizon-research/efficient-deep-learning-for-point-clouds}. In summary, this paper makes the following contributions:
\begin{itemize}
\item We comprehensively characterize the performance bottlenecks as well as the memory and compute cost of state-of-the-art point cloud algorithms, and identify the root-causes of the algorithmic inefficiencies.
\item We propose delayed-aggregation, an efficient algorithm primitive that enables point cloud algorithms to hide the performance bottlenecks and to reduce the overall workload. Delayed-aggregation can readily achieve significant speedup and energy savings on current-generation mobile GPUs without hardware modification.
\item We co-design hardware with delayed-aggregation to achieve even greater speedups with minor, yet principled, augmentations to conventional DNN accelerators while retaining the modularity of existing SoCs.
\end{itemize}
\section{Introduction}
\label{sec:intro}
In recent years, we have seen the explosive rise of intelligent machines that operate on \textit{point clouds}, a fundamental visual data representation that provides a direct 3D measure of object geometry, rather than 2D projections (i.e., images). For instance, Waymo’s self-driving cars carry five LiDAR sensors to gather point clouds from the environment in order to estimate the trajectory over time and to sense object depths~\cite{waymolidar}. Augmented Reality (AR) development frameworks such as Google's ARCore enable processing point clouds for localization (SLAM) and scene understanding~\cite{arcore}. While point cloud algorithms traditionally use ``hand-crafted'' features~\cite{rusu2009fast, tombari2010unique}, they are increasingly moving towards learned features using deep learning~\cite{qi2017pointnet++, wang2019dynamic}, which poses significant efficiency challenges.
We present \textsc{Mesorasi}\xspace\footnote{\textipa{[me-s"@ra-z\=e]} Between two vision modes. \textit{meso}-: in the middle; from Ancient Greek \textmu$\acute{\varepsilon}$\textsigma\textomikron\textvarsigma. \textit{orasi}: vision; from Greek $\acute{o}$\textrho\textalpha\textsigma\texteta.}, an algorithm-architecture co-designed system that simultaneously improves the performance and energy efficiency of point cloud algorithms without hurting the accuracy. \textsc{Mesorasi}\xspace applies algorithmic and architectural optimizations that exploit characteristics unique to point cloud. Critically, our algorithmic optimizations can directly benefit software running on commodity GPUs without hardware support. Minor augmentations to contemporary DNN accelerators (NPU) unlock further improvements, widening the applicability of \textsc{Mesorasi}\xspace.
We start by understanding the characteristics of point cloud algorithms. They inherit the key idea of conventional image/video processing algorithms (e.g., CNNs): extracting features from local windows (neighborhoods) iteratively and hierarchically until the final output is calculated. However, since points in a point cloud are arbitrarily spread in the 3D space, point cloud algorithms require explicit neighbor search and point aggregation operations (as opposed to direct memory indexing) before the actual feature computation.
This leads to two fundamental inefficiencies. First, the three key steps---neighbor search, aggregation, and feature computation---are serialized, leading to long critical path latency. In particular, neighbor search and feature computation dominate the execution time. Second, feature computation operates on aggregated neighbor points, which are inherently redundant representations of the original points, leading to massive memory and computation redundancies.
We propose \textit{delayed-aggregation}, a new algorithmic primitive for building efficient point cloud networks. The key idea is to delay aggregation after feature computation by exploiting the \textit{approximately distributive} property of feature computation over aggregation. In this way, feature computation operates directly on original input points rather aggregated neighbors, significantly reducing the compute cost and memory accesses. In addition, delayed-aggregation breaks the serialized execution chain in existing algorithms, overlapping neighbor search and feature computation---the two performance bottlenecks---to hide long latencies.
To maximize the benefits of delayed-aggregation, we propose minor extensions to conventional DNN accelerators. We find that delayed-aggregation increases the overhead of aggregation, which involves irregular gather operations. The hardware extension co-designs an intelligent data structure partitioning strategy with a small but specialized memory unit to enable efficient aggregation. Our hardware extensions are integrated into generic DNN accelerators without affecting the rest of a mobile Systems-on-a-Chip (SoC).
We evaluate \textsc{Mesorasi}\xspace on a set of popular point cloud algorithms and datasets. On the mobile Pascal GPU on TX2, a representative mobile platform today, the delayed-aggregation algorithm alone without hardware support achieves 1.6$\times$ speedup and 51.1\% energy reduction while retaining the accuracy (-0.9\% loss to 1.2\% gains). We implement and synthesize the \textsc{Mesorasi}\xspace hardware support in a 16nm process node and integrate it into a state-of-the-art SoC that incorporates a GPU and an NPU. With 3.8\% area overhead to the NPU (\textless 0.05\% of a typical SoC area), \textsc{Mesorasi}\xspace achieves up to 3.6$\times$ speedup, which increases to 6.7 on a futuristic SoC with a dedicated neighbor search accelerator.
The artifact is publicly available at \url{https://github.com/horizon-research/efficient-deep-learning-for-point-clouds}. In summary, this paper makes the following contributions:
\begin{itemize}
\item We comprehensively characterize the performance bottlenecks as well as the memory and compute cost of state-of-the-art point cloud algorithms, and identify the root-causes of the algorithmic inefficiencies.
\item We propose delayed-aggregation, an efficient algorithm primitive that enables point cloud algorithms to hide the performance bottlenecks and to reduce the overall workload. Delayed-aggregation can readily achieve significant speedup and energy savings on current-generation mobile GPUs without hardware modification.
\item We co-design hardware with delayed-aggregation to achieve even greater speedups with minor, yet principled, augmentations to conventional DNN accelerators while retaining the modularity of existing SoCs.
\end{itemize}
\section{Motivation}
\label{sec:mot}
We first introduce the general flow of point cloud algorithms and identify key operators (\Sect{sec:mot:conv}). We then characterize point cloud algorithms on today's hardware systems to understand the algorithmic and execution bottlenecks (\Sect{sec:mot:char}), which motivate the \textsc{Mesorasi}\xspace design.
\begin{figure}[t]
\centering
\subfloat[Network architecture of PointNet++~\cite{qi2017pointnet++}.]{
\label{fig:pointnet2}
\includegraphics[width=\columnwidth]{module-pointnet2}
}
\\
\subfloat[DGCNN~\cite{wang2019dynamic} network architecture. ``\textbf{+}'' is tensor concatenation.]{
\label{fig:dgcnn}
\includegraphics[width=\columnwidth]{module-dgcnn}
}
\caption{Point cloud networks consist of a set of modules, which extract local features from the input point cloud iteratively and hierarchically to calculate the final output.}
\label{fig:module}
\end{figure}
\begin{figure}[t]
\centering
\subfloat[Convolution in conventional CNNs can be thought of as two steps: 1) neighbor search (${\mathcal{N}}$) by directly indexing adjacent pixels and 2) feature computation (${\mathcal{F}}$) by a dot product.]
{
\includegraphics[trim=0 0 0 0, clip, width=\columnwidth]{convreuse}
\label{fig:convreuse}
}
\\
\subfloat[Point cloud networks consist of three main steps: neighbor search (${\mathcal{N}}$), aggregation (${\mathcal{A}}$), and feature computation (${\mathcal{F}}$). ${\mathcal{N}}$ requires an explicit neighbor search; ${\mathcal{A}}$ normalizes neighbors to their centroid; ${\mathcal{F}}$ is an MLP with batched inputs (i.e., shared MLP weights).]
{
\includegraphics[trim=0 0 0 0, clip, width=\columnwidth]{nsreuse}
\label{fig:nsreuse}
}
\caption{Comparing a convolution layer in conventional CNNs and a module in point cloud networks.}
\label{fig:conv}
\end{figure}
\begin{figure*}[t]
\centering
\includegraphics[width=2.1\columnwidth]{baselinealgo}
\caption{The first module in PointNet++~\cite{qi2017pointnet++}. The same MLP is shared across all the row vectors in a Neighbor Feature Matrix (NFM) and also across different NFMs. Thus, MLPs in point cloud networks process batched inputs, effectively performing matrix-matrix multiplications. The (shared) MLP weights are small in size, but the MLP activations are much larger. This is because the same input point is normalized to different values in different neighborhoods before entering the MLP. For instance, \texttt{P3} is normalized to different offsets with respect to \texttt{\underline{P1}} and \texttt{\underline{P2}} as \texttt{P3} is a neighbor of both \texttt{\underline{P1}} and \texttt{\underline{P2}}. In point cloud algorithms, most points are normalized to 20 to 100 centroids, proportionally increasing the MLP activation size.}
\label{fig:baselinealgo}
\end{figure*}
\subsection{Point Cloud Network Architecture}
\label{sec:mot:conv}
\paragraph{Module} The key component in point cloud algorithms is a \textit{module}. Each module transforms an input point cloud to an output point cloud, similar to how a convolution \textit{layer} transforms an input feature map to an output feature map in conventional CNNs. A point cloud network assembles different modules along with other common primitives such as fully-connected (FC) layers. \Fig{fig:pointnet2} and \Fig{fig:dgcnn} illustrate the architecture of two representative point cloud networks, PointNet++~\cite{qi2017pointnet++} and DGCNN~\cite{wang2019dynamic}, respectively.
\paragraph{Module Internals} Each point $\mathbf{p}$ in a point cloud is represented by a feature vector, which in the original point cloud is simply the 3D coordinates of the point. The input point cloud to a module is represented by an $N_{in} \times M_{in}$ matrix, where $N_{in}$ denotes the number of input points and $M_{in}$ denotes the input feature dimension. Similarly, the output point cloud is represented by an $N_{out} \times M_{out}$ matrix, where $N_{out}$ denotes the number of output points and $M_{out}$ denotes the output feature dimension. Note that $N_{in}$ and $N_{out}$ need not be the same; neither do $M_{in}$ and $M_{out}$.
Internally, each module extracts local features from the input point cloud. This is achieved by iteratively operating on a small \textit{neighborhood} of input points, similar to how a convolution layer extracts local features of the input image through a sliding window. \Fig{fig:conv} illustrates this analogy.
Specifically, each output point $\mathbf{p}_o$ is computed from an input point $\mathbf{p}_i$ in three steps --- neighbor search (${\mathcal{N}}$), aggregation (${\mathcal{A}}$), and feature computation (${\mathcal{F}}$):
\begin{align}
\mathbf{p}_o = {\mathcal{F}}({\mathcal{A}}({\mathcal{N}}(\mathbf{p}_i),~~\mathbf{p}_i))
\end{align}
\noindent where ${\mathcal{N}}$ returns $K$ neighbors of $\mathbf{p}_i$, ${\mathcal{A}}$ aggregates the $K$ neighbors, and ${\mathcal{F}}$ operates on the aggregation ($\mathbf{p}_i$ and its $K$ neighbors) to generate the output $\mathbf{p}_o$.
The same formulation applies to the convolution operation in conventional CNNs as well, as illustrated in \Fig{fig:conv}. However, the specifics of the three operations differ in point cloud networks and CNNs. Understanding the differences is key to identifying optimization opportunities.
\paragraph{Neighbor Search} ${\mathcal{N}}$ in convolution returns $K$ adjacent pixels in a regular 3D tensor by simply \textit{indexing} the input feature map ($K$ dictated by the convolution kernel volume). In contrast, ${\mathcal{N}}$ in point cloud networks requires explicit \textit{neighbor search} to return the $K$ nearest neighbors of $\mathbf{p}_i$, because the points are irregularly scattered in the space. Similar to the notion of a ``stride'' in convolution, the neighbor search might be applied to only a subset of the input points, in which case $N_{out}$ would be smaller than $N_{in}$, as is the case in \Fig{fig:nsreuse}.
\paragraph{Aggregation} Given the $K$ pixels, convolution in CNNs directly operates on the raw pixel values. Thus, conventional convolution skips the aggregation step.
In contrast, point cloud modules operate on the \textit{relative} value of each point in order to correlate a neighbor with its centroid. For instance, a point $\mathbf{p}_3$ could be a neighbor of two centroids $\mathbf{p}_1$ and $\mathbf{p}_2$ (as is the case in \Fig{fig:nsreuse}). To differentiate the different contributions of $\mathbf{p}_3$ to $\mathbf{p}_1$ and $\mathbf{p}_2$, $\mathbf{p}_3$ is \textit{normalized} to the two centroids by calculating the offsets $\mathbf{p}_3 - \mathbf{p}_1$ and $\mathbf{p}_3 - \mathbf{p}_2$ for subsequent computations.
Generally, for each neighbor $\mathbf{p}_k \in {\mathcal{N}}(\mathbf{p}_i)$, the aggregation operation calculates the offset $\mathbf{p}_k - \mathbf{p}_i$ (a $1 \times M_{in}$ vector). All $K$ neighbors' offsets form a Neighbor Feature Matrix (NFM) of size $K \times M_{in}$, effectively aggregating the neighbors of $\mathbf{p}_i$.
\begin{figure*}[t]
\centering
\begin{minipage}[t]{0.48\columnwidth}
\centering
\includegraphics[trim=0 0 0 0, clip, height=1.40in]{motivation-exe-time}
\caption{Latency of five point cloud networks on the Pascal GPU on TX2. Results are averaged over 100 executions, and the error bars denote one standard deviation.}
\label{fig:motivation-exe-time}
\end{minipage}
\hspace{5pt}
\begin{minipage}[t]{0.48\columnwidth}
\centering
\includegraphics[trim=0 0 0 0, clip, height=1.40in]{motivation-dist}
\caption{Time distribution across the three main point cloud operations (${\mathcal{N}}$, ${\mathcal{A}}$, and ${\mathcal{F}}$). The data is averaged on the mobile Pascal GPU on TX2 over 100 executions.}
\label{fig:motivation-dist}
\end{minipage}
\hspace{5pt}
\begin{minipage}[t]{0.42\columnwidth}
\centering
\includegraphics[trim=0 0 0 0, clip, height=1.45in]{motivation-pts-use}
\caption{Distribution of the number of points ($y$-axis) that occur in a certain number of neighborhoods ($x$-axis). We profile 32 inputs (curves).}
\label{fig:motivation-pts-use}
\end{minipage}
\hspace{5pt}
\begin{minipage}[t]{0.55\columnwidth}
\centering
\includegraphics[trim=0 0 0 0, clip, height=1.40in]{mac_ops}
\caption{MAC operation comparison between point cloud networks (130K input points per frame~\cite{geiger2012we}) and conventional CNNs (nearly 130K pixels per frame).}
\label{fig:motivation-mac}
\end{minipage}
\vspace{-5pt}
\end{figure*}
\paragraph{Feature Computation} ${\mathcal{F}}$ in convolution is a dot product between the pixel values in a window and the kernel weights. In contrast, ${\mathcal{F}}$ in point cloud applies a multilayer perceptron (MLP) to each row vector in the NFM. Critically, all $K$ row vectors share the same MLP; thus, the $K$ input vectors are batched into a matrix and the MLP becomes a matrix-matrix product, transforming a $K \times M_{in}$ matrix to a $K \times M_{out}$ matrix.
In the end, a reduction operation then reduces the $K \times M_{out}$ matrix to a $1 \times M_{out}$ vector, which becomes the feature vector of an output point. A common choice for reduction is to, for each column independently, take the max of the $K$ rows.
\paragraph{Example} \Fig{fig:baselinealgo} shows the first module in PointNet++~\cite{qi2017pointnet++}, a classic point cloud network that many other networks build upon. This module transforms a point cloud with 1024 ($N_{in}$) points, each with a 3-D ($M_{in}$) feature vector, to a point cloud with 512 ($N_{out}$) points, each with an 128-D ($M_{out}$) feature vector, indicating that the neighbor search is applied to only 512 input points. Each neighbor search returns 32 ($K$) neighbors and forms a $32 \times 3$ NFM, which is processed by a MLP with 3 layers to generate a $32 \times 128$ matrix, which in turn is reduced to a $1 \times 128$ feature vector for an output point. In this particular network, all the NFMs also share the same MLP.
Note that while feature computation is not always MLP and normalization is not always differencing from centroids, they are the most widely used, both in classic networks (e.g., PointNet++~\mbox{\cite{qi2017pointnet++}}) and recent ones (e.g., DGCNN~\mbox{\cite{wang2019dynamic}}).
\subsection{Performance Characterizations}
\label{sec:mot:char}
We characterize point cloud networks on today's systems to understand the bottlenecks and optimization opportunities. To that end, we profile the performance of five popular point cloud networks on the mobile Pascal GPU on the Jetson TX2 development board~\cite{tx2spec}, which is representative of state-of-the-art mobile computing platforms. Please refer to \Sect{sec:exp} for a detailed experimental setup.
\paragraph{Time Distribution} \Fig{fig:motivation-exe-time} shows the execution times of the five networks, which range from 71 $ms$ to 5,200 $ms$, clearly infeasible for real-time deployment. The time would scale proportionally as the input size grows.
\Fig{fig:motivation-dist} further decomposes the execution time into the three components, i.e., Neighbor Search (${\mathcal{N}}$), Aggregation (${\mathcal{A}}$), and Feature Computation (${\mathcal{F}}$). ${\mathcal{N}}$ and ${\mathcal{F}}$ are the major performance bottlenecks. While ${\mathcal{F}}$ consists of MLP operations that are well-optimized, ${\mathcal{N}}$ (and ${\mathcal{A}}$) is uniquely introduced in point cloud networks. Even if ${\mathcal{F}}$ could be further accelerated on a DNN accelerator, ${\mathcal{N}}$ has compute and data access patterns different from matrix multiplications~\cite{xu2019tigris}, and thus does not fit on a DNN accelerator.
Critically, ${\mathcal{N}}$, ${\mathcal{A}}$, and ${\mathcal{F}}$ are serialized. Thus, they all contribute to the critical path latency; optimizing one alone would not lead to universal speedups. The serialization is inherent to today's point cloud algorithms: in order to extract local features of a point (${\mathcal{F}}$), the point must be aggregated with its neighbors (${\mathcal{A}}$), which in turn requires neighbor search (${\mathcal{N}}$). \textsc{Mesorasi}\xspace's algorithm breaks this serialized execution chain, allowing ${\mathcal{F}}$ and ${\mathcal{N}}$ to be overlapped.
\paragraph{Memory Analysis} Point cloud networks have large memory footprints. While the MLP weights are small and are shared across input NFMs (\Fig{fig:baselinealgo}), the intermediate (inter-layer) activations in the MLP are excessive in size.
The ``Original'' category in \Fig{fig:layer_mem_red} shows the distribution of each MLP layer's output size across the five networks. The data is shown as a violin plot, where the high and low ticks represent the largest and smallest layer output size, respectively, and the width of the violin represents the density at a particular size value ($y$-axis). The layer output usually exceeds 2 MB, and could be as large as 32 MB, much greater than a typical on-chip memory size in today's mobile GPUs or DNN accelerators. The large activation sizes would lead to frequent DRAM accesses and high energy consumption.
The large activation size is fundamental to point cloud algorithms. This is because an input point usually belongs to many overlapped neighborhoods, and thus must be normalized to different values, one for each neighborhood. \Fig{fig:nsreuse} shows a concrete example, where \texttt{P3} is a neighbor of both \texttt{P1} and \texttt{P2}; the aggregation operation normalizes \texttt{P3} to \texttt{P1} and \texttt{P2}, leading to two different relative values (\texttt{P3} - \texttt{P1} and \texttt{P3} - \texttt{P2}) that participate in feature computation, increasing the activation size. This is in contrast to convolutions, where pixels in overlapped neighborhoods (windows) are directly reused in feature computation (e.g., \texttt{P4} in \Fig{fig:convreuse}).
\begin{figure*}[t]
\centering
\includegraphics[width=2.1\columnwidth]{newalgo}
\caption{The delayed-aggregation algorithm applied to the first module in PointNet++. The MLP and neighbor search are executed in parallel, effectively delaying aggregation after feature computation. The input size of the MLP is much smaller (input point cloud as opposed to the aggregated NFMs), which significantly reduces the MAC operations and the intermediate activation sizes. Aggregation now operates on the output feature space (128-D in this case), whereas it previously operates on the input feature space (3-D in this case). Thus, the aggregation time increases and emerges as a new performance bottleneck.}
\label{fig:newalgo}
\end{figure*}
We use two networks, DGCNN~\cite{qi2017pointnet++} and PointNet++~\cite{ wang2019dynamic}, to explain the large activation sizes. \Fig{fig:motivation-pts-use} shows the distribution of the number of neighborhoods each point is in. Each curve corresponds to an input point cloud, and each ($x$, $y$) point on a curve denotes the number of points ($y$) that occur in a certain number of neighborhoods ($x$). In PointNet++, over half occur in more than 30 neighborhoods; in DGCNN, over half occurs in 20 neighborhoods. Since the same point is normalized to different values in different neighborhoods, this bloats the MLP's intermediate activations.
\paragraph{Compute Cost} The large activations lead to high multiply-and-accumulate (MACs) operations. \Fig{fig:motivation-mac} compares the number of MAC operations in three classic CNNs with that in the feature computation of point cloud networks. To use the same ``resolution'' for a fair comparison, the input point cloud has 130,000 points (e.g., from the widely-used KITTI Odometry dataset~\cite{geiger2012we}) and the CNN input has a similar amount of pixels. In feature computation alone, point cloud networks have an order of magnitude higher MAC counts than conventional CNNs. \textsc{Mesorasi}\xspace's algorithm reduces both the memory accesses and MAC counts in feature computation.
\paragraph{Summary} Today's point cloud algorithms extract local features of a point by aggregating the point with its neighbors. The aggregation happens \textit{before} feature computation, which leads to two fundamental inefficiencies:
\begin{itemize}
\item The two major performance bottlenecks, neighbor search and feature computation, are serialized.
\item Feature computation operates on aggregated neighbor points, leading to high memory and compute cost.
\end{itemize}
\section{Conclusion}
\label{sec:conc}
With the explosion of 3D sensing devices (e.g., LiDAR, stereo cameras), point cloud algorithms present exciting opportunities to transform the perception ability of future intelligent machines. \textsc{Mesorasi}\xspace takes a systematic step toward efficient point cloud processing. The key to \textsc{Mesorasi}\xspace is the delayed-aggregation primitive that decouples neighbor search with feature computation and significantly reduces the overall workload. Hardware support maximizes the effectiveness of delayed-aggregation. The potential gain is even greater in future SoCs where neighbor search is accelerated.
\section{Background}
\label{sec:bck}
\paragraph{Point Cloud} A point cloud is an unordered set of points in the 3D Cartesian space. Each point is uniquely identified by its $<x$, $y$, $z>$ coordinates. While point cloud has long been used as a fundamental visual data representation in fields such as 3D modeling~\cite{alliez2017culture} and graphics rendering~\cite{gross2011point, levoy1985use, rusinkiewicz2000qsplat, pfister2000surfels}, it has recently received lots of attention in a range of emerging intelligent systems such as autonomous vehicles~\cite{geiger2012we}, robotics~\cite{whitty2010autonomous}, and AR/VR devices~\cite{stets2017visualization}.
\paragraph{Point Cloud Analytics} Similar to conventional visual analytics that analyzes images and videos, point cloud analytics distill semantics information from point clouds. Examples include object detection~\cite{geiger2012we}, semantics segmentation~\cite{behley2019semantickitti}, and classification~\cite{wu20153d}. While image and video analytics have been well-optimized, point cloud analytics require different algorithms and are much less optimized.
Point cloud algorithms operate by iteratively extracting features of each point. Conventional point cloud algorithms use ``hand-crafted'' features such as FPFH~\cite{rusu2009fast} and SHOT~\cite{tombari2010unique}. Recent deep learning-based algorithms use learned features and have generally out-performed conventional algorithms~\cite{chen2016eyeriss}. This paper thus focuses on deep learning-based algorithms.
We focus on deep learning-based algorithms that directly manipulate raw point clouds. Other data representations such as 2D projections of 3D points and voxelization suffer from low accuracy and/or consume excessively high memory~\cite{liu2019point}.
\section{Delayed-Aggregation Algorithm}
\label{sec:algo}
\begin{figure*}[t]
\centering
\begin{minipage}[t]{0.65\columnwidth}
\centering
\includegraphics[width=\columnwidth]{ops_reduction}
\caption{MAC operation reduction in the MLP by delayed-aggregation. The MAC count reductions come from directly operating on the input points as opposed to aggregated neighbors.}
\label{fig:overall_ops_red}
\end{minipage}
\hspace{5pt}
\begin{minipage}[t]{0.65\columnwidth}
\centering
\includegraphics[width=\columnwidth]{layer_ops}
\caption{Layer output size distribution as a violin plot with and without delayed-aggregation. High and low ticks denote the largest and smallest layer outputs, respectively.}
\label{fig:layer_mem_red}
\end{minipage}
\hspace{5pt}
\begin{minipage}[t]{0.65\columnwidth}
\centering
\includegraphics[width=\columnwidth]{pointnet_dist}
\caption{Time distribution across ${\mathcal{N}}$, ${\mathcal{A}}$, and ${\mathcal{F}}$ in PointNet++ (s) with and without delayed-aggregation. Note that delayed-aggregation would also allow ${\mathcal{N}}$ and ${\mathcal{F}}$ to be executed in parallel.}
\label{fig:pointnet_dist}
\end{minipage}
\end{figure*}
We introduce delayed-aggregation, a primitive for building efficient point cloud networks (\Sect{sec:algo:algo}). Delayed-aggregation improves the compute and memory efficiencies of point cloud networks without degrading accuracy (\Sect{sec:algo:eff}). We show that aggregation emerges as a new bottleneck in new networks, motivating dedicated hardware support (\Sect{sec:algo:bn}).
\subsection{Algorithm}
\label{sec:algo:algo}
We propose a new framework for building efficient point cloud algorithms. The central idea is to delay aggregation until \textit{after} feature computation so that features are extracted on individual input points rather than on aggregated neighbors. Delayed-aggregation has two benefits. First, it allows neighbor search and feature computation, the two time-consuming components, to be executed in parallel. Second, feature computation operates on input points rather than aggregated neighbors, reducing the compute and memory costs.
\paragraph{Delayed-Aggregation} The key insight is that feature extraction (${\mathcal{F}}$) is \textit{approximately distributive} over aggregation (${\mathcal{A}}$). For an input point $\mathbf{p}_i$ and its corresponding output $\mathbf{p}_o$:
\begin{align}
\mathbf{p}_o = {\mathcal{F}}({\mathcal{A}}({\mathcal{N}}(\mathbf{p}_i),~~\mathbf{p}_i)) \approx {\mathcal{A}}({\mathcal{F}}({\mathcal{N}}(\mathbf{p}_i)),~{\mathcal{F}}(\mathbf{p}_i))
\label{eq:fdist}
\end{align}
Fundamentally, \Equ{eq:fdist} holds because the MLP in ${\mathcal{F}}$ is approximately distributive over subtraction in ${\mathcal{A}}$. Specifically, applying an MLP to the difference of two matrices is approximately equivalent to applying an MLP to both matrices and then subtract the two resulting matrices. The approximation is introduced by the non-linearity in the MLP (e.g., ReLU):
\begin{align}
& \phi(\phi(
\begin{bmatrix}
\mathbf{p}_1 - \mathbf{p}_i \\
... \\
\mathbf{p}_k - \mathbf{p}_i
\end{bmatrix}
\times W_1) \times W_2) \approx \nonumber \\
& \phi(\phi(
\begin{bmatrix}
\mathbf{p}_1 \\
... \\
\mathbf{p}_k
\end{bmatrix}
\times W_1 \times W_2)) - \phi(\phi(
\begin{bmatrix}
\mathbf{p}_i \\
... \\
\mathbf{p}_i
\end{bmatrix}
\times W_1 \times W_2))
\label{eq:mlpdist}
\end{align}
\noindent where $\mathbf{p}_1, ..., \mathbf{p}_k$ are neighbors of $\mathbf{p}_i$, $W_1$ and $W_2$ are the two weight matrices in the MLP (assuming one hidden layer), and $\phi$ is the non-linear activation function. Without $\phi$, the distribution of MLP over subtraction is precise. In actual implementation, the computation on $[\mathbf{p}_i~~...~~\mathbf{p}_i]^\intercal$ is simplified to operating on $\mathbf{p}_i$ once and scattering the result $K$ times.
Critically, applying this distribution allows us to decouple ${\mathcal{N}}$ with ${\mathcal{F}}$. As shown in \Equ{eq:fdist} and \Equ{eq:mlpdist}, ${\mathcal{F}}$ now operates on original input points, i.e., $\mathbf{p}_i$ and ${\mathcal{N}}({\mathbf{p}_i})$ (a subset of the input points, too) rather than the normalized point values ($\mathbf{p}_k - \mathbf{p}_i$), which requires neighbor search results. As a result, we could first apply feature computation on all input points. The computed features are then aggregated later.
\paragraph{Walk-Through} We use the first module in PointNet++ as an example to walk through the new algorithm. This module consumes 1024 ($N_{in}$) input points, among which 512 undergo neighbor search. Thus, the module produces 512 ($N_{out}$) output points. The input feature dimension is 3 ($M_{in}$) and the output feature dimension is 128 ($M_{out}$). \Fig{fig:newalgo} shows this module implemented with delayed-aggregation.
We first compute features (${\mathcal{F}}$) from all 1024 points in the input point cloud and store the results in the Point Feature Table (PFT), a $1024 \times 128$ matrix. Every PFT entry contains the feature vector of an input point. Meanwhile, neighbor searches (${\mathcal{N}}$) are executed in parallel on the input point cloud, each returning 32 neighbors of a centroid. The results of neighbor search are stored in a Neighbor Index Table (NIT), a $512 \times 32$ matrix. Each NIT entry contains the neighbor indices of an input point. In the end, the aggregation operation (${\mathcal{A}}$) aggregates features in the PFT using the neighbor information in the NIT. Note that it is the features that are being aggregated, not the original points.
Each aggregated matrix ($32 \times 128$) is reduced to the final feature vector ($1 \times 128$) of an output point. If reduction is implemented by a max operation as is the common case, aggregation could further be delayed after reduction because subtraction is distributive over max: $max(\mathbf{p}_1 - \mathbf{p}_i, \mathbf{p}_2 - \mathbf{p}_i) = max(\mathbf{p}_1, \mathbf{p}_2) - \mathbf{p}_i$. This optimization avoids scattering $\mathbf{p}_i$, reduces the subtraction cost, and is mathematically precise.
\subsection{First-Order Efficiency Analysis}
\label{sec:algo:eff}
Compared with the original implementation of the same module in \Fig{fig:baselinealgo}, the delayed-aggregation algorithm provides three benefits. First, neighbor search and the MLP are now executed in parallel, hiding the latencies of the slower path.
Second, we significantly reduce the MAC operations in the MLP. In this module, the original algorithm executes MLP on 512 $32 \times 3$ matrices while the new algorithm executes MLP only on one $1024 \times 3$ matrix. \Fig{fig:overall_ops_red} shows the MAC operation reductions across all five networks. On average, delayed-aggregation reduces the MAC counts by 68\%.
Third, delayed-aggregation also reduces the memory traffic because the MLP input is much smaller. While the actual memory traffic reduction is tied to the hardware architecture, as a first-order estimation \Fig{fig:layer_mem_red} compares the distribution of per-layer output size with and without delayed-aggregation. The data is shown as a violin plot. Delayed-aggregation reduces the layer output sizes from 8 MB\textasciitilde 32 MB to 512 KB\textasciitilde 1 MB, amenable to be buffered completely on-chip.
By directly extracting features from the input points, our algorithm unlocks the inherent data reuse opportunities in point cloud. Specifically in this example, \texttt{P3} is a neighbor of both \texttt{\underline{P1}} and \texttt{\underline{P2}}, but could not be reused in feature computation by the original algorithm because \texttt{P3}'s normalized values with respect to \texttt{\underline{P1}} and \texttt{\underline{P2}} are different. In contrast, the MLP in our algorithm directly operates on \texttt{P1}, whose feature is then reused in aggregation, \textit{implicitly} reusing \texttt{P1}.
\subsection{Bottleneck Analysis}
\label{sec:algo:bn}
\begin{figure}
\centering
\includegraphics[width=\columnwidth]{runtime_dist}
\caption{Both absolute (left $y$-axis) and relative (right $y$-axis) aggregation times increase with delayed-aggregation.}
\label{fig:runtime_dist}
\end{figure}
While delayed-aggregation reduces the compute costs and memory accesses, it also significantly increases the aggregation time. Using PointNet++ as an example, \Fig{fig:pointnet_dist} compares the execution time distribution across the three operations (${\mathcal{N}}$, ${\mathcal{A}}$, and ${\mathcal{F}}$) with and without delayed-aggregation. The error bars denote one standard deviation in the measurement. The feature extraction time significantly decreases, and the neighbor search time roughly stays the same --- both are expected. The aggregation time, however, significantly increases.
\Fig{fig:runtime_dist} generalizes the conclusion across the five networks. The figure compares the absolute (left $y$-axis) and relative (right $y$-axis) aggregation time in the original and new algorithms. The aggregation time consistently increases in all five networks. Since neighbor search and feature computation are now executed in parallel, aggregation overhead contributes even more significantly to the overall execution time. On average, the aggregation time increases from 3\% to 24\%.
Aggregation time increases mainly because aggregation involves irregular gather operations~\cite{kirk2016programming}, which now operate on a much larger working set with delayed-aggregation. For instance, in PointNet++'s first module (\Fig{fig:newalgo}), aggregation originally gathers from a 12 KB matrix but now gathers from a 512 KB matrix, which is much larger than the L1 cache size (48 KB -- 96 KB\footnote{To our best knowledge, Nvidia does not publish the L1 cache size for the mobile Pascal GPU in TX2 (GP10B~\cite{gp10b}). We estimate the size based on the L1 cache size per SM in other Pascal GPU chips~\cite{pascaluarch} and the number of SMs in the mobile Pascal GPU~\cite{tx2spec}}) in the mobile Pascal GPU on TX2.
The working set size increases significantly because aggregation in new algorithms gathers data from the PFT, whose dimension is $N_{in} \times M_{out}$, whereas the original algorithms gather data from the input point matrix, whose dimension is $N_{in} \times M_{in}$. $M_{out}$ is usually several times greater than $M_{in}$ in order to extract higher-dimensional features. In the example above, $M_{out}$ is 128-D whereas $M_{in}$ is 3-D.
\section{Evaluation}
\label{sec:eval}
We first show \textsc{Mesorasi}\xspace adds little hardware overhead (\Sect{sec:eval:area}) while achieving comparable accuracy against original point cloud networks (\Sect{sec:eval:acc}). We then demonstrate the efficiency gains of \textsc{Mesorasi}\xspace on different hardware platforms (\Sect{sec:eval:gpu} -- \Sect{sec:eval:nse}), followed by sensitivity studies (\Sect{sec:eval:sen}).
\subsection{Area Overhead}
\label{sec:eval:area}
\textsc{Mesorasi}\xspace introduces only minimal area overhead with the minor AU augmentations. The main overhead comes from the 88 KB additional SRAM required for the PFT buffer and the NIT buffer. Compared to the baseline NPU, the additional hardware introduces less than 3.8\% area overhead (\SI{0.059}{\mm\squared}), which is even more negligible compared to the entire SoC area (e.g., \SI{350}{\mm\squared} for Nvidia Xavier~\cite{xaviersochotchips} and \SI{99}{\mm\squared} for Apple A13~\cite{applea13}).
Our custom-designed PFT buffer avoids the crossbar connecting the banks to the read ports by exploiting the algorithmic characteristics (\Sect{sec:arch:aug}). Since our PFT buffer is heavily banked (32) and ported (32) and each bank is small in size (2 KB), the additional area overhead introduced by the crossbar would have been high. Specifically, the area of the PFT buffer now is \SI{0.031}{\mm\squared}, but the crossbar area would be \SI{0.064}{\mm\squared}, which is now avoided.
\subsection{Accuracy}
\label{sec:eval:acc}
Overall, \textsc{Mesorasi}\xspace matches or out-performs the original algorithms. We train all seven networks with delayed-aggregation from scratch until the accuracy converges. \Fig{fig:app_acc} compares our accuracy with that of the baseline models, which we choose the better of the reported accuracies in the original papers or accuracies from training their released code. Overall, \textsc{Mesorasi}\xspace leads to at most 0.9\% accuracy loss in the case of PointNet++ (c) and up to 1.2\% accuracy gain in the case of F-PointNet. This shows that, while delayed-aggregation approximates the original algorithms, the accuracy loss could be recovered from training. Delayed-aggregation could be used as a primitive to build accurate point cloud algorithms.
We find that fine-tuning the model weights trained on the original networks has similar accuracies as retraining from scratch. However, directly using the original weights without retraining leads to a few percentages of accuracy loss, which is more significant when the non-linear layers use batch normalization, which perturbs the distributive property of matrix multiplication over subtraction more than ReLU.
\begin{figure}[t]
\centering
\includegraphics[width=\columnwidth]{pcloud_accuracy}
\caption{The accuracy comparison between networks trained with delayed-aggregation and the original networks.}
\label{fig:app_acc}
\end{figure}
\subsection{Results on GPU}
\label{sec:eval:gpu}
\begin{figure}
\centering \includegraphics[width=\columnwidth]{gpu_speedup_energy}
\caption{Speedup and energy reduction of the delayed-aggregation algorithm and the limited version of the algorithm on the mobile Pascal GPU on TX2.}
\label{fig:sw_speedup_energy}
\end{figure}
We first show that our delayed-aggregation algorithm readily achieves significant speedups on today's GPU \textit{without} hardware support. \Fig{fig:sw_speedup_energy} shows the speedup and energy reduction of \textsc{Mesorasi}\xspace on the Pascal GPU on TX2.
As a comparison, we also show the results of a limited version of delayed-aggregation, where only the matrix-vector multiplication (MVM) part of an MLP is hoisted before aggregation (Ltd-\textsc{Mesorasi}\xspace). The limited delayed-aggregation algorithm is inspired by certain Graph Neural Network (GNN) implementations such as GCN~\cite{gcnpytorch, fey2019pytorchgeo, wang2019deep} and GraphSage~\cite{graphsagetf}. Note that by hoisting only the MVM rather than the entire MLP, Ltd-\textsc{Mesorasi}\xspace is precise since MVM is linear. We refer interested readers to the wiki page of our code repository~\cite{mesorasiwiki} for a detailed comparison between our delayed-aggregation and GNN's limited delayed-aggregation.
On average, \textsc{Mesorasi}\xspace achieves $1.6\times$ speedup and 51.1\% energy reduction compared to the original algorithms. In comparison, the limited delayed-aggregation algorithm achieves only $1.3\times$ speedup and 28.3\% energy reduction. Directly comparing with Ltd-\textsc{Mesorasi}\xspace, \textsc{Mesorasi}\xspace has $1.3\times$ speedup and 25.9\% energy reduction. This is because the limited delay-aggregation, in order to be precise, could be applied to only the first MLP layer. By being approximate, \textsc{Mesorasi}\xspace does not have this constraint and thus enables larger benefits; the accuracy loss could be recovered through fine-tuning (\Fig{fig:app_acc}). \textsc{Mesorasi}\xspace has similar performance as Ltd-\textsc{Mesorasi}\xspace on DGCNN (c), LDGCNN, and DensePoint, because these three networks have only one MLP layer per module.
Although delayed-aggregation allows neighbor search and feature extraction to be executed in parallel, and our implementation does exploit the concurrent kernel execution in CUDA, we find that neighbor search and feature extraction in actual executions are rarely overlapped. Further investigation shows that this is because the available resources on the Pascal GPU on TX2 are not sufficient to allow both kernels to execute concurrently. We expect the speedup to be even higher on more powerful mobile GPUs in the future.
Overall, networks in which feature computation contributes more heavily to the overall time, such as PointNet++ (c) and F-PointNet (\Fig{fig:motivation-dist}), have higher MAC operation reductions (\Fig{fig:overall_ops_red}), and thus have higher speedups and energy reductions. This confirms that the improvements are mainly attributed to optimizing the MLPs in feature computation.
\subsection{Speedup and Energy Reduction}
\label{sec:eval:res}
\begin{figure}[t]
\centering
\subfloat[Speedup. Higher is better.]{
\label{fig:hw_speedup} \includegraphics[width=\columnwidth]{hw_speedup} }
\\
\vspace{-5pt}
\subfloat[Normalized energy. Lower is better.]{
\label{fig:hw_energy}
\includegraphics[width=\columnwidth]{hw_energy} }
\caption{Speedup and energy reduction of \sys{\textsc{Mesorasi}\xspace-SW} and \sys{\textsc{Mesorasi}\xspace-HW} over the baseline (GPU+NPU), which is twice as fast and consumes one-third of the energy compared to the GPU, indicating an optimized baseline to begin with.}
\label{fig:hw_speedup_energy}
\end{figure}
\textsc{Mesorasi}\xspace also improves the performance and energy consumption of emerging mobile SoCs with a dedicated NPU. \Fig{fig:hw_speedup} and \Fig{fig:hw_energy} show the speedup and the normalized energy consumption of the two \textsc{Mesorasi}\xspace variants over the NPU+GPU baseline, respectively.
\paragraph{Software} The delayed-aggregation algorithm alone without AU support, i.e., \sys{\textsc{Mesorasi}\xspace-SW}, has a $1.3\times$ speedup and 22\% energy saving over the baseline. The main contributor of the improvements is optimizing the MLPs in feature computation. \Fig{fig:systolic_speedup} shows the speedups and energy savings of the delayed-aggregation algorithm on feature computation. On average, the feature computation time is reduced by $5.1\times$ and the energy consumption is reduced by 76.3\%.
The large speedup on feature computation does not translate to similar overall speedup, because feature computation time has already been significantly reduced by the NPU, leaving less room for improvement. In fact, our GPU+NPU baseline is about 1.8$\times$ faster (\Fig{fig:hw_speedup}) and consumes 70\% less energy compared to the GPU (\Fig{fig:hw_energy}). The increased workload of aggregation also adds to the overhead, leading to overall lower speedup and energy reduction than on GPU.
\paragraph{Hardware} With the AU hardware, \sys{\textsc{Mesorasi}\xspace-HW} boosts the speedup to $1.9 \times$ (up to $3.6\times$) and reduces the energy consumption by 37.6\% (up to $92.9\%$). DGCNN (s) has the least speedup because it has the least aggregation time (\Fig{fig:runtime_dist}), thus benefiting the least from the AU hardware.
\Fig{fig:perf_details} shows the speedup and energy reduction of aggregation over the baseline (which executes aggregation on the GPU). Overall, \sys{\textsc{Mesorasi}\xspace-HW} reduces the aggregation time by $7.5\times$ and reduces the energy by 99.4\%. The huge improvements mainly come from using a small memory structure customized to the data access patterns in aggregation.
\begin{figure}[t]
\centering
\captionsetup[subfigure]{width=0.5\columnwidth}
\subfloat[\small{Feature computation.}]
{
\includegraphics[width=.48\columnwidth]{systolic_speedup}
\label{fig:systolic_speedup}
}
\subfloat[\small{Aggregation.}]
{
\includegraphics[width=.48\columnwidth]{group_speedup}
\label{fig:group_speedup}
}
\caption{Speedup and energy savings on feature computation and aggregation.}
\label{fig:perf_details}
\end{figure}
On average, 27\% (max 29\%) of PFT buffer accesses are to serve previous bank conflicts. The total time spent on PFT buffer accesses is 1.5$\times$ of the ideal case without bank conflicts. Empirically we do not observe pathological cases.
The AU's speedup varies across networks. For instance, the speedup on PointNet++ (c) is over 3$\times$ higher than that of F-PointNet. This is because the speedup decreases as bank conflict increases; bank conflicts occur more often when neighbor search returns more neighbors. The neighbor searches in PointNet++ (c) mostly return 32 neighbors, whereas neighbor searches in F-PointNet return mostly 128 neighbors, significantly increasing the chances of bank conflicts. This also explains why PointNet++ (c) has overall higher speedup than F-PointNet (\Fig{fig:hw_speedup}).
\subsection{Results with Neighbor Search Engine (NSE)}
\label{sec:eval:nse}
From the evaluations above, it is clear that the improvements of \textsc{Mesorasi}\xspace will ultimately be limited by the neighbor search overhead, which \textsc{Mesorasi}\xspace does not optimize and becomes the ``Amdahl's law bottleneck.''
To assess the full potential of \textsc{Mesorasi}\xspace, we evaluate it in a futuristic SoC that incorporates a dedicated neighbor search engine (NSE) that accelerates neighbor searches. We implement a recently published NSE built specifically for accelerating neighbor searches in point cloud algorithms~\cite{xu2019tigris}, and incorporate it into our SoC model. On average, the NSE provides over 60$\times$ speedup over the GPU. Note that the NSE is \textit{not} our contribution. Instead, we evaluate the potential speedup of \textsc{Mesorasi}\xspace if an NSE is available.
The speedup of \textsc{Mesorasi}\xspace greatly improves when neighbor search is no longer a bottleneck. \Fig{fig:nse_speedup} shows the speedups of \sys{\textsc{Mesorasi}\xspace-SW} and \sys{\textsc{Mesorasi}\xspace-HW} on the NSE-enabled SoC. On average, \sys{\textsc{Mesorasi}\xspace-SW} achieves $2.1\times$ speedup and \sys{\textsc{Mesorasi}\xspace-HW} achieves $6.7\times$ speedup. The two DGCNN networks have particularly high speedups because neighbor search contributes heavily to their execution times (\Fig{fig:motivation-dist}).
\begin{figure}
\centering
\includegraphics[width=\columnwidth]{nse_speedup}
\caption{\sys{\textsc{Mesorasi}\xspace-SW} and \sys{\textsc{Mesorasi}\xspace-HW} speedup over an NSE-enabled SoC (GPU+NPU+NSE), which is 4.0$\times$ faster than the GPU by accelerating both MLP and neighbor search.}
\label{fig:nse_speedup}
\end{figure}
\subsection{Sensitivity Study}
\label{sec:eval:sen}
The evaluations so far are based on one hardware configuration. We now study how the improvements vary with different hardware resource provisions. In particular, we focus on two types of hardware resources: the baseline NPU and the AU augmentation. Due to the page limit, we show only the results of PointNet++ (s). The general trend holds.
\paragraph{NPU} We find that \textsc{Mesorasi}\xspace has higher speedups when the NPU is smaller. \Fig{fig:sa_profile} shows how the speedup and normalized energy of \sys{\textsc{Mesorasi}\xspace-HW} over the baseline vary as the systolic array (SA) size increases from $8 \times 8$ to $48 \times 48$. As the SA size increases, the feature extraction time decreases, and thus leaving less room for performance improvement. As a result, the speedup decreases from 2.8$\times$ to 1.2$\times$.
Meanwhile, the energy reduction increases from 17.7\% to $23.4\%$. This is because a large SA is more likely throttled by memory bandwidth, leading to overall higher energy.
\paragraph{AU} We find that the AU energy consumption is sensitive to the NIT and PFT buffer sizes. \Fig{fig:au_profile} shows the AU energy under different NIT and PFT buffer sizes. The results are normalized to the nominal design point described in \Sect{sec:exp} (i.e., a 64 KB of PFT and a 12 KB NIT).
The energy consumption increases as the PFT and NIT buffer sizes decrease. In an extremely small setting with an 8 KB PFT buffer and a 3 KB NIT buffer, the AU energy increases by 32$\times$, which leads to a 5.6\% overall energy increase. This is because a smaller PFT buffer leads to more PFT partitions, which increases NIT buffer energy since each NIT entry must be read once per partition. Meanwhile, a smaller NIT requires more DRAM accesses, whose energy dominates as the PFT buffer becomes very small. On the other extreme, using a 256 KB PFT buffer and a 96 KB NIT buffer reduces the overall energy by 2.0\% while increasing the area overhead by 4$\times$. Our design point balances energy saving and area overhead.
\begin{figure}[t]
\centering
\begin{minipage}[t]{0.48\columnwidth}
\centering
\includegraphics[width=\columnwidth]{systolic_profile}
\caption{Sensitivity of the speedup and energy to the systolic array size.}
\label{fig:sa_profile}
\end{minipage}
\hspace{2pt}
\begin{minipage}[t]{0.48\columnwidth}
\centering
\includegraphics[width=\columnwidth]{au_profile}
\caption{Sensitivity of AU energy consumption to the NIT/PFT buffer sizes.}
\label{fig:au_profile}
\end{minipage}
\end{figure}
\section{Related Work}
\label{sec:related}
\paragraph{Point Cloud Analytics} Point cloud has only recently received extensive interests. Unlike conventional image/video analytics, point cloud analytics requires considerably different algorithms due to the unique characteristics of point cloud data. Most of the recent work focuses on the accuracy, exploring not only different data representation (e.g., 2D projection~\cite{qi2016volumetric}, voxelization~\cite{wu20153d, riegler2017octnet}, and raw points~\cite{qi2017pointnet++, wang2019dynamic}), but also different ways to extract features from points~\cite{simonovsky2017dynamic, wu2019pointconv, qi2017pointnet++, wang2019dynamic}. Our delayed-aggregation primitive can be thought of as a new, and efficient, way of extracting features from raw points.
\textsc{Mesorasi}\xspace focuses on improving the efficiency of point cloud algorithms while retaining the high accuracy. In the same vein, PVCNN~\cite{liu2019point} combines point-based and voxel-based data representations in order to boost compute and memory efficiency. Different but complementary, \textsc{Mesorasi}\xspace focuses on point-based neural networks. While PVCNN is demonstrated on GPUs, \textsc{Mesorasi}\xspace not only directly benefits commodity GPUs, but also incorporates systematic hardware support that improves DNN accelerators.
Prior work has also extensively studied systems and architectures for accelerating neighbor search on GPU~\cite{Qiu2009GPU, Gieseke2014Buffer}, FPGA~\cite{Winterstein2013FPGA, Kuhara2013An, Heinzle2008A}, and ASIC~\cite{xu2019tigris}. Neighbor search contributes non-trivial execution time to point cloud networks. \textsc{Mesorasi}\xspace hides, rather than reduces, the neighbor search latency, and directly benefits from faster neighbor search.
\paragraph{GNNs} Point cloud applications bear some resemblance to GNNs. After all, both deal with spatial/geometric data. In fact, some point cloud applications are implemented using GNNs, e.g., DGCNN~\cite{wang2019dynamic}.
However, existing GNN accelerators, e.g., HyGCN~\cite{yan2020hygcn}, are insufficient in accelerating point cloud applications. Fundamentally, GNN does not require explicit neighbor search (as a vertex's neighbors are explicitly encoded), but neighbor search is a critical bottleneck of all point cloud applications, as points are arbitrarily spread in 3D space. Our design hides the neighbor search latency, which existing GNN accelerators simply do not optimize for. In addition, \textsc{Mesorasi}\xspace minimally extends conventional DNN accelerators instead of being a new accelerator design, broadening its applicability in practice.
From \Fig{fig:motivation-dist}, one might notice that ${\mathcal{A}}$ in point cloud networks is much faster than ${\mathcal{F}}$, which is the opposite in many GNNs~\cite{yan2020hygcn}. This is because ${\mathcal{F}}$ in point cloud applications does much more work than ${\mathcal{A}}$, opposite to GNNs. In point cloud application, ${\mathcal{A}}$ simply gathers neighbor feature vectors, and ${\mathcal{F}}$ operates on neighbor feature vectors (MLP on each vector). In contrast, ${\mathcal{A}}$ in GNNs gathers and reduces neighbor feature vectors to one vector, and ${\mathcal{F}}$ operates on the reduced vector (MLP on one vector).
\paragraph{Domain-Specific Accelerator} Complementary to improving generic DNN accelerators, much of recent work has focused on improving the DNN accelerators for specific application domains such as real-time computer vision~\cite{buckler2018eva2, feng2019asv, zhu2018euphrates}, computational imaging~\cite{huang2019ecnn, mahmoud2018diffy}, and language processing~\cite{riera2018computation}. The NPU in the \textsc{Mesorasi}\xspace architecture is a DNN accelerator specialized to point cloud processing. \textsc{Mesorasi}\xspace also extends beyond prior visual accelerators that deal with 2D data (images and videos)~\cite{mahmoud2017ideal, leng2019energy, zhang2017race, mazumdar2017exploring, zhang2019distilling, dejaview} to 3D point clouds.
To keep the modularity of existing SoCs, \textsc{Mesorasi}\xspace relies on the DRAM for inter-accelerator communication. That said, \textsc{Mesorasi}\xspace could benefit from more direct accelerator communication schemes such as VIP~\cite{nachiappan2016vip} and Short-circuiting~\cite{yedlapalli2014short}. For instance, the NIT could be directly communicated to the NIT buffer from the GPU through a dedicated on-chip link, pipelining neighbor search with aggregation.
\section{Architectural Support}
\label{sec:arch}
\begin{figure}[t]
\centering
\includegraphics[width=\columnwidth]{soc}
\caption{The \textsc{Mesorasi}\xspace SoC builds on top of today's SoCs consisting of a GPU and a DNN accelerator (NPU). Neighbor search executes on the GPU and feature extraction executes on the NPU. \textsc{Mesorasi}\xspace augments the NPU with an aggregation unit (AU) to efficiently execute the aggregation operation. The AU structures are shaded (colored).}
\label{fig:soc}
\end{figure}
\begin{figure*}[t]
\centering
\includegraphics[width=2.1\columnwidth]{grouping}
\caption{Aggregation unit. The NIT buffer is double-buffered from the DRAM. The Address Generation logic simply fetches addresses already buffered in the NIT and sends them to the PFT buffer controller. The PFT buffer is organized as B independently addressed single-ported SRAMs. It could be thought of as an optimized version of a traditional B-banked, B-ported SRAM, because it does not need the crossbar that routes data from banks to ports (but does need the crossbar to route an address to the corresponding bank). The PFT buffer is connected to the NPU's global buffer. Each bank produces one word (Wr) per cycle. The shift registers hold up to $M_{out}$ words, where $M_{out}$ is the output feature vector size. The top shift register holds the result of reduction, and the bottom shift register holds the feature vector of a centroid.}
\label{fig:groupinghw}
\end{figure*}
This section describes \textsc{Mesorasi}\xspace, our hardware design that efficiently executes point cloud algorithms developed using delayed-aggregation. \textsc{Mesorasi}\xspace extends existing DNN accelerators with minor augmentations while leaving the rest of the SoC untouched. We start from an overview of \textsc{Mesorasi}\xspace and its workflow (\Sect{sec:arch:ov}), followed by a detailed description of the architecture support (\Sect{sec:arch:aug}).
\subsection{Overall Design}
\label{sec:arch:ov}
We assume a baseline SoC that incorporates a GPU and an NPU, as with emerging mobile SoCs such as Nvidia Xavier~\cite{xaviersoc}, Apple A13~\cite{applea13}, and Microsoft HPU~\cite{hpuaicore}. Point cloud algorithms are a few times faster when an NPU is available to accelerate MLP compared to running only on the GPU (\Sect{sec:eval:res}). Thus, an NPU-enabled SoC represents the trend of the industry and is a more optimized baseline.
\paragraph{Design} \Fig{fig:soc} shows how \textsc{Mesorasi}\xspace augments the NPU in a generic SoC. In \textsc{Mesorasi}\xspace, the GPU executes neighbor search (${\mathcal{N}}$) and the NPU executes feature extraction (${\mathcal{F}}$), i.e., the MLP. In addition, \textsc{Mesorasi}\xspace augments the NPU with an Aggregation Unit (AU) to efficiently execute the aggregation operation (${\mathcal{A}}$). As shown in \Sect{sec:algo:bn}, aggregation becomes a bottleneck in our new algorithms and is inefficient on the GPU. AU minimally extends a generic NPU architecture with a set of principled memory structures and datapaths.
\textsc{Mesorasi}\xspace maps ${\mathcal{N}}$ to the GPU because neighbor search is highly parallel, but does not map to the specialized datapath of an NPU. Alternatively, an SoC could use a dedicated neighbor search engine (NSE)~\cite{Kuhara2013An, xu2019tigris}. We use the GPU because it is prevalent in today's SoCs and thus provides a concrete context to describe our design. We later show that delayed-aggregation could achieve even higher speedups in a futurist SoC where an NSE is available to accelerate neighbor search (\Sect{sec:eval:nse}). In either case, \textsc{Mesorasi}\xspace does not modify the internals of the GPU or the NSE.
\paragraph{Work Flow} Point cloud algorithms with delayed-aggregation work on \textsc{Mesorasi}\xspace as follows. The input point cloud is initially stored in the DRAM. The CPU configures and triggers the GPU and the NPU simultaneously, both of which read the input point cloud. The GPU executes the KNN search and generates the Neighbor Index Table (NIT), which gets stored back to the DRAM. Meanwhile, the NPU computes features for input points and generates the Point Feature Table (PFT). The AU in NPU combines the PFT with the NIT from the memory for aggregation and reduction, and eventually generates the output of the current module.
In some algorithms (e.g., PointNet++), neighbor searches in all modules search in the original 3-D coordinate space, while in other algorithms (e.g., DGCNN) the neighbor search in module $i$ searches in the output feature space of module ($i-1$). In the latter case, the current module's output is written back to the memory for the GPU to read in the next module.
Our design modifies only the NPU while leaving other SoC components untouched. This design maintains the modularity of existing SoCs, broadening the applicability. We now describe the AU augmentation in NPU in detail.
\subsection{Aggregation Unit in NPU}
\label{sec:arch:aug}
Aggregation requires irregular gather operations that are inefficient on GPUs. The key to our architectural support is the specialized memory structures co-designed with customized data structure partitioning, which provide efficient data accesses for aggregation with a little area overhead.
Algorithmically, aggregation iterates over the NIT's $N_{out}$ entries until NIT is exhausted. Each NIT entry contains the $K$ neighbor indices of a centroid $\mathbf{p}$. The aggregation operation first gathers the $K$ corresponding entries (feature vectors) from the PFT ($N_{in} \times M_{out}$). The $K$ feature vectors are then reduced to one ($1 \times M_{out}$) vector, which subtracts $\mathbf{p}$'s feature vector to generate the output feature for $\mathbf{p}$.
\Fig{fig:groupinghw} shows the detailed design of the aggregation unit. The NIT is stored in an SRAM, which is doubled-buffered in order to limit the on-chip memory size. The PFT is stored in a separate on-chip SRAM connected to the NPU's global buffer (which stores the MLP weights and input/output). This allows the output of feature extraction to be directly transferred to the PFT buffer without going through the DRAM. Similarly, the aggregation output is directly written back to the NPU's global buffer, as the aggregation output of the current module is the input to the feature extraction in the next module.
To process each NIT entry, the Address Generation Unit (AGU) uses the $K$ indices to generate $K$ addresses to index into the PFT buffer. Due to the large read bandwidth requirement, the PFT buffer is divided into $B$ independently addressable banks, each of which produces 1 word per cycle.
Each cycle, the PFT buffer produces $B$ words, which enters the reduction unit. In our current design, the reduction unit implements the max logic as is the case in today's point cloud algorithms. The output of the max unit, i.e., the max of the $B$ words, enters a shift register (the top one in \Fig{fig:groupinghw}). Ideally, the number of banks $B$ is the same as the number of neighbors $K$ and the $K$ addresses fall into different banks. If so, the shift register is populated with the $1 \times M_{out}$ vector after $M_{out}$ cycles. The AGU then reads $\mathbf{p}$'s feature vector from the PFT buffer and stores it in another shift register (the bottom one in \Fig{fig:groupinghw}). The two shift registers perform an element-wise subtraction as required by aggregation. The same process continues until the entire NIT is exhausted.
\paragraph{Multi-Round Grouping} In reality, reading the neighbor feature vectors takes more than $M_{out}$ cycles because of two reasons. First, $K$ could be greater than $B$. The number of banks $B$ is limited by the peripheral circuits overhead, which increases as $B$ increases. Second, some of the $K$ addresses could fall into the same bank, causing bank conflicts. We empirically find that an LSB-interleaving reduces bank conflicts, but it is impossible to completely avoid bank conflict at runtime, because the data access patterns in point cloud are irregular and could not be statically calculated -- unlike conventional DNNs and other regular kernels.
We use a simple multi-round design to handle both non-ideal scenarios. Each round the AGU would attempt to identify as many unconflicted addresses as possible, which is achieved by the AGU logic examining each address modulo $B$. The unconflicted addresses are issued to the PFT buffer, whose output enters the max unit to generate a temporary output stored in the shift register. The data in the shift register would be combined with the PFT output in the next round for reduction. This process continues until all the addresses in an NIT buffer entry are processed.
An alternative way to resolve bank-conflict would be to simply ignore conflicted banks, essentially approximating the aggregation operation. We leave it to future work to explore this optimization and its impact on the overall accuracy.
\begin{figure}[t]
\centering
\includegraphics[width=\columnwidth]{colpart}
\caption{Column-major partitioning of PFT to reduce PFT buffer size (4 partitions in this example). Each time the PFT buffer is filled with only one partition. Since reduction (max) is applied to each column independently, the column-major partitioning ensures that all the neighbors of a centroid are present in the PFT buffer for aggregation.}
\label{fig:colpart}
\end{figure}
\paragraph{PFT Buffer Design} One could think of the PFT buffer as a $B$-banked, $B$-ported SRAM. Traditionally, heavily ported and banked SRAMs are area inefficient due to the crossbar that routes each bank's output to the corresponding issuing port~\cite{weste2015cmos}. However, our PFT buffer is much simplified \textit{without} the crossbar. This is by leveraging a key observation that the outputs of all the PFT banks are consumed by the max unit, which executes a \textit{commutative} operation, i.e., $max(a, b)=max(b, a)$. Thus, the output of each bank need not be routed to the issuing port so long as the requested data is correctly produced. This design optimization greatly reduces the area overhead (\Sect{sec:eval:area}).
One might be tempted to reuse the NPU's global buffer for the PFT buffer to save chip area. After all, the PFT \textit{is} MLP's output, which is stored in the global buffer. However, physically sharing the two SRAM structures is difficult, mainly because of their different design requirements. Global buffer contains MLP weights and layer inputs, accesses to which have regular patterns. As a result, NPU global buffers are usually designed with very few ports (e.g., one)~\cite{jouppi2017datacenter, armmlproc} while using a wide word. In contrast, accesses to the PFT are irregular as the neighbors of a centroid could be arbitrary spread in the PFT. Thus, the PFT buffer must be heavily-ported in order to sustain a high bandwidth requirement.
\paragraph{PFT Partitioning} To hold the entire PFT, the buffer must hold $N_{out} \times M_{out}$ features, which could be as large as 0.75~MB in some networks (e.g., DGCNN). Since the PFT buffer adds area overhead, we would like to minimize its size.
We partition the PFT to reduce the PFT buffer size. Each time, the PFT buffer is filled with only one partition. One straightforward strategy is the row-major partitioning, where the PFT buffer holds only a few rows of the PFT. However, since a centroid's neighbors could be arbitrarily spread across different PFT rows, row-major partitioning does not guarantee that all the neighbors of a centroid are present in the PFT buffer (i.e., in the same partition) for aggregation.
Instead, our design partitions the PFT column-wise, where each partition contains several columns of the PFT. \Fig{fig:colpart} illustrates the idea with 4 partitions. In this way, aggregation of a centroid is divided into four steps, each step aggregating only one partition. The column-major partitioning ensures that, within each partition, the neighbors of a centroid are available in the PFT buffer. Since reductions (max) of different columns are independent, the four intermediate reduction results can simply be concatenated in the end.
With column-wise partitioning, each NIT entry is accessed multiples times---once per aggregation step. Thus, a smaller PFT buffer, while reducing the area overhead, would also increase the energy overhead. We later quantify this resource vs. energy trade-off (\Sect{sec:eval:sen}).
\section{Experimental Setup}
\label{sec:exp}
\paragraph{Hardware Implementation} We develop RTL implementations for the NPU and its augmentations for the aggregation unit (AU). The NPU is based on the systolic array architecture, and consists of a $16 \times 16$ PE array. Each PE consists of two input registers, a MAC unit with an accumulator register, and simple trivial control logic. This is identical to the PE in the TPU~\cite{jouppi2017datacenter}. Recall that MLPs in point cloud networks process batched inputs (\Fig{fig:baselinealgo}), so the MLPs perform matrix-matrix product that can be efficiently implemented on a systolic array. The NPU's global buffer is sized at 1.5 MB and is banked at a 128 KB granularity.
The PFT buffer in the AU is sized at 64 KB with 32 banks. The NIT buffer is doubled-buffered; each buffer is implemented as one SRAM bank sized at 12 KB and holds 128 entries. The NIT buffer produces one entry per cycle. Each entry is 98 Bytes, accommodating 64 neighbor indices (12 bits each). Each of the two shift registers is implemented as 256 flip-flops (4-byte each). The datapath mainly consists of 1) one 33-input max unit and 256 subtraction units in the reduction unit, and 2) 32 32-input MUXes in the AGU.
The design is clocked at 1 GHz. The RTL is implemented using Synposys synthesis and Cadence layout tools in TSMC 16nm FinFET technology, with SRAMs generated by an Arm memory compiler. Power is simulated using Synopsys PrimeTimePX, with fully annotated switching activity.
\paragraph{Experimental Methodology} The latency and energy of the NPU (and its augmentation) are obtained from post-synthesis results of the RTL design. We model the GPU after the Pascal mobile GPU in the Nvidia Parker SoC hosted on the Jetson TX2 development board~\cite{tx2spec}. The SoC is fabricated in a 16 nm technology node, same as our NPU. We directly measure the GPU execution time as well as the kernel launch time. The GPU energy is directly measured using the built-in power sensing circuity on TX2.
The DRAM parameters are modeled after Micron 16 Gb LPDDR3-1600 (4 channels) according to its datasheet~\cite{micronlpddr3}. DRAM energy is calculated using Micron's System Power Calculators~\cite{microdrampower} using the memory traffic, which includes: 1) GPU reading input point cloud, 2) NPU accessing MLP kernels and activations each layer, and 3) GPU writing NIT and NPU reading NIT. Overall, the DRAM energy per bit is about 70$\times$ of that of SRAM, matching prior work~\cite{Yazdanbakhsh2018GAN, gao2017tetris}.
The system energy is the aggregation of GPU, NPU, and DRAM. The overall latency is sum of GPU, NPU, and DRAM minus: 1) double buffering in the NPU, and 2) parallel execution between neighbor search on GPU and feature computation on NPU. Due to double-buffering, the overall latency is dominated by the compute latency, not memory.
\begin{table}
\caption{Evaluation benchmarks.}
\resizebox{\columnwidth}{!}{
\renewcommand*{\arraystretch}{1}
\renewcommand*{\tabcolsep}{10pt}
\begin{tabular}{ cccc }
\toprule[0.15em]
\textbf{\specialcell{Application\\Domains}} & \textbf{\specialcell{Algorithm}} & \textbf{Dataset} & \textbf{Year} \\
\midrule[0.05em]
\specialcell{Classification} & \specialcell{PointNet++ (c)\\DGCNN (c)\\LDGCNN\\DensePoint} & ModelNet40 & \specialcell{2017\\2019\\2019\\2019} \\
\midrule[0.05em]
\specialcell{Segmentation} &
\specialcell{PointNet++ (s)\\DGCNN (s)} & ShapeNet & \specialcell{2017\\2019} \\
\midrule[0.05em]
\specialcell{Detection} & \specialcell{F-PointNet} & KITTI & \specialcell{2018} \\
\bottomrule[0.15em]
\end{tabular}
}
\label{tab:eval_app}
\end{table}
\paragraph{Software Setup} \Tbl{tab:eval_app} lists the point cloud networks we use, which cover different domains for point cloud analytics including object classification, segmentation, and detection. The networks cover both classic and recent ones (2019).
For classification, we use four networks: PointNet++~\cite{qi2017pointnet++}, DGCNN~\cite{wang2019dynamic}, LDGCNN~\cite{zhang2019linked}, and DensePoint~\cite{liu2019densepoint}; we use the ModelNet40~\cite{wu20153d} dataset. We report the standard overall accuracy metric. To evaluate segmentation, we use the variants of PointNet++ and DGCNN specifically built for segmentation, and use the ShapeNet dataset~\cite{shapenet2015}. We report the standard mean Intersection-over-Unit (mIoU) accuracy metric. Finally, we use F-PointNet~\cite{qi2018frustum} as the object detection network. We use the KITTI dataset~\cite{geiger2012we} and report the geometric mean of the IoU metric (BEV) across its classes.
We optimize the author-released open-source version of these networks to obtain stronger software baselines. We: 1) removed redundant data duplications introduced by \texttt{tf.tile}; 2) accelerated the CPU implementation of an important kernel, 3D Interpretation (\texttt{three\_interpolate}), with a GPU implementation; 3) replaced the Farthest Point Sampling with random sampling in PointNet++ with little accuracy loss; 4) replaced the Grouping operation (\texttt{group\_point}) with an optimized implementation (\texttt{tf.gather}) to improve the efficiency of grouping/aggregation. On TX2, our baseline networks are 2.2$\times$ faster than the open-source versions.
\paragraph{Baseline} We mainly compare with a generic NPU+GPU SoC without any \textsc{Mesorasi}\xspace-related optimizations. Compared to the baseline, our proposal improves both the software, i.e., the delayed-aggregation algorithm as well as hardware, i.e., the aggregation unit (AU) augmentations to the NPU.
\paragraph{Variants} To decouple the contributions of our algorithm and hardware, we present two different \textsc{Mesorasi}\xspace variants:
\begin{itemize}
\item \sys{\textsc{Mesorasi}\xspace-SW}: delayed-aggregation without AU support. Neighbor search and aggregation execute on the GPU; feature computation executes on the NPU.
\item \sys{\textsc{Mesorasi}\xspace-HW}: delayed-aggregation with AU support. Neighbor search executes on the GPU; aggregation and feature computation execute on the NPU.
\end{itemize}
\section{Motivation}
\label{sec:mot}
We first introduce the general flow of point cloud algorithms and identify key operators (\Sect{sec:mot:conv}). We then characterize point cloud algorithms on today's hardware systems to understand the algorithmic and execution bottlenecks (\Sect{sec:mot:char}), which motivate the \textsc{Mesorasi}\xspace design.
\begin{figure}[t]
\centering
\subfloat[Network architecture of PointNet++~\cite{qi2017pointnet++}.]{
\label{fig:pointnet2}
\includegraphics[width=\columnwidth]{module-pointnet2}
}
\\
\subfloat[DGCNN~\cite{wang2019dynamic} network architecture. ``\textbf{+}'' is tensor concatenation.]{
\label{fig:dgcnn}
\includegraphics[width=\columnwidth]{module-dgcnn}
}
\caption{Point cloud networks consist of a set of modules, which extract local features from the input point cloud iteratively and hierarchically to calculate the final output.}
\label{fig:module}
\end{figure}
\begin{figure}[t]
\centering
\subfloat[Convolution in conventional CNNs can be thought of as two steps: 1) neighbor search (${\mathcal{N}}$) by directly indexing adjacent pixels and 2) feature computation (${\mathcal{F}}$) by a dot product.]
{
\includegraphics[trim=0 0 0 0, clip, width=\columnwidth]{convreuse}
\label{fig:convreuse}
}
\\
\subfloat[Point cloud networks consist of three main steps: neighbor search (${\mathcal{N}}$), aggregation (${\mathcal{A}}$), and feature computation (${\mathcal{F}}$). ${\mathcal{N}}$ requires an explicit neighbor search; ${\mathcal{A}}$ normalizes neighbors to their centroid; ${\mathcal{F}}$ is an MLP with batched inputs (i.e., shared MLP weights).]
{
\includegraphics[trim=0 0 0 0, clip, width=\columnwidth]{nsreuse}
\label{fig:nsreuse}
}
\caption{Comparing a convolution layer in conventional CNNs and a module in point cloud networks.}
\label{fig:conv}
\end{figure}
\begin{figure*}[t]
\centering
\includegraphics[width=2.1\columnwidth]{baselinealgo}
\caption{The first module in PointNet++~\cite{qi2017pointnet++}. The same MLP is shared across all the row vectors in a Neighbor Feature Matrix (NFM) and also across different NFMs. Thus, MLPs in point cloud networks process batched inputs, effectively performing matrix-matrix multiplications. The (shared) MLP weights are small in size, but the MLP activations are much larger. This is because the same input point is normalized to different values in different neighborhoods before entering the MLP. For instance, \texttt{P3} is normalized to different offsets with respect to \texttt{\underline{P1}} and \texttt{\underline{P2}} as \texttt{P3} is a neighbor of both \texttt{\underline{P1}} and \texttt{\underline{P2}}. In point cloud algorithms, most points are normalized to 20 to 100 centroids, proportionally increasing the MLP activation size.}
\label{fig:baselinealgo}
\end{figure*}
\subsection{Point Cloud Network Architecture}
\label{sec:mot:conv}
\paragraph{Module} The key component in point cloud algorithms is a \textit{module}. Each module transforms an input point cloud to an output point cloud, similar to how a convolution \textit{layer} transforms an input feature map to an output feature map in conventional CNNs. A point cloud network assembles different modules along with other common primitives such as fully-connected (FC) layers. \Fig{fig:pointnet2} and \Fig{fig:dgcnn} illustrate the architecture of two representative point cloud networks, PointNet++~\cite{qi2017pointnet++} and DGCNN~\cite{wang2019dynamic}, respectively.
\paragraph{Module Internals} Each point $\mathbf{p}$ in a point cloud is represented by a feature vector, which in the original point cloud is simply the 3D coordinates of the point. The input point cloud to a module is represented by an $N_{in} \times M_{in}$ matrix, where $N_{in}$ denotes the number of input points and $M_{in}$ denotes the input feature dimension. Similarly, the output point cloud is represented by an $N_{out} \times M_{out}$ matrix, where $N_{out}$ denotes the number of output points and $M_{out}$ denotes the output feature dimension. Note that $N_{in}$ and $N_{out}$ need not be the same; neither do $M_{in}$ and $M_{out}$.
Internally, each module extracts local features from the input point cloud. This is achieved by iteratively operating on a small \textit{neighborhood} of input points, similar to how a convolution layer extracts local features of the input image through a sliding window. \Fig{fig:conv} illustrates this analogy.
Specifically, each output point $\mathbf{p}_o$ is computed from an input point $\mathbf{p}_i$ in three steps --- neighbor search (${\mathcal{N}}$), aggregation (${\mathcal{A}}$), and feature computation (${\mathcal{F}}$):
\begin{align}
\mathbf{p}_o = {\mathcal{F}}({\mathcal{A}}({\mathcal{N}}(\mathbf{p}_i),~~\mathbf{p}_i))
\end{align}
\noindent where ${\mathcal{N}}$ returns $K$ neighbors of $\mathbf{p}_i$, ${\mathcal{A}}$ aggregates the $K$ neighbors, and ${\mathcal{F}}$ operates on the aggregation ($\mathbf{p}_i$ and its $K$ neighbors) to generate the output $\mathbf{p}_o$.
The same formulation applies to the convolution operation in conventional CNNs as well, as illustrated in \Fig{fig:conv}. However, the specifics of the three operations differ in point cloud networks and CNNs. Understanding the differences is key to identifying optimization opportunities.
\paragraph{Neighbor Search} ${\mathcal{N}}$ in convolution returns $K$ adjacent pixels in a regular 3D tensor by simply \textit{indexing} the input feature map ($K$ dictated by the convolution kernel volume). In contrast, ${\mathcal{N}}$ in point cloud networks requires explicit \textit{neighbor search} to return the $K$ nearest neighbors of $\mathbf{p}_i$, because the points are irregularly scattered in the space. Similar to the notion of a ``stride'' in convolution, the neighbor search might be applied to only a subset of the input points, in which case $N_{out}$ would be smaller than $N_{in}$, as is the case in \Fig{fig:nsreuse}.
\paragraph{Aggregation} Given the $K$ pixels, convolution in CNNs directly operates on the raw pixel values. Thus, conventional convolution skips the aggregation step.
In contrast, point cloud modules operate on the \textit{relative} value of each point in order to correlate a neighbor with its centroid. For instance, a point $\mathbf{p}_3$ could be a neighbor of two centroids $\mathbf{p}_1$ and $\mathbf{p}_2$ (as is the case in \Fig{fig:nsreuse}). To differentiate the different contributions of $\mathbf{p}_3$ to $\mathbf{p}_1$ and $\mathbf{p}_2$, $\mathbf{p}_3$ is \textit{normalized} to the two centroids by calculating the offsets $\mathbf{p}_3 - \mathbf{p}_1$ and $\mathbf{p}_3 - \mathbf{p}_2$ for subsequent computations.
Generally, for each neighbor $\mathbf{p}_k \in {\mathcal{N}}(\mathbf{p}_i)$, the aggregation operation calculates the offset $\mathbf{p}_k - \mathbf{p}_i$ (a $1 \times M_{in}$ vector). All $K$ neighbors' offsets form a Neighbor Feature Matrix (NFM) of size $K \times M_{in}$, effectively aggregating the neighbors of $\mathbf{p}_i$.
\begin{figure*}[t]
\centering
\begin{minipage}[t]{0.48\columnwidth}
\centering
\includegraphics[trim=0 0 0 0, clip, height=1.40in]{motivation-exe-time}
\caption{Latency of five point cloud networks on the Pascal GPU on TX2. Results are averaged over 100 executions, and the error bars denote one standard deviation.}
\label{fig:motivation-exe-time}
\end{minipage}
\hspace{5pt}
\begin{minipage}[t]{0.48\columnwidth}
\centering
\includegraphics[trim=0 0 0 0, clip, height=1.40in]{motivation-dist}
\caption{Time distribution across the three main point cloud operations (${\mathcal{N}}$, ${\mathcal{A}}$, and ${\mathcal{F}}$). The data is averaged on the mobile Pascal GPU on TX2 over 100 executions.}
\label{fig:motivation-dist}
\end{minipage}
\hspace{5pt}
\begin{minipage}[t]{0.42\columnwidth}
\centering
\includegraphics[trim=0 0 0 0, clip, height=1.45in]{motivation-pts-use}
\caption{Distribution of the number of points ($y$-axis) that occur in a certain number of neighborhoods ($x$-axis). We profile 32 inputs (curves).}
\label{fig:motivation-pts-use}
\end{minipage}
\hspace{5pt}
\begin{minipage}[t]{0.55\columnwidth}
\centering
\includegraphics[trim=0 0 0 0, clip, height=1.40in]{mac_ops}
\caption{MAC operation comparison between point cloud networks (130K input points per frame~\cite{geiger2012we}) and conventional CNNs (nearly 130K pixels per frame).}
\label{fig:motivation-mac}
\end{minipage}
\vspace{-5pt}
\end{figure*}
\paragraph{Feature Computation} ${\mathcal{F}}$ in convolution is a dot product between the pixel values in a window and the kernel weights. In contrast, ${\mathcal{F}}$ in point cloud applies a multilayer perceptron (MLP) to each row vector in the NFM. Critically, all $K$ row vectors share the same MLP; thus, the $K$ input vectors are batched into a matrix and the MLP becomes a matrix-matrix product, transforming a $K \times M_{in}$ matrix to a $K \times M_{out}$ matrix.
In the end, a reduction operation then reduces the $K \times M_{out}$ matrix to a $1 \times M_{out}$ vector, which becomes the feature vector of an output point. A common choice for reduction is to, for each column independently, take the max of the $K$ rows.
\paragraph{Example} \Fig{fig:baselinealgo} shows the first module in PointNet++~\cite{qi2017pointnet++}, a classic point cloud network that many other networks build upon. This module transforms a point cloud with 1024 ($N_{in}$) points, each with a 3-D ($M_{in}$) feature vector, to a point cloud with 512 ($N_{out}$) points, each with an 128-D ($M_{out}$) feature vector, indicating that the neighbor search is applied to only 512 input points. Each neighbor search returns 32 ($K$) neighbors and forms a $32 \times 3$ NFM, which is processed by a MLP with 3 layers to generate a $32 \times 128$ matrix, which in turn is reduced to a $1 \times 128$ feature vector for an output point. In this particular network, all the NFMs also share the same MLP.
Note that while feature computation is not always MLP and normalization is not always differencing from centroids, they are the most widely used, both in classic networks (e.g., PointNet++~\mbox{\cite{qi2017pointnet++}}) and recent ones (e.g., DGCNN~\mbox{\cite{wang2019dynamic}}).
\subsection{Performance Characterizations}
\label{sec:mot:char}
We characterize point cloud networks on today's systems to understand the bottlenecks and optimization opportunities. To that end, we profile the performance of five popular point cloud networks on the mobile Pascal GPU on the Jetson TX2 development board~\cite{tx2spec}, which is representative of state-of-the-art mobile computing platforms. Please refer to \Sect{sec:exp} for a detailed experimental setup.
\paragraph{Time Distribution} \Fig{fig:motivation-exe-time} shows the execution times of the five networks, which range from 71 $ms$ to 5,200 $ms$, clearly infeasible for real-time deployment. The time would scale proportionally as the input size grows.
\Fig{fig:motivation-dist} further decomposes the execution time into the three components, i.e., Neighbor Search (${\mathcal{N}}$), Aggregation (${\mathcal{A}}$), and Feature Computation (${\mathcal{F}}$). ${\mathcal{N}}$ and ${\mathcal{F}}$ are the major performance bottlenecks. While ${\mathcal{F}}$ consists of MLP operations that are well-optimized, ${\mathcal{N}}$ (and ${\mathcal{A}}$) is uniquely introduced in point cloud networks. Even if ${\mathcal{F}}$ could be further accelerated on a DNN accelerator, ${\mathcal{N}}$ has compute and data access patterns different from matrix multiplications~\cite{xu2019tigris}, and thus does not fit on a DNN accelerator.
Critically, ${\mathcal{N}}$, ${\mathcal{A}}$, and ${\mathcal{F}}$ are serialized. Thus, they all contribute to the critical path latency; optimizing one alone would not lead to universal speedups. The serialization is inherent to today's point cloud algorithms: in order to extract local features of a point (${\mathcal{F}}$), the point must be aggregated with its neighbors (${\mathcal{A}}$), which in turn requires neighbor search (${\mathcal{N}}$). \textsc{Mesorasi}\xspace's algorithm breaks this serialized execution chain, allowing ${\mathcal{F}}$ and ${\mathcal{N}}$ to be overlapped.
\paragraph{Memory Analysis} Point cloud networks have large memory footprints. While the MLP weights are small and are shared across input NFMs (\Fig{fig:baselinealgo}), the intermediate (inter-layer) activations in the MLP are excessive in size.
The ``Original'' category in \Fig{fig:layer_mem_red} shows the distribution of each MLP layer's output size across the five networks. The data is shown as a violin plot, where the high and low ticks represent the largest and smallest layer output size, respectively, and the width of the violin represents the density at a particular size value ($y$-axis). The layer output usually exceeds 2 MB, and could be as large as 32 MB, much greater than a typical on-chip memory size in today's mobile GPUs or DNN accelerators. The large activation sizes would lead to frequent DRAM accesses and high energy consumption.
The large activation size is fundamental to point cloud algorithms. This is because an input point usually belongs to many overlapped neighborhoods, and thus must be normalized to different values, one for each neighborhood. \Fig{fig:nsreuse} shows a concrete example, where \texttt{P3} is a neighbor of both \texttt{P1} and \texttt{P2}; the aggregation operation normalizes \texttt{P3} to \texttt{P1} and \texttt{P2}, leading to two different relative values (\texttt{P3} - \texttt{P1} and \texttt{P3} - \texttt{P2}) that participate in feature computation, increasing the activation size. This is in contrast to convolutions, where pixels in overlapped neighborhoods (windows) are directly reused in feature computation (e.g., \texttt{P4} in \Fig{fig:convreuse}).
\begin{figure*}[t]
\centering
\includegraphics[width=2.1\columnwidth]{newalgo}
\caption{The delayed-aggregation algorithm applied to the first module in PointNet++. The MLP and neighbor search are executed in parallel, effectively delaying aggregation after feature computation. The input size of the MLP is much smaller (input point cloud as opposed to the aggregated NFMs), which significantly reduces the MAC operations and the intermediate activation sizes. Aggregation now operates on the output feature space (128-D in this case), whereas it previously operates on the input feature space (3-D in this case). Thus, the aggregation time increases and emerges as a new performance bottleneck.}
\label{fig:newalgo}
\end{figure*}
We use two networks, DGCNN~\cite{qi2017pointnet++} and PointNet++~\cite{ wang2019dynamic}, to explain the large activation sizes. \Fig{fig:motivation-pts-use} shows the distribution of the number of neighborhoods each point is in. Each curve corresponds to an input point cloud, and each ($x$, $y$) point on a curve denotes the number of points ($y$) that occur in a certain number of neighborhoods ($x$). In PointNet++, over half occur in more than 30 neighborhoods; in DGCNN, over half occurs in 20 neighborhoods. Since the same point is normalized to different values in different neighborhoods, this bloats the MLP's intermediate activations.
\paragraph{Compute Cost} The large activations lead to high multiply-and-accumulate (MACs) operations. \Fig{fig:motivation-mac} compares the number of MAC operations in three classic CNNs with that in the feature computation of point cloud networks. To use the same ``resolution'' for a fair comparison, the input point cloud has 130,000 points (e.g., from the widely-used KITTI Odometry dataset~\cite{geiger2012we}) and the CNN input has a similar amount of pixels. In feature computation alone, point cloud networks have an order of magnitude higher MAC counts than conventional CNNs. \textsc{Mesorasi}\xspace's algorithm reduces both the memory accesses and MAC counts in feature computation.
\paragraph{Summary} Today's point cloud algorithms extract local features of a point by aggregating the point with its neighbors. The aggregation happens \textit{before} feature computation, which leads to two fundamental inefficiencies:
\begin{itemize}
\item The two major performance bottlenecks, neighbor search and feature computation, are serialized.
\item Feature computation operates on aggregated neighbor points, leading to high memory and compute cost.
\end{itemize}
\section{Related Work}
\label{sec:related}
\paragraph{Point Cloud Analytics} Point cloud has only recently received extensive interests. Unlike conventional image/video analytics, point cloud analytics requires considerably different algorithms due to the unique characteristics of point cloud data. Most of the recent work focuses on the accuracy, exploring not only different data representation (e.g., 2D projection~\cite{qi2016volumetric}, voxelization~\cite{wu20153d, riegler2017octnet}, and raw points~\cite{qi2017pointnet++, wang2019dynamic}), but also different ways to extract features from points~\cite{simonovsky2017dynamic, wu2019pointconv, qi2017pointnet++, wang2019dynamic}. Our delayed-aggregation primitive can be thought of as a new, and efficient, way of extracting features from raw points.
\textsc{Mesorasi}\xspace focuses on improving the efficiency of point cloud algorithms while retaining the high accuracy. In the same vein, PVCNN~\cite{liu2019point} combines point-based and voxel-based data representations in order to boost compute and memory efficiency. Different but complementary, \textsc{Mesorasi}\xspace focuses on point-based neural networks. While PVCNN is demonstrated on GPUs, \textsc{Mesorasi}\xspace not only directly benefits commodity GPUs, but also incorporates systematic hardware support that improves DNN accelerators.
Prior work has also extensively studied systems and architectures for accelerating neighbor search on GPU~\cite{Qiu2009GPU, Gieseke2014Buffer}, FPGA~\cite{Winterstein2013FPGA, Kuhara2013An, Heinzle2008A}, and ASIC~\cite{xu2019tigris}. Neighbor search contributes non-trivial execution time to point cloud networks. \textsc{Mesorasi}\xspace hides, rather than reduces, the neighbor search latency, and directly benefits from faster neighbor search.
\paragraph{GNNs} Point cloud applications bear some resemblance to GNNs. After all, both deal with spatial/geometric data. In fact, some point cloud applications are implemented using GNNs, e.g., DGCNN~\cite{wang2019dynamic}.
However, existing GNN accelerators, e.g., HyGCN~\cite{yan2020hygcn}, are insufficient in accelerating point cloud applications. Fundamentally, GNN does not require explicit neighbor search (as a vertex's neighbors are explicitly encoded), but neighbor search is a critical bottleneck of all point cloud applications, as points are arbitrarily spread in 3D space. Our design hides the neighbor search latency, which existing GNN accelerators simply do not optimize for. In addition, \textsc{Mesorasi}\xspace minimally extends conventional DNN accelerators instead of being a new accelerator design, broadening its applicability in practice.
From \Fig{fig:motivation-dist}, one might notice that ${\mathcal{A}}$ in point cloud networks is much faster than ${\mathcal{F}}$, which is the opposite in many GNNs~\cite{yan2020hygcn}. This is because ${\mathcal{F}}$ in point cloud applications does much more work than ${\mathcal{A}}$, opposite to GNNs. In point cloud application, ${\mathcal{A}}$ simply gathers neighbor feature vectors, and ${\mathcal{F}}$ operates on neighbor feature vectors (MLP on each vector). In contrast, ${\mathcal{A}}$ in GNNs gathers and reduces neighbor feature vectors to one vector, and ${\mathcal{F}}$ operates on the reduced vector (MLP on one vector).
\paragraph{Domain-Specific Accelerator} Complementary to improving generic DNN accelerators, much of recent work has focused on improving the DNN accelerators for specific application domains such as real-time computer vision~\cite{buckler2018eva2, feng2019asv, zhu2018euphrates}, computational imaging~\cite{huang2019ecnn, mahmoud2018diffy}, and language processing~\cite{riera2018computation}. The NPU in the \textsc{Mesorasi}\xspace architecture is a DNN accelerator specialized to point cloud processing. \textsc{Mesorasi}\xspace also extends beyond prior visual accelerators that deal with 2D data (images and videos)~\cite{mahmoud2017ideal, leng2019energy, zhang2017race, mazumdar2017exploring, zhang2019distilling, dejaview} to 3D point clouds.
To keep the modularity of existing SoCs, \textsc{Mesorasi}\xspace relies on the DRAM for inter-accelerator communication. That said, \textsc{Mesorasi}\xspace could benefit from more direct accelerator communication schemes such as VIP~\cite{nachiappan2016vip} and Short-circuiting~\cite{yedlapalli2014short}. For instance, the NIT could be directly communicated to the NIT buffer from the GPU through a dedicated on-chip link, pipelining neighbor search with aggregation.
| {'timestamp': '2020-08-18T02:19:28', 'yymm': '2008', 'arxiv_id': '2008.06967', 'language': 'en', 'url': 'https://arxiv.org/abs/2008.06967'} | arxiv |
\section{Introduction}
The fire alarm systems are a combination of sensors and machine learning algorithms to identify patterns of warning.
Usually, the sensor system is composed of: (i) heat or temperature detectors, which typically are not early warning devices; (ii) flame detectors that habitually are built-on optical, UV, and IR sensors; and (iii) smoke detectors, frequently using photoelectric, ionization, or a combination of both.
The use of images to fire recognition is a new promising approach \cite{Alves2019:FireImage}, based on the excellent results that deep learning models are obtaining in image processing applications \cite{Chollet2017:Xception} allowing to avoid the use of special sensors to perform the recognition.
The Deep Learning (DL) approach \cite{LeCun2015:deeplearning} has proved to be suitable for automating the feature acquisition from complex data in machine learning tasks.
In such a way, DL works in multiple levels of abstraction for data representation.
Considering that, the use of computer vision to fire recognition reduces the necessity of specific sensors, being suitable for the inlay to portable, remote, and mobile devices.
However, DL approaches have some challenges: (i) the required computational resources; (ii) the model's computation complexity and size; and (iii) the quantity of data needed for its training, among others.
The previously mentioned challenges can be tackled by focusing on the development of deep learning models for mobile devices \cite{Deng2019:DLMobile}, which has been a less explored area in DL literature.
For robotics or autonomous systems being portables, they must be capable of working with limited processing power, storage, and energy, besides providing an efficient inference time.
Some works have addressed portable models of deep learning using more efficient ways to compute the convolutions, such as presented by Sandler et al. \cite{Sandler2018:MobileNet}.
The authors proposed the inverted residual block (see Figure \ref{fig:InvertedResidualBlock}) with point-wise and depth-wise convolutions to simplify the dimensionality of the signal processing.
Thus, the proposed deep model offers an interesting trade-off between accuracy, the number of operations, and the number of parameters considering other models such as ShuffleNet \cite{Zhang2018:ShuffleNet} and NasNet \cite{Zoph2018:NasNet}.
Another efficient approach for portable models is the work presented by Chen et al. \cite{Chen2019:octave}, the octave convolution (see Figure \ref{fig:OctaveConvolution}), which reduces the spatial redundancy of the signal, separating into a high and low spatial frequency for processing.
In this case, the size of the separation depends on an $\alpha$ ratio, which defines the \textit{octave feature representation} factorizing the feature map into groups for each frequency.
The $\alpha$ value also establishes the quantity of memory, operations, and the number of parameters reduced for the model.
\begin{figure*
\centering
\subfigure[The inverted residual block.
Diagonally hatched layers do not use non-linearities.
The thickness of each block is used to indicate its relative number of channels.
The inverted residuals connect the bottlenecks.
Adapted from \cite{Sandler2018:MobileNet}.
]{\includegraphics[width=0.99\columnwidth]{inverted_residual_block}
\label{fig:InvertedResidualBlock}}
\hspace{0.1cm}
\subfigure[Detailed design of the octave convolution.
Green arrows correspond to information updates, while red arrows facilitate information exchange between the two frequencies.
Adapted from \cite{Chen2019:octave}.
]{\includegraphics[width=0.99\columnwidth]{octave_convolution}
\label{fig:OctaveConvolution}
}
\caption{The fundamental convolutional blocks used in this work.}
\label{fig:AllBlocks}
\end{figure*}
In this paper, we propose a new deep learning model for fire recognition called KutralNet\footnote{We took inspiration from Mapuche language or Mapudungun where k\"utral means fire.}, which comprises five layers and require 92\% fewer floating-point operations (flops) for processing in comparison with previous approaches.
This model is used as a baseline to build portable models that compare the efficiency in signal processing of the inverted residual block, the depth-wise convolution, and octave convolution approaches.
Our best resultant model, KutralNet Mobile Octave, presents a competitive validation accuracy and AUROC performance despite using 71\% fewer numbers of parameters in comparison with FireNet.
We compare the proposed models with state-of-the-art approaches to fire recognition over the FireNet and FiSmo datasets.
In Section II, we present related works. Section III the proposed model. Section IV presents the experiment setup and in Section V, the results and discussion. Section VI presents the final remarks.
\section{Related Works}
In the last years, multiple methods to automate fire recognition were proposed, most of them from video surveillance systems, such as Closed Circuit TV systems.
Some surveillance equipment uses cameras with low resolution, at a flat frame rate, or with no storage option, and others more sophisticated ones with proper image resolution cameras.
The first approaches to fire recognition in computer vision were addressed using techniques based on RGB color space \cite{YoonHo2014:rgbfire}, spectral color \cite{Nikos2011:sensor}, texture recognition \cite{Dimitropoulos2015:flame}, and spatio-temporal treatment \cite{Barmpoutis2013:video}.
The most recent methods correspond to deep neural networks, especially convolutional neural networks (CNNs).
Many of the DL implementations \cite{Sharma2017:deepfire, Muhammad2018:deepfire, Namozov2018:fire} were built on previously trained models such as ResNet and its variations \cite{Kaiming2015:ResNet}.
Recently, it has been widespread the use of the DL method combined with fine-tuning or transfer-learning techniques.
This complement solves the lack of data for training deep models; the only issue is the size and complexity constraint of the network.
A new lightweight model, FireNet, was proposed by Jadon et al. \cite{Jadon2019:FireNet}, who present a dataset for training and test a model from scratch considering a fire and smoke detection system.
The model's architecture presents three consecutive convolution blocks before the classifier, and each convolution block contains a convolution layer, an average pooling layer, and a dropout normalization layer.
The classifier is composed of three fully connected hidden layers and is capable of processing images with a maximum size of 64x64 pixels on RGB channels.
Other model trained from scratch is OctFiResNet \cite{Ayala2019:OctFiResNet}.
This model is based on the initial blocks of ResNet, replacing the vanilla convolution with the octave convolution.
For this model, the optimizer corresponds to the Adam algorithm with Nesterov momentum and hyper-parameters settled to $\alpha=10^{-4}$ and $\epsilon=10^{-7}$, to process images of 96x96 pixels.
Likewise, a well-known deep learning model, ResNet \cite{Kaiming2015:ResNet} with its depth-dependent variations, is used in this task.
In this case, the ResNet50's architecture presents a slight modification of the classifier on the top of the model \cite{Sharma2017:deepfire}, using transfer-learning over a pre-trained model where the first layers perform the feature mapping of an image of 224x224 pixels.
Currently, most of the models developed using DL techniques are focused on the results, leaving in second place the resources needed for the execution of the algorithm.
The development of algorithms for mobile devices must be focused on the duration of the battery, optimizing its performance and autonomy.
A DL model must be efficient enough to work in real-time to be suitable for running in a hardware-restricted system or mobile devices.
For example, the development of the fire recognition DL model can work in the mobile vehicle system for fire detection proposed by Madhevan et al. \cite{Madhevan2017:mobile}.
\section{The KutralNet Architecture}
The KutralNet model proposal for fire recognition is intended to reduce the complexity of a deep learning model to process an image and decides if it has or not fire presence.
This proposal sets a baseline model in order to develop portable models that are well suited for limited hardware devices.
\begin{figure
\centering
\includegraphics[width=\columnwidth]{KutralNet_model}
\caption{The KutralNet architecture works with images of 84x84 pixels in RGB channels.
Only the first three convolution layer blocks keep the image dimensions.
To the classifier, a global average pooling delivers the features to the fully connected (FC) layer with two outputs, one for the fire label and another for the no-fire label.
Consecutively, a softmax function is implemented as activation at the top of the network.}
\label{fig:KutralNet}
\end{figure}
\subsection{Baseline model's architecture}
The baseline for the KutralNet model is inspired by FireNet, OctFiResNet, and the modified ResNet50 models.
Our KutralNet is the result of mixing between a deep model and a lightweight one, capable of processing 84x84 pixels images in RGB channels.
The model can be seen in Figure \ref{fig:KutralNet}.
The first three blocks consist of convolution with no bias and a 3x3 filters layer, followed by a batch-normalization layer, continuing with a LeakyReLU activation, and finally, a max-pooling with kernel 2x2 and stride 2.
When the signal passes from one block to another, it increases the number of the filters and reduces the dimension.
For the last block, two convolution layers and a batch-normalization layer are present.
The first convolution of 1x1 reduces the number of filters, and the second convolution of 3x3 processes the filters finishing with 64 channels.
A shortcut, of a 2x2 max-pooling layer with stride 2 and a batch-normalization layer, connects from the second block with the final convolution block.
On the top of the layer after the shortcut, the signal passes through a LeakyReLU activation and a global average pooling layer to the classifier, which consists of a fully connected layer with two neurons in the exit.
This architecture is defined for processing low-dimension images in a lightweight configuration.
It has been proved that few layers are capable of acquiring enough features for fire classification in order to optimize the inference time \cite{Jadon2019:FireNet}.
Additionally, using shortcut and batch-normalization layers avoids overfitting the model \cite{Kaiming2015:ResNet}.
We have chosen LeakyReLU since a non-zero slope for negative part improves the results \cite{Xu2015:ReLUActivations} and presents a low-cost implementation.
\begin{figure*
\centering
\includegraphics[width=0.8\textwidth]{KutralNet_mobile_block}
\caption{KutralNet Mobile Octave model resultant block.
The most to left and right of the block present a point-wise convolution and, in the middle, the depth-wise convolution, all combined with the octave convolution with $\alpha=0.5$.}
\label{fig:KutralNet_mobile_block}
\end{figure*}
The models' summary with the parameter numbers and operations required for image processing is in Table \ref{table:Comparative}.
The flops value for the FireNet model is not presented due to the instability during measurement, which increase the value over each run.
\begin{table
\caption{The computational cost of each implemented model represented as parameters and flops.}
\centering
\begin{tabularx}{\columnwidth}{lYY}
\toprule
\multicolumn{1}{c}{\textbf{Model$_{(InputSize)}$}} & \multicolumn{1}{c}{\textbf{Parameters}} & \multicolumn{1}{c}{\textbf{Flops}} \\
\midrule
ResNet50$_{(224x224)}$ & 31.91M & 4.13G \\
OctFiResNet$_{(96x96)}$ & 956.23K & 928.95M \\
FireNet$_{(64x64)}$ & 646.82K & - \\
KutralNet$_{(84x84)}$ & 138.91K & 76.85M \\
\bottomrule
\end{tabularx}
\label{table:Comparative}
\end{table}
\subsection{Portable version implementations}
The KutralNet model is the baseline used here to develop portable models, focusing on reducing the model size and computational cost.
The octave and depth-wise convolution \cite{Chen2019:octave,Sandler2018:MobileNet} demonstrate excellent performance with a sharp reduction of operations and parameters required, resulting in more efficient models.
This reduction is resulting from convolutions with low kernel dimensions for both cases.
For the depth-wise convolution type, the filter channels are processed in groups where $groups = C_{in}$ and $out\_channels = C_{in} * K$, in which the output filters are K times the input filters, reducing in this way the mathematical complexity of the operation.
For the octave convolution, the separate ways to process the filters on high and low frequency computing the parameters information $W$ into two components $W=[W_H, W_L]$ and exchanging information between them.
Additionally, these convolution techniques, used in different deep learning model architectures, and various tasks such as classification, object detection, and semantic segmentation, achieve a model size reduction, less computational requirements, and a slightly better performance in some cases.
This is useful for our purpose, and we present a new type of convolution combining the depth-wise convolution with its group filter operations and the octave convolution, which achieves a valuable trade-off between accuracy, model size, and computational cost.
Our different portable versions implemented are as follows:
\begin{itemize}
\item \textbf{KutralNet Mobile:} It is inspired by MobileNetV2 \cite{Sandler2018:MobileNet} and presents the implementation of the inverted residual block.
In this approach, from the second block, the KutralNet convolution blocks were replaced with the inverted residual block, in which each block contains point-wise and depth-wise convolution with shortcut connections in some cases.
\item \textbf{KutralNet Octave:} It is based on the KutralNet's architecture, and all the vanilla convolution were replaced with octave convolution with an $\alpha$ parameter of $0.5$.
Thus, the octave convolution uses the 50\% for the \textit{octave feature representation}, which corresponds to the low-frequency channel dealing with global features, and the rest for the high-frequency channel dealing with specific features.
Additionally, the octave convolution works using the depth-wise convolution form where it is possible.
\item \textbf{KutralNet Mobile Octave:} It is the combination of the MobileNetV2 block and the octave convolution.
It is the same KutralNet Mobile but replacing the vanilla convolution with the octave convolution combined with depth-wise convolution form.
The resultant block can be seen in Figure \ref{fig:KutralNet_mobile_block}.
\end{itemize}
All the portable models present the same classifier on the top of the network, which is composed of a LeakyReLU activation, passing through a global average pooling layer directly to a fully connected layer with two neurons on the exit.
Additional details of the implementations can be seen on the project repository\footnote{Github repository \url{https://github.com/angel-ayala/kutralnet}}.
A summary of the parameters and operations of the KutralNet models can be seen in Table \ref{table:PortableComparative}.
The number of floating-point operations (flops) and the number of parameters for a model are the metrics defined to measure the model requirements for image processing and storage, respectively.
The fewer parameters, the less on-disk size, is required.
Moreover, as fewer the number of flops, less is the computational cost for processing.
As the focus of our work is on develop a mobile deep learning model, the less value on both metrics, the best suited is the model for this purpose.
For the case of the Mobile and Mobile Octave variations, the models present a higher number of parameters but with a high flops reduction than the baseline.
\begin{table
\caption{The computational cost of each KutralNet portable variation represented as parameters and flops.}
\centering
\begin{tabularx}{\columnwidth}{lYY}
\toprule
\multicolumn{1}{c}{\textbf{Model$_{(InputSize)}$}} & \multicolumn{1}{c}{\textbf{Parameters}} & \multicolumn{1}{c}{\textbf{Flops}} \\
\midrule
KutralNet$_{(84x84)}$ & 138.91K & 76.85M \\
KutralNet Mobile$_{(84x84)}$ & 173.09K & 43.27M \\
KutralNet Octave$_{(84x84)}$ & 125.73K & 29.98M \\
KutralNet Mobile Octave$_{(84x84)}$ & 185.25K & 24.59M \\
\bottomrule
\end{tabularx}
\label{table:PortableComparative}
\end{table}
\section{Experimental Setup}
The environment used for the experiments was Google Colab, an online open cloud platform for machine learning algorithms.
This online platform provides a ready to use ecosystem with all the required libraries installed, e.g., for data manipulation, data visualization, and for the training process.
The container of the environment was a virtual machine configured with up to 13GB of memory, an Intel [email protected], and an Nvidia Tesla K80 with 12GB of GPU memory.
Our first experiment aimed to define a baseline model and prove its effectiveness to fire recognition.
For this purpose, three different models were implemented for comparing the baseline.
The first model is a novel lightweight model for fire recognition, the FireNet model \cite{Jadon2019:FireNet}, which is implemented in a Raspberry Pi as part of a fire alarm system.
A second model is a modified version of ResNet50 \cite{Sharma2017:deepfire} used with the transfer-learning technique for training the classifier on the top of the network with fire and no-fire images.
Another implemented model is OctFiResNet \cite{Ayala2019:OctFiResNet}, a proposal to lightweight and efficient model, based on the ResNet model, with few layers and octave convolutions.
The final implemented model is our proposal, KutralNet, to address a computationally efficient and lightweight deep neural network, balancing between the parameters and effectiveness.
Just for the case of KutralNet, during the training stage, present a learning rate variation from $\alpha=10^{-4}$ to $\alpha=10^{-5}$ on the epoch 85.
The trained and evaluated KutralNet is the baseline for the portable approaches.
With the defined baseline, the next set of experiments aimed to reduce the operations required for processing the images for fire recognition of the KutralNet model.
In order to reduce the operations required, techniques such as the depth-wise convolution presented with an inverted residual block in \cite{Sandler2018:MobileNet} and the octave convolution presented by Chen et al. \cite{Chen2019:octave} were implemented separately at first and mixed later to check their compatibility and efficiency.
This reduction results in three different models named: (i) KutralNet Mobile for the one where uses the inverted residual block, inspired in MobileNetV2;
(ii) KutralNet Octave is called the model which uses the octave convolution with a reduction parameter $\alpha=0.5$ combined with the depth-wise convolution, requiring fewer operations and space to store the model;
and (iii) KutralNet Mobile Octave, which uses the inverted residual block in combination with the octave convolution using the depth-wise form.
The training of all the models was performed during 100 epochs to choose the model with the best validation accuracy.
All of them were trained using cross-entropy loss and the Adam optimizer with default parameters, except for those previously mentioned.
For testing, two metrics were used to compare the efficiency of each model, the Receiver Operating Characteristics (ROC) curve and the area under the ROC curve (AUROC).
\subsection{Datasets}
For the training, validation, and test of the models, two datasets were used in this work.
The first one is called FireNet as the model \cite{Jadon2019:FireNet} and contains training and test subsets, with 2425 and 871 images, respectively.
The second one is the FiSmo dataset proposed by Cazzolato et al. \cite{Cazzolato2017:fismo}, which has been recently published with a total of 6063 images.
Additionally, we have used a contained subset of FiSmo comprised of 1968 images equally balanced between the fire and no-fire label.
An augmented version of FiSmo is also used, adding 485 black images labeled as no-fire, in order to check out the models' response to this kind of augmentation.
In addition to the balanced FiSmo version, we have also used an augmented version of this subset, which replaces 98 no-fire images for black images.
More details of the dataset images are in Table \ref{table:DatasetsSummary}, where FiSmoA is the augmented version of FiSmo, FiSmoB is the balanced version of FiSmo, and FiSmoBA is the augmented balanced version of FiSmo.
\begin{table
\caption{Quantity of images per label present on the particular dataset presented for this work.}
\centering
\begin{tabularx}{\columnwidth}{lYYY}
\toprule
\textbf{Dataset} & \textbf{Fire} & \textbf{No Fire} & \textbf{Total} \\
\midrule
\textbf{FireNet (training)} & 1124 & 1301 & 2425 \\
\textbf{FireNet (testing)} & 593 & 278 & 871 \\
\textbf{FiSmo} & 2004 & 4059 & 6063 \\
\textbf{FiSmoA} & 2004 & 4544 & 6548 \\
\textbf{FiSmoB} & 984 & 984 & 1968 \\
\textbf{FiSmoBA} & 984 & 984 & 1968 \\
\bottomrule
\end{tabularx}
\label{table:DatasetsSummary}
\end{table}
The datasets were used with the same specifications presented in their original works.
For the case of FireNet, the training dataset is split into 70\% for training and 30\% for validation, with a whole new dataset included for test purposes.
For FiSmo dataset, an arbitrary split value of 80\% for training and 20\% for validation separates the images of the dataset, due to only a single implementation for model training has been found.
The augmented version presents the same dataset separation, from the 485 black images inserted, 388 correspond to training and 97 for validation.
For preprocessing, the images were rescaled to the image input size of each model and normalized with values $\in [0,1]$.
\begin{figure*
\centering
\subfigure[The validation accuracy obtained from each dataset by the different models. The ResNet50 version works better with the augmented version of FiSmo and for the FireNet dataset, followed by KutralNet.
Additionally, Kutralnet performs better with FiSmo.
]{\includegraphics[width=0.8\columnwidth]{baseline_training_results}
\label{fig:TrainingResults}
}\quad
\subfigure[Test accuracy of each model trained with a different dataset and tested with FireNet-Test.
The KutralNet model is 5.7\% lower than ResNet50 with FireNet, and it gets the best accuracy trained over the FiSmo dataset.
The ResNet50 version gets better performance with the FiSmoA, followed by KutralNet.
]{\includegraphics[width=0.8\columnwidth]{baseline_test_results}
\label{fig:TestResults}
}
\caption{Training results of datasets FireNet, FiSmo, including FiSmoA, the augmented version of FiSmo (with 485 additional black images). The datasets were split as 70/30 for FireNet and 80/20 for both variants of FiSmo.
The augmentation with black images allows a better generalization in all the models, but just a slight difference for KutralNet.}
\end{figure*}
\begin{figure*
\centering
\subfigure[ROC curve for the models trained over the FireNet dataset.
The FireNet model performs slightly better than the modified version of ResNet50, OctFiResNet, and KutralNet.
]{\includegraphics[width=0.3\textwidth]{baseline_firenet_test_results} \label{fig:baseline_firenet_test}
}\quad
\subfigure[ROC curve for the models trained over the FiSmo dataset.
FireNet performs the best AUROC value but with low test accuracy.
The KutralNet model is the second-best AUROC value achieving the best test accuracy, followed by OctFiResNet and ResNet50.
]{\includegraphics[width=0.3\textwidth]{baseline_fismo_test_results} \label{fig:baseline_fismo_test}
}\quad
\subfigure[ROC curve for the models trained over the FiSmoA dataset.
The performance improves in all the models with this augmented version of FiSmo.
Again, FireNet presents the best AUROC value but with low test accuracy.
The ResNet50 performs the second-best AUROC value achieving the best test accuracy, followed by KutralNet and OctFiResNet.
]{\includegraphics[width=0.3\textwidth]{baseline_fismo_black_test_results} \label{fig:baseline_fismo_black_test}
}
\caption{The test results of the models with the FireNet-Test dataset with 871 images for fire classification.
All the models were trained with a different dataset and tested.
The augmented dataset, FiSmoA, presents better results than FiSmo for all the models.}
\label{fig:TestMetrics}
\end{figure*}
\section{Results and Discussion}
The next two subsections separate the experiments in order to achieve a portable deep learning model for fire recognition.
The first experimentation was with the proposed baseline model KutralNet, which uses novel deep learning techniques for image classification.
Experimentation results compare KutralNet with other previously presented deep learning models.
After the comparison with our baseline, the final experimentation allowed us to optimize the computational cost of the model, exploring the benefits of different portable approaches presented in the last years as the inverted residual block, the depth-wise, and octave convolution.
The different proposals got almost the same accuracy as the baseline model.
\begin{figure*
\centering
\subfigure[Validation accuracy obtained from each dataset by different portable models.
All the models presents almost the same results. ]{\includegraphics[width=0.8\columnwidth]{portable_training_results}
\label{fig:PortableTrainingResults}
}\quad
\subfigure[Test accuracy of each portable model trained with a different dataset and tested with the FireNet-Test dataset.
The KutralNet Mobile Octave and KutralNet Octave were capable of outperforming the baseline results.
]{\includegraphics[width=0.8\columnwidth]{portable_test_results} \label{fig:PortableTestResults}}
\caption{Training results obtained with the used datasets: FiSmo, FiSmoB, and FiSmoBA, a variant with 98 replaced no-fire images with black images.
The datasets were a validation split of 80/20 for all the models.
The black image augmentation reduces the difference distance between models' accuracy.}
\label{fig:PortableResults}
\end{figure*}
\begin{figure*
\centering
\subfigure[ROC curve for the models trained over the FiSmo dataset.
The KutralNet Octave performs the best, followed by KutralNet.
KutralNet Mobile Octave and the KutralNet mobile models get under the KutralNet's performance.
]{\includegraphics[width=0.3\textwidth]{portable_fismo_test_results} \label{fig:portable_fismo_test}
}\quad
\subfigure[ROC curve for the models trained over FiSmo balanced dataset.
The KutralNet Mobile Octave outperforms the KutralNet results, followed by the Mobile version.
]{\includegraphics[width=0.3\textwidth]{portable_fismo_balanced_test_results} \label{fig:portable_fismo_balanced_test}
}\quad
\subfigure[ROC curve for the models trained over the augment balanced FiSmo dataset.
Just the Octave and Mobile Octave version of KutralNet outperforms the baseline.
]{\includegraphics[width=0.3\textwidth]{portable_fismo_balanced_black_test_results} \label{fig:portable_fismo_balanced_black_test}}
\caption{The test results for the portable models with the FireNet-Test dataset with 871 images for fire classification.
The models' results are from the training with different datasets. The FiSmo, FiSmoB, and the FiSmoBA with 98 no-fire images replaced with black images.}
\label{fig:PortableTestMetrics}
\end{figure*}
\subsection{Baseline comparison}
The baseline comparison is performed with three deep models, in order to improve the results of our proposed model, focusing on efficiency and lightweight.
The first model is FireNet from Jadon et al. \cite{Jadon2019:FireNet}, which comprises just a few convolution layers and is part of a fire alarm system.
The second model is presented by Sharma et al. \cite{Sharma2017:deepfire}, where a pre-trained ResNet50 makes the feature extraction for a multilayer perceptron classifier with 4096 hidden units.
Finally, the OctFiResNet model \cite{Ayala2019:OctFiResNet} is a reduced version of ResNet50 presenting fewer layers and replacing almost all the vanilla convolution by octave convolution.
The first comparison has been performed over the FireNet dataset with 2425 images, 1124 with fire label, and 1301 with the no-fire label.
The FireNet dataset also contains a test subset with 871 images corresponding to 593 with the fire label and 278 with the no-fire label.
The first results show a validation accuracy of 93.83\%, 96.02\%, 95.34\%, and 98.22\% for FireNet, KutralNet, OctFiResNet, and ResNet50 respectively for the FireNet dataset.
Correspondingly, the test accuracy results are 88.98\%, 83.70\%, 88.18\%, and 89.44\% for FireNet, KutralNet, OctFiResNet, and ResNet50.
In order to check the generalization of the models, for the training and validation, the FiSmo dataset was used.
The test results obtained against the FireNet-Test dataset, as expected, get a lower accuracy for training with the FiSmo dataset.
The following experiment evaluated the prediction of the model with a black image as input.
All the models trained with the FireNet dataset miss-classify the black image, and the same behavior occurs with those models trained with FiSmo, also miss-classifying the black image with some exceptions.
The FiSmo dataset was augmented, to deal with this miss-classification issue, adding a 10\% of the no-fire label images, of black images.
The augmentation for this task showed useful improvements in training and test stage; both results can be observed in Figure \ref{fig:TrainingResults} and Figure \ref{fig:TestResults}.
The most in-depth models outperform the results of the FireNet model.
The test performance of the models trained with different datasets are in Figure \ref{fig:TestMetrics}.
As can be seen, comparing Figure \ref{fig:baseline_fismo_test} to \ref{fig:baseline_fismo_black_test}, the black images added into the FiSmo dataset show a reaction in the behaviour of the ROC curve of the models.
For the KutralNet and ResNet50 models present an improvement, for FireNet a diminishment, and OctFiResNet remains almost the same.
Regarding to the AUROC index, FireNet achieves better value in all the datasets, but as presented in Figure \ref{fig:TestResults} for FiSmo and FiSmoA achieves a low test accuracy.
To visualize the comparison of the models in a more straightforward way, Table \ref{table:BaselineMeanPerf} shows the average value of test accuracy and, AUROC index for all the datasets of each model.
Our proposed approach presents good accuracy for validation and testing using different datasets.
Overall, KutralNet presents the same behavior as a deep learning model, achieving high performance with a reduced number of parameters and operations.
Our baseline proposed as KutralNet accomplishes an interesting performance compared with previous deep models for fire recognition.
This model presents a few convolution layers in order to acquire a feature representation of fire in images.
A model with a few numbers of layers consequently present a reduced number of parameters and operations required for this task.
Our resultant baseline reduces 85\% the parameters number and 92\% the number of operations required, in comparison to the OctFiResNet model, to process an image signal of 84x84 pixels in RGB channels.
\begin{table
\caption{Mean performance values for testing accuracy and AUROC index of each model.}
\centering
\begin{tabularx}{\columnwidth}{lYY}
\toprule
\textbf{Model} & \textbf{Test Acc} & \textbf{AUROC}\\
\midrule
\textbf{FireNet} & 64.27\% & \textbf{0.96} \\
\textbf{KutralNet} & \textbf{78.26\%} & 0.92 \\
\textbf{OctFiResNet} & 75.92\% & 0.87 \\
\textbf{ResNet50} & 70.26\% & 0.90 \\
\bottomrule
\end{tabularx}
\label{table:BaselineMeanPerf}
\end{table}
\subsection{Portable version}
With our KutralNet baseline architecture, the next experimentation was to reduce its computational cost.
For this purpose, from the baseline, some convolution layers are modified, resulting in three different models to check the most efficient way of convolution.
The first model, KutralNet Mobile, replaces the structure of the baseline superficially in order to get the inverted residual blocks with depth-wise convolution, as proposed in \cite{Sandler2018:MobileNet}, simplifying the operations required for the processing.
The second model, KutralNet Octave, replaces the vanilla convolution from the baseline with the octave convolution \cite{Chen2019:octave} for signal processing.
In order for the octave convolution works, the shortcut of the baseline's architecture is slightly modified.
For the third model, KutralNet Mobile Octave is the version that presents a combination of the previously mentioned convolutions.
This version implements the inverted residual block with the octave convolution.
\begin{table
\caption{Mean performance values for testing accuracy and AUROC index of each portable model.}
\centering
\begin{tabularx}{\columnwidth}{lYY}
\toprule
\textbf{Model} & \textbf{Test Acc} & \textbf{AUROC}\\
\midrule
\textbf{KutralNet} & 76.01\% & 0.86 \\
\textbf{KutralNet Mobile} & 71.99\% & 0.85 \\
\textbf{KutralNet Octave} & 73.90\% & 0.85 \\
\textbf{KutralNet Mobile Octave} & \textbf{79.49\%} & \textbf{0.90} \\
\bottomrule
\end{tabularx}
\label{table:PortableMeanPerf}
\end{table}
In the first place, the training was performed over FiSmo, an unbalanced dataset with 2004 and 4059 images for the fire and no-fire label, respectively.
For this comparison of portable approaches, a validation accuracy of 88.62\%, 85.99\%, 87.55\%, and 87.39\% is achieved by KutralNet, KutralNet Mobile, KutralNet Octave, and KutralNet Mobile Octave model respectively.
Additionally, the test accuracy obtained from the models trained with this dataset is 74.63\%, 67.28\%, 72.33\% and, 72.91\%, respectively.
The bar plot in Figure \ref{fig:PortableResults} shows the results obtained with the other datasets.
For the trained models, the black image test was carried out in order to check the quality of features obtained from the signal.
For this purpose, using the FiSmoBA dataset gets the lowest miss-classification error in all the trained models.
Additionally, it gets $\pm 1\%$ of validation accuracy difference compared with the FiSmoB dataset.
For the black image test, the KutralNet Mobile with octave convolution gets the lowest miss-classification with 10\%, 30\%, and 0\% for the FiSmo, FiSmoB, and FiSmoBA respectively.
In overall, as can be seen in Figure \ref{fig:PortableTestMetrics}, the KutralNet Mobile Octave performs well in the different variations of the FiSmo dataset.
Additionally, the AUROC index is even better than the baseline with the balanced version of the dataset, and the augmented balanced version.
For the case of the KutralNet Octave, it performs better to the Mobile Octave version with the FiSmo and its augmented balanced version.
In Table \ref{table:PortableMeanPerf} are the mean values obtained for test accuracy and AUROC index for all the datasets of each portable model.
Taking into consideration the trade-off between parameter numbers and operations required for processing the image, the Kutralnet Octave presents a suitable solution with a less number of parameters than the KutralNet Mobile Octave and, conversely, requires more operations for processing.
\section{Conclusions}
In this work, we have proposed a lightweight approach for fire recognition, which consists of 138.9K parameters and 76.9M flops used as a baseline to build three portable versions.
The KutralNet Mobile, KutralNet Octave, and KutralNet Mobile Octave compare the efficiency of the inverted residual block, the depth-wise convolution, and octave convolution techniques for portable models.
Our proposed model KutralNet obtains better accuracy and AUROC index than previously deep learning models for fire recognition, with just a few layers and with a considerable reduction in computational cost.
The portable version KutralNet Mobile Octave can achieve good performance even if trained with different datasets for the fire and no-fire classification task, requiring only of 24.6M flops with 185.3K parameters.
The computational cost reduction has been possible using the inverted residual block with depth-wise and octave convolution combined for signal processing, proving to be the best approach for feature extraction for portable models.
Additionally, the augmentation with black images improves the generalization in the fire recognition task for deep models, for both balanced and unbalanced datasets.
As future work, we consider applying portable deep learning models for fire recognition and detection on video signal sources.
Furthermore, we plan to extend our work to fire detection using a bounding box approach as well.
\section*{Acknowledgment}
This study was financed in part by the Coordenação de Aperfeiçoamento de Pessoal de Nível Superior - Brasil (CAPES) - Finance Code 001, Fundação de Amparo a Ciência e Tecnologia do Estado de Pernambuco (FACEPE), and Conselho Nacional de Desenvolvimento Científico e Tecnológico (CNPq) - Brazilian research agencies
\bibliographystyle{./bibliography/IEEEtran}
| {'timestamp': '2020-08-18T02:16:26', 'yymm': '2008', 'arxiv_id': '2008.06866', 'language': 'en', 'url': 'https://arxiv.org/abs/2008.06866'} | arxiv |
\section{Introduction}
Many of the existing studies and datasets of the COVID-19 global pandemic focus on the biomedical and epidemiological aspect of the case and fatality rates, including efforts in detection, infection propagation, therapeutic intervention, and vaccine design, with a gaze fixed on the virus and illness that it causes.
Despite the direct focus on mitigating the spread and morbidity of infection~\cite{wellenius2020impacts}, pandemic-related policy decisions and investments cannot be made on health information alone.
Challenges span societal (e.g., disparities~\cite{chowkwanyun2020racial}), economic (e.g., unemployment~\cite{baek2020unemployment,coibion2020labor}), and psychosocial (e.g., stress, anxiety~\cite{pfefferbaum2020mental}, loneliness~\cite{usher2020life}) realms.
Recent work has called for identifying and understanding the multi-level system of humans needs and well-being for pandemic response and recovery strategies~\cite{ryan2020covid}.
Our goal is to better understand the influences of the pandemic and associated policy decisions on a multitude of human needs, where new insights about shifting needs can guide valuable refinements of policies and motivate the development of new interventions, programs, and investments.
Quantifying human needs across the population is important but challenging, as it requires innovative, ethical, privacy-preserving approaches with fine-grained and broad geo-temporal coverage.
A standard way to assess human needs is through survey-based measures~\cite{gallup1976human}, which can be costly and time-consuming to conduct at large scales.
Surveys are difficult to manage across time and geographies when the desire is to provide fine-grained analyses longitudinally and to be able to understand and react in near real-time.
Passively observing human behaviors is another approach, grounded in the fact that physical and psychosocial needs motivate human behaviors to express and fulfill those needs when they are unmet~\cite{maslow1943theory}.
For example, historical purchase behaviors are used to predict future consumer needs in market research~\cite{nielsen_2020}, but this approach is also limited to smaller-scale, consumer and commercial interests.
E-commerce platforms (e.g., Amazon marketplace) or specialized service providers (e.g., Talkspace, Coursera) may have access to large-scale, real-time analysis of customer behaviors, but they are focused tightly on specific needs.
Publicly available social network data (e.g., Twitter), have been used to characterize needs~\cite{alharthi2017dataset,yang2013identifying}, but these studies examine a subset of needs from data that only portrays externalized behaviors.
Such fragmentation of data limits the capture of broader expressions and comparisons across a broad spectrum of human needs.
We address these limitations in obtaining signals about human needs by observing the behaviors of people through their everyday interactions with a web search engine.
Human behaviors, through which human needs are expressed or fulfilled, often involve seeking information or obtaining tangible support or material items, for which web search has been an integral component.
Thus, search logs provide a unique lens into human needs via providing signals about human behaviors in their natural state, at large scale, and on already routinely collected data.
\squeezesome{We propose a computational methodology built on constructs of human needs by Maslow~\cite{maslow1943theory,maslow1970new} and Max-Neef~\cite{max1992human}.
We characterize pandemic changes across a broad spectrum of \emph{fundamental human needs}, spanning five broad human needs categories--\emph{Self Actualization}, \emph{Cognitive}, \emph{Love and Belonging}, \emph{Safety}, and \emph{Physiological}--and 79 subcategories.
We apply this framework to a dataset of 35+ billion search interactions across 36,000+ ZIP codes in the United States and over 14 months (7 months in 2019 and 7 months in 2020) to map search query strings and click interactions to human needs, resulting in over three billion expressions of human needs.
We demonstrate how this approach enables the examination of shifts in fundamental human needs based on disruptions induced by the pandemic.}
Our contributions include the following:
\begin{itemize}
\item \squeeze{We propose a novel computational framework for characterizing a \emph{holistic} view of human behaviors, intents, and unmet needs based on web search logs and human motivational theories (Sec.~\ref{sec:humanneedsframework})}.
\item \squeeze{We leverage a difference-in-differences approach~\cite{lechner2011estimation}} to quantify the impact of the pandemic and its associated policies on the relative changes in needs while controlling for seasonality and external factors (Sec.~\ref{sec:quantneed}).
\item We present the first population-scale analysis across a \emph{holistic} set of human needs during the COVID-19 pandemic in the United States through the use of web search logs (35+ billion search interactions for 14 months on 86\% of US ZIP codes; Sections~\ref{sec:tempchange}-\ref{sec:consequences}).
\item We find that search interactions in pursuit of basic human needs (i.e., \emph{Physiological}, \emph{Safety}) have increased exponentially during the pandemic while several higher-level aspirations (i.e., \emph{Self Actualization}, \emph{Cognitive}) have declined (Sections~\ref{sec:tempchange},~\ref{sec:subneeds}).
\item We observe geographical differences in how differing statewide shelter-in-place policies are associated with short-term and long-term changes in social and emotional needs (Sec.~\ref{sec:geo}).
\item We demonstrate that potential barriers to accessing critical resources, in support of people facing unemployment or domestic violence, can be identified through search interactions combined with external data sources (Sec.~\ref{sec:consequences}).
\end{itemize}
Our work suggests that signals from web search logs can be used to characterize and to monitor over time human needs at a population scale.
Our findings also emphasize the importance of tracking broad sets of human needs in combination with other reported measures to identify gaps in our current understanding of challenges and support, to measure the impact of policy changes, and to design policies and programs that can meet the needs.
\section{Related Work}
\enlargethispage{2\baselineskip}
\xhdr{Quantifying Human Needs}\label{back:needs}
\squeeze{Theories about basic human needs have been discussed for close to a century~\cite{pittman2007basic}. In particular, Maslow's hierarchy of needs~\cite{maslow1943theory,maslow1970new} has been applied in numerous domains~\cite{yang2013identifying,van2015understanding,cerbara2020nation, moss2010introduction}, despite criticisms of the validity of the theory~\cite{wahba1976maslow}.
These theories are aimed at providing a holistic understanding of human needs. The characterizations of broad spectrum of needs from these models are increasingly relevant during the pandemic~\cite{ryan2020covid}.}
\squeeze{Most studies use survey-based methods to measure human needs~\cite{cerbara2020nation,tay2011needs,mathes1978empirical,mitchell1976measurement}.}
Others have applied human needs theories in computational social science~\cite{alharthi2017dataset,yang2013identifying,long2020needfull}, but they focus deeply on specific topics (e.g., consumer behavior, well-being) and leverage publicly available social network data.
In contrast, we introduce a computational methodology to extract a full spectrum of human needs at population scales, which is critical for aligning policies with societal needs that they are intended to support.
\xhdr{Web Search Logs for Human Needs Analysis}
In addition, we harness search interaction data which captures more natural observations of human needs~\cite{dumais2014understanding}.
Web search logs have been used to understand human behaviors across many different domains~\cite{althoff2018psychomotor,ginsberg2009detecting,west2013cookies,weber2012mining}, time~\cite{althoff2016influence,althoff2017harnessing,paul2016search,fourney2015exploring}, location~\cite{west2013here,sadilek2018machine}, and to predict the now and the future~\cite{d2010google,choi2012predicting}, but prior studies typically focus on a single aspect of human well-being.
Google Trends APIs have helped to stimulate a prolific range of research in the context of the COVID-19 pandemic for physical~\cite{lin2020google}, psychological~\cite{tubadji2020narrative}, and socioeconomic~\cite{gupta2020effects,abay2020winners} well-being that operate on highly normalized and aggregated data.
In distinction, our work leverages fine-grained geospatial comparisons across 79 need subcategories and a difference-in-differences methodology, which allows for controlling confounders and understanding national coverage with flexible geo-temporal normalization and aggregation. We also improve detection of needs by leveraging click interactions.
\enlargethispage{\baselineskip}
\section{Dataset and Validity}\label{sec:data}
\process
\subsection{Dataset, Privacy, and Ethics}
We collected a dataset containing a random sample of deidentified search interactions from the first seven months of the years 2019 and 2020 obtained from Microsoft's Bing search engine.
For each search interaction, we collected the search query strings, all subsequent clicks from the search results page (e.g., clicked URL), and time and ZIP code location of the search interaction.
The resulting dataset contains 35+ billion search interactions and represents the web search traffic of over 86\% (36,667/42,632) of US ZIP codes associated with at least 100 queries per month so as to preserve anonymity (Table~\ref{tab:dataset}).
All data was deidentified, aggregated to ZIP code levels or higher, and stored in a way to preserve the privacy of the users and in accordance to Bing's Privacy Policy.
Our study was approved by the Microsoft Research Institutional Review Board (IRB).
\tabdataset
\subsection{Validation of Data}
Considering potential threats to validity, we examined the dataset from three perspectives: coverage of the population, analysis of selection bias, and reliability of the trends.
\xhdr{Analyzing National Representation}
To understand how much of the US population is represented by the collected data, we obtained demographics data from the Census Reporter API~\cite{census_reporter}.
The demographics of the ZIP codes in our dataset closely matched the US population demographics (\onlineappendix{A.1}).
Although query volumes are not uniformly distributed across these ZIP codes, the vast majority of the ZIP codes are included in our dataset.
We leverage location information for our analysis when geographical differentiation is necessary.
\xhdr{Analyzing Selection Bias}
To understand potential biases in socioeconomic circumstances that would influence the usage of the Bing search engine, we leveraged deidentified client id as a proxy for a unique user to estimate the `client rate', or how much of the population in a ZIP code is using the Bing search engine.
We examined the correlation between the client rate and various demographic factors.
While the factors describe some of the variance, none were correlated more strongly than $r$=--0.058 (\% Housing Owned), suggesting that the dataset is not strongly biased towards any single demographic (\onlineappendix{A.2}).
\xhdr{Reliability of Search Interaction Trends}
Many Americans use other search engines such as Google.
Therefore, we compared search trends for Bing with data available via the Google Trends API for the same time period and for specific keywords in each need category.
We found that the search trends are highly similar, with a median Pearson correlation of 0.96 (min=0.45, max=0.98, all $p$<0.001).
\squeeze{This implies that our findings are not simply an artifact of using one search engine over another (\onlineappendix{A.3}).}
\section{Human Needs Framework}\label{sec:humanneedsframework}
\subsection{Human Needs Categories}\label{method:categories}
We draw inspiration from Maslow's hierarchy of fundamental human needs~\cite{maslow1943theory,maslow1970new} to tag each search interaction with one or more of five broad categories of needs. We represent human needs as a ladder to convey that a person may have multiple needs (Fig.~\ref{fig:process}a). \emph{Safety} and \emph{Physiological} are considered as `basic' needs. \emph{Love and Belonging} is often considered to be `psychological' needs, and \emph{Cognitive} and \emph{Self Actualization} are considered as `growth' needs, defined in more detail below:
\enlargethispage{2\baselineskip}
\textbf{Self Actualization} needs are about realizing personal potential, seeking personal growth, and self-fulfillment. Topics include: hobbies; parenting; wedding; talent acquisition; goals; charity.
\textbf{Cognitive} needs are about pursuing knowledge and intelligence through learning and discovering. Topics include: online education, learning materials; educational degrees; cognition; memory; focus.
\textbf{Love and Belonging} are social and emotional needs and include emotionally-based relationships such as friendship, family, dating, sexual intimacy. Topics include: mental health or emotions; social network or activities; relationships, dating, divorce or breakup.
\textbf{Safety} needs stem from our desire to seek order, stability, and protection from elements in the world. Topics include: personal protection; finances; banking; job search; unemployment; housing.
\textbf{Physiological} needs are the basic animal needs such as air, food, drink, shelter, warmth, sex, and other body needs. Topics include: health; food and groceries; basic staples; sleep; transportation.
\squeeze{To understand the nuances of the needs, we further subdivided the five main categories into 79 subcategories.
Several researchers independently developed subcategories which were combined and resolved collaboratively through consensus meetings.
\onlineappendix{A.4} describes this process in detail with the full taxonomy of our need categories, example queries and/or clicked page URLs.}
\subsection{Human Needs Detection}\label{method:processing}
\enlargethispage{\baselineskip}
A search interaction can be an observation of the underlying human need in two ways: (1) an expression of a potential satisfier (physical or information) for that need, or (2) a direct expression of the deficiency or satisfaction of that need.
For example, a search query for `bandages' with a subsequent click on `amazon.com' could indicate a purchase intent that satisfies a \emph{Physiological} need.
We require the additional click into one of many e-commerce domains to solidify that this interaction is a purchase intent.
Information search about `online games with friends' could satisfy a \emph{Love and Belonging} need.
A need (satisfaction or deficiency thereof) could be directly expressed in experiential statements such as `I feel depressed' (\emph{Love and Belonging}).
We match each search interaction to a corresponding need subcategory through simple detectors based on regular expressions and basic propositional logic.
Each need subcategory could have multiple regular expressions applied to either the query string, the clicked URL, or both, depending on the complexity of the expression and the need subcategory.
We arrived at these regular expressions based on our data through several collaborative consensus meetings until we were satisfied with precision and recall (\onlineappendix{A.4}).
Overall, 9.1\% of our query samples matched at least one of the need categories.
Each search interaction can satisfy multiple human needs~\cite{max1992human}, so we allowed each search interaction to be tagged by multiple need categories
(only 0.32\% have multiple tags).
We then aggregated matched search interactions across need categories and subcategories, time (e.g., day, week), and geography (e.g., ZIP code, county, state).
Fig.~\ref{fig:process} illustrates these steps in detecting and processing of human needs.
Throughout the paper, we report needs as \emph{expressed} through search interactions and not actual underlying human needs.
Some human needs are expressed well by search interactions while other needs are more appropriately expressed through other digital and/or non-digital means.
When analyzing \emph{changes} in such search interactions, careful consideration is required to differentiate actual shifts in the underlying human needs (e.g., health-related needs have increased due to COVID-19) from the equally meaningful changes observed in logs based upon shifts from offline to online behaviors (e.g., online grocery purchases due to store closures), and we present our results in both possible contexts.
\subsection{Framework Validation}\label{sec:validation}
Our goal is to detect with high precision a large number of needs across a broad set of categories.
\enlargethispage{2\baselineskip}
\xhdr{Precision}
We sampled ~1.2 million search interactions that matched at least one need category as a candidate set.
From this sample, we randomly chose 100 unique tuples of search query string and clicked URL (e.g., `15 lb dumbbells' and click on `walmart.com') for each of the five high-level need categories, for a total of 500 unique tuples representing 1,530 search interactions in our evaluation set.
We selected unique tuples to avoid duplication in labeling, but we mapped the labels back to the original 1,530 search interactions to compute precision on the distribution of the source evaluation set.
We then collected human labels for each tuple via Amazon's Mechanical Turk, where each tuple could be tagged with none, one, or more of the five needs categories.
All labels and predictions have Boolean values with no ranking among needs categories.
Upon inspecting the label quality, we found common systematic label errors such as labeling `recipe'-related queries as \emph{Cognitive} needs, or `divorce'-related queries or visits to specific government unemployment sites as \emph{Physiological} needs, where the workers mislabeled the queries according to the definitions we specified in the task detail.
Other errors were due to inherent ambiguities in search. For example, `rent in florida coronavirus' is tagged as \emph{Physiological} for `coronavirus' but not as \emph{Safety} for `rent' because our high precision detector requires more qualified keywords such as `apartment rent.'
Although the worker tagged this as \emph{Safety} (i.e., rent for shelter), the use of the word `rent' here may not be shelter-related.
We took a conservative approach of only correcting definitive label errors and not ambiguous errors, and our evaluation set achieved a precision of $97.2\%$, using the example-based precision metric defined in~\cite{zhang2013review} for multi-label classification.
\xhdr{Recall}
Although it is infeasible to ensure a perfect recall across a massive dataset, it is important that we capture a significant number of needs expressions.
We find that 9.1\% of our search interactions match at least one need category.
While this recall is significant and led to more than 3.2 billion detections of needs expressions,
we note that high recall is not necessary for an unbiased analysis approach, because we conduct a fair comparison among the outputs of the same detectors across pre-pandemic and pandemic periods.
We did not find that the exact expressions of needs varied drastically within our dataset that would indicate any temporal bias.
We also investigated whether our need expressions were dominated by a few categories. Clicks to YouTube or Facebook dominated, but still only represented 1\% of our dataset.
We categorized visits to these sites based on their primary functions (i.e., Facebook for social networking and YouTube for media consumption).
We found that our results were robust, whether or not we included these high-traffic sites in our dataset.
\subsection{Quantifying Changes in Human Needs}\label{sec:quantneed}
Our goal is to quantify the change in human needs during the pandemic relative to the pre-pandemic period.
This can be challenging due to potential confounding effects of yearly seasonal variations, weekly seasonal variations, and variations in query volume over time.
Conceptually, we control for yearly seasonal effects through comparisons with the previous year, for weekly seasonal effects by matching the day of the week between both years (i.e., \mbox{Mon Jan 6, 2020} is aligned to \mbox{Mon Jan 7, 2019}), and by considering relative proportions of the query volume represented by each need over time.
Formally, we follow a difference-in-differences methodology~\cite{lechner2011estimation,dimick2014methods}, commonly used in economics, to account for confounding effects between comparison groups.
Finally, our adjusted effect size is the logarithm of the ratio between two groups.
This is effectively the difference-in-differences approach applied to the logarithmic effect sizes and has the advantage of the effect sizes having symmetric properties (i.e., $\Delta(t_1; t_2)$=$-\Delta(t_2;t_1)$)~\cite{graff2014expressing, cole2017statistics}.
This step allows for appropriate comparison of effect sizes across both increases and decreases in need.
Our estimate of the \emph{relative change in human need} $C$ between two time periods is defined as
\begin{displaymath}
C(t_1;t_2, n) = \log_2\left(\frac{E(t_2^{2020}, n)}{E(t_1^{2020}, n)}\right) - \log_2\left(\frac{E(t_2^{2019}, n)}{E(t_1^{2019}, n)}\right)
\end{displaymath}
where $E(t_{2}^{2020}, n)$ is the expression of need $n$ at some time $t_2^{2020}$ in 2020 (i.e., after the pandemic declaration) and $E(t_{1}^{2020}, n)$ is the expression of need at $t_{1}^{2020}$ (i.e., before the pandemic).
\squeeze{Across all following analyses, we choose the mean daily expression of needs between Jan 6 to Feb 23, 2020 as the `pre-pandemic baseline', referred to throughout the paper, and dates on or after Mar 16 as the `pandemic period' because individual states declared a state of emergency at different times (Feb 29 to Mar 15).}
We then compute the 95\% confidence interval on this multiplicative effect size by using bootstrap resampling with replacement (N=500).
We report mean estimates and p-values throughout the text and 95\% confidence intervals in all figures and tables where applicable.
All time series figures (Figures~\ref{fig:annotatedtrend}, \ref{fig:subneeds}, \ref{fig:unemployment}B) indicate the moving average of the daily relative changes, computed from 3 days before to 3 days after.
\section{Temporal Changes in Human Needs}\label{sec:tempchange}
\enlargethispage{2\baselineskip}
\annotateedtrend
We first consider how human needs change over time across the US in the context of major events surrounding the pandemic.
We compute the daily relative change in the expressed needs in comparison to the pre-pandemic baseline, as described in Sec.~\ref{sec:quantneed}, for the duration of our entire dataset, giving us per-day relative changes in all need categories and subcategories.
For each inflection point and major national event, we examine need subcategories with the highest relative changes to understand which contribute the most to the overall need.
\xhdr{Elevated Needs and Contributing Subcategories}
Fig.~\ref{fig:annotatedtrend} illustrates daily relative changes of needs on a log scale, where zero indicates no change.
Overall, we see that all need categories were at elevated rates during March through May relative to the earlier months.
A few of the local inflection points correspond to US national events, such as the declaration of national emergency on Mar 13 or the first stimulus checks being deposited on Apr 11.
\emph{Physiological} needs start to increase first around February (Fig.~\ref{fig:annotatedtrend}A), dominated by \emph{health condition related queries} ($C$=$1.46$ on Feb 29) and subsequently by \emph{toilet paper purchase} and \emph{health measurement equipment purchase} ($C$=$1.14$, $0.76$ on Mar 6 respectively; Fig.~\ref{fig:annotatedtrend}B).
Around \mbox{Mar 16}, \emph{Physiological} needs peak at over 3.8 times the baseline ($2^{1.91}$; Fig.~\ref{fig:annotatedtrend}C).
Following national emergency declaration (Mar 13) and mandated lock downs (first on Mar 21), we see a sharp increase in \emph{Cognitive} needs (Fig.~\ref{fig:annotatedtrend}D), dominated by \emph{educational site visits} and \emph{online education queries} ($C$=$1.97$, $1.42$ on Mar 23).
\emph{Self Actualization} needs peak around Apr 11 (Fig.~\ref{fig:annotatedtrend}E), dominated by \emph{cooking site visits} and \emph{cooking related queries} ($C$=$1.73$, $1.15$), and \emph{online social activities queries} and \emph{social technology uses} dominate \emph{Love and Belonging} needs ($C$=1.77, 1.72 on Apr 11).
A sharp spike of \emph{Safety} needs can be seen shortly after the first stimulus checks were deposited: \emph{stimulus related queries}, \emph{state unemployment site visits}, \emph{COVID-19 protection purchase} dominate \emph{Safety} needs \mbox{($C$=8.17, 5.49, 5.12 on Apr 18; Fig.~\ref{fig:annotatedtrend}F).}
While other needs start to trend downwards or stabilize throughout much of May-July, \emph{Physiological} needs increase for a second time with additional interests in health conditions, followed by \emph{Safety} needs with queries related to economic stimulus and loans (Fig.~\ref{fig:annotatedtrend}G), which aligns with the rise of COVID-19 cases in the US around Jun 6.
\enlargethispage{\baselineskip}
\xhdr{Shifting of Needs}
Based on the severe health impacts of the COVID-19 pandemic, we expected to see and confirmed that \emph{Physiological} needs dominate throughout our dataset, as COVID-19 is still a major US public health issue at the time of writing.
At a glance, we see two instances of the surge in \emph{Physiological} needs followed by a subsequent increase in \emph{Safety} needs.
As \emph{Physiological} concerns rise, public health responses (e.g., business closures or restrictions) could potentially induce instabilities in \emph{Safety} needs, and this observation needs to be further investigated.
We see basic needs expressed before other needs consistent with the hypothesis by Maslow~\cite{maslow1943theory} and observations by others~\cite{tay2011needs}.
We also expected to see a decrease in the expression of growth needs (\emph{Self Actualization} and \emph{Cognitive}) as people's attention shifts toward basic needs.
However, both \emph{Cognitive} and \emph{Self Actualization} needs increased overall, with the increase in \emph{Cognitive} needs being more temporary and \emph{Self Actualization} being more sustained.
Despite health and economic concerns, interests in recreational activities or hobbies (e.g., cooking, gaming) contribute to this steady 23\% (=$2^{0.3}$--1) increase in \emph{Self Actualization} needs.
Further research into the temporary nature of \emph{Cognitive} needs and the long-term impact of such sustained interest in \emph{Self Actualization} is necessary.
\squeeze{We see that the peak in \emph{Physiological} needs occurs around four weeks before the peak in \emph{Safety} needs (Fig.~\ref{fig:annotatedtrend}C, F), while the second set of peaks are a few days apart (Fig.~\ref{fig:annotatedtrend}H).
This could be an indication of phenomena like resilience or endurance from economics and disaster management that requires further examination~\cite{martin2015notion,fletcher2013psychological}.}
\section{Significant Changes in Human Needs}\label{sec:subneeds}
\enlargethispage{\baselineskip}
Next, we examine individual need subcategories that present the largest increase or decrease in search expressions, possibly due to the pandemic impact.
To explore these two ends of the spectrum, we compute the mean relative changes in needs during the initial four weeks of the pandemic period (Mar 16 to Apr 12) compared to the pre-pandemic baseline, as described in Sec.~\ref{sec:quantneed}.
We then examined the top 12 need subcategories with the largest increase or decrease in the relative change.
\tabtopchange
\tabbottomchange
\xhdr{Heightened \emph{Physiological} and \emph{Safety} Needs}
\squeeze{Table~\ref{tab:topchange} shows that 11 need subcategories with the most increase fall under \emph{Physiological} and \emph{Safety} needs as seen from the temporal trends in Sec.~\ref{sec:tempchange}, and one (\emph{online social activities queries}) belongs to the \emph{Love and Belonging} need category.
\emph{Toilet paper purchase} reached a maximum increase of 127 times the pre-pandemic baseline (Mar 16).
Recall that these are not just queries containing `toilet paper', but purchase intents as indicated by subsequent clicks to e-commerce sites (Sec.~\ref{method:processing}).
Such a high level of interest in toilet papers is commonly attributed to panic buying due to the supply scarcity~\cite{hamilton2020scarcity} and media coverage~\cite{garfin2020novel}.
\emph{Stimulus related queries}, including general terms like `loan forgiveness,' reached an even higher maximum increase of 286 times the baseline
(Apr 18) and is sustained at that high level through July, reflecting the magnitude of the pandemic's impact on the US economy.}
When we examine the daily trends, we see that \emph{COVID-19 protection purchase} exhibits a small peak ($C$=1.0 on Jan 29) after the first reported COVID-19 case (Jan 20), and the needs quickly escalate from Feb 20 (Fig.~\ref{fig:subneeds}B), at least three weeks earlier than other needs (Fig.~\ref{fig:subneeds}A,C,D) that do not escalate until the national emergency declaration.
\squeeze{A subsequent peak on Apr 3 ($C$=5.6) coincides with CDC's updated recommendation on cloth-based mask use. }
\squeeze{We also find that indicators of social-economic instabilities such as \emph{unemployment site visits} and \emph{food assistance related queries} still have not returned to their baseline levels (Fig.~\ref{fig:subneeds}A,C), arguably because the pandemic is still in effect.
\emph{Online social activities queries} follow a similar pattern (Fig.~\ref{fig:subneeds}D), reflecting the need to satisfy lock-down induced social isolation through online services, but it also raises the question of potential permanent shifts in ways of satisfying social needs.
Our findings revealed that only a few of these needs have returned to the pre-pandemic baselines while many of them are sustained at elevated rates.}
\subneeds
\xhdr{Shifts Away from Positive Outlooks}
\enlargethispage{\baselineskip}
Table~\ref{tab:bottomchange} shows the most decrease in the expression of several \emph{Self Actualization} and one \emph{Cognitive} need subcategories.
Specifically, indications of \emph{Self Actualization} needs for partnership have declined by more than 64\% (=$2^{-1.49}$--1) of their baseline throughout the typical US wedding season around Spring and early Summer, which is expected given restrictions on large gatherings.
In addition, needs that are typically associated with growth, positive outlook, or new opportunities have taken a large toll.
In \emph{Self Actualization}, queries about life goals also see a large decline.
In other need categories, needs expressed by \emph{educational degree related queries}, \emph{job search related queries}, \emph{job search site visits}, or \emph{housing related queries} have declined by over 34\% (=$2^{-0.61}$--1) of their baseline.
Upon inspection of daily trends, expressions of forward-looking needs have decreased and remain below the pre-pandemic baseline (Fig.~\ref{fig:subneeds}E,F,G).
The sustained decline in \emph{job search related queries} (Fig.~\ref{fig:subneeds}G) juxtaposed with near 30 times increase in unemployment needs (Fig.~\ref{fig:subneeds}A) is a troubling evidence of the declining labor force as seen in other studies~\cite{coibion2020labor}.
Indications of growth interests in educational degrees or life goals have not recovered (Fig.~\ref{fig:subneeds}F).
These results combined with heightened \emph{Physiological} needs suggest a shift of focus away from individual growth.
\squeeze{\emph{Divorce related queries} exhibited a maximum of 47\% (=$2^{-0.93}$; Fig.~\ref{fig:subneeds}H) decline, possibly reflecting the challenges that families face in proceeding with divorce during the lock downs~\cite{lebow2020challenges}.
Therefore, underlying mechanisms for these shifts, long-term impact of the lack of growth needs, and support for relationships should be further studied.
See \onlineappendix{A.5} for corresponding figures on all 24 subcategories.}
\section{Geographical Differences in Needs}\label{sec:geo}
\enlargethispage{\baselineskip}
We shift our attention to how the pandemic and its related policies \emph{differentially} influence local \emph{subpopulations}.
We use a set of statewide policies\footnote{Although our dataset allows ZIP code level analysis, a comprehensive list of local policies across the US are difficult to obtain at ZIP code, city, or even county levels.} readily available through the COVID-19 US State Policy Database~\cite{raifman2020covid}.
We examine the impact of the shelter-in-place mandate (its duration and effective date) on social-emotional and relationship needs (i.e., eight \emph{Love and Belonging} and two wedding-related \emph{Self Actualization} subcategories).
We hypothesized that social isolation induced by longer shelter-in-place mandates generates more expressions of social-emotional needs.
\squeeze{We used the date on which the shelter-in-place mandate was enacted and relaxed or lifted for 38 states to derive the mandate duration\footnote{Only 38 states had the start and end dates in the dataset as of this writing.}.
We compute two relative changes in needs for each state.
First, to understand the \emph{short-term} impact of the {shelter-in-place mandate}, we compute the relative change in needs for {\emph{two weeks after}} each state's shelter-in-place mandate compared to the {\emph{one week before}} the mandates\footnote{We chose one week before the mandate because it is the maximum number of full weeks after the declaration of national emergency and before the earliest start date (Mar 21) for any shelter-in-place mandate.}.
Second, to understand the {\emph{long-term}} impact of the mandate, we compute the relative change in needs between the \emph{pre-pandemic baseline} and the \emph{last four weeks} of our dataset (Jul 6 to Aug 2), which is at least two weeks after the last state lifted its mandate (Jun 19).
To quantify the potential impact of these mandates, we ran a Pearson correlation analysis (1) between the start date of the shelter-in-place mandates (i.e., ISO day number) and the short-term relative changes in needs, and (2) between the duration of the mandates and the long-term relative changes in needs.}
\xhdr{Early Adjustments to Social Needs}
The start date of shelter-in-place mandates ranged between Mar 21 and Apr 7.
We find that the relative changes in \emph{online social activities queries} (\mbox{$r$=$-0.53$}, $p$<0.001), \emph{wedding site visits} (\mbox{($r$=0.48}, $p$=0.002), \emph{wedding related purchase} ($r$=0.43, $p$=0.006), and \emph{mental health resource site visits} ($r$=0.47, $p$=0.003) needs were most correlated with the start date.
People from states that have earlier shelter-in-place mandates expressed significantly reduced interests in weddings and mental health site visits (Fig.~\ref{fig:stateshelter}A) and significantly more need for online social activities (Fig.~\ref{fig:stateshelter}B).
For example, in the two weeks after the mandate, people in New Jersey (mandate on Mar 21) sought online mental health resources 25.7\% less than the week before the mandate, while people in South Carolina (mandate on Apr 7) sought those resources 13.4\% more than the week before.
\stateshelter
\xhdr{Long-term Social Impact}
\squeezetiny{When we examine the long-term changes in expressed needs, we find that shifts in \emph{negative mental health experiential queries} ($r$=0.42, $p$=$0.010$, Fig.~\ref{fig:stateshelter}C), \emph{wedding site visits} ($r$=$-0.37$, $p$=0.022, Fig.~\ref{fig:stateshelter}D), and \emph{wedding related purchase} ($r$=$-0.35$, $p$=0.033) were most correlated with the duration of sheltering and closures.
The duration of the shelter-in-place mandates were highly correlated with the start date ($r$=$-0.62$, $p$<0.001), indicating that people faced with earlier mandates are also impacted by longer mandates.
As we discovered above, these people likely suppressed their needs for weddings or mental health support early during the pandemic.
At the same time, as wedding needs slowly recover to the pre-pandemic baseline (Fig.~\ref{fig:subneeds}E), those impacted by longer mandates are even slower in their recovery of wedding needs and are more likely to express negative mental health issues.
For example, people in Mississippi (24 days of shelter-in-place) expressed 33.2\% \emph{less} negative mental health experiences than before the pandemic while people in Oregon (88 days) expressed 27.2\% \emph{more} negative mental health experiences than before (Fig.~\ref{fig:stateshelter}C).
Others attribute this increase in negative emotions during the pandemic to the shift to basic needs~\cite{cerbara2020nation}.
Per-state analysis of this shift along with differential prevalence of COVID-19 may be necessary to understand the mechanisms for this increase in negative emotions and to provide appropriate social-emotional support.}
\enlargethispage{\baselineskip}
\section{Gaps between Expressed and Reported Needs}\label{sec:consequences}
\squeeze{As we have demonstrated so far, there are many needs that are well expressed by web search interactions such as purchasing goods online, looking for health information online, or accessing economic assistance through government websites.
Our final analysis examines a gap between how web search facilitates the expression of these needs and the reported fulfillment of these needs to discover potential barriers to accessing critical resources.
To demonstrate how our approach allows for exploring these barriers, we focus on two need subcategories: unemployment and domestic violence.}
\enlargethispage{2\baselineskip}
\unemployment
\xhdr{\mbox{Expressed Unemployment Needs vs. Reported Claims}}
We obtained weekly, seasonally adjusted initial unemployment claims for 2020 from the US Department of Labor\footnote{\url{https://oui.doleta.gov/unemploy/claims.asp}} and computed the relative changes in unemployment claims using the same approach as in Sec.~\ref{sec:quantneed}.
We compare the change in reported unemployment claims with the change in expression of unemployment needs in search and find that these two changes are closely aligned (Pearson $r$=0.996, $p$<0.001) (Fig.~\ref{fig:unemployment}A).
Despite policies that extend unemployment eligibility for up to 26 weeks during the pandemic, we see that the expression of unemployment needs remain at 25\% higher than the reported claims since April.
This discrepancy corroborates with known issues with the unemployment benefits: many people were confused about the benefits (e.g., job search requirement) and were being denied, having to search for more information or file multiple applications~\cite{schwartz_hsu_cohen_2020,bhardwaj_2020}.
Although our analysis excludes those who use traditional methods for filing unemployment claims (e.g., mail, phone), our results indicate that web search is a critical resource that facilitates unemployment needs and highlight a potential gap in satisfying unemployment needs which requires further investigation.
\xhdr{Expressed Domestic Violence Needs vs. Reports}
\squeeze{One of the dire consequences of the COVID-19 pandemic is an increased risk of domestic violence due to shelter-in-place mandates exacerbated by physical, financial, and social-emotional stressors and increased alcohol consumption at home~\cite{campbell2020increasing,li_schwartzapfel_2020}.
Our analysis shows that the expression of needs for \emph{domestic violence queries} has dropped by nearly 36.7\% (=$2^{-0.66}$--1) since the pandemic and stabilized at around -15.9\% (=$2^{-0.25}$--1, Fig.~\ref{fig:unemployment}B) below pre-pandemic levels.
Interests in \emph{firearm purchase} have increased by over 40\% (=$2^{0.5}$--1), corroborating other reports of increased gun sales and gun violence and worrisome links to fatal domestic violence incidents~\cite{sutherland2020gun,hatchimonji2020trauma,campbell2020increasing}.}
\squeezetiny{A similar decrease in domestic violence related metrics in March is seen by national hotlines\footnote{\url{https://crisistrends.org/}; \url{https://www.thehotline.org/}}. Some reports point to potential underreporting by victims unable to reach out for help under constant surveillance by the offenders at home and fearful of exposure to the virus at a shelter~\cite{bullinger2020covid, southall_2020}.
Although the expansion of online resources are critical to addressing the rise in domestic violence~\cite{mahase2020covid}, many studies highlight the need to recognize control tactics that prevent access to these digital resources~\cite{ross2020if}.
The sustained decrease in domestic violence queries seen in our data may indicate such barriers or shifts in access methods for these online resources.
The complexities of domestic violence are evident in the inconsistencies across many data sources, resource media, and contexts.
Our results frame an urgent question that needs to be resolved through expertise in domestic violence and social work organizations and through careful combination of multiple data sources to identify the underlying explanations for our findings.}
\section{Discussion and Conclusion}
\enlargethispage{\baselineskip}
We presented a computational methodology based on theories of human needs to quantify the effects of the pandemic and its related events on web search interactions.
Although all need categories had elevated changes in needs, we found that basic need subcategories were elevated the most while growth-based need subcategories, indicative of positive outlooks in life, were subdued (Sections~\ref{sec:tempchange},~\ref{sec:subneeds}).
We also found that earlier and longer shelter-in-place mandates may come with an unintended impact on mental health needs (Sec.~\ref{sec:geo}).
We used unemployment and domestic violence related queries to demonstrate how our methodology could help expose gaps between the expression and fulfillment of needs--and frame questions and directions for urgent investigation (Sec.~\ref{sec:consequences}).
\xhdr{Limitations}
We cannot use our method to make causal claims.
If other major, concurrent events (e.g., Black Lives Matter) have significantly influenced human needs during the observations window, we are not be able to distinguish between needs caused by the pandemic or these events.
However, our analysis clearly presents changes in the expression of human needs which can be important on its own for understanding rising needs and in considering factors for the design of specific interventions.
Our analysis relies on heuristics and correct inference of needs from search interactions. But our framework is theory-driven, comprehensive, and achieves 97\% precision across five main need categories. Further fine-tuning of the framework should be motivated by precision-recall requirements of individual analysis goals.
Although \emph{expressions} of needs may not reflect the actual underlying human needs, the methodology serves as a useful detector for needs, as we have demonstrated through its corroboration with several external findings, and combining our methodology with additional data sources and interdisciplinary collaboration can further the understanding of changes in human needs during global crises.
In contrast to traditional methods of measuring needs, our approach can operate at population scales relying solely on data that is already routinely collected by web search engines, and thus allows for effective, retrospective, and fine-grained studies with observation periods of over one year.
\xhdr{Implications: Resilience and Vulnerability}
Our work has demonstrated major shifts in a spectrum of human needs during the pandemic, echoing the need to understand the societal, economic, and psychosocial effects of these events and the underlying system of human needs.
Such understanding is essential for guiding programs around outreach and support of people during the current pandemic and preparing for future pandemic responses and recovery efforts~\cite{ryan2020covid}.
We observed that some needs have returned to their baseline levels while others are sustained at elevated (e.g., health and economic instability) or suppressed (e.g., job search, educational degree) levels (Fig.~\ref{fig:subneeds}).
As we saw in Sec.~\ref{sec:tempchange}, temporal variations on how and when certain needs arise in response to major disruptions could indicate a degree of psychological and economic resilience~\cite{martin2015notion,fletcher2013psychological}.
Understanding how well a region can endure disruptions is crucial for balancing health risks against societal risks, especially for vulnerable populations who are severely impacted by the pandemic~\cite{chowkwanyun2020racial}.
Our framework could be used to quantify how much a community has been and might be able to endure social and economic distress.
For example, a region may be able to withstand prolonged business closures before loan forgiveness needs surge, while another region may show immediate need for financial stimulus.
In addition, when coupled with demographic variables, our framework could be used to examine disparities in needs which may help with understandings of the disparate impacts of blanket policies on the most vulnerable populations.
\xhdr{Implications: Preparedness and Resources}
Our work revealed strong correlations indicative of a long-term mental health impact of longer shelter-in-place mandate, suggesting that states with longer duration of shelter-in-place mandates may need to provide additional support for social emotional well-being (Fig.~\ref{fig:stateshelter}).
We also saw potential barriers to accessing critical resources for unemployment and domestic violence; a decrease in domestic violence queries in spite of conflicting anecdotes should raise questions and an alarm (Fig.~\ref{fig:unemployment}).
These examples suggest that expressions of needs through web interactions could highlight resource deficiencies or barriers.
As regions prepare recovery efforts from COVID-19 or make plans for future disruptions, our methodology can be harnessed to monitor or anticipate a spectrum of needs at various geotemporal granularities; this could help reveal impacts of the pandemic (e.g., mental health~\cite{cdcmentalhealth}) and cater the appropriate interventions that meet individual and societal needs.
\xhdr{Future Directions}
We see this work as a step towards achieving a more holistic understanding of the multiple influences of the pandemic and associated policies and programs.
While we focused on retrospective analyses, our approach has the potential to be used in near real-time to monitor human needs and support future policy decisions.
Understanding the disparate impacts of the pandemic and its policies on a full spectrum of human needs, especially for vulnerable populations, is critical for designing response and recovery efforts for major disruptions.
Our work highlighted future research opportunities and calls for action and collaboration across epidemiology, economy, social sciences, risk management, and more.
We look forward to further refinement of the methods presented and hope the work will encourage discussions on observing and addressing changes across a broad spectrum of human needs during a global crisis.
\enlargethispage{\baselineskip}
\begin{acks}
We thank the reviewers and colleagues for their valuable feedback. This research was supported in part by NSF grant IIS-1901386, Bill \& Melinda Gates Foundation (INV-004841), and the Allen Institute for Artificial Intelligence.
\end{acks}
\section{Online Appendix}
\subsection{Analyzing National Representation}\label{app:datademographics}
To understand how much of the US population is represented by the collected data, we obtained demographics data from the Census Reporter API~\cite{census_reporter} for ZIP codes represented in our dataset.
Census Reporter API provides demographics data for 32,989 US ZIP codes, and not all of the ZIP codes in our dataset have available demographics information through this service.
Between our dataset and the demographics data, we have 96.4\% overlap of ZIP codes, representing 97.5\% of total queries in our dataset.
Table~\ref{tab:suppdemographic} summarizes the median of the select 11 demographic variables for ZIP codes in our dataset in comparison to all available ZIP codes in Census Reporter. Given 96.4\% overlap, we find that the ZIP codes in our dataset closely mirrors the US population.
Although query volumes are not uniformly distributed across these ZIP codes, the vast majority of US ZIP codes is included in our dataset.
\suppdemographic
\subsection{Analyzing Selection Bias}\label{app:clientrate}
We sought to understand potential biases in socioeconomic circumstances that would influence the usage of Bing search engine.
We leveraged deidentified client id as a proxy for a unique user to estimate the `client rate', or how much of the population in a ZIP code is using the Bing search engine.
We examined the correlation between the client rate and various demographic factors at the ZIP code level (e.g., income, race, age, gender, education, housing, internet access).
Although unsurprisingly the factors describe some of the variance, none were correlated more strongly than $r$=-0.058 (\% Housing Owned).
Table~\ref{tab:suppdemcorr} summarizes Pearson correlation statistics.
These results suggest that our dataset is not strongly biased towards any single demographic.
\suppdemcorr
\subsection{Reliability of Search Interaction Trends}\label{app:googletrends}
Although our analysis relies solely on Bing search data, many Americans use other search engines such as Google.
Therefore, we compared search trends for Bing with data available via the Google Trends API\footnote{\url{https://trends.google.com/}} for the same time period and a subset of keywords.
We chose to use select keywords from each need category, rather than applying our needs aggregation pipeline (described in Sec.~\ref{method:processing}), because the Google Trends public API does not support regular expressions or access to the click interactions.
We chose 9 keywords that were representative of their respective need subcategory (i.e., `online learning' captures \emph{online education queries}), had a significantly larger query volume compared to other keywords in the need categories (i.e., `hand sanitizer' had more query volume than `mask'), or may have a seasonal effect (i.e., query volume for `tax' could depend on the tax season).
We conducted a correlation analysis on a moving average of a full week to account for timezone differences between the two data sources.
Visual inspection of both Google and Bing trends confirm that search patterns across these two search engines are remarkably similar (Fig.~\ref{fig:binggoogle}), and Pearson correlation coefficients are very high with a median of 0.96 (min=0.45, max=0.98, all $p$<0.001).
Table~\ref{tab:suppbinggooglecorr} summarizes Pearson correlation outputs.
These results imply that our findings are not simply an artifact of using one search engine over another.
\suppbinggoogle
\suppbinggooglecorr
\subsection{Human Needs Categories and Detection}\label{app:needs}
We draw inspiration from Maslow's hierarchy of fundamental human needs \cite{maslow1943theory,maslow1970new} to tag each search interaction. Of the eight top-level human needs from Maslow's expanded hierarchy of needs, we omit \emph{Esteem}, \emph{Aesthetics}, and \emph{Transcendence} because they are difficult to operationalize from observational data alone.
We categorize search behaviors into one or more of five broad categories of needs. \emph{Safety} and \emph{Physiological} are considered as `basic' needs. \emph{Love and Belonging}, \emph{Cognitive}, and \emph{Self Actualization} are often considered to be `psychological' needs, and \emph{Cognitive} and \emph{Self Actualization} are considered as `growth' needs.
We obtain further granularity of the 5 human need categories by decomposing each need category into many sub-need categories.
This extra level of granularity has advantages in teasing apart the specific aspects of the need (e.g., shelter vs. finances in \emph{Safety} needs) and in debugging and refining the detection logic. Table~\ref{tab:suppsubneeds} enumerates 79 sub-needs and their examples.
For each need subcategory, we had multiple regular expressions applied to either the query string, the clicked URL, or both. This is noted in Table~\ref{tab:suppsubneeds} under the `Logic' column. `Keyword and domain (KD)' logic indicates that there is one regular expression for matching query strings and another regular expression for matching clicked URLs. Both must be matched for the search interaction to be categorized as that need. `Queries (Q)' logic indicates that there is one regular expression for query strings alone regardless of the clicked URLs. `Domains (D)' logic indicates that there is one regular expression for clicked URLs regardless of the query strings. A full table of regular expressions used in the data collection is provided in a separate supplementary file and can be cross-referenced through the `Need Id' column\footnote{\url{https://github.com/jinasuh/pandemic_needs}}.
There were several steps in arriving at these subcategories and regular expressions.
We first identified a set of e-commerce websites (1) from market research blog posts and reports that were publicly available online and (2) from enumerating top 100 URL hosts from a sample of search interactions that were tagged as purchase or commerce related using built-in classifiers in Bing.
We combined these two data sources to manually curate a list of 61 e-commerce domains.
Next, we collected another sample of query strings that led to subsequent clicks to these e-commerce domains as well as page snippets that were displayed on the search result page.
Using the Latent Dirichlet Allocation module in gensim, a popular topic modeling tool in python, we trained an unsupervised topic model on the query strings and the associated page snippets for 100, 500, and 1000 topics on 100,000 unigrams.
We manually inspected the keywords in the topics to curate 22 topics of over 800 keywords.
We also extracted frequent bigrams from the same dataset to expand our keywords if existing unigrams were too ambiguous.
These topics represented purchase categories because they were collected from search interactions with subsequent clicks to e-commerce websites.
Our next step was to categorize these topics into five main need categories.
We used a hybrid card sorting method~\cite{albert2013measuring} with 5 participants who merged, split, edited, or created these topics into need subcategories. Then these need subcategories were then placed into the 5 main need categories.
Using the outputs from the card sorting activity as a basis, we further brainstormed subcategories beyond purchase categories.
Several researchers independently brainstormed and categorized subcategories which were combined and resolved collaboratively through consensus meetings.
We referred to the definitions presented in the theories of human needs to resolve any remaining disagreements~\cite{maslow1943theory}.
Once the need categories and subcategories were identified, we leveraged keywords and domains from manually curated topics and card sort outputs.
We also obtained a list of topical domains from publicly available blog posts and articles summarizing recommended websites (e.g., search for best parenting website) or manually curated a list of domains (e.g., search for unemployment benefit page for each state).
Again, we independently brainstormed and curated lists of keywords, keyword patterns, and domains for each subcategory and collaboratively iterated on the lists through consensus meetings.
These keywords, keyword patterns, and domain URLs were combined into many regular expressions that we used to tag each search interaction.
We validated our detection logic by collecting human labels from Amazon's Mechanical Turk, and our evaluation set achieved a precision of 97.2\%, as described in detail in Sec.~\ref{sec:validation}.
A screenshot of an example task seen by a crowd worker is shown in Fig.~\ref{fig:suppmturktask}, and the full set of detailed task instructions can be found at the end of this Appendix.
\suppsubneeds
\suppfigmturktask
\newpage
\subsection{Significant Changes in Human Needs}\label{app:subneeds}
\suppfigsubneeds
\newpage
\includepdf[pages=-]{figures/Supp-Mturk-Instructions-Doc.pdf}
| {'timestamp': '2021-01-15T02:22:44', 'yymm': '2008', 'arxiv_id': '2008.07045', 'language': 'en', 'url': 'https://arxiv.org/abs/2008.07045'} | arxiv |
\section{Introduction}
Interpretable Representations (IRs) are the foundation of many explainability methods for black-box Machine Learning (ML)~\cite{friedman2008predictive,ribeiro2016why,lundberg2017unified}. %
They facilitate translating the ``language'' of ML models -- such as raw feature values and their complex embeddings -- into concepts that are intelligible and relatable for humans. %
IRs create an \emph{interface} between a computer-readable encoding of a phenomenon (collected data) and cognitively digestible chunks of information. %
By personalising an IR we can adjust the complexity of the resulting explanations and tune them towards a particular \emph{audience}, making the underlying explainer more versatile and appealing.%
An IR of images, for example, can be created with super-pixel segmentation, i.e., partitioning images into non-overlapping \emph{segments}, each one representing an object of interest or pieces thereof. %
Similarly, text can be split into \emph{tokens} denoting individual words, their stems or collections of words, which are not necessarily adjacent. %
Tabular data containing numerical features can be discretised to capture meaningful patterns, e.g., people in different age groups. %
In particular, these representation changes facilitate explainability of sensory data and allow retrofitting explainers into pre-existing black-box ML models~\cite{ribeiro2016why}.%
An interpretable representation, however, is just one of many components needed to build explainability algorithms. %
Given high complexity of such end-to-end explainers, many of them opt for generic (thus versatile) IRs, focusing on the overall performance of the explainers and not delving into selection and optimisation of their individual components. %
Understandably, these explainers seek to automate the whole process, which requires IRs that can be generated without human guidance, thereby enabling their creation and evaluation at scale. %
Such examples are quantile discretisation for numerical features of tabular data, edge-based super-pixel segmentation for images (e.g., quick shift~\cite{vedaldi2008quick}), and whitespace-based tokenisation for text. %
This design choice can be easily justified since creating an IR that is intelligible and meaningful is often user- and application-dependant or even unique to the explained data point, therefore scaling it up is impractical without a concrete deployment use case. %
However, the core premise of interpretable representations is encoding concepts that are \emph{meaningful} to the target audience, thus relying upon computer-generated IRs without understanding their behaviour and properties may be counterproductive.%
Interpretable representations are often paired with a simple and inherently transparent model to form a surrogate explainer such as Local Interpretable Model-agnostic Explanations (LIME~\cite{ribeiro2016why}). %
These explainers are very attractive since they are post-hoc, model-agnostic and -- due to the use of IRs -- compatible with any data type. %
Their versatility, however, comes at a cost: they are complex entities suffering from overparameterisation, which often manifests itself in multiple contributing sources of randomness and low fidelity of the resulting explanations~\cite{zhang2019should,rudin2019stop,lakkaraju2019faithful,lakkaraju2020fool}. %
Some of these deficiencies can be attributed to a misuse of the interpretable representation, which can make or break an explainer~\cite{sokol2019blimey}. %
These problems can be magnified, or even render the explainer unusable, by certain pairings of interpretable representations and surrogate model types, especially when the implicit assumptions behind both of these components are at odds. %
This area of research is vastly under-explored for IRs on their own and as a part of an explainer, potentially leading to sub-optimal design choices and inadequate explanations.%
Explainee-driven interactive personalisation of IRs is an interesting avenue of research in this direction on the crossroads of interpretable ML and Human--Computer Interaction~\cite{sokol2020one}. %
It has the potential to formulate guidelines for the design and operationalisation of IRs for individual applications, but such a solution comes at the expense of a user-in-the-loop architecture that cannot be automated and scaled. %
A more impactful research direction, which we focus on in this paper, is \emph{automatic} creation of IRs that encode (computationally) meaningful concepts. %
Notably, an interpretable representation defines the question that the explanation answers and restricts the types of explanation that can meaningfully communicate this information, e.g., importance of interpretable concepts, counterfactuals or what-if statements. %
By understanding characteristics and behaviour of each interpretable representation and its influence on the resulting explanation -- both on its own and in conjunction with a particular type of a surrogate model -- we can uncover the theoretical properties of such explainers and assess their applicability and usefulness for a problem at hand.%
However, the important task of choosing an appropriate interpretable representation is often overlooked in the literature. %
It is common to assume that an IR is given or to reuse one that was introduced in prior work without much afterthought or deliberation on its suitability, (often implicit) assumptions, properties and caveats~\cite{laugel2018defining,zhang2019should,lakkaraju2020fool}. %
These approaches result in a uniform landscape of IRs, where the dominating objective is to understand \emph{how important} a particular interpretable component is for a black-box prediction. %
Nonetheless, this type of explainability-driven sensitivity analysis comes with many unaddressed issues. %
For example, to discern how a particular interpretable component influences a black-box prediction, it needs to be ``removed'' and the resulting change in the model's prediction quantified. %
Most black-box models, however, cannot predict incomplete instances, especially for tabular and image data, in which case this procedure becomes ill-defined and replaced with a proxy -- such as segment occlusion for images -- leading to biased and untrustworthy explanations.%
In this paper, we investigate capabilities and limitations of the most common type of interpretable representations -- where presence and absence of interpretable concepts is encoded with a binary vector -- for images and text in Section~\ref{sec:ir}, and tabular data in Section~\ref{sec:ir:tab}. %
Our findings are a stepping stone towards building custom IRs that can be generated automatically while still representing (computationally) meaningful concepts. %
Among others, we discuss an implicit assumption of the \emph{explanation locality} that is detrimental to its completeness, and a \emph{non-bijective transformation} between the original and interpretable domains that introduces unnecessary randomness, thereby reducing fidelity and soundness of resulting explanations~\cite{sokol2019blimey,sokol2020explainability}. %
Moreover, we investigate implicit assumptions and consequences of using proxies when it is impossible to remove information from data as imposed by the IR. %
We support our claims with a range of experimental results -- presented in Appendix~\ref{sec:appendix:img} -- which illustrate how such proxies may results in \emph{volatile explanations} that are easily influenced by the segmentation granularity and occlusion colour for images.%
Furthermore, in Section~\ref{sec:modelling} we examine how the choice of a surrogate model influences the resulting explanations in view of the properties and limitations of the underlying IR. %
To this end, we analyse tabular data with numerical features in a surrogate explainer setting, where importance-based explanations are determined by the coefficients of a linear model. %
In particular, we illustrate limited explanatory capabilities of an interpretable representation built upon discretisation of continuous attributes when paired with Ordinary Least Squares (OLS), a detailed derivation of which is presented in Appendix~C. %
Such explainers lose precise encoding of the black-box decision boundary and can be manipulated by altering the distribution of the data sample used to train the OLS, which undermine reliability of the resulting explanations. %
As a solution, we propose using decision trees to both partition (discretise) the data space and generate explanations, e.g., with counterfactuals~\cite{waa2018contrastive} -- a recommendation that we support with an array of experimental results presented in Appendix~\ref{sec:appendix:tree}. %
Finally, we conclude our work and discuss future research directions in Section~\ref{sec:conclusion}.%
The choice of the IR and surrogate model for our analysis is motivated by the popularity of these particular approaches in the literature. %
Namely, LIME~\cite{ribeiro2016why} and RuleFit~\cite{friedman2008predictive} use a surrogate linear model to estimate importance of interpretable concepts. %
Additionally, LIME and SHapley Additive exPlanations (SHAP~\cite{lundberg2017unified}) employ an interpretable representation that encodes presence and absence of intelligible concepts to formulate their explanations. %
\citeay{friedman2008predictive}, on the other hand, experimented with automatically learning a more complex IR by training a random forest and extracting rules from therein. %
These logical rules, which express various concepts, are then used as binary features for training a linear model, thus improving the expressiveness of the interpretable representation. %
More recently, \citeay{garreau2020explaining} analysed theoretical properties and parameterisation of vanilla LIME for tabular data, including its interpretable representation and surrogate linear model, however their work treated the explainer as an end-to-end algorithm and operated under quite restrictive assumptions, e.g., linearity of the black-box model.%
\section{Sensory Interpretable Representations\label{sec:ir}}%
The operationalisation of interpretable representations vary for different data types -- tabular, image and text -- but their machine representation is usually consistent: a binary vector indicating presence (\(1\)) or absence (\(0\)) of certain human-understandable concepts for a selected data point. %
To this end, tabular data with numerical features are discretised, creating a hyper-rectangle partition of the space. %
The binary interpretable representation is unique to each hyper-rectangle, hence one of them has to be selected as the explanation target. %
The binary IR of an arbitrary data point is then computed by juxtaposing the discrete encoding of the hyper-rectangle it belongs to against the explained hyper-rectangle. %
This operation results in a binary on/off vector that for each discrete dimension indicates whether the selected data point lies in the same partition as the explained hyper-rectangle or not -- see Section~\ref{sec:ir:tab} for more details.%
The interpretable representations of image and text data, on the other hand, come more naturally and share many properties. %
Images are partitioned into non-overlapping segments called super-pixels, which are then represented in the interpretable binary space as either present or absent. %
Similarly, text is split into tokens that can encode individual words, their stems or collections of words, which presence or absence is encoded in the IR. %
These two interpretable representations are relatively easy to generate automatically and, when configured correctly, encode (computationally) meaningful concepts. %
High-dimensionality of raw data does not affect their comprehensibility, which is the case with tabular data where we are generally confined to three dimensions given the inherent spatio-temporal limitations of our visual system. %
Moreover, dimensionality reduction for images and text is unnecessary or even harmful: removing super-pixels from images is an ill-defined procedure and would results in ``holes'', whereas for text it can be used to discard stop words and punctuation, but such pruning is often incorporated into the preceding tokenisation step.%
\subsection{Text}%
The interpretable domain based on presence and absence of tokens in text is very natural and appealing to humans. %
Individual words and their groups encode understandable concepts and their absence may alter the meaning of a sentence, which reflects how humans comprehend text. %
A na\"ive IR can represent text as a bag-of-words, where each word becomes a token, thereby forfeiting the influence of word ordering and the information carried by their co-appearance. %
We can easily improve upon that and capture the dependencies between words by including \(n\)-gram groupings. %
Applying other pre-processing steps, e.g., extracting word stems, can also be beneficial for the human-comprehensibility of such interpretable representations. %
Machine processing of text is a well-established research field~\cite{manning1999foundations}, providing plenty of inspiration for designing appealing IRs.%
Once text is pre-processed and tokenised, it is \emph{deterministically} transformed into the binary interpretable representation. %
To this end, a sentence is encoded as a Boolean vector of length equal to the number of tokens in the IR, where \(1\) indicates presence of a given token and \(0\) its absence, meaning that the original sentence is encoded with an all-\(1\) vector. %
By flipping some components of this vector to \(0\), we effectively remove tokens from this sentence and create its variations. %
Notably, high dimensionality of this representation does not undermine the comprehensibility of the resulting explanations since altered text cannot have more tokens than the original sentence. %
Explanations based on token importance can be overlaid on top of text by highlighting each token with a different shade of green (positive influence) or red (negative influence) given their respective importance for the explained class -- see Figure~\ref{fig:text_ex} for an example.%
\begin{figure}[bt]
\centering
\begin{subfigure}[t]{0.23\textwidth}
\centering
\parbox[b][\textwidth][c]{\textwidth}{
\noindent\begin{flushleft}\mylib{\(f_0\)}{white}{\Large This} \mylib{\(f_1\)}{green}{\Large sentence} \mylib{\(f_2\)}{white}{\Large has} \mylib{\(f_3\)}{white}{\Large a} \mylib{\(f_4\)}{green}{\Large positive} \mylib{\(f_5\)}{red}{\Large sentiment} \mylib{\(f_6\)}{white}{\Large ,} \mylib{\(f_7\)}{red}{\Large maybe} \mylib{\(f_8\)}{white}{\Large .}\end{flushleft}%
}
\caption{Words are the components of the interpretable representation.\label{fig:text_ex:1}}
\end{subfigure}
\hfill
\begin{subfigure}[t]{0.23\textwidth}
\centering
\includegraphics[width=\textwidth]{fig/bars.pdf}
\caption{Explanation shows influence of the interpretable components.\label{fig:text_ex:2}}%
\end{subfigure}
\caption{Example of an importance-based explanation of text with a \emph{bag-of-words} interpretable representation. Panel (\subref{fig:text_ex:1}) illustrates a sentence whose (positive) \emph{sentiment} is being decided by a black-box model. The colouring of each word in panel (\subref{fig:text_ex:1}) conveys its influence on the prediction, with panel (\subref{fig:text_ex:2}) depicting their magnitudes.\label{fig:text_ex}}%
\end{figure}
\subsection{Images\label{sec:ir:images}}%
The interpretable representation of image data operates similarly -- see Figure~\ref{fig:blimey_lime}. %
Images are algorithmically segmented into super-pixels, often using edge-based methods~\cite{ribeiro2016why} such as quick shift~\cite{vedaldi2008quick}, but the resulting partition may not convey (cognitively) meaningful concepts from a human perspective. %
\emph{Semantic segmentation} or outsourcing this task to the user usually yields better results~\cite{sokol2020limetree,sokol2020one}. %
Next, the segments are represented as a binary vector indicating presence (\(1\)) or absence (\(0\)) of information in each super-pixel, where an all-\(1\) vector corresponds to the original image. %
However, removing a super-pixel from an image when setting one of the interpretable components to \(0\) is an ill-defined procedure. %
The most appealing and semantically-meaningful solution would be to ``remove'' the content of a segment by occluding it with another object, akin to Benchmarking Attribution Methods (BAM~\cite{yang2019bam}), or retouching it in a context-aware manner, e.g., with what is anticipated in the background, thus preserving the colour continuity of the image. %
Both of these approaches are intuitive, but they are difficult to automate and scale since they are mostly limited to image partitions where each super-pixel represents a self-contained and semantically-coherent object.%
\begin{figure}[bth]
\centering
\begin{subfigure}[t]{0.23\textwidth}
\centering
\includegraphics[width=\textwidth]{fig/husky_mask.jpeg}
\caption{Image segments are the components of the interpretable representation.\label{fig:blimey_lime:ir}}
\end{subfigure}
\hfill
\begin{subfigure}[t]{0.23\textwidth}
\centering
\includegraphics[width=\textwidth]{fig/bars_img.pdf}%
\caption{Explanation shows influence of the IR components on \emph{Eskimo dog} prediction.\label{fig:blimey_lime:bars}}
\end{subfigure}
\caption{Example of an importance-based explanation of image data with the interpretable representation built upon \emph{segmentation}. Panel (\subref{fig:blimey_lime:ir}) illustrates an image that is being classified by a black-box model. The colouring of each super-pixel in panel (\subref{fig:blimey_lime:ir}) conveys its influence on the prediction, with panel (\subref{fig:blimey_lime:bars}) depicting their magnitudes.\label{fig:blimey_lime}}%
\end{figure}
Instead, a computationally-feasible proxy is commonly used to hide the information carried by the super-pixels: segments are occluded with a solid colour. %
However, this approach comes with its own implicit assumptions and limitations, which are often ovelooked. %
For example, LIME uses the mean colour of each segment to mask its content~\cite{ribeiro2016why} -- see Figure~\ref{fig:husky_patchwork_mean} -- which for some segmentation and colour distribution of an image may undermine the utility of the occlusion procedure. %
With this approach, segments that have a relatively uniform colour gamut may, effectively, be impossible to occlude; this is especially common for segments that are in the background or out of focus, e.g., bokeh and depth-of-field effects. %
Furthermore, whenever the segmentation coincides with objects' edges or regions of an image where colour continuity is not preserved, which is common for edge-based segmenters, occluding super-pixels with their mean colour causes (slight) colour variations between adjacent segments. %
These artefacts preserve edges in a (partially) occluded image, and they often convey enough information for a black-box model to correctly recognise its class, for example see Figure~\ref{fig:husky_patchwork}. %
Segmentation granularity is also important: the smaller the segments are, the more likely it is that their colour composition is uniform given the ``continuity'' of images, i.e., high correlation of adjacent pixels, resulting in a similar effect as above.%
Since most of these issues are consequences of using the mean-colour occlusion, it may seem that fixing a single masking colour for all of the segments would eradicate some of these problems. %
Such an approach hides the edges between occluded super-pixels and removes their content instead of just ``blurring'' the image, however the edges between occluded and preserved segments remain visible. %
Moreover, the choice of the masking colour may impact the explanations themselves regardless of the colouring strategy. %
This particular type of a proxy for removing information from image segments implicitly assumes that the black-box model is \emph{neutral} with respect to the occlusion colour, i.e., none of the modelled classes is biased towards it. %
Adjusting the granularity of the segmentation also plays an important role given high correlation of adjacent super-pixels. %
We support these observations with a range of experiments done for occlusion-based interpretable representations of images, the results of which are presented in Appendix~\ref{sec:appendix:img}. %
In particular, they exemplify the degree to which the segmentation granularity as well as the occlusion strategy and colour affect the resulting explanations.%
\subsection{Discussion\label{sec:ir:discussion}}%
The interpretable representations of image and text data discussed above are \emph{implicitly local} -- they are only valid for the data point (sentence or image) for which they were created. %
Another, often overlooked, property that they share is \emph{bijectiveness} of the transformation (within the scope of a single instance): there is one-to-one correspondence between a data point and its interpretable representation and a uniquely defined inverse transformation from the interpretable to the original data domain, assuming that the image occlusion strategy (colour) and text pre-processing are fixed~\cite{sokol2019blimey}. %
This property helps to guarantee uniqueness of explanations, which is very important for their stability, hence preserving explainees' trust~\cite{rudin2019stop,sokol2020explainability}. %
Transforming between the two domains seamlessly only requires memorising the structure or skeleton of the explained data point: adjacency of segments and their original pixel values for images, and order of tokens and their pre-processing for text. %
Out of the two IRs, the one for text has the advantage of allowing the tokens to be \emph{truly} removed from a sentence, however this is more of a property of the underlying predictive model rather than the IR itself -- text classifiers are more flexible and do not assume input of a fixed length, while vision models cannot handle ``missing'' pixels.%
\begin{figure}[bt]
\centering
\begin{subfigure}[t]{0.23\textwidth}
\centering
\includegraphics[width=\textwidth]{fig/husky_but_one.jpeg}
\caption{Mean-colour occlusion.\label{fig:husky_patchwork_mean}}
\end{subfigure}
\hfill
\begin{subfigure}[t]{0.23\textwidth}
\centering
\includegraphics[width=\textwidth]{fig/husky_but_one_bk.jpeg}
\caption{Black occlusion.\label{fig:husky_patchwork_bk}}
\end{subfigure}
\caption{Image occlusion strategy influences the resulting explanations (see Appendix~\ref{sec:appendix:img}). The picture shown in Figure~\ref{fig:blimey_lime:ir} is classified by a black box as \emph{Eskimo dog} with 83\% probability. Mean-colour occlusion of all the segments but one (\subref{fig:husky_patchwork_mean}) results in 77\% and black occlusion (\subref{fig:husky_patchwork_bk}) in 9\% probability of the same class, showing that the former approach cannot effectively remove information from this particular image.\label{fig:husky_patchwork}}%
\end{figure}
\section{Tabular Interpretable Representations\label{sec:ir:tab}}%
In contrast to raw pixel values and word embeddings, tabular data do not require an interpretable representation to be explainable since their features are often human-comprehensible. %
However, if the explanation is to answer a specific question -- as was the case for images and text -- using an IR may be helpful. %
Continuing with the sensitivity analysis setting, for tabular data we are interested in how presence and absence of certain \emph{binary} concepts, which the explained data point exhibits, influence its prediction. %
One approach is to treat the specific feature values of the explained instance as concepts: if a feature value of a data point is identical to the value of the same feature for the explained instance, the concept is \emph{present} (\(1\)), otherwise it is \emph{absent} (\(0\)). %
While appealing for categorical features, considering each and every unique value of a numerical attribute is counter-intuitive given their inherent continuity. %
Moreover, doing so may not reflect the underlying human thought process, e.g., ``high sugar content'' in contrast to ``70g of sugar per 100g of a product'', with both 0g and 100g in the latter case encoded as an \emph{absent} concept in the corresponding IR. %
Building up on this observation, a natural extension of such an interpretable representation is to consider discretisation of numerical features as interpretable concepts: if a feature value of a data point is within the same range as the value of the same attribute for the explained instance, the concept is \emph{present} (\(1\)), otherwise it is \emph{absent} (\(0\)).%
\subsection{Interpretable Representation via Discretisation}%
Interpretable representations of tabular data are generated by preserving categorical features and discretising numerical attributes into ``categorical'' bins, e.g., \(x_2 < 5\), \(5 \leq x_2 < 7\) and \(7 \leq x_2\). %
Next, the binary on/off representation is computed based on the data point selected to be explained, which facilitates expressing importance of each interpretable concept in relation to the black-box prediction of this instance. %
Since a binary representation allows to encode only 2 events for each attribute, it commonly indicates a feature value belonging to the same (\(1\)) or different (\(0\)) numerical bin as the data point selected to be explained. %
For example, if the second feature \(x_2\) of the explained data point \(\mathring{x}\) is \(\mathring{x}_2 = 6.5\), based on the aforementioned bin boundaries, any instance \(x\) whose second attribute is within the \(5 \leq x_2 < 7\) range is assigned \(\hat{x}_2 = 1\) in the binary IR, and \(0\) otherwise. %
When paired with a linear surrogate model, this can be understood as investigating the importance of each feature value being within the specified range (the concept ``switched on'') for the black-box prediction of the selected data point, or more precisely \emph{any} instance situated within the same hyper-rectangle -- see Figure~\ref{fig:tab} for an example.%
Notably, this binary interpretable representation of tabular data is specific to the explained data point (more generally, its hyper-rectangle), as was the case for images and text. %
Nonetheless, for tabular data the underlying discretisation can be reused for explaining any instance from the same data set. %
While a common practice~\cite{ribeiro2016why}, such an approach undermines faithfulness of the resulting explanations -- the goal is to produce a \emph{local} explanation of the selected data point, hence the discretisation should be truthful within the explained neighbourhood. %
Neither globally nor locally faithful discretisation can capture uniqueness of a black-box decision boundary universally well for an arbitrary data subspace~\cite{sokol2019blimey}. %
Therefore, reusing the same discretisation to generate individual IRs for tabular data can be compared to creating a super-pixel partition of a specific image and reapplying it to other, unrelated images, resulting in a technically valid, yet conceptually meaningless interpretable representation. %
Finally, selecting the bin boundaries when discretising tabular data is non-trivial and biases the explanation akin to the influence of the segmentation granularity and occlusion colour on image explanations.%
\begin{figure}[bth]
\centering
\begin{subfigure}[t]{0.23\textwidth}
\centering
\includegraphics[width=\textwidth]{fig/tab_1.pdf}
\caption{Discretised and binarised numerical features become the components of the interpretable representation (\(x^\star\)).\label{fig:tab:ir}}
\end{subfigure}
\hfill
\begin{subfigure}[t]{0.23\textwidth}
\centering
\includegraphics[width=\textwidth]{fig/tab_2.pdf}
\caption{Explanation shows influence of IR components on predicting the \emph{grey} class for the \(\star\) instance and, more generally, the \(x^\star = (1, 1)\) hyper-rectangle.\label{fig:tab:bars}}%
\end{subfigure}
\caption{Example of an importance-based explanation of tabular data with the interpretable representation built upon \emph{discretisation} and \emph{binarisation}. Panel (\subref{fig:tab:ir}) illustrates an instance (red \(\star\)) that is being predicted by a black-box model. The dashed blue lines mark feature binning, grey and green dots denote two classes, and \(x^\star\) encodes the binary IR created for the \(\star\) data point. Panel (\subref{fig:tab:bars}) depicts the magnitude of the influence that \(x_1^\star: 75 \leq x_1\) and \(x_2^\star: 40 < x_2 \leq 80\) have on predicting the \emph{grey} class for the \(\star\) instance (as well as any other data point located within the same hyper-rectangle).\label{fig:tab}}%
\end{figure}
\subsection{Faithfulness\label{sec:ir:tab:faithfulness}}
The two factors that determine quality and faithfulness of a binary interpretable representation of tabular data are the \emph{data point} selected to be explained -- which specifies the reference hyper-rectangle -- and the ability of the \emph{discretisation} algorithm to locally approximate the black-box decision boundary. %
However, only the latter is controlled algorithmically and can either be explicitly \textbf{global}, i.e., learnt with respect to a whole data set, or \textbf{local}, thus focusing on a specific neighbourhood. %
Furthermore, each one can either observe just the \emph{data distribution}, or additionally take into account their \emph{black-box predictions}, presenting us with two distinct approaches:%
\begin{description}
\item[distribution-aware] discretisation -- Figure~\ref{fig:tabular_ir:dist} -- is based on the density of data in the local or global region chosen to be explained, e.g., quantile discretisaton; and%
\item[class-aware] discretisation -- Figure~\ref{fig:tabular_ir:class} -- partitions data according to a black-box decision boundary confined within the local or global region chosen to be explained.%
\end{description}
\begin{figure*}[tbh]
\centering
\begin{minipage}[t]{.65\textwidth}
\centering
\begin{subfigure}[t]{0.49\textwidth} %
\centering
\includegraphics[width=\textwidth]{fig/3_1.pdf}
\caption{\emph{Distribution}-aware discretisation.\label{fig:tabular_ir:dist}}%
\end{subfigure}
\hfill
\begin{subfigure}[t]{0.49\textwidth} %
\centering
\includegraphics[width=\textwidth]{fig/3_2.pdf}
\caption{\emph{Class}-aware (predictions) discretisation.\label{fig:tabular_ir:class}}%
\end{subfigure}
\caption{Discretisation is the main building block of interpretable representations of tabular data. It can either be learnt based on data features alone -- panel~(\subref{fig:tabular_ir:dist}) -- or additionally consider their black-box predictions (background shading) -- panel~(\subref{fig:tabular_ir:class}).\label{fig:tabular_ir}}%
\end{minipage}
\hfill
\begin{minipage}[t]{0.34\textwidth}
\centering
\includegraphics[width=.63\textwidth]{fig/4_2.pdf} %
\vspace{-.4em}
\caption{Some hyper-rectangles -- created with discretisation -- become indistinguishable in the binary interpretable representation of tabular data. The \(\star\) indicates the explained instance and the background shading marks unique binary encodings.\label{fig:tabular_binary_ir}}%
\end{minipage}
\end{figure*}
Since the predominant role of local surrogate explanations is to approximate and simplify the behaviour of a black box near a selected instance, the latter type should be preferred. %
It is a stepping stone towards representing human-intelligible concepts that are coherent with predictions of the underlying model, thus producing faithful and appealing insights. %
However, to the best of our knowledge, class-aware discretisation approaches are absent in the explainable AI literature. %
Computationally, their objective can be expressed as maximising the \emph{purity} or \emph{uniformity} of each hyper-rectangle with respect to the black-box predictions of data that it encloses -- this applies to both probabilistic and crisp models. %
This observation suggests that \textbf{learning interpretable representations with decision trees} -- specifically, the data space partitions that they create -- is an algorithmically sound approach to optimising the aforementioned objective, which we shown experimentally in Appendix~\ref{sec:appendix:tree}. %
While tree training procedures tend to be greedy, alternatives that consider multiple features at any given iteration could improve the quality of the resulting IRs even further.%
\subsection{Information Loss and Removal}
The intermediate discrete representation of a tabular IR uniquely encodes each hyper-rectangle -- see the \((x^\prime, y^\prime)\) coordinates in Figure~\ref{fig:tabular_binary_ir}. %
However, the same is not true for the \emph{binary} interpretable representation if any categorical feature has more than two unique values or any numerical attribute is partitioned into more than two intervals. %
In such cases, the transformation between these two representations loses information as depicted by the background shading and the \((x^\star, y^\star)\) coordinates in Figure~\ref{fig:tabular_binary_ir}. %
For each of these binary features, \(1\) is assigned to the partition that contains the explained data point and \(0\) to all the other intervals, effectively making them indistinguishable. %
Similarly, information is lost when transitioning from the original data representation into their discretised form: each hyper-rectangle, which has unique coordinates in this domain, contains multiple data points that become indistinguishable -- see Figure~\ref{fig:tabular_ir} for reference. %
These two many-to-one transformations, which are needed to create an interpretable representation of tabular data, contribute to non-bijectiveness discussed in the following section.%
The impossibility to distinguish data belonging to different hyper-rectangles in the binary interpretable representation is particularly detrimental to capturing the complexity of a black-box decision boundary. %
While the underlying discretisation may have closely approximated its intricacies, these can be lost when transitioning into the binary representation, especially if the decision boundary runs across hyper-rectangles that were merged in this process. %
For example, consider the discretisation shown in Figure~\ref{fig:tabular_ir:class} assuming that the explained instance resides in the \((x^\prime, y^\prime) = (1, 1)\) hyper-rectangle -- top row, second from the left. %
In the binary representation, the remaining top-row hyper-rectangles \((0, 1)\), \((2, 1)\) and \((3, 1)\) would be grouped -- akin to the process depicted by the background shading in Figure~\ref{fig:tabular_binary_ir} -- thus forfeiting the information that the first one belongs to the red class and the latter two to the green class.%
Furthermore, in contrast to text and comparably to image data, \emph{removing} information from the original representation by setting a member of the binary IR to \(0\) is infeasible and requires a proxy. %
Within our operationalisation of the interpretable representation of tabular data, switching off an interpretable concept is equivalent to placing the value of the corresponding numerical feature outside of the range encoded by this concept. %
Similarly, for categorical features this step is equivalent to choosing any other value not encoded by the corresponding interpretable concept. %
This procedure ensures diversity of data in the explained neighbourhood at a high price of introducing two sources of randomness when manipulating the IR.%
\subsection{Non-bijectiveness}
A direct consequence of the information loss is \emph{non-bi\-jec\-tive\-ness} of the interpretable representation transformation function, which increases volatility of the resulting explanations. %
Transitioning from an original into a discrete representation is a many-to-one operation if the underlying data set contains numerical features. %
Furthermore, transforming the discrete representation into a binary IR is also a many-to-one mapping if any discretised attribute has more than two unique values. %
Recall that surrogate explainers -- a big beneficiary of IRs -- sample data from the (binary) interpretable representation, which implicitly introduces locality of these data points and the resulting explanations. %
While reasonable for images and text, following the same procedure for a tabular IR entails reversing the binary sample back to the original domain, which requires \emph{random sampling} because of the forward transformation not being bijective~\cite{sokol2019blimey}. %
To this end, we first choose at random one of the concatenated hyper-rectangles if the binary component is \(0\) (\(1\)~uniquely identifies a hyper-rectangle); next, we sample a numerical value from the range defined by this hyper-rectangle, e.g., using a Gaussian distribution fitted to the (training) data enclosed by this hyper-rectangle (categorical features are uniquely identified by a hyper-rectangle).%
Image and text data require manipulating the binary IR since sampling from raw text or pixels is semantically an ill-defined procedure. %
However, tabular data can be sampled in their original representation, which allows for an algorithmic workaround of non-bijectiveness. %
Data drawn from the original domain can be easily transformed into a discrete representation and followed with binarisation. %
But moving in the opposite direction in a deterministic fashion requires memorising the matching between these points in different representations when executing the forward transformation -- this matching can be compared to storing segment adjacency for images or a sentence skeleton for text. %
By sampling in the original domain and binding different representations of each instance, we avoid using the ill-defined inverse IR transformation of tabular data, hence reduce randomness and improve stability of the resulting explanations. %
Nonetheless, this sampling strategy forfeits the implicit locality achieved by operating directly on the binary representation, therefore the substitute sampling algorithm should be \emph{explicitly local} to capture the explained subspace in detail~\cite{sokol2019blimey}.%
\section{Modelling Interpretable Representations\label{sec:modelling}}
Interpretable representations are commonly paired with linear models~\cite{friedman2008predictive,ribeiro2016why} to explain black-box predictions with concept importance, meaning that such explanations are subject to assumptions and limitations of these models. %
In particular, the coefficients of linear models can be deceiving when the target variable is \emph{non-linear} with respect to data features, the features are \emph{co-dependant} or \emph{correlated}, and the feature values are \emph{not normalised} to the same range~\cite{sokol2019blimey,sokol2020limetree}. %
Intuitively, the first two properties may not hold for high-level interpretable representations since their components are highly inter-dependent, e.g., adjacent image segments, neighbouring words and bordering hyper-rectangles, thus the resulting explanations can misrepresent the possible relations between these concepts. %
\citeay{friedman2008predictive} addressed some of these issues by using logical rules extracted from random forests as binary interpretable concepts, which they modelled with a linear predictor, however the overlap between these rules remains the culprit of the feature independence assumption.%
To overcome these limitations and facilitate explanations more diverse than importance of interpretable concepts, alternative surrogate models can be used~\cite{sokol2019blimey}. %
Logical models, such as \emph{decision trees}, are particularly appealing given that they provide a wide range of explanations and do not introduce any restrictions on the features, albeit they impose axis-parallel partition of the feature space~\cite{sokol2020limetree}. %
They are particularly suited for explaining tabular data, for which they alleviate the need for an independent interpretable representation as noted in Section~\ref{sec:ir:tab:faithfulness}. %
In particular, they can automatically learn a locally faithful, class-aware discretisation, with the added benefit of modelling combinations of hyper-rectangles and not suffering from information loss and non-bijectiveness~\cite{sokol2019blimey}.%
On the other hand, using linear models to capture concept importance of tabular data is particularly \textbf{flawed} when utilising the interpretable representation introduced in Section~\ref{sec:ir:tab}. %
The information loss suffered when transitioning from the discrete into the binary representation partially forfeits the preceding effort to faithfully capture the black-box decision boundary during the discretisation step. %
Appendix~C demonstrates this phenomenon with an analytical solution to OLS. %
Notably, it shows an unexpected influence of the number of data points sampled in each hyper-rectangle on the resulting explanations (concept importance magnitudes) and irrelevance of feature partitions other than the ones directly enclosing the explained instance.%
\section{Conclusions and Future Work\label{sec:conclusion}}%
Our findings show the importance of building semantically and computationally meaningful interpretable representations, and their role in defining the question answered by the resulting explanations. %
Among others, we demonstrated that generic algorithms for building IRs may be insufficient, and that the intended application domain and audience, as well as interactive customisation and personalisation, should be considered. %
In particular, we discussed a popular operationalisation of interpretable representations for image, text and tabular data, where they are used as binary indicators of presence and absence of interpretable concepts. %
This framework is then used in conjunction with surrogate models to quantify importance of such concepts for individual black-box predictions. %
In this setting, we identified challenges such as information removal proxies, parametrisation, faithfulness and bijectiveness -- which are particularly prominent for tabular data -- and showed how to overcome them. %
We also demonstrated the limitations of explaining binary interpretable representations of tabular data with linear models and suggested logical models as a viable alternative. %
Our future work will investigate algorithmic information removal proxies -- focusing on meaningful occlusion techniques for images -- and modelling interpretable representations with technologically-compatible approaches such as logical predictive models.%
\bibliographystyle{named}
| {'timestamp': '2020-08-18T02:20:49', 'yymm': '2008', 'arxiv_id': '2008.07007', 'language': 'en', 'url': 'https://arxiv.org/abs/2008.07007'} | arxiv |
\section{Introduction}
Continuous Engineering (CE) practices,
such as Continuous Integration (CI) and Continuous Deployment (CD),
are gaining prominence in software engineering,
as they help streamline and optimize the way software is built, tested and shipped.
The most salient advantage of CE is the tighter feedback loops:
CE practices help developers test and build their software more,
and makes software releases less brittle by enabling more incremental releases.
Nevertheless, a frequently reported barrier for success is the need to effectively analyze
the data that results from the numerous build and test
runs~\cite{Laukkanen2017,Hilton2017,Shahin2017,Debbiche2014,Olsson2012}.
One evident example of this is the handling and
analysis of results from complex end-to-end integration tests
which we focus on in this paper:
CE practices make it easier to run such end-to-end tests,
which include system integration and deployment to production hardware,
and they are critical for ensuring the quality of the end product.
However, since these end-to-end tests by their nature can fail for multiple
reasons, not least in the sense that new product code can make the tests
fail in new ways, it is critical to rapidly diagnose these failures.
In this paper we concern ourselves with how to rapidly analyze a set
of logs resulting from complex CE tasks\footnote{~For simplicity, and without loss of generality,
we will refer to these CE tasks as ``integration tests'' or ``tests'' throughout the paper,
though we acknowledge that they include more than just testing,
such as building the system and deploying it on hardware in a test or staging environment,
and failures can occur in any of these phases.
The proposed approach aims to cover all these situations,
and is evaluated on real-life logs capturing everything from building the system,
to deploying it on production hardware,
and running complex integration and interaction scenarios.}
where the overall outcome of the task (i.e. 'fail' or 'pass') is known,
but where analysts must consult the resulting logs to fully diagnose why the failures occurred.
Since these logs can get large and unwieldy, we
develop a tool that automatically suggests which segments in the logs
are most likely relevant for troubleshooting purposes.
Our method gives each event in the log an interestingness score based
on the overall event frequencies in the test result set: The log
events are in turn clustered based on these scores, and the event
clusters are presented to the user in decreasing order of overall
interestingness. The goal is to enable users to find all relevant
diagnostic information in the first presented event cluster, while having the
option of retrieving additional clusters if needed. An
additional benefit of our method is that the extracted events can help
identify commonly occurring patterns that are symptomatic for specific
errors. Future logs that exhibit the same characteristics can then be
automatically classified as having symptoms of that error.
\head{Contributions} We present Spectrum-Based Log Diagnosis (SBLD), a method for helping developers quickly find the
most relevant segments of a log. Using data from \CiscoNorway{an
industrial partner}, we empirically evaluate SBLD by investigating the following
three questions:
(i) How well does SBLD reduce the \emph{effort needed} to identify all \emph{failure-relevant events} in the log for a failing run?
(ii) How is the \emph{performance} of SBLD affected by \emph{available data}?
(iii) How does SBLD compare to searching for \emph{simple textual patterns} that often occur in failure-relevant events?
\head{Overview}
The rest of the paper is structured as follows: Section~\ref{sec:approach}
explains SBLD and the methodology underlying its event ranking
procedures. Sections~\ref{sec:rqs} and~\ref{sec:expdesign} motivates our research questions
and empirical design. We report and discuss our results in
Section~\ref{sec:resdiscuss}. Section~\ref{sec:relwork} surveys related work,
and we discuss threats to validity in Section~\ref{sec:ttv} before concluding
in Section~\ref{sec:conclusion}.
%
\section{Approach}
\label{sec:approach}
\begin{figure}[b]
\includegraphics[width=0.99\columnwidth]{overview.pdf}
\vspace*{-2ex}
\caption{A visual overview of our approach.}
\label{fig:approach}
\end{figure}
SBLD takes a set of log files from test failures, a set of log files from test successes, and a singular log file from a test failure called the \emph{target log} that the user wants analyzed and produces a list of segments from the target log file that are likely relevant for understanding why the corresponding test run failed.
In the following we explain the workings of SBLD in a stepwise
manner. At each step, we present the technical background needed to
understand how SBLD accomplishes its task. A visual overview of SBLD is
shown in Figure \ref{fig:approach}.
\head{Prerequisites}
First of all, SBLD requires access to a set of log files from failing test runs and a set of log files from successful test runs.
For brevity, we will refer to log files from failing test runs as 'failing logs',
and log files from successful test runs as 'passing logs'.%
\footnote{~Note that we explicitly assume that the outcome of each run is known;
This work is not concerned with determining whether the run was a failure or a success,
but rather with helping identify why the failing runs failed.}
We also require a programmatic way of segmenting each log file
into individually meaningful components. For the dataset used in this
paper these components are \emph{events} in the form of blocks of text
preceded by a date and a time-stamp in a predictable format. Lastly,
we require that run-time specific information such as timestamps,
dynamically generated IP addresses, check-sums and so on are removed
from the logs and replaced with standardized text. We refer to the process of
enforcing these requirements and delineating the log into events as
the \emph{abstraction} step. This enables SBLD to treat events
like ``2019-04-05 19:19:22.441 CEST: Alice calls Bob'' and ``2019-04-07
13:12:11.337 CEST: Alice calls Bob'' as two instances of the same
generic event "Alice calls Bob". The appropriate degree of abstraction
and how to meaningfully delineate a log will be context-dependent
and thus we require the user to perform these steps before using SBLD.
In the current paper we use an abstraction mechanism
and dataset generously provided by \CiscoNorway{our industrial partner}.
\renewcommand{\Ncf}{\ensuremath{\text{N}_\text{FI}}} %
\renewcommand{\Nuf}{\ensuremath{\text{N}_\text{FE}}} %
\renewcommand{\Ncs}{\ensuremath{\text{N}_\text{PI}}} %
\renewcommand{\Nus}{\ensuremath{\text{N}_\text{PE}}} %
\head{Computing coverage and event relevance} SBLD requires an assumption about what makes an event \emph{relevant}
and a method for computing this relevance. Our method takes inspiration
from Spectrum-Based Fault Localization (SBFL) in which the suspiciousness
or fault-proneness of a program statement is treated as a function of
the number of times the statement was activated in a failing test case,
combined with the number of times it is skipped in a passing test case~\cite{Jones2002,Abreu2007,Abreu2009}.
The four primitives that need to be computed are shown on the right-hand side in Table~\ref{table:measures}.
We treat each abstracted event as a statement and study their occurrences
in the logs like Fault Localization tracks the activation of statements in test cases.
We compute the analysis primitives by devising a binary
\emph{coverage matrix} whose columns represent every unique event
observed in the set of failing and successful logs while each row $r$
represents a log and tracks whether the event at column $c$ occurred in
log $r$ (1), or not (0), as shown in Figure~\ref{fig:approach}.
By computing these primitives, we can rank each event by using an
\emph{interestingness measure} (also referred to as ranking
metric, heuristic, or similarity coefficient~\cite{Wong2016}).
The choice of interestingness measure
is ultimately left to the user, as these are context dependent and
there is no generally optimal choice of interestingness measure~\cite{Yoo2014}.
In this paper we consider a
selection of nine interestingness measures prominent in the literature
and a simple metric that emphasizes the events that exclusively occur
in failing logs in the spirit of the \emph{union model} discussed
by Renieres et al.~\cite{renieres2003:fault}. We
report on the median performance of these interestingness measures with the intention of providing a
representative, yet unbiased, result. The ten measures considered are
precisely defined in Table~\ref{table:measures}.
\begin{table*}
\centering
\begin{tabular}{c@{\hspace{10mm}}c}
{\renewcommand{\arraystretch}{1.7} %
\begin{tabular}{lc}
\toprule
measure & formula \\\midrule
Tarantula \cite{Jones2001,Jones2002} & %
\( \frac{ \frac{ \cef{} }{ \cef{} + \cnf{} } }{ \frac{ \cef{} }{ \cef{} + \cnf{} } + \frac{ \cep{} }{ \cep{} + \cnp{} } } \)
\\
Jaccard \cite{Jaccard1912,Chen2002} & %
\( \frac{ \Ncf }{ \Ncf + \Nuf + \Ncs } \)
\\
Ochiai \cite{Ochiai1957,Abreu2006} & %
\( \frac{ \Ncf }{ \sqrt{ ( \cef + \cnf ) \times ( \cef + \cep ) } } \)
\\
Ochiai2 \cite{Ochiai1957, Naish2011} & %
\( \frac{ \Aef \times \Anp }{ \sqrt{ ( \Aef + \Aep ) \times ( \Anf + \Anp ) \times ( \Aef + \Anf) \times ( \Aep + \Anp ) } } \)
\\
Zoltar \cite{Gonzalez2007} & %
\( \frac{ \Ncf }{ \Ncf + \Nuf + \Ncs + \frac { 10000 \times \Nuf \times \Ncs }{ \Ncf } } \)
\\
D$^\star$ \cite{Wong2014} (we use $\star = 2$) & %
\( \frac{ (\cef)^\star }{ \cnf + \cep } \)
\\
O$^p$ \cite{Naish2011} & %
\( \Aef - \frac{ \Aep }{ \Aep + \Anp + 1} \)
\\
Wong3 \cite{Wong2007,Wong2010} &
\( \Aef - h, \text{where~} h = \left\{
\scalebox{.8}{\(\renewcommand{\arraystretch}{1} %
\begin{array}{@{}ll@{}}
\Aep & \text{if~} \Aep \leq 2 \\
2 + 0.1(\Aep - 2) & \text{if~} 2 < \Aep \leq 10 \\
2.8 + 0.001(\Aep - 10) & \text{if~} \Aep > 10 \\
\end{array}\)}
\right. \)
\\
Kulczynski2 \cite{Kulczynski1927,Naish2011} & %
\( \frac{ 1 }{ 2 } \times ( \frac{ \Aef }{ \Aef + \Anf } + \frac{ \Aef }{ \Aef + \Aep } ) \)
\\
Failed only & %
\( \left\{\scalebox{.8}{\(\renewcommand{\arraystretch}{1} %
\begin{array}{@{}ll@{}}
1 & \text{if~} \Ncs = 0 \\
0 & \text{otherwise~} \\
\end{array}\)}
\right. \)
\\
\bottomrule
\end{tabular}} &
\begin{tabular}{lp{2.99cm}}
\toprule
\multicolumn{2}{l}{notation used} \\\midrule
\Ncf & number of \emph{failing} logs \\ & that \emph{include} the event \\
\Nuf & number of \emph{failing} logs \\ & that \emph{exclude} the event \\
\Ncs & number of \emph{passing} logs \\ & that \emph{include} the event \\
\Nus & number of \emph{passing} logs \\ & that \emph{exclude} the event \\
\bottomrule
\end{tabular}
\end{tabular}\vspace*{1ex}
\caption{\label{table:measures}The 10 interestingness measures under consideration in this paper.}
\vspace*{-3ex}
\end{table*}
\head{Analyzing a target log file} Using our database of event scores,
we first identify the events occurring in the target log file and the
interestingness scores associated with these events. Then, we group
similarly scored events together using a clustering algorithm. Finally,
we present the best performing cluster of events to the end user. The
clustering step helps us make a meaningful selection of events rather
than setting an often arbitrary window selection size. Among other
things, it prevents two identically scored events from falling at
opposite sides of the selection threshold. If the user suspects that
the best performing cluster did not report all relevant events, she can
inspect additional event clusters in order of decreasing
aggregate interestingness score. To perform the clustering step we use Hierarchical Agglomerative
Clustering (HAC) with Complete linkage~\cite{manning2008introduction}, where
sub-clusters are merged until the maximal distance between members of
each candidate cluster exceeds some specified threshold. In SBLD,
this threshold is the uncorrected sample standard deviation of the event
scores for the events being clustered.\footnote{~Specifically,
we use the \texttt{numpy.std} procedure from the SciPy framework~\cite{2020SciPy-NMeth},
in which the uncorrected sample standard deviation is given by
$ \sqrt{\frac{1}{N} \sum_{i=1}^{N}\lvert x_{i} - \bar{x} \rvert^2} $ where
$\bar{x}$ is the sample mean of the interestingness scores obtained for the
events in the log being analyzed and $N$ is the number of events in the log.}
This ensures that the ``interestingness-distance'' between two events
in a cluster never exceeds the uncorrected sample standard deviation observed in the set.
%
\section{Research Questions}
\label{sec:rqs}
The goal of this paper is to present SBLD and help practitioners make
an informed decision whether SBLD meets their needs. To this end, we have identified
three research questions that encompass several concerns practitioners
are likely to have and that also are of interested to the research community at
large:
\begin{enumerate}[\bfseries RQ1]
\item How well does SBLD reduce the effort needed to identify all
known-to-be relevant events ("does it work?") ?
\item How is the efficacy of SBLD impacted by increased evidence in the form of
additional failing and passing logs ("how much data do we need before
running the analysis?") ?
\item How does SBLD perform compared to a strategy based on searching for
common textual patterns with a tool like \texttt{grep} ("is it better than doing the obvious thing?") ?
\end{enumerate}
RQ1 looks at the aggregated performance of SBLD to assess its viability.
With RQ2 we assess how sensitive the performance is to the amount of
available data: How many logs should you have before you can expect the
analysis to yield good results? Is more data unequivocally a good thing?
What type of log is more informative: A passing log or a failing log?
Finally, we compare SBLD's performance to a more traditional method for
finding relevant segments in logs: Using a textual search for strings
one expects to occur near informative segments, like
"failure" and "error". The next section details the dataset used, our
chosen quality measures for assessment and our methodology for answering
each research question.
%
\section{Experimental Design}
\label{sec:expdesign}
\begin{table}
\centering
\caption{The key per-test attributes of our dataset. Two events are considered
distinct if they are treated as separate events after the abstraction
step. A "mixed" event is an event that occurs in logs of both failing and
passing runs.}
\vspace*{-1ex}
\label{table:descriptive}
\renewcommand{\tabcolsep}{0.11cm}\small
\begin{tabular}{rcrrrrrr}
\toprule
& & \# fail & \# pass & distinct & fail-only & mixed & pass-only \\
test & signature & logs & logs & events & events & events & events \\
\midrule
1 & C & 24 & 100 & 36391 & 21870 & 207 & 14314 \\
2 & E & 11 & 25 & 380 & 79 & 100 & 201 \\
3 & E & 11 & 25 & 679 & 174 & 43 & 462 \\
4 & E & 4 & 25 & 227 & 49 & 39 & 139 \\
5 & C & 2 & 100 & 33420 & 2034 & 82 & 31304 \\
6 & C & 19 & 100 & 49155 & 15684 & 893 & 32578 \\
7 & C & 21 & 100 & 37316 & 17881 & 154 & 19281 \\
8 & C & 4 & 100 & 26614 & 3976 & 67 & 22571 \\
9 & C & 21 & 100 & 36828 & 19240 & 228 & 17360 \\
10 & C & 22 & 100 & 110479 & 19134 & 1135 & 90210 \\
11 & E & 5 & 25 & 586 & 95 & 47 & 444 \\
12 & E & 7 & 25 & 532 & 66 & 18 & 448 \\
13 & C & 2 & 100 & 15351 & 2048 & 232 & 13071 \\
14 & C & 3 & 100 & 16318 & 2991 & 237 & 13090 \\
15 & C & 26 & 100 & 60362 & 20964 & 1395 & 38003 \\
16 & C & 12 & 100 & 2206 & 159 & 112 & 1935 \\
17 & E & 8 & 25 & 271 & 58 & 98 & 115 \\
18 & A & 23 & 75 & 3209 & 570 & 156 & 2483 \\
19 & C & 13 & 100 & 36268 & 13544 & 411 & 22313 \\
20 & B & 3 & 19 & 688 & 69 & 31 & 588 \\
21 & B & 22 & 25 & 540 & 187 & 94 & 259 \\
22 & E & 1 & 25 & 276 & 11 & 13 & 252 \\
23 & C & 13 & 100 & 28395 & 13629 & 114 & 14652 \\
24 & E & 7 & 26 & 655 & 117 & 56 & 482 \\
25 & C & 21 & 100 & 44693 & 18461 & 543 & 25689 \\
26 & C & 21 & 100 & 42259 & 19434 & 408 & 22417 \\
27 & C & 21 & 100 & 44229 & 18115 & 396 & 25718 \\
28 & C & 20 & 100 & 43862 & 16922 & 642 & 26298 \\
29 & C & 28 & 100 & 54003 & 24216 & 1226 & 28561 \\
30 & C & 31 & 100 & 53482 & 26997 & 1063 & 25422 \\
31 & C & 27 & 100 & 53092 & 23283 & 463 & 29346 \\
32 & C & 21 & 100 & 55195 & 19817 & 768 & 34610 \\
33 & E & 9 & 25 & 291 & 70 & 30 & 191 \\
34 & D & 2 & 13 & 697 & 76 & 92 & 529 \\
35 & E & 9 & 25 & 479 & 141 & 47 & 291 \\
36 & E & 10 & 75 & 1026 & 137 & 68 & 821 \\
37 & E & 7 & 25 & 7165 & 1804 & 94 & 5267 \\
38 & E & 4 & 25 & 647 & 67 & 49 & 531 \\
39 & G & 47 & 333 & 3350 & 428 & 144 & 2778 \\
40 & G & 26 & 333 & 3599 & 240 & 157 & 3202 \\
41 & G & 26 & 332 & 4918 & 239 & 145 & 4534 \\
42 & C & 17 & 100 & 30411 & 14844 & 348 & 15219 \\
43 & F & 267 & 477 & 10002 & 3204 & 1519 & 5279 \\
44 & C & 9 & 100 & 29906 & 8260 & 274 & 21372 \\
45 & E & 3 & 25 & 380 & 44 & 43 & 293 \\
\bottomrule
\end{tabular}
\vspace*{-2ex}
\end{table}
%
\begin{table}
\centering
\caption{Ground-truth signatures and their occurrences in distinct events.}
\label{table:signature}
\vspace*{-1ex}
\small
\begin{tabular}{ccrrrc}
\toprule
& sub- & fail-only & pass-only & fail \& & failure \\
signature & pattern & events & events & pass & strings* \\
\midrule
A & 1 & 1 & 0 & 0 & yes \\
A & 2 & 2 & 0 & 0 & no \\
B & 1 & 2 & 0 & 0 & yes \\
C & 1 & 21 & 0 & 0 & yes \\
C & 2 & 21 & 0 & 0 & yes \\
D & 1 & 4 & 0 & 0 & yes \\
\textbf{D$^{\#}$} & \textbf{2} & 69 & 267 & 115 & no \\
\textbf{D$^{\#}$} & \textbf{3} & 2 & 10 & 13 & no \\
\textbf{E$^{\#}$} & \textbf{1} & 24 & 239 & 171 & no \\
E & 1 & 1 & 0 & 0 & no \\
E & 2 & 9 & 0 & 0 & no \\
E & 3 & 9 & 0 & 0 & yes \\
E & 4 & 23 & 0 & 0 & yes \\
F & 1 & 19 & 0 & 0 & yes \\
F & 2 & 19 & 0 & 0 & no \\
F & 3 & 19 & 0 & 0 & yes \\
F & 4 & 14 & 0 & 0 & yes \\
G & 1 & 2 & 0 & 0 & yes \\
G & 2 & 1 & 0 & 0 & no \\
G & 3 & 1 & 0 & 0 & no \\
\bottomrule
\multicolumn{6}{l}{* signature contains the lexical patterns 'error', 'fault' or 'fail*'}\\
\multicolumn{6}{l}{$^{\#}$ sub-patterns that were removed to ensure a clean ground truth}
\end{tabular}
\vspace*{-3ex}
\end{table}
\subsection{Dataset and ground truth}
\label{sec:dataset}
Our dataset provided by \CiscoNorway{our industrial partner} consists
of failing and passing log files from 45 different end-to-end integration
tests. In addition to the log text we also have data on when a given
log file was produced. Most test-sets span a time-period of 38 days, while
the largest set (test 43 in Table~\ref{table:descriptive}) spans 112
days. Each failing log is known to exemplify symptoms of one of seven
known errors, and \CiscoNorway{our industrial partner} has given us a
set of regular expressions that help determine which events are relevant
for a given known error. We refer to the set of regular expressions
that identify a known error as a \emph{signature} for that error. These
signatures help us construct a ground truth for our investigation.
Moreover, an important motivation for developing SBLD is to help create
signatures for novel problems: The events highlighted by SBLD should be
characteristic of the observed failure, and the textual contents of the
events can be used in new signature expressions.
Descriptive facts about our dataset is listed in
Table~\ref{table:descriptive} while Table~\ref{table:signature}
summarizes key insights about the signatures used.
Ideally, our ground truth should highlight exactly and \emph{only} the
log events that an end user would find relevant for troubleshooting
an error. However, the signatures used in this investigation were
designed to find sufficient evidence that the \emph{entire log} in
question belongs to a certain error class: the log might contain other
events that a human user would find equally relevant for diagnosing
a problem, but the signature in question might not encompass these
events. Nevertheless, the events that constitute sufficient evidence
for assigning the log to a given error class are presumably relevant
and should be presented as soon as possible to the end user. However,
if our method cannot differentiate between these signature events and
other events we cannot say anything certain about the relevance of
those other events. This fact is reflected in our choice of quality
measures, specifically in how we assess the precision of the approach. This
is explained in detail in the next section.
When producing the ground truth, we first ensured that a log would only be
associated with a signature if the entire log taken as a whole satisfied all
the sub-patterns of that signature. If so, we then determined which events
the patterns were matching on. These events constitute the known-to-be relevant
set of events for a given log. However, we identified some problems with two of the provided
signatures that made them unsuitable for assessing SBLD. Signature \emph{E}
(see Table~\ref{table:signature}) had a sub-pattern that searched for a "starting test"-prefix that necessarily
matches on the first event in all logs due to the structure of the logs.
Similarly, signature \emph{D} contained two sub-patterns that necessarily
match all logs in the set--in this case by searching for whether the test
was run on a given machine, which was true for all logs for the corresponding
test. We therefore elected to remove these sub-patterns from the signatures
before conducting the analysis.
\subsection{Quality Measures}
As a measure of how well SBLD reports all known-to-be relevant log
events, we measure \emph{recall in best cluster}, which we for brevity refer to
as simply \emph{recall}.
This is an adaption of the classic recall measure used in information retrieval,
which tracks the proportion of all relevant events that were retrieved
by the system~\cite{manning2008introduction}.
As our method presents events to the user in a series of ranked clusters,
we ideally want all known-to-be relevant events to appear in the highest ranked cluster.
We therefore track the overall recall obtained as if the first cluster were the only events retrieved.
Note, however, that SBLD ranks all clusters, and a user can retrieve additional clusters if desired.
We explore whether this could improve SBLD's performance on a
specific problematic test-set in Section~\ref{sec:testfourtythree}.
It is trivial to obtain a perfect recall by simply retrieving all events
in the log, but such a method would obviously be of little help to a user
who wants to reduce the effort needed to diagnose failures.
We therefore also track the \emph{effort reduction} (ER), defined as
\[ \text{ER} = 1 - \frac{\text{number of events in first cluster}}{\text{number of events in log}} \]
Much like effective information retrieval systems aim for high recall and
precision, we want our method to score a perfect recall while obtaining the
highest effort reduction possible.
\subsection{Recording the impact of added data}
To study the impact of added data on SBLD's performance, we need to measure how
SBLD's performance on a target log $t$ is affected by adding an extra
failing log $f$ or a passing log $p$. There are several strategies
for accomplishing this. One way is to try all combinations in the
dataset i.e.\ compute the performance on any $t$ using any choice of
failing and passing logs to produce the interestingness scores. This
approach does not account for the fact that the logs in the data are
produced at different points in time and is also extremely expensive
computationally. We opted instead to order the logs chronologically and
simulate a step-wise increase in data as time progresses, as shown in
Algorithm~\ref{alg:time}.
\begin{algorithm}[b]
\caption{Pseudo-code illustrating how we simulate a step-wise increase in data
as time progresses and account for variability in choice of
interestingness measure.}
\label{alg:time}
\begin{algorithmic}\small
\STATE $F$ is the set of failing logs for a given test
\STATE $P$ is the set of passing logs for a given test
\STATE $M$ is the set of interestingness measures considered
\STATE sort $F$ chronologically
\STATE sort $P$ chronologically
\FOR{$i=0$ to $i=\lvert F \rvert$}
\FOR{$j=0$ to $j=\lvert P \rvert$}
\STATE $f = F[:i]$ \COMMENT{get all elements in F up to and including position i}
\STATE $p = P[:j]$
\FORALL{$l$ in $f$}
\STATE initialize $er\_scores$ as an empty list
\STATE initialize $recall\_scores$ as an empty list
\FORALL{$m$ in $M$}
\STATE perform SBLD on $l$ using $m$ as measure \\ \hspace*{1.75cm} and $f$ and $p$ as spectrum data
\STATE append recorded effort reduction score to $er\_scores$
\STATE append recorded recall score to $recall\_scores$
\ENDFOR
\STATE record median of $er\_scores$
\STATE record median of $recall\_scores$
\ENDFOR
\ENDFOR
\ENDFOR
\end{algorithmic}
\end{algorithm}
\subsection{Variability in interestingness measures}
\label{sec:imvars}
As mentioned in Section~\ref{sec:approach}, SBLD requires a
choice of interestingness measure for scoring the events,
which can have a considerable impact on SBLD's performance.
Considering that the best choice of interestingness measure is context-dependent,
there is no global optimum,
it is up to the user to decide which interestingness metric best reflects their
notion of event relevance.
Consequently, we want to empirically study SBLD in way
that captures the variability introduced by this decision.
To this end, we record the median score obtained by performing SBLD for every possible choice of
interestingness measure from those listed in Table~\ref{table:measures}.
Algorithm~\ref{alg:time} demonstrates the procedure in pseudo-code.
\subsection{Comparing alternatives}
\label{sec:comps}
To answer RQ2 and RQ3, we use pairwise comparisons of
different configurations of SBLD with a method that searches for regular expressions.
The alternatives are compared
on each individual failing log in the set in a paired fashion. An
important consequence of this is that the statistical comparisons have
no concept of which test the failing log belongs to, and thus the test
for which there is most data has the highest impact on the result of the
comparison.
The pairwise comparisons are conducted using paired Wilcoxon signed-rank
tests~\cite{wilcoxon1945} where the Pratt correction~\cite{Pratt1959}
is used to handle ties. We apply Holm's correction~\cite{Holm1979}
to the obtained p-values to account for the family-wise error
rate arising from multiple comparisons. We declare a comparison
\emph{statistically significant} if the Holm-adjusted p-value is below
$\alpha=0.05$. The Wilcoxon tests check the two-sided null hypothesis of
no difference between the alternatives. We report the Vargha-Delaney $A_{12}$ and
$A_{21}$~\cite{Vargha2000} measures of stochastic superiority to
indicate which alternative is the strongest. Conventionally, $A_{12}=0.56$ is
considered a small difference, $A_{12}=.64$ is considered a medium difference
and $A_{12}=.71$ or greater is considered large~\cite{Vargha2000}. Observe
also that $A_{21} = 1 - A_{12}$.
\begin{figure*}
\includegraphics[width=0.8\textwidth]{rq1_boxplot.png}
%
\caption{The overall performance of SBLD in terms of effort reduction
and recall. On many tests, SBLD exhibited perfect recall for
all observations in the inter-quartile range and thus the box collapses to a single line on the $1.0$ mark.\label{fig:rq1boxplot}}
\end{figure*}
\subsection{Analysis procedures}
We implement the SBLD approach in a prototype tool
DAIM (Diagnosis and Analysis using Interestingness Measures),
and use DAIM to empirically evaluate the idea.
\head{RQ1 - overall performance} We investigate the overall performance
of SBLD by analyzing a boxplot for each test in our dataset. Every individual
datum that forms the basis of the plot is the median performance of SBLD over
all choices of interestingness measures for a given set of failing and passing
logs subject to the chronological ordering scheme outlined above.
\head{RQ2 - impact of data} We analyze the impact of added data by
producing and evaluating heatmaps that show the obtained performance
as a function of the number of failing logs (y-axis) and number of
passing logs (x-axis). The color intensity of each tile in the heatmaps
is calculated by taking the median of the scores obtained for each
failing log analyzed with the given number of failing and passing logs
as data for the spectrum inference, wherein the score for each log is
the median over all the interestingness measures considered as outlined in
Section~\ref{sec:imvars}.
Furthermore, we compare three variant configurations
of SBLD that give an overall impression of the influence of added
data. The three configurations considered are \emph{minimal evidence},
\emph{median evidence} and \emph{maximal evidence}, where minimal
evidence uses only events from the log being analyzed and one additional
passing log, median evidence uses the median amount of respectively failing and
and passing logs available while maximal evidence uses
all available data for a given test. The comparisons are conducted with the
statistical scheme described above in Section~\ref{sec:comps}.
\head{RQ3 - SBLD versus pattern-based search} To compare SBLD
against a pattern-based search, we record the effort reduction and
recall obtained when only selecting events in the log that match on the
case-insensitive regular expression \texttt{"error|fault|fail*"}, where
the $*$ denotes a wildcard-operator and the $\lvert$ denotes logical
$OR$. This simulates the results that a user would obtain by using
a tool like \texttt{grep} to search for words like 'error' and 'failure'.
Sometimes the ground-truth signature expressions contain words from this
pattern, and we indicate this in Table~\ref{table:signature}. If so, the
regular expression-based method is guaranteed to retrieve the event.
Similarly to RQ2, we compare the three configurations of SBLD described
above (minimum, median and maximal evidence) against the pattern-based
search using the statistical described in Section~\ref{sec:comps}.
%
\section{Results and Discussion}
\label{sec:resdiscuss}
This section gradually dissects Figure~\ref{fig:rq1boxplot}, showing a breakdown of SBLD's performance per test for both recall
and effort reduction, Figures \ref{fig:erheat} and \ref{fig:recallheat},
showing SBLD's performance as a function of the number of failing and passing
logs used, as well as Table~\ref{table:comparisons}, which shows the results
of the statistical comparisons we have performed.
\begin{figure*}
\includegraphics[width=\textwidth]{er_heatmap.pdf}
\caption{Effort reduction score obtained when SBLD is run on a given number of failing and passing logs. The tests not listed in this figure all obtained a lowest median effort reduction score of 90\% or greater and are thus not shown for space considerations. \label{fig:erheat}}
\vspace*{-2ex}
\end{figure*}
\begin{table*}
\caption{Statistical comparisons performed in this investigation. The
bold p-values are those for which no statistically significant difference under $\alpha=0.05$
could be established.}
\label{table:comparisons}
{\small%
\begin{tabular}{lllrrrr}
\toprule
variant 1 & variant 2 & quality measure & Wilcoxon statistic & $A_{12}$ & $A_{21}$ & Holm-adjusted p-value\\
\midrule
pattern-based search & minimal evidence & effort reduction & 29568.5 & 0.777 & 0.223 & $\ll$ 0.001 \\
pattern-based search & maximal evidence & effort reduction & 202413.0 & 0.506 & 0.494 & \textbf{1.000} \\
pattern-based search & median evidence & effort reduction & 170870.5 & 0.496 & 0.504 & $\ll$ 0.001 \\
minimal evidence & maximal evidence & effort reduction & 832.0 & 0.145 & 0.855 & $\ll$ 0.001 \\
minimal evidence & median evidence & effort reduction & 2666.0 & 0.125 & 0.875 & $\ll$ 0.001 \\
maximal evidence & median evidence & effort reduction & 164674.0 & 0.521 & 0.479 & \textbf{1.000} \\
pattern-based search & minimal evidence & recall & 57707.0 & 0.610 & 0.390 & $\ll$ 0.001 \\
pattern-based search & maximal evidence & recall & 67296.0 & 0.599 & 0.401 & $\ll$ 0.001 \\
pattern-based search & median evidence & recall & 58663.5 & 0.609 & 0.391 & $\ll$ 0.001 \\
minimal evidence & maximal evidence & recall & 867.5 & 0.481 & 0.519 & $\ll$ 0.001 \\
minimal evidence & median evidence & recall & 909.0 & 0.498 & 0.502 & 0.020 \\
maximal evidence & median evidence & recall & 0.0 & 0.518 & 0.482 & $\ll$ 0.001 \\
\bottomrule
\end{tabular}
%
}
\end{table*}
\begin{figure}
\includegraphics[width=\columnwidth]{recall_heatmap.pdf}
\caption{Recall score obtained when SBLD is run on a given number of failing and passing logs. For space
considerations, we only show tests for which the minimum observed
median recall was smaller than 1 (SBLD attained perfect median recall for all configurations in the other tests). \label{fig:recallheat}}
\vspace*{-3ex}
\end{figure}
\subsection{RQ1: The overall performance of SBLD}
Figure~\ref{fig:rq1boxplot} suggests that SBLD's overall performance is strong,
since it obtains near-perfect recall while retaining a high degree of effort
reduction. In terms of recall, SBLD obtains a perfect performance on all except
four tests: 18, 34, 42 and 43, with the lower quartile stationed at perfect recall for all tests
except 43 (which we discuss in detail in Section~\ref{sec:testfourtythree}).
For test 18, only 75 out of 20700 observations ($0.036\%$) obtained a recall score
of $0.5$ while the rest obtained a perfect score. On test 34 (the smallest in our
dataset), 4 out of 39 observations obtained a score of zero recall while the
others obtained perfect recall.
For test 42, 700 out of 15300 ($0.4\%$) observations obtained a score of zero recall while the rest obtained perfect recall.
Hence with the exception of test 43 which is discussed later,
SBLD obtains very strong recall scores overall with only a few outliers.
The performance is also strong in terms of effort reduction, albeit
more varied. To a certain extent this is expected since the attainable
effort reduction on any log will vary with the length of the log and
the number of ground-truth relevant events in the log. As can be seen
in Figure~\ref{fig:rq1boxplot}, most of the observations fall well
over the 75\% mark, with the exceptions being tests 4 and 22. For test
4, Figure~\ref{fig:erheat} suggests that one or more of the latest
passing logs helped SBLD refine the interestingness scores. A similar
but less pronounced effect seems to have happened for test 22. However,
as reported in Table~\ref{table:descriptive}, test 22 consists only of
\emph{one} failing log. Manual inspection reveals that the log consists
of 30 events, of which 11 are fail-only events. Without additional
failing logs, most interestingness measures will give a high score to
all events that are unique to that singular failing log, which is likely
to include many events that are not ground-truth relevant. Reporting 11
out of 30 events to the user yields a meager effort reduction of around
63\%. Nevertheless, the general trend is that SBLD retrieves a compact
set of events to the user which yields a high effort reduction score.
In summary, the overall performance shows that SBLD
retrieves the majority of all known-to-be-relevant events
in compact clusters, which dramatically reduces the analysis burden for the
end user. The major exception is Test 43, which we return to in
Section~\ref{sec:testfourtythree}.
\subsection{RQ2: On the impact of evidence}
The heatmaps suggest that the effort reduction is generally not
adversely affected by adding more \emph{passing logs}. If the
assumptions underlying our interestingness measures are correct,
this is to be expected: Each additional passing log either gives us
reason to devalue certain events that co-occur in failing and passing
logs or contain passing-only events that are deemed uninteresting.
Most interestingness measures highly value events that
exclusively occur in failing logs, and additional passing logs help
reduce the number of events that satisfy this criteria. However, since
our method bases itself on clustering similarly scored events it is
weak to \emph{ties} in interestingness scores. It is possible that
an additional passing log introduces ties where there previously was
none. This is likely to have an exaggerated effect in situations with
little data, where each additional log can have a dramatic impact on the
interestingness scores. This might explain the gradual dip in effort
reduction seen in Test 34, for which there are only two failing logs.
Adding more failing logs, on the other hand, draws a more nuanced
picture: When the number of failing logs (y-axis) is high relative
to the number of passing logs (x-axis), effort reduction seems to suffer.
Again, while most interestingness measures will prioritize events that
only occur in failing logs, this strategy only works if there is a
sufficient corpus of passing logs to weed out false positives. When
there are far fewer passing than failing logs, many events will be
unique to the failing logs even though they merely reflect a different
valid execution path that the test can take. This is especially true for
complex integration tests like the ones in our dataset, which might test
a system's ability to recover from an error, or in other ways have many
valid execution paths.
The statistical comparisons summarized in Table~\ref{table:comparisons}
suggest that the minimal evidence strategy performs poorly compared to the
median and maximal evidence strategies. This is especially
pronounced for effort reduction, where the Vargha-Delaney
metric scores well over 80\% in favor of the maximal and median
strategy. For recall, the difference between the minimum strategy and
the other variants is small, albeit statistically significant. Furthermore,
the jump from minimal evidence to median evidence is much more
pronounced than the jump from median evidence to maximal evidence.
For effort reduction, there is in fact no statistically discernible
difference between the median and maximal strategies. For recall, the maximal
strategies seems a tiny bit better, but the $A_{12}$ measure suggests the
magnitude of the difference to be small.
Overall, SBLD seems to benefit from extra data, especially additional passing
logs. Failing logs also help, but depend on a proportional amount of passing
logs for SBLD to fully benefit.
The performance increase from going from minimal data to some data is more pronounced than going from some data to
maximal data. This suggests that there may be diminishing returns to
collecting extra logs, but our investigation cannot prove or disprove this.
\subsection{RQ3: SBLD versus simple pattern-search}
In terms of effort reduction, Table~\ref{table:comparisons} shows that
the pattern-based search clearly beats the minimal evidence variant of
SBLD. It does not, however, beat the median and maximal variants: The
comparison to median evidence suggests a statistically significant win
in favor of median evidence, but the effect reported by $A_{12}$ is
so small that it is unlikely to matter in practice. No statistically
significant difference could be established between the pattern-based
search and SBLD with maximal evidence.
In one sense, it is to be expected that the pattern-based search does
well on effort reduction assuming that events containing words like
"fault" and "error" are rare. The fact that the pattern-based search
works so well could indicate that \CiscoNorway{our industrial partner}
has a well-designed logging infrastructure where such words are
rare and occur at relevant positions in the logs. On the other
hand, it is then notable that the median and maximum variants of SBLD perform
comparably on effort reduction without having any concept of the textual
content in the events.
In terms of recall, however, pattern-based search beats all variants of
SBLD in a statistically significant manner, where the effect size of the
differences is small to medium. One likely explanation for this better performance is that the
pattern-based search performs very well on Test 43, which SBLD generally
performs less well on. Since the comparisons are run per failing log and test
43 constitutes 29\% of the failing logs (specifically, 267 out of 910 logs), the
performance of test 43 has a massive impact. We return to test 43 and its
impact on our results in Section~\ref{sec:testfourtythree}.
On the whole, SBLD performs similarly to pattern-based search, obtaining
slightly poorer results on recall for reasons that are likely due
to a particular test we discuss below. At any rate, there is no
contradiction in combining SBLD with a traditional pattern-based search.
Analysts could start by issuing a set of pattern-based searches and
run SBLD afterward if the pattern search returned unhelpful results.
Indeed, an excellent and intended use of SBLD is to suggest candidate
signature patterns that, once proven reliable, can be incorporated in a
regular-expression based search to automatically identify known issues
in future runs.
\subsection{What happens in Test 43?}
\label{sec:testfourtythree}
SBLD's performance is much worse on Test 43 than the other tests, which
warrants a dedicated investigation. The first thing we observed in the
results for Test 43 is that all of the ground-truth-relevant events
occurred \emph{exclusively} in failing logs and were often singular
(11 out of the 33) or infrequent (30 out of 33 events occurred in 10\%
of the failing logs or fewer). Consequently, we observed a strong
performance from the \emph{Tarantula} and \emph{Failed only}-measures
that put a high premium on failure-exclusive events. Most of the
interestingness measures, on the other hand, will prefer an event that
is very frequent in the failing logs and sometimes occur in passing logs
over a very rare event that only occurs in failing logs. This goes a
long way in explaining the poor performance on recall. The abundance of
singular events might also suggest that there is an error in the event
abstraction framework, where several events that should be treated as
instances of the same abstract event are treated as separate events. We
discuss this further in Section~\ref{sec:ttv}.
\begin{sloppypar}%
Another observation we made is that the failing logs contained only \emph{two}
ground-truth relevant events, which means that the recorded recall can quickly
fluctuate between $0$, $0.5$ and $1$.
\end{sloppypar}
Would the overall performance improve by retrieving an additional
cluster? A priori, retrieving an extra cluster would strictly improve
or not change recall since more events are retrieved without removing
the previously retrieved events. Furthermore, retrieving an additional
cluster necessarily decreases the effort reduction. We re-ran the
analysis on Test 43 and collected effort reduction and recall scores
for SBLD when retrieving \emph{two} clusters, and found that the added
cluster increased median recall from $0$ to $0.5$ while the median
effort reduction decreased from $0.97$ to $0.72$. While the proportional
increase in recall is larger than the decrease in effort reduction,
this should in our view not be seen as an improvement: As previously
mentioned, the failing logs in this set contain only two ground-truth
relevant events and thus recall is expected to fluctuate greatly.
Secondly, an effort reduction of $0.72$ implies that you still have to
manually inspect 28\% of the data, which in most information retrieval
contexts is unacceptable. An unfortunate aspect of our analysis in this
regard is that we do not account for event \emph{lengths}: An abstracted
event is treated as one atomic entity, but could in reality vary from a
single line to a stack trace that spans several pages. A better measure
of effort reduction should incorporate a notion of event length to
better reflect the real-world effect of retrieving more events.
All in all, Test 43 exhibits a challenge that SBLD is not suited for:
It asks SBLD to prioritize rare events that are exclusive to failing
logs over events that frequently occur in failing logs but might
occasionally occur in passing logs. The majority of interestingness
measures supported by SBLD would prioritize the latter category of
events. In a way, this might suggest that SBLD is not suited for finding
\emph{outliers} and rare events: Rather, it is useful for finding
events that are \emph{characteristic} for failures that have occurred
several times - a "recurring suspect", if you will. An avenue for future
research is to explore ways of letting the user combine a search for
"recurring suspects" with the search for outliers.
%
\section{Related Work}
\label{sec:relwork}
We distinguish two main lines of related work:
First, there is other work aimed at automated analysis of log files,
i.e., our problem domain,
and second, there is other work that shares similarities with our technical approach,
i.e., our solution domain.
\head{Automated log analysis}
Automated log analysis originates in \emph{system and network monitoring} for security and administration~\cite{lin1990:error,Oliner2007},
and saw a revival in recent years due to the needs of \emph{modern software development}, \emph{CE} and \emph{DevOps}~\cite{Hilton2017,Laukkanen2017,Debbiche2014,Olsson2012,Shahin2017,candido2019:contemporary}.
A considerable amount of research has focused on automated \emph{log parsing} or \emph{log abstraction},
which aims to reduce and organize log data by recognizing latent structures or templates in the events in a log~\cite{zhu2019:tools,el-masri2020:systematic}.
He et al. analyze the quality of these log parsers and conclude that many of them are not accurate or efficient enough for parsing the logs of modern software systems~\cite{he2018:automated}.
In contrast to these automated approaches,
our study uses a handcrafted log abstracter developed by \CiscoNorway{our industrial collaborator}.
\emph{Anomaly detection} has traditionally been used for intrusion detection and computer security~\cite{liao2013:intrusion,ramaki2016:survey,ramaki2018:systematic}.
Application-level anomaly detection has been investigated for troubleshooting~\cite{chen2004:failure,zhang2019:robust},
and to assess compliance with service-level agreements~\cite{banerjee2010:logbased,He2018,sauvanaud2018:anomaly}.
Gunter et al. present an infrastructure for troubleshooting of large distributed systems, %
by first (distributively) summarizing high volume event streams before submitting those summaries to a centralized anomaly detector.
This helps them achieve the fidelity needed for detailed troubleshooting,
without suffering from the overhead that such detailed instrumentation would bring~\cite{Gunter2007}.
Deeplog by Du et al. enables execution-path and performance anomaly detection in system logs by training a Long Short-Term Memory neural network of the system's expected behavior from the logs, and using that model to flag events and parameter values in the logs that deviate from the model's expectations~\cite{Du2017}.
Similarly, LogRobust by Zhang et al. performs anomaly detection using a bi-LSTM neural network but also detects events that are likely evolved versions of previously seen events, making the learned model more robust to updates in the target logging infrastructure~\cite{zhang2019:robust}.
In earlier work, we use \emph{log clustering} to reduce the effort needed to process a backlog of failing CE logs
by grouping those logs that failed for similar reasons~\cite{rosenberg2018:use,rosenberg:2018:improving}.
They build on earlier research that uses log clustering to identify problems in system logs~\cite{Lin2016,Shang2013}.
Common to these approaches is how the contrast between passing and failing logs is used to improve accuracy,
which is closely related to how SBLD highlights failure-relevant events.
Nagarash et al.~\cite{nagaraj:2012} explore the use of dependency networks to exploit the contrast between two sets of logs,
one with good and one with bad performance,
to help developers understand which component(s) likely contain the root cause of performance issues.
An often-occurring challenge is the need to (re)construct an interpretable model of a system's execution.
To this end, several authors investigate the combination of log analysis with (static) source code analysis,
where they try to (partially) match events in logs to log statements in the code,
and then use these statements to reconstruct a path through the source code to help determine
what happened in a failed execution~\cite{Xu2009,yuan:2010:sherlog,zhao2014:lprof,schipper2019:tracing}.
Gadler et al. employ Hidden Markov Models to create a model of a system's usage patterns from logged events~\cite{gadler2017:mining}, while
Pettinato et al. model and analyze the behavior of a complex telescope system using Latent Dirichlet Allocation~\cite{pettinato2019:log}.
Other researchers have analyzed the logs for successful and failing builds,
to warn for anti-patterns and decay~\cite{vassallo2019:automated},
give build repair hints~\cite{Vassallo2018},
and automatically repair build scripts~\cite{hassan2018:hirebuild, tarlow2019:learning}.
Opposite to our work,
these techniques exploit the \emph{overlap} in build systems used by many projects to mine patterns that hint at decay or help repair a failing build,
whereas we exploit the \emph{contrast} with passing runs for the same project to highlight failure-relevant events.
\begin{sloppypar}
\head{Fault Localization}
As mentioned, our approach was inspired by Spectrum-Based Fault Localization (SBFL),
where the fault-proneness of a statement is computed as a function of
the number of times that the statement was executed in a failing test case, combined with
the number of times that the statement was skipped in a passing test case~\cite{Jones2002,Chen2002,Abreu2007,Abreu2009,Naish2011}.
This more or less directly translates to the inclusion or exclusion of events in failing, resp. passing logs,
where the difference is that SBLD adds clustering of the results to enable step-wise presentation of results to the user.
\end{sloppypar}
A recent survey of Software Fault Localization includes the SBFL literature up to 2014~\cite{Wong2016}.
De Souza et. all extend this with SBFL work up to to 2017, and add an overview of seminal work on automated debugging from 1950 to 1977~\cite{deSouza2017}.
By reflecting on the information-theoretic foundations of fault localization, Perez proposes the DDU metric,
which can be used to evaluate test suites and predict their diagnostic performance when used in SBFL~\cite{Perez2018}.
One avenue for future work is exploring how a metric like this can be adapted to our context,
and see if helps to explain what happened with test 43.
A recent evaluation of \emph{pure} SBFL on large-scale software systems found that it under-performs in these situations
(only 33-40\% of the bugs are identified with the top 10 of ranked results~\cite{heiden2019:evaluation}.
The authors discuss several directions beyond pure SBFL, such as combining it with dynamic program analysis techniques,
including additional text analysis/IR techniques~\cite{Wang2015a}, mutation based fault localization,
and using SBFL in an interactive feedback-based process, such as whyline-debugging~\cite{ko2008:debugging}.
Pure SBFL is closely related to the Spectrum-Based Log Diagnosis proposed here,
so we may see similar challenges (in fact, test 43 may already show some of this).
Of the proposed directions to go beyond pure SBFL,
both the inclusion of additional text analysis/IR techniques,
and the application of Spectrum-Based Log Diagnosis in an interactive feedback-based process
are plausible avenues to extend our approach.
Closely related to the latter option,
de Souza et al.~\cite{deSouza2018b} assess guidance and filtering strategies to \emph{contextualize} the fault localization process.
Their results suggest that contextualization by guidance and filtering can improve the effectiveness of SBFL,
by classifying more actual bugs in the top ranked results.
\begin{comment}
Direct comparison~\cite{He2018, jiang2017:what, Jones:2007:DP:1273463.1273468,
Xu2009, Hwa-YouHsu:2008:RIB:1642931.1642994}.
Hsu et
al~\cite{Hwa-YouHsu:2008:RIB:1642931.1642994} discuss methods for extracting
failure signatures as sequences of code executions, which in spirit is rather
similar to what we are trying to accomplish.
An interesting data-structure, the event correlation
graph, is explores in~\cite{Fu2012a}. An FL metric that takes frequencies into
account~\cite{Shu2016}.
\end{comment}
%
\section{Threats to Validity}
\label{sec:ttv}
\head{Construct Validity} %
The signatures that provide our ground truth were devised to determine whether a given log \emph{in its entirety} showed symptoms of a known error.
As discussed in Section~\ref{sec:dataset}, we have used these signatures to detect events that give sufficient evidence for a symptom,
but there may be other events that could be useful to the user that are not part of our ground truth.
We also assume that the logs exhibit exactly the failures described by the signature expression.
In reality, the logs could contain symptoms of multiple failures beyond the ones described by the signature.
Furthermore, we currently do not distinguish between events that consist of single line of text,
or events that contain a multi-line stack-trace, although these clearly represent different comprehension efforts.
This threat could be addressed by tracking the \emph{length} of the event contents,
and using it to further improve the accuracy of our effort reduction measure.
The choice of clustering algorithm and parameters affects the events retrieved,
but our investigation currently only considers HAC with complete linkage.
While we chose complete linkage to favor compact clusters,
outliers in the dataset could cause unfavorable clustering outcomes.
Furthermore, using the uncorrected sample standard deviation as threshold criterion
may be too lenient if the variance in the scores is high.
This threat could be addressed by investigate alternative cluster algorithm and parameter choices.
Moreover, as for the majority of log analysis frameworks, the performance of SBLD strongly depends on the quality of log abstraction.
An error in the abstraction will directly propagate to SBLD:
For example, if abstraction fails to identify two concrete events as being instances of the same generic event,
their aggregated frequencies will be smaller and consequently treated as less interesting by SBLD.
Similarly, the accuracy will suffer if two events that represent distinct generic events are treated as instances of the same generic event.
Future work could investigate alternative log abstraction approaches.
\head{Internal Validity} %
While our heatmaps illustrate the interaction between additional data and SBLD performance,
they are not sufficient to prove a causal relationship between performance and added data.
Our statistical comparisons suggests that a strategy of maximizing data is generally preferable,
but they are not sufficient for discussing the respective contribution of failing or passing logs.
\head{External Validity} %
This investigation is concerned with a single dataset from one industrial partner.
Studies using additional datasets from other contexts is needed to assess the generalizability of SBLD to other domains.
Moreover, while SBLD is made to help users diagnose problems that are not already well understood,
we are assessing it on a dataset of \emph{known} problems.
It could be that these errors, being known, are of a kind that are generally easier to identify than most errors.
Studying SBLD in-situ over time and directly assessing whether end users found it helpful
in diagnosis would better indicate the generalizability of our approach.
%
\section{Concluding Remarks}
\label{sec:conclusion}
\head{Contributions}
This paper presents and evaluates Spectrum-Based Log Diagnosis (SBLD),
a method for automatically identifying segments of failing logs
that are likely to help users diagnose failures.
Our empirical investigation of SBLD addresses the following questions:
(i) How well does SBLD reduce the \emph{effort needed} to identify all \emph{failure-relevant events} in the log for a failing run?
(ii) How is the \emph{performance} of SBLD affected by \emph{available data}?
(iii) How does SBLD compare to searching for \emph{simple textual patterns} that often occur in failure-relevant events?
\head{Results}
In response to (i),
we find that SBLD generally retrieves the failure-relevant events in a compact manner
that effectively reduces the effort needed to identify failure-relevant events.
In response to (ii),
we find that SBLD benefits from addition data, especially more logs from successful runs.
SBLD also benefits from additional logs from failing runs if there is a proportional amount of successful runs in the set.
We also find that the effect of added data is most pronounced when going from little data to \emph{some} data rather than from \emph{some} data to maximal data.
In response to (iii),
we find that SBLD achieves roughly the same effort reduction as traditional search-based methods but obtains slightly lower recall.
We trace the likely cause of this discrepancy on recall to a prominent part of our dataset, whose ground truth emphasizes rare events.
A lesson learned in this regard is that SBLD is not suited for finding statistical outliers but rather \emph{recurring suspects}
that characterize the observed failures.
Furthermore, the investigation highlights that traditional pattern-based search and SBLD can complement each other nicely:
Users can resort to SBLD if they are unhappy with what the pattern-based searches turn
up, and SBLD is an excellent method for finding characteristic textual patterns
that can form the basis of automated failure identification methods.
\head{Conclusions}
We conclude that SBLD shows promise as a method diagnosing failing runs,
that its performance is positively affected by additional data,
but that it does not outperform textual search on the dataset considered.
\head{Future work}
We see the following directions for future work:
(a) investigate SBLD's performance on other datasets, to better assess generalizability,
(b) explore the impact of alternative log abstraction mechanisms,
(c) explore ways of combining SBLD with outlier detection, to accommodate different user needs,
(d) adapt the Perez' DDU metric to our context and see if it can help predict diagnostic efficiency,
(e) experiment with extensions of \emph{pure SBLD} that include additional text analysis/IR techniques,
or apply it in an interactive feedback-based process
(f) rigorously assess (extensions of) SBLD in in-situ experiments.
\begin{acks}
We thank Marius Liaaen and Thomas Nornes of Cisco Systems Norway for help with obtaining and understanding the dataset, for developing the log abstraction
mechanisms and for extensive discussions.
This work is supported by the \grantsponsor{RCN}{Research Council of Norway}{https://www.rcn.no} through the
Certus SFI (\grantnum{RCN}{\#203461/030)}.
The empirical evaluation was performed on resources provided by \textsc{uninett s}igma2,
the national infrastructure for high performance computing and data
storage in Norway.
\end{acks}
\printbibliography
\end{document}
| {'timestamp': '2020-08-18T02:18:33', 'yymm': '2008', 'arxiv_id': '2008.06948', 'language': 'en', 'url': 'https://arxiv.org/abs/2008.06948'} | arxiv |
\section{Introduction}
Multi-label classification jointly assigns one sample with multiple tags reflecting its semantic content, which has been widely used in many real-world applications. In document classification, there are multiple topics for one document; in computer vision, one image may contain multiple types of object; in emotion analysis, there may be combined types of emotions, \emph{e.g.}, relaxing and quiet. Though plenty of multi-label classification methods \cite{tsoumakas2007multi,read2008multi,zhang2014review,read2011classifier,hou2016multi,liu2017deep,wu2017diverse,wu2018multi} have been proposed, multi-label classification is still a recognized challenging task due to the complexity of label correlations, and the difficulty of predicting all labels.
\begin{figure}[t]
\centering
\includegraphics[width=3.6in, height=1.7in]{figure/coverFig3.pdf}
\caption{Why landmarks should be predictable? With a test image, although the other related labels (\emph{e.g.}, ``street", ``road") can be inferred from ``sign", the landmark label ``sign" itself is difficult to accurately predict (bottom row). While based on the image, the label ``street" is more predictable, and accordingly, more related labels are correctly inferred (top row). }
\label{fig:coverFig1}
\end{figure}
In real-world applications, labels are usually correlated, and simultaneously predicting all possible labels is usually rather difficult. Accordingly, there are techniques aiming to reduce the label space. The representative strategy is landmark based multi-label classification. Landmark based methods first select a small subset of representative labels as landmarks, where the landmark labels are able to establish interdependence with other labels. The algorithm \cite{Balasubramanian2012The} employ group-sparse learning to select a few labels as landmarks which can reconstruct the other labels. However, this method divides the landmark selection and landmark prediction as two separate processes. The method \cite{bi2013efficient} performs label selection based on randomized sampling, where the sampling probability of each class label reflects its importance among all the labels. Another representative strategy is label embedding \cite{hsu2009multi,tai2012multilabel,chen2012feature,zhang2012maximum,zhou2012compressed}, which transforms label vectors into low-dimensional embeddings, where the correlations among labels can be implicitly encoded.
Although several methods have been proposed to reduce the dimensionality of label space, there are several limitations left behind these methods. First, existing landmark-based methods usually separate the landmark label selection and landmark prediction into two independent steps. Therefore, even the other labels could be easily recovered from the selected landmarks, but the landmarks themselves may be difficult to be accurately predicted with input (as shown in Fig.~\ref{fig:coverFig1}). Second, the label-embedding-based methods usually project the original label space into a low-dimensional embedding space, where embedded vectors can be used to recover the full-label set. Although the embedded vectors may be easy to predict, the embedding way (\emph{i.e.}, dimensionality reduction) may cause information loss, and the label correlations are implicitly encoded thus lack interpretability. Considering the above issues, we jointly conduct landmarks selection, landmarks prediction and full-label recovery in a unified framework, and accordingly, propose a novel multi-label learning method, termed \emph{Selecting Predictable Landmarks for Multi-Label Learning} (\textbf{\emph{SPL-MLL}}). The overview of SPL-MLL is shown in Fig.~\ref{fig:framework2}.
The main advantages of the proposed algorithm include: (1) compared with existing landmark-based multi-label learning methods, SPL-MLL can select the landmarks which are both representative and predictable due to the unified objective; (2) compared with the embedding methods, SPL-MLL is more interpretable due to explicitly exploring the correlations with landmarks.
The contributions of this work are summarized as:
\begin{itemize}
\item{We propose a novel landmark-based multi-label learning algorithm for complex correlations among labels. The landmarks bridge the intrinsic correlations among different labels, while also reduce the complexity of correlations and possible label noise.}
%
\item{To the best of our knowledge, SPL-MLL is the first algorithm which simultaneously conducts landmark selection, landmark prediction, and full-label recovery in a unified objective, thus taking both representativeness and predictability for landmarks into account. This is quite different from the 2-step manner separating landmark selection and prediction.}
%
\item{Extensive experiments on benchmark datasets are conducted, validating the effectiveness of the proposed method over state-of-the-arts.}
\end{itemize}
\section{Related Work}
Generally, existing multi-label methods can be roughly categorized into three lines based on the order of label correlations \cite{zhang2014review}. The first-order strategy \cite{boutell2004learning,zhang2007ml} tackles multi-label learning problem in the label-by-label manner, which ignores the co-existence of other labels. The second-order strategy \cite{elisseeff2002kernel,furnkranz2008multilabel,ghamrawi2005collective} conducts multi-label learning problem by introducing the pairwise relations between different labels. For high-order strategy \cite{ji2010shared,read2011classifier,tsoumakas2011random,wu2018tagging}, multi-label learning problem is solved by establishing more complicated label relationships, which makes these approaches tend to be quite computationally expensive.
In order to reduce label space, there are approaches based on label embedding, which searches a low-dimensional subspace so that correlations among labels can be implicitly expressed \cite{hsu2009multi,tai2012multilabel,chen2012feature,ren2019label,jia2019facial,zhang2012maximum,zhou2012compressed,yu2014large,lin2014multi,li2015multi}.
Based on the low-dimensional latent label space, one can effectively reduce computation cost while performing multi-label prediction. The representative embedding based methods include: label embedding via random projections \cite{hsu2009multi}, principal label space transformation (PLST) \cite{tai2012multilabel} and its conditional version (CPLST) \cite{chen2012feature}. Beyond considering linear embedding functions, there are several approaches employing standard kernel functions (\emph{e.g.}, low-degree polynomial kernels) for nonlinear label embedding. The work in \cite{yeh2017learning} proposes a novel DNN architecture of Canonical-Correlated Autoencoder (C2AE), which is a DNN-based label embedding framework for multi-label classification, which is able to perform feature-aware label embedding and label-correlation aware prediction.
To explore label correlations, there are several landmark based multi-label classification models aiming to reduce the label space \cite{Balasubramanian2012The,bi2013efficient,zhou2012compressed,boutsidis2009improved}. They usually first select a small subset of labels as landmarks, which are supposed to be representative and able to establish interdependency with other labels. The work in \cite{Balasubramanian2012The} models landmark selection with group-sparsity technique.
Following the assumption in \cite{Balasubramanian2012The}, the method in \cite{bi2013efficient} alleviates this problem of computation cost by proposing an valid label selection method based on randomized sampling, and utilizes the leverage score in the best rank-$\emph{k}$ subspace of the label matrix to obtain the sampling probability of each label.
It is noteworthy that these methods separate the landmark selection and landmark prediction in a 2-step manner, which can not simultaneously guarantee the representativeness and predictability of landmarks.
\begin{figure*}[]
\centering
\includegraphics[width=4.4in, height = 2.0in]{figure/framework-zuixin.pdf}
\caption{Overview of SPL-MLL. The key component of our model is the landmark selection strategy, which induces the explicit landmark label matrix $\mathbf{Y}_L$. The matrix $\mathbf{B}$, termed as landmark selection matrix, is used to construct the landmark label matrix explicitly, while the matrix $\mathbf{A}$ is used to reconstruct all possible labels from landmarks. Benefitting from the explicit landmark label matrix $\mathbf{Y}_L$, the input is also able to be taken into account to ensure the predictable property for landmarks.}
\label{fig:framework2}
\end{figure*}
\vspace{-0.5cm}
\section{Our Algorithm: Selecting Predictable Landmarks for Multi-Label Learning}
For clarification, we first provide the definitions for symbols and variables used through out this paper. Let $\mathcal{X} = \mathbb{R}^{D} $ and $\mathcal{Y} = \{0,1\}^{C} $ denote the feature space and label space, where $D$ and $C$ are the dimensionality of feature space and label space, respectively. Given training data with the form of instance-label pairs $\{{{\mathbf{x}}_i},{{\mathbf{y}}_i}\} _{i = 1}^N $, accordingly, the feature matrix can be represented as $\mathbf{X} \in \mathbb{R}^{N \times D}$, and the label matrix is represented as $ \mathbf{Y} \in \mathbb{R}^{N \times C}$. The goal of multi-label learning is to learn a model $f:\mathcal{X} \to \mathcal{Y}$, to predict possible labels accurately for new coming instances. Motivated by the landmark strategy, we propose a novel algorithm for multi-label learning, termed SPL-MLL, \emph{i.e.}, \emph{Selecting Predictable Landmarks for Multi-Label Learning}. SPL-MLL consists of two key components, \emph{i.e.}, \emph{Explicit Landmark Selection} and \emph{Predictable Landmark Classification}.
\subsection{Explicit Landmark Selection}
Different from the 2-step manner \cite{Balasubramanian2012The} which only focuses on selecting landmarks that are most representative, our goal is to select landmarks which are both representative and predictable. There are two designed matrixes which are the keys to realize this goal. The first matrix is the \textbf{\emph{label correlation matrix (LCM)}} $\mathbf{A}$ used for recovering other labels with landmarks. In self-representation manner, the matrix $\mathbf{A} \in \mathbb{R}^{C \times C}$ is obtained which captures the correlation among labels and explores the interdependency between landmark labels and the others. In the work \cite{Balasubramanian2012The}, the landmarks are selected implicitly. Specifically, the underlying assumption is ${\mathbf{Y}}= \mathbf{YA}$, where $\mathbf{A}$ is constrained by minimizing $||\mathbf{A}||_{2,1}$ to enforce the reconstruction of $\mathbf{Y}$ mainly base on a few labels, \emph{i.e.}, landmarks. In our model, although the linear self-representation manner is also introduced in our model, we try to obtain the landmark label matrix explicitly in the objective function.
The second critical matrix is the \textbf{\emph{landmark selection matrix (LSM)}} $\mathbf{B}$. Note that, in the work \cite{Balasubramanian2012The}, there is no explicit landmark label matrix constructed and the selection result is implicitly encoded in $\mathbf{A}$ due to its sparsity in row. Both $\mathbf{YA}$ and $\mathbf{Y}$ ($\mathbf{YA}\approx \mathbf{Y}$) in \cite{Balasubramanian2012The} are full-label matrix. Different from \cite{Balasubramanian2012The}, since we aim to jointly conduct landmark selection and learn a model to predict these selected landmarks instead of all labels, we need to explicitly derive a label matrix encoding the landmarks. To this end, we introduce the matrix $\mathbf{B} \in \mathbb{R}^{C \times C}$ which is a diagonal matrix, and each diagonal element is either 0 or 1, \emph{i.e.}, ${B}_{ii} \in \{0,1\}$. Then, we can obtain the explicit landmark label matrix ${\mathbf{Y}}_L$ with ${\mathbf{Y}}_L = \mathbf{YB}$. In this way, the columns corresponding to the landmarks in $\mathbf{Y}_L$ unchanged while the elements of other columns (corresponding to non-landmark labels) will be 0. It is noteworthy that $\mathbf{B}$ is learned in our model instead of being fixed in advance. Accordingly, the explicit landmark selection objective to minimize is induced as:
\begin{equation}
\begin{aligned}
\mathbf{\Gamma}(\mathbf{B},\mathbf{A})&=\|\mathbf{Y}-\mathbf{Y}_{L}\mathbf{A}\|_{F}^2+\mathbf{\Omega}(\mathbf{B})\\
&=\|\mathbf{Y}-\mathbf{Y}\mathbf{B}\mathbf{A}\|_{F}^2+\mathbf{\Omega}(\mathbf{B}),\\
&s.t.~B_{ij} = 0, ~i \neq j; ~B_{ij} \in \{0,1\}, ~i = j.
\end{aligned}
\label{loss}
\end{equation}
Since it is difficult to strictly ensure the diagonal property for $\mathbf{B}$, a soft constraint $\mathbf{\Omega}(\mathbf{B})$ is introduced as follows:
\begin{equation}
\begin{aligned}
\mathbf{\Omega}(\mathbf{B})&= \lambda_1\|\mathbf{B}-\mathbf{I}\|_{F}^2+\lambda_2\|\mathbf{B}\|_{2,1},\\
\end{aligned}
\label{loss}
\end{equation}
where the structure sparsity $ ||\mathbf{B}||_{2,1}=\sum_{i=1}^{C}\sqrt{\sum_{j=1}^{C}B_{ij}^2}$ is used to select a few landmarks, and the approximation to the identity matrix $\mathbf{I}$ ensures the labels corresponding to landmarks unchanged. The regularization parameter $\lambda_1$ and $\lambda_2$ control the degree of diagonal and sparsity property for $\mathbf{B}$, respectively.
Notice that the label correlation matrix $\mathbf{A}$ is learned automatically without constraint, the underlying assumption for the correlation is sparse (similar to the existing work \cite{Balasubramanian2012The}) which is jointly ensured by the sparse landmark selection matrix $\mathbf{B}$.
Then, we can obtain the explicit landmark label matrix $\mathbf{Y}_L = \mathbf{YB}$, and train a prediction model exactly for the landmarks.
\subsection{Predictable Landmark Classification}
Now, we firstly consider learning the classification model for accurately predicting landmarks instead of all possible labels. Beyond label correlation, modeling $\mathcal{X} \to \mathcal{Y}$ is also critical in multi-label classification. However, the traditional landmark-based multi-label classification algorithms usually separate landmark selection and landmark prediction, which may result in unpromising classification accuracy because the selected landmarks may be representative but difficult to be predicted (see Fig.~\ref{fig:coverFig1}). Recall that the goal of our model is to recover full labels with landmark labels, so our classification model only focuses on predicting landmarks $\mathbf{Y}_L$ based on $\mathbf{X}$ instead of full labels $\mathbf{Y}$. Accordingly, our predictable landmark classification objective to minimize is as follows:
\begin{equation}
\begin{aligned}
\mathbf{\Phi}(\mathbf{B},\mathbf{\Theta})&=\|\bm{f}(\mathbf{X};\mathbf{\Theta})\mathbf{B}-\mathbf{Y}_{L}\|_{F}^2\\
&=\|(\bm{f}(\mathbf{X};\mathbf{\Theta})-\mathbf{Y})\mathbf{B}\|_{F}^2,
\end{aligned}
\label{loss}
\end{equation}
where $\bm{f}(\cdot;\mathbf{\Theta})$ is the neural networks (parameterized by $\mathbf{\Theta}$) used for feature embedding and conducting classification for landmarks, which is implemented by fully connected neural networks.
\subsection{Objective Function}
Based on above considerations, a novel landmark-based multi-label classification algorithm, \emph{i.e.}, Selecting Predictable Landmarks for Multi-Label Learning (SPL-MLL), is induced, which jointly learns landmark selection matrix, label correlation matrix, and landmark-oriented feature embedding in a unified framework. Specifically, the objective function of SPL-MLL for us to minimize is as follows:
\begin{equation}
\begin{aligned}
\mathcal{L}(\mathbf{B},&\mathbf{\Theta},\mathbf{A})=\mathbf{\Phi}(\mathbf{B},\mathbf{\Theta})+\mathbf{\Gamma}(\mathbf{B},\mathbf{A})\\
&=\|(\bm{f}(\mathbf{X};\mathbf{\Theta})-\mathbf{Y})\mathbf{B}\|_{F}^2\\
&+\|\mathbf{Y}-\mathbf{Y}\mathbf{B}\mathbf{A}\|_{F}^2+\lambda_1\|\mathbf{B}-\mathbf{I}\|_{F}^2+\lambda_2\|\mathbf{B}\|_{2,1}.\\
\end{aligned}
\label{loss-function}
\end{equation}
It is noteworthy that the critical role of matrix $\mathbf{B}$, which bridges the landmark selection and landmark classification model. With this strategy, the proposed model jointly selects predictable landmark labels, captures the correlations among labels, and discovers the nonlinear correlations between features and landmarks, accordingly, promotes the performance of multi-label prediction.
\subsection{Optimization}
Since the objective function of our SPL-MLL is not jointly convex for all the variables, we optimize our objective function by employing Alternating Direction Minimization(ADM) \cite{lin2011linearized} strategy. To optimize the objective function in Eq.~(\ref{loss-function}), we should solve three subproblems with respect to $\mathbf{\Theta}$, $\mathbf{B}$ and $\mathbf{A}$, respectively. The optimization is cycled over updating different blocks of variables.
We apply the technique of stochastic gradient descent for updating $\mathbf{\Theta}$, $\mathbf{B}$ and $\mathbf{A}$. The details of optimization are demonstrated as follows:\\
$\bullet$ Update networks. The back-propagation algorithm is employed to update the network parameters.\\
$\bullet$ Update $\mathbf{B}$. The gradient of $\mathcal{L}$ with respect to $\mathbf{B}$ can be derived as:
\begin{equation}
\begin{aligned}
\frac{\partial{\mathcal{L}}}{\partial{\mathbf{B}}}&=2(\bm{f}(\mathbf{X};\mathbf{\Theta})-\mathbf{Y})^T(\bm{f}(\mathbf{X};\mathbf{\Theta})-\mathbf{Y})\mathbf{B}\\
&-2\mathbf{Y}^T(\mathbf{Y}-\mathbf{Y}\mathbf{B}\mathbf{A})\mathbf{A}^T+2\lambda_1(\mathbf{B}-\mathbf{I})+2\lambda_2\mathbf{D}\mathbf{B},
\end{aligned}
\label{gradient-B}
\end{equation}
where $\mathbf{D}$ is a diagonal matrix with $D_{ii}=\frac{1}{{2||{\mathbf{B}_i}||}}$. Accordingly, gradient descent is employed based on Eq.~(\ref{gradient-B}). \\
$\bullet$ Update $\mathbf{A}$. The gradient of $\mathcal{L}$ with respect to $\mathbf{A}$ can be derived as:
\begin{equation}
\begin{aligned}
\frac{\partial{\mathcal{L}}}{\partial{\mathbf{A}}}&=-2\mathbf{B}^T\mathbf{Y}^T(\mathbf{Y}-\mathbf{Y}\mathbf{B}\mathbf{A}).\\
\end{aligned}
\label{gradient-A}
\end{equation}
then $\mathbf{A}$ is updated by applying gradient descent based on Eq.~(\ref{gradient-A}).
The optimization procedure of SPL-MLL is summarized as Algorithm 1.
Once the model of SPL-MLL is obtained, it can be easily applied for predicting the labels of test samples. Specifically, given a test input $\mathbf{x}$, it will be first transformed into $\bm{f}(\mathbf{x};\mathbf{\Theta})$, followed by utilizing the learned mappings $\mathbf{B}$ and $\mathbf{A}$ to predict its all possible labels with $\mathbf{y} = \bm{f}(\mathbf{x};\mathbf{\Theta}) \mathbf{B}\mathbf{A}$.
\begin{algorithm}[t]
\SetAlgoLined
\caption{Algorithm of SPL-MLL}
\KwIn{Feature matrix $ \mathbf{X} \in \mathbb{R}^{N \times D}$, label matrix $ \mathbf{Y} \in \mathbb{R}^{N \times C}$, parameters $\lambda_1 , \lambda_2$.}
\textbf{Initialize:} $ \mathbf{B}=\mathbf{I}$, initialize randomly $ \mathbf{A} $.\\
\While{not converged}{
Update the parameters $\mathbf{\Theta}$ of $\bm{f}(\cdot;\mathbf{\Theta})$;\\
Update $\mathbf{B}$ by Eq.(\ref{gradient-B});\\
Update $\mathbf{A}$ by Eq.(\ref{gradient-A});\\
}
\KwOut{$\bm{f}(\cdot;\mathbf{\Theta}),\mathbf{B},\mathbf{A} $.
\label{alg:alg1}
\end{algorithm}
\section{Experiments}
\subsection{Experiment Settings}
We conduct experiments on the following benchmark multi-label datasets: emotions \cite{trohidis2008multi}, yeast \cite{elisseeff2002kernel}, tmc2007 \cite{chartemultilabel}, scene \cite{boutell2004learning}, espgame \cite{von2004labeling} and pascal VOC 2007 \cite{everingham2010pascal}. Specifically, emotions and yeast are used for music and gene functional classification, respectively; tmc2007 is a large-scale text dataset, while scene, espgame and pascal voc 2007 belong to the domain of image.
The description of features for emotions, yeast, tmc2007 and scene could be referred in \cite{trohidis2008multi,elisseeff2002kernel,chartemultilabel,boutell2004learning}.
For espgame and pascal voc 2007, the local descriptor DenseSift \cite{lowe2004distinctive} is used. These datasets can be found in Mulan \footnote[1]{http://mulan.sourceforge.net/datasets-mlc.html\label{footnote1}} and LEAR websites \footnote[2]{http://lear.inrialpes.fr/people/guillaumin/data.php\label{footnote2}}. The detailed statistics information of each dataset is listed in Table \ref{tab:addlabel1}. We employ the standard partitions for training and testing sets \textsuperscript{\ref {footnote1},\ref {footnote2}}.
For the proposed SPL-MLL, we utilize neural networks for feature embedding and classification. The networks consists of 2 layers: for the first and second fully connected layer, 512 and 64 neurons are deployed, respectively. A leaky ReLU activation function is employed with the batch size being 64. In addition, we initialize the matrix $\mathbf{B}$ with $\mathbf{B}=\mathbf{I}$ which captures the most sparse correlation among labels and is beneficial to landmark selection. The regularization parameters, i.e., $\lambda_1$ and $\lambda_2$ are both fixed as 0.1 for all datasets and promising performance is obtained. In our experiments, we set the constraint $\mathbf{B}_{ij}=0,i \neq j$ in each iteration of optimization. This strictly guarantees the diagonal property and can provide clear interpretability for landmarks. The experimental results show that both convergence of our model and promising performance are achieved with this constraint.
\vspace{-0.5cm}
\begin{table}[htbp]
\centering
\caption{Statistics of datasets.}
\setlength{\tabcolsep}{2.5mm}{
\begin{tabular}{cccccc}
\hline
dataset & \#instances & \#features & \#labels & cardinality & domain \\
\hline
emotions & 593 & 72 & 6 & 1.9 & music \\
scene & 2407 & 294 & 6 & 1.1 & image \\
yeast & 2417 & 103 & 14 & 4.2 & biology \\
tmc2007 & 28596 & 500 & 22 & 2.2 & text \\
espgame & 20770 & 1000 & 268 & 4.7 & image \\
pascal VOC 2007 & 9963 & 1000 & 20 & 1.5 & image \\
\hline
\end{tabular}}%
\label{tab:addlabel1}%
\end{table}%
Five diverse metrics are employed for performance evaluation. For \emph{Hamming loss} and \emph{Ranking loss}, smaller value indicates better classification quality, while larger value of \emph{Average precision}, \emph{Macro-F1} and \emph{Micro-F1} means better performance. These evaluation metrics evaluate the performance of multi-label predictor from various aspects, and details of these evaluation metrics can be found in \cite{zhang2014review}. 10-fold cross-validation is performed for each method, which randomly holds 1/10 of training data for validation during each fold. We repeat each experiment 10 times and report the averaged results with standard derivations.
\subsection{Experimental Results}
\subsubsection{Comparison with state-of-the-art multi-label classification methods}
\begin{table*}[!ht]\small
\centering
\renewcommand\arraystretch{0.75}
\caption{ Comparing results (mean $\pm$ std.) of multi-label learning algorithms. $\downarrow$ ($\uparrow$) indicates the smaller (larger), the better. The values in red and blue indicate the best and the second best performances, respectively. $\bullet$ indicates that ours is better than the compared algorithms.}
\resizebox{4.8in}{!}{
\begin{tabular}{ccccccc}
\toprule[1pt]
Datasets & Methods & Ranking Loss $\downarrow$ & Hamming Loss $\downarrow$ & Average Precision $\uparrow$ & Micro-F1 $\uparrow$ & Macro-F1 $\uparrow$ \\
\midrule[0.5pt]
\multirow{11}[10]{*}{emotions} & BR \cite{tsoumakas2007multi} & 0.309$\pm$0.021$\bullet$ & 0.265$\pm$0.015$\bullet$ & 0.687$\pm$0.017$\bullet$ & 0.592$\pm$0.025$\bullet$ & 0.590$\pm$0.016$\bullet$ \\
& LP \cite{boutell2004learning} & 0.345$\pm$0.022$\bullet$ & 0.277$\pm$0.010$\bullet$ & 0.661$\pm$0.018$\bullet$ & 0.533$\pm$0.016$\bullet$ & 0.504$\pm$0.019$\bullet$ \\
& ML-kNN \cite{zhang2007ml} & 0.173$\pm$0.015$\bullet$ & 0.209$\pm$0.021$\bullet$ & 0.794$\pm$0.016$\bullet$ & 0.650$\pm$0.031$\bullet$ & 0.607$\pm$0.033$\bullet$ \\
& EPS \cite{read2008multi} & 0.183$\pm$0.014$\bullet$ & 0.208$\pm$0.010$\bullet$ & 0.780$\pm$0.017$\bullet$ & 0.664$\pm$0.012$\bullet$ & 0.655$\pm$0.018$\bullet$ \\
& ECC \cite{read2011classifier} & 0.198$\pm$0.021$\bullet$ & 0.228$\pm$0.022$\bullet$ & 0.766$\pm$0.014$\bullet$ & 0.617$\pm$0.013$\bullet$ & 0.597$\pm$0.019$\bullet$ \\
& RAkEL \cite{tsoumakas2011random} & 0.217$\pm$0.026$\bullet$ & 0.219$\pm$0.013$\bullet$ & 0.766$\pm$0.031$\bullet$ & 0.634$\pm$0.023$\bullet$ & 0.618$\pm$0.036$\bullet$ \\
& CLR \cite{furnkranz2008multilabel} & 0.199$\pm$0.024$\bullet$ & 0.255$\pm$0.012$\bullet$ & 0.762$\pm$0.024$\bullet$ & 0.614$\pm$0.037$\bullet$ & 0.601$\pm$0.038$\bullet$ \\
& MLML \cite{hou2016multi} & 0.184$\pm$0.015$\bullet$ & 0.197$\pm$0.013$\bullet$ & 0.719$\pm$0.018$\bullet$ & 0.661$\pm$0.039$\bullet$ & 0.650$\pm$0.047$\bullet$ \\
& MLFE \cite{zhang2018feature} & 0.181$\pm$0.012$\bullet$ & 0.217$\pm$0.020$\bullet$ & 0.782$\pm$0.013$\bullet$ & 0.674$\pm$0.026$\bullet$ & 0.663$\pm$0.021$\bullet$ \\
& HNOML \cite{zhang2019hybrid} & 0.173$\pm$0.012$\bullet$ & 0.192$\pm$0.005$\bullet$ & 0.784$\pm$0.011$\bullet$ & 0.672$\pm$0.014$\bullet$ & 0.660$\pm$0.029$\bullet$ \\
& Ours (linear) & \textcolor{blue}{0.172$\pm$0.006}$\hspace*{1.6mm}$ & \textcolor{blue}{0.184$\pm$0.015}$\hspace*{1.6mm}$ & \textcolor{blue}{0.798$\pm$0.011}$\hspace*{1.6mm}$ & \textcolor{blue}{0.686$\pm$0.013}$\hspace*{1.6mm}$ & \textcolor{blue}{0.675$\pm$0.031}$\hspace*{1.6mm}$ \\
& Ours & \textcolor{red}{0.170$\pm$0.004}$\hspace*{1.6mm}$ & \textcolor{red}{0.175$\pm$0.021}$\hspace*{1.6mm}$ & \textcolor{red}{0.815$\pm$0.014}$\hspace*{1.6mm}$ & \textcolor{red}{0.698$\pm$0.021}$\hspace*{1.6mm}$ & \textcolor{red}{0.687$\pm$0.024}$\hspace*{1.6mm}$ \\
\hline
\multirow{11}[10]{*}{yeast} & BR \cite{tsoumakas2007multi} & 0.322$\pm$0.011$\bullet$ & 0.253$\pm$0.004$\bullet$ & 0.614$\pm$0.008$\bullet$ & 0.569$\pm$0.014$\bullet$ & 0.386$\pm$0.011$\bullet$ \\
& LP \cite{boutell2004learning} & 0.408$\pm$0.008$\bullet$ & 0.282$\pm$0.005$\bullet$ & 0.566$\pm$0.008$\bullet$ & 0.519$\pm$0.023$\bullet$ & 0.361$\pm$0.025$\bullet$ \\
& ML-kNN \cite{zhang2007ml} & \textcolor{blue}{0.171$\pm$0.006}$\hspace*{1.6mm}$ & 0.218$\pm$0.004$\bullet$ & 0.757$\pm$0.011$\bullet$ & 0.636$\pm$0.012$\bullet$ & 0.357$\pm$0.021$\bullet$ \\
& EPS \cite{read2008multi} & 0.205$\pm$0.003$\bullet$ & 0.214$\pm$0.005$\bullet$ & 0.731$\pm$0.017$\bullet$ & 0.625$\pm$0.015$\bullet$ & 0.372$\pm$0.014$\bullet$ \\
& ECC \cite{read2011classifier} & 0.187$\pm$0.007$\bullet$ & 0.209$\pm$0.009$\bullet$ & 0.745$\pm$0.012$\bullet$ & 0.618$\pm$0.013$\bullet$ & 0.369$\pm$0.017$\bullet$ \\
& RAkEL \cite{tsoumakas2011random} & 0.250$\pm$0.005$\bullet$ & 0.232$\pm$0.005$\bullet$ & 0.710$\pm$0.009$\bullet$ & 0.632$\pm$0.009$\bullet$ & 0.430$\pm$0.012$\bullet$ \\
& CLR \cite{furnkranz2008multilabel} & 0.187$\pm$0.005$\bullet$ & 0.222$\pm$0.005$\bullet$ & 0.745$\pm$0.008$\bullet$ & 0.628$\pm$0.012$\bullet$ & 0.400$\pm$0.018$\bullet$ \\
& MLML \cite{hou2016multi} & 0.178$\pm$0.002$\bullet$ & 0.224$\pm$0.005$\bullet$ & 0.757$\pm$0.009$\bullet$ & 0.641$\pm$0.014$\bullet$ & 0.443$\pm$0.025$\bullet$ \\
& MLFE \cite{zhang2018feature} & \textcolor{red}{0.169$\pm$0.021}$\hspace*{1.6mm}$ & 0.227$\pm$0.010$\bullet$ & 0.754$\pm$0.012$\bullet$ & 0.646$\pm$0.013$\bullet$ & 0.415$\pm$0.011$\bullet$ \\
& HNOML \cite{zhang2019hybrid} & 0.179$\pm$0.007$\bullet$ & 0.222$\pm$0.004$\bullet$ & 0.757$\pm$0.011$\bullet$ & 0.648$\pm$0.006$\bullet$ & 0.421$\pm$0.016$\bullet$ \\
& Ours (linear) & 0.172$\pm$0.003$\hspace*{1.6mm}$ & \textcolor{blue}{0.210$\pm$0.008}$\hspace*{1.6mm}$ & \textcolor{blue}{0.769$\pm$0.006}$\hspace*{1.6mm}$ & \textcolor{blue}{0.659$\pm$0.012}$\hspace*{1.6mm}$ & \textcolor{blue}{0.443$\pm$0.016}$\hspace*{1.6mm}$ \\
& Ours & \textcolor{blue}{0.171$\pm$0.004}$\hspace*{1.6mm}$ & \textcolor{red}{0.201$\pm$0.006}$\hspace*{1.6mm}$ & \textcolor{red}{0.786$\pm$0.005}$\hspace*{1.6mm}$ & \textcolor{red}{0.667$\pm$0.011}$\hspace*{1.6mm}$ & \textcolor{red}{0.451$\pm$0.023}$\hspace*{1.6mm}$ \\
\hline
\multirow{11}[10]{*}{scene} & BR \cite{tsoumakas2007multi} & 0.236$\pm$0.017$\bullet$ & 0.136$\pm$0.004$\bullet$ & 0.715$\pm$0.011$\bullet$ & 0.609$\pm$0.014$\bullet$ & 0.616$\pm$0.025$\bullet$ \\
& LP \cite{boutell2004learning} & 0.219$\pm$0.010$\bullet$ & 0.149$\pm$0.006$\bullet$ & 0.722$\pm$0.010$\bullet$ & 0.585$\pm$0.016$\bullet$ & 0.592$\pm$0.011$\bullet$ \\
& ML-kNN \cite{zhang2007ml} & 0.093$\pm$0.009$\bullet$ & 0.095$\pm$0.008$\bullet$ & 0.851$\pm$0.016$\bullet$ & 0.718$\pm$0.015$\bullet$ & 0.719$\pm$0.024$\bullet$ \\
& EPS \cite{read2008multi} & 0.113$\pm$0.007$\bullet$ & 0.103$\pm$0.017$\bullet$ & 0.825$\pm$0.013$\bullet$ & 0.686$\pm$0.018$\bullet$ & 0.688$\pm$0.018$\bullet$ \\
& ECC \cite{read2011classifier} & 0.103$\pm$0.010$\bullet$ & 0.104$\pm$0.012$\bullet$ & 0.832$\pm$0.015$\bullet$ & 0.668$\pm$0.017$\bullet$ & 0.671$\pm$0.016$\bullet$ \\
& RAkEL \cite{tsoumakas2011random} & 0.106$\pm$0.005$\bullet$ & 0.106$\pm$0.005$\bullet$ & 0.829$\pm$0.007$\bullet$ & 0.636$\pm$0.023$\bullet$ & 0.644$\pm$0.019$\bullet$ \\
& CLR \cite{furnkranz2008multilabel} & 0.106$\pm$0.003$\bullet$ & 0.138$\pm$0.003$\bullet$ & 0.817$\pm$0.006$\bullet$ & 0.612$\pm$0.026$\bullet$ & 0.620$\pm$0.025$\bullet$ \\
& MLML \cite{hou2016multi} & 0.079$\pm$0.004$\bullet$ & 0.098$\pm$0.013$\bullet$ & \textcolor{blue}{0.862$\pm$0.010}$\bullet$ & 0.728$\pm$0.029$\bullet$ & 0.729$\pm$0.029$\bullet$ \\
& MLFE \cite{zhang2018feature} & 0.079$\pm$0.002$\bullet$ & 0.094$\pm$0.003$\bullet$ & 0.858$\pm$0.013$\bullet$ & 0.732$\pm$0.021$\bullet$ & 0.734$\pm$0.019$\bullet$ \\
& HNOML \cite{zhang2019hybrid} & 0.103$\pm$0.005$\bullet$ & 0.110$\pm$0.003$\bullet$ & 0.832$\pm$0.108$\bullet$ & 0.733$\pm$0.011$\bullet$ & 0.736$\pm$0.013$\bullet$ \\
& Ours (linear) & \textcolor{blue}{0.073$\pm$0.003}$\hspace*{1.6mm}$ & \textcolor{blue}{0.083$\pm$0.006}$\hspace*{1.6mm}$ & 0.861$\pm$0.005$\hspace*{1.6mm}$ & \textcolor{blue}{0.738$\pm$0.012}$\hspace*{1.6mm}$ & \textcolor{blue}{0.742$\pm$0.021}$\hspace*{1.6mm}$ \\
& Ours & \textcolor{red}{0.067$\pm$0.003}$\hspace*{1.6mm}$ & \textcolor{red}{0.074$\pm$0.004}$\hspace*{1.6mm}$ & \textcolor{red}{0.884$\pm$0.005}$\hspace*{1.6mm}$ & \textcolor{red}{0.746$\pm$0.016}$\hspace*{1.6mm}$ & \textcolor{red}{0.753$\pm$0.024}$\hspace*{1.6mm}$ \\
\hline
\multirow{11}[10]{*}{espgame} & BR \cite{tsoumakas2007multi} & 0.266$\pm$0.003$\bullet$ & 0.019$\pm$0.002$\bullet$ & 0.221$\pm$0.001$\bullet$ & 0.205$\pm$0.004$\bullet$ & 0.116$\pm$0.001$\bullet$ \\
& LP \cite{boutell2004learning} & 0.496$\pm$0.003$\bullet$ & 0.031$\pm$0.001$\bullet$ & 0.055$\pm$0.004$\bullet$ & 0.109$\pm$0.003$\bullet$ & 0.060$\pm$0.002$\bullet$ \\
& ML-kNN \cite{zhang2007ml} & 0.238$\pm$0.001$\bullet$ & \textcolor{blue}{0.017$\pm$0.002}$\hspace*{1.6mm}$ & 0.255$\pm$0.003$\bullet$ & 0.039$\pm$0.002$\bullet$ & 0.020$\pm$0.001$\bullet$ \\
& EPS \cite{read2008multi} & 0.380$\pm$0.001$\bullet$ & \textcolor{blue}{0.017$\pm$0.001}$\hspace*{1.6mm}$ & 0.200$\pm$0.003$\bullet$ & 0.083$\pm$0.002$\bullet$ & 0.065$\pm$0.001$\bullet$ \\
& ECC \cite{read2011classifier} & 0.230$\pm$0.001$\bullet$ & 0.020$\pm$0.002$\bullet$ & 0.282$\pm$0.001$\bullet$ & 0.245$\pm$0.004$\bullet$ & 0.123$\pm$0.001$\bullet$ \\
& RAkEL \cite{tsoumakas2011random} & 0.343$\pm$0.001$\bullet$ & 0.019$\pm$0.001$\bullet$ & 0.211$\pm$0.003$\bullet$ & 0.150$\pm$0.003$\bullet$ & 0.059$\pm$0.001$\bullet$ \\
& CLR \cite{furnkranz2008multilabel} & \textcolor{red}{0.196$\pm$0.001}$\hspace*{1.6mm}$ & 0.019$\pm$0.001$\bullet$ & \textcolor{red}{0.305$\pm$0.003}$\hspace*{1.6mm}$ & 0.266$\pm$0.004$\bullet$ & 0.143$\pm$0.001$\bullet$ \\
& MLML \cite{hou2016multi} & 0.317$\pm$0.000$\bullet$ & 0.019$\pm$0.003$\bullet$ & 0.086$\pm$0.002$\bullet$ & 0.103$\pm$0.003$\bullet$ & 0.060$\pm$0.002$\bullet$ \\
& MLFE \cite{zhang2018feature} & 0.312$\pm$0.012$\bullet$ & 0.020$\pm$0.001$\bullet$ & 0.268$\pm$0.011$\bullet$ & 0.260$\pm$0.003$\bullet$ & 0.134$\pm$0.004$\bullet$ \\
& HNOML \cite{zhang2019hybrid} & 0.221$\pm$0.001$\bullet$ & 0.019$\pm$0.003$\bullet$ & 0.271$\pm$0.003$\bullet$ & 0.263$\pm$0.006$\bullet$ & 0.132$\pm$0.004$\bullet$ \\
& Ours (linear) & 0.223$\pm$0.002$\hspace*{1.6mm}$ & \textcolor{blue}{0.017$\pm$0.001}$\hspace*{1.6mm}$ & 0.289$\pm$0.002$\hspace*{1.6mm}$ & \textcolor{blue}{0.269$\pm$0.002}$\hspace*{1.6mm}$ & \textcolor{blue}{0.143$\pm$0.002}$\hspace*{1.6mm}$ \\
& Ours & \textcolor{blue}{0.220$\pm$0.003}$\hspace*{1.6mm}$ & \textcolor{red}{0.016$\pm$0.001}$\hspace*{1.6mm}$ & \textcolor{blue}{0.291$\pm$0.002}$\hspace*{1.6mm}$ & \textcolor{red}{0.276$\pm$0.004}$\hspace*{1.6mm}$ & \textcolor{red}{0.149$\pm$0.001}$\hspace*{1.6mm}$ \\
\hline
\multirow{11}[10]{*}{tmc2007} & BR \cite{tsoumakas2007multi} & 0.037$\pm$0.007$\bullet$ & 0.031$\pm$0.004$\bullet$ & 0.899$\pm$0.025$\bullet$ & 0.834$\pm$0.014$\bullet$ & 0.719$\pm$0.011$\bullet$ \\
& LP \cite{boutell2004learning} & 0.324$\pm$0.018$\bullet$ & 0.041$\pm$0.006$\bullet$ & 0.594$\pm$0.012$\bullet$ & 0.791$\pm$0.008$\bullet$ & 0.721$\pm$0.004$\bullet$ \\
& ML-kNN \cite{zhang2007ml} & 0.031$\pm$0.006$\bullet$ & 0.058$\pm$0.004$\bullet$ & 0.844$\pm$0.017$\bullet$ & 0.682$\pm$0.003$\bullet$ & 0.493$\pm$0.002$\bullet$ \\
& EPS \cite{read2008multi} & 0.021$\pm$0.004$\bullet$ & 0.033$\pm$0.005$\bullet$ & 0.927$\pm$0.007$\bullet$ & 0.829$\pm$0.009$\bullet$ & 0.722$\pm$0.010$\bullet$ \\
& ECC \cite{read2011classifier} & 0.017$\pm$0.006$\bullet$ & 0.026$\pm$0.003$\bullet$ & 0.925$\pm$0.006$\bullet$ & 0.862$\pm$0.014$\bullet$ & 0.763$\pm$0.007$\bullet$ \\
& RAkEL \cite{tsoumakas2011random} & 0.038$\pm$0.008$\bullet$ & 0.024$\pm$0.002$\bullet$ & 0.923$\pm$0.005$\bullet$ & 0.870$\pm$0.011$\bullet$ & 0.756$\pm$0.006$\bullet$ \\
& CLR \cite{furnkranz2008multilabel} & 0.018$\pm$0.005$\bullet$ & 0.034$\pm$0.004$\bullet$ & 0.923$\pm$0.011$\bullet$ & 0.825$\pm$0.013$\bullet$ & 0.711$\pm$0.011$\bullet$ \\
& MLML \cite{hou2016multi} & 0.018$\pm$0.001$\bullet$ & 0.021$\pm$0.001$\bullet$ & 0.921$\pm$0.002$\bullet$ & 0.865$\pm$0.011$\bullet$ & 0.769$\pm$0.008$\bullet$ \\
& MLFE \cite{zhang2018feature} & 0.021$\pm$0.002$\bullet$ & 0.022$\pm$0.001$\bullet$ & 0.924$\pm$0.013$\bullet$ & 0.873$\pm$0.015$\bullet$ & 0.771$\pm$0.011$\bullet$ \\
& HNOML \cite{zhang2019hybrid} & 0.023$\pm$0.002$\bullet$ & 0.017$\pm$0.001$\bullet$ & 0.919$\pm$0.003$\bullet$ & 0.858$\pm$0.014$\bullet$ & 0.762$\pm$0.016$\bullet$ \\
& Ours (linear) & \textcolor{blue}{0.015$\pm$0.003}$\hspace*{1.6mm}$ & \textcolor{blue}{0.013$\pm$0.002}$\hspace*{1.6mm}$ & \textcolor{blue}{0.937$\pm$0.007}$\hspace*{1.6mm}$ & \textcolor{blue}{0.912$\pm$0.008}$\hspace*{1.6mm}$ & \textcolor{blue}{0.781$\pm$0.005}$\hspace*{1.6mm}$ \\
& Ours & \textcolor{red}{0.012$\pm$0.004}$\hspace*{1.6mm}$ & \textcolor{red}{0.011$\pm$0.001}$\hspace*{1.6mm}$ & \textcolor{red}{0.945$\pm$0.007}$\hspace*{1.6mm}$ & \textcolor{red}{0.944$\pm$0.007}$\hspace*{1.6mm}$ & \textcolor{red}{0.792$\pm$0.010}$\hspace*{1.6mm}$ \\
\bottomrule[1pt]
\end{tabular}}%
\label{tab:addlabel2}%
\end{table*}%
We compare our algorithm with both baseline and state-of-the-art multi-label classification methods. The binary relevance (BR) \cite{tsoumakas2007multi} and label powerset (LP) \cite{boutell2004learning} act as baselines. We also compare ours with two ensemble methods, \emph{i.e.}, ensemble of pruned sets (EPS) \cite{read2008multi} and ensemble of classifier chains (ECC) \cite{read2011classifier}, second-order approach - calibrated label ranking (CLR) \cite{furnkranz2008multilabel} and high-order approach - random k-labelsets (RAkEL) \cite{tsoumakas2011random}, the lazy multi-label methods based on k-nearest neighbors (ML-kNN)\cite{zhang2007ml} and feature-aware approach - multi-label manifold learning (MLML) \cite{hou2016multi}, labeling information enrichment approach - Multi-label Learning with Feature-induced labeling information Enrichment(MLFE) \cite{zhang2018feature} and robust approach for data with hybrid noise - hybrid noise-oriented multilabel learning (HNOML) \cite{zhang2019hybrid}.
We try our best to tune the parameters of all the above compared methods to the best performance according to the suggested ways in their literatures.
\vspace{-0.4cm}
\begin{table*}[ht]
\centering
\renewcommand\arraystretch{0.7}
\caption{Performance comparisons with approaches based on label space reduction.}
\setlength{\tabcolsep}{1.0mm}{
\begin{tabular}{cccccccc}
\hline
\multicolumn{2}{c}{Datasets} & \multicolumn{2}{c}{tmc2007} & \multicolumn{2}{c}{espgame} \\
\hline
Methods $\hspace*{2mm}/$ & Metrics & Micro-F1$\uparrow$ & Macro-F1$\uparrow$ & Micro-F1$\uparrow$ & Macro-F1$\uparrow$ \\
\hline
\multicolumn{2}{c}{MOPLMS \cite{Balasubramanian2012The}} & 0.556$\pm$0.012 & 0.421$\pm$0.013 & 0.032$\pm$0.006 & 0.025$\pm$0.005 \\
\multicolumn{2}{c}{ML-CSSP \cite{bi2013efficient}} & 0.604$\pm$0.014 & 0.432$\pm$0.015 & 0.035$\pm$0.004 & 0.023$\pm$0.006 \\
\multicolumn{2}{c}{PBR \cite{chen2012feature}} & 0.602$\pm$0.034 & 0.422$\pm$0.025 & 0.021$\pm$0.008 & 0.014$\pm$0.003 \\
\multicolumn{2}{c}{CPLST \cite{chen2012feature}} & 0.643$\pm$0.027 & 0.437$\pm$0.031 & 0.042$\pm$0.005 & 0.023$\pm$0.004 \\
\multicolumn{2}{c}{FAIE \cite{lin2014multi}} & 0.605$\pm$0.011 & 0.458$\pm$0.015 & 0.072$\pm$0.008 & 0.026$\pm$0.003 \\
\multicolumn{2}{c}{Deep CPLST} & 0.786$\pm$0.021 & 0.601$\pm$0.031 & 0.074$\pm$0.004 & 0.016$\pm$0.002 \\
\multicolumn{2}{c}{Deep FAIE} & 0.604$\pm$0.016 & 0.435$\pm$0.029 & 0.121$\pm$0.011 & 0.024$\pm$0.003 \\
\multicolumn{2}{c}{LEML \cite{yu2014large}} & 0.704$\pm$0.013 & 0.616$\pm$0.022 & 0.148$\pm$0.004 & 0.082$\pm$0.001 \\
\multicolumn{2}{c}{SLEEC \cite{bhatia2015sparse}} & 0.607$\pm$0.031 & 0.586$\pm$0.011 & 0.226$\pm$0.016 & 0.108$\pm$0.009 \\
\multicolumn{2}{c}{DC2AE \cite{yeh2017learning}} & 0.808$\pm$0.017 & 0.757$\pm$0.027 & 0.256$\pm$0.013 & 0.121$\pm$0.009 \\
\multicolumn{2}{c}{\textbf{Ours}} & \textbf{0.944$\pm$0.007} & \textbf{0.792$\pm$0.010} & \textbf{0.276$\pm$0.004} & \textbf{0.149$\pm$0.001} \\
\hline
\end{tabular}%
\label{tab:addlabel3}}%
\end{table*}%
As shown in Table \ref{tab:addlabel2}, we report the quantitative experimental results of different methods on the benchmark datasets. Because above comparison methods are not based on neural networks, for fair comparisons, we also report the results of our model using the linear projections instead of neural networks for feature embedding. For each algorithm, the averaged performance with standard deviation are reported in terms of different metrics. As for each metric, ``$\uparrow$" indicates the larger the better while ``$\downarrow$" indicates the smaller the better. The red number and blue number indicate the best and the second best performances, respectively. According to Table \ref{tab:addlabel2}, several observations are obtained as follows: 1) Compared with other multi-label classification methods, our algorithm achieves competitive performance on all the five benchmark datasets. For example, on emotions , scene and tmc2007, our SPL-MLL ranks as the first in terms of all metrics. 2) Compared with BR and LP, our SPL-MLL obtains much better performance on all datasets. The reason may be that these methods lack of sufficient ability to explore complex correlations among labels. 3) Compared with the three ensemble methods EPS, ECC and RAkEL, our algorithm always performs better, which further verifies the effectiveness of our SPL-MLL. 4) We also note that the performances of ML-kNN, CLR and MLML are also competitive, and the performances of CLR are slightly better than ours on espgame in terms of some metrics. However, the performances of ours are more stable and robust for different datasets. For example, CLR performs unpromising on emotions, yeast, and scene.
5) Furthermore, compared with the latest and most advanced approaches MLFE and HNOML, our model outperforms them on all datasets in terms of most metrics. In short, our proposed SPL-MLL achieves promising and stable performance compared with state-of-the-art multi-label classification methods.
\begin{figure}[htbp]
\centering
\includegraphics[width=3.1in, height = 1.8in]{figure/vis_B/Sample_emotions2.pdf}
\caption{ Visualization of the number of co-occurrence labels on emotions. `+' and `-' denote co-occurrence and no co-occurrence of two labels, respectively.}
\label{fig:Sample-emotions4}
\end{figure}
\vspace{-1.2cm}
\subsubsection{Comparison with label space reduction methods}
\begin{figure*}[!ht]
\centering
\subfigure[emotions]{
\includegraphics[width=2.2in, height = 1.8in]{figure/vis_B/emo_B_new.pdf}
}
\quad
\subfigure[scene]{
\includegraphics[width=2.2in, height = 1.8in]{figure/vis_B/sce_B_new.pdf}
}
\caption{Visualization of the landmark selection matrix $\mathbf{B}$.}
\label{fig:B3}
\end{figure*}
We compare our method with two typical landmark selection methods which conduct landmark selection with group-sparsity technique (MOPLMS) \cite{Balasubramanian2012The} and an efficient randomized sampling procedure (ML-CSSP) \cite{bi2013efficient}. Moreover, we compare our method with the label embedding multi-label classification methods, which jointly reduce the label space and explore the correlations among labels. Specifically, we conduct comparison with the following label embedding based methods: Conditional Principal Label Space Transformation (CPLST) \cite{chen2012feature}, Feature-aware Implicit Label space Encoding (FaIE) \cite{lin2014multi}, Low rank Empirical risk minimization for Multi-Label Learning (LEML) \cite{yu2014large}, Sparse Local Embeddings for Extreme Multi-label Classification (SLEEC) \cite{bhatia2015sparse}, and the baseline method of partial binary relevance (PBR) \cite{chen2012feature}. Furthermore, we replace the linear regressors in CPLST and FAIE with DNN regressors, and name them as Deep CPLST and Deep FAIE, respectively. The work in \cite{yeh2017learning} proposes a novel DNN architecture of Canonical-Correlated Autoencoder (C2AE), which can exploit label correlation effectively. Since some methods (e.g., C2AE) reported the results in terms of Micro-F1 and Macro-F1 \cite{tang2009large}, we also provides results of different approaches in terms of these two metrics for convenient comparison as shown in Table \ref{tab:addlabel3}. According to the results, it is observed that the performance of our model is much better than the landmark selection methods \cite{Balasubramanian2012The,bi2013efficient} which separate landmark selection and prediction in 2-step manner. Moreover, our SPL-MLL performs superiorly against these label embedding methods.
\vspace{-0.2cm}
\begin{table*}[!ht]\large
\centering
\renewcommand\arraystretch{1.1}
\caption{Ablation studies for our model on different setting on pascal VOC 2007.}
\resizebox{4.8in}{!}{
\begin{tabular}{c|ccccc}
\hline
Methods & Ranking Loss $\downarrow$ & Hamming Loss $\downarrow$ & Average Precision $\uparrow$ & Micro-F1 $\uparrow$ & Macro-F1 $\uparrow$ \\
\hline
MLFE \cite{zhang2018feature} & 0.232$\pm$0.013$\hspace*{1.6mm}$ & 0.162$\pm$0.012$\hspace*{1.6mm}$ & 0.565$\pm$0.022$\hspace*{1.6mm}$ & 0.436$\pm$0.026$\hspace*{1.6mm}$ & 0.357$\pm$0.011$\hspace*{1.6mm}$ \\
HNOML \cite{zhang2019hybrid} & 0.227$\pm$0.012$\hspace*{1.6mm}$ & 0.123$\pm$0.008$\hspace*{1.6mm}$ & 0.593$\pm$0.023$\hspace*{1.6mm}$ & 0.443$\pm$0.024$\hspace*{1.6mm}$ & 0.368$\pm$0.019$\hspace*{1.6mm}$ \\
\hline
NN-embeddings & 0.324$\pm$0.016$\hspace*{1.6mm}$ & 0.266$\pm$0.011$\hspace*{1.6mm}$ & 0.431$\pm$0.013$\hspace*{1.6mm}$ & 0.308$\pm$0.011$\hspace*{1.6mm}$ & 0.287$\pm$0.016$\hspace*{1.6mm}$\\
Ours(NN + separated) & 0.243$\pm$0.014$\hspace*{1.6mm}$ & 0.194$\pm$0.015$\hspace*{1.6mm}$ & 0.521$\pm$0.024$\hspace*{1.6mm}$ & 0.384$\pm$0.009$\hspace*{1.6mm}$ & 0.311$\pm$0.017$\hspace*{1.6mm}$ \\
Ours(joint + linear) & 0.192$\pm$0.011$\hspace*{1.6mm}$ & 0.095$\pm$0.012$\hspace*{1.6mm}$ & 0.608$\pm$0.021$\hspace*{1.6mm}$ & 0.516$\pm$0.025$\hspace*{1.6mm}$ & 0.422$\pm$0.024$\hspace*{1.6mm}$ \\
Ours(joint + NN) & \textbf{0.184$\pm$0.012}$\hspace*{1.6mm}$ & \textbf{0.083$\pm$0.013}$\hspace*{1.6mm}$ & \textbf{0.616$\pm$0.018}$\hspace*{1.6mm}$ & \textbf{0.586$\pm$0.018}$\hspace*{1.6mm}$ & \textbf{0.495$\pm$0.017}$\hspace*{1.6mm}$ \\
\hline
\end{tabular}}%
\label{tab:addlabel4}%
\end{table*}%
\vspace{-0.4cm}
\subsubsection{Ablation Studies}
To investigate the advantage of our model on jointly conducting landmark selection, landmark prediction and label recovery in a unified
framework, we further conduct comparison and ablation experiments on pascal VOC 2007. Specifically, we conduct ablation studies for our model under the following settings: (1) NN-embeddings: the features are directly encoded by neural network for full label recovery without landmark selection and landmark prediction; (2) Ours (NN + separated): our model is still based on the landmark selection strategy, but separates the landmark selection and landmark prediction in the 2-step manner like the work \cite{Balasubramanian2012The}; (3) Ours (joint + linear): our model employs the linear projections instead of neural networks for feature embedding. To further validate the performance improvement from our model, we also report the results of the latest and most advanced approaches MLFE \cite{zhang2018feature} and HNOML \cite{zhang2019hybrid}. The comparision results are shown in Table \ref{tab:addlabel4}, which validates the superiority of conducting landmark selection, landmark prediction and label recovery in a unified framework.
\subsubsection{Insight for selected landmarks}
To investigate the improvement of SPL-MLL, we visualize the landmark selection matrix $\mathbf{B}$ on emotions and scene. As illustrated in Fig.~\ref{fig:B3}, the values in yellow on the diagonal are much larger than the values in other colors, where the corresponding labels are selected landmarks. For emotions, ``Amazed" and ``Quiet" are most likely to be landmark labels, and ``Amazed" is often accompanied by ``Angry" in music, ``Quiet" tends to occur simultaneously with ``Relaxing" or ``Sad". Thus, we can utilize the selected landmark labels to recover other related labels effectively. Similar, for scene, the label ``FallFoliage" and ``Field" are most likely to be landmark labels.
As shown in Fig.~\ref{fig:Sample-emotions4}, we count the number of those samples with or without ``Angry" when having ``Amazed", which is represented as ``Amazed $\pm$ Angry", and similarly we obtain ``Quiet $\pm$ Relaxing" and ``Quiet $\pm$ Sad". According to Fig.~\ref{fig:Sample-emotions4}, it is observed that when the ``Amazed" (``Quiet") emotion occurs, the probability that ``Angry" (``Relaxing" and ``Sad") occur simultaneously is $56\%$ ($70\%$ and $71\%$). This statistics further support the reasonability of the selected landmark labels.
\begin{figure*}[htbp]
\centering
\includegraphics[width=4.8in]{figure/Esp+Sce_images_landmark_failed.pdf}
\caption{Example predictions on espgame and scene. }
\label{fig:images5}
\end{figure*}
\vspace{-0.3cm}
\subsubsection{Result visualization \& convergence experiment}
For intuitive analysis, Fig.~\ref{fig:images5} shows some representative examples from espgame and scene. The correctly predicted landmark labels from our model are in red, while the labels in green, gray and black indicate the successfully predicted, missed predicted and wrongly predicted labels. Generally, although multi-label classification is rather challenging especially for the large label set, our model achieves competitive results. We find that a few labels of some samples are not correctly predicted, and the possible reasons are as follows. First, a few labels on some samples do not obviously correlate with other labels, which makes it difficult to accurately recover given selected landmark labels. Second, a few labels for some samples are associated with very small parts in images, making it difficult to predict accurately even taking the feature of images into account in our model. For example, the image labeled with ``Kitchen" and ``Dining" as landmark labels has the following labels predicted correctly: ``Table", ``Chair", ``Room", ``Light", ``Restaurant" and ``Door". However, there are labels: ``Sun" and ``Flower" failed to be predicted. The main reasons is that the label ``Sun" and ``Flower" may be not strongly correlated with the selected landmark labels in the dataset.
There are a few landmarks failed to be predicted for some samples, even though our model aims to select predictable landmark labels. For example, for the rightmost picture in the bottom of Fig.~\ref{fig:images5}, we predict successfully ``Sky" and ``Man" as landmarks while not able to obtain the more critical landmark label ``Parachuting", which leads to failure prediction for ``Falling", ``Fall", ``Skydiving", ``Parachuting". It can be seen that the parachute is rather difficult to predict due to the strong illumination.
\begin{figure*}[!ht]
\centering
\subfigure[emotions]{
\includegraphics[width=1.4in, height = 1.1in]{figure/loss_train_emotions_800_2.pdf}
}
\quad
\subfigure[tmc2007]{
\includegraphics[width=1.4in, height = 1.1in]{figure/loss_train_tmc2007_200_2.pdf}
}
\quad
\subfigure[yeast]{
\includegraphics[width=1.4in, height = 1.1in]{figure/loss_train_yeast_800_2.pdf}
}
\quad
\caption{Convergence experiment.}
\label{fig:loss-curve6}
\end{figure*}
Fig.~\ref{fig:loss-curve6} gives the convergence experiments on emotion, yeast and tmc2007. Obviously, the results demonstrate that our method can converge within a small number of iterations.
\section{Conclusions \& Future Work}
In this paper, we proposed a novel landmark-based multi-label classification algorithm, termed \emph{SPL-MLL: Selecting Predictable Landmarks for Multi-Label Learning}. SPL-MLL jointly takes the representative and predictable properties for landmarks in a unified framework, avoiding separating landmark selection/prediction in the 2-step manner. Our key idea lies in selecting explicitly the landmarks which are both representative and predictable. The empirical experiments clearly demonstrate that our algorithm outperforms existing state-of-the-art methods. In the future, we will consider the end-to-end manner to extend our model for image annotation with large label set.
\subsubsection{Acknowledgements.} This work is supported by the National Natural Science Foundation of China (Nos. 61976151, 61732011 and 61872190).
\bibliographystyle{splncs04}
| {'timestamp': '2020-08-18T02:16:49', 'yymm': '2008', 'arxiv_id': '2008.06883', 'language': 'en', 'url': 'https://arxiv.org/abs/2008.06883'} | arxiv |
\section{Introduction}
The ability to segment the visual field into coherently moving regions is among the traits most broadly shared among visual animals \cite{albright1995visual,gibson2014ecological,goldstein2016sensation}.
Even camouflaged, moving objects are easy to spot (Fig. \ref{fig:lizard-sloth}).
During early development, humans spend considerable amounts of time interacting with a single moving object before losing interest \cite{bambach2018toddler}, which may help prime object models and learn invariances \cite{spelke1990principles}.
In contrast, the mature visual system can learn an object with a few static examples; objects do not need to move in order to be detected. This suggests using motion as a cue to bootstrap object models that can be used for detection in static images, with no need for explicit supervision.
Objects that have never been seen moving are considered part of whatever background they are part of, at least until they move.
As time goes by, more and more objects are seen moving, thus improving one's ability to detect and segment objects in static images (Tab.~\ref{tab:chi-improves}).
The more objects are bootstrapped in a bottom-up fashion, the easier they are to detect top-down, priming better motion discrimination, which in turn results in more accurate object detection.
This synergistic loop gradually improves both the diversity of objects that can be detected and the accuracy of the detection.
\begin{figure}[!t]
\centering
\includegraphics[width=0.47\textwidth]{figures/move_static.png}
\vspace{-0.1cm}
\caption{Dynamic-static bootstrapping. (a) A lizard is hard to detect when still thanks to camouflage (top left). However, it is easy to see once it moves (bottom left; optical flow visualized using the inset color wheel). Once learned the lizard, a never-before-seen sloth (b) can be easily detected in a static image, exploiting the static model learned from the moving lizard.}
\vspace{-0.2cm}
\label{fig:lizard-sloth}
\end{figure}
\begin{figure*}[!t]
\centering
\includegraphics[width=0.85\textwidth]{figures/system_new.pdf}
\vspace{-0.0cm}
\caption{System overview. {\color{orange} Dynamic}: motion segmentation model described in Sec.~\ref{subsec:CIS_TC_SP}; {\color{ceruleanblue} Static}: object model described in Sec.~\ref{subsec:static_object}. The training (``dynamic-static bootstrapping'' in Sec.~\ref{subsec:joint_percept}) iterates between these two models. In particular, once $\chi$ (static object model) is trained, it can be used as a ``top-down'' object prior to bias the motion segmentation network $\phi$ (dynamic model) in a feedback loop. $\psi$ is the adversarial inpainting network that enforces minimal mutual information between motion field partitions (two $\psi$'s are identical), and losses are represented using dashed lines/boxes.}
\vspace{-0.2cm}
\label{fig:system}
\end{figure*}
We present a method to learn object segmentation using unlabeled videos, that at test time can be used for both moving objects in videos and static objects in single images.
The method uses a motion segmentation module that performs temporally consistent region separation. The resulting motion segmentation primes a detector that operates on static images, and feeds back to the motion segmentation module, reinforcing it. We call this method Dynamic-Static Bootstrapping, or {\em DyStaB}.
During training, the dynamic model minimizes the mutual information between partitions of the motion field, while enforcing temporal consistency, which yields a state-of-the-art unsupervised motion segmentation method. Putative regions, along with their uncertainty approximated during the computation of mutual information in the dynamic model, are used to train a static model.
The static model is then fed back as a regularizer in a top-down fashion, completing the synergistic loop.
One might argue that every pixel in the image back-projects to something in space that we could call an object.
However, the training data biases the process towards objects that exist at a scale that is detectable relative to the size of the pixel and the magnitude of the motion. For instance, individual leaves in an outdoor video might not be seen at a resolution that allows detecting them as independent objects. Instead, the tree may be detected as moving coherently.
So, the definition of objects is conditioned on the training data and, in particular, the scale and distribution of their size and relative motion.
With this caveat, our contribution is two-fold: First, a deep neural network trained with unlabeled videos that achieves state-of-the-art performance in motion segmentation. It exploits mutual information separation and temporal consistency to identify candidate objects. Second, a deep neural network to perform object segmentation in single images, bootstrapped from the first. The static model uses as input both the output of the dynamic model and its uncertainty, to avoid self-learning. The two models are trained jointly in a synergistic loop. The resulting object segmentation models outperform the state of the art by 10\% in average precision in both video and static object segmentation across six standard benchmarks. Despite not requiring any manual annotation, our method also outperforms recent supervised ones by almost 5\% on average.
\begin{figure*}[!t]
\centering
\begin{minipage}[t]{.55\textwidth}
\centering
\includegraphics[trim={0.55cm 0.0cm 0 0},clip,width=.95\linewidth]{figures/conditional.pdf}
\vspace{-0.0cm}
\caption{A single image $\mathrm{I}$, renders possible motion fields $\mathbf{u}$ of an independently moving object as if they are sampled from the conditional distribution $\mathrm{p}(\mathbf{u}|\mathrm{I})$. Thus, given the image, one can complete partial observations of the flow fields in Fig.~\ref{fig:over-under}.}
\vspace{-0.2cm}
\label{fig:conditional}
\end{minipage}
\hspace{0.2cm}
\begin{minipage}[t]{.33\textwidth}
\centering
\includegraphics[width=.75\linewidth]{figures/over-under-proper.pdf}
\vspace{-0.1cm}
\caption{With image $\mathrm{I}$ in Fig.~\ref{fig:conditional}, only the mask in (c) minimizes mutual information between flow fields of the object (inside mask) and the background (outside mask).}
\vspace{-0.2cm}
\label{fig:over-under}
\end{minipage}
\end{figure*}
\section{Related Work}
{\bf Motion segmentation} aims to identify independently moving regions in a video.
Background subtraction assumes a static camera \cite{stauffer2000learning,elgammal2002background,radke2005image}, while scene dynamic models compensate for camera motion \cite{mittal2004motion,patwardhan2008robust,sheikh2009background}.
One could directly segment or cluster pixel-wise motion vectors \cite{weiss1997smoothness,shi1998motion,kumar2008learning,papazoglou2013fast}, but this approach is prone to errors due to occlusions, singularities and discontinuities of the motion field.
To increase robustness, some employ pixel trajectories accumulated over multiple frames \cite{brox2010object,keuper2015motion,xu2015unsupervised,shen2018submodular} or patches, losing discriminative power. The hard trade-off between discriminability and robustness is a key challenge in unsupervised motion segmentation. Manual pixel-level annotations help set the trade-off, but in a non-scalable manner \cite{fragkiadaki2015learning,tokmakov2017learning,xiao2018monet,hu2018motion,dave2019towards}. Contextual Information Separation \cite{yang2019unsupervised} aims to bypass this trade-off without the need for human annotation, using a segmentation network to minimize the mutual information between the inside and the outside of putative motion regions. In the absence of temporal consistency, this procedure can be sensitive to motion errors (Fig.~\ref{fig:effective-TC-SP}). Furthermore, \cite{yang2019unsupervised} cannot detect stationary objects as it relies on motion segmentation (Fig.~\ref{fig:motion-vs-static}).
Note, \cite{yang2020learning} applies \cite{yang2019unsupervised} with perceptual cycle-consistency to separating multiple objects, but they focus on learning object-centric representations.
{\bf Saliency prediction} aims to detect the most salient objects relative to their background or ``context.'' Saliency can be computed locally in a bottom-up fashion \cite{koch1987shifts,itti1998model,ma2003contrast} or globally \cite{zhai2006visual,achanta2009frequency,cheng2014global}, at multiple scales \cite{liu2006region,liu2010learning} and top-down \cite{tsotsos1995modeling}.
\cite{hou2007saliency} constructs the saliency map from the spectral residual and \cite{shen2012unified} performs low-rank matrix decomposition to detect salient objects. Separation can also be achieved by increasing the divergence of the feature distributions \cite{klein2011center}.
Despite advancements in the optimization for salient region segmentation \cite{comaniciu2002mean,felzenszwalb2004efficient,levinshtein2009turbopixels}, the quality of the predicted saliency depends highly on the features selected.
Currently, the best performing methods employ deep neural networks trained on labeled datasets \cite{zhang2017amulet,luo2017non,liu2018picanet,lin2014microsoft,li2014secrets}.
Recently, \cite{chen2019unsupervised,bielski2019emergence} proposed unsupervised adversarial salient object discovery models in single images.
Due to the variability of object appearance, these models are hard to train and the process is not scalable. On the other hand, \cite{zhang2018deep,nguyen2019deepusps} propose training deep networks using the pseudo-labels generated by conventional unsupervised methods.
While an improvement over adversarial methods, performance still hinges on human prior knowledge through the selection of handcrafted features.
We wish to avoid specifying features by instead articulating a criterion, namely that anything similar to what we have previously detected as objects should be salient. The model trained with this simple criterion outperforms the state of the art on unsupervised saliency prediction.
{\bf Video object segmentation} comprises a vast literature \cite{faisal2019exploiting,hu2018unsupervised,lao2018extending,yang2015self,wang2015saliency,wang2019ranet}; we focus on unsupervised methods that are more related to our work. It should be noted that the term ``unsupervised'' in video object segmentation only reflects absence of annotations at \textit{test time}, whereas we reserve the name for methods that involve no manual annotation during training, as well as testing.
To segment moving objects, \cite{tokmakov2017learning} trains a network to directly output the segmentation from motion, which is then augmented by an appearance channel in \cite{jain2017fusionseg}; \cite{taylor2015causal} proposes a layered model for detachable objects using occlusion as primary cue. \cite{zhuo2019unsupervised} incorporates salient motion detection with object proposals; \cite{koh2017primary} segments video into ``primary'' objects.
A pyramid dilated bidirectional ConvLSTM is proposed in \cite{song2018pyramid} to extract spatial features at multiple scales, and \cite{lu2019see} introduces a global co-attention mechanism to capture scene context.
\cite{zhou2020motion} proposes an architecture that allows interaction between motion and appearance during the encoding process, while \cite{yang2019anchor,lai2019self} focuses on learning discriminative features for segmentation propagation and assumes the first frame been annotated.
\section{Method}
\label{sec:method}
An object that is detached from its surroundings induces an independent motion when projected onto a moving image \cite{ayvaci2011detachable}.
Here, we utilize this independence principle by minimizing the mutual information between the motions of an object and its context in Sec.~\ref{subsec:CIS_TC_SP}.
In contrast to the Contextual Information Separation (CIS) criterion \cite{yang2019unsupervised}, we enforce that the separation is temporally consistent in a sequence, which directly improves \cite{yang2019unsupervised} by an average of 7\%.
In Sec.~\ref{subsec:static_object}, we instantiate a static model that enables perception of stationary objects utilizing the detection of moving ones and the confidence measure computed from the mutual information.
The interaction or mutual bootstrapping between motion segmentation and static perception is described in Sec.~\ref{subsec:joint_percept}.
The overall method is illustrated in Fig.~\ref{fig:system}.
\subsection{Dynamic Model with Temporally Consistent Mutual Information Minimization}
\label{subsec:CIS_TC_SP}
Given an image $\mathrm{I} \in \mathbb{R}^{H\times W\times 3}$, the motion field $\mathbf{u}$ defined on $\mathrm{I}$ is a random variable distributed according to $\mathrm{p}(\mathbf{u}|\mathrm{I})$, which is determined by a dataset of image sequences $\mathcal{D} = \{ \mathrm{I}^t_i \}_{i\leq N, t\leq T}$, where $N$ is the cardinality of the dataset and $T$ is the maximum number of images in a sequence.
Particularly, for an instance $\mathrm{u} \in \mathbb{R}^{H\times W\times 2}$, sampled from $\mathrm{p}(\mathbf{u}|\mathrm{I})$, there exists an image $\hat{\mathrm{I}}$ such that for any pixel $\mathrm{x}$ on $\mathrm{I}$, $\mathrm{I}(\mathrm{x}) = \hat{\mathrm{I}}(\mathrm{x} + \mathrm{u}(\mathrm{x}))$ holds up to noise and occlusions, as shown in Fig.~\ref{fig:conditional}.
To detect objects that move independently in the scene, a motion segmentation network $\phi$ should generate masks $\mathrm{m} = \phi(\mathrm{u}) \in \{0,1\}^{H\times W}$, such that the motions inside the mask $\mathrm{m}\odot\mathbf{u}$ and outside the mask $(1-\mathrm{m})\odot\mathbf{u}$ are mutually independent conditioned on the image $\mathrm{I}$.
More explicitly, the conditional mutual information $\mathbb{I}(\mathrm{m}\odot\mathbf{u}, (1-\mathrm{m})\odot\mathbf{u}|\mathrm{I})$ should be minimal.
Since the mutual information measures the difference between the Shannon entropy of the inside and its conditional entropy (conditioned) on the outside, simply minimizing the mutual information yields a trivial solution (empty set).
One solution is to normalize the conditional mutual information by the entropy $\mathbb{H}(\mathrm{m}\odot\mathbf{u}|\mathrm{I})$,
\begin{multline}
\argmin_{\mathrm{m}} \dfrac{\mathbb{I}(\mathrm{m}\odot\mathbf{u}, (1-\mathrm{m})\odot\mathbf{u}|\mathrm{I})}{\mathbb{H}(\mathrm{m}\odot\mathbf{u}|\mathrm{I})}\\
= \argmax_{\mathrm{m}} \dfrac{\mathbb{H}(\mathrm{m}\odot\mathbf{u}|(1-\mathrm{m})\odot\mathbf{u},\mathrm{I})}{\mathbb{H}(\mathrm{m}\odot\mathbf{u}|\mathrm{I})}
\end{multline}
which is equivalent to maximizing the un-informativeness measured by the ratio on the right.
Again, this ratio can be maximized by simply setting $\mathrm{m}$ as the whole image domain, which results in over detection (Fig.~\ref{fig:over-under} (a)).
Thus, if the detection is not accurate as in Fig.~\ref{fig:over-under} (c),
the context will be rendered informative, vice versa.
Therefore it is necessary to add a symmetric term:
\begin{multline}
\mathcal{L}(\mathrm{m}; \mathrm{I}) = \dfrac{\mathbb{H}(\mathrm{m}\odot\mathbf{u}|(1-\mathrm{m})\odot\mathbf{u},\mathrm{I})}{\mathbb{H}(\mathrm{m}\odot\mathbf{u}|\mathrm{I})} \\
+ \dfrac{\mathbb{H}((1-\mathrm{m})\odot\mathbf{u}|\mathrm{m}\odot\mathbf{u},\mathrm{I})}{\mathbb{H}((1-\mathrm{m})\odot\mathbf{u}|\mathrm{I})}
\label{loss:symmetric-ratio}
\end{multline}
whose value is upper bounded by $2$, and can be maximized only when $\mathrm{m}$ accurately segments the object.
\begin{figure}[!t]
\centering
\includegraphics[width=.48\textwidth]{figures/effective-tc-sp_new.png}
\vspace{-0.5cm}
\caption{Temporally consistent mutual information minimization prevents label flipping (2nd and 3rd columns), and also improves segmentation accuracy (the motorbike).}
\vspace{-0.2cm}
\label{fig:effective-TC-SP}
\end{figure}
Similar to \cite{yang2019unsupervised}, we make the loss in Eq.~\eqref{loss:symmetric-ratio} computable by assuming Gaussian conditionals, and instantiating an adversarial inpainting network $\psi$ that computes the conditional means, e.g., $\psi(\mathrm{m}, (1-\mathrm{m})\odot\mathrm{u}, \mathrm{I})$ estimates the conditional mean of $\mathrm{m}\odot\mathbf{u}$ under $\mathrm{p}(\mathrm{m}\odot\mathbf{u}|(1-\mathrm{m})\odot\mathrm{u}, \mathrm{I})$.
Both $\phi$ and $\psi$ can be trained adversarially:
\begin{multline}
\max_{\phi}\min_{\psi}\mathcal{L}_{\mathrm{\scriptscriptstyle A}}(\phi,\psi; \mathrm{I}) = \\
\dfrac{\sum_{\mathrm{u} \sim \mathrm{p}(\mathbf{u}|\mathrm{I})} \| \mathrm{m}\odot\mathrm{u} - \psi(\mathrm{m}, (1-\mathrm{m})\odot\mathrm{u}, \mathrm{I}) \|}
{\sum_{\mathrm{u} \sim \mathrm{p}(\mathbf{u}|\mathrm{I})}\| \mathrm{m}\odot\mathrm{u} \| + \epsilon} \\
+ \dfrac{\sum_{\mathrm{u} \sim \mathrm{p}(\mathbf{u}|\mathrm{I})} \| (1-\mathrm{m})\odot\mathrm{u} - \psi(1-\mathrm{m}, \mathrm{m}\odot\mathrm{u}, \mathrm{I}) \|}
{\sum_{\mathrm{u} \sim \mathrm{p}(\mathbf{u}|\mathrm{I})} \| (1-\mathrm{m})\odot\mathrm{u} \| + \epsilon}
\label{loss:CIS}
\end{multline}
with $\mathrm{m} = \phi(\mathrm{u})$, and $\| \cdot \|$ the $l^2$-norm. The constant $0<\epsilon\ll 1$ is to prevent numerical instability, and $\psi(\mathrm{m}, \emptyset, \mathrm{I} )$ is default to zeros.
Since Eq.~\eqref{loss:CIS} characterizes moving objects solely using motion, it is sensitive to variations in the motion field, resulting in label flipping and irregular segments due to failures of motion estimation shown in Fig.~\ref{fig:effective-TC-SP}.
To resolve these issues, we introduce a temporal consistency constraint to reduce the instability in the motion segmentation model.
{\bf Temporal consistency.} Given two consecutive images $\mathrm{I}^1,\mathrm{I}^2$ from the same video sequence,
we can compute the forward and backward optical flow $\mathrm{u}^{12}, \mathrm{u}^{21}$, and the predicted masks $\mathrm{m}^1 = \phi(\mathrm{u}^{12}), \mathrm{m}^2 = \phi(\mathrm{u}^{21})$.
We would like the individually predicted masks to be temporally consistent,
in the sense that if we deform one onto the other using the flow fields, the two should look similar as they are the projections of the same object. Thus, we penalize the following warping difference to enforce temporal consistency:
\begin{multline}
\mathcal{L}_{\mathrm{\scriptscriptstyle TC}}(\phi; \mathrm{u}^{12},\mathrm{u}^{21}) = \sum_{\mathrm{x} \notin \mathbf{o}} | \mathrm{m}^1(\mathrm{x}) - \mathrm{m}^2(\mathrm{x}+\mathrm{u}^{12}(\mathrm{x})) | \\
+ | \mathrm{m}^2(\mathrm{x}) - \mathrm{m}^1(\mathrm{x}+\mathrm{u}^{21}(\mathrm{x})) |
\label{loss:TC}
\end{multline}
with $\mathrm{x}$ the pixel index, and $\mathbf{o}$ the union of occlusions within the image domain, which can be easily estimated using the forward-backward identity criterion \cite{ince2008occlusion}. The reasoning is that inconsistencies of the predictions should only be penalized in the co-visible region.
Without introducing extra networks, Eq.~\eqref{loss:TC} effectively reduces instabilities in the motion segmentation compared to Eq.~\eqref{loss:CIS}, as shown in Fig.~\ref{fig:effective-TC-SP}.
{\bf Initial training for the dynamic model:} By enforcing temporal consistency, the dynamic model for independently moving object segmentation can be obtained through the following adversarial training:
\begin{multline}
\max_{\phi}\min_{\psi}\mathcal{L}_{\mathrm{\scriptscriptstyle D}}(\phi,\psi; \mathrm{I}^1,\mathrm{u}^{12},\mathrm{u}^{21}) \\
= \mathcal{L}_{\mathrm{\scriptscriptstyle A}}(\phi,\psi;\mathrm{I}^1) + \lambda_{\mathrm{\scriptscriptstyle TC}} \mathcal{L}_{\mathrm{\scriptscriptstyle TC}}(\phi;\mathrm{u}^{12},\mathrm{u}^{21})
\label{loss:cis-tc-sp}
\end{multline}
with $\lambda_{\mathrm{\scriptscriptstyle TC}}=-0.1$
($\lambda_{\mathrm{\scriptscriptstyle TC}}<0$ as $\phi$ maximizes $\mathcal{L}_{\mathrm{\scriptscriptstyle D}}$). The effectiveness of optimizing Eq.~\eqref{loss:cis-tc-sp} is also numerically demonstrated in Tab.~\ref{tab:effective-TC-SP}.
Next, we describe the confidence-aware training for the static object model.
\begin{figure*}[!ht]
\centering
\includegraphics[width=0.85\textwidth]{figures/motion_vs_static.png}\
\vspace{-0.0cm}
\caption{Comparison between the dynamic and static object models. After the first round of learning from noisy motion segmentations ($\phi(\mathrm{u})$, second row) with the proposed confidence-aware adaptation, the static object model ($\chi(\mathrm{I})$, fourth row) improves over the dynamic model on all cases where the motion is noisy (a), the object is partially static (b) or fully static (c).}
\vspace{-0.2cm}
\label{fig:motion-vs-static}
\end{figure*}
\subsection{Static Model with Confidence-Aware Update}
\vspace{-0.0cm}
\label{subsec:static_object}
In Sec.~\ref{subsec:CIS_TC_SP}, we describe a model that detects moving objects in a temporally coherent manner.
However, what if the objects stop moving or they have been moving in an indistinctive way?
These present challenges for the dynamic model $\phi$,
which relies on motion to signal the existence of an object (Fig.~\ref{fig:motion-vs-static}).
Note in Fig.~\ref{fig:motion-vs-static}, the motion varies between frames, but the appearance of an object is temporally persistent, and when motion fades away, the image array still depicts the same object.
Our position is that, once a moving object is detected, we ought to be able to find it even in a still image.
Thus, we propose to train a static object model to complement the dynamic model when there is no significant motion.
We could directly train a segmentation network $\chi$ to predict objects from a single image, utilizing the output of $\phi$ as the pseudo labels, by maximizing the F-measure \cite{nguyen2019deepusps} commonly used for salient object detection:
\begin{equation}
F_{\alpha}(\chi(\mathrm{I}), \overline{\mathrm{m}}) = (1+\alpha^2)\dfrac{\rho(\chi(\mathrm{I}),\overline{\mathrm{m}})\gamma(\chi(\mathrm{I}),\overline{\mathrm{m}})}{\alpha^2\rho(\chi(\mathrm{I}),\overline{\mathrm{m}})+\gamma(\chi(\mathrm{I}),\overline{\mathrm{m}})}
\label{loss:f-beta}
\end{equation}
with $\rho, \gamma$ the precision and recall between the prediction $\chi(\mathrm{I})$ and the motion mask $\overline{\mathrm{m}}$ generated by $\phi$. And $\alpha^2$ is default to 1.5 if not explicitly mentioned.
However, directly learning from all motion masks is counter-productive, as these are quite noisy especially when motion is uninformative (Fig.~\ref{fig:motion-vs-static}).
To address this issue, we propose to use the loss $\mathcal{L}_{\mathrm{\scriptscriptstyle A}}$ (Eq.~\eqref{loss:CIS}) as a confidence measure on the reliability of the motion masks:
{\it if the motion is uninformative,
the reconstruction from the context will be accurate,
thus $\mathcal{L}_{\mathrm{\scriptscriptstyle A}}$ will be small and vice versa, if the motion is distinctive, $\mathcal{L}_{\mathrm{\scriptscriptstyle A}}$ will be large due to a bad reconstruction} (See Fig.~\ref{fig:birdfall} and Fig.~\ref{fig:frog} for a demonstration.)
We propose using the difference between the values of $\mathcal{L}_{\mathrm{\scriptscriptstyle A}}$ to perform a confidence-aware adaptation via the following:
\begin{multline}
\mathcal{L}_{\mathrm{\scriptscriptstyle \chi}}(\chi; \mathrm{I},\overline{\mathrm{m}},\chi') = \lambda_{F}F_{\alpha}(\chi(\mathrm{I}),\chi'(\mathrm{I}))\\
+ \max(\mathcal{L}_{\mathrm{\scriptscriptstyle A}}(\overline{\mathrm{m}})-\mathcal{L}_{\mathrm{\scriptscriptstyle A}}(\chi'(\mathrm{I}))-\delta,0)F_{\alpha}(\chi(\mathrm{I}),\overline{\mathrm{m}})
\label{loss:static-seg}
\end{multline}
Note that the pseudo-label $\overline{\mathrm{m}}$ is only effective when it has a larger $\mathcal{L}_{\mathrm{\scriptscriptstyle A}}$ than the one predicted by $\chi'$,
which is a copy of an earlier $\chi$.
In other words, if the output of the dynamic model is not confident enough, $\chi$ retains its own prediction, and the first term (moving average) is to ensure that $\chi$ is updated smoothly.
We set $\mathcal{L}_{\mathrm{\scriptscriptstyle A}}(\chi'(\mathrm{I}))=0$ and $\lambda_F=0$ the first time $\chi$ is trained, then $\lambda_F=1.0$.
When updated, $\chi$ learns a model of objects based on their appearance, so we would expect $\chi$ to detect stationary objects which have been seen moving before.
Indeed, we find that $\chi$ is able to detect static object that has never been observed moving as shown in Fig.~\ref{fig:motion-vs-static} (3rd column), which confirms that a general concept of objects can be learned through the observations of moving ones. Next we detail the proposed dynamic-static bootstrapping scheme for a continuous learning of objects.
\subsection{Dynamic-Static Bootstrapping}
\vspace{-0.0cm}
\label{subsec:joint_percept}
Once the static object model is learned by $\chi$, it can be used to modulate the detection in general scenes, even where the motion of the objects is unknown.
It is also possible that the predictions of $\phi$, which employs motion information are imperfect.
The output of $\chi$ can then provide complementary information to strengthen the dynamic model.
We feed $\chi$ back into the training of the dynamic model as an experiential prior of objectness based on the photometric information.
The dynamic model reinforced by the objectness prior is:
\begin{multline}
\max_{\phi}\min_{\psi} \mathcal{L}_{\mathrm{\scriptscriptstyle J}}(\phi,\psi; \mathrm{I}^1,\mathrm{u}^{12},\mathrm{u}^{21},\chi) =\\ \mathcal{L}_{\mathrm{\scriptscriptstyle D}}(\phi,\psi; \mathrm{I}^1,\mathrm{u}^{12},\mathrm{u}^{21}) + \lambda_{\mathrm{obj}} F_{\alpha}(\phi(\mathrm{u}^{12}),\chi(\mathrm{I}^1))
\label{loss:joint-training}
\end{multline}
with $\mathcal{L}_{\mathrm{\scriptscriptstyle D}}$ the adversarial motion segmentation loss in Eq.~\eqref{loss:cis-tc-sp}, and the second term measures the similarity between the motion mask and the static object prior ($\lambda_{\mathrm{obj}}=1.0$).
Besides learning from motion information to detect moving objects, $\phi$ is now able to leverage photometric cues that facilitate the detection under circumstances where objects become stationary or move extremely slowly.
Moreover, improved dynamic model could yield better pseudo-labels that help training a more accurate static object model (Eq.~\eqref{loss:static-seg}), which can then be used to facilitate the learning of the former in a synergistic loop (Eq.~\eqref{loss:joint-training}), thus the name ``Dynamic-Static Bootstrapping.''
The overall training procedure is presented in Algorithm~\ref{algo:all}.
\begin{algorithm}[!h]
\KwResult{$\phi$: dynamic model; $\chi$: static object model; $\psi$: conditional inpainting network}
Initialize $\phi,\psi$ by optimizing $\mathcal{L}_{\mathrm{\scriptscriptstyle D}}$ (Eq.~\eqref{loss:cis-tc-sp}), set k=0\;
\While{k<3}{
k = k+1\;
Update the static model $\chi$ using $\mathcal{L}_{\mathrm{\scriptscriptstyle \chi}}$ (Eq.~\eqref{loss:static-seg})\;
Update the dynamic model $\phi$ using $\mathcal{L}_{\mathrm{\scriptscriptstyle J}}$ (Eq.~\eqref{loss:joint-training})\;
}
\caption{Dynamic-Static Bootstrapping}
\vspace{-0.1cm}
\label{algo:all}
\end{algorithm}
\begin{figure*}[!t]
\centering
\begin{minipage}[t]{.45\textwidth}
\centering
\includegraphics[width=.8\textwidth]{figures/goodflow.pdf}
\vspace{-0.0cm}
\caption{Distribution of $\mathcal{L}_{\mathrm{\scriptscriptstyle A}}$ computed using the output of the dynamic model $\phi$ (orange) and the static model $\chi$ (blue) on the birdfall sequence, which shows that $\mathcal{L}_{\mathrm{\scriptscriptstyle A}}$ is a good indicator of reliable masks when the motion field is informative, as verified by the gap between the distributions of $\mathcal{L}_{\mathrm{\scriptscriptstyle A}}$.}
\vspace{-0.3cm}
\label{fig:birdfall}
\end{minipage}
\hspace{1.0cm}
\begin{minipage}[t]{.45\textwidth}
\centering
\includegraphics[width=.8\textwidth]{figures/badflow.pdf}
\vspace{-0.0cm}
\caption{Distribution of $\mathcal{L}_{\mathrm{\scriptscriptstyle A}}$ for the dynamic model $\phi$ (orange) and the static model $\chi$ (blue) on the frog sequence, which shows that when the motion is not informative or erroneous, the static model can work better, thus the difference in the values of $\mathcal{L}_{\mathrm{\scriptscriptstyle A}}$ is small.}
\vspace{-0.3cm}
\label{fig:frog}
\end{minipage}
\end{figure*}
\section{Implementation}
\label{sec:implement}
\textbf{Dynamic model $\phi$} uses the Deeplab architecture \cite{chen2017deeplab}, with the initialization weights as in \cite{zhang2018deep,nguyen2019deepusps}. $\phi$ takes as input the estimated flow between two randomly chosen frames from the same video with the maximum interval equals to three. Optical flow is produced by PWCNet \cite{sun2018pwc}, which is trained on synthetic data.
The output of $\phi$ is a two channel softmax score.
In total, $\phi$ has 23M trainable parameters and can run in 19 fps during inference.
\textbf{Static model $\chi$} uses similar architecture as the dynamic model, but takes a single RGB image as input. The output is also a two channel softmax score. The total number of parameters is 21 M, and $\chi$ can run at 22 fps at inference.
{\bf Training details.} For the initial training of the dynamic model $\phi$, we alternate between updating $\phi$ for three steps and updating $\psi$ for one step, up to 30 epochs on the training set of each dataset, using an Adam optimizer with lr=1e-4, beta1=0.9, and beta2=0.999.
The static model is then trained up to 15 epochs, using an Adam optimizer with lr=2e-5, beta1=0.9, and beta2=0.999.
As described in Algorithm~\ref{algo:all}, the dynamic-static bootstrapping runs for three iterations. On average, each iteration takes six hours to converge, and the whole training procedure can be finished within a day.
\section{Experiments}
\label{sec:exp}
{\bf Datasets:} For {\it video object segmentation}, we train and test our model on three commonly used video object segmentation datasets: DAVIS \cite{perazzi2016benchmark}, FBMS \cite{ochs2013segmentation}, and SegTrackV2 \cite{li2013video} (Tab.~\ref{tab:vos-benchmarks}).
We also test our trained model on two other datasets, DAVIS17 \cite{pont20172017} and Youtube-VOS \cite{xu2018youtube}, to check how well our method generalizes (Tab.~\ref{tab:D17-YVOS}).
DAVIS consists of high-resolution videos (30 for training and 20 for validation) depicting the primary object moving in the scene with pixel-wise annotations for each frame.
FBMS contains videos of multiple moving objects, providing test cases for multiple object segmentation. FBMS has sparsely annotated 59 video sequences, with 30 sequences for validation.
SegTrackV2 contains 14 densely annotated videos.
These videos constitute the only source of training data for our unsupervised motion perception module $\phi$.
Youtube-VOS contains 4,453 videos and 94 object categories, and DAVIS17 consists of 150 videos.
To evaluate $\chi$ on static object segmentation, we test on three major saliency prediction datasets: MSRA-B \cite{jiang2013salient} (5000 images), ECCSD \cite{shi2015hierarchical} (1000 images) and DUT \cite{yang2013saliency} (5168 images). All three datasets are annotated with pixel-wise labels for each image.
These saliency datasets contain objects from a much broader span of categories, such as road signs, statues, flowers, etc., that are never seen moving in the training videos
We evaluate the static object model learned from only video objects
on these saliency benchmarks,
to check its transferability to different instances from seen categories and unseen categories.
\subsection{Effectiveness of Temporally Consistent Mutual Information Minimization}
To verify the effectiveness of the temporally consistent mutual information minimization proposed in Sec.~\ref{subsec:CIS_TC_SP} for bottom-up motion segmentation, we compare to the baseline CIS \cite{yang2019unsupervised} that trains a segmentation network using only Eq.~\eqref{loss:CIS}.
We train both CIS \cite{yang2019unsupervised} and our model described in Eq.~\eqref{loss:cis-tc-sp} on the unlabeled videos from DAVIS, and then test on the validation set of DAVIS. We also report the scores by directly applying the model trained on DAVIS to FBMS and SegTrackV2 in Tab.~\ref{tab:effective-TC-SP} to check the generalization on different domains.
The performance is measured by mean-Intersection-over-Union (mIoU), and the relative weights used in our model are $\lambda_{\mathrm{\scriptscriptstyle TC}}=1.0$. As shown in Tab.~\ref{tab:effective-TC-SP}, our dynamic model (Eq.~\eqref{loss:cis-tc-sp}) consistently outperforms CIS (Eq.~\eqref{loss:CIS}) on all three video object segmentation benchmarks by 7\%, which confirms that temporal consistency is a critical component in our dynamic model.
\begin{table}[!h]
\centering
\begin{tabular}{cccc}
\toprule
& {DAVIS} & {FBMS} & {SegTV2}\\
\midrule
CIS \cite{yang2019unsupervised} & 59.2 & 36.8 & 45.6 \\
Ours & {\bf 62.4} & {\bf 40.0} & {\bf 49.1} \\
\bottomrule
\end{tabular}
\vspace{0.05cm}
\caption{Our temporally consistent dynamic model v.s. CIS \cite{yang2019unsupervised}.}
\label{tab:effective-TC-SP}
\end{table}
\subsection{Effectiveness of Confidence-Aware Adaptation}
Here we check the effectiveness of the confidence-aware adaptation scheme proposed in Sec.~\ref{subsec:static_object} in precluding counter-productive self-learning.
We first train a motion model $\phi$ on the training data from DAVIS.
Then we train two static models $\chi$: $\chi(F_{\alpha})$ using Eq.~\eqref{loss:f-beta} (not confidence-aware), the other $\chi(\mathcal{L}_{\chi})$ using Eq.~\eqref{loss:static-seg} (confidence-aware).
We set $\delta$ in Eq.~\eqref{loss:static-seg} to 0.2 and $\lambda_{F}$ to 1.0, which are fixed for the future experiments.
We compare the performance of the static models on the DAVIS validation set using mIoU. Further, we perform the same evaluation on both FBMS and SegTrackV2, and report the scores in Tab.~\ref{tab:adaptive-bootstrap}. As shown, with the confidence-aware adaptive bootstrapping loss Eq.~\eqref{loss:static-seg}, the static object model $\chi$ consistently improves over its counter-part on the three benchmarks, confirming the importance of uncertainty estimation in self-supervised learning.
\begin{table}[!h]
\centering
\begin{tabular}{cccc}
\toprule
& {DAVIS} & {FBMS} & {SegTV2} \\
\midrule
$\chi(F_{\alpha})$ & 73.8 & 65.5 & 65.7 \\
$\chi(\mathcal{L}_{\chi})$ & {\bf 78.2} & {\bf 68.7} & {\bf 69.3} \\
\bottomrule
\end{tabular}
\vspace{0.1cm}
\caption{Static model $\chi(F_{\alpha})$ vs. $\chi(\mathcal{L}_{\chi})$. The latter is trained with confidence-aware adaptation.}
\label{tab:adaptive-bootstrap}
\end{table}
\begin{figure}[!t]
\centering
\includegraphics[width=0.47\textwidth]{figures/visuals-davis.png}
\caption{Qualitative comparison to the top two methods from each category on the DAVIS benchmark. MatNet \cite{zhou2020motion}, AnDiff \cite{yang2019anchor} (supervised) and ARP \cite{koh2017primary}, CIS \cite{yang2019unsupervised} (unsupervised).}
\vspace{-0.3cm}
\label{fig:vis-davis}
\end{figure}
\begin{table*}[!h]
\setlength{\tabcolsep}{6pt}
\centering
\begin{tabular}{lcccclccc}
\toprule
\multicolumn{5}{c}{Supervised Methods} & \multicolumn{4}{c}{Unsupervised Methods} \\
\midrule
& {\small $\#$ Annot.} & {\small DAVIS} & {\small FBMS(J/F)} & {\small SegTV2} & & {\small DAVIS} & {\small FBMS} & {\small SegTV2} \\
\midrule
{\small MATNet \cite{zhou2020motion}} & 14,000 & 82.4 & {\bf 76.1} / ----- & 50.2 & {\small ARP \cite{koh2017primary}} & 76.2 & 59.8 & 57.2 \\
{\small AnDiff \cite{yang2019anchor}} & 2,000 & 81.7 & ----- / 81.2 & 48.3 &
{\small ELM \cite{lao2018extending}} & 61.8 & 61.6 & -- \\
{\small COSNet \cite{lu2019see}} & 17,000 & 80.5 & 75.6 / ----- & 49.7 &
{\small FST \cite{papazoglou2013fast}} & 55.8 & 47.7 & 47.8 \\
{\small EPONet \cite{faisal2019exploiting}} & 2,000+ & 80.6 & -- & { 70.9} &
{\small NLC \cite{faktor2014video}} & 55.1 & 51.5 & 67.2 \\
{\small PDB \cite{song2018pyramid}} & 17,000 & 77.2 & 74.0 / 81.5 & 60.9 &
{\small SAGE \cite{wang2015saliency}} & 42.6 & 61.2 & 57.6 \\
{\small LVO \cite{tokmakov2017learning}} & 2,000+ & 75.9 & 65.1 / 77.8 & 57.3 &
{\small STP \cite{hu2018unsupervised}} & 77.6 & 60.8 & 70.1 \\
{\small FSEG \cite{jain2017fusionseg}} & 10,500 & 70.7 & 68.4 / ----- & 61.4 &
{\small CIS \cite{yang2019unsupervised}} & 71.5 & 63.6 & 62.0 \\
{\small Ours } & 2,000 & {\bf 82.8} & 75.8 / {\bf 82.0} & {\bf 74.2} & Ours & {\bf 80.0} & {\bf 73.2} & {\bf 74.2}\\
\bottomrule
\end{tabular}
\vspace{0.1cm}
\caption{Quantitative comparison on video object segmentation benchmarks with both supervised and fully unsupervised methods.}
\vspace{-0.1cm}
\label{tab:vos-benchmarks}
\end{table*}
\begin{table*}
\setlength{\tabcolsep}{4pt}
\centering
\begin{tabular}{cccccccccccc}
\toprule
\multicolumn{5}{c}{Supervised Methods} & \multicolumn{4}{c}{Unsupervised Methods} \\
\midrule
& {\small \it DSS \cite{hou2017deeply}} & {\small \it NDF \cite{luo2017non}} & {\small \it SR \cite{wang2017stagewise}} & {\small RBD \cite{zhu2014saliency}} & {\small DSR \cite{li2013saliency}} & {\small HS \cite{zou2015harf}} & {\small CHS \cite{wangiccv17}} & {\small SBF \cite{yan2013hierarchical}}
& {\small USD \cite{zhang2018deep}} & {\small DUSPS \cite{nguyen2019deepusps}} & {\small Ours} \\
\midrule
{\small ECCSD} & 87.9 & 89.1 & 82.6 & 65.2 & 63.9 & 62.3 & 68.2 & 78.7 & 87.8 & 87.4 & \textbf{88.1} \\
{\small MSRA-B} & 89.4 & 89.7 & 85.1 & 75.1 & 72.3 & 71.3 & 79.8 & -- & 87.7 & \textbf{90.3} & 89.7 \\
{\small DUT} & 72.9 & 73.6 & 67.2 & 51.0 & 55.8 & 52.1 & -- & 58.3 & 71.6 & 73.6 & \textbf{73.9} \\
\bottomrule
\end{tabular}
\vspace{0.1cm}
\caption{Quantitative results on saliency prediction (or salient object detection) benchmarks.}
\vspace{-0.1cm}
\label{tab:saliency-benchmarks}
\end{table*}
\subsection{Improvement from Bootstrapping}
In Tab.~\ref{tab:multiple-rounds},
we show the improvement after multiple rounds of bootstrapping for each model as described in Algorithm~\ref{algo:all} (dynamic-static bootstrapping).
The reported score is the mIoU of the segmentation on the three video object segmentation benchmarks.
This demonstrates the effectiveness of training in a synergistic loop with our dynamic-static bootstrapping strategy.
\begin{table}[!h]
\centering
\begin{tabular}{cccc}
\toprule
\# of Rounds & DAVIS & FBMS & SegTV2 \\
\midrule
1 & 73.8 & 65.5 & 65.7 \\
2 & 79.2 & 71.7 & 73.1 \\
3 & {\bf 80.0} & {\bf 73.2} & {\bf 74.2} \\
\bottomrule
\end{tabular}
\vspace{0.1cm}
\caption{The mIoU improves over multiple rounds of dynamic-static bootstrapping.}
\label{tab:multiple-rounds}
\end{table}
\subsection{Static Model Improves with the Number of Training Videos}
One characteristic of our method is that the static model $\chi$ improves over time as more and more objects are seen moving through the bottom-up motion detection module $\phi$.
To verify, we construct a collection of videos $S$ by combining the three aforementioned video object segmentation datasets (in total there are 123 video sequences).
We randomly partition them into 10 subsets $\{s_k\}_{k=1}^{10}$, each contains around 12 video sequences.
Correspondingly, we train 5 static object models $\{\chi_i\}_{i=0}^{4}$ by performing Algorithm~\ref{algo:all}.
The training set for each $\chi_i$ is $\{s_k\}_{k=1}^{2i+1}$, such that $\chi_i$ with a larger $i$ is exposed to more video sequences.
Each $\chi$ is evaluated on the union of the three saliency datasets mentioned above (in total 11,000 testing images).
In Tab.~\ref{tab:chi-improves},
we report the performance of $\chi_i$'s, measured in terms of mIoU (with standard deviation computed across five runs).
As shown in Tab.~\ref{tab:chi-improves},
when the number of the observed videos increases, the performance of the static object model also improves, which is consistently observed across multiple runs.
\begin{table}[!h]
\centering
\begin{tabular}{cccccc}
\toprule
$\#$ of videos & 12 & 36 & 60 & 84 & 108 \\
\midrule
mIoU & 48.3 & 52.4 & 54.9 & 58.8 & 61.4 \\
Std. Dev. & 1.99 & 2.37 & 2.30 & 1.17 & 1.56 \\
\bottomrule
\end{tabular}
\vspace{0.1cm}
\caption{Static model $\chi$ improves over time as more videos are observed.}
\label{tab:chi-improves}
\end{table}
\begin{figure}[!t]
\centering
\includegraphics[width=0.47\textwidth]{figures/visuals-saliency.png}
\vspace{-0.1cm}
\caption{Visual results on the saliency prediction benchmarks. CHS \cite{yan2013hierarchical}, HS \cite{zou2015harf} (unsupervised), SBF \cite{wangiccv17} (unsupervised learning-based), SR \cite{wang2017stagewise} (supervised).}
\vspace{-0.1cm}
\label{fig:failure-case}
\end{figure}
\subsection{Video Object Segmentation Benchmarks}
To check the effectiveness of the proposed dynamic-static bootstrapping in learning better motion segmentation,
we evaluate on the benchmarks for video object segmentation.
Since video object segmentation focuses on moving objects, we weigh the predictions from the dynamic model with the predictions from the static model to emphasize the detection of moving ones.
Similar to \cite{yang2019unsupervised}, CRF postprocessing is performed to get our final results.
We compare to top-performing unsupervised (no annotations are involved) and supervised (annotations are involved during the training phase) methods.
The performance is measured by mIoU.
As shown in Tab.~\ref{tab:vos-benchmarks}, our method achieves the top performance on all three video object segmentation benchmarks among fully unsupervised methods.
To compare with methods that utilize manual annotations (Supervised), we finetune our model on the DAVIS training set with 2000 annotations.
We have also listed the number of annotations used by other supervised methods in Tab.~\ref{tab:vos-benchmarks}.
Again, our model achieves the top performance using the least amount of manual annotations among all the supervised methods.
In Tab.~\ref{tab:D17-YVOS} we show the results by testing our trained models on two other video object segmentation benchmarks DAVIS17 and Youtube-VOS. Our model still achieves competitive performance compared to the state of the art and demonstrates good generalization.
\subsection{Unsupervised Salient Object Detection}
In Tab.~\ref{tab:saliency-benchmarks}, we evaluate the learned object prior (static object model) through the task of salient object detection in images. Note that the top-performing methods on unsupervised salient object detection all rely on handcrafted methods either as the primary procedure, or as a subprocess.
Among all top-performing ones, we are, to the best of our knowledge, the only one that does not rely on any handcrafted features.
We refine the static model $\chi$ by performing CRF on its predictions, and by one round of self-training with the CRF refined masks \cite{nguyen2019deepusps}.
By leveraging the object prior learned through videos, we can approach and surpass the state of the art. Even when compared with top-performing supervised methods ({\it DSS, NDF, SR} in Tab.~\ref{tab:saliency-benchmarks}), our method still achieves competitive performance with no explicit annotation.
\begin{table}
\setlength{\tabcolsep}{2pt}
\centering
\begin{tabular}{lccccc}
\toprule
&{\small MATNet \cite{zhou2020motion}}& {\small Andiff \cite{yang2019anchor} }& {\small ARP \cite{koh2017primary} }& {\small CIS \cite{yang2019unsupervised}} & {\small Ours}\\
\midrule
{\small DAVIS17} & 58.6 & 57.8 & 50.2 & 53.1 & {\bf 58.9} \\
{\small YTVOS} & -- & 46.1 & 28.7 & 15.6 & {\bf 47.2}\\
\bottomrule
\end{tabular}
\vspace{0.1cm}
\caption{Results on DAVIS17 \cite{pont20172017} and Youtube-VOS \cite{xu2018youtube} datasets.}
\vspace{-0.1cm}
\label{tab:D17-YVOS}
\end{table}
\section{Discussion}
We have presented a method to learn how to segment objects in images that exploits temporal consistency in their motion, observed in training videos, to bootstrap a top-down model.
The definition of what constitutes an object is implicit in the method and in the datasets used for training.
This may appear to be a limitation, as training on different datasets may yield different outcomes.
However, what constitutes an object, or even a segment of an image, is ultimately not objective: In Fig.~\ref{fig:effective-TC-SP}, is the object a person? Or the motorcycle they are riding? The union of the two? The helmet they are wearing? All of the above? We let the evidence bootstrap the definition: If the motion at the resolution of the first video shows the human and bike moving as a whole, we do not know any better than to consider them one object.
If, in later video, a human is seen without a motorcycle, they will be an independent object thereafter.
Admittedly, our model does not capture the fact that a proper object model should segment instances and enable multiple memberships for each point: A pixel on the helmet is part of the object, but also of the person, and the rider, and so on.
We also do not exploit side information from other modalities.
Nonetheless, despite the complete absence of annotation requirements, our method edges out methods that exploit manual annotation, so we believe it to be a useful starting point for further development of more complete object segmentation methods.
\subsubsection*{Acknowledgment}
Research supported by ARO W911NF-17-1-0304 and ONR N00014-17-1-2072.
\section{Appendix}
\subsection{From Eq.~\ref{loss:symmetric-ratio} to Eq.~\ref{loss:CIS}}
Under the Gaussian assumption, the Shannon entropy is proportional to the variance of the Gaussian. So Eq.~\ref{loss:CIS} can be obtained by replacing Shannon entropies in Eq.~\ref{loss:symmetric-ratio} with the estimated variances.
\begin{figure*}[!t]
\centering
\includegraphics[width=0.99\textwidth]{figures/objectness-transfer.png}
\caption{Top: frames from sequences in DAVIS \cite{perazzi2016benchmark} on which the static model is trained. Bottom: directly running the static model, trained on DAVIS without any fine-tuning, on frames from sequences in SegTrackV2 \cite{li2013video}, which contain different object categories. The good segmentation quality in the bottom demonstrates again that our experiential definition of objectness or saliency transfers well between different object categories.}
\label{fig:vis-transfer}
\end{figure*}
\begin{figure*}[!h]
\centering
\includegraphics[width=.99\textwidth]{figures/failure.pdf}
\caption{Failure case: multiple salient objects appear in the same image are all captured by our static model. However, the ground-truth annotations only highlight one of them.}
\label{fig:failure-case}
\end{figure*}
\begin{figure*}[!ht]
\centering
\includegraphics[width=0.7\textwidth]{figures/combinedYTVOS.pdf}
\caption{Visual comparison on Youtube-VOS \cite{xu2018youtube}. From left to right: Image, Ground-truth, AnDiff \cite{yang2019anchor}, CIS \cite{yang2019unsupervised}, Ours.}
\label{fig:yt-vos}
\end{figure*}
\subsection{Additional Qualitative Comparisons}
In Fig.~\ref{fig:vis-transfer}, we show that the objectness prior learned by the static model $\chi$ introduced in Sec.~\ref{subsec:static_object} can effectively generalize to object categories that it has not seen during training.
We perform the training using only the DAVIS dataset and directly use the static model $\chi$ to do inference on sequences from SegTrackV2.
Youtube-VOS \cite{xu2018youtube} has recently been used to benchmark ``semi-supervised'' video object segmentation methods,
where one is required to feed the system a ground-truth segmentation mask for the first frame.
This reduces the problem to one of correspondence and tracking, quite different than what we tackle, which is object 'discovery' without any manual input.
But we still experiment on Youtube-VOS and compare to similar methods to check the generalization ability over diverse video quality, unseen object categories and annotation noise.
We provide additional visual comparisons on the Youtube-VOS \cite{xu2018youtube} benchmark in Fig.~\ref{fig:yt-vos}. In this case, where there are many new categories that have not been seen during training, the model is still capable of generating reasonable segmentations.
The use of videos to learn good object representations aligns well with the findings in \cite{purushwalkam2020demystifying} which finds that self-supervised contrastive learning methods often perform better when videos are used in place of single images.
\subsection{Failure Case in Salient Object Detection}
In Fig.~\ref{fig:failure-case}, we show some examples of our static model that violate the ground-truth annotations.
Since our model captures the general concept of objectness, it does not have access to or understanding of which object in the image is currently attended by the viewer. Further inclusion of attention information can help on this.
{\small
\bibliographystyle{ieee_fullname}
| {'timestamp': '2021-04-06T02:07:36', 'yymm': '2008', 'arxiv_id': '2008.07012', 'language': 'en', 'url': 'https://arxiv.org/abs/2008.07012'} | arxiv |
\section{Introduction}
Reinforcement learning is a branch of machine learning that deals with how an agent can act in an environment to receive the maximum rewards from the environment.
One of the well known and first successful neural networks used in reinforcement learning is \citet{tesauro1994td}~'s TD-gammon \citep{tesauro1994td}. It used neural networks to train the agent who won the world backgammon.
After that, one of the most significant breakthroughs in RL was the Deep Q network\cite{mnih2015human}, which used deep learning in the modeling of the action function.
They used convolutional neural networks in combination with experience replay so that the agent could learn from raw pixels of Atari games without any handcrafted features nor any changes for a specific game. Their experiments have shown that the DQN agent could play Atari 2600 as good as a human.
In addition to using the deep neural networks, addressing the moving targets problem by enabling the network to be synced after a while rather than immediate updates, was another success factor of this method. Their approach for synchronization increased the stability and possibility of convergence to the optimal policy compared to immediately updating the target network.
Following the success of DQN, many extensions of this method presented in recent years. For example, double DQN \cite{van2016deep} addresses the overestimation bias of Q-learning by separating of selection and evaluation of actions \cite{hasselt2010double}.
Prioritized experience replay proposed in \cite{schaul2015prioritized} improved experience replay of DQN. This improvement is done based on selecting important experiences more frequently.
The dueling network architecture \cite{Wang2016Dueling} is another extension that tries to generalize
across actions by separately representing state values
and action advantages to different neural networks.
In distributional Q-learning \cite{bellemare2017distributional}, the agent learns to approximate the distribution of returns instead of expected returns.
Recently in \cite{hessel2018rainbow}, all of these extensions were integrated into one agent called Rainbow. In the reported experiments, this integrated method achieves the state of the art performance.
In all methods similar to the DQN, syncing the deep networks is done at fixed predefined intervals. Although this approach could solve the moving target problem, losing some semi-optimal trained target networks in some cases is its main drawback. Syncing the target network weights without considering the agent's behavior may prevent the agent from following a good policy which could lead to more potential rewards. In this paper, we propose an adaptive way of syncing with considering the behavior of the agent.
\section{Background}
\label{sec:Background}
Reinforcement learning problems can be formalized by the Markov Decision Process (MDP). MDP is a tuple $\langle \mathcal{S},\mathcal{A},T,r,\gamma \rangle$ where $\mathcal{S}$ is a finite set of states, $\mathcal{A}$ is a finite set of actions, $T$ is the transition matrix, $r$ is the reward function and $\gamma$ is a discount factor.
Usually, in reinforcement learning, an agent starts at state $S_1$ and then by selecting an action $A_t$, the environment sends a reward signal $R_1$ and the agent moves to the next state $S_{2}$ based on $T(S_1,A_t)$ and so on, until it reaches to a terminal state or the maximum number of steps allowed.
\subsection{Basics of reinforcement learning}
Policy, value functions, and the model are relevant concepts in RL.
While the policy is the agent's behavior function, the value functions determine the quality of each state or each action. The model is the agent's representation of the environment.
Temporal-Difference learning \cite{sutton1988learning} is One of the most important and widely used techniques in reinforcement learning. In this method, the agent learns to predict the expected value of the value function at the end of each step. Expressed formally:
\begin{equation}
V(S_t) \leftarrow V(S_t) + \alpha [R_{t+1}+\gamma V(S_{t+1})-V(S_t)]. \label{eqn:TDlearning}
\end{equation}
On-policy and off-policy learning methods are two categories that used in RL. In on-policy learning the value functions us learned from the actions, the agent achieves using the current policy. In off-policy methods, the policy used to generate behavior may be unrelated to the policy that is evaluated and improved.
DQN (based on Q-learnin)g \cite{watkins1992q} is an off-policy control algorithm of TD(0). In this algorithm, first action-values are initialized arbitrary (e.\ g. 0) and then in each step old value $Q(s_t,a_t)$ is updated by a fraction (learning rate) of
$r+\gamma \max_{a'}Q^*(s',a')$ which called is the td-target $\delta$ \eqref{eqn:qlearning}. Q-learning is formulated as:
\begin{equation}
Q(S_t,A_t) \leftarrow Q(S_t,A_t) + \alpha \cdot \delta. \label{eqn:qlearning}
\end{equation}
where $\delta$ is td-target
\begin{equation}
\delta = [R_{t+1}+\gamma \max_a Q(S_{t+1},a)-Q(S_t,A_t)]
\end{equation}
and $\alpha$ is the learning rate.
Q-learning is considered a tabular solution method \cite{sutton2018reinforcement}. There are other types of RL methods that use approximation instead of a tabular solution. In Q-learning, we can approximate action-value function $Q$ instead of calculating the exact value of it. This is the main idea of deep reinforcement learning discussed in section \ref{sec:DQN}.
\subsection{Deep reinforcement learning}
\label{sec:DQN}
The authors in\cite{mnih2015human} developed a deep reinforcement learning method by using a deep convolutional neural network to approximate the action-value function. Using CNN architecture enabled them to learn from raw images (in this instance, images of Atari 2600 games) without any handcrafted features. Furthermore, the same settings and network architecture used from variant games and DQN showed the state of the art performance in the majority of the games. The development of DQN was challenging, one of which was moving targets problem. In each iteration, the values of Q may change, thus altering the value of the targets, which may cause oscillations or divergence. In \citet{mnih2015human}, to overcome this challenge the weights of the action value network for C updates are cloned and used as the Q-learning updates.
The duplicated Q-network is showed by $\hat{Q}$.
Another challenge of using DQN was the correlation between successive samples, which led to a large variation between updates, thus instability of the method. All of mentioned extensions (including Rainbow) are using the same approach as DQN to overcome the moving targets problem. \citet{mnih2015human} Modified the standard Q-learning to use experience replay \cite{lin1992self}. Experiences $e_t=(s_t,a_t,r_t,s_{t+1})$ at each time-step $t$ are stored in a memory data set $D_t=\{e_1,\cdots,e_t\}$ and during learning Q-learning updates will be applied by samples of these experiences which are selected randomly with a uniform distribution.
The raw images of Atari games are preprocessed by function $\phi$ (described in \cite{mnih2015human}) and turned into an $84\times84\times4$ image (or tensor). Q-network consists of three convolutional layers and two fully connected layers with rectifier nonlinearity (that is, $\max(0,x)$) as activation function and the output layer has a single output for each valid action. The Q-network can be trained by optimizing the parameters $\theta_i$ at iteration $i$ to reduce the mean-squared error in the Bellman equation, where the optimal target values $r+\gamma \max_{a'}Q^*(s',a') $ are substituted with approximate target values $y= r+\gamma \max_{a'}Q^*(s',a';\theta_i^{-})$, using parameters $\theta_i$ from some previous iteration. This leads to a sequence of loss functions $L_i(\theta_i)$ that changes at each iteration i,
\begin{equation}
L_i(\theta_i) = \mathbb{E}_{s,a,r,s'\sim D_i }\bigg[(\dot{\delta} - Q(s,a;\theta_i))^2\bigg]
\label{eqn:lossfunction}
\end{equation}
where
\begin{equation}
\dot{\delta} = r+\gamma \max_{a'}Q^*(s',a';\theta_i^{-})
\end{equation}
Which can be optimized by gradient descent methods, specifically stochastic gradient descent method.
\begin{algorithm}
\caption{deep Q-learning with experience replay.
} \label{alg:DQN}
\begin{algorithmic}[1]
\State Initialize replay memory $ D $ to capacity $ N $
\State Initialize action-value function $ Q $ with random weights $ \theta $
\State Initialize target action-value function $ \hat{Q} $ with weights $ \theta^{-}=\theta $
\For{$episode = 1, \cdots, M$}
\State \begin{varwidth}[t]{0.9\linewidth}
Initialize sequence $s_1 = \{x_1\}$ and preprocessed sequence $\phi_1=\phi(s_1)$
\end{varwidth}
\For{$t=1, \cdots, T$}
\State With probability $\epsilon$ select a random action $a_t$
\State otherwise select $a_t = argmax_a Q(\phi(s_t),a;\theta)$
\State \begin{varwidth}[t]{0.8\linewidth}
Execute action $a_t$ in emulator and observe reward $r_t$ and image $x_{t+1}$
\end{varwidth}
\State \begin{varwidth}[t]{0.8\linewidth}
set $s_{t+1}=(s_t,a_t,x_{t+1})$ and preprocess \mbox{$\phi_{t+1}=\phi(s_{t+1})$}
\end{varwidth}
\State Store transition $(\phi_t,a_t,r_t,\phi_{t+1})$ in $D$
\State \begin{varwidth}[t]{0.8\linewidth}
Sample random minibatch of transitions $(\phi_j,a_j,r_j,\phi_{j+1})$ from $D$
\end{varwidth}
\State \begin{varwidth}[t]{0.8\linewidth}
\[
\textnormal{Set }y_j=\Bigg\{\begin{array}{lc}
r_j, & s_{j+1} \textnormal{is terminal }\\
\dot{\delta}, & \textnormal{o.w.}
\end{array}
\]
where $\dot{\delta} = r_j+\gamma \max_{a'}\hat{Q}(\phi_{j+1},a';\theta^{-})$
\end{varwidth}
\State \begin{varwidth}[t]{0.8\linewidth}
Perform a gradient descent step on $(y_j - Q(\phi_j,a_j;\theta))^2$ with respect to $\theta$
\end{varwidth}
\State Every $C$ steps reset $\hat{Q}=Q$
\EndFor
\EndFor
\end{algorithmic}
\end{algorithm}
\section{Proposed adaptive synchronization method}
\label{sec:ProposedMethod}
As mentioned, in DQN and it's extensions, syncing the deep networks is done at intervals with the fixed step size $C$ to solve the moving target problem.
Syncing the target network weights in a fixed step size $C$ without considering the agent's behavior may prevent the agent from following a good policy and leading to more potential rewards. In this section, we define a criterion to find out when to sync the network instead of the fixed steps size.
This criterion should set up based on the obtained rewards by the agent. Since these rewards are obtained by the actions of the agent(chosen by $a_t = argmax_a \hat{Q}(s_t, a;\theta)$) then they are dependent to the Q-network that is learning continuously by target network (see \eqref{eqn:lossfunction}). Therefore, we can use a stream of recent rewards to measure the behavior of the agent as an evaluation of the network quality. Then, based on this evaluation criterion, we can decide when to synchronize the target network with the Q-network.
Let $t$ be a step that we should decide about syncing. To construct our criterion for syncing, we push the recent rewards (obtained from the environment) in a queue
$ \{r_{2n-t+1}, \ldots, r_t\}$
with the length $2n$ and compare the quality of rewards of the first part, i.e,
$que_{old} =\{ r_{t-2n+1}, \cdots, r_{t-n}\}$
and the second part
$que_{new} =\{ r_{t-n+1}, \cdots, r_t\}$
of this queue to construct our criterion. Here $n$ could be selected as $C$. If the second part works better than the first one this means that the agent and so the network works good and we should preserve this network.
Average of rewards can tell us about the behavior of agent but since we are more interested in recent behavior, applying a weight vector $w$ which increases the effect of recent rewards can lead to a better representation of recent behavior of the agent. So this weight vector should satisfy the following conditions
\begin{align}
w_{1}\leq w_2 \leq \ldots \leq w_n, \quad \sum_{i=1}^{n}w_i=1
\end{align}
Although different type of weights could be used, here we use a simple form
\[
w_{i}=\frac{i}{n(n+1)}.
\]
So the weighted average of rewards in both $que_{new}$ and $que_{old}$ will be
\begin{align}
\overline{que}_{new} &= {\frac{1}{n}}{\sum\limits_{i = 1}^{n} w_i (que_{new})_i} \label{eqn:AVGQue1}\\
\overline{que}_{old} &= {\frac{1}{n}}{\sum\limits_{i = 1}^{n} w_i (que_{old})_i} \label{eqn:AVGQue2}
\end{align}
Now we need to decide whether to sync $\hat{Q}=Q$ or not, for this matter, we used the simple idea of comparing the weighted average of $que_{new}$ and $que_{old}$.
We, at each $C$ steps, calculate $\overline{que}_{new}$ and $\overline{que}_{old}$ (\eqref{eqn:AVGQue1} , \eqref{eqn:AVGQue2}) and if $\overline{que}_{new} < \overline{que}_{old}$ which means the recent behavior of the agent is not as good as last time, we sync the weights of Q-network. Because of adaptability of our synchronization method, we call our modified DQN agent the Adaptive Synchronization DQN or for short AS\_DQN and our modified Rainbow agent, AS\_Rainbow.
\begin{algorithm}
\caption{Adaptive Synchronization DQN}
\label{alg:ASDQN}
\begin{algorithmic}[1]
\State Initialize replay memory $ D $ to capacity $ N $
\State Initialize action-value function $ Q $ with random weights $ \theta $
\State Initialize target action-value function $ \hat{Q} $ with weights $ \theta^{-}=\theta $
\For{$episode = 1, \cdots, M$}
\State \begin{varwidth}[t]{0.9\linewidth}
Initialize sequence $s_1 = \{x_1\}$ and preprocessed sequence $\phi_1=\phi(s_1)$
\end{varwidth}
\State \begin{varwidth}[t]{0.9\linewidth}
Initialize $que$ a $2n$ queue containing the rewards with weight vector $w$.
\end{varwidth}
\For{$t=1, \cdots, T$}
\State With probability $\epsilon$ select a random action $a_t$
\State otherwise select $a_t = argmax_a Q(\phi(s_t),a;\theta)$
\State \begin{varwidth}[t]{0.85\linewidth}
Execute action $a_t$ in emulator and observe reward $r_t$ and image $x_{t+1}$
\end{varwidth}
\State \begin{varwidth}[t]{0.85\linewidth}
set $s_{t+1}=(s_t,a_t,x_{t+1})$ and preprocess $\phi_{t+1}=\phi(s_{t+1})$
\end{varwidth}
\State \begin{varwidth}[t]{0.85\linewidth}
Store transition $(\phi_t,a_t,r_t,\phi_{t+1})$ in $D$ and push $r_t$ into $que$
\end{varwidth}
\State \begin{varwidth}[t]{0.85\linewidth}
Sample random minibatch of transitions $(\phi_j,a_j,r_j,\phi_{j+1})$ from $D$
\end{varwidth}
\State \begin{varwidth}[t]{0.85\linewidth}
\[
\textnormal{Set }y_j=\Bigg\{\begin{array}{lc}
r_j, & s_{j+1} \textnormal{is terminal }\\
\dot{\delta}, & \textnormal{o.w.}
\end{array}
\]
where $\dot{\delta} = r_j+\gamma \max_{a'}\hat{Q}(\phi_{j+1},a';\theta^{-})$
\end{varwidth}
\State \begin{varwidth}[t]{0.85\linewidth}
Perform a gradient descent step on $(y_j - Q(\phi_j,a_j;\theta))^2$ with respect to $\theta$
\end{varwidth}
\If{$mod(step,C)==0$}
\State
$\overline{que}_{new} = {\frac{1}{n}}{\sum\limits_{i = 1}^{n} w_i (que_{new} )_i}$
\State
$\overline{que}_{old} = {\frac{1}{n}}{\sum\limits_{i = 1}^{n} w_i (que_{old} )_i}$
\If{$\overline{que}_{new} < \overline{que}_{old}$}
\State
Reset $\hat{Q}=Q$
\EndIf
\EndIf
\EndFor
\EndFor
\end{algorithmic}
\end{algorithm}
\section{Experimental results}
\label{ExperimentalResults}
In this section, we describe our settings and configurations used to test our agents. We used a Linux-based PC to train our agents, and each session lasts between 3 and 4 days. For DQN implementation, we used the Dopamine \cite{r51} library and modified their DQN and Rainbow implementations with our proposed method. For the testing environment, we used Atari 2600 games provided by OpenAi's Gym \cite{r53}.
\subsection{Evaluation methodology}
We did the experiments on AirRaid, Alien, Amidar, Assault, Asterix, Asteroids, Breakout, SpaceInvaders, and Seaquest games. We tried to choose games that are different in visuals and gameplay. In our all experiments all parameters (even the target network period $C$ ) were same as DQN \cite{mnih2015human} and Rainbow \cite{hessel2018rainbow} accordingly and for our hyper-parameters we tested our agent with $k = 3$ and $\delta = 0.01$ .Also, similar to \cite{mnih2015human} and \cite{hessel2018rainbow} we trained our agents with 200 iterations, where each iteration consists of two training and evaluation phases. In the training phase, the agent is trained on 1M frames, and in the evaluation phase, the agent is evaluated only on 512k frames. In both phases, we used the mean of episode return (scores) to evaluate our agents and compare them to DQN and Rainbow. For DQN and Rainbow results, we used data prepared by Dopamine \ cite {r51}. Also, the reported results for each game are an average of 5 training sessions. Although due to limited computing tools and time, we only trained our agent for 3 sessions in 4 games, in all 9 games, our agents were even better than the best DQN representatives.
\subsection{Analysis}
First, we trained our agent on the Breakout game for 50 iterations. Then we plot the real-time return for 1 million frames (or 250k steps) and marked when our agent synced its target network (figure \ref{fig:ASDQNrealtime}). The agent behavior was as expected. It maintained the target networks which it achieved higher returns and synced to new ones when the performance did not meet the criteria.\\
\begin{figure}
\centering
\includegraphics[width=\columnwidth]{images/RealtimeView1M.jpg}
\caption{Real-time return of AS\_DQN agent after 50 iterations of training. Red marks mean the agent did not sync its target network and green marks mean it did.}
\label{fig:ASDQNrealtime}
\end{figure}
As mentioned before, we tested our agents on 9 Atari 2600 games. We used DQN baselines provided by Dopamine library \cite{r51}. AS\_DQN outperformed DQN in almost all 9 games. To be more specific, the average rewards of 3 AS\_DQN agents outperformed the average of 5 DQN agent on 4 games (figure \ref{fig:ASDQNresults}). Also, AS\_DQN agents had less variance over different runs (e.g. the variance of DQN returns over 5 runs of Seaquest is 916200 compared to AS\_DQN's 590507). Furthermore, our single AS\_DQN agents outperformed the average of 5 DQN agents on 5 other games (figure \ref{fig:ASDQNresults2}).
AS\_Rainbow shows an exceptionally good performance in Breakout and Seaquest (Figures \ref{fig:Breakout_Rainbow} and \ref{fig:Seaquest_Rainbow}) but Rainbow outperformed AS\_Rainbow in Asterix (Figure \ref{fig:Asterix_Rainbow}) and AS\_Rainbow performs better than Rainbow in SpaceInvaders (Figure \ref{fig:SpaceInvaders_Rainbow}).
\begin{figure}
\centering
\begin{subfigure}[t]{0.75\columnwidth}
\includegraphics[width=\columnwidth]{images/ASDQN_Asterix.jpg}
\caption{Asterix}
\label{fig:Asterix_DQN}
\end{subfigure}%
\quad
\begin{subfigure}[t]{0.75\columnwidth}
\includegraphics[width=\columnwidth]{images/ASDQN_Breakout.jpg}
\caption{Breakout}
\label{fig:Breakout_DQN}
\end{subfigure}%
\\
\begin{subfigure}[b]{0.75\columnwidth}
\includegraphics[width=\columnwidth]{images/ASDQN_SpaceInvaders.jpg}
\caption{SpaceInvaders}
\label{fig:SpaceInvaders_DQN}
\end{subfigure}%
\quad
\begin{subfigure}[b]{0.75\columnwidth}
\includegraphics[width=\columnwidth]{images/ASDQN_Seaquest.jpg}
\caption{Seaquest}
\label{fig:Seaquest_DQN}
\end{subfigure}%
\caption[ASDQN]{ \textbf{DQN vs AS\_DQN}. Average return of episodes for each iteration are shown for 4 different games. DQN results are averaged over 5 runs and AS\_DQN runs are averaged over 3 runs in this figure. }
\label{fig:ASDQNresults}
\end{figure}
\begin{figure}
\centering
\begin{subfigure}[t]{0.6\columnwidth}
\includegraphics[width=\columnwidth]{images/ASDQN_AirRaid.jpg}
\caption{AirRaid}
\label{fig:ASDQN_AirRaid}
\end{subfigure}%
\quad
\begin{subfigure}[t]{0.6\columnwidth}
\includegraphics[width=\columnwidth]{images/ASDQN_Alien.jpg}
\caption{Alien}
\label{fig:ASDQN_Alien}
\end{subfigure}%
\\
\begin{subfigure}[b]{0.6\columnwidth}
\includegraphics[width=\columnwidth]{images/ASDQN_Amidar.jpg}
\caption{Amidar}
\label{fig:ASDQN_Amidar}
\end{subfigure}%
\quad
\begin{subfigure}[b]{0.6\columnwidth}
\includegraphics[width=\columnwidth]{images/ASDQN_Assault.jpg}
\caption{Assault}
\label{fig:ASDQN_Assault}
\end{subfigure}%
\quad
\begin{subfigure}[b]{0.6\columnwidth}
\includegraphics[width=\columnwidth]{images/ASDQN_Asteroids.jpg}
\caption{Asteroids}
\label{fig:ASDQN_Asteroids}
\end{subfigure}%
\caption[ASDQN2]{ \textbf{DQN vs AS\_DQN}. Average return of episodes for each iteration are shown for 5 different games. DQN results are averaged over 5 runs and AS\_DQN runs are averaged over only one in this figure.}
\label{fig:ASDQNresults2}
\end{figure}
\begin{figure}
\centering
\begin{subfigure}[t]{0.75\columnwidth}
\includegraphics[width=\columnwidth]{images/ASRainbow_Asterix.jpg}
\caption{Asterix}
\label{fig:Asterix_Rainbow}
\end{subfigure}%
\quad
\begin{subfigure}[t]{0.75\columnwidth}
\includegraphics[width=\columnwidth]{images/ASRainbow_Breakout.jpg}
\caption{Breakout}
\label{fig:Breakout_Rainbow}
\end{subfigure}%
\\
\begin{subfigure}[b]{0.75\columnwidth}
\includegraphics[width=\columnwidth]{images/ASRainbow_SpaceInvaders.jpg}
\caption{SpaceInvaders}
\label{fig:SpaceInvaders_Rainbow}
\end{subfigure}%
\quad
\begin{subfigure}[b]{0.75\columnwidth}
\includegraphics[width=\columnwidth]{images/ASRainbow_Seaquest.jpg}
\caption{Seaquest}
\label{fig:Seaquest_Rainbow}
\end{subfigure}%
\caption[AS\_Rainbow]{ \textbf{Rainbow vs AS\_Rainbow}. Average return of episodes for each iteration are shown for 4 different games. DQN results are also shown for better insight of Rainbow and AS\_Rainbow performances.}
\label{fig:ASRainbowresults}
\end{figure}
\begin{figure}
\centering
\begin{subfigure}[t]{0.75\columnwidth}
\includegraphics[width=\columnwidth]{images/ASDQN_Asterix_100to4000.jpg}
\caption{Asterix}
\label{fig:Asterix_ASDQNsmallsteps}
\end{subfigure}%
\quad
\begin{subfigure}[t]{0.75\columnwidth}
\includegraphics[width=\columnwidth]{images/ASDQN_Breakout_100to4000.jpg}
\caption{Breakout}
\label{fig:Breakout_ASDQNsmallsteps}
\end{subfigure}%
\caption[AS\_DQN small steps]{ \textbf{DQN vs AS\_DQN}. Average return of episodes for each iteration are shown for 2 different games with $C=100,1000,3000,4000$ and $C=8000$ as benchmark.}
\label{fig:ASDQNsmallsteps}
\end{figure}
The main problem in methods that use the target network is finding the optimal length of fixed intervals. If we choose a very small step size $C$ for fixed intervals, it leads to instability during training the Q-network, which is not desirable(see DQN agent with $C=100$ in figure \ref{fig:ASDQNsmallsteps}); And if we choose a very long step size $C$, it may lead to overfitting the Q-network to every target network, which again, is not desirable. On the other hand, scale of these step sizes is different for every problem and environment, as you may already know, Atari's Pong game can be trained by a small step size (e.g. $C=100$) which, if used for some other game (e.g. SpaceInvaders) leads to divergence from optimal policy. Therefor, finding appropriate step size is an important problem for DQN and methods based on it and considering only a predefined step size is not optimal. Despite this, due to our knowledge all state of the art methods like Rainbow based on DQN are using a fixed step size. To overcome this problem the main question is that how we define a criterion for quality of a target network? Is the instant rewards that agent obtains from environment a good criterion? These rewards are obtained by actions of the agent, which it chooses based on the current Q-network that is trained by target network. If we use a moving average over recent rewards we can eliminate any instant reward noises and have an acceptable (based on results) criterion.
At last we desire to sync the target network as soon as possible, but in fixed step sized method, networks sync at a predetermined rate. In our method if we choose smaller step sizes, the agent tend to sync the networks as soon as the criteria allows it, and thats why our agent performs better at step sizes lower than $C=8000$ (figure \ref{fig:ASDQNsmallsteps}).
\section{Conclusion}
In this paper, we investigated the DQN Reinforcement learning methods and considered its approach to solve moving targets problem. Here we discussed the drawback of syncing the network in fixed step size used by DQN and its extension, then shown that by evaluating the behavior of agent one could propose an adaptive syncing method.
Optimally we want to sync the target network as soon as possible, but by reducing the step size $C$ we risk the stability of the agent learning process. This type of adaptive approach discussed in this paper, might be the answer to this problem, no matter what is our environment (Atari or not), Our agents could have stable learning process towards the optimal policy without finding and fine tuning a fixed step size.
For this matter, we proposed a simple method for this evaluation and experiments show the quality of this simple evaluation criteria. It is clear that in the future, we and others could derive more sophisticated
criterion for the quality of target networks.
In our test we did not change any hyper-parameters which were used in \cite{mnih2015human} and \cite{hessel2018rainbow} to make a fair comparison.
Due to time and hardware limitations our experiment results are not many but still enough to prove our method is effective.
\bibliographystyle{spbasic}
\section{Introduction}
Reinforcement learning is a branch of machine learning that deals with how an agent can act in an environment to receive the maximum rewards from the environment.
One of the well known and first successful neural networks used in reinforcement learning is \citet{tesauro1994td}~'s TD-gammon \citep{tesauro1994td}. It used neural networks to train the agent who won the world backgammon.
After that, one of the most significant breakthroughs in RL was the Deep Q network\cite{mnih2015human}, which used deep learning in the modeling of the action function.
They used convolutional neural networks in combination with experience replay so that the agent could learn from raw pixels of Atari games without any handcrafted features nor any changes for a specific game. Their experiments have shown that the DQN agent could play Atari 2600 as good as a human.
In addition to using the deep neural networks, addressing the moving targets problem by enabling the network to be synced after a while rather than immediate updates, was another success factor of this method. Their approach for synchronization increased the stability and possibility of convergence to the optimal policy compared to immediately updating the target network.
Following the success of DQN, many extensions of this method presented in recent years. For example, double DQN \cite{van2016deep} addresses the overestimation bias of Q-learning by separating of selection and evaluation of actions \cite{hasselt2010double}.
Prioritized experience replay proposed in \cite{schaul2015prioritized} improved experience replay of DQN. This improvement is done based on selecting important experiences more frequently.
The dueling network architecture \cite{Wang2016Dueling} is another extension that tries to generalize
across actions by separately representing state values
and action advantages to different neural networks.
In distributional Q-learning \cite{bellemare2017distributional}, the agent learns to approximate the distribution of returns instead of expected returns.
Recently in \cite{hessel2018rainbow}, all of these extensions were integrated into one agent called Rainbow. In the reported experiments, this integrated method achieves the state of the art performance.
In all methods similar to the DQN, syncing the deep networks is done at fixed predefined intervals. Although this approach could solve the moving target problem, losing some semi-optimal trained target networks in some cases is its main drawback. Syncing the target network weights without considering the agent's behavior may prevent the agent from following a good policy which could lead to more potential rewards. In this paper, we propose an adaptive way of syncing with considering the behavior of the agent.
\section{Background}
\label{sec:Background}
Reinforcement learning problems can be formalized by the Markov Decision Process (MDP). MDP is a tuple $\langle \mathcal{S},\mathcal{A},T,r,\gamma \rangle$ where $\mathcal{S}$ is a finite set of states, $\mathcal{A}$ is a finite set of actions, $T$ is the transition matrix, $r$ is the reward function and $\gamma$ is a discount factor.
Usually, in reinforcement learning, an agent starts at state $S_1$ and then by selecting an action $A_t$, the environment sends a reward signal $R_1$ and the agent moves to the next state $S_{2}$ based on $T(S_1,A_t)$ and so on, until it reaches to a terminal state or the maximum number of steps allowed.
\subsection{Basics of reinforcement learning}
Policy, value functions, and the model are relevant concepts in RL.
While the policy is the agent's behavior function, the value functions determine the quality of each state or each action. The model is the agent's representation of the environment.
Temporal-Difference learning \cite{sutton1988learning} is One of the most important and widely used techniques in reinforcement learning. In this method, the agent learns to predict the expected value of the value function at the end of each step. Expressed formally:
\begin{equation}
V(S_t) \leftarrow V(S_t) + \alpha [R_{t+1}+\gamma V(S_{t+1})-V(S_t)]. \label{eqn:TDlearning}
\end{equation}
On-policy and off-policy learning methods are two categories that used in RL. In on-policy learning the value functions us learned from the actions, the agent achieves using the current policy. In off-policy methods, the policy used to generate behavior may be unrelated to the policy that is evaluated and improved.
DQN (based on Q-learnin)g \cite{watkins1992q} is an off-policy control algorithm of TD(0). In this algorithm, first action-values are initialized arbitrary (e.\ g. 0) and then in each step old value $Q(s_t,a_t)$ is updated by a fraction (learning rate) of
$r+\gamma \max_{a'}Q^*(s',a')$ which called is the td-target $\delta$ \eqref{eqn:qlearning}. Q-learning is formulated as:
\begin{equation}
Q(S_t,A_t) \leftarrow Q(S_t,A_t) + \alpha \cdot \delta. \label{eqn:qlearning}
\end{equation}
where $\delta$ is td-target
\begin{equation}
\delta = [R_{t+1}+\gamma \max_a Q(S_{t+1},a)-Q(S_t,A_t)]
\end{equation}
and $\alpha$ is the learning rate.
Q-learning is considered a tabular solution method \cite{sutton2018reinforcement}. There are other types of RL methods that use approximation instead of a tabular solution. In Q-learning, we can approximate action-value function $Q$ instead of calculating the exact value of it. This is the main idea of deep reinforcement learning discussed in section \ref{sec:DQN}.
\subsection{Deep reinforcement learning}
\label{sec:DQN}
The authors in\cite{mnih2015human} developed a deep reinforcement learning method by using a deep convolutional neural network to approximate the action-value function. Using CNN architecture enabled them to learn from raw images (in this instance, images of Atari 2600 games) without any handcrafted features. Furthermore, the same settings and network architecture used from variant games and DQN showed the state of the art performance in the majority of the games. The development of DQN was challenging, one of which was moving targets problem. In each iteration, the values of Q may change, thus altering the value of the targets, which may cause oscillations or divergence. In \citet{mnih2015human}, to overcome this challenge the weights of the action value network for C updates are cloned and used as the Q-learning updates.
The duplicated Q-network is showed by $\hat{Q}$.
Another challenge of using DQN was the correlation between successive samples, which led to a large variation between updates, thus instability of the method. All of mentioned extensions (including Rainbow) are using the same approach as DQN to overcome the moving targets problem. \citet{mnih2015human} Modified the standard Q-learning to use experience replay \cite{lin1992self}. Experiences $e_t=(s_t,a_t,r_t,s_{t+1})$ at each time-step $t$ are stored in a memory data set $D_t=\{e_1,\cdots,e_t\}$ and during learning Q-learning updates will be applied by samples of these experiences which are selected randomly with a uniform distribution.
The raw images of Atari games are preprocessed by function $\phi$ (described in \cite{mnih2015human}) and turned into an $84\times84\times4$ image (or tensor). Q-network consists of three convolutional layers and two fully connected layers with rectifier nonlinearity (that is, $\max(0,x)$) as activation function and the output layer has a single output for each valid action. The Q-network can be trained by optimizing the parameters $\theta_i$ at iteration $i$ to reduce the mean-squared error in the Bellman equation, where the optimal target values $r+\gamma \max_{a'}Q^*(s',a') $ are substituted with approximate target values $y= r+\gamma \max_{a'}Q^*(s',a';\theta_i^{-})$, using parameters $\theta_i$ from some previous iteration. This leads to a sequence of loss functions $L_i(\theta_i)$ that changes at each iteration i,
\begin{equation}
L_i(\theta_i) = \mathbb{E}_{s,a,r,s'\sim D_i }\bigg[(\dot{\delta} - Q(s,a;\theta_i))^2\bigg]
\label{eqn:lossfunction}
\end{equation}
where
\begin{equation}
\dot{\delta} = r+\gamma \max_{a'}Q^*(s',a';\theta_i^{-})
\end{equation}
Which can be optimized by gradient descent methods, specifically stochastic gradient descent method.
\begin{algorithm}
\caption{deep Q-learning with experience replay.
} \label{alg:DQN}
\begin{algorithmic}[1]
\State Initialize replay memory $ D $ to capacity $ N $
\State Initialize action-value function $ Q $ with random weights $ \theta $
\State Initialize target action-value function $ \hat{Q} $ with weights $ \theta^{-}=\theta $
\For{$episode = 1, \cdots, M$}
\State \begin{varwidth}[t]{0.9\linewidth}
Initialize sequence $s_1 = \{x_1\}$ and preprocessed sequence $\phi_1=\phi(s_1)$
\end{varwidth}
\For{$t=1, \cdots, T$}
\State With probability $\epsilon$ select a random action $a_t$
\State otherwise select $a_t = argmax_a Q(\phi(s_t),a;\theta)$
\State \begin{varwidth}[t]{0.8\linewidth}
Execute action $a_t$ in emulator and observe reward $r_t$ and image $x_{t+1}$
\end{varwidth}
\State \begin{varwidth}[t]{0.8\linewidth}
set $s_{t+1}=(s_t,a_t,x_{t+1})$ and preprocess \mbox{$\phi_{t+1}=\phi(s_{t+1})$}
\end{varwidth}
\State Store transition $(\phi_t,a_t,r_t,\phi_{t+1})$ in $D$
\State \begin{varwidth}[t]{0.8\linewidth}
Sample random minibatch of transitions $(\phi_j,a_j,r_j,\phi_{j+1})$ from $D$
\end{varwidth}
\State \begin{varwidth}[t]{0.8\linewidth}
\[
\textnormal{Set }y_j=\Bigg\{\begin{array}{lc}
r_j, & s_{j+1} \textnormal{is terminal }\\
\dot{\delta}, & \textnormal{o.w.}
\end{array}
\]
where $\dot{\delta} = r_j+\gamma \max_{a'}\hat{Q}(\phi_{j+1},a';\theta^{-})$
\end{varwidth}
\State \begin{varwidth}[t]{0.8\linewidth}
Perform a gradient descent step on $(y_j - Q(\phi_j,a_j;\theta))^2$ with respect to $\theta$
\end{varwidth}
\State Every $C$ steps reset $\hat{Q}=Q$
\EndFor
\EndFor
\end{algorithmic}
\end{algorithm}
\section{Proposed adaptive synchronization method}
\label{sec:ProposedMethod}
As mentioned, in DQN and it's extensions, syncing the deep networks is done at intervals with the fixed step size $C$ to solve the moving target problem.
Syncing the target network weights in a fixed step size $C$ without considering the agent's behavior may prevent the agent from following a good policy and leading to more potential rewards. In this section, we define a criterion to find out when to sync the network instead of the fixed steps size.
This criterion should set up based on the obtained rewards by the agent. Since these rewards are obtained by the actions of the agent(chosen by $a_t = argmax_a \hat{Q}(s_t, a;\theta)$) then they are dependent to the Q-network that is learning continuously by target network (see \eqref{eqn:lossfunction}). Therefore, we can use a stream of recent rewards to measure the behavior of the agent as an evaluation of the network quality. Then, based on this evaluation criterion, we can decide when to synchronize the target network with the Q-network.
Let $t$ be a step that we should decide about syncing. To construct our criterion for syncing, we push the recent rewards (obtained from the environment) in a queue
$ \{r_{2n-t+1}, \ldots, r_t\}$
with the length $2n$ and compare the quality of rewards of the first part, i.e,
$que_{old} =\{ r_{t-2n+1}, \cdots, r_{t-n}\}$
and the second part
$que_{new} =\{ r_{t-n+1}, \cdots, r_t\}$
of this queue to construct our criterion. Here $n$ could be selected as $C$. If the second part works better than the first one this means that the agent and so the network works good and we should preserve this network.
Average of rewards can tell us about the behavior of agent but since we are more interested in recent behavior, applying a weight vector $w$ which increases the effect of recent rewards can lead to a better representation of recent behavior of the agent. So this weight vector should satisfy the following conditions
\begin{align}
w_{1}\leq w_2 \leq \ldots \leq w_n, \quad \sum_{i=1}^{n}w_i=1
\end{align}
Although different type of weights could be used, here we use a simple form
\[
w_{i}=\frac{i}{n(n+1)}.
\]
So the weighted average of rewards in both $que_{new}$ and $que_{old}$ will be
\begin{align}
\overline{que}_{new} &= {\frac{1}{n}}{\sum\limits_{i = 1}^{n} w_i (que_{new})_i} \label{eqn:AVGQue1}\\
\overline{que}_{old} &= {\frac{1}{n}}{\sum\limits_{i = 1}^{n} w_i (que_{old})_i} \label{eqn:AVGQue2}
\end{align}
Now we need to decide whether to sync $\hat{Q}=Q$ or not, for this matter, we used the simple idea of comparing the weighted average of $que_{new}$ and $que_{old}$.
We, at each $C$ steps, calculate $\overline{que}_{new}$ and $\overline{que}_{old}$ (\eqref{eqn:AVGQue1} , \eqref{eqn:AVGQue2}) and if $\overline{que}_{new} < \overline{que}_{old}$ which means the recent behavior of the agent is not as good as last time, we sync the weights of Q-network. Because of adaptability of our synchronization method, we call our modified DQN agent the Adaptive Synchronization DQN or for short AS\_DQN and our modified Rainbow agent, AS\_Rainbow.
\begin{algorithm}
\caption{Adaptive Synchronization DQN}
\label{alg:ASDQN}
\begin{algorithmic}[1]
\State Initialize replay memory $ D $ to capacity $ N $
\State Initialize action-value function $ Q $ with random weights $ \theta $
\State Initialize target action-value function $ \hat{Q} $ with weights $ \theta^{-}=\theta $
\For{$episode = 1, \cdots, M$}
\State \begin{varwidth}[t]{0.9\linewidth}
Initialize sequence $s_1 = \{x_1\}$ and preprocessed sequence $\phi_1=\phi(s_1)$
\end{varwidth}
\State \begin{varwidth}[t]{0.9\linewidth}
Initialize $que$ a $2n$ queue containing the rewards with weight vector $w$.
\end{varwidth}
\For{$t=1, \cdots, T$}
\State With probability $\epsilon$ select a random action $a_t$
\State otherwise select $a_t = argmax_a Q(\phi(s_t),a;\theta)$
\State \begin{varwidth}[t]{0.85\linewidth}
Execute action $a_t$ in emulator and observe reward $r_t$ and image $x_{t+1}$
\end{varwidth}
\State \begin{varwidth}[t]{0.85\linewidth}
set $s_{t+1}=(s_t,a_t,x_{t+1})$ and preprocess $\phi_{t+1}=\phi(s_{t+1})$
\end{varwidth}
\State \begin{varwidth}[t]{0.85\linewidth}
Store transition $(\phi_t,a_t,r_t,\phi_{t+1})$ in $D$ and push $r_t$ into $que$
\end{varwidth}
\State \begin{varwidth}[t]{0.85\linewidth}
Sample random minibatch of transitions $(\phi_j,a_j,r_j,\phi_{j+1})$ from $D$
\end{varwidth}
\State \begin{varwidth}[t]{0.85\linewidth}
\[
\textnormal{Set }y_j=\Bigg\{\begin{array}{lc}
r_j, & s_{j+1} \textnormal{is terminal }\\
\dot{\delta}, & \textnormal{o.w.}
\end{array}
\]
where $\dot{\delta} = r_j+\gamma \max_{a'}\hat{Q}(\phi_{j+1},a';\theta^{-})$
\end{varwidth}
\State \begin{varwidth}[t]{0.85\linewidth}
Perform a gradient descent step on $(y_j - Q(\phi_j,a_j;\theta))^2$ with respect to $\theta$
\end{varwidth}
\If{$mod(step,C)==0$}
\State
$\overline{que}_{new} = {\frac{1}{n}}{\sum\limits_{i = 1}^{n} w_i (que_{new} )_i}$
\State
$\overline{que}_{old} = {\frac{1}{n}}{\sum\limits_{i = 1}^{n} w_i (que_{old} )_i}$
\If{$\overline{que}_{new} < \overline{que}_{old}$}
\State
Reset $\hat{Q}=Q$
\EndIf
\EndIf
\EndFor
\EndFor
\end{algorithmic}
\end{algorithm}
\section{Experimental results}
\label{ExperimentalResults}
In this section, we describe our settings and configurations used to test our agents. We used a Linux-based PC to train our agents, and each session lasts between 3 and 4 days. For DQN implementation, we used the Dopamine \cite{r51} library and modified their DQN and Rainbow implementations with our proposed method. For the testing environment, we used Atari 2600 games provided by OpenAi's Gym \cite{r53}.
\subsection{Evaluation methodology}
We did the experiments on AirRaid, Alien, Amidar, Assault, Asterix, Asteroids, Breakout, SpaceInvaders, and Seaquest games. We tried to choose games that are different in visuals and gameplay. In our all experiments all parameters (even the target network period $C$ ) were same as DQN \cite{mnih2015human} and Rainbow \cite{hessel2018rainbow} accordingly and for our hyper-parameters we tested our agent with $k = 3$ and $\delta = 0.01$ .Also, similar to \cite{mnih2015human} and \cite{hessel2018rainbow} we trained our agents with 200 iterations, where each iteration consists of two training and evaluation phases. In the training phase, the agent is trained on 1M frames, and in the evaluation phase, the agent is evaluated only on 512k frames. In both phases, we used the mean of episode return (scores) to evaluate our agents and compare them to DQN and Rainbow. For DQN and Rainbow results, we used data prepared by Dopamine \ cite {r51}. Also, the reported results for each game are an average of 5 training sessions. Although due to limited computing tools and time, we only trained our agent for 3 sessions in 4 games, in all 9 games, our agents were even better than the best DQN representatives.
\subsection{Analysis}
First, we trained our agent on the Breakout game for 50 iterations. Then we plot the real-time return for 1 million frames (or 250k steps) and marked when our agent synced its target network (figure \ref{fig:ASDQNrealtime}). The agent behavior was as expected. It maintained the target networks which it achieved higher returns and synced to new ones when the performance did not meet the criteria.\\
\begin{figure}
\centering
\includegraphics[width=\columnwidth]{images/RealtimeView1M.jpg}
\caption{Real-time return of AS\_DQN agent after 50 iterations of training. Red marks mean the agent did not sync its target network and green marks mean it did.}
\label{fig:ASDQNrealtime}
\end{figure}
As mentioned before, we tested our agents on 9 Atari 2600 games. We used DQN baselines provided by Dopamine library \cite{r51}. AS\_DQN outperformed DQN in almost all 9 games. To be more specific, the average rewards of 3 AS\_DQN agents outperformed the average of 5 DQN agent on 4 games (figure \ref{fig:ASDQNresults}). Also, AS\_DQN agents had less variance over different runs (e.g. the variance of DQN returns over 5 runs of Seaquest is 916200 compared to AS\_DQN's 590507). Furthermore, our single AS\_DQN agents outperformed the average of 5 DQN agents on 5 other games (figure \ref{fig:ASDQNresults2}).
AS\_Rainbow shows an exceptionally good performance in Breakout and Seaquest (Figures \ref{fig:Breakout_Rainbow} and \ref{fig:Seaquest_Rainbow}) but Rainbow outperformed AS\_Rainbow in Asterix (Figure \ref{fig:Asterix_Rainbow}) and AS\_Rainbow performs better than Rainbow in SpaceInvaders (Figure \ref{fig:SpaceInvaders_Rainbow}).
\begin{figure}
\centering
\begin{subfigure}[t]{0.75\columnwidth}
\includegraphics[width=\columnwidth]{images/ASDQN_Asterix.jpg}
\caption{Asterix}
\label{fig:Asterix_DQN}
\end{subfigure}%
\quad
\begin{subfigure}[t]{0.75\columnwidth}
\includegraphics[width=\columnwidth]{images/ASDQN_Breakout.jpg}
\caption{Breakout}
\label{fig:Breakout_DQN}
\end{subfigure}%
\\
\begin{subfigure}[b]{0.75\columnwidth}
\includegraphics[width=\columnwidth]{images/ASDQN_SpaceInvaders.jpg}
\caption{SpaceInvaders}
\label{fig:SpaceInvaders_DQN}
\end{subfigure}%
\quad
\begin{subfigure}[b]{0.75\columnwidth}
\includegraphics[width=\columnwidth]{images/ASDQN_Seaquest.jpg}
\caption{Seaquest}
\label{fig:Seaquest_DQN}
\end{subfigure}%
\caption[ASDQN]{ \textbf{DQN vs AS\_DQN}. Average return of episodes for each iteration are shown for 4 different games. DQN results are averaged over 5 runs and AS\_DQN runs are averaged over 3 runs in this figure. }
\label{fig:ASDQNresults}
\end{figure}
\begin{figure}
\centering
\begin{subfigure}[t]{0.6\columnwidth}
\includegraphics[width=\columnwidth]{images/ASDQN_AirRaid.jpg}
\caption{AirRaid}
\label{fig:ASDQN_AirRaid}
\end{subfigure}%
\quad
\begin{subfigure}[t]{0.6\columnwidth}
\includegraphics[width=\columnwidth]{images/ASDQN_Alien.jpg}
\caption{Alien}
\label{fig:ASDQN_Alien}
\end{subfigure}%
\\
\begin{subfigure}[b]{0.6\columnwidth}
\includegraphics[width=\columnwidth]{images/ASDQN_Amidar.jpg}
\caption{Amidar}
\label{fig:ASDQN_Amidar}
\end{subfigure}%
\quad
\begin{subfigure}[b]{0.6\columnwidth}
\includegraphics[width=\columnwidth]{images/ASDQN_Assault.jpg}
\caption{Assault}
\label{fig:ASDQN_Assault}
\end{subfigure}%
\quad
\begin{subfigure}[b]{0.6\columnwidth}
\includegraphics[width=\columnwidth]{images/ASDQN_Asteroids.jpg}
\caption{Asteroids}
\label{fig:ASDQN_Asteroids}
\end{subfigure}%
\caption[ASDQN2]{ \textbf{DQN vs AS\_DQN}. Average return of episodes for each iteration are shown for 5 different games. DQN results are averaged over 5 runs and AS\_DQN runs are averaged over only one in this figure.}
\label{fig:ASDQNresults2}
\end{figure}
\begin{figure}
\centering
\begin{subfigure}[t]{0.75\columnwidth}
\includegraphics[width=\columnwidth]{images/ASRainbow_Asterix.jpg}
\caption{Asterix}
\label{fig:Asterix_Rainbow}
\end{subfigure}%
\quad
\begin{subfigure}[t]{0.75\columnwidth}
\includegraphics[width=\columnwidth]{images/ASRainbow_Breakout.jpg}
\caption{Breakout}
\label{fig:Breakout_Rainbow}
\end{subfigure}%
\\
\begin{subfigure}[b]{0.75\columnwidth}
\includegraphics[width=\columnwidth]{images/ASRainbow_SpaceInvaders.jpg}
\caption{SpaceInvaders}
\label{fig:SpaceInvaders_Rainbow}
\end{subfigure}%
\quad
\begin{subfigure}[b]{0.75\columnwidth}
\includegraphics[width=\columnwidth]{images/ASRainbow_Seaquest.jpg}
\caption{Seaquest}
\label{fig:Seaquest_Rainbow}
\end{subfigure}%
\caption[AS\_Rainbow]{ \textbf{Rainbow vs AS\_Rainbow}. Average return of episodes for each iteration are shown for 4 different games. DQN results are also shown for better insight of Rainbow and AS\_Rainbow performances.}
\label{fig:ASRainbowresults}
\end{figure}
\begin{figure}
\centering
\begin{subfigure}[t]{0.75\columnwidth}
\includegraphics[width=\columnwidth]{images/ASDQN_Asterix_100to4000.jpg}
\caption{Asterix}
\label{fig:Asterix_ASDQNsmallsteps}
\end{subfigure}%
\quad
\begin{subfigure}[t]{0.75\columnwidth}
\includegraphics[width=\columnwidth]{images/ASDQN_Breakout_100to4000.jpg}
\caption{Breakout}
\label{fig:Breakout_ASDQNsmallsteps}
\end{subfigure}%
\caption[AS\_DQN small steps]{ \textbf{DQN vs AS\_DQN}. Average return of episodes for each iteration are shown for 2 different games with $C=100,1000,3000,4000$ and $C=8000$ as benchmark.}
\label{fig:ASDQNsmallsteps}
\end{figure}
The main problem in methods that use the target network is finding the optimal length of fixed intervals. If we choose a very small step size $C$ for fixed intervals, it leads to instability during training the Q-network, which is not desirable(see DQN agent with $C=100$ in figure \ref{fig:ASDQNsmallsteps}); And if we choose a very long step size $C$, it may lead to overfitting the Q-network to every target network, which again, is not desirable. On the other hand, scale of these step sizes is different for every problem and environment, as you may already know, Atari's Pong game can be trained by a small step size (e.g. $C=100$) which, if used for some other game (e.g. SpaceInvaders) leads to divergence from optimal policy. Therefor, finding appropriate step size is an important problem for DQN and methods based on it and considering only a predefined step size is not optimal. Despite this, due to our knowledge all state of the art methods like Rainbow based on DQN are using a fixed step size. To overcome this problem the main question is that how we define a criterion for quality of a target network? Is the instant rewards that agent obtains from environment a good criterion? These rewards are obtained by actions of the agent, which it chooses based on the current Q-network that is trained by target network. If we use a moving average over recent rewards we can eliminate any instant reward noises and have an acceptable (based on results) criterion.
At last we desire to sync the target network as soon as possible, but in fixed step sized method, networks sync at a predetermined rate. In our method if we choose smaller step sizes, the agent tend to sync the networks as soon as the criteria allows it, and thats why our agent performs better at step sizes lower than $C=8000$ (figure \ref{fig:ASDQNsmallsteps}).
\section{Conclusion}
In this paper, we investigated the DQN Reinforcement learning methods and considered its approach to solve moving targets problem. Here we discussed the drawback of syncing the network in fixed step size used by DQN and its extension, then shown that by evaluating the behavior of agent one could propose an adaptive syncing method.
Optimally we want to sync the target network as soon as possible, but by reducing the step size $C$ we risk the stability of the agent learning process. This type of adaptive approach discussed in this paper, might be the answer to this problem, no matter what is our environment (Atari or not), Our agents could have stable learning process towards the optimal policy without finding and fine tuning a fixed step size.
For this matter, we proposed a simple method for this evaluation and experiments show the quality of this simple evaluation criteria. It is clear that in the future, we and others could derive more sophisticated
criterion for the quality of target networks.
In our test we did not change any hyper-parameters which were used in \cite{mnih2015human} and \cite{hessel2018rainbow} to make a fair comparison.
Due to time and hardware limitations our experiment results are not many but still enough to prove our method is effective.
\bibliographystyle{spbasic}
| {'timestamp': '2020-08-18T02:19:43', 'yymm': '2008', 'arxiv_id': '2008.06973', 'language': 'en', 'url': 'https://arxiv.org/abs/2008.06973'} | arxiv |
\subsubsection{0pt}{0pt}{0pt}}
\newcounter{observation}
\newcommand{\observation}[1]{\refstepcounter{observation}
\begin{center}
\Ovalbox{
\begin{minipage}{0.93\columnwidth}
{\bf Observation \arabic{observation}:} #1
\end{minipage}
}
\end{center}
}
\def120{120}
\newcommand\hl[1]{\textcolor{blue}{#1}}
\newcommand\hlbreakable[1]{\textcolor{blue}{#1}}
\newcommand\com[1]{\textcolor{blue}{Comment: #1}}
\makesavenoteenv{tabular}
\makesavenoteenv{table}
\newcommand{\specialcell}[2][c]{%
\begin{tabular}[#1]{@{}c@{}}#2\end{tabular}}
\newcommand{\textsc{Semantic}\xspace}{\textsc{Semantic}\xspace}
\newcommand{\textsc{Disjoint}\xspace}{\textsc{Disjoint}\xspace}
\newcommand{\textsc{Formatting}\xspace}{\textsc{Formatting}\xspace}
\newcommand{\textsc{Comments}\xspace}{\textsc{Comments}\xspace}
\newcommand{\textsc{Delete}\xspace}{\textsc{Delete}\xspace}
\newcommand{\textsc{Other}\xspace}{\textsc{Other}\xspace}
\newcommand{\textsc{Trivial}\xspace}{\textsc{Trivial}\xspace}
\newcommand{\textsc{Non-trivial}\xspace}{\textsc{Non-trivial}\xspace}
\newcommand{\textsc{Adapted}\xspace}{\textsc{Adapted}\xspace}
\newcommand{\cobbling}{\textsc{Adapted}\xspace}
\newcommand{\textsc{Interleave}\xspace}{\textsc{Interleave}\xspace}
\newcommand{\mixandmatch}{\textsc{Interleave}\xspace}
\newcommand{\textsc{Select one}\xspace}{\textsc{Select one}\xspace}
\newcommand{\trivial}{\textsc{Trivial}\xspace}
\newcommand{\nontrivial}{\textsc{Non-trivial}\xspace}
\newcommand{core}{core}
\newcommand{Core}{Core}
\newcommand{non-core}{non-core}
\newcommand{Non-core}{Non-core}
\newcommand{\textsc{Third Party}}{\textsc{Third Party}}
\newcommand{\revchanges}[1]{\textcolor{blue}{#1}}
\makeatletter
\newcommand*{\rom}[1]{\expandafter\@slowromancap\romannumeral #1@}
\begin{document}
\title{A Deep Dive on the Impact of COVID-19 in Software Development}
\author{Paulo Anselmo da Mota Silveira Neto \and Umme Ayda Mannan \and Eduardo Santana de Almeida \and Nachiappan Nagappan \and David Lo \and Pavneet Singh Kochhar \and Cuiyun Gao \and Iftekhar Ahmed}
\date{Received: date / Accepted: date}
\maketitle
\begin{abstract}
\textbf{Context.} COVID-19 pandemic has impacted different business sectors around the world. \textbf{Objective.} This study investigates the impact of COVID-19 on software projects and software development professionals. \textbf{Method.} We conducted a mining software repository study based on 100 GitHub projects developed in Java using ten different metrics. Next, we surveyed 279 software development professionals for better understanding the impact of COVID-19 on daily activities and wellbeing. \textbf{Results.} We identified 12 observations related to productivity, code quality, and wellbeing. \textbf{Conclusions.} Our findings highlight that the impact of COVID-19 is not binary (reduce productivity vs. increase productivity) but rather a spectrum. For many of our observations, substantial proportions of respondents have differing opinions from each other. We believe that more research is needed to uncover specific conditions that cause certain outcomes to be more prevalent.
\keywords{COVID-19\and Empirical Study \and Survey \and Mining Software Repository (MSR)}
\end{abstract}
\section{Introduction}
The latest threat to global health is the ongoing
outbreak of the respiratory disease that was recently
given the name Coronavirus Disease 2019
(COVID-19) \cite{Uncharted}. COVID-19 was recognized in December 2019, in Wuhan, a large city in central China \cite{Wuhan}. Three months later, on March 11, 2020, the World Health Organization (WHO) characterized COVID-19 as a pandemic\footnote{WHO characterizes COVID-19 as a pandemic. \url{https://www.who.int/emergencies/diseases/novel-coronavirus-2019/events-as-they-happen}}. According to WHO:\textit{``We have never before seen a pandemic sparked by a coronavirus. This is the first pandemic caused by a coronavirus. And we have never before seen a pandemic that can be controlled, at the same time.''} In August 2020, COVID-19 was spread out more than 200 countries with more than 500k confirmed deaths.
The COVID-19 pandemic is considered the most crucial global health calamity of the century and the greatest challenge humankind faced since the 2nd World War \cite{Chakraborty}. It has enormously impacted how we live and interact with each other (social distancing, wearing masks, washing hands frequently, quarantine, etc.) Besides the health problems, the action taken by the countries around the world to manage the COVID-19 pandemic, e.g., restricting travel, shuttering nonessential businesses, and implementing universal social distancing policies, are having drastic economic consequences. In the United States, for example, more than 30 million Americans have filed initial unemployment claims since March 2020.\footnote{\url{https://edition.cnn.com/2020/04/30/economy/unemployment-benefits-coronavirus/index.html}}
Business sectors, such as travel and transportation, manufacturing, hotels, restaurants, live entertainment and movie, and sports are strongly impacted and they are having to adapt to this new situation. The software development sector is not an exception. Besides the economic aspects, suddenly, companies had to support and (in some cases) equip office workers who quickly transitioned to a work-from-home set up because of the pandemic.
Working from home is not a new reality for software development. Many companies adopt different approaches for it, such as remote teams that have employees in a single country or even in one city, and some/all of them work from home without having to go to the office every day. Professional websites such as Upwork, Linkedin, and Stack Overflow present several job offers to work remotely. However, working from home during a pandemic is not like regular remote work. Additional difficulties are involved due to the lack of proper physical infrastructure, the need to care for children with school and daycare being closed, fear and anxiety of contracting COVID-19, etc.
Previous research studies \cite{DBLP:journals/tse/HerbslebM03}, \cite{DBLP:conf/fose/Herbsleb07}, \cite{DBLP:conf/icse/CataldoH08}, \cite{DBLP:journals/cacm/Herbsleb09} have investigated remote work and responses for a better understanding of pandemic \cite{twitter}, \cite{dashboard}, \cite{Verity}, \cite{Walkereabc0035}, \cite{covidex}. However, just a few studies \cite{bao2020does}, \cite{rahman2020exploratory}, \cite{ralph2020pandemic} have started to investigate the impact of a pandemic in software development. This aspect can be justified since COVID-19 is the first pandemic after World Wide Web development. Thus, to gain insights into the impact of COVID-19 in software development, our first research question (\textit{RQ1: What is the Impact of COVID-19 on Projects?}) explores how the pandemic impacts open source projects considering different perspectives. In addition to quantitative information about the projects, it is also important to understand the impact on developers' wellbeing; this motivates us to investigate another research question (\textit{RQ2: What is the Impact of COVID-19 on Developers WellBeing?}).
To answer these questions, we conducted a mining software repository study based on 100 GitHub projects developed in Java. The Java projects were selected according to different criteria ranging from the last update to the number of commits. We collected ten metrics for analyzing the projects. Next, we surveyed 279 software development professionals from 32 countries. The survey asked respondents to provide feedback on the impact of COVID-19 on software projects and their wellbeing.
Overall, the paper makes the following contributions:
\begin{itemize}
\item{} We perform a large scale quantitative study to investigate the impact of COVID-19 on software development based on ten different metrics.
\item{} We complement this study with a survey of how software development professionals perceive the impact of COVID-19 on daily activities.
\item{} Based on a set of observations from the mining software repository study and survey, we provide some recommendations for practitioners, organizations, and researchers.
\item For replication and reproducible research, we make our materials available on our project website. These include our repository mining data (project data, including metrics and time series data) and survey instrument. Our artifacts can be found at the accompanying website.\footnote{https://github.com/pamsn/covid-study}
\end{itemize}
\section{Background and Related Work}
\label{litreview}
In this section, we discuss the main work related to our study.
\subsection{COVID-19 Studies}
The COVID-19 pandemic originated the development of several multidisciplinary initiatives around the world. The Center for Systems Science and Engineering (CSSE) at Johns Hopkins University, created an interactive web-based dashboard to visualize and track COVID-19 reported cases in real-time \cite{dashboard}. The dashboard illustrates the location and number of confirmed COVID-19 cases, deaths, and recoveries for all affected countries. Zhang et al. \cite{covidex} created, Neural Covidex, a search engine for clinicians, researchers, and other experts trying to better understand COVID-19. The system offers access to the Allen Institute for AI’s COVID-19 Open Research Dataset (CORD-19). CORD-19 is a curated public resource of more than 40,000 scholarly articles, medical reports, journal articles, and preprints about COVID-19 and the coronavirus family of viruses. Researchers from MRC Centre for Global Infectious Disease Analysis, from Imperial College London, have developed a set of tools and prediction models based on different scenarios (social distancing, shielding the elderly, and healthcare availability) \cite{Verity}, \cite{Walkereabc0035}. Chen et al. \cite{twitter} created a public Coronavirus Twitter dataset with more than 100 million tweets. According to the authors, the dataset can help track scientific coronavirus misinformation and unverified rumors, and contribute towards enabling informed solutions and prescribing targeted policy interventions.
In the software engineering area, Ralph et al. \cite{ralph2020pandemic} conducted a survey with 2225 software developers to understand the effects of the COVID-19 pandemic on developers' wellbeing and productivity. They identified that developers had lower wellbeing and productivity while working from home due to COVID-19. In addition, disaster preparedness, fear related to the pandemic and home office
ergonomics all affect wellbeing and productivity; and women, parents, and people with disabilities may be disproportionately affected.
Rahman and Farhana \cite{rahman2020exploratory} conducted an empirical study with 129 open source COVID-19 projects hosted on GitHub to identify what categories of bugs exist in this kind of project. Initially, they identified seven categories of COVID-19 projects (aggregation, education, medical equipment, mining, user tracking, statistical modeling, and volunteer management). Next, applying open coding on 550 bug reports, they identified eight bug categories for these projects (algorithm, data, dependency, documentation, performance, security, syntax, and user interface). Based on this taxonomy, user interface was the most frequent category using the proportion of bugs across all projects, and documentation was the least frequent category.
Bao et al. \cite{bao2020does} collected data from a Chinese company, which contains the development activities from 139 developers working in 8 projects over a period of 138 working days, and compared developer productivity when working from home and working onsite. Part of records in the dataset included a period where developers worked from home due to COVID-19 pandemic. They found that working from home has both positive and negative impacts on developer productivity in terms of different metrics, such as the number of builds/commits/code reviews. In addition, they identified that working from home has different impacts on different kinds of projects. For example, working from home has a negative impact on developer productivity for large projects. They also found that the majority of developers' productivity when working from home is similar to that when working onsite. For a small portion of developers, working from home had different impacts on their productivity.
\subsection{Productivity}
There are a number of studies \cite{4273079}, \cite{8658138}, \cite{47853}, \cite{8851296}, \cite{pull},that investigate developer productivity. For example, Meyer et al.~\cite{MeyerM0F17} investigated how developer workday looks like and the relationships between their activities and perceived productivity. The study uncovered that productivity is a personal matter, and factors such as emails and meetings are often considered detrimental to productivity. In another work, Murphy-Hill et al.~\cite{Murphy-Hill19} surveyed 622 developers across 3 companies regarding self-perceived productivity and its contributing factors. They uncovered that developers perceived productivity is strongly correlated to job enthusiasm, peer support, and reception of useful feedback. Moreover, they reported that compared to other knowledge workers, {\em ability to work remotely} is more strongly related to perceived productivity. Unlike the aforementioned studies, in this work, we investigate the impact of COVID-19 on software projects.
\subsection{Wellbeing}
Many prior works investigate wellbeing in the workplace, e.g.,~\cite{BhutkarRCBAMLCG19}. However, not many investigate it in the context of software development. One such work is by Kuutila et al.~\cite{KuutilaMCEA18} that investigated the relationship between developer wellbeing and software repository metrics. They reported that developers who reported ``high hurry'' were less productive. Moreover, factors that hamper wellbeing (such as stress, sleeping problems, etc.) are negatively related to the number of chat messages. Another work by Graziotin et al.~\cite{GraziotinFWA18} investigated what happens when developers are happy and unhappy. They found that unhappiness impacts the developer's own being (in terms of low cognitive performance, mental unease, and disorder, etc.) and their work products (in terms of low productivity, low code quality, etc.). Happiness leads to the opposite effect (e.g., high cognitive performance, high productivity, high code quality, etc.).
Johnson et al. \cite{8658138} conducted a mixed-method study (two surveys and interviews) with 1159 participants from Microsoft to understand the effect of work environments on productivity and satisfaction of software engineers. They found that personalization, social norms and signals, room composition and atmosphere, work-related environment affordances, work area, and furniture, and productivity strategies were considered important factors for work environments. In addition, the ability to work privately with no interruptions and the ability to communicate with the team and leads were important factors related to satisfaction.
Meyer et al. \cite{8666786} investigated what is a good and typical workday for software developers at Microsoft. They conducted a survey with 5971 developers and identified that on good workdays, developers make progress and value projects they consider meaningful and spend their time efficiently, with little randomization, administrative work, and infrastructure issues.
Fucci et al. \cite{8357494} performed a quasi-experiment with 45 undergraduate students to investigate whether, and to what extent, sleep deprivation impacts the performance of novice software developers using the agile practice of test-first development (TFD). The students were divided into two groups, where 23 stayed awake the night before carrying out the tasks, while 22 slept normally. They identified that a single night of sleep deprivation reduced 50\% in the quality of the implementations. In addition, the study found that sleep-deprived developers make more fixes to syntactic mistakes in the source code.
\section{Research Design}
\label{sec:method}
This section describes the research design used in our study. Firstly, a \textit{(i) Repository Mining} analysis was performed to understand the impact of COVID-19 pandemic on software projects. It considered different perspectives such as number of commits, issues, pull requests, branches, comments, time to fix a pull request and an issue, and the number of active and new contributors. Next, a \textit{(ii) Survey} with software professionals was performed to get insights on how the pandemic impact on their wellbeing. Figure \ref{fig:research_design} shows the overall research design used in our study.
\begin{center}
\begin{figure}[ht]
\includegraphics[width=\linewidth]{pandemia.png}
\caption{Research Design.}
\label{fig:research_design}
\end{figure}
\end{center}
\subsection{Repositories Selection and Mining}
\label{subsec:mining}
\begin{table}
\centering
\resizebox{\textwidth}{!}{\begin{tabular}{ p{4cm} p{6cm} c }
\hline
\textbf{Metric} & \textbf{Description} & \textbf{Ref.} \\
\hline
N of Active Contributors & The developers that had at least one commit in the study date range & \cite{4273079} \\
N of New Developers & The developers that committed at first time during the study date range & \cite{4273079} \\
N of Branches & List of all public branches of each repository & \cite{Barr2012CohesiveAI} \\
N of Created Pull Requests & Number of pull requests created per month considering the study date range. & \cite{Murphy-Hill19,pull} \\
N of Closed Pull Requests & Number of pull requests updated per month considering the study date range. & \cite{Murphy-Hill19,pull} \\
Pull Request created and closed per month & Number of pull requests created and closed in the same month considering the study date range. & \cite{Murphy-Hill19,pull} \\
N of Commits & Number of commits considering the study date range & \cite{4273079} \\
N of Created Pull Requests Comments & Number of comments created related to a previous created pull request. & \cite{7654253} \\
N of Updated Pull Requests Comments & Number of comments updated related to a previous created pull request. & \cite{7654253} \\
N of Bug-fix commits & Number of project commits related to bug fix. & \cite{123455} \\
\hline
\end{tabular}}
\caption{Metrics used in the analysis.
\label{tab:metrics}}
\end{table}
\textbf{Metrics.} The metrics used in our analysis are presented in Table \ref{tab:metrics}. For each of the metrics, we collected information for one year and four months (2019-Jan to 2020-May). It was important to show the behavior before and during the pandemic period. We also want to investigate how the metrics evolve month by month.
\textbf{Selecting and Filtering Repositories.} First, we choose GitHub repositories written in the Java language, since it is one of the most popular programming languages.\footnote{TIOBE Index. https://www.tiobe.com/tiobe-index/} Next, in order to detect pandemic impact on GitHub repositories, we retrieved Java repositories created from 2019 and sorted by their popularity \cite{Borges_2018}. In addition, as recommended by Munaiah et al.~\cite{Munaiah_2016}, we filtered out the noise in such large repositories by applying different inclusion and exclusion criteria, as follows:
\begin{itemize}
\item \textbf{Inclusion Criteria 1:} The repository has been updated at least once in the last year (2019-Jan to 2020-May);
\item \textbf{Inclusion Criteria 2:} The repository must have at least 34 commits in the study period (2019-Jan to 2020-May); this corresponds to two commits per month in the 17-month study period. This criteria was used to filter out inactive repositories;
\item \textbf{Inclusion Criteria 3:} The repository must have at least 10 contributors in the study period (2019-Jan to 2020-May). This criteria was used in order to eliminate irrelevant repositories, c.f., \cite{Agrawal_2018}, \cite{Krishna_2018}, \cite{Rahman_2018};
\item \textbf{Exclusion Criteria 1:} Repositories that did not have their artifacts and description in English were not considered in the study;
\item \textbf{Exclusion Criteria 2:} Repositories corresponding to tutorials, books, and classroom materials were also removed from our analysis.
\end{itemize}
After the filtering step, we selected the Top 100 Java repositories. As described in Figure \ref{fig:research_design}, the repositories were cloned and the \texttt{git log} and \texttt{git branch} commands were used to get all projects commits and branches. Using the \texttt{.csv} file generated, a Python script was used to extract the number of commits, time to fix a issue and pull request, the number of new contributors (i.e. those who made their first contribution in the study period (2019-Jan to 2020-May)), the number of contributors (i.e. those who collaborated in the study period) and number of remote branches for each repository. When the information could not be collected from local cloned repositories, we used the GitHub API. Specifically, pull requests and their comments were retrieved by GitHub REST API requests\footnote{https://developer.github.com/v3/}.
Next, we present how each metric was identified and measured for the repository mining process.
\subsubsection{Number of Active Contributors}
\textit{Active Contributors Identification and Measurement.} The number of active contributors was identified by first cloning each repository and collecting all commits\footnote{All commits were extracted using the git command: \texttt{$git log --all --format=H,aE,ci > commit_file.csv$}} in the study period. Once the commits were collected in a \texttt{.csv} file, a Python script was used to identify each developer responsible for each commit. This way, we considered an active contributor to be a developer which has at least one commit in the study period.
\subsubsection{Number of New Developers}
\textit{New Developers Identification and Measuring.} The number of new developers was also collected from the commits extracted from each repository. The Python script searched for developers that had their first commit in the repository during the study period. It is important to know if most of the new developers initiated their contribution before or during the pandemic.
\subsubsection{Number of Branches}
\textit{Number of Branches Identification and Measuring.} The number of branches was also collected from the cloned repositories throughout the
GitHub REST API. It is important to mention that we used an API Endpoint that retrieves all protected and unprotected repository branches. Finally, a Python script was used to collect the branch creation date based on its commits.
\subsubsection{Number of Created and Closed Pull Requests}
\textit{Number of Created, Closed Pull Requests Identification and Measuring.} The created and closed pull requests were collected using the GitHub REST API\footnote{\url{https://developer.github.com/v3/}} since this information is not available at local cloned repositories. According to GitHub REST API documentation, both issues and pull requests should be retrieved by the same \texttt{GET /issues} endpoint. In order to identify pull requests, we need to filter the results searching for the ``pull request'' string in each issue occurrence. With this information, we were able to identify how many pull requests were created and closed, considering the study date interval. In addition, we also identified the pull requests created and closed in the same months. With this metric, we analyze how the pandemic impacts team productivity.
\subsubsection{Number of Commits}
\textit{Number of Commits Identification and Measurement.} The project commits were collected from the cloned repository using \texttt{git log} command. Next, the Python script was used to group all commits by month-year in a \texttt{.csv} file. This information is important to understand how the pandemic impacts on team productivity over the months.
\subsubsection{Number of Created and Updated Pull Requests Comments}
\textit{Number of Created and Updated Pull Requests Comments Identification and Measuring.} The GitHub REST API \footnote{\url{https://developer.github.com/v3/}} was also used to collect information regarding to the pull requests comments. This metric collected both new and updated comments related to repository pull requests. The comments show important insights regarding to the project activity over the study interval.
\subsubsection{Number of Bug-Fixing commits}
\textit{Number of Bug-Fixing commits Identification and Measurement.} To gather the number of commits related to bug-fixing, we used the GitcProc Tool\footnote{https://github.com/caseycas/gitcproc} which uses a keyword search to determine if that commits is related to a bug fixing or not. It searches for related words such as error, bug, defect, and fix within each commit message \cite{123455}.
\subsection{Survey}
\textbf{Protocol.} We created a 20-minute survey designed to understand the impact of COVID-19 on software development from the perspective of projects and developers' wellbeing. It was composed of seventeen closed questions on a Likert scale (Strongly Disagree, Disagree, Neutral, Agree, Strongly Agree, and N/A) and three open questions. We included the option N/A to prevent respondents providing arbitrary ratings to questions that they find to be unclear. The survey also collected demographic information from respondents. For the design of the survey, we followed the Kitchenham and Pfleeger's guidelines for personal opinion surveys \cite{BarbaraKitchenham_2008}.
We piloted our survey with three researchers (2 with Ph.D. degrees and 1 Ph.D. student) with experience in the area to get feedback on the questions and their corresponding answers; difficulties faced to answer the survey and time to finish it. As these pilot respondents were experts in the area, we also would like to know if we were asking the right questions. We conducted several iterations of the survey and rephrased some questions and removed others to make the survey easier to understand and answer. Then, we ended up with 20 questions. Another concern in this stage was also to ensure that the participants could finish it in 20-minutes. The pilot survey responses were used solely to improve the questions, and these responses were not included in the final results. We kept the survey anonymous, but in the end, the respondents could inform their email to receive a summary of the study. The survey instrument can be seen in the accompanying website\footnote{\url{https://github.com/pamsn/covid-study}}.
\textbf{Respondents}. We followed a three steps approach to recruit survey respondents: initially, we posted survey information on personal accounts of social media (Twitter, LinkedIn, Instagram). Next, most authors contacted potential respondents by email (convenience sample) and asked them to share it with other potential respondents (snowballing). Because of this process, we were not able to track the total number of invitations. In total, we received 287 responses. We disqualified six responses without actual data (without responses to any of the survey questions of interest to the study despite responding to basic demographics questions, such as the role of the respondent) and two repeated ones, leading to 279 valid responses that were considered.
The respondents spread out in 32 countries across four continents. The top three countries where the respondents come from are Brazil, United States, and Germany. The professional experience of these 279 respondents varies from no experience to 50 years, with an average of 12.5 years and a median of 10 years.
Regarding the size of the organizations, 34\% of the respondents work for companies with 1000 to 9999 employees, 23\% of the participants work for companies with 100 to 999 employees, 16\% of the respondents work for companies with 10 to 99 employees, 11\% of the respondents work for companies with 10000 to 99999 employees, 8\% work for companies with 100000 or more employees, and 8\% of the respondents work for companies with 0 to 9 employees. The majority of the respondents have a Bachelor's degree (41\%) and an advanced degree (41\%), i.e., Master's or Ph.D.
95\% of the respondents were paid professional, and 5\% were volunteers. 90\% of the respondents work full time, and 94\% had no disability. On average, the participants live with three people (including himself/herself), and only 32\% live with children under the age of 12. The home office experience of the 279 respondents varies from no experience to 35 years, with an average of 3.5 years and a median of 1 year. Finally, 82\% of the participants were working from office before the pandemic and switched to a home office, 17\% were working the whole time remotely, and 1\% were working at the office the whole time.
\textbf{Data Analysis}. We collected the ratings that our respondents provided for each question. Next, we converted these ratings to Likert scores from 1 (Strongly Disagree) to 5 (Strongly Agree), We computed the average Likert score of each statement related to productivity and wellbeing perspectives and the plot Likert scale graph. A Likert scale graph is a bar chart that shows the number of responses corresponding to strongly disagree, disagree, neutral, agree, strongly agree, and N/A. In addition, we used open coding \cite{saldana2015coding} to analyze the answers that the survey respondents gave to explain the open questions related to productivity and wellbeing, and their perceptions about how the COVID-19 pandemic has affected him/her and his/her team.
\subsection{Statistical Analysis}
In the mining part of the study, we calculated the number of each metric mentioned in Table~\ref{tab:metrics} for each project for $17$ months (for details, see section~\ref{subsec:mining}). To investigate the impact of COVID-19 on these metrics, we partition the time into six time-windows. As all the collected data related to project metrics are time-series \cite{book}, we did a time series analysis for each metric in each time frame across the projects to see the changes. We also performed a pairwise two-sample t-test to check if there is any statistically significant difference in the mean of each metric among the time-frames. The time series plots for each metric for each category and for each time-frame is available at the accompanying Website \footnote{\url{https://github.com/pamsn/covid-study}}.
\section{Results}
This section presents our findings from analyzing both mining data and survey responses. The content is organized around our two research questions.
\subsection{RQ1: What is the impact of COVID-19 on projects?}
Our goal is to identify the impact of COVID-19 on software projects with the first research question. For this, we conducted a mining study of $100$ Java projects where we investigate the change of $10$ different project-related metrics (defined in Table~\ref{tab:metrics}) during the COVID-19 period. In order to do this comparison, we divided our dataset of $17$ months into six time-windows:
\begin{enumerate}
\item \textbf{ Jan'19-May' 20 (TW1)}: This time-window includes time starting from January 2019 to May 2020.
\item \textbf{ Jan'19-Jun'19 (TW2)}: This time-window includes the time starting from January 2019 to June 2019.
\item \textbf{ Jul' 19-Dec'19 (TW3)}: This time-window includes the time starting from July 2019 to December 2019. This time-window includes the initial COVID-19 spread time.
\item \textbf{ Jan'20-Mar' 20 (TW4)}: This time-window includes time starting from January 2020 to March 2020. During this time-window, WHO (World Health Organization) declared COVID-19 as a global pandemic on March 11,2020~\cite{cucinotta2020declares}. Moreover, people started to work from home during this time-window.
\item \textbf{Apr' 20-May' 20 (TW5)}: This time-window includes the months of April and May 2020.
\item \textbf{ Jan'20-May' 20 (TW6)}: This time-window includes time staring from January 2020 to May 2020.
\end{enumerate}
After dividing the metrics data into six time-windows (including the window with full-time length TW1), we investigated the changes of each metric (Table~\ref{tab:metrics}). We tracked the evolution of each metric for identifying their trends in the projects during the time-windows. For this purpose, we calculated the effect size of the month on each metric using a linear regression model, giving us how much that metric changed for each project per month. Then, based on the effect size, we categorized each project into one of two categories: increasing or decreasing. If the effect was positive, we marked those projects as increasing for that metric. For a negative effect, we marked the project as decreasing. For example, Figure~\ref{fig:trend} shows that for the metric ``number of active contributors'', project ``Brave'' (Figure~\ref{fig:trend}.a) shows an increasing trend for the time-window January 2020 to May 2020 and ``ExoPlayer'' project (Figure~\ref{fig:trend}.b) shows a decreasing trend according to our time series analysis. All the figures generated from the analysis are provided in the accompanying website\footnote{\url{https://github.com/pamsn/covid-study}}. In Table~\ref{tab:timeseries}, we report the number of projects belonging to each trend for the six time-windows mentioned earlier.
\begin{center}
\begin{figure}[ht]
\includegraphics[width=\linewidth]{trends.png}
\caption{Month wise trends for Active Contributors across all projects.}
\label{fig:trend}
\end{figure}
\end{center}
\begin{table}[hbt]
\centering
\caption{Summary of time series analysis for each category }
\label{tab:timeseries}
\begin{tabular}{|l|c|c|c|c|c|c|c|c|c|c|c|c|}
\hline
\multirow{2}{*}{Metric} & \multicolumn{2}{l|}{TW 1} & \multicolumn{2}{l|}{TW 2} & \multicolumn{2}{l|}{TW 3} & \multicolumn{2}{l|}{TW 4} & \multicolumn{2}{l|}{TW 5}& \multicolumn{2}{l|}{TW 6} \\ \cline{2-13}
& $\uparrow$ & $\downarrow$ & $\uparrow$ & $\downarrow$ & $\uparrow$ & $\downarrow$ & $\uparrow$ & $\downarrow$ & $\uparrow$ & $\downarrow$ & $\uparrow$ & $\downarrow$ \\ \hline
\begin{tabular}[l]{@{}l@{}}Active \\ Contributors\end{tabular} & 42 & 58 & 42 & 58 & 45 & 55 & 31 & 69 & 47 & 50 & 18 & 82 \\ \hline
\begin{tabular}[c]{@{}l@{}}New \\ Developers \end{tabular} & 49 & 49 & 41 & 59 & 29 & 69 & 30 & 66 & 49 & 41 & 18 & 70 \\ \hline
Branches & 93 & 7 & 26 & 28 & 35 & 39 & 91 & 9 & 33 & 29 & 77 & 23 \\ \hline
\begin{tabular}[c]{@{}l@{}}Created \\ Pull\\ Requests\end{tabular} & 81 & 11 & 29 & 25 & 35 & 35 & 73 & 15 & 49 & 21 & 54 & 30 \\ \hline
\begin{tabular}[c]{@{}l@{}}Closed \\ Pull\\ Requests\end{tabular} & 45 & 54 & 45 & 53 & 49 & 50 & 34 & 64 & 49 & 48 & 25 & 71 \\ \hline
\begin{tabular}[c]{@{}l@{}}Pull request \\opened \& \\closed in \\same month\end{tabular} & 46 & 53 & 42 & 58 & 44 & 55 & 39 & 58 & 52 & 43 & 20 & 75 \\ \hline
Commits & 45 & 55 & 40 & 60 & 44 & 56 & 32 & 68 & 55 & 44 & 23 & 77 \\ \hline
\begin{tabular}[c]{@{}l@{}}Created \\Pull request \\ Comments \end{tabular} & 56 & 41 & 36 & 64 & 38 & 46 & 34 & 55 & 50 & 34 & 23 & 59 \\ \hline
\begin{tabular}[c]{@{}l@{}}Updated \\ Pull request \\ comments \end{tabular} & 58 & 39 & 38 & 62 & 37 & 45 & 38 & 51 & 49 & 35 & 32 & 51 \\ \hline
\begin{tabular}[c]{@{}l@{}} Bug-fix \\ Commits\end{tabular} & 40 & 60 & 38 & 62 & 37 & 62 & 32 & 65 & 49 & 47 & 25 & 70 \\ \hline
\end{tabular}
\end{table}
In the following sections, we list the observations pertaining to the impact of COVID-19 on different project activities.
\subsubsection{Impact on Bug-fixing Activity}
From our mining analysis, we found that in general, more projects are showing decreasing trends in the number of bug-fix commits per month during the pandemic period. For example, time-window between Jan'20-May'20 (TW6) shows more projects with a decreasing trend in comparison to the time-windows between Jan'19-Dec'19 (See Table~\ref{tab:timeseries}). Next, we performed a pairwise two-sample t-test to check if there is any statistically significant difference in the mean between these time-windows and found that between the time-windows Jul'19-Dec'19 and Jan'20-May'20, there is a statistically significant difference in their mean (p-value $<$ 0.05). Table~\ref{tab:hypotest} shows the summary of the pair-wise t-test for each metric in different time-windows. Table~\ref{tab:hypotest} only shows the statistically significant results of our t-test.
\begin{table}[hbt]
\centering
\caption{Summary of t-test among projects between different time range.}
\label{tab:hypotest}
\begin{tabular}{|l|l|l|r|r|r|}
\hline
Metric & TW 1 & TW 2 & Mean1 & Mean2 & p-value \\ \hline
Active Contributors & Jul19-Dec19 & Jan20-May20 & 19.13 & 29.02 & 0.019 \\ \hline
Closed Pull Requests & Jan20-Mar20 & Apr20-May20 & 78.79 & 46.94 & 0.047 \\ \hline
Created Pull Requests & Jul19-Dec19 & Jan20-May20 & 6.79 & 12.48 & 0.04 \\ \hline
New Developers & Jan20-Mar20 & Apr20-May20 & 8.88 & 4.46 & 0.00012 \\ \hline
\begin{tabular}[l]{@{}l@{}}Pull Request opened \& \\closed in the same month \end{tabular} & Jan20-Mar20 & Apr20-May20 & 62.25 & 35.7 & 0.048 \\ \hline
Bug-fix Commits & Jul19-Dec19 & Jan20-May20 & 69.92 & 32.54 & 0.028 \\
\bottomrule
\end{tabular}
\end{table}
In our survey, we asked respondents if they agree/disagree with the statement, ``Since you began working from home, the number of bug-fixes is lower than usual''. Among the 279 survey respondents, 44.08\% disagreed, where 15.77\% agreed that the number of bug-fixes is lower than usual since they began working from home during the pandemic. 42, 81, and 95 respondents strongly disagree, disagree, and neutral with this statement. The average Likert score for this statement is 2.58 (i.e., between "disagree" and "neutral").
\observation{Though the majority of projects show decreasing trends in the number of bug-fix commits most of the survey respondents disagree regarding decreased number of bug-fix commits during the pandemic period.}
We also asked the respondents about their view on the statement: ``The number of bugs in the project has increased since they began working from home''. 39, 91, and 107 respondents strongly disagree, disagree, and neutral with this statement. The average Likert score for this statement is 2.47 (i.e., between "disagree" and "neutral"). The following are some comments that refute or confirm the statement:
\ding{55} \textit{"Overall we've been finishing more features at a higher quality.}"
\ding{51} \textit{"The overall level of engagement has increased, but I feel that the quality has suffered somewhat.}"
\observation{46.60\% of the respondents conveyed that the number of bugs did not increase during the pandemic period.}
Figure~\ref{fig:bug-fix} shows the summary of the survey results on the impact of COVID-19 on the bug-fixing activities.
\begin{center}
\begin{figure}[ht]
\includegraphics[width=\textwidth]{bug-fix-act.PNG}
\caption{Summary of the survey results on the impact of COVID-19 on the bug-fixing activities.}
\label{fig:bug-fix}
\end{figure}
\end{center}
\subsubsection{Impact on Discussion}
From our mining part of the study, we found that in case of creating and updating pull request comments (which is a way of discussion among developers), more projects are showing decreasing trends during the pandemic period. For example, time-windows between Jan'20-May'20 (TW6) show more projects with a decreasing trend in comparison to the time-windows between Jan'19-Dec'19 (See Table~\ref{tab:timeseries}) in both creating and updating comments. Next, we performed a pairwise two-sample t-test to check if there is any statistically significant difference in the mean between these time-windows and did not find any statistically significant difference in mean between any two time-windows (p-value $>$ 00.5, see Table~\ref{tab:hypotest} for details).
We asked our survey respondents about the review activity (another form of discussion among developers) in their projects during the pandemic. 54.83\% of the survey respondents mentioned that, in general, review activities are not lower than usual during the pandemic period. 56, 97, and 60 respondents strongly disagree, disagree, and are neutral with this statement, respectively. The average Likert score for this statement is 2.41 (i.e., between "disagree" and "neutral"). The following are some comments that refute the statement:
\ding{55} \textit{"I having more structure timed schedule. Review with the team, coding, review with the team.}"
We also asked about the rate of discussion among team members in our survey. 37.63\% respondents did not think there is an increment in discussion among team members since they began working from home in the pandemic period. 19, 86, and 73 respondents strongly disagree, disagree, and are neutral in this, respectively. The average Likert score for this statement is 3.0 ("neutral"). The following are some comments that refute or confirm the statement:
\ding{55} \textit{"Normally during work days, at least on the team/office I worked with/on we would have some time to discuss about problems that occur to us during the development of some task. Now with everyone so distant, even though we have tools to workaround that problem it still feels like you are significantly distant from that person, both physically and mentally.}"
\ding{51} \textit{"On our company we have a permanent virtual room opened to attend doubts and have discussions.}"
\observation{Though the number of pull request comments created and updated decreased over the pandemic period, discussion among developers related to their work and review activity did not decrease during the pandemic.}
53.04\% of the respondents disagree on the quality degradation of discussion among team members since they began working from home, while 26.16\% agree that there is a degradation in discussion quality. The average Likert score for this statement is 2.63 (i.e., between "disagree" and "neutral"). The following are some comments that refute or confirm the statement:
\ding{55} \textit{"I make calls with my colleagues the whole time, to discuss and cheap talk, this helps focus and fell like we are at the same room.}"
\ding{51} \textit{"In general, people are more nervous and stressed, which makes discussions less constructive and more stressful.}"\\
Figure~\ref{fig:discussion} shows the summary of the survey results on the impact of COVID-19 on discussion among developers.
\begin{center}
\begin{figure}[ht]
\includegraphics[width=\textwidth]{discussion.PNG}
\caption{Summary of the survey results on the impact of COVID-19 on discussions among developers.}
\label{fig:discussion}
\end{figure}
\end{center}
\subsubsection{Impact on Code Contribution}
To investigate the impact of COVID-19 in code contribution, we analyzed the number of pull requests created, closed each month during and before the pandemic period.
From our mining analysis, we found that in general, more projects show increasing trends in the number of created and closed pull requests per month during the pandemic period. For example, time-windows between Jan'20-May'20 (TW6) show more projects with an increasing trend in comparison to the time-windows between Jan'19-Dec'19 (See Table~\ref{tab:timeseries}). Next, we performed a pairwise two-sample t-test to check if there is any statistically significant difference in the mean of the number of created pull requests between these time-windows and found that between the time-windows Jul'19-Dec'19 and Jan'20-May'20, there is a statistically significant difference in their means (p-value $<$ 0.05). For the closed pull requests, we found that between the time-windows Jan'20-Mar'20 and April'20-May'20, there is a statistically significant difference in their means (p-value $<$ 0.05, see Table~\ref{tab:hypotest} for details).
We also found that the pull requests that opened and closed in the same month show increasing trends in more projects during the pandemic compared to the time-windows before the pandemic. We found a statistically significant difference in mean for this metric between the time-windows Jan'20-Mar'20 and Apr'20-May'20.
In our survey, we asked our respondents about code contribution. There are different ways of contributing code, such as adding a new feature, refactoring, etc. 58.42\% of our survey respondents do not think that working from home during pandemic results in adding fewer new features than usual time. 49, 114, and 54 respondents strongly disagree, disagree, and are neutral with the statement: ``The number of new features is lower than usual'' statement, respectively. The average Likert score for this statement is 2.41 (i.e., between "disagree" and "neutral"). The following are some comments that refute the statement:
\ding{55} \textit{"I am doing home office. It's effective to keep the features delivery.}"
\ding{55} \textit{"Overall we've been finishing more features at a higher quality. However, we have limited QA resources (we only have one full-time QA staff member), so the fact that the developers are churning out code is probably making it much more stressful for our QA lead.}"
48.75\% of our survey respondents disagree that the number of refactoring is lower than usual since they began working from home. 36, 100, and 92 respondents strongly disagree, disagree, and are neutral with this statement, respectively. The average Likert score for this statement is 2.50 (i.e., between "disagree" and "neutral"). The following are some comments that confirm the statement:
\ding{51} \textit{"Besides of interpersonal communication be affected, I perceived that long term strategies about the quality and refactoring, for example, are depreciated instead of short term tasks, such as new implementations and tests automation related to the implementations.}"
\observation{In general, working from home during pandemic period does not impact code contribution.}
Figure~\ref{fig:code_cont} shows the summary of the survey results on the impact of COVID-19 on code contribution.
\begin{center}
\begin{figure}[ht]
\includegraphics[width=\textwidth]{code_cont.PNG}
\caption{Summary of the survey results on the impact of COVID-19 on code contribution.}
\label{fig:code_cont}
\end{figure}
\end{center}
In our survey, we also asked the survey respondents about task completion time, productivity, and quality of their work during the pandemic period.
47\% survey respondents disagree that it takes longer to complete the tasks than usual since they began working from home. 58, 73, and 52 respondents strongly disagree, disagree, and are neutral with this statement, respectively. The average Likert score for this statement is 2.72 (i.e., between "disagree" and "neutral"). The following are some comments that refute or confirm the statement:
\ding{55} \textit{"I've more time to study my tasks, with more attention and patience, I've created step by steps before to start working and this is more effective.}"
\ding{55} \textit{"We scheduled more small conversations during the day and splitted more the tasks. We are keeping the same productivity as before or even higher.}"
\ding{51} \textit{"Tried using the Pomodoro method of time boxing tasks. Otherwise, nothing. I don’t think it helped much.}"
\ding{51} \textit{"Work more hours to complete necessary work, try to be more organized with tasks and time available (prioritization). Not so effective, I still have to work more hours.}"\\
On the overall productivity, 56\% of the survey respondents disagree they are less productive since they began working at home due to the COVID-19 pandemic. 89, 67, and 39 respondents strongly disagree, disagree, and are neutral, respectively. The average Likert score for this statement is 2.43 (i.e., between ``disagree'' and ``neutral''). The following are some comments that refute or confirm the statement:
\ding{55} "\textit{My productivity at work increased a lot in this pandemic and I was even recognized as an QA MVP (Most Valuable Player) for the last 2 months. However, I had to keep track of my working hours because I started working a lot more than I was supposed to.}"
\ding{55} "\textit{My team became more productive due to the absence of office distractions.}"
\ding{51} "\textit{We had been working remotely for years already. However, our productivity still took a big hit - not due to working from home specifically, but due to the cognitive overload we're all experiencing these days. It's hard to concentrate and be productive when we're all worried about our families, our society and our own health.}"
\ding{51} "\textit{Decreased one-on-one conversations, low internet bandwidth, irregular power supplies and many other factors have impacted our effectiveness.}"\\
In general, respondents disagree or are neutral considering that the quality of their work is lower than it should have been since they began working from home. 83, 89, and 40 respondents strongly disagree, disagree, and are neutral with this statement, respectively. The average Likert score for this statement is 2.33 ("i.e., between "disagree" and "neutral").
\observation{Overall productivity and task completion time do not decrease during the pandemic period compare to the usual time.}
Figure~\ref{fig:task_comp} shows the summary of the survey results on the impact of COVID-19 on task completion time, productivity, and quality of the work.
\begin{center}
\begin{figure}[ht]
\includegraphics[width=\textwidth]{task_comp.PNG}
\caption{Summary of the survey results on the impact of COVID-19 on task completion time, productivity, and quality of the work.}
\label{fig:task_comp}
\end{figure}
\end{center}
In general, respondents disagree or are neutral, considering that the amount of testing is lower than usual since they began working from home during the pandemic. 54, 110, and 69 respondents strongly disagree, disagree, and are neutral with this statement, respectively. The average Likert score for this statement is 2.28 (i.e., between ``disagree'' and ``neutral''). The following is a comment that confirms the statement:
\ding{51} \textit{"Besides of interpersonal communication be affected, I perceived that long term strategies about the quality and refactoring, for example, are depreciated instead of short term tasks, such as new implementations and tests automation related to the implementations.}"\\
Many respondents disagree or are neutral, considering that the code quality has decreased since they began working from home. 62, 112, and 66 respondents strongly disagree, disagree, and are neutral with this statement, respectively. The average Likert score for this statement is 2.21 ("i.e., between "disagree" and "neutral"), which is the lowest among all survey questions.
\observation{According to our survey respondents working from home during pandemic period does not impact code quality.}
Figure~\ref{fig:code_qual} shows the summary of the survey results on the impact of COVID-19 on code quality.
\begin{figure}[ht]
\centering
\includegraphics[width=\linewidth]{code_qual.PNG}
\caption{Summary of the survey results on the impact of COVID-19 on code quality.}
\label{fig:code_qual}
\end{figure}
\subsection{RQ2: What is the impact of COVID-19 on Developers Wellbeing?}
With the second research question our goal is to identify the impact of COVID-19 on developers wellbeing. To achieve this goal, we asked the survey respondents regarding their stress, emotional condition, getting help from others, etc. In the following sections, we present our findings regarding the impact of COVID-19 on developers wellbeing.
\subsubsection{Sleep Disorder}
Sleep disorder could hamper developer's productivity. In our survey, we asked the respondents if they think their sleeping disorder increased during the pandemic period. Among 279 respondents, 39.40\% of the respondents agreed that their sleep disorder increased since they began working from home. The average Likert score for this statement is 3.0 (i.e., "neutral"). The following are some comments that refute or confirm the statement:
\ding{55} \textit{"This situation is quite complex, especially when we perceive a complete neglect on the part of the federal authorities in Brazil with the pandemic and at the same time see the increasingly devastating advance of the virus in Brazilian territory. The most important action has been to control the amount of information to maintain emotional control. Apparently just for sleep it hasn't been enough.}"
\ding{51} \textit{"I'm going to sleep at the same time. It was effectively strong.}"
\ding{51} \textit{"I gave sleep a priority. Discontinues some non-essential activities.}"
\observation{39.40\% of the survey respondents agreed that sleep disorder increased during pandemic period.}
\subsubsection{Level of Stress}
We found that 141 out of 279 survey respondents agreed that the level of stress increased in the pandemic period since they began working from home. A substantial number of respondents choose to be neutral or disagree (44 neutral respondents, and 85 respondents who disagree or strongly disagree). The average Likert score for this statement is 3.33 ("i.e., "neutral") which is the highest among the survey questions. The following are some comments that refute or confirm the statement:
\ding{55} \textit{"Constant breaks (10minutes every 50 minutes). No overtime. When my workday is done, I close my laptop and put in a drawer ("Out of sight, out of mind") and get it out only on the next working day. I feel less stressed because I have more time overall (no commuting).}"
\ding{55} \textit{"The pandemic is serious, but it is far away to be my source of stress. I have low need for social interaction. Sunbathing with the baby is enough to relieve the "quarantine".}"
\ding{51} \textit{"Working more flexible hours to watch family more during day and shift more at night. This has maintained work output and quality but increases stress.}"
\ding{51} \textit{"In general, people are more nervous and stressed, which makes discussions less constructive and more stressful.}"
\observation{50.53\% of survey respondents indicate that their stress level increased since they began working from home during pandemic.}
\subsubsection{Happiness}
Many respondents disagree or are neutral considering that the level of happiness increased since they began working from home. 27, 70, and 95 respondents strongly disagree, disagree, and are neutral with this statement, respectively. The average Likert score for this statement is 2.91 ("i.e., between "disagree" and "neutral"). The following are some comments that refute or confirm the statement:
\ding{55} \textit{"I am depressed and taking anti-depression pills along with therapy. I check a doctor online.}"
\ding{55} \textit{"Slightly increased the frequency of my panic attacks.}"
\ding{55} \textit{"I try to get just enough news to stay informed but other than that I try to avoid news because the more I hear, the more depressed I get. I have a regular schedule of zoom dates with my boyfriend on top of our impromptu calls/facetimes to make sure that we are staying as connected as we can. That helps to some extent because we know we'll get through it, but it still completely sucks that we don't get to see each other in person. To make up for it, we probably text more frequently during work hours than we would have before the pandemic. At work, my team has weekly 30min meetings to just hangout together on zoom. They were good at first to help us stay connected and sane, but now I think we're kind of getting bored with them. We probably don't need them so frequently.}"
\ding{51} \textit{"My overall wellbeing was not affected. Just the mood and motivation is down due to the situation. There is not much to do about it. We just have to get through it.}"
\observation{34.76\% of the survey respondents mentioned that the level of happiness did not increase during the pandemic period.}
Figure~\ref{fig:well-being1} shows the summary of the survey results on the impact of COVID-19 on developer's sleep, stress level and happiness.
\begin{center}
\begin{figure}[ht]
\includegraphics[width=\textwidth]{wellbeing1.PNG}
\caption{Summary of the survey results on the impact of COVID-19 on the developer's wellbeing.}
\label{fig:well-being1}
\end{figure}
\end{center}
\subsubsection{Mentoring}
101 out of 279 survey respondents agreed that the mentoring activities for newcomers has decreased in the project since they began working from home in pandemic. A substantial number of respondents choose to be neutral or disagree (66 neutral respondents, and 81 respondents with disagree or strongly disagree with this statement). The average Likert score for this statement is 3.15 (i.e., "neutral"). The following are some comments that confirm the statement:
\ding{51} "\textit{I think it affected the welcoming of the youngest to the team. Face-to-face activities generate more intimacy between people.}"
\ding{51} "\textit{The COVID-19 has influenced the acceptance of new employees. The efficiency of the discussion among team members was much lower than face-to-face discussion.}"
\observation{35.12\% of the survey respondent mentioned that mentoring activities for newcomers have decreased during the pandemic period.}
Figure~\ref{fig:well-being2} shows the summary of the survey results on the impact of COVID-19 on the developer's mentoring activity.
\begin{center}
\begin{figure}[ht]
\includegraphics[width=\textwidth]{wellbeing2.PNG}
\caption{Summary of the survey results on the impact of COVID-19 on the developer's mentoring activity.}
\label{fig:well-being2}
\end{figure}
\end{center}
\subsubsection{Interruptions}
In general, respondents disagree or are neutral considering that newly introduced interruptions along with the old ones are negatively impacting their productivity since they began working from home. 35, 81, 64 respondents strongly disagree, disagree, and are neutral with this statement, respectively. The average Likert score for this statement is 2.87 (i.e., between "disagree" and "neutral"). The following are some comments that refute or confirm the statement:
\ding{55} \textit{"Working remotely, others can't interrupt my work so quickly, so this increased my productivity in general.}"
\ding{55} \textit{"Home office leads to much less interruptions. This helps productivity a lot!}"
\ding{51} \textit{"I had to improvise a home office in my daughter's room so I can isolate myself there to avoid too many interruptions or background noises. It helped a little, but my wife and daughter still eventually interrupt me during my working hours.}"
\ding{51} \textit{"We tried to schedule a series of video conferences to keep in touch with the team. It helped a lot, but is not as good as talking directly to the persons. The rate of interruptions did increase.}"\\
\observation{41.60\% of the survey respondents do not think that newly introduced interruptions along with the old ones are negatively impacting their productivity during the pandemic time.}
We posit that interruptions are associated with number of people living in the household. We analyzed the results from the survey and our results show that the average Likert score ranges from $2.9$ to $3.4$, indicating the perception that the number of people living in the household is not having a major impact.
We also investigated whether interruptions are associated with number of children below 12 years of age living in the household. We analyzed the results from the survey and our results show that the average Likert score ranges from $2.0$ to $3.2$, indicating the perception that the number of children also does not have a major impact. On the contrary, people mostly disagree with this perception. Figure~\ref{fig:agree_disagree} shows the summary of the survey.
\observation{Majority of the respondents do not perceive the number of kids and people living in the house as a source of interruption.}
\begin{center}
\begin{figure}[ht]
\includegraphics[width=\linewidth]{likert4.png}
\caption{Survey Results Summary.}
\label{fig:agree_disagree}
\end{figure}
\end{center}
\section{Discussion}
\label{sec:discussionandimplication}
\vspace{0.2cm}\noindent{\bf Practitioners:} From our study, we found several suggestions for the practitioners to maintain a healthy work-life balance during a pandemic. Creating various ``forms of entertainment at home'' can help divert the mind away from all the negative news. Staying at home provides opportunities for practitioners to expand their knowledge and utilize this time to study and take online courses as several universities and platforms have their offerings. While pandemic has been tough for everyone, it has been positive for many with ``better sleep, more time with family, less travel time". Practitioners recommend taking ``more small breaks during the day to spend time with family and pets". Others mentioned the benefit of being disciplined in separating work time from rest/family time; for example, one respondent mentions: \textit{``No overtime. When my workday is done, I close my laptop and put in a drawer (``Out of sight, out of mind'') and get it out only on the next working day.''} Several respondents mention using the Pomodoro technique for time management, which uses a timer to break down work into intervals, has helped ``improve productivity''.
\vspace{0.2cm}\noindent{\bf Organizations:} Based on our analysis, we found that the COVID-19 situation does not necessarily result in reduced productivity and inferior code quality. Organizations can take active steps to help developers cope with COVID-19 and remain productive and produce high-quality code. We received many inputs from our respondents including the following: \textit{``On our company we have a permanent virtual room opened to attend doubts and have discussions.'', ``At work, my team has weekly 30min meetings to just hangout together on zoom. They were good at first to help us stay connected and sane'', ``Daily meetings during the beginning and end of the day, it allows visibility for the whole team and visibility about what is being executed. It was too efficient that the team is producing more'', ``My team opened up a remote call which everybody should be present during all day. This way we 'simulate' the real-world environment which we can talk with the other team members anytime. We noticed that the team collaboration has not decreased''.} From the above, we can note that organizations can positively impact their developers ability to cope well with COVID-19 in various ways to simulate their previous working environment (before the pandemic) and facilitate more interactions between the developers. In such a way, developers can effectively collaborate and feel less isolated in doing their tasks.
\vspace{0.2cm}\noindent {\bf Researchers:} Our findings highlight that the impact of COVID-19 is not binary (reduce productivity vs. increase productivity) but rather a spectrum. For many of our observations, substantial proportions of respondents have differing opinions from each other. For example, for Observation 3 (\textit{Though the number of pull request comments created and updated decreased over the pandemic period, discussion among developers related to their work and review activity did not decrease during the pandemic.}), 37.63\% of respondents did not think there is an increment in discussion among team members since they began working from home in the pandemic period, with an average Likert score of 3.0 ("neutral").
More research is needed to uncover specific conditions that cause certain outcomes to be more prevalent. These conditions can correspond to personalities of different developers, their roles, their organization structure, and characteristics, their home conditions (e.g., ``low internet bandwidth'', ``irregular power supplies''), etc. To illustrate the impact of these factors, one of our respondents mentions ``... \textit{[I] have a low
need for social interaction. Sunbathing with the baby is enough to relieve the ``quarantine''} while another mentions ``\textit{decreased one-on-one conversations ... impacted our effectiveness''}. Yet another mention: ``\textit{Slightly increased the frequency of my panic attacks''}. This suggests that personality plays a role in the impact of COVID-19 to developers (c.f.,~\cite{XiaLBSL17} that also shows the impact of personality on the developer and team effectiveness prior to COVID-19). Developers with some physical/mental health conditions (e.g., panic attacks) may also be more adversely impacted by COVID-19.
The understanding gained from further research can result in: (1) creation of specific guidelines that can help developers or organizations adversely affected by COVID-19 to learn from other developers or organizations that have coped well with COVID-19, (2) Organizations to adopt different strategies to help developers of different personalities and conditions to cope with COVID-19.
We do not view our study as a final definitive study, but rather one of the many that can shed ``full'' light into COVID-19 (or other pandemics), its impacts, and ways to mitigate those impacts. Some of the future studies can consider performing a smaller scale but more in-depth and focused study on a particular aspect (e.g., the impact of personality on how developers cope with COVID-19).
\section{Threats to Validity}
Our research findings may be subject to the concerns that we list below. We have taken all possible steps to reduce the impacts of these possible threats, but some could not be mitigated and it's possible that our mitigation strategies may not have been effective.
Our samples have been from a single source (Github) and single programming language (Java). This may be a source of bias, and our findings may be limited to open source programs from Github. However, we believe that the large number of projects sampled more than adequately addresses this concern.
The set of analyzed metrics spans across 10 different categories and widely used in literature. However, we cannot guarantee that our set of metric are exhaustive. We plan to expand our metric set in future work.
It is possible that there are defects in the implementation of our mining scripts. To that end, we have extensively tested our implementation, and manually verified sampled counts of different metrics.
Finally, it is possible that the survey participants misunderstood some of the survey questions. To mitigate this threat, we conducted a pilot study with developers with different experience levels from both open-source community and industry. We also conducted a pilot study with survey design experts. We updated the survey based on the findings of these pilot studies.
\section{Conclusions}
The COVID-19 pandemic has impacted the whole world in different ways. As software is still "eating the world", it is essential to understand COVID-19's impact on software projects. We conducted a mining software repository study based on 100 GitHub projects developed in Java using ten different metrics. Next, we surveyed 279 software development professionals from 32 countries for gathering more insights about the impact of COVID-19 on daily activities and wellbeing.
Based on our findings, we derived 12 observations that can be used by practitioners, organizations, and researchers. Practitioners can use our recommendations to maintain a healthy work-life balance during a pandemic. Organizations can learn from our survey respondents and take steps to remain productive while creating high-quality code. The research community can explore the social and human aspects to understand the impact of developer personality during a pandemic.
As future work, we intend to expand the analysis of the projects (considering a wider time window) to better understand the impact of a year-long pandemic on software development.
| {'timestamp': '2020-08-18T02:22:09', 'yymm': '2008', 'arxiv_id': '2008.07048', 'language': 'en', 'url': 'https://arxiv.org/abs/2008.07048'} | arxiv |
\section{Introduction}
\label{sec:introduction}
Internet and its applications are widely advancing towards social networks in which the user generated content plays a crucial role \cite{Dallas2012}. This content which is mostly generated by users, companies, news reporting agencies and etc., consists of text, image and video and has noise naturally \cite{Atefeh2015,Kaplan2010}. This media forms the foundation of social media delivery systems such as Facebook, Youtube, Instagram, Twitter, and etc. with different views and media orientations. Some of these social networks tend to be an online social TV such as Youtube. Content of these networks are generated in video format by users and posted in channels and communication between users is possible by commenting under these videos. Instagram was started as an image and short video sharing social network and the same communication method has been implemented. Facebook as another big social network, does not restrict users to post specific media types and also allows users to directly communicate with each other using direct chat which is recently available on Instagram too.
Among these popular social media delivery systems, Twitter has gained much attention in recent years due to its simplicity and user friendly interface. It is also known as the best social media for discovering ``\textit{what is happening right now}''\cite{Twitter2018}. Twitter is easily accessible by almost any device connected to Internet through a web browser or a third-party/official application. The nature of twitter short posts that are known as tweets has restrictions in size and at first it was supposed to be a gentle replacement for SMS \cite{Carlson2011}. In other words, twitter is the best social media for discovering news and real world events \cite{Kwak2010}.
Reports show that on a daily basis, 500 million new tweets and on a monthly basis, 300 new user sign-ups happened on twitter in 2013; In 2018, it is estimated that 700 million tweets will be posted each day and growth rate for number of tweets per year to be around 32\% on 2013 \cite{TwitterStats}. These statistics show that users tend to produce large volumes of tweets on variety of types with high velocity and diverse veracity with different values; Mentioned characteristics of twitter streaming media takes it into account of social big data with respect to 5'V model \cite{Bello-Orgaz2016}.
Twitter has very rich data in form of tweets which can be accessed using Twitter API. This API made researchers capable of investigating its social big data in a streaming way or in a query based data retrieval fashion \cite{API2018}. Documentation about the API itself is available at twitter developer website\footnote{\url{https://developer.twitter.com/en}}. This API allows direct messaging, search, advertisement management, and account activity control. It has some restriction to prevent developers from abusing the service. For example, it has rate limit for user or application\footnote{\url{https://developer.twitter.com/en/docs/basics/rate-limiting}}.
This open and free dataset has been used by many researchers. Many advancements has been conducted in multiple research areas related to this social big data such as opinion mining, topic detection and tracking, user modeling, sentiment analysis, and etc. But the underlying conceptual perspective of researcher to the problem makes different outcomes with diverse real world applications. If the data is supposed to be treated as streaming social big data (as it is) then the problem would likely to be solved in an unsupervised or semi-supervised methodology. Some other researches try to solve the problem with respect to a static corpus but others tend to do so in an streaming big social data respect \cite{atefeh2015survey}.
On the other hand, many of the previous works assumed the correctness of incoming data for granted which is not true in many cases. For example, in the case of analyzing tweets related to regular users, many noisy content such as mistypes and grammar errors exist while in the case of official tweets like a news agency tweet, this problem can be ignored. The most missing part of this analysis is related to images and videos of the tweets. To the best of our knowledge, most of the existing methods did not use multimodal data to detect and track topics.
To overcome the mentioned problems, we present a novel approach for topic detection and tracking problem. Our work consists of three major parts: multimodal named entity recognizer, memory graph, and Transformer based semantic similarity assignment. The combination of these three parts provides the final results. Orientation of presented study is as follows: Section \ref{sec:relatedWork} covers related works of the problem at hand. Section \ref{sec:topicbert} presents the proposed methodology for detecting and tracking topics. The experimental results at Section \ref{sec:experimentalResults} investigates the performance of our work on three distinct datasets. Finally, Section \ref{sec:conclusions} concludes the whole paper.
\section{Related work}
\label{sec:relatedWork}
This section describes various techniques proposed for topic detection and tracking from twitter. For reader curiosity and further information, Table \ref{tab:tableRelatedWorks} is inserted to cover most of related works in literature of TDT task on twitter.
The first methods we investigate here, are using frequent pattern mining as building block. The frequent pattern mining problem is a well studied area by virtue of its various applications in multiple domains like clustering and classification. This problem is initiated as finding relationships between items in a transaction database \cite{aggarwal2014frequent}, where the formal definition is given below:
\begin{definition}
\label{def:fpm}
Given a database $D$ consisting transactions $T_1, \dots, T_2$, determination of all possible patterns $P$ with at least $s$ frequency over all of transactions, is known as Frequent Pattern Mining.
\end{definition}
With respect to this definition, a document collection can be noted as a database of transactions. Depending on this technical terminology, a frequent pattern mining approach applied to collection of documents discovers relationships between words with frequency of at least $s$ \cite{ibrahim2017tools,atefeh2015survey}. To have a better formalization and homogeneity, just like a database of transactions, we use notation $D$ for collection of documents and $P$ for possible patterns which are relationships between words.
Abstract topic on the other hand, is defined in the following:
\begin{definition}
\label{def:topic}
Set of abstract topics (or shortly $topics$) $\Theta$ in collection of documents $D$ are bag of words $W_\Theta$ related to each other by occurrence in the same documents with high frequency.
\end{definition}
Summing up definitions \ref{def:fpm} and \ref{def:topic}, topic detection task from a series of documents is almost equivalent to frequent pattern mining in database of transactions if the semantic relation between words is discarded from problem.
A major topic such as $\theta_i \in \Theta$ usually consists of multiple minor topics like $\theta_j$, based on this assumption, a minor topic is defined as: $\theta_j = \{W_{\theta_j} \mid W_{\theta_j} \subset W_{\theta_i} \}$. With association rule mining in mind \cite{zhang2002association}, statement $\theta_j \subset \theta_i$ holds true while the confidence $c$ for a minor topic depends on detection algorithm but at any means is less than one.
On the contrary, a real life event, or event for short is defined as \cite{atefeh2015survey}:
\begin{definition}
\label{def:event}
An event $e_i \in E$ is a real-life topic that occurs in real life at specific time period $\tau$.
\end{definition}
According to this definition, any event is also a topic but a topic $\theta_i$ needs to happen in real life to be counted as an event $e$. For example, the \texttt{Bongo Cat}\footnote{Bongo cat is a set of tweets identified by \texttt{\#BongoCat} hashtag: \url{https://www.twitter.com/hashtag/Bongocat}} is not a real life event but it is surely a topic. For event detection tasks, it is crucial to have more information about topics rather than depending only on documents; online sources such as Wikipedia\footnote{Wikipedia is a free encyclopedia, written by the people who use it: \url{https://www.wikipedia.org/}} are very helpful for information gathering on this specific problem.
These two problems, namely frequent pattern finding and topic detection, are dealt by a similar way. Frequent pattern mining has been a common way to solve the topic detection task over twitter data stream and some variants of formal methods has been proposed by researchers in \cite{Petkos2014,HuangJiajiaandPeng2015,Gaglio2015,Choi2019}.
In \cite{Petkos2014}, authors designed a soft frequent pattern mining approach to overcome the topic detection problem. This research aims at finding word co-occurrence large than two, in order to do so, likelihood of each word is computed separately. Equation \ref{eq:likelihood} shows likelihood of appearance for each word.
\begin{equation}
\label{eq:likelihood}
p(w|corpus) = \frac{N_w + \sigma}{(\sum_{u}^{n}N_u) + \sigma n}
\end{equation}
\noindent where $N_w$ is the number of occurrences of word $w$, and $\sigma$ equals to $0.5$. Denominator part in this equation is used to normalize the fraction. Grow rate of each word in corpus is computed to indicate the most discussed words.
After finding top-K frequent words, a co-occurrence vector is formed to add co-occurring words to the top-K word vectors. This expansion forms the foundation of soft frequent pattern mining algorithm (SFPM) utilized in \cite{Petkos2014} to solve the topic detection problem. Results presented in main article shows superiority of this method to $LDA$ \cite{Sayyadi2009} and a $Graph-based$ approach \cite{Quercia2012}, which is assumed to be the baseline for this research.
Like previous method, in \cite{Gaglio2015} a named entity recognition weight has been added to boost scores for each word. This simple addition to original algorithm (SFPM) improved topic recall, keyword precision and keyword recall on two different datasets.
Recently, high utility pattern mining (HUPM) has been introduced \cite{liu2012mining}. This approach for finding frequent item-sets with higher utility in twitter topic detection domain has been investigated in \cite{HuangJiajiaandPeng2015,Choi2019}. The proposed high utility pattern clustering in \cite{HuangJiajiaandPeng2015} considered the utility of each pattern in order to extract high utility patterns, afterwards it takes these patterns and uses an incremental pattern clustering scheme. $KNN$ and $modularity-based$ clustering employed by authors, try to identify new emerging patterns and coherent topics simultaneously. Finally, a group of words for each cluster of patterns are extracted to represent the topic of that specific cluster. All of mentioned steps together form HUPC framework (High Utility Pattern Clustering): text stream, text segments, top-K HUP mining, term indexing, HUP clustering, and post-processing.
Like two previous methods, proposed scheme in \cite{Choi2019} considered the problem of topic detection as a pattern mining problem and introduces a HUP mining algorithm in order to extract final topics. Internal, external, and transaction weighted utility of words has been used by authors to determine the utility of words. Minimum utility of each chunk of tweets is determined automatically by their algorithm. Also, for post-processing step, a $Topic-tree$ was proposed to extract actual topics from candidate ones. Experimental results shows superiority of this work compared to five different methods.
Some research \cite{saeed2018text,saeed2019event,saeed2019enhanced,saeed2020evesense} used dynamic heart beat graph technique (DHG) for streaming data on Twitter. The proposed algorithms construct a sub-graph for each sentence. These bi-clique sub-graphs are added to the main graph and a graph operation on the whole graph is performed based on the frequency of co-occuring words (edges between nodes). Their proposed method shows a novel approach on how graph methods can be applied to streaming text but on the other hand their work lacks multimodality and comprehensiveness.
However, in most of previous works the main contribution of authors is extracting topics with higher precision and recall, but none of these works except \cite{Choi2019,saeed2019enhanced} tried to take performance metrics in mind. An online topic detection and tracking scheme must fit in Definition \ref{def:NED} to be considered as a practical solution.
\begin{definition}
\label{def:NED}
New event detection (NED) is discovering new events from live stream $L$ in real time with no delay or at least with an acceptable delay $t_d$.
\end{definition}
If the extraction and tracking method is applied to collection of offline documents, it will be considered a RED methodology, which completely differs from NED. Definition \ref{def:RED} is a formalization of RED.
\begin{definition}
\label{def:RED}
Retrospective event detection (RED) is discovering previously unidentified events from collection of documents.
\end{definition}
Definitions \ref{def:NED} and \ref{def:RED} make a fair clarification of Table \ref{tab:tableRelatedWorks} and highlight differences among diverse approaches. In Table \ref{tab:tableRelatedWorks} we provide an overview of related works in this field and categorized them based on the NED and RED terminology.
\section{TopicBERT}
\label{sec:topicbert}
The three pillars of our proposed system (TopicBERT), namely, Transformer semantic similarity, word community detection, and multimodal named entity recognizer, are bounded together as it is presented in Figure \ref{fig:proposed_system}. The incoming data from social media stream such as Twitter is streamed into the MongoDB that feeds multimodal data into different elements of the system. In this design, MongoDB acts as a cache for whole system in the case of any long delay or failure in any system parts. Delays happen because different parts have different complexity and speed metrics. On the other hand, the neo4j\footnote{\url{https://neo4j.com/}} database is the repository of word graph in form of a memory graph. The following sections describe each part in more detail and the last section reviews how the whole system works in a harmony.
\subsection{Memory-Graph}
\label{sec:wordSubgraphMining}
Our approach identifies any document as a word graph such as $G_i=(V_i,E_i)$, in which the nodes represent words, and vertices are the co-occurrence relation of these nodes. A group of word graphs arriving in a streaming fashion form a larger graph such as $G=(V,E)$. Figure \ref{fig:wordgraph} shows an example of such graphs. Preprocessing tasks like tokenization and stemming can be applied before forming word graphs. Time slots are used to identify arrival of each document and accordingly its addition to $G$. Upon arrival of each separate and independent $G_i$, the cumulative word graph $G$ will be updated and each new node and edge will be added. Putting previous assumption in mind, each word graph has a time slot identifier label like $t$ and must be noted as $G_{(i,t)}$. Discarding duplicated words in each document yields to no further change in $G_{(i,t)}$ but the $G$ must be a weighted graph to uphold weight of relations. In our case, we use similarity metric for computing comulative weights that is explained in Section \ref{sec:transformer}.
Evolving nature of cumulative word graph $G$ indicates that streaming documents tend to complete it. In order to have a fading effect on $G$, we also consider it as a memory-graph (MG) that can remember and forget. A control parameter $\varrho$, controls the fading effect on memory graph, meaning, each node and edge would fade in MG as time passes (new word graphs arriving).
\begin{figure}
\centering
\includegraphics[width=0.6\linewidth]{WordGraph.pdf}
\caption{Word Graph formation example}
\label{fig:wordgraph}
\end{figure}
Forgetting and remembering properties of MG makes it reliable for extracting frequent patterns as relations that have certain properties in terms of MG's memory representation. In other words, relations that withstand the evolution of MG are those that are being repeatedly added. Weights of MG show the importance of particular relations over time, if any weight goes under a specific value, then the relation does not seem to be an important one anymore. If the weight shows a spiking growth, it means that the relation has been repeated with a high frequency in a short time. This property indicates an emerging relation if it disappears soon, otherwise, it will be assumed to be a \textit{common relation}.
All that is said draws a general assumption of MG which is core of current research to control the size of graph. Setting up forgetting rate can be done in diverse setups ranging from computational or cognitive approaches. In order to adapt a cognitive configuration bound with our presented MG, we implement \textbf{forgetting curve} \cite{wozniak1995two}. According to \textit{Hermann Ebbinghaus}'s work, who pioneered experimental study of memory, the forgetting curve is formulated as:
\begin{equation}\label{eq:forgettingcurve}
R = e^{-\frac{t}{\varrho}}
\end{equation}
\noindent where $R$ is retrievability, $\varrho$ is stability of memory and $t$ is time. $\varrho$ determines how fast retrievability falls over time in absence of any \textbf{memory recall}\footnote{\textbf{memory recall} is different from \textbf{recall}}.
Memory recall is defined as simply trying to remember items. However, there are two types of memory recall, \textbf{free recall} and \textbf{serial recall}. Free recall is an attempt to recall individual items regardless of their order while serial recall is attempting to recall the list of items in the ordered study. \textbf{Overlearning effect} is practicing memorization beyond required repetitions. This effect ensures that the memorized information will be more resistant to disruption or loss.
Using this effect and multiplying it to any values gives the fading effect over it. For the $t$ value in this equation, we will use the time that specific value last updated. If it has been a long time from its last update then the effect is high and if it goes under a specific threshold it will be completely forgotten (deleted).
However, the remembering and forgetting has its shortcomings too. For example, some words come from different contexts which need to be updated with different weights rather than just using +1 for any edge. On the other hand, words or phrases must have different importance because of their semantic nature; For example, a phrase related to a named entity such as person or location must be more important compared to a typical word. To enhance the described memory graph, subsection \ref{sec:transformer} and \ref{sec:multimodalner} describe our solutions.
\subsection{Transformer masked language modelling}
\label{sec:transformer}
Capturing the words and recording them in a graph form is explored in many previous works too. However, none of them tried to consider the semantic relation between words that appear in previous different contexts. For example, consider a word such as $W$, previously appearing in three different tweets of $T_1,T_2,T_3$ and the word $W'$ in only one tweet $T_4$, each of these two words had been on different contexts before, and no relation between them is available in our word graph. A new tweet arrives that has both of these words in the same context, a tweet such as $T_5$. The resulting sub-graph contains both of $W$ and $W'$ now and according to previous methods there should be an edge with the weight of one between the two words. Apart from the consideration that this assumption is wrong, in this section we try to employ Transformers to improve it.
We use the BERT transformer pretrained model\footnote{Available at: \url{https://storage.googleapis.com/bert_models/2020_02_20/uncased_L-4_H-512_A-8.zip}}\footnote{Source code from google: \url{https://github.com/google-research/bert}}\footnote{SentBert: \url{https://pypi.org/project/sentence-transformers/}} to compute the embedding for each incoming tweet and record it as an attribute for each node (word). The original version of BERT is not sufficient because it does not capture sentence similarity, instead we used a pre-trained version called SentBERT \cite{reimers2019sentence}. If another tweet comes that has the word, embedding attribute of node is updated using a weighted approach between previous and new embedding. In the case of computing score for two different nodes in one tweet, we use frequency and similarity score. Frequency is the number of occurrence of two nodes in the same tweets, and score is calculated using \eqref{eq:score}.
\begin{equation}\label{eq:score}
S_{i,j}^{t} = S_{i,j}^{t-1}+ cos(M_i^{t},M_j^{t})\text{, if } W_i \text{ and }W_j \in tweet_t
\end{equation}
\begin{equation}\label{eq:embedding}
M_i^{t} = \alpha M_i^{t-1}+ (1-\alpha) M_i^{tweet_t}\text{, if }W_i \in tweet_t
\end{equation}
where, $tweet_t$ is the tweet that arrives at time $t$, $S_{i.j}^t$ is the score between words $W_i$ and $W_j$, $M_i^t$ is the embedding of word $W_i$, $\alpha$ is discount value for aggregating previous embedding and the new one (in the range of $(0,1)$), and $t$ is the time.
According to \eqref{eq:embedding}, at each time a new tweet arrives and the embedding of nodes are updated with embedding provided from BERT (i.e., \texttt{[CLS]} token). The reason we have used \texttt{[CLS]} instead of each node embdding is that the context itself is more important than the word embedding and some words are tokenized into multiple tokens rather than one token which makes it harder to aggregate.
Scoring equation shown in \eqref{eq:score} provides a mechanism to score edges rather than naively using frequencies. This score equation at its best is equal to co-occurrence frequency, because larger values for $cos(M_i^{t},M_j^{t})$ at each step equals means higher context similarity.
However, this mechanism provides a smoother approach compared to frequency counting, but the online learning for fine tuning the underlying BERT language model has an undeniable importance. This fine tuning makes the language model more tuned to the task which the language is in form of tweets rather than formal essays or grammatically perfect articles. We adopt this assumption too, and use it in our setup to finetune the BERT at each step we gather batches of tweets. Utilizing MongoDB as a cache is important in this case. Additionally, if there is more than one server available, a dedicated server can be used for language modeling.
\subsection{Multimodal Named Entity Recognition}
\label{sec:multimodalner}
Categorization of items in the graph, based on their types provides key features to highlight the node significance. For example, in our study, words or phrases that point to some named entity such as a person is more important in forming a topic. To find the named entities, we use the deep multimodal model described in \cite{asgari2020multimodal}.
Figure \ref{fig:multimodalner} shows the multimodal named entity recognizer model that utilizes both image and text data from tweets. The multimodal nature of this approach provides better results in the presence of noise and it is able to perform recognition in the absence of image. The high performance of the model makes it perfect fit for the task at hand.
\begin{figure*}[!ht]
\centering
\includegraphics[width=\textwidth]{Model.pdf}
\caption{Multimodal NER model, courtesy of \cite{asgari2020multimodal}.}
\label{fig:multimodalner}
\end{figure*}
\subsection{Graph update rules}
\label{sec:graph_update_rules}
Updating the graph makes it larger and therefore, the memory graph approach is considered to shrink it to the desired size. However, adding multiple tweets (subgraphs) to it needs precautions, because each addition changes the shape and form of connections. Tracking changes and inferring topics according to small changes will be harder as the data stream get faster or the topic gets hotter. In order to detect and track topics, we propose using graph update rules that we obtained by getting motivated from \cite{zhao2019incremental}. They initially used this approach for community detection and we employ a different but similar method for topic detection.
Each tweet converted to a complete subgraph, is part of a larger graph called memory graph. At each time step $t$, incoming tweets are converted to complete subgraphs such as $G_t=(V_t,E_t)$. For simplicity, we see tweets coming in a specific time stamp one by one. Time stamp $t$ is the identifier for each complete subgraph such as $G_t$ generated from tweet. The $V_t$ symbol presents words or tokens and $E_t$ presents the connection between them. $E_t$ is complete for any tweet and is always determined according to \eqref{eq:score} and \eqref{eq:embedding}. Rest of the notations are explained in Table \ref{tb:notations}.
\begin{table*}[h]
\centering
\caption{Notations used in this paper}
\label{tb:notations}
\begin{tabular}{l l}
\hline
Notation & Description\\
\hline
$G_t=(V_t,E_t)$&Complete graph from twitter stream at time $t$ with tokens as $V$ and edges as $E$\\
$S_{i,j}^t$&Cumulative similarity score between tokens $i$ and $j$ in time $t$ (Eq. \ref{eq:score})\\
$M_i^t$&Embedding of token $i$ at time $t$ (Eq. \ref{eq:embedding})\\
$\theta^t$&Set of all topic clusters at time $t$\\
$\theta_i^t$&$i$th topic cluster at time $t$\\
$\theta$&Set of all topic clusters in all times\\
$\theta_i^t$&$i$th topic at time $t$\\
$N^t(W)$&Neighbourhood of $W$ in time $t$\\
\hline
\end{tabular}
\end{table*}
According to the assumptions above, we redefine each edge as a score in \eqref{eq:score} and note the subgraph as $G_t=(V_t,S_t)$ in which $S_t \equiv S_{i,j}^t$. To understand the graph update rules, we first categorize the incoming subgraph type and according to its type, we decide which strategy to apply. Table \ref{tb:categorization} described each category. The first category $\mathcal{U}$ needs no precaution for addition because it will form a completely new topic cluster $\theta_i^t \not \in \theta^t$ independent of any other previous one. The strategy required for this category is to assign a new cluster id for it and add it to the set of topic clusters at time $t$ that is noted as $\theta^t$. In other sense, $(\forall a) W_a \in V_t\rightarrow (\forall i) W_a \notin \theta_i^t$ or $(\forall i) V_t \cap \theta_i^t = \emptyset$ is the mathematical definition of this category. In the case of category $\mathcal{I}$, the new graph will be completely added to an existing $\theta_i^t$ because $(\exists i) V_t \subset \theta_i^t$. This update will change the inner structure of $\theta_i^t$ and has no impact on any other topic clusters. The Multiple category or $\mathcal{M}$ is identified as words belonging to more than one topic cluster. Its mathematical definition is expressed as $[(\forall a) W_a \in V_t\rightarrow (\exists i) W_a \in \theta_i^t]\wedge [(\forall j) V_t \not\subset \theta_j^t]$. The last category, $\mathcal{S}$, is expressed as $[(\exists a) W_a \in V_t\rightarrow (\forall i) W_a \notin \theta_i^t]\wedge[(\exists b) W_b \in V_t\rightarrow (\exists i) W_b \in \theta_i^t] \wedge [(\forall j) V_t \not\subset \theta_j^t]$. For the last two cases of these categorization, $\mathcal{M}$ and $\mathcal{S}$, we need algorithmic approach to determine which word belongs to which topic cluster that is presented by Algorithm \ref{alg:algall}. In this algorithm, the topic cluster stickiness metric is used that is explained in \eqref{eq:stick}. The $\Lambda$ function provides a metric to determine how much a single word $W_a$ is related to a topic such as $\theta_i^t$. This function can be used in different approaches, utilization of this function is described by Algorithm \ref{alg:algall}.
\begin{equation}\label{eq:stick}
\Lambda(W_a,\theta_i^t) = \frac{\sum\limits_{W_b \in N^t(W_a) \cap V_{\theta_i^t}}S_{W_a,W_b}^t}{\sum\limits_{W_b \in N^t(W_a)}S_{W_a,W_b}^t}
\end{equation}
\begin{algorithm}\label{alg:algall}
\caption{Update $\theta^t$ for all the categories listed in Table \ref{tb:categorization}}
\SetAlgoLined
\LinesNumbered
\SetKwInOut{Input}{Inputs}
\SetKwInOut{Output}{Output}
\SetKwProg{Update}{UpdateTopicClusters}{}{}
\Update{$(\theta^t,G_t)$}{
\Input{$\theta^t$ and $G_t=(V_t,S_t)$}
\Output{$\theta^{t+1}$}
$G_{unseen}=\{W \in V_t | (\forall i) W \notin \theta_i^t\}$\;
$G_{seen}=V_t - G_{unseen}$\;
$S_{update} =\{S_{W,W'}^t|W \in V_t$ and $W' \in N(W)\}$\;
Apply $S_{update}$to related edges in update\;
\If{$G_{seen} == \emptyset$}{
$\theta_{K^t+1}^t=G_t$\;
}
\Else{
$\theta_{K^t+1}^t=G_t$\;
\ForEach{$\mathcal{G} \in [G_{unseen},G_{seen}]$}
{
\ForEach{ $W \in \mathcal{G}$}{
assign $W$ to $\theta_i^t$ where $i= \argmax\limits_{i\in\{1,2,\dots,K^t+1\}} \{\Lambda(W,\theta_i^t)|N(W)\cap\theta_i^t \neq \emptyset\}$\;
}
}
\If{$\theta_{K^t+1}^t ==\emptyset$}{
remove $\theta_{K^t+1}^t$ from $\theta^t$\;
}
}
\KwRet{$\theta^t$}\;
}
\end{algorithm}
This algorithm provides a combination of all categorizations in a better understandable and efficient way. At first, if the incoming $G_t$, consists of all new words, if it is type $\mathcal{U}$, a new topic cluster is formed and assigned to it. Otherwise, for seen and unseen words in the $G_t$ (first seen and then unseen ones), we calculate $\Lambda$ for each $W$ and assign $W$ to the topic cluster which has the higher $\Lambda$. This part of algorithm is required for the $\mathcal{M}$ and $\mathcal{S}$ categories while for the $\mathcal{I}$ no update is required, just updating the $S$ values is enough. The reason for no required update in category $\mathcal{I}$ is that no new $W$ will be added to topic clusters, just the $S$ values will be updated.
\begin{table*}[h]
\centering
\caption{Categorization of incoming tweets as subgraphs}
\label{tb:categorization}
\begin{tabular}{l c l}
\hline
Category & Symbol & Description\\
\hline
Unique &$\mathcal{U}$& \textit{All} words in tweet are \textbf{new} and did not appear in any $\theta_i^t$\\
Incessant &$\mathcal{I}$& \textit{All} words in tweet are \textbf{previously merged into a \underline{single $\theta_i^t$}}\\
Multiple &$\mathcal{M}$& \textit{All} words in tweet are \textbf{previously merged into \underline{more than one $\theta_i^t$}}\\
Subset &$\mathcal{S}$& \textit{Some} words in tweet are \textbf{previously merged into \underline{one or more that one $\theta_i^t$}} and \textit{some} are \textbf{new}\\
\hline
\end{tabular}
\end{table*}
\subsection{Topic Extraction\label{sec:topic_extraction}}
The extraction part seems much easier having well-separated topic clusters which only contain related and connected words. However, using other features of the tweets is also helpful. By other features, we use how much tweet has been retweeted and liked. The other features are also available too, such as word frequency itself and the trend. We use all these features and store them in each node along with the embedding. Tagging words and grouping them as entities also improves the outcome. Here, we describe the methodology behind extracting topics from topic clusters at time $t$ or the $\theta^t$.
Equations \eqref{eq:topic_score} and \eqref{eq:node_score} describe how we score each node in each time $t$.
\begin{equation}\label{eq:topic_score}
\Gamma^t(W) = E\times\left(\Upsilon^t(W) + \sum\limits_{W'\in N^t(W)}\Upsilon^t(W')\times S^t_{W,W'}\right)
\end{equation}
\begin{equation}\label{eq:node_score}
\Upsilon^t(W)=\delta F^t\times\left(F^t(W) +\sum\limits_{i=0}^t\left(L_i+R_i\right)\right)
\end{equation}\begin{equation}
E=
\begin{cases}
1.2, & \text{if}\ W \text{ is tagged as named entity} \\
1, & \text{otherwise}
\end{cases}
\end{equation}
From the above equations, the outcome values for $\Gamma$ are converted to probabilities by \eqref{eq:p_w}. In this equation, $\theta^t_i$ is the topic cluster that $W$ belongs to. For each cluster, the probability of that topic cluster is in the topics is computed by \eqref{eq:prob_topic} and also, for each topic cluster, the probability of each word being nominated is computed by \eqref{eq:prob_word}. Multiplication of these two values gives the probability of each word being nominated in the overall outcome. Higher ranked words will appear first.
\begin{equation}\label{eq:p_w}
P(W|\theta^t_i) = \frac{\Gamma^t(W)}{\sum\limits_{W'\in \theta^t_i}\Gamma^t(W')}
\end{equation}
\begin{equation}\label{eq:prob_topic}
P(\theta^t_i|\theta^t) = \frac{\sum\limits_{W\in \theta^t_i}\Gamma^t(W)}{\sum\limits_{W\in \theta^t}\Gamma^t(W)}
\end{equation}
\begin{equation}\label{eq:prob_word}
P(W|\theta^t) = P(W|\theta^t_i)\times P(\theta^t_i|\theta^t)
\end{equation}
\subsection{Proposed system in a bounded harmony}
Although all parts and sections describe the system in little pieces but how this parts are bounded needs to be clarified. Figure \ref{fig:proposed_system} shows a visualization of the proposed system. The most important part of this systems is the data flow into the parts and keep it in a harmony. By harmony we mean how each part does its task and minimize the requirement for delays caused by slower parts.
First, the connection to the twitter data stream is established and the incoming tweets about a topic of interest (this can be done by targeting specified keywords or just querying on specific key-phrases) are stored in the MongoDB as they are collected. These batches of data contain very valuable fields such text, media, hyperlinks and etc. which we just select the necessary fields and send them to each module that is indicated on the connection curves in the figure. Each batch containing 64 text samples are passed into BERT for fine-tuning. The masked language modeling using this transformer fine-tunes the embeddings in our use case. On the other hand, the graph strategies defined in Section \ref{sec:graph_update_rules} is used and applied by Algorithm \ref{alg:algall}. The named entity recognition is done by using both image and text from this multimodal data stream using what is described in Section \ref{sec:multimodalner}. Graph strategies module adds data into the graph with doing topic clustering at the same time while the NER tags related words and combines them if there is an entity containing more than one words. We used Neo4j as our database because of its similicity in use and the ability to keep larger amounts of data while helping to access them using Cipher query language. This database is where we collect our findings in a graph form and share it between modules. The mining/tuning module is described in Section \ref{sec:topic_extraction} which after mining the topics using equation \eqref{eq:prob_word}, applies the decay defined by \eqref{eq:forgettingcurve} to nodes. As hyperparameter for forgetting, we used a dynamic method that investigates how much RAM is available and according to that finds new $\varrho$. If the memory usage goes over the threshold ($90\%$) we start reducing the $\varrho$ by 1 until we get to the exact RAM usage after automatic elimination of nodes. If it goes under the threshold ($80\%$) the $\varrho$ is increased by 1 until it is reached to the desired value.The initial value of $\varrho$ is set to $10^3$. The results are sent to the output at each step mining/tuning has been applied.
This independence of modules makes them work concurrently or on different servers if needed.
\section{Experiments and results}
\label{sec:experimentalResults}
For experimenting our system on various datasets we have used the datasets provided by \cite{aiello2013sensing} which was part of \textit{social sensor project}. The three collected datasets along with results all of the methods that have been proposed upon these datasets are discussed in the following.
\subsection{Datasets} \label{sec:datasets}
According to the TREC practice, releasing contents of tweets are not allowed because it violates the user privacy. The user might change his preferences to not seen by public in future time and releasing in past will violate his/her rights eventually. Therefore, the authors did not release the tweets, but instead they released the tweet id to be accessed if it is still available. However, in time, small part of this dataset was not accessible because of many reasons such as user changes to the privacy settings, user account closed or even restricted. This issue is not specific to this dataset and happens when the providers of datasets follow the TREC rules and respect user privacy. At the time we collected these datasets, the same issue happened and the quantitative results about the dataset itself is reported in table \ref{tab:datasets}.
\begin{table*}[h]
\centering
\caption{Quantitative information about the datasets, duration time format is HH:MM:SS}
\label{tab:datasets}
\begin{tabular}{l l r l l l}
\hline
Dataset & Total Topics & Number of Tweets&Start Data&End Date&Duration\\
\hline
FA CUP &13&189,034&2012/05/05 14:00:00&2012/05/05 19:59:30&05:59:30\\
SUPER TUESDAY&22&475,659&2012/03/06 17:00:00&2012/03/07 16:59:59&24:00:00\\
US ELECTIONS&64&1,992,260&2012/11/06 17:00:00&2012/11/08 04:59:59&36:00:00\\
\hline
\end{tabular}
\end{table*}
\begin{figure*}[!ht]
\centering
\includegraphics[width=0.25\linewidth]{us_elections_all.pdf}
\includegraphics[width=0.25\linewidth]{super_tuesday_all.pdf}
\includegraphics[width=0.25\linewidth]{fa_cup_all.pdf}
\caption{WordCloud representation of datasets: A. US Elections; B. Super Tuesday; C. FA Cup.}
\label{fig:wordcloud_datasets}
\end{figure*}
\begin{figure*}[!ht]
\centering
\includegraphics[width=0.25\linewidth]{fa_cup_0.pdf}
\includegraphics[width=0.25\linewidth]{fa_cup_1.pdf}
\includegraphics[width=0.25\linewidth]{fa_cup_2.pdf}
\\
\includegraphics[width=0.25\linewidth]{fa_cup_3.pdf}
\includegraphics[width=0.25\linewidth]{fa_cup_4.pdf}
\includegraphics[width=0.25\linewidth]{fa_cup_5.pdf}
\\
\includegraphics[width=0.25\linewidth]{fa_cup_6.pdf}
\includegraphics[width=0.25\linewidth]{fa_cup_7.pdf}
\includegraphics[width=0.25\linewidth]{fa_cup_8.pdf}
\caption{WordCloud representation of FA Cup dataset}
\label{fig:wordcloud_fa_cup}
\end{figure*}
\subsection{Preprocessing}
Tweets often contain huge amounts of noise such as mistyped and user invetned words. This noise is a big problem in cases where no subword embedding is used. One of reasons we used BERT is because it can handle such unknown tokens. For the preprocessing part, we dropped stop words if they do not appear in the named entities. Other than dropping stopwords, we also dropped non-english tweets that contain various languages such as Spanish or Hindi and etc. We considered such languages out of our scope but our method is capable of handling these methods and we put into our future works to use multilingual contextual pretrained models\footnote{Pretrained multilingual BERT available at: \url{https://github.com/google-research/bert/blob/master/multilingual.md}}. Cleaning other characters such as \texttt{@} or \texttt{-} did not damage results more than 0.05 in various metrics but dropping these caharacter from tokens would yield in losing important tokens such as 1-0 in datasets such as FA CUP. Because of event itself, designing such preprocessing and engineering it is a hard thing to do and in some cases (rather than datasets we have tested and in some other languages) it may be beneficial but in overall it is logical to keep it as minimum as possible.
\begin{table*}
\centering
\caption{Top-K topics-recall of detection algorithms compared to our proposed method on FA CUP dataset}
\label{tb:res_facup}
\begin{tabular}{l l l l l l l l l l l}
\hline
\multirow{2}{*}{Method}&\multicolumn{10}{c}{Top-K topic-recall}\\
\cline{2-11}
&2&4&6&8&10&12&14&16&18&20 \\
\hline
LDA&.692&.692&.840&.840&.920&.920&.840&.840&.840&.750\\
Doc-P&.769&.850&.920&.920&1&1&1&1&1&1\\
Gfeat-P&.000&.308&.308&.375&.375&.375&.375&.375&.375&.375\\
SFPM&.615&.840&.840&1&1&1&1&1&1&1\\
BNGram&.769&.920&.920&.920&.920&.920&.920&.920&.920&.920\\
SVD+Kmean&.482&.596&.710&.824&.938&.951&.951&.951&.951&.951\\
SNMF-Orig&.100&.177&.254&.331&.389&.389&.389&.389&.389&.389\\
SNMF-KL&.167&.334&.502&.670&.837&.837&.840&.850&.850&.924\\
Exempler&.810&.838&.886&.908&.916&.916&.916&.916&.916&.916\\
EHG&.379&.591&.727&.727&.864&.864&1&1&1&1\\
Ours&.810&.951&.951&1&1&1&1&1&1&1\\
\hline
\end{tabular}
\end{table*}
\begin{table*}
\centering
\caption{Top-K topics-recall of detection algorithms compared to our proposed method on SUPER TUESDAY dataset}
\label{tb:res_super_tuesday}
\begin{tabular}{l l l l l l l l l l l l}
\hline
\multirow{2}{*}{Method}&\multicolumn{11}{c}{Top-K topic-recall}\\
\cline{2-12}
&2&10&20&30&40&50&60&70&80&90&100 \\
\hline
LDA&.000&.000&.000&.180&.130&.130&.180&.280&.280&.370&.227\\
Doc-P&.227&.227&.310&.400&.460&.500&.500&.500&.540&.680&.680\\
Gfeat-P&.046&.045&.085&.180&.227&.280&.280&.280&.280&.280&.280\\
SFPM&.182&.182&.270&.325&.325&.325&.325&.325&.325&.325&.325\\
BNGram&.500&.500&.540&.540&.540&.540&.540&.540&.540&.540&.540\\
SVD+Kmean&.192&.236&.400&.488&.547&.580&.626&.666&.666&.666&.666\\
SNMF-Orig&.000&.045&.100&.183&.277&.277&.277&.320&.320&.363&.453\\
SNMF-KL&.000&.100&.183&.183&.318&.410&.366&.410&.453&.363&.410\\
Exempler&.246&.463&.538&.572&.586&.597&.600&.617&.638&.638&.638\\
EHG&.163&.408&.466&.540&.628&.674&.674&.699&.699&.711&.711\\
Ours&.463&.381&.580&.628&.699&.699&.699&.711&722&.722&.722\\
\hline
\end{tabular}
\end{table*}
\begin{table*}
\centering
\caption{Top-K topics-recall of detection algorithms compared to our proposed method on US ELECTIONS dataset}
\label{tb:res_us_elections}
\begin{tabular}{l l l l l l l l l l l l}
\hline
\multirow{2}{*}{Method}&\multicolumn{11}{c}{Top-K topic-recall}\\
\cline{2-12}
&2&10&20&30&40&50&60&70&80&90&100 \\
\hline
LDA&.109&.109&.185&.245&.220&.280&.325&.500&.475&.430&.460\\
Doc-P&.234&.234&.415&.505&.560&.615&.615&.690&.690&.720&.740\\
Gfeat-P&.078&.078&.140&.180&.180&.180&.180&.180&.180&.180&.180\\
SFPM&.359&.359&.465&.525&.540&.540&.540&.540&.540&.540&.540\\
BNGram&.480&.480&.495&.495&.495&.495&.495&.495&.495&.495&.495\\
SVD+Kmean&.110&.216&.420&.522&.588&.608&.647&.700&.720&.720&.740\\
SNMF-Orig&.075&.075&.154&.218&.439&.467&.483&.545&.563&.595&.595\\
SNMF-KL&.154&.154&.326&.400&.547&.581&.562&.618&.600&.652&.622\\
Exempler&.022&.142&.244&.364&.465&.532&.590&.628&.651&.662&.662\\
EHG&.279&.608&.670&.688&.733&.746&.762&.772&.780&.796&.805\\
Ours&.326&.628&.628&.733&.772&.772&.780&.805&.805&.813&.821\\
\hline
\end{tabular}
\end{table*}
\begin{table*}
\centering
\caption{Top-2 keyword-precision of detection algorithms compared to our proposed method on all three datasets}
\label{tb:res_all}
\begin{tabular}{l l l l}
\hline
\multirow{2}{*}{Method}&\multicolumn{3}{c}{Dataset}\\
\cline{2-4}
&FA CUP&SUPER TUESDAY&US ELECTIONS\\
\hline
LDA&.164&.000&.165\\
Doc-P&.337&.511&.401\\
Gfeat-P&.000&.375&.375\\
SFPM&.233&.471&.241\\
BNGram&.299&.628&.405\\
SVD+Kmean&.242&.367&.300\\
SNMF-Orig&.330&.241&.241\\
SNMF-KL&.242&.164&.164\\
Exemplar&.300&.485&.391\\
EHG&.442&.812&.591\\
Ours&\textbf{.456}&\textbf{.851}&\textbf{.621}\\
\hline
\end{tabular}
\end{table*}
\subsection{Evaluation metrics and results}
We use two metrics for evaluating our work, namely keyword-precision and topic-recall. Keyword-precision is defined as the number of correctly detected keywords divided by the number of ground-truth keywords. Topic-recall is the number of detected ground-truth topics divided by all ground truth topics. In order to evaluate and compare our work to others, we used the results obtained by other methods and also added our own on various top-K tests. For results of other methods, we used the reported values from \cite{saeed2019enhanced}. Tables \ref{tb:res_facup}, \ref{tb:res_super_tuesday}, and \ref{tb:res_us_elections} present results of our expriments on top-k topic-recall over all three datasets while table \ref{tb:res_all} provides results for all datasets with top-2 keyword-precision applied to these datasets. For the visualization part of our memory graph, we obtained results from our Neo4j database that is shown for an early moment before and after detecting communities. Figure \ref{fig:mg} shows this visualization, in yellow nodes indicate the named entities while the blue ones are regular words.
\begin{figure*}[!ht]
\centering
\includegraphics[width=0.9\linewidth]{graphs.pdf}
\caption{Outputs from Neo4j: (A) and (B) using Neo4j default visualization tool, yellow nodes are named entities and blues ones are words; (C) and (D) using GraphXR, all nodes are named entities}
\label{fig:mg}
\end{figure*}
\begin{figure*}[!ht]
\centering
\includegraphics[width=0.9\linewidth]{Scheme.pdf}
\caption{Proposed System}
\label{fig:proposed_system}
\end{figure*}
\subsection{Future works}
In Figure \ref{fig:proposed_system}, we propose a module in our system as computer vision. This module is our future work guide for researcher to obtain other visual entities such as people and objects in visual content such as videos and images. Clustering this objects using their embedding would yield to having them bounded with the topics they appear most. Thus, such results would give the end user much more information rather than text and this visual content would help automatic journalism from social media.
\section{Conclusions}
\label{sec:conclusions}
In current research, we used Transformers combined with graph techniques to provide a topic detection system for social media. Fine-tuning the transformers in realtime and obtaining valuable semantic information rather than using just frequencies is another novelty of our work. Our proposed model is combined of various modules including BERT, graph strategies and multimodal named entity recognizer. This combination as a unique methodology is called memory graph that uses cognitive memorization in human brain. Using our hyper-parameters such as the rate of forgetting makes this system available for any stream size and any machine it is running. Modularity of our work makes it more usable in real life and corporate based environments when dealing with big social data.The results shows superiority of our proposed method compared to other state of the art techniques.
\begin{table*}
\begin{tabular}{l p{3cm} c| c| c| c c p{3cm}}
\hline
\multirow{2}{*}{Ref.} & \multirow{2}{*}{Detection Method} & \multicolumn{2}{c}{Type} & \multicolumn{2}{c}{Task} & \multirow{2}{*}{Dataset} & \multirow{2}{*}{Application} \\
\cline{3-6}
& & Event & Topic & RED & NED & & \\
\hline
\cite{sankaranarayanan2009twitterstand} & Naive Bayse Classifier & & \checkmark & & \checkmark & Twitter API, Handpicked Users & Hot News Detection \\
\hline
\cite{phuvipadawat2010breaking} & BScore based BOW Clustering &\checkmark & & & \checkmark & Twitter API (offline) & Disaster and Story Detection \\
\hline
\cite{petrovic2010streaming} & BOW Distance Similarity & \checkmark & & & \checkmark & Twitter API & FSD \footnote{First Story Detection} \\
\hline
\cite{tembhurnikar2015topic} & BN-Gram and tf-idf & & \checkmark & \checkmark & & Offline Datasets & Topic Detection \\
\hline
\cite{osborne2012bieber} & Cross Checking via Wikipedia & \checkmark & & & \checkmark & Twitter API, Wikipedia & Hot News Detection \\
\hline
\cite{cigarran2016step} & Formal Concept Analysis & & \checkmark & & \checkmark & Replab 2013 dataset & Topic Detection \\
\hline
\cite{adedoyin2016rule} & FPM\footnote{Frequent Pattern Mining} & \checkmark & & & \checkmark & Twitter API & Event Detection \\
\hline
\cite{Petkos2014} & FPM & & \checkmark & \checkmark & & Super Tuesday/FA Cup/U.S. Elections & Topic Detection \\
\hline
\cite{dong2017discovering} & FPM (Hierarchical Clustering) & & \checkmark & & \checkmark & topic dataset from CLEar system & Topic Detection \\
\hline
\cite{Gaglio2015} & FPM (tf-idf \& n-gram improved) & \checkmark & & & \checkmark & Twitter API & Event Detection \\
\hline
\cite{erra2015approximate} & GPU improved tf-idf approximation & & \checkmark & \checkmark & & offline dataset & Topic Detection \\
\hline
\cite{becker2011beyond} & BOW Similarity & \checkmark & & & \checkmark & offline dataset & Topic Detection \\
\hline
\cite{tang2014learning} & Word Embedding & & & & & SemEval Dataset & Twitter Sentiment Classification \\
\hline
\cite{hua2016automatic} & spatiotemporal detection & \checkmark & & \checkmark & & offline Dataset & Targeted-domain event detection \\
\hline
\cite{abdelhaq2013eventweet} & Clustering of Temporal \& Spatial features & \checkmark & & \checkmark & & Twitter API & Social Event Detection \\
\hline
\cite{lee2010measuring} & Geographical Regularity Estimation & \checkmark & & & \checkmark & Twitter API & Geo-Social Event Detection \\
\hline
\cite{li2012tedas} & BOW clustering & \checkmark & & & \checkmark & Twitter API & Event Detection \& Analysis \\
\hline
\cite{sakaki2010earthquake} & Probabilistic Modeling & \checkmark & & & \checkmark & Twitter API & Early Disaster Detection \\
\hline
\cite{snowsill2010finding} & FPM & \checkmark & & \checkmark & & offline dataset & Event Detection \\
\hline
\cite{cordeiro2012twitter} & wavelet analysis & \checkmark & & & \checkmark & Twitter API & Event Detection \\
\hline
\end{tabular}
\caption{Twitter Topic/Event detection/tracking related studies}
\label{tab:tableRelatedWorks}
\end{table*}
\bibliographystyle{elsarticle-num-names}
| {'timestamp': '2020-08-18T02:16:40', 'yymm': '2008', 'arxiv_id': '2008.06877', 'language': 'en', 'url': 'https://arxiv.org/abs/2008.06877'} | arxiv |
\section{Introduction}
\vspace{-2mm}
Given a never-before-seen object (\textit{e.g.}, a gadwall in Figure~\ref{fig:teaser}), humans are able to generalize even from a single image of this object in different ways, including recognizing new object instances and imagining what the object would look like from different viewpoints. Achieving similar levels of generalization for machines is a fundamental problem in computer vision, and has been actively explored in areas such as few-shot object recognition~\citep{fei2006one,vinyals2016matching,wang2016learning,finn2017model,snell2017prototypical} and novel-view synthesis~\citep{park2017transformation,nguyen2018rendernet,sitzmann2019deepvoxels}. However, such exploration is often limited in {\em separate} areas with specialized algorithms {\em but not jointly}.
We argue that synthesizing images and recognizing them are inherently interconnected with each other. Being able to {\em simultaneously} address both tasks with a {\em single} model is a crucial step toward human-level generalization. This requires learning a richer, shareable internal representation for more comprehensive object understanding than it could be within individual tasks. Such ``cross-task'' knowledge becomes particularly critical in the low-data regime, where identifying 3D geometric structures of input images facilities recognizing their semantic categories, and vice versa.
Inspired by this insight, here we propose a novel task of {\em joint few-shot recognition and novel-view synthesis}: given only one or few images of a novel object {\em from arbitrary views with only category annotation}, we aim to simultaneously learn an object classifier and generate images of that type of object from new viewpoints. This joint task is challenging, because of its (i) {\em weak supervision}, where we do not have access to any 3D supervision, and (ii) {\em few-shot setting}, where we need to effectively learn both 3D geometric and semantic representations from minimal data.
While existing work copes with two or more tasks mainly by multi-task learning or meta-learning of a shared feature representation~\citep{yu2020meta,zamir2018taskonomy,lake2015human}, we take a different perspective in this paper. Motivated by the nature of our problem, we focus on the {\em interaction and cooperation between a generative model (for view synthesis) and a discriminative model (for recognition)}, in a way that facilitates knowledge to flow across tasks {\em in complementary directions}, thus making the tasks help each other. For example, the synthesized images produced by the generative model provide viewpoint variations and could be used as additional training data to build a better recognition model; meanwhile, the recognition model ensures the preservation of the desired category information and deals with partial occlusions during the synthesis.
To this end, we propose a {\em feedback-based bowtie network (FBNet)}, as illustrated in Figure~\ref{fig:teaser}. The network consists of a view synthesis module and a recognition module, which are linked through feedback connections in a bowtie fashion. This is a general architecture that can be used on top of any view synthesis model and any recognition model. The view synthesis module explicitly learns a 3D geometric representation from 2D images, which is transformed to target viewpoints, projected to 2D features, and rendered to generate images. The recognition module then leverages these synthesized images from different views together with the original real images to learn a semantic feature representation and produce corresponding classifiers, leading to {\em the feedback from the output of the view synthesis module to the input of the recognition module}. The semantic features of real images extracted from the recognition module are further fed into the view synthesis module as conditional inputs, leading to {\em the feedback from the output of the recognition module to the input of the view synthesis module}.
One potential difficulty, when combining the view synthesis and the recognition modules, lies in the mismatch in their level of image resolutions. Deep recognition models can benefit from high-resolution images, and the recognition performance greatly improves with increased resolution~\citep{wang2016studying,cai2019convolutional,he2016deep}. By contrast, it is still challenging for modern generative models to synthesize very high-resolution images~\citep{regmi2018cross,nguyen2019hologan}. To address this challenge, while operating on a resolution consistent with state-of-the-art view synthesis models~\citep{nguyen2019hologan}, we further introduce {\em resolution distillation} to leverage additional knowledge in a recognition model that is learned from higher-resolution images.
{\bf Our contributions} are three-folds. (1) We introduce a new problem of simultaneous few-shot recognition and novel-view synthesis, and address it from a novel perspective of {\em cooperating generative and discriminative modeling}. (2) We propose feedback-based bowtie networks that jointly learn 3D geometric and semantic representations with feedback in the loop. We further address the mismatch issue between different modules by leveraging resolution distillation. (3) Our approach significantly improves both view synthesis and recognition performance, {\em especially in the low-data regime}, by enabling direct manipulation of view, shape, appearance, and semantics in generative image modeling.
\section{Related Work}
\vspace{-2mm}
\begin{figure}[t]
\centering
\vspace{-6mm}
\includegraphics[width = 0.92 \linewidth]{figures/teaser.pdf}
\caption{{\bf Left:} Given a single image of a novel visual concept (\textit{e.g.}, a gadwall), a person can generalize in various ways, including imagining what this gadwall would look like from different viewpoints (top) and recognizing new gadwall instances (bottom). {\bf Right:} Inspired by this, we introduce a general feedback-based bowtie network that facilitates the interaction and cooperation between a generative module and a discriminative module, thus simultaneously addressing few-shot recognition and novel-view synthesis in the low-data regime.}
\label{fig:teaser}
\vspace{-5mm}
\end{figure}
{\bf Few-Shot Recognition} is a classic problem in computer vision~\citep{thrun1996learning,fei2006one}. Many algorithms have been proposed to address this problem~\citep{vinyals2016matching,wang2016learning,finn2017model,snell2017prototypical}, including the recent efforts on leveraging generative models~\citep{li2015generative,wang2018low,schwartz2018delta,zhang2018metagan,tsutsui2019meta,chen2019image,li2019few,zhang2019few,Sun_2019_CVPR}. A hallucinator is introduced to generate additional examples in a pre-trained feature space as data augmentation to help with low-shot classification~\citep{wang2018low}. MetaGAN improves few-shot recognition by producing fake images as a new category~\citep{zhang2018metagan}. However, these methods either do not synthesize images directly or use a pre-trained generative model that is not optimized towards the downstream task. By contrast, our approach performs joint training of recognition and view synthesis, and enables the two tasks to cooperate through feedback connections. In addition, while there has been work considering both classification and exemplar generation in the few-shot regime, such investigation focuses on simple domains like handwritten characters~\citep{lake2015human} but we address more realistic scenarios with natural images. Note that {\em our effort is largely orthogonal to designing the best few-shot recognition or novel-view synthesis method}; instead, we show that the joint model outperforms the original methods addressing each task in isolation.
{\bf Novel-View Synthesis} aims to generate a target image with an arbitrary camera pose from one given source image~\citep{tucker2020single}. It is also known as ``multiview synthesis.'' For this task, some approaches are able to synthesize lifelike images~\citep{park2017transformation,yin2018geonet,nguyen2018rendernet,sitzmann2019deepvoxels,iqbal2020weakly,yoon2020novel,wiles2019synsin,wortsman2020supermasks}. However, they heavily rely on pose supervision or 3D annotation, which is not applicable in our case. An alternative way is to learn a view synthesis model in an unsupervised manner. Pix2Shape learns an implicit 3D scene representation by generating a 2.5D surfel based reconstruction~\citep{rajeswar2020pix2shape}. HoloGAN proposes an unsupervised approach to learn 3D feature representations and render 2D images accordingly~\citep{nguyen2019hologan}.~\citet{nguyen2020blockgan} learn scene representations from 2D unlabeled images through foreground-background fragmenting. Different from them, not only can our view synthesis module learn from weakly labeled images, but it also enables conditional synthesis to facilitate recognition.
{\bf Feedback-Based Architectures}, where the full or partial output of a system is routed back into the input as part of an iterative cause-and-effect process~\citep{ford1999modeling}, have been recently introduced into neural networks~\citep{belagiannis2017recurrent,zamir2017feedback,yang2018convolutional}. Compared with prior work, our FBNet contains two complete sub-networks, and the output of \textit{each} module is fed into the other as one of the inputs. Therefore, FBNet is essentially a {\em bi-directional} feedback-based framework which optimizes the two sub-networks jointly.
{\bf Multi-task Learning} focuses on optimizing a collection of tasks jointly~\citep{misra2016cross,ruder2017overview,kendall2018multi,Pal_2019_CVPR,xiao2020few}. Task relationships have also been studied~\citep{zamir2018taskonomy,standley2019tasks}. Some recent work investigates the connection between recognition and view synthesis, and makes some attempt to combine them together~\citep{sun2018multi,wang2018low,Xian_2019_CVPR,santurkar2019image,xiong2020fine,michalkiewicz2020few}. For example,~\citet{xiong2020fine} use multiview images to tackle fine-grained recognition tasks. However, their method needs strong pose supervision to train the view synthesis model, while we do not. Also, these approaches do not treat the two tasks of equal importance, \textit{i.e.}, one task as an auxiliary task to facilitate the other. On the contrary, our approach targets the joint learning of the two tasks and improves both of their performance. {\em Importantly}, we focus on learning a shared generative model, rather than a shared feature representation as is normally the case in multi-task learning.
{\bf Joint Data Augmentation and Task Model Learning} leverage generative networks to improve other visual tasks~\citep{peng2018jointly,hu2019learning,luo2020learn,zhang2020unified}. A generative network and a discriminative pose estimation network are trained jointly through adversarial loss in \citet{peng2018jointly}, where the generative network performs data augmentation to facilitate the downstream pose estimation task. \citet{luo2020learn} design a controllable data augmentation method for robust text recognition, which is achieved by tracking and refining the moving state of the control points.~\citet{zhang2020unified} study and make use of the relationship among facial expression recognition, face alignment, and face synthesis to improve training.~\citet{mustikovela2020self} leverage a generative model to boost viewpoint estimation. The main difference is that we focus on the
joint task of synthesis and recognition and achieve bi-directional feedback, while existing work only considers optimizing the target discriminative task using adversarial training or with a feedforward network.
\section{Our Approach}
\vspace{-2mm}
\subsection{Joint Task of Few-Shot Recognition and Novel-View Synthesis}
\label{sec:setting}
\vspace{-1mm}
{\bf Problem Formulation:} Given a dataset $\mathcal{D}=\{(x_i,y_i)\}$, where $x_i \in \mathcal{X}$ is an image of an object and $y_i\in\mathcal{C}$ is the corresponding category label ($\mathcal{X}$ and $\mathcal{C}$ are the image space and label space, respectively), we address the following two tasks {\em simultaneously}. (i) Object recognition: learning a discriminative model $R:\mathcal{X}\rightarrow \mathcal{C}$ that takes as input an image $x_i$ and predicts its category label. (ii) Novel-view synthesis: learning a generative model $G:\mathcal{X}\times \mathit{\Theta}\rightarrow \mathcal{X}$ that, given an image $x_i$ of category $y_i$ and an arbitrary 3D viewpoint $\theta_j \in \mathit{\Theta}$, synthesizes an image in category $y_i$ viewed from $\theta_j$.
Notice that we are more interested in {\em category-level consistency}, for which $G$ is able to generate images of not only the instance $x_i$ but also other objects of the category $y_i$ from different viewpoints. This joint-task scenario requires us to improve the performance of both 2D and 3D tasks under weak supervision {\em without any ground-truth 3D annotations}. Hence, we need to exploit the {\em cooperation} between them.
{\bf Few-Shot Setting:} The few-shot dataset consists of one or only a few images per category, which makes our problem even more challenging.
To this end, following the recent work on knowledge transfer and few-shot learning~\citep{hariharan2017low,chen2019closer}, we leverage a set of ``base'' classes $\mathcal{C}_\text{base}$ with a large-sample dataset $\mathcal{D}_\text{base}=\{(x_i,y_i), y_i \in \mathcal{C}_\text{base}$\} to train our initial model. We then fine-tune the pre-trained model on our target ``novel'' classes $\mathcal{C}_\text{novel}$ ($\mathcal{C}_\text{base} \cap \mathcal{C}_\text{novel} = 0$) with its small-sample dataset $\mathcal{D}_\text{novel}=\{(x_i,y_i), y_i \in \mathcal{C}_\text{novel}$\} (\textit{e.g.}, a $K$-shot setting corresponds to $K$ images per class).
\subsection{Feedback-Based Bowtie Networks}
\vspace{-1mm}
To address the joint task, we are interested in learning a generative model that can synthesize realistic images of different viewpoints, which are also useful for building a strong recognition model. We propose a feedback-based bowtie network (FBNet) for this purpose. This model consists of a view synthesis module and a recognition module, trained in a joint, end-to-end fashion. Our key insight is to explicitly introduce feedback connections between the two modules, so that they cooperate with each other, thus enabling the entire model to simultaneously learn 3D geometric and semantic representations. This general architecture can be used on top of any view synthesis model and any recognition model. Here we focus on a state-of-the-art view synthesis model -- {\mbox{HoloGAN}}~\citep{nguyen2019hologan}, and a widely adopted few-shot recognition model -- prototypical network~\citep{snell2017prototypical}, as shown in Figure~\ref{fig:model}.
\begin{figure}[t]
\centering
\vspace{-6mm}
\includegraphics[width = 0.92 \linewidth]{figures/model.pdf}
\caption{Architecture of our feedback-based bowtie network. The whole network consists of a view synthesis module and a recognition module, which are linked through feedback connections in a bowtie fashion.}
\label{fig:model}
\vspace{-5mm}
\end{figure}
\subsubsection{View Synthesis Module}
\vspace{-1mm}
The view synthesis module $V$ is shown in the blue shaded region in Figure~\ref{fig:model}. It is adapted from {\mbox{HoloGAN}}~\citep{nguyen2019hologan}, a state-of-the-art model for unsupervised view synthesis. This module consists of a generator $G$ which first generates a 3D feature representation from a latent constant tensor (initial cube) through 3D convolutions. The feature representation is then transformed to a certain pose and projected to 2D with a projector. The final color image is then computed through 2D convolutions. This module takes two inputs: a latent vector input $z$ and a view input $\theta$. $z$ characterizes the style of the generated image through adaptive instance normalization (AdaIN)~\citep{huang2017arbitrary} units. $\theta = [\theta^x, \theta^y,\theta^z]$ guides the transformation of the 3D feature representation. This module also contains a discriminator $D$ to detect whether an image is real or fake (not shown in Figure~\ref{fig:model}). We use the standard GAN loss from DC-GAN~\citep{radford2015unsupervised}, $\mathcal{L}_\text{GAN}(G,D)$. We make the following important modifications to make the architecture applicable to our joint task.
\textbf{Latent Vector Formulation:} To allow the synthesis module to get feedback from the recognition module (details are shown in Section~\ref{sec:joint}), we first change HoloGAN from unconditional to conditional. To this end, we model the latent input $z$ as: $z_i = f_i \oplus n_i$, where $f_i$ is the conditional feature input derived from image $x_i$ and $n_i$ is a noise vector sampled from Gaussian distribution. $\oplus$ is the combination strategy (\textit{e.g.}, concatenation). By doing so, the synthesis module leverages additional semantic information, and thus maintains the category-level consistency with a target image and improves the diversity of the generated images.
\textbf{Identity Regularizer:} Inspired by~\citet{chen2016infogan}, we introduce an identity regularizer to ensure that the synthesis module simultaneously satisfies two critical properties: (i) the identity of the generated image remains when we only change the view input $\theta$; (ii) the orientation of the generated image preserves when we only change the latent input $z$, and this orientation should be consistent with the view input $\theta$. Specifically, we leverage an encoding network $H$ to predict the reconstructed latent vector $z^\prime$ and the view input $\theta^\prime$: $ H(G(z,\theta)) = [z^\prime, \theta^\prime]$, where $G(z,\theta)$ is the generated image. Then we minimize the difference between the real and the reconstructed inputs as
\vspace{-1mm}
\begin{align}
\mathcal{L}_\text{identity}(G,H) = \mathbb{E}_{z}\|z - z^\prime\|^{2} + \mathbb{E}_{\theta}\|\theta-\theta^\prime\|^{2}.
\end{align}
\vspace{-1mm}
Here $H$ shares the majority of the convolution layers of the discriminator $D$, but uses an additional fully-connected layer. Section~\ref{sec:syndetail} explains the detailed architecture of the view synthesis module.
\subsubsection{Recognition Module}
The recognition module $R$ (green shaded region in Fig.~\ref{fig:model}) consists of a feature extraction network $F$ which transforms images to latent features, and a prototypical classification network $P$~\citep{snell2017prototypical} which performs the final classification. Below we explain the design of these two components, focusing on how to address the technical challenges faced by joint training with view synthesis.
\textbf{Feature Extraction with Resolution Distillation:} We use a ResNet~\citep{he2016deep} as our feature extraction network $F$ to transform images into latent features for the recognition module. One of the main obstacles to combining $F$ with the synthesis module is that state-of-the-art synthesis models and recognition models operate on different resolutions. Concretely, to the best of our knowledge, current approaches to unsupervised novel-view synthesis still cannot generate satisfactory high-resolution images (\textit{e.g.}, $224\times 224$)~\citep{nguyen2019hologan}. By contrast, the performance of current well-performing recognition models substantially degrades with low-resolution images~\citep{wang2016studying,cai2019convolutional}. To reconcile the resolution incompatibility, we introduce a simple distillation technique inspired by the general concept of knowledge distillation~\citep{hinton2015distilling}.
Specifically, we operate on the resolution of the synthesis module (\textit{e.g.}, $64 \times 64$). But we benefit from an additional auxiliary feature extraction network $F_\text{highR}$ that is trained on high-resolution images (\textit{e.g.}, $224 \times 224$). We first pre-train $F_\text{highR}$ following the standard practice with a cross-entropy softmax classifier~\citep{liu2016large}. We then train our feature extraction network $F_\text{lowR}$ (the one used in the recognition module), under the guidance of $F_\text{highR}$ through matching their features:
\vspace{-1mm}
\begin{align}
\mathcal{L}_\text{\text feature}(F_\text{lowR}) = \mathbb{E}_{x}\| F_\text{highR}(x) - F_\text{lowR}(x)\|^2,
\end{align}
\vspace{-1mm}
where $x$ is a training image. With the help of resolution distillation, the feature extraction network re-captures information in high-resolution images but potentially missed in low-resolution images.
\textbf{Prototypical Classification Network:}
We use the prototypical network $P$~\citep{snell2017prototypical} as our classifier. The network assigns class probabilities $\hat{p}$ based on distance of the input feature vector from class centers $\mu$; and $\mu$ is calculated by using support images in the latent feature space:
\vspace{-1mm}
\begin{align}
\hat{p}_{c}(x) =\frac{e^{-d(P(F_\text{lowR}(x)), \mu_c)}}{\sum_j e^{-d(P(F_\text{lowR}(x)), \mu_j)}},
\quad
\mu_{c}=\frac{\sum_{(x_{i}, y_{i}) \in S} P(F_\text{lowR}(x_i)) \mathbf{I}\left[y_{i}=c\right]}{\sum_{(x_{i}, y_{i}) \in S} \mathbf{I}\left[y_{i}=c\right]},
\end{align}
\vspace{-1mm}
where $x$ is a real query image, $\hat{p}_c$ is the probability of category $c$, and $d$ is a distance metric (\textit{e.g.}, Euclidean distance). $S$ is the support dataset. $P$ operates on top of the feature extraction network $F$, and consists of 3 fully-connected layers as additional feature embedding (the classifier is non-parametric). Another benefit of using the prototypical network lies in that it enables the recognition module to explicitly leverage the generated images in a way of data augmentation, \textit{i.e.}, $S$ contains both real and generated images to compute the class mean. Notice that, though, the module parameters are updated based on the loss calculated on the {\em real query images}, which is a cross-entropy loss $\mathcal{L}_\text{rec}(R)$ between their predictions $\hat{p}$ and ground-truth labels.
\subsubsection{Feedback-Based Bowtie Model}
\label{sec:joint}
\vspace{-1mm}
As shown in Figure~\ref{fig:model}, we leverage a bowtie architecture for our full model, where the output of each module is fed into the other module as one of its inputs. Through joint training, such connections work as explicit feedback to facilitate the communication and cooperation between different modules.
\textbf{Feedback Connections:} We introduce two complementary feedback connections between the view synthesis module and the recognition module: (1) {\bf recognition output $\rightarrow$ synthesis input} (green arrow in Figure~\ref{fig:model}), where the features of the real images extracted from the recognition module are fed into the synthesis module as conditional inputs to generate images from different views; (2) {\bf synthesis output $\rightarrow$ recognition input} (blue arrow in Figure~\ref{fig:model}), where the generated images are used to produce an augmented set to train the recognition module.
\textbf{Categorical Loss for Feedback:} The view synthesis module needs to capture the categorical semantics in order to further encourage the generated images to benefit the recognition. Therefore, we introduce a categorical loss to update the synthesis module with the prediction results of the generated images:
\vspace{-1mm}
\begin{align}
\mathcal{L}_\text{cat}(G) = \mathbb{E}_{y_i}\|-\log (R(G(z_i,\theta_i))) \|,
\end{align}
\vspace{-1mm}
where $y_i$ is the category label for the generated image $G(z_i, \theta_i)$. This loss also implicitly increases the diversity and quality of the generated images.
\textbf{Final Loss Function:}
The final loss function is:
\vspace{-1mm}
\begin{align}
\mathcal{L}_\text{Total} = \mathcal{L}_\text{GAN} + \mathcal{L}_\text{rec} + \mathcal{L}_\text{feature} + \lambda_\text{id} \mathcal{L}_\text{identity} + \lambda_\text{cat} \mathcal{L}_\text{cat},
\end{align}
\vspace{-1mm}
where $\lambda_\text{id}$ and $\lambda_\text{cat}$ are trade-off hyper-parameters.
\textbf{Training Procedure:} We first pre-train $F_\text{highR}$ on the high-resolution dataset and save the computed features. These features are used to help train the feature extraction network $F_\text{lowR}$ through $\mathcal{L}_\text{feature}$. Then the entire model is first trained on $\mathcal{C}_\text{base}$ and then fine-tuned on $\mathcal{C}_\text{novel}$. The training on the two sets are similar. During each iteration, we randomly sample some images per class as a support set and one image per class as a query set. The images in the support set, together with their computed features via the entire recognition module, are fed into the view synthesis module to generate multiple images from different viewpoints. These synthesized images are used to augment the original support set to compute the prototypes. Then, the query images are used to update the parameters of the recognition module through $\mathcal{L}_\text{rec}$; the view-synthesis module is updated through $\mathcal{L}_\text{GAN}$, $\mathcal{L}_\text{identity}$, and $\mathcal{L}_\text{cat}$. The entire model is trained in an end-to-end fashion. More details are in Section~\ref{sec:pseudocode}.
\section{Experimental Evaluation}
\vspace{-2mm}
\textbf{Datasets:} We focus on two datasets here: the Caltech-UCSD Birds (CUB) dataset which contains 200 classes with 11,788 images~\citep{WelinderEtal2010}, and the CompCars dataset which contains 360 classes with 25,519 images~\citep{yang2015large}. Please refer to Section~\ref{sec:adddetails} for more details of the datasets. These are challenging fine-grained recognition datasets for our joint task. The images are resized to $64 \times 64$. We randomly split the entire dataset into 75\% as the training set and 25\% as the test set. For CUB, 150 classes are selected as base classes and 50 as novel classes. For CompCars, 240 classes are selected as base classes and 120 as novel classes. Note that we focus on simultaneous recognition and synthesis over {\em all} base or novel classes, which is significantly more challenging than typical 5-way classification over sampled classes in most of few-shot classification work~\citep{snell2017prototypical,chen2019closer}. We also include evaluation on additional datasets in Section~\ref{sec:morexpts}.
\textbf{Implementation Details:} We set $\lambda_\text{id} = 10$ and $\lambda_\text{cat} = 1$ via cross-validation. We use ResNet-18~\citep{he2016deep} as the feature extraction network, unless otherwise specified. To match the resolution of our data, we change the kernel size of the first convolution layer of ResNet from 7 to 5. The training process requires hundreds of examples at each iteration, which may not fit in the memory of our device. Hence, inspired by~\citet{wang2018low}, we make a trade-off to first train the feature extraction network through resolution distillation. We then freeze its parameters and train the other parts of our model. Section~\ref{sec:adddetails} includes more implementation details.
\textbf{Compared Methods:} Our feedback connections enable the two modules to cooperate through joint training. Therefore, to evaluate the effectiveness of the feedback connections, we focus on the following comparisons. (1) For the novel-view image synthesis task, we compare our approach \textbf{FBNet} with the state-of-the-art method \textbf{HoloGAN}~\citep{nguyen2019hologan}. We also consider a variant of our approach \textbf{FBNet-view}, which has the same architecture as our novel-view synthesis module, but takes the {\em constant} features extracted by a pre-trained ResNet-18 as latent input. FBNet-view can be also viewed as a {\em conditional} version of HoloGAN. (2) For the few-shot recognition task, we compare our full model \textbf{FBNet} with its two variants: \textbf{FBNet-rec} inherits the architecture of our recognition module, which is essentially a prototypical network~\citep{snell2017prototypical}; \textbf{FBNet-aug} uses the synthesized images from {\em individually trained} FBNet-view as data augmentation for the recognition module.
Note that, while conducting comparisons with other few-shot recognition (\textit{e.g.},~\citet{chen2019closer,finn2017model}) or view synthesis models (\textit{e.g.},~\citet{yoon2020novel,wiles2019synsin}) is interesting, {\em it is not the main focus of this paper}. We aim to validate that the feedback-based bowtie architecture outperforms the single-task models upon which it builds, rather than designing the best few-shot recognition or novel-view synthesis method. In Section~\ref{sec:relation}, we show that our framework is general and can be used on top of other single-task models and improve their performance. All the models are trained following the same few-shot setting described in Section~\ref{sec:setting}.
\textbf{View Synthesis Facilitates Recognition:} Table~\ref{tab:recog} presents the top-1 recognition accuracy for the base classes and the novel classes, respectively. We focus on the challenging 1, 5-shot settings, where the number of training examples per novel class $K$ is 1 or 5. For the novel classes, we run five trials for each setting of $K$, and report the average accuracy and standard deviation for all the approaches. Table~\ref{tab:recog} shows that our FBNet {\em consistently} achieves the best few-shot recognition performance on the two datasets. Moreover, the significant improvement of FBNet over FBNet-aug (where the recognition model uses additional data from the {\em conditional} view synthesis model, but they are trained separately) indicates that the feedback-based {\em joint training} is the key to improve the recognition performance.
\begin{table}[t]
\centering
\vspace{-6mm}
\resizebox{.6\linewidth}{!}{
\begin{tabular}{l|lccc}
\hline
& Model & Base & Novel-$K$=1 & Novel-$K$=5 \\ \hline
\multirow{3}{*}{\shortstack[l]{CUB}}
& FBNet-rec & 57.91 & $47.53\pm 0.14$ &$71.26\pm0.26$ \\
& FBNet-aug & 58.03 & $ 47.20 \pm 0.19$ & $71.51 \pm 0.33$ \\
& FBNet& {\bf 59.43} & $\bf 48.39 \pm 0.19$ & $\bf 72.76 \pm 0.24$ \\
\hline
\multirow{3}{*}{\shortstack[l]{CompCars}}
&FBNet-rec & 46.05 & $20.83 \pm 0.03$ & $50.52 \pm 0.11$ \\
& FBNet-aug & 47.41 & $ 21.59 \pm 0.05$ & $51.07 \pm 0.14$ \\
&FBNet& {\bf 49.63} & $ \bf23.28 \pm 0.05$ & $\bf
53.12 \pm 0.09$ \\
\hline
\end{tabular}}
\caption{Top-1 (\%) recognition accuracy on the CUB and CompCars datasets. For base classes: {\bf 150-way} classification on CUB and {\bf 240-way} classification on CompCars; for $K$-shot novel classes: {\bf 50-way} classification on CUB and {\bf 120-way} classification on CompCars. Our FBNet consistently achieves the best performance for both base and novel classes, and joint training significantly outperforms training each module individually.}
\label{tab:recog}
\vspace{-4mm}
\end{table}
\textbf{Recognition Facilitates View Synthesis:} We investigate the novel-view synthesis results under two standard metrics. The \textbf{FID} score computes the Fr{\'e}chet distance between two Gaussians fitted to feature representations of the source (real) images and the target (synthesized) images~\citep{dowson1982frechet}. The \textbf{Inception Score (IS)} uses an Inception network pre-trained on ImageNet~\citep{deng2009imagenet} to predict the label of the generated image and calculate the entropy based on the predictions. IS seeks to capture both the quality and diversity of a collection of generated images~\citep{salimans2016improved}. A higher IS or a lower FID value indicates better realism of the generated images. A larger variance of IS indicates more diversity of the generated images. We generate images of random views in one-to-one correspondence with the training examples for all the models, and compute the IS and FID values based on these images. The results are reported in Table~\ref{tab:single}. As a reference, we also show the results of \emph{real images} under the two metrics, which are the best results we could expect from synthesized images. Our FBNet consistently achieves the best performance under both metrics. Compared with HoloGAN, our method brings up to 18\% improvement under FID and 19\% under IS. Again, the significant performance gap between FBNet and FBNet-view shows that the feedback-based {\em joint training} substantially improves the synthesis performance.
\begin{table}[t]
\centering
\small
\resizebox{\linewidth}{!}{
\begin{tabular}{l|lccc|ccc}
\hline
& \multirow{2}{*}{Model} & \multicolumn{3}{c|}{IS ($\uparrow$)} & \multicolumn{3}{c}{FID ($\downarrow$)} \\ \cline{3-8}
& & Base & Novel-$K$=1 & Novel-$K$=5 & Base & Novel-$K$=1 & Novel-$K$=5 \\ \hline
\multirow{4}{*}{\shortstack[l]{CUB}} & {\it Real Images} & $4.55\pm 0.30$ & $3.53 \pm 0.22$ & $3.53 \pm 0.22$ & 0 & 0 & 0 \\
& {HoloGAN~\citep{nguyen2019hologan}} & $3.55 \pm 0.09$ & $2.44 \pm 0.07$ & $2.58 \pm 0.08 $ & 79.01 & 106.56 & 94.73\\
& {FBNet-view} & $3.60 \pm 0.12$ & $2.53 \pm 0.03$ & $2.64 \pm 0.05$ & 75.38 & 107.36 & 103.25 \\
& {FBNet} & $\bf 3.69\pm 0.17$ & $\bf 2.79 \pm 0.06$ & $\bf 2.83 \pm 0.12$ & {\bf 70.86} & {\bf 104.04} & {\bf 92.97}\\
\hline
\multirow{4}{*}{\shortstack[l]{CompCars}} & {\it Real Images} & $2.96 \pm 0.12$ & $2.80 \pm 0.13$ & $2.80 \pm 0.13$ & 0 & 0 & 0 \\
& {HoloGAN~\citep{nguyen2019hologan}} & $1.85 \pm 0.08$ & $1.41 \pm 0.04$ & $1.65 \pm 0.07$ & 51.49 & 93.48 & 83.17\\
& {FBNet-view} & $2.03 \pm 0.09$ & $1.44 \pm 0.05$ & $1.71 \pm 0.07$ & 49.94 & 92.01 & 83.58 \\
& {FBNet} & $\bf 2.33 \pm 0.14$ & $\bf 1.89 \pm 0.07$ & $ \bf 1.91 \pm 0.10$ & {\bf 44.70} & {\bf 89.39} & {\bf 78.38} \\
\hline
\end{tabular}}
\caption{Novel-view synthesis results under the FID and IS metrics.
$\uparrow$ indicates that higher is better, and $\downarrow$ indicates that lower is better. As a reference, FID and IS of \emph{Real Images} represent the best results we could expect. FBNet consistently outperforms the baselines, achieving 18\% improvements for FID and 19\% for IS.}
\label{tab:single}
\vspace{-7mm}
\end{table}
\begin{figure}[t]
\centering
\vspace{-6mm}
\includegraphics[width = 0.95 \linewidth]{figures/qualitative.pdf}
\caption{Synthesized images from multiple viewpoints. Images in the same row/column are from the same viewpoint/object. Our approach captures the shape and attributes well {\em even in the extremely low-data regime}.}
\label{fig:qualitative}
\end{figure}
IS and FID cannot effectively evaluate whether the generated images maintain the category-level identity and capture different viewpoints. Therefore, Figure~\ref{fig:qualitative} visualizes the synthesized multiview images. Note that, in our problem setting of limited training data under weak supervision, we could not expect that the quality of the synthesized images would match those generated based on large amounts of training data, \textit{e.g.} ~\citet{brock2018large}. This demonstrates the general difficulty of image generation in the few-shot setting, which is worth further exploration in the community.
Notably, even in this challenging setting, our synthesized images are of significantly higher visual quality than the state-of-the-art baselines. Specifically, (1) our FBNet is able to perform {\em controllable} conditional generation, while HoloGAN cannot. Such conditional generation enables FBNet to better capture the shape information of different car models on CompCars, which is crucial to the recognition task. On CUB, FBNet captures both the shape and attributes well even in the extremely low-data regime (1-shot), thus generating images of higher quality and more diversity. (2) Our FBNet also better maintains the identity of the objects in different viewpoints. For both HoloGAN and FBNet-view, it is hard to tell whether they keep the identity, but FBNet synthesizes images well from all the viewpoints while maintaining the main color and shape. (3) In addition, we notice that there is just a minor improvement for the visual quality of the synthesis results from HoloGAN to FBNet-view, indicating that simply changing the view synthesis model from unconditional to conditional versions does not improve the performance. However, through our feedback-based joint training with recognition, the quality and diversity of the generated images significantly improve.
\textbf{Shared Generative Model vs. Shared Feature Representation:} We further compare with a standard multi-task baseline~\citep{ruder2017overview}, which learns a shared feature representation across the joint tasks, denoted as `Multitask-Feat' in Table~\ref{tab:ablation}. We treat the feature extraction network as a shared component between the recognition module and the view synthesis module, and update its parameters using both tasks {\em without} feedback connections. Table~\ref{tab:ablation} shows that, through the feedback connections, our shared generative model captures the {\em underlying image generation mechanism} for more comprehensive object understanding, outperforming direct task-level shared feature representation.
\section{Conclusion}
\vspace{-2mm}
This paper has proposed a feedback-based bowtie network for the joint task of few-shot recognition and novel-view synthesis. Our model consistently improves performance for both tasks, especially with extremely limited data. The proposed framework could be potentially extended to address more tasks, leading to a generative model useful and shareable across a wide range of tasks.
\textbf{Acknowledgement:}
This work was supported in part by ONR MURI N000014-16-1-2007 and by AFRL Grant FA23861714660. We also thank NVIDIA
for donating GPUs and AWS Cloud Credits for Research program.
\section*{Appendix}
\begin{figure}[ht]
\centering
\includegraphics[width = 0.8 \linewidth]{figures/sup-res.pdf}
\caption{Architecture of ResBlock used in the view synthesis module. The default kernel size is 3 and the stride is 1.}
\label{fig:res}
\end{figure}
\section{Detailed Architecture of View Synthesis Module}
\label{sec:syndetail}
\begin{figure}[t]
\centering
\includegraphics[width = 0.9 \linewidth]{figures/sup-dis.pdf}
\caption{Architecture of the discriminator in the view synthesis module. The kernel size of all the convolution layers is 3 and the stride is 2.}
\label{fig:dis}
\vspace{-4mm}
\end{figure}
One of the central components in our view synthesis module is the ResBlock adapted from ResNet~\citep{he2016deep}, where we use Instance Normalization instead of Batch Normalization~\citep{ulyanov2016instance,ioffe2015batch}. Figure~\ref{fig:res} shows the architecture of a 2D ResBlock. For all the convolution layers in this structure, the kernel size is 3 and the stride is 1. By changing the 2D convolution layers to 3D convolution layers, we will get a 3D ResBlock. Figure~\ref{fig:dis} shows the architecture of the discriminator $D$. The kernel size is 3 and the stride is 2 for all the convolution layers. The structure of the generator $G$ is illustrated in Figure~\ref{fig:gen}. Notice that the ``Res-Up'' module is the structure of ResBlock, followed by an upsampling layer. The kernel size is 3 and the stride is 1 for all the convolution layers.
\begin{figure}[t]
\centering
\includegraphics[width = 0.9 \linewidth]{figures/sup-generator.pdf}
\caption{Architecture of the generator in the view synthesis module. Res-Up module is a combination of a ResBlock and an upsampling layer.}
\vspace{-4mm}
\label{fig:gen}
\end{figure}
\section{Pseudocode of Training Algorithm}
\label{sec:pseudocode}
To have a better understanding of the training procedure of \textbf{FBNet}, we include Algorithm~\ref{alg} to show the detailed training process on {\em base} classes. The training on novel classes follows similar process, except the sample number $n$ ($n$ = 1 when we conduct 1-shot training).
\section{Additional Experimental Details}
\label{sec:adddetails}
\textbf{Data Pre-processing:} For the CUB~\citep{WelinderEtal2010} dataset, we first square crop the images with the given bounding boxes, and then we resize the cropped images to 64-resolution. For the CompCars~\citep{yang2015large} dataset, slightly different from the original paper and HoloGAN~\citep{nguyen2019hologan}, we follow the instructions of the publicly released CompCars dataset\footnote{\url{http://mmlab.ie.cuhk.edu.hk/datasets/comp\_cars/} } for classification tasks, and obtain 366 classes of car models after standard pre-processing. We then manually drop 6 classes which have fewer than 15 images per class, and construct a proper dataset for our experiments.
\textbf{Additional Implementation Details:} In the main paper, we set $\lambda_\text{id} = 10$ and $\lambda_\text{cat} = 1$ via cross-validation, and found that the performance is relatively stable to the setting of these trade-off hyper-parameters. We sample 5 images per class for $\mathcal{C}_\text{base}$ and 1 image for $\mathcal{C}_\text{novel}$. We use Adam optimizer for all the networks. The learning rate is set to $5e-5$. The final dimension of the feature extraction network is 1,000. The hidden size of all the three fully-connected layers is 128, and the final feature dimension of the prototypical classification network is also 128. The batch size is 64 for the view synthesis module. We train 1,400 iterations for $\mathcal{C}_\text{base}$ and 100 iterations for $\mathcal{C}_\text{novel}$.
\begin{algorithm}[H]
\SetAlgoLined
\textbf{Initialization:} \\
$max\_it$: Maximum iteration for the training\;
$R$: Recognition module, $V$: View synthesis module\;
$F$: Feature extraction network, $F_\text{high}$: Feature extraction network with high-resolution images\;
$G$: Generator of view synthesis module, $D$: Discriminator of view synthesis module\;
$n$: Number of support images per class, $n = 5$ \;
\For{$iter \leftarrow 1$ \KwTo $max\_iter$}{
$S_\text{support} = \{\}$, $S_\text{query} = \{\}$, $S_\text{augmented} = \{\}$\;
\For{c $\in \mathcal{C}_\text{base}$}{
support\_ims $\leftarrow$ sample $n$ images in $c$\;
query\_ims $\leftarrow$ sample 1 image in $c$\;
$S_\text{support} \leftarrow S_\text{support} \cup$ support\_ims \;
$S_\text{query} \leftarrow S_\text{query} \cup$ query\_ims \;
}
$f_\text{high} \leftarrow F_\text{high}(S_\text{support} \cup S_\text{query})$\;
$f_\text{low} \leftarrow F(S_\text{support} \cup S_\text{query})$ \;
\For{img \textbf{in} $S_\text{support}$}{
$f = R(img)$ \;
$z = f \oplus \mathcal{N}$ \;
$\theta \leftarrow $ sample a view angle\;
$img^\prime \leftarrow G(z,\theta)$\;
$y = D(img)$\;
$[y^\prime,z^\prime,\theta^\prime] = D(img^\prime)$ \;
$\mathcal{L}_\text{GAN}(y,img,y^\prime, img^\prime )\rightarrow $ update $G$, $D$\;
$\mathcal{L}_\text{id}(z,\theta,z^\prime,\theta^\prime) \rightarrow$ update $D$\;
$S_\text{augmented} \leftarrow S_\text{augmented} \cup img^\prime$ \;
}
$S_\text{whole} \leftarrow S_\text{support} \cup S_\text{augmented}$ \;
$\mathcal{L}_\text{rec}(S_\text{whole},S_\text{query})\rightarrow $ update $R$\;
$\mathcal{L}_\text{feature}(f_\text{high}, f_\text{real})\rightarrow $ update $F$\;
$\mathcal{L}_\text{cat}(S_\text{support},S_\text{augmented})\rightarrow $ update $G$\;
}
\caption{Training process of FBNet on base classes.}
\vspace{-4mm}
\label{alg}
\end{algorithm}
\section{Experiments on Additional Datasets}
\label{sec:morexpts}
To show the effectiveness and generality of our proposed FBNet, we conduct experiments on two additional datasets: the North American Birds (NAB) dataset~\citep{van2015building} and the Stanford Dog dataset (DOG)~\citep{KhoslaYaoJayadevaprakashFeiFei_FGVC2011}. There are 555 classes with 48,527 images in NAB dataset. We randomly select 350 classes as base classes and 255 classes as novel classes. For the DOG dataset, there are 20,580 images belonging to 120 classes. We randomly select 80 classes as base and 40 classes as novel. For each class of the two datasets, we randomly select 75\% as training data and 25\% as test data. We pre-process these two datasets in a similar way as the CUB dataset.
Slightly different from the evaluation in the main paper, we only compare our \textbf{FBNet} with \textbf{HoloGAN}~\citep{nguyen2019hologan} for the view synthesis task. For the recognition task, we compare our method with \textbf{FBNet-rec} and \textbf{FBNet-aug}. All the experimental setting remains the same as that in the main paper on the CUB and CompCars datasets.
\textbf{Quantitative Results:} Table~\ref{tab:recog-sup} shows the recognition performance of the three competing models. Again, our method achieves the best performance for both base and novel classes. Table~\ref{tab:view} shows the results of view synthesis and our method also achieves the best performance.
\begin{table}[t]
\centering
\resizebox{.6\linewidth}{!}{
\begin{tabular}{l|lccc}
\hline
& Model & Base & Novel-$K$=1 & Novel-$K$=5 \\ \hline
\multirow{3}{*}{NAB}
&FBNet-rec & 44.56 & $23.97 \pm 0.05$ & $58.09 \pm 0.19$ \\
& FBNet-aug & 44.85 & $ 23.69 \pm 0.08$ & $58.40 \pm 0.26$ \\
&FBNet& {\bf 45.63} & $ \bf24.15 \pm 0.07$ & $\bf
58.98 \pm 0.15$ \\
\hline
\multirow{3}{*}{DOG}
&FBNet-rec & 51.13 & $53.33 \pm 0.09$ & $72.59 \pm 0.17$ \\
&FBNet-aug & 51.46 & $53.11 \pm 0.11$ & $72.68 \pm 0.15$ \\
&FBNet& {\bf 52.25} & $\bf
53.78 \pm 0.08$ & $ \bf 73.21 \pm 0.14$ \\
\hline
\end{tabular}}
\caption{Top-1 (\%) recognition accuracy on the NAB and DOG datasets. For base classes: {\bf 350-way} classification on NAB and {\bf 80-way} classification on DOG; for $K$-shot novel classes: {\bf 205-way} classification on NAB and {\bf 40-way} classification on DOG. Again, our FBNet consistently achieves the best performance for both base and novel classes.}
\label{tab:recog-sup}
\end{table}
\begin{table}[t]
\centering
\small
\resizebox{\linewidth}{!}{
\begin{tabular}{l|lccc|ccc}
\hline
& \multirow{2}{*}{Model} & \multicolumn{3}{c|}{IS ($\uparrow$)} & \multicolumn{3}{c}{FID ($\downarrow$)} \\ \cline{3-8}
& & Base & Novel-$K$=1 & Novel-$K$=5 & Base & Novel-$K$=1 & Novel-$K$=5 \\ \hline
\multirow{3}{*}{\shortstack[l]{NAB}} & {\it Real Images} & $4.90 \pm 0.31$ & $3.47 \pm 0.14$ & $3.88 \pm 0.19$ & 0 & 0 & 0 \\
& {HoloGAN~\citep{nguyen2019hologan}} & $4.06 \pm 0.08$ & $2.52 \pm 0.04$ & $2.65 \pm 0.06$ & 47.52 & 85.74 & 76.38\\
& {FBNet} & $\bf 4.13 \pm 0.12$ & $\bf 2.90 \pm 0.04$ & $ \bf 3.05 \pm 0.08$ & {\bf 40.00} & {\bf 74.55} & {\bf 62.39} \\
\hline
\multirow{3}{*}{DOG} & {\it Real Images} & $8.62 \pm 0.36$ & $4.18 \pm 0.11$ & $4.91 \pm 0.19$ & 0 & 0 & 0 \\
& {HoloGAN~\citep{nguyen2019hologan}} & $6.06 \pm 0.29$& $3.35 \pm 0.11$ & $3.85 \pm 0.17$ & 53.85 & 82.64& 73.21\\
& {FBNet} & $\bf 6.42 \pm 0.32$ & $\bf 3.64 \pm 0.16$ & $\bf 4.02 \pm 0.21$ & {\bf 45.17}& {\bf 79.25} & {\bf 69.66} \\
\hline
\end{tabular}}
\caption{Quantitative results of novel-view synthesis under the FID and IS metrics on the NAB and DOG datasets. $\uparrow$ indicates that higher is better, and $\downarrow$ indicates that lower is better. FBNet consistently outperforms the baselines.}
\label{tab:view}
\end{table}
\begin{figure}[t!]
\centering
\includegraphics[width = \linewidth]{figures/sup-qualitative.pdf}
\caption{Qualitative comparison of synthesized images from multiple viewpoints between our FBNet and state-of-the-art HoloGAN on the NAB and DOG datasets. Images in the same row/column are from the same viewpoint/object. The overall quality of the synthesized images for both methods indicates the general difficulty of the task, due to weak supervision and lack of data. However, our FBNet still captures the shape and attributes well, even though the data is scarcely limited. This shows the strong adaptability of FBNet for few-shot learning.}
\label{fig:quality}
\end{figure}
\textbf{Qualitative Results:} Figure~\ref{fig:quality} shows the synthesized images by HoloGAN and our FBNet on the two datasets. First, we note that the overall quality of the synthesized images for both methods becomes substantially worse than one would expect with large amounts of training images. This demonstrates the general difficulty of the task due to weak supervision and lack of data, indicating the need for the community to focus on such problems. Second, our FBNet significantly outperforms the state-of-the-art HoloGAN, especially for the diversity of the synthesized images. Additionally, even though the data is scarcely limited, FBNet still captures the shape and some detailed attributes of images well.
\section{Comparison with Other Few-Shot Recognition Methods}
\label{sec:external}
We further compare our FBNet with a variety of state-of-the-art few-shot recognition methods on the CompCars dataset~\citep{yang2015large}, including prototypical network (PN)~\citep{snell2017prototypical}, relation network (RN)~\citep{sung2018learning}, matching network (MN)~\citep{vinyals2016matching}, and proto-matching network (PMN)~\citep{wang2018low}. We also compare with two data hallucination-based methods: PN w/ G~\citep{wang2018low} and MetaGAN~\citep{zhang2018metagan}. Table~\ref{tab:external} shows that our FBNet consistently outperforms these methods. Importantly, note that these methods can only address few-shot recognition, while our FBNet is able to deal with the joint task.
\begin{table}[t]
\centering
{
\begin{tabular}{l|cccc|cc|c}
\hline
Setting & PN & RN & MN & PMN & PN w/ G& MetaGAN & FBNet \\ \hline
Base & 46.05 & 45.89 & 46.72 & 47.10 & 48.57 & 39.91 &\bf 49.63 \\
Novel-$K$=1 & 20.83 & 22.14 & 21.62 & 22.78 & 22.71 & 18.59 &\bf 23.28 \\
Novel-$K$ = 5 & 50.52 & 50.26 & 50.59 & 51.07 & 52.65 & 44.20 &\bf 53.12 \\
\hline
\end{tabular}}
\caption{Top-1 (\%) recognition accuracy for our approach and other state-of-the-art few-shot methods, including data hallucination-based methods on CompCars. Our FBNet consistently outperforms the other models.}
\label{tab:external}
\vspace{-4 mm}
\end{table}
\section{Additional Experimental Results with Relation Network}
\label{sec:relation}
The proposed feedback-based framework has a great generalization capability. In the main paper, we have shown that it is flexible with different backbone feature extraction networks $F$. In addition, our FBNet could improve the performance of the recognition module with different classification networks $P$ through feedback connections. To show this, we change the prototypical network~\citep{snell2017prototypical} to the relation network~\citep{sung2018learning} and report the recognition result on the CUB~\citep{WelinderEtal2010} and CompCars~\citep{yang2015large} dataset in Table~\ref{tab:rn}. The experimental setting remains the same as that in the main paper. From the table, we can see that the whole feedback-based models consistently outperform the single recognition modules for the prototypical network and the relation network. This indicates that our proposed bowtie architecture is a general and robust framework that could improve the performance of different types of classification networks.
\begin{table}[t]
\centering
\resizebox{.6\linewidth}{!}{
\begin{tabular}{l|lccc}
\hline
& Model & Base & Novel-$K$=1 & Novel-$K$=5 \\ \hline
\multirow{4}{*}{\shortstack[l]{CUB}}
& PN~\citep{snell2017prototypical} & 57.91 & $47.53$ &$71.26$ \\
& FBNet-PN& {\bf 59.43} & $ 48.39$ & $\bf 72.76$ \\
& RN~\citep{sung2018learning} & 58.10 & $ 47.77$ &$70.94$ \\
& FBNet-RN& { 59.19} & $\bf 48.46$ & $ 72.60$ \\
\hline
\multirow{4}{*}{\shortstack[l]{CompCars}}
&PN~\citep{snell2017prototypical} & 46.05 & $20.83$ & $50.52$ \\
&FBNet-PN& {\bf 49.63} & $ 23.28$ & $
\bf 53.12$ \\
& RN~\citep{sung2018learning} & 45.89 & $22.14$ &$50.26$ \\
& FBNet-RN& {48.99} & $\bf 24.83$ & $52.72$ \\
\hline
\end{tabular}}
\caption{Top-1 (\%) recognition accuracy for recognition modules with PN (prototypical network) and RN (Relation Network), respectively, on the CUB and CompCars datasets. For base classes: {\bf 150-way} classification on CUB and {\bf 240-way} classification on CompCars; for $K$-shot novel classes: {\bf 50-way} classification on CUB and {\bf 120-way} classification on CompCars. The proposed FBNet consistently improves the performance of the single recognition modules for both PN and RN, indicating the generality of our framework.}
\label{tab:rn}
\end{table}
\begin{figure}[htbp]
\centering
\includegraphics[width = 0.95 \linewidth]{figures/sup-128.pdf}
\caption{Synthesized 128-resolution images by our FBNet on the CUB dataset.}
\label{fig:128}
\end{figure}
\section{Experiments with Higher-Resolution Images}
In the main paper, following the state-of-the-art novel-view synthesis model HoloGAN~\citep{nguyen2019hologan}, we mainly focused on images of size $64 \times 64$. Our FBNet can also operate on higher-resolutions, by adding more 2D ResBlocks for the view synthesis module, and adding more convolution layers for the recognition module. Here, we modify our model to operate on images of size $128 \times 128$ and show some representative generated images on the CUB dataset in Figure~\ref{fig:128}. We see that the proposed method effectively works with $128$-resolution. We also note that higher resolution requires higher-quality training data. The unsatisfactory size and quality of the CUB dataset introduce additional challenges for synthesis, such as missing of details, inconsistency of identity across different viewpoints, and noisy background. However, such problems could be further addressed by improving the quantity and quality of the training data.
\begin{figure}[t!]
\centering
\includegraphics[width = 0.85 \linewidth]{figures/feature.pdf}
\caption{FBNet with an extended attribute transfer task. `im1' is the source image corresponding with 3D AdaIN and `im2' is the attribute image corresponding with 2D AdaIN. Images in the same row/column have the same identity/attributes.}
\label{fig:feature}
\vspace{-3mm}
\end{figure}
\section{From Joint-Task to Triple-Task: Attribute Transfer}
The proposed bowtie framework could also be extended to address more than two tasks, by either introducing additional feedback connections or changing the architectures of the two modules. Here as an example, we introduce an additional ``attribute transfer'' task combined with the novel-view synthesis task. That is, instead of seeing one image each time, the view synthesis module sees one source image (`im1') and one target image (`im2') at the same time; then it generates images with the object of the source image and the attributes of the target image. We achieve this by arranging source latent input for 3D AdaIN units and target latent input for 2D AdaIN units in the view-synthesis module. Figure \ref{fig:feature} shows the result of this additional task: images in the same row keep the same identity with im1; images in the same column have the same attributes of im2. Note that, to have a better visualization, we use the predicted views from the source images as the view input for all the generated images in Figure \ref{fig:feature}, but the model could still synthesize images of different viewpoints.
| {'timestamp': '2021-04-08T02:02:23', 'yymm': '2008', 'arxiv_id': '2008.06981', 'language': 'en', 'url': 'https://arxiv.org/abs/2008.06981'} | arxiv |
\section{Introduction}
Automatic 3d human sensing from images and video would be a key, transformative enabler in areas as diverse as clothing virtual apparel try-on, fitness, personal well-being, health or rehabilitation, AR and VR for improved communication or collaboration, self-driving systems with emphasis to urban scenarios, special effects, human-computer interaction or gaming, among others. Applications in shopping, telepresence or fitness would increase human engagement and stimulate collaboration, communication, and the economy, during a lock-down.
The rapid progress in 3D human sensing has recently relied on volumetric statistical human body models \cite{SMPL2015,ghum2020} and supervised training. Most, if not all, state of the art architectures for predicting 2d, \emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot, body keypoints \cite{cao2017realtime} or 3d, \emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot, body joints, kinematic pose and shape \cite{dmhs_cvpr17,zanfir2018monocular,Kanazawa2018,kolotouros2019learning, sun2019human, doersch2019sim2real, humanMotionKanazawa19, kolotouros2019convolutional, arnab2019exploiting, xu2019denserac, kocabas2019vibe, varol18_bodynet, jackson20183d, pavlakos2017cvpr, yang20183d, zhou2017towards, rogez2016mocap, Fua17, mehta2017vnect,martinez17iccv, iskakov2019learnable} rely, \emph{ab initio}, at their learning core, on complete supervision. For 2d methods this primarily enters as keypoint or semantic segmentation annotations by humans, but for complex 3D articulated structures human annotation is both impractical and inaccurate. Hence for most methods, supervision comes in the form of synchronous 2d \emph{and} 3d ground truth, mostly available in motion capture datasets like Human3.6M \cite{Ionescu14pami} and more recently also 3DPW \cite{vonMarcard2018}.
Supervision-types aside, the other key ingredient of any successful system is the interplay between 3d initialization using neural networks and non-linear optimization (refinement) based on losses computed over image primitives like keypoints, silhouettes, or body part semantic segmentation maps. No existing feedforward system, particularly a \emph{monocular} one, achieves \emph{both} plausible 3d reconstruction \emph{and} veridical image alignment\footnote{To be understood in the classical model-based vision sense of best fitting the model predictions to implicitly or explicitly-associated image primitives (or landmarks), within modeling accuracy.} without non-linear optimization -- a key component whose effectiveness for 3d pose estimation has been long since demonstrated \cite{sminchisescu_ijrr03,sminchisescu_cvpr03}.
The challenge faced by applying non-linear optimization in high-dimensional problems like 3d human pose and shape estimation stems from its complexity. On one hand, first-order model state updates are relatively inefficient for very ill-conditioned problems like \emph{monocular} 3d human pose estimation where Hessian condition numbers in the $10^{-3}$ are typical \cite{sminchisescu_ijrr03}. Consequently, many iterations are usually necessary for good results, even when BFGS approximations are used. On the other hand, nonlinear output state optimization is difficult to integrate as part of parameter learning, since correct back-propagation would require potentially complex, computationally expensive second-order updates, for the associated layers. Such considerations have inspired some authors \cite{kolotouros2019learning} to replace an otherwise desirable integrated learning process, with a dual system approach, where multiple non-linear optimization stages, supplying potentially improved 3d output state targets, are interleaved with classical supervised learning based on synchronized 2d and 3d data obtained by imputation. Such intuitive ideas have been shown to be effective practically, but remain expensive in training, and lack not just an explicit, integrated cost function, but also a consistent learning procedure to guarantee progress, in principle. Moreover, applying the system symmetrically, during testing, would still require potentially expensive non-linear optimization for precise image alignment.
In this paper, we take a different approach and replace the non-linear gradient refinement stage at the end of a classical 3d predictive architecture with neural descent, in a model called HUND (Human Neural Descent). In HUND, recurrent neural network stages refine the state output (in this case the 3d human pose and shape of a statistical GHUM model \cite{ghum2020}) based on previous state estimates, loss values, and a context encoding of the input image, similarly in spirit to non-linear optimization. However, differently from models relying on gradient-based back-ends, HUND can be trained end-to-end using stochastic gradient descent, offers no asymmetry between training and testing, supports the possibility of potentially more complex, problem-dependent step updates compared to non-linear optimization, and is significantly faster. Moreover, by using such an architecture, symmetric in training and testing, with capability of refinement and self-consistency, we show, for the first time, that a 3d human pose and shape estimation system trained from monocular images can entirely bootstrap itself. The system would thus no longer necessarily require, the completely synchronous supervision, in the form of images and corresponding 3d ground truth configurations that has been previously unavoidable. Experiments in several datasets, ablation studies, and qualitative results in challenging imagery support and illustrate the main claims.
\noindent{\bf Related Work:} There is considerable prior work in 3d human modeling \cite{SMPL2015,ghum2020,dmhs_cvpr17,zanfir2018monocular,Rhodin_2018_ECCV,Kanazawa2018,kolotouros2019learning,ExPose:2020}, as well as the associated learning and optimization techniques \cite{sminchisescu_ijrr03,bogo2016}.
Systems combining either random 3d initialization or prediction from neural networks with non-linear optimization using losses expressed in terms of alignment to keypoints and body semantic segmentation masks exist \cite{bogo2016,zanfir2018monocular,kolotouros2019learning}. Black-box optimization has gained more interest in recent years \cite{andrychowicz2016learning, chen2017learning}, usually deployed in the context of meta-learning \cite{hospedales2020metalearning}. Our work is inspired in part by that of \cite{chen2017learning,hospedales2020metalearning} in which the authors introduce recurrent mechanisms to solve optimization problems, albeit in a different domain and for other representations than the ones considered in this work.
\cite{omran2018nbf} uses a neural network to directly regress the pose and shape parameters of a 3d body model from predicted body semantic segmentation. The network is trained in a mixed supervision regime, with either full supervision for the body model parameters or a weak supervision based on a 2d reprojection loss.
\cite{xiong2013supervised} propose to learn a series of linear regressors over SIFT \cite{lowe2004distinctive} features that produce descent directions analogous to an optimization algorithm for face alignment. Training is fully supervised based on 2d landmarks.
Similarly, \cite{trigeorgis2016mnemonic} learn a recurrent network, that given an input image of a face, iteratively refines face landmark predictions. The network is trained fully supervised and operates only in the 2d domain.
In \cite{tian2019regressing}, a cascade of linear regressors are learned to refine the 3d parameters of a 3d face model. Training is done over the entire dataset at a time (multiple persons with multiple associated face images) on synthetic data, in a simulated, mixed supervision regime.
\begin{figure*}[!ht]
\begin{center}
\includegraphics[width=0.6\linewidth]{Figures/pipeline-nd7.png}
\end{center}
\caption{\small Overview of our Human Neural Descent ({\bf HUND}) architecture for learning to estimate the state $\mathbf{s}$ of a generative human model GHUM (including shape $\boldsymbol{\beta}$ and pose $\boldsymbol{\theta}$, as well as person's global rotation $\mathbf{r}$ and translation $\mathbf{t}$) from monocular images. Given an input image, a first CNN extracts semantic feature maps for body keypoints ($\mathbf{K}$) and part segmentation ($\mathbf{B}$), as well as other features ($\bm F$). These, in turn feed, into a second stage CNN that learns to compute a global context code $\mathbf{s}^c$ as well as an initial estimate of the model state $\mathbf{s}_0$. These estimates (and at later stages similar ones obtained recursively), together with the value of a semantic alignment loss $L_u$, expressed in terms of keypoint correspondences and differentiable rendering measures between model predictions and associated image structures, are fed into multiple refining RNN layers, with shared parameters $\boldsymbol{\delta}$, and internal memory (hidden state) $\mathbf{m}$. The alignment losses (which can be unsupervised, weakly-supervised or self-supervised, depending on available data) at multiple recurrent stages $M$ are aggregated into a learning loss $L_l$, optimized as part of the learning-to-learn process. The parameters are obtained using stochastic gradient descent, as typical in deep learning. The model produces refined state estimates $\mathbf{s}$ with precise image alignment, but does not require additional gradient calculations for the recurrent stages neither in training (\emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot, second-order parameter updates), nor during testing (first-order state updates). It is also extremely efficient computationally compared to models relying on nonlinear state optimization at test time.}
\label{fig:pipeline}
\end{figure*}
\begin{figure*}[!htbp]
\begin{center}
\includegraphics[width=0.9\linewidth]{Figures/figure_fullgp.png}
\end{center}
\vspace{-10mm}
\caption{\small Our complete full body 3d sensing HUND network combines a feed-forward architecture to detect landmarks and semantically segment body parts with an attention mechanism that further processes the face, hands and the rest of the body as separate HUND predictive networks, with results fused in order to obtain the final, full body estimate. See fig.\ref{fig:pipeline} for the architecture of an individual HUND network.
}
\label{fig:hund-fullgp}
\end{figure*}
\section{Methodology}\label{sec:methodology}
We describe the elements of the proposed methodology, including the statistical 3D human body model GHUM, as well as the associated learning and reconstruction architecture used. We also cover the fusion of multiple architectures in order to obtain accurate estimates for the full body including hand gestures and facial expressions.
\subsection{Statistical 3D Human Body Model GHUM}
We use a recently introduced statistical 3d human body model called GHUM \cite{ghum2020}, to represent the pose and the shape of the human body. The model has been trained end-to-end, in a deep learning framework, using a large corpus of over 60,000 diverse human shapes, and $540,000$ human motions, consisting of 390,000 samples from CMU and 150,000 samples from Human3.6M (subjects S1, S5, S6, S7, S8).
The model has generative body shape and facial expressions $\bm{\beta} = \left( \boldsymbol{\beta_{b}, \bm{\beta}_{f}} \right) $ represented using deep variational auto-encoders and generative pose $\bm{\theta} = \left( \boldsymbol{ \theta_{b}, \theta_{lh}, \theta_{rh}} \right)$ for the body, left and right hands respectively represented using normalizing flows \cite{zanfir2020weakly}. We assume a separable prior on the model pose and shape state $p(\bm{\theta}, \bm{\beta})=p(\bm{\theta}) + p(\bm{\beta})$ where Gaussian components with $\mathbf{0}$ mean and unit $\mathbf{I}$ covariance, as typical in variational encoder and normalizing flow models.
Given a monocular RGB image as input, our objective is to infer the pose $\bm{\theta} \in \mathbb{R}^{N_{p}\times1}$ and shape $\bm{\beta} \in \mathbb{R}^{N_{s}\times1}$ state variables, where $N_{p}$ is the number of posing variables and $N_{s}$ is the length of the shape code, respectively. A posed mesh $\mathbf{M}(\bm{\theta}, \bm{\beta})$ has $N_{v}$ associated 3d vertices $\mathbf{V}=\{\mathbf{v}_{i}, i=1\ldots N_v\}$ with fixed topology given by the GHUM template. Because the rigid transformation of the model in camera space -- represented by a 6d rotation \cite{zhou2018continuity} $\mathbf{r}\in\mathbb{R}^{6\times1}$ and a translation vector $\mathbf{t}\in\mathbb{R}^{3\times1}$ -- are important and require special handling, we will write them explicitly. The posed mesh thus writes $\mathbf{M}(\bm{\theta}, \bm{\beta}, \mathbf{r}, \mathbf{t})$.
\paragraph{Camera model.} We assume a pinhole camera with intrinsics $C = [f_x, f_y, c_x, c_y]^\top$ and associated perspective projection operator $\mathbf{x}_{2d} = \Pi(\mathbf{x}_{3d}, C)$, where $\mathbf{x}_{3d}$ is any 3d point. During training and testing, intrinsics \textit{for the full input image} are approximated, $f_x=\max(H, W), f_y=\max(H, W), c_x=W / 2, c_y=H / 2$, where $H, W$ are the input dimensions. Our method works with cropped bounding-boxes of humans, re-scaled to a fixed size
of $480\times480$,
therefore we need to warp the image intrinsics $C$ into the corresponding crop intrinsics $C_c$
\begin{align}
[C_c^\top 1]^\top = K [C^\top 1]^\top,
\end{align}
where $K \in \mathbb{R}^{5\times 5}$ is the scale and translation matrix, adapting the image intrinsics $C$. By using cropped intrinsics, we effectively solve for the state of the 3d model (including global scene translation) in the camera space of the input image. For multiple detections in the same image, the resulting 3d meshes are estimated relative to a common world coordinate system, into the \textit{same 3d scene}. At test time, when switching $C_c$ with $C$, the 3d model projection will also align with the corresponding person layout in the initial image.
\subsection{Learning Architecture}\label{sec:learn-arch}
The network takes as input a cropped human detection and resizes it to $480\times480$. A multi-stage sub-network produces features $\bm F \in \mathbb{R}^{60\times60\times256}$, keypoint detection heatmaps $\mathbf{K} \in \mathbb{R}^{60\times60\times137}$ and body-part segmentation maps $\mathbf{B} \in \mathbb{R}^{60\times60\times15}$. These are embedded into a low-dimensional space, producing a code vector $\mathbf{s}^c$ -- the superscript $c$ stands for context, \emph{i.e}\onedot} \def\Ie{\emph{I.e}\onedot\ the optimization’s objective function context. We also append the cropped camera intrinsics $C_c$ to this context vector. At training time, a estimate $\mathbf{s}_0$ of the initial GHUM state $\mathbf{s} = [\bm{\theta}^\top, \bm{\beta}^\top, \mathbf{r}^\top, \mathbf{t}^\top]^\top$ is also produced.
To simulate model refinement\footnote{HMR\cite{Kanazawa2018} uses several recursive output layers on top of a CNN prediction. However HMR does not use a formal RNN to recursively refine outputs based on a memory structure encompassing the previous estimates, the image reprojection (keypoint and semantic) error and the image feature code, as we do, which is the equivalent of a complete non-linear optimization context. Nor do we use a discriminator for pose as HMR, but instead rely on the kinematic normalizing flow prior of GHUM. Hence our approach is methodologically very different. See
\S\ref{sec:exps} for quantitative evaluation. }, we employ a Recurrent Neural Network module $\mathbf{RNN}_{\boldsymbol{\delta}}(\mathbf{s}^c, \mathbf{s}_i, \mathbf{m}_i)$, where $\mathbf{m}_i$ is the memory (hidden state) at refinement stage $i$, and unroll the updates into $M$ stages (see fig.\ref{fig:pipeline})
\begin{equation}
\begin{bmatrix}
\mathbf{s}_i\\
\mathbf{m}_i
\end{bmatrix} = \mathbf{RNN}_{\boldsymbol{\delta}}(\mathbf{s}_{i-1}, \mathbf{m}_{i-1}, L_u^{i-1}, \mathbf{s}^c).
\end{equation}
The loss at each stage $i$ is computed based on the labeling available at training time in the form of either 2d or 3d annotations. When both are missing, we are training with \textit{self-supervision}. The self-supervised loss at each unit processing stage $i$ can be expressed as
\begin{align}\label{eq:ss-losses}
L^i_{u}(\mathbf{s}, \mathbf{K}, \mathbf{B}) = \lambda_k L_{k}(\mathbf{s}_i, \mathbf{K}) + \lambda_b L_{b}(\mathbf{s}_i, \mathbf{B}) + l(\bm{\theta}_i, \bm{\beta}_i),
\end{align}
where $l=-\log(p)$, $L_k$ is a 2d keypoint alignment loss, $L_b$ is a 2d semantic body part alignment (defined in terms of differentiable rendering), and $M$ is the total number of \textit{training} LSTM stages, while $\lambda_{k}$ and $\lambda_{b}$ are cross-validated scalar values which balance the loss terms.
The \textbf{keypoint alignment loss}, $L_k$, measures the reprojection error of the GHUM's model 3d joints w.r.t. the predicted 2d keypoints. The loss is defined as the 2d mean-per-joint position error (MPJPE)
\begin{align}
L_{k}(\mathbf{s}_t, \mathbf{K}) = \frac{1}{N_j} \sum_i^{N_j} \|\mathbf{j}_{i}(\mathbf{K}) - \Pi(\mathbf{J}_i(\mathbf{s}_t), C_c)\|_2.
\end{align}
with $N_j$ keypoints, $\mathbf{j}_{i}(\mathbf{K})$ is the 2d location of the $i$-th 2d keypoint extracted from the the $\mathbf{K}$ heatmap, and $\mathbf{J}_i(\mathbf{s}_t)$ is the $i$-th 3d keypoint computed by posing the GHUM model at $\mathbf{s}_t$.
The \textbf{body-part alignment loss}, $L_{b}$, uses the current prediction $\mathbf{s}_t$ to create a body-part semantic segmentation image $I(\mathbf{M}(\mathbf{s}_t), C_c)\in\mathbb{R}^{H\times W \times 15}$. Then we follow a soft differentiable rasterization process\cite{liu2019soft} to fuse probabilistic contributions of all predicted mesh triangles of the model, at its current state, with respect to the rendered pixels. In this way, gradients can flow to the occluded and far-range vertices.
To be able to aggregate occlusion states and semantic information, we append to each mesh vertex its semantic label, as a one-hot vector $\{0,1\}^{15\times 1}$, and a constant alpha value of $1$. The target body part semantic probability maps $\mathbf{B}$ are also appended with a visibility value, equal to the foreground probability $\in [0,1]^{H\times W \times 1}$. The loss is the mean-per-pixel absolute value of the difference between the estimated and predicted semantic segmentation maps
\begin{align}
L_{b}(\mathbf{s}_t, \mathbf{B}) = \frac{1}{HW} \sum_i^{HW} \|\mathbf{B}_i - I(\mathbf{M}(\mathbf{s}_t), C_c)_i\|_1.
\end{align}
For \textbf{body shape and pose}, we include two regularizers, proportional to the negative log-likelihood of their associated Gaussian distributions
\begin{align}
l(\bm{\theta})=-\log p(\bm{\theta}) = \|\bm{\theta}\|_2^2, \;\; l(\bm{\beta})=-\log p(\bm{\beta}) = \|\bm{\beta}\|_2^2.
\end{align}
When \textit{3d supervision} is available, we use the following unit training loss $L^{i}_{f}$, as well as, potentially, the other ones previously introduced
in \eqref{eq:ss-losses}
for the self-supervised regime
\begin{align}
\begin{split}
L^{i}_{f}(\mathbf{s}) = \lambda_{m} L_{m}(\mathbf{M}(\mathbf{s}_i), \widetilde{\mathbf{M}}) &+ \lambda_{3d} L_{3d}(\mathbf{J}(\mathbf{s}_i), \widetilde{\mathbf{J}})
\notag,
\end{split}
\end{align}
where $L_m$ represents the 3d vertex error between the ground-truth mesh $\widetilde{\mathbf{M}}$ and a predicted one, $\mathbf{M}(\mathbf{s}_i)$-- obtained by posing the GHUM model using the predicted state $\mathbf{s}_i$; $L_{3d}$ is the 3d MPJPE between the 3d joints recovered from the predicted GHUM parameters, $\mathbf{J}(\mathbf{s}_i)$, and the ground-truth 3d joints, $\widetilde{\mathbf{J}}$; $\lambda_{m}$ and $\lambda_{3d}$ are scalar values that balance the two terms.\\
For learning, we consider different losses $L_l$, including `sum', `last', `min' or `max', as follows
\begin{align}\label{eq:meta-losses}
L_u^{\Sigma}(\mathbf{s},\mathbf{K}, \mathbf{B})=\sum_{i=1}^{M} L_u^i(\mathbf{s}_i,\mathbf{K}, \mathbf{B}) \nonumber\\
L^{\rightarrow}_{u}(\mathbf{s}, \mathbf{K}, \mathbf{B}) = L_u^M(\mathbf{s}_M,\mathbf{K}, \mathbf{B})\nonumber\\
L_{u}^{\min}(\mathbf{s}, \mathbf{K}, \mathbf{B}) = \min_{i=1}^{M} L_u^i(\mathbf{s}_i,\mathbf{K}, \mathbf{B}) \nonumber\\
L_{u}^{\max}(\mathbf{s}, \mathbf{K}, \mathbf{B}) = \max_{i=1}^{M} L_u^i(\mathbf{s}_i,\mathbf{K}, \mathbf{B})
\end{align}
We also consider an \textit{observable improvement} (OI) loss for $L_l$ \cite{hospedales2020metalearning}
\begin{align}\label{ml-oi}
L_{u}^{oi} = \sum_{i=1}^{M} \min\{L_u^i - \min_{j<i}L_u^j, 0\}.
\end{align}
\noindent{\bf Multiple HUND networks for Body Pose, Shape, and Facial Expressions.} Capturing the main body pose but also hand gestures and facial expressions using a single network is challenging due to the very different scales of each region statistics. To improve robustness and flexibility we rely on 4 part networks, one specialized for facial expressions, two for the hands, and one for the rest of the body. Based on an initial person keypoint detection and semantic segmentation, we drive attention to face and hand regions as identified by landmarks and semantic maps, in order to process those features in more detail. This results in multiple HUND networks being trained, with estimates for the full body shape and pose fused in a subsequent step from parts (fig. \ref{fig:hund-fullgp}).
\section{Experiments}\label{sec:exps}
\noindent{\bf View of Experimental Protocols.} There is large variety of models and methods now available for 3d human sensing research, including body models like SMPL \cite{SMPL2015} and GHUM \cite{ghum2020}, or reconstruction methods like DMHS \cite{dmhs_cvpr17}, HMR \cite{Kanazawa2018}, SPIN \cite{kolotouros2019learning} \emph{etc}\onedot} \def\vs{\emph{vs}\onedot, set aside methods that combine random initialization or neural network prediction and non-linear refinement\cite{bogo2016,zanfir17}. To make things even more complex, some models are pre-trained on different 2d or 3d datasets and refined on others. A considerable part of this development has a historical trace, with models built on top of each-other and inheriting their structure and training sets, as available at different moments in time.
Set that aside, multiple protocols are used for testing. For Human3.6M \cite{Ionescu14pami} only, there are at least 4: the ones originally proposed by the dataset creators, on the withheld test set of Human3.6M (or the representative subset Human80K \cite{Ionescu14}) as well as others, created by various authors, known as protocol 1 and 2 by re-partitioning the original training and validation sets for which ground truth is available. Out of these 2, only protocol 1 is sufficiently solid in the sense of providing a reasonably large and diverse test set for stable statistics (\emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot, 110,000 images from different views in P1 vs. 13,700 in P2, from the same camera, at the same training set size of 312,000 configurations for both). Hence we use P1 for ablations and the official Human3.6M test set for more relevant comparisons. For some of the competing methods, e.g. SPIN\cite{kolotouros2019learning}, HMR\cite{Kanazawa2018} we ran the code from the released github repositories ourselves on the Human3.6M test set since numbers were not reported in the original publications. Results are presented in table \ref{tbl:H36MOfficial}. We will also use 3DPW \cite{vonMarcard2018} for similar reasons, or rather, in the absence of other options in the wild (30,150 training and 33,000 testing configurations). Testing all other model combinations would be both impractical and irrelevant, especially for new models like GHUM where most prior combinations are unavailable and impossible to replicate. As a matter of principle, 3D reconstruction models can be evaluated based on the amount of supervision received, be it 2d (for training landmark detectors {\bf \#2d det} or, additionally, for direct 3d learning {\bf \#2d}), {\bf \# 3d}, or synchronized {\bf \#2d-3d} annotations, the number of images used for self-supervision \#I, as well as perhaps number of parameters and run-time. In addition, ablations for each model, \emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot, {\bf HUND}, would offer insights into different components and their relevance. We argue in support of this being one scientifically sound way of promoting diversity in the creation of new models and methods, rather than closing towards premature methodological convergence, weakly supported by unsustainable, ad-hoc, experimental combinatorics.
\begin{table*}[!htbp]
\small
\centering
\begin{tabular}[t]{|l||r|r||r||r||r|r|r|r|}
\hline
\textbf{Method} & {MPJPE-PA} & {MPJPE} & {MPJPE Trans} & {\#2d det} & {\#2d} & {\#3d} & {\#2d-3d}&{\#I}\\
\hline
\hline
\textbf{HMR (FS+WS) \cite{Kanazawa2018}} & $58.1$ & $88.0$& NR &129k & $111$k &$720$k &$300$k &$0$\\
\hline
\textbf{SPIN (FS+WS)} \cite{kolotouros2019learning} & NR & NR&NR&129k &$111$k & $720$k$/390$k & $300$k & $0$ \\
\hline
\textbf{HUND (FS+SS)} & $\mathbf{52.6}$ & $\mathbf{69.45}$& $152.6$ &80k&$0$ &$540$k & $150$k & $54$k\\
\hline
\hline
\textbf{HMR (WS) \cite{Kanazawa2018}} & $67.45$ & $106.84$&NR& 129k & 111k &$720$k &$0$ &$0$\\
\hline
\textbf{HUND (SS)} & $\mathbf{66.0}$ & $\mathbf{91.8}$&$159.3$&80k &$0$ &$540$k &$0$ &$54$k\\
\hline
\end{tabular}
\caption{\small Performance of different pose and shape estimation methods on the H3.6M dataset, with training/testing based on the representative protocol P1 (for self-supervised variants this only indicates the images used in testing). MPJPE-PA and MPJPE are expressed in mm. We also report the global translation of the body as this is supported by our fully perspective camera model (N.B. this is not supported by other methods which use an orthographic perspective model). We also compare different annotations used in the construction of different models, with a split into 2d (further differentiated into {\bf \#2d\,det} for training the joint landmarks and {\bf \#2d} for training the 3d learning algorithm), 3d and synchronized 2d-3d. The last column gives the number of images for self-supervised variants, \emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot, HUND(SS), which do not use either 2d image keypoints or synchronized images and 3d mocap during training.}
\label{tbl:H36MP1}
\end{table*}
\begin{table}[!htbp]
\small
\centering
\begin{tabular}[t]{|l||r|r||r||r||r|r|r|r|}
\hline
\textbf{Method} & {MPJPE}\\
\hline
\hline
\textbf{HMR (FS+WS) \cite{Kanazawa2018}} & $89$\\
\hline
\textbf{SPIN (FS+WS)} \cite{kolotouros2019learning} & $68$ \\
\hline
\textbf{HUND (FS+SS)} & $\mathbf{66}$ \\
\hline
\end{tabular}
\caption{\small Results of different methods on the H3.6M official held-out test set. We achieve better results on a large test set of 900k images.}
\label{tbl:H36MOfficial}
\end{table}
\begin{table}[!htbp]
\small
\centering
\begin{tabular}[t]{|l||r|r|}
\hline
\textbf{Method} & {MPJPE-PA (mm)} & {MPJPE (mm)} \\
\hline
\hline
\textbf{HMR (FS+WS) \cite{Kanazawa2018}} & $81.3$ & $130.0$ \\
\hline
\textbf{SPIN (FS+WS)\cite{kolotouros2019learning}} & $59.2$ & $96.9$ \\
\hline
\textbf{ExPose (FS+WS)\cite{ExPose:2020}} & $60.7$ & $93.4$ \\
\hline
\hline
\textbf{HUND (SS)} & $63.5$ & $90.4$ \\
\hline
\textbf{HUND (FS+SS)} & $\mathbf{57.5}$ & $\mathbf{81.4}$\\
\hline
\end{tabular}
\caption{\small Results on the 3DPW test set for different methods. Notice that a self-supervised version of HUND produces lower errors compared to the best supervised HMR implementation that includes not just synchronized $2d-3d$ training sets but also images with 2d annotation ground truth. A HUND model that includes asynchronous 2d-3d supervision, in addition to just unlabeled images, achieves the lowest error, and uses less training data than any other competitive method -- see also table \ref{tbl:H36MP1}.}
\label{tbl:3DPW}
\end{table}
For our \textbf{self-supervised (SS)} experiments, we employ two datasets containing images in-the-wild, COCO2017 \cite{lin2014microsoft} (30,000 images) and OpenImages \cite{OpenImages} (24,000), with no annotations in training and testing. We refer to \textbf{weakly-supervised (WS)} experiments as those where ground truth annotations are available, \emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot\ human body keypoints. We do not rely on these but some other techniques including HMR and SPIN do, hence we make this distinction in order to correctly reflect their supervision level.
For \textbf{fully supervised (FS)} experiments, we employ H3.6M and 3DPW. Because we work with the newly released GHUM model, we retarget the mocap raw marker data from H3.6M to obtain accurate 3d mesh supervision for our model \cite{ghum2020}. Because the ground-truth of 3DPW is provided as SMPL 3d meshes, we fit the GHUM model by using an objective function minimizing vertex-to-vertex distances between the two corresponding meshes.
\noindent{\bf Architecture Implementation.} To predict single-person keypoints and body part segmentation, we train a multi-task network with ResNet50 \cite{he2016identity} backbone (the first CNN in our pipeline, see fig.\ref{fig:pipeline} and fig.\ref{fig:hund-fullgp})\cite{dmhs_cvpr17}.
We have $137$ 2d keypoints as in \cite{cao2019openpose} and $15$ body part labels, as in \cite{Guler2018DensePose}. This network has $34$M trainable parameters.
The self-supervised training protocol for \textbf{HUND} assumes only images are available and we predict 2d body keypoints and body part labels during training, in addition to body shape and pose regularizers. For the embedding model (the second CNN in the pipeline) predicting $\mathbf{s}^c$, we use a series of $6$ convolutional layers with pooling, followed by a fully connected layer. We use $M = 5$ LSTM \cite{hochreiter1997long} stages as RNNs for \textbf{HUND} and we set the number of units to $256$, which translates to $525$k parameters. In total there are $950$k trainable parameters for the 3D reconstruction model. We train with a batch size of $32$ and a learning rate of $10^{-4}$ for $50$ epochs. For experiments where we train HUND using {\bf FS+SS}, we use a mixed schedule, alternating between self-supervised and fully-supervised batches. Training takes about 72 hours on a single Nvidia Tesla P100 GPU. The runtime of our prediction network for a single image is $0.035$s and $0.02$s for \textbf{HUND}, on an Nvidia RTX 2080 GPU.
\noindent{\bf Evaluation and discussion.} Multiple experiments are run for different regimes. Quantitative results are presented in tables \ref{tbl:H36MP1}, \ref{tbl:H36MOfficial} and \ref{tbl:3DPW} for Human3.6M and 3DPW respectively.
\begin{figure*}[!htbp]
\vspace{-4mm}
\begin{center}
\includegraphics[width=0.4\linewidth]{Figures/lossvalue.png}~~
\includegraphics[width=0.4\linewidth]{Figures/running_time_single.png}
\end{center}
\vspace{-3mm}
\caption{Behavior of different optimization methods including standard non-linear gradient-based BFGS, HUND(5), as well as variants of HUND$(i), i \leq 5$, initializing BFGS, in order to assess progress and the quality of solutions obtained along the way (left). Corresponding cumulative run-times are shown on the right. Observe that HUND produces a good quality solution orders of magnitude faster than gradient descent (note log-scales on both plots). End refinement using gradient descent improves results, although we do not recommend a hybrid approach--- here we only show different hybrids for insight. This shows one optimization trace for a model initialized in A-pose and estimated given one image from Human3.6M, but such behavior is typical of aggregates, see \emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot, fig. \ref{fig:averaged_optimization_and_runtime}. See also fig. \ref{fig:hund-optim-visuals} for visual illustrations of different configurations sampled by HUND during optimization.}
\label{fig:single_image_optimization_and_runtime}
\end{figure*}
A detailed analysis of optimization behavior for one image is given in fig. \ref{fig:single_image_optimization_and_runtime} as well as, in aggregate, in fig. \ref{fig:averaged_optimization_and_runtime}. Visual reconstructions at different HUND optimization stages, for several images, are given in fig. \ref{fig:hund-optim-visuals}.
\begin{figure*}[!htbp]
\vspace{-4mm}
\begin{center}
\includegraphics[width=0.4\linewidth]{Figures/rotmatvalue.png}~~
\includegraphics[width=0.4\linewidth]{Figures/running_time_averaged.png}
\end{center}
\vspace{-3mm}
\caption{\small Optimization statistics for different methods, aggregated over 100 different poses (estimation runs) from Human3.6M. We initialize in an A-pose and perform monocular 3d pose and shape reconstruction for GHUM under a HUND (FS+SS) model, as well as non-linear optimization baselines. On the left we show per-joint angle averages w.r.t. ground truth. On the right we show running times in aggregate for different types of optimization. One can see that BFGS descent under a keypoint+prior loss tends to be prone to inferior local optima compared to different HUND hybrids, which on average find significantly better solutions. The plot needs to be interpreted in proper context, as aggregates meant to show distance and run-time statistics per iteration. Hence, they may not be entirely representative of any single run, but for a singleton see \emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot, fig. \ref{fig:single_image_optimization_and_runtime}.
}
\label{fig:averaged_optimization_and_runtime}
\end{figure*}
\begin{table}[!htbp]
\small
\centering
\begin{tabular}[t]{|l||r|r|}
\hline
\textbf{Loss} & {MPJPE-PA (mm)} & {MPJPE (mm)}\\
\hline
\hline
$L_f^\rightarrow$ & $\mathbf{58.50}$ & $\mathbf{80.16}$\\
\hline
$L_f^{\Sigma}$ & $59.91$ & $83.26$ \\
\hline
$L_f^{\min}$ & $78.61$ & $122.60$\\
\hline
$L_f^{oi}$\ & $79.35$ & $123.90$\\
\hline
$L_f^{\max}$ & $83.80$ & $128.0$\\
\hline
\end{tabular}
\caption{\small Impact assessment of different meta-losses used in HUND (FS), trained on the Human3.6M dataset, following protocol 1. The last and sum losses perform similarly well, with others following at a distance.}
\label{tbl:losses_ablation}
\end{table}
We also study the impact of different meta-learning losses, as given in \eqref{eq:meta-losses} and \eqref{ml-oi}, on the quality of results of HUND. We use a HUND (FS) model trained and evaluated on Human3.6M (protocol 1). From table \ref{tbl:losses_ablation} we observe that the last ($L_f^\rightarrow$) and sum ($L_f^{\Sigma}$) losses perform best, whereas others produce considerably less competitive results, by some margin, for this problem.
Finally, we show qualitative visual 3d reconstruction results, from several viewpoints, for a variety of difficult poses and backgrounds in fig. \ref{fig:visuals1}. \emph{Please see our Sup. Mat. for videos!}
\begin{figure*}[!htbp]
\begin{center}
\includegraphics[width=0.95\linewidth]{Figures/visual_examples.jpeg}
\end{center}
\vspace{-4mm}
\caption{\small Visual 3d reconstruction results obtained by {\bf HUND}. Given initial 2d predictions for body, face and hand keypoints, and initial predictions for semantic body part labelling, the neural descent network predicts the 3d GHUM pose and shape parameters. Best seen in color. For other examples and videos see our Sup. Mat.
}
\label{fig:visuals1}
\end{figure*}
\begin{figure*}[!htbp]
\begin{center}
\includegraphics[width=0.95\linewidth]{Figures/sideviews.jpeg}
\end{center}
\vspace{-4mm}
\caption{\small Visual 3d pose and shape configurations of GHUM sampled by {\bf HUND} during optimization. First column shows the input image, columns 2-6 illustrate GHUM estimates at each HUND stage. Columns 7 and 8 show visualizations of the GHUM state from different viewpoints, after HUND terminates. Columns 9, 10 and 11 show close up views for the reconstructed face expressions, left and right hands.
}
\label{fig:hund-optim-visuals}
\end{figure*}
\noindent{\bf Ethical Considerations.} Our methodology aims to decrease bias by introducing flexible forms of self-supervision which would allow, in principle, for system bootstrapping and adaptation to new domains and fair, diverse subject distributions, for which labeled data may be difficult or impossible to collect upfront. Applications like visual surveillance and person identification would not be effectively supported currently, given that model's output does not provide sufficient detail for these purposes. This is equally true of the creation of potentially adversely-impacting deepfakes, as we do not include an appearance model or a joint audio-visual model.
\section{Conclusions}
We have presented a neural model, {\bf HUND}, to reconstruct the 3d pose and shape of people, including hand gestures and facial expressions, from image data. In doing so, we rely on an expressive full body statistical 3d human model, GHUM, to capture typical human shape and motion regularities. Even so, accurate reconstruction and continuous learning are challenging because large-scale diverse 3d supervision is difficult to acquire for people, and because the most efficient inference is typically based on non-linear image fitting. This is however difficult to correctly `supra'-differentiate, to second order, in training and expensive in testing. To address such challenges, we rely on self-supervision based on differentiable rendering within \emph{learning-to-learn} approaches based on recurrent networks, which avoid expensive gradient descent in testing, yet provide a surrogate for robust loss minimization.
{\bf HUND} is tested and achieves very competitive results for datasets like H3.6M and 3DPW, as well as for complex poses, collected in challenging outdoor conditions. HUND's learning-to-learn and optimize capabilities, and symmetry between training and testing, can make it the first architecture to demonstrate the possibility of bootstraping a plausible 3d human reconstruction model without initial, synchronous (2d, 3d) supervision.
\clearpage
\balance
{\small
\bibliographystyle{ieee_fullname}
| {'timestamp': '2021-06-15T02:33:48', 'yymm': '2008', 'arxiv_id': '2008.06910', 'language': 'en', 'url': 'https://arxiv.org/abs/2008.06910'} | arxiv |
\section{Introduction}
A neurological disorder\cite{Yolcu2019} is a term given to certain abnormalities generated due to the malfunctioning of the human body's nervous system. The human body's nervous system essentially consists of the brain, the nerves, and the spinal cords. The nerves are responsible for connecting the brain and the spinal cord and mutually connecting these to the various parts of the body. It controls and coordinates even different bodily voluntary and involuntary actions. The nervous system is quite sophisticated and has an excellent system of information transfer. Therefore, any fault or disorder in this system can cause trouble in performing even simple movements such as writing, walking, and eating correctly. These troubles lead to various visual abnormalities, which can be recorded in videos \cite{10.1007/978-3-319-46478-7_12} and analyzed. We choose to analyze gait (a person's manner of walking) to detect these abnormalities and, thus, potentially even the neurological disorder. Considering this as a video analytics problem, we can employ different computer vision and machine learning algorithms to build a computer-assisted diagnosis system. Given a video of the subject's gait \cite{zhang2013score,gianaria2013gait,dao2015kinect,khan2019generic}, our primary goal is to be able to detect different gait abnormalities related to neurological disorders.
\begin{figure}
\begin{center}
\includegraphics[width=1\linewidth]{images/gait_abnormalities.pdf}
\end{center}
\vspace{-4mm}
\caption{Gait Abnormalities }\label{fig:ga}
\end{figure}
In some of the neurological disorders, gait-related abnormalities are excellent visible symptoms to detect those disorders. Even doctors consider such visible symptoms as a basis for their diagnosis to identify the root cause of the problem. This research attempts to expedite the diagnosis process by automating this step with computer vision and machine learning algorithms. It is not only for saving time (or faster diagnosis) but also because it is much cheaper than the existing electronic instruments based diagnosis. Also, special assistance could be given to such people at public places and events by automatically identifying them. Parkinson's disease can be identified by what is known as parkinsonian gait \cite{nandy2019statistical}, where a person bends forward and walks very slowly. Similarly, Hemiplegia can be identified by hemiplegic gait, characterized by leg's circumduction (conical movement). In Diplegia, the gait is known as diplegic gait, which involves circumduction (conical movement) of both the legs. Lastly, Huntington's Chorea is characterized by its choreaform gait that involves completely involuntary and unbalanced walking. Sample cropped frames of a demo of all these abnormal gaits are given in Fig.~\ref{fig:ga}. These observations could be modeled into video-based predictors (features) using state-of-the-art pose-estimation algorithms (of computer vision). These features can subsequently be employed for detecting the gait abnormalities through machine learning algorithms.
That said, there are quite a few challenges involved. First, there are no publicly available gait video datasets for neurological disorders. Second, there are no readily available video features to quantify the gait observations discussed above. A thorough search of the relevant literature yielded that almost little to no work was done to detect neurological disorders based on the gait videos. There are works with the same goal but using motion sensor data, a time-consuming, expensive, and sophisticated approach. The sensor-data based approach is not pragmatic because we aim to potentially detect such disorders even outside hospitals, for public assistance. The predictors designed should be robust enough so that they do not depend on irregularities such as video-duration, background variation \cite{jerripothula2015qcce}, foreground variations ~\cite{anusha2020clothing,jerripothula2018quality,7025663}, and lighting conditions.
We address the above-described challenges in the following manner:
We create a dataset named \emph{NeuroSynGait} dataset, which is a synthetic dataset of videos\cite{jerripothula2018efficient} of normal human beings mimicking the four gait abnormalities discussed and demonstrating their normal gait. Besides, we develop six gait based features, namely, limb straightness, hand-leg co-ordination, upper-body straightness, body straightness, central distances, and mutual distances, for a frame. These features are summarized over the video using statistics like mean and variance for developing a video-level feature. We use landmarks (key-points) of the human pose for developing these features. The pose is estimated using AlphaPose \cite{fang2017rmpe, li2018crowdpose, xiu2018poseflow} technique, which already accounts for challenges posed by the background, foreground variations, lighting conditions, etc.
The derived video-level features are used to build classification models (using machine learning algorithms) to detect a gait abnormality, and possibly the related neurological disorder.
The contributions made through this research are as follows: (i) A benchmark dataset named NeuroSynGait video dataset for detecting gait abnormalities has been proposed. (ii) Six gait features have been developed while focusing on the gait abnormalities caused by four different neurological disorders, namely Parkinson's disease, Diplegia, Hemiplegia, and Huntington's Chorea. (iii) We successfully build machine learning models to detect these gait abnormalities.
\section{Related Works}
Early works on detecting neurological disorders using gait analysis started with \cite{lee2000huma} and \cite{piecha2007gait}. \cite{lee2000huma} proposed wearing a specific suit and having a constrained environment (like a plain background) to extract relevant gait features effectively and detect neurological disorders, \cite{piecha2007gait} proposed detection of neurological disorders from load distribution on foot. \cite{lee2000huma} easily segmented the body (thanks to the suit and plain background) and extracted a skeleton through thinning operation to extract the skeleton required for developing the relevant features. Similarly, \cite{abdul2010sensor} proposed a sensor system to detect various vertical movements and, subsequently, neurological disorders. Thus, all these works are heavily constrained either by the arrangements required or the instruments required. Also, given the idea presented in \cite{piecha2007gait}, \cite{papavasileiou2017classification} collected data from smart-shoes to predict neurological disorders, specifically stroke and Parkinson's disease. Similarly, \cite{tunca2017inertial} used inertial sensors to extract relevant features and detect neurological disorders.
It is clear from above that gait analysis has been one of the prominent characteristics in detecting neurological disorders. However, to the best of our knowledge, a pose-estimation based approach has not been explored yet to perform gait analysis that particularly focuses on neurological disorders.
\section{Proposed Method}
In this section, we describe what data we extract from the video, how we design our gait features (focusing on neurological disorders) at frame-level using such data, and how we derive video-level features from those frame-level features.
\begin{table}
\centering
\caption{Notations for the key-points in the Human Pose}
\begin{tabular}{|l|c|c|}
\hline
Key-point & Notation as set $P$'s element & Symbolic Notation \\
\hline
\hline
Left Ear & $P_1$&$R_l$ \\
Right Ear & $P_2$&$R_r$\\
Left Shoulder & $P_3$&$S_l$\\
Right Shoulder & $P_4$&$S_r$\\
Left Elbow & $P_5$&$E_l$\\
Right Elbow & $P_6$&$E_r$\\
Left Wrist & $P_7$&$W_l$\\
Right Wrist & $P_8$&$W_r$\\
Left Hip & $P_9$&$H_l$\\
Right Hip & $P_{10}$&$H_r$\\
Left Knee & $P_{11}$&$K_l$\\
Right Knee & $P_{12}$&$K_r$\\
Left Ankle & $P_{13}$&$A_l$\\
Right Ankle & $P_{14}$&$A_r$\\
\hline
\end{tabular}
\label{tab:notation}
\end{table}
\subsection{Data Extraction}
We extract key-points of human pose using the AlphaPose technique \cite{fang2017rmpe}, which essentially provides a skeleton~\cite{jerripothula2017object,gao20182d} along with the coordinates of different key-points (or joints). We select only the key-points we need for our gait analysis, and those key-points have been mentioned in Table~\ref{tab:notation}.
Let the selected set of key-points of a human pose be denoted as $P=\{P_i|i=1,\cdots,|P|\}$. Also, let those key-points be denoted by individual symbols, as shown in Table~\ref{tab:notation}, for readability. Note that for ensuring brevity and readability of our equations, we denote the key-points either as elements of $P$ or using symbolic notations. Each key-point has two values: an x-coordinate value and a y-coordinate value of the key-point location on a human body. In summary, taking an example, we denote x-coordinate of the left ear ($R_l$) as $R_l(x)$ (or $P_1(x)$) and its y-coordinate as $R_r(y)$ (or $P_2(y)$).
\subsection{Limb Straightness}
\begin{figure}
\begin{center}
\includegraphics[width=0.47\linewidth,height=2.4cm]{images/limb_straightness_new.pdf}
\includegraphics[width=0.47\linewidth,height=2.4cm]{images/handleg_coordination_new.pdf}
\end{center}
\vspace{-4mm}
\caption{Limb Straightness and Hand-leg Coordination}\label{fig:ls}
\end{figure}
In the parkinsonian gait, we observe that the hands of the subject get bent almost like `V' shape while walking. Also, in choreiform gait, involuntary and unbalanced motion sometimes leads to a bending of hands and legs. Hence, we can exploit this observation to form and define our first feature \cite{7484309,9153789} named limb straightness. There are four limbs in total: two hands and two legs. While we can consider shoulder, elbow, and wrist landmark points present on a hand to measure its straightness, we can consider hip, knee, and ankle landmark points to do the same for legs. In Fig.~\ref{fig:ls}, we demonstrate how we compute the straightness of a hand limb. To quantify the observation, we measure the displacement of the central landmark point (elbow) from the line joining the other two landmark points (shoulder and wrist), which are extreme landmark points of the limb. We derive this distance in the following way, say for the left hand: (i) We compute the slope \Big(denoted as $m(S_l, W_l)$\Big) of the line joining $S_l$ and $W_l$. (ii) We compute the y-intercept \Big(denoted as $c(S_l,W_l)$\Big) of the line joining $S_l$ and $W_l$. (iii) We use central landmark point ($E_l$) coordinate values and slope calculated to obtain the perpendicular distance using the perpendicular distance of a point from a line formula. We use the following equations to arrive at our left-hand limb straightness \Big($LS(S_l, E_l, W_l)$\Big) feature:
\begin{align}
m(S_l,W_l)&=\frac{S_l(y)-W_l(y)}{S_l(x)-W_l(x)}\\
c(S_l,W_l)&=\frac{W_l(y)S_l(x)-W_l(x)S_l(y)}{S_l(x)-W_l(x)}\\
LS(S_l,E_l,W_l)&=\frac{|m(S_l,W_l) E_l(x)+c(S_l,W_l)-E_l(y)|}{\sqrt{(m(S_l,W_l)^2+1}}.
\end{align}
\begin{sloppypar}In the same way, we can find other limb straightness feature values also, which are $LS(S_r,E_r,W_r)$, $LS(H_l,K_l,A_l)$, and $LS(H_r,K_r,A_r)$. While the measured distance should be small normally, it would be much larger in the case of abnormality. Note that limb-bending can happen to even normal humans while holding something or walking on an uneven path, but such instances occur quite rarely compare to the occurrence of straight limbs. Therefore, we can know whether a person has abnormal gait or not only at a video level, after evaluating all the frames.
\end{sloppypar}
\subsection{Hand-leg Coordination}
We observe that while walking normally opposite pairs of an upper limb and a lower limb often tend to swing parallel to each other, i.e., left-hand swings parallelly with the right-leg, and right-hand swings parallelly with left-leg. However, we note that when a person affected with Hemiplegia or Diplegia walks, our observation of parallelism gets disrupted due to the abnormal conical movement of legs. Such disruption occurs in the case of Parkinson's Disease as well due to bent-hands and almost straight legs. So, with the motivation of encoding the hand-leg co-ordination using parallelism of pairs of opposite limbs, we compute the angle between the hand and the leg present in those pairs, as shown in Fig.~\ref{fig:ls}. We derive this angle in the following way, say for the pair comprising left-hand, and right-leg limbs: (i) We compute the slope of the hand \Big($m(S_l, W_l)$\Big). (ii) We compute the slope of the leg \Big($m(H_r, A_r)$\Big). (iii) We compute our hand-leg co-ordination feature \Big($HL(S_l, W_l, H_r, A_r)$\Big) for the pair by finding the difference between the corresponding angles of two slopes computed, as shown below:
\begin{equation}
HL(S_l,W_l,H_r,A_r)=|tan^{-1}\Big(m(S_l,W_l)\Big)-tan^{-1}\Big(m(S_l,W_l)\Big)|
\end{equation}
This angle turns out to be smaller in the normal case and possesses quite a significant value in the abnormal case. We can compute this angle for the other pair as well, i.e., involving right-hand and left-leg, i.e., $HL(S_r, W_r, H_l, A_l)$. In this way, there are two hand-leg co-ordination feature values for a frame. Like the limb straightness feature, this feature can also be analyzed at the video-level only to arrive at a proper decision.
\subsection{Upper Body Straightness}
\begin{figure}
\begin{center}
\includegraphics[width=0.47\linewidth,height=3cm]{images/upper-body_straightness_new.pdf}
\includegraphics[width=0.47\linewidth,height=3cm]{images/total-body_straightness_new.pdf}
\end{center}
\vspace{-4mm}
\caption{Upper-body and Total-body Straightness }\label{fig:us}
\end{figure}
The observation that upper-body bends in the parkinsonian and diplegic gaits leads us to our next gait feature: upper body straightness.This straightness particularly gets affected in choreiform gait with the unstable neck. To quantify this observation, we define our upper-body straightness in terms of displacement of effective shoulder coordinates from the line joining the effective hip and effective ear, as shown in the Fig.~\ref{fig:us}. By effective shoulder/hip/ear, we mean midpoint of the two ears/shoulders/hips. Ideally, the effective ear, effective shoulder, and effective hip should be collinear. We measure this non-collinearity in the following manner: Similar to limb straightness, we compute this feature by computing the perpendicular distance of effective shoulder from the line joining the effective hip and the effective ear. The final expression of our upper-body straightness (US) feature turns out to be the following:
\begingroup\makeatletter\def\f@size{7}\check@mathfonts
\def\maketag@@@#1{\hbox{\m@th\large\normalfont#1}}%
\begin{multline}
US=0.5\Bigg|\frac{\frac{R_l(y)+R_r(y)-H_l(y)-H_r(y)}{R_l(x)+R_r(x)-H_l(x)-H_r(x)}\Big(S_l(x)+S_r(x)\Big)}{\sqrt{1+(\frac{R_l(y)+R_r(y)-H_l(y)-H_r(y)}{R_l(x)+R_r(x)-H_l(x)-H_r(x)})^2}}\\+ \frac{\Big(R_l(x)+R_r(x)\Big)\Big(H_l(y)+H_r(y)\Big)-\Big(H_l(x)+H_r(x)\Big)\Big(R_l(y)+R_r(y)\Big)}{\Big(R_l(x)+R_r(x)-H_l(x)-H_r(x)\Big)\sqrt{1+(\frac{R_l(y)+R_r(y)-H_l(y)-H_r(y)}{R_l(x)+R_r(x)-H_l(x)-H_r(x)})^2}}\\- \frac{\Big(S_l(y)+S_r(y)\Big)}{\sqrt{1+(\frac{R_l(y)+R_r(y)-H_l(y)-H_r(y)}{R_l(x)+R_r(x)-H_l(x)-H_r(x)})^2}}\Bigg|.
\end{multline}
\endgroup
So, the lesser the displacement of the effective shoulder from the line joining effective ear and effective hip, the more the straightness of the upper-body. Again, this feature also can be analysed only at video-level for a conclusive decision making, for even a healthy human may bend forward sometimes.
\subsection{Body Straightness}
During hemiplegic gait, since one of the legs follow a conical motion while walking, the entire body can not be in a straight form. Similarly, with all kinds of arbitary movements at different joints of the body in the Choreiform gait, we can't expect body to be straight in such a scenario either. Same goes with the parkisonian gait where one's upper body comes forward quite characteristically. Therefore, the next feature is named as body straightness. This measures the straightness of the entire body as a whole. For the same, the displacement of the effective hip is computed from the line joining the effective shoulder and effective ankle joints, as shown in the Fig.~\ref{fig:us}. Similar to upper-body straightness, the body straightness (BS) value is computed as following, considering shoulders, hips, and ankles positions:
\begingroup\makeatletter\def\f@size{7}\check@mathfonts
\def\maketag@@@#1{\hbox{\m@th\large\normalfont#1}}%
\begin{multline}
BS=0.5\Bigg|\frac{\frac{S_l(y)+S_r(y)-A_l(y)-A_r(y)}{S_l(x)+S_r(x)-A_l(x)-A_r(x)}\Big(H_l(x)+H_r(x)\Big)}{\sqrt{1+(\frac{S_l(y)+S_r(y)-A_l(y)-A_r(y)}{S_l(x)+S_r(x)-A_l(x)-A_r(x)})^2}} \\+ \frac{\Big(S_l(x)+S_r(x)\Big)\Big(A_l(y)+A_r(y)\Big)-\Big(A_l(x)+A_r(x)\Big)\Big(S_l(y)+S_r(y)\Big)}{\Big(S_l(x)+S_r(x)-A_l(x)-A_r(x)\Big)\sqrt{1+(\frac{S_l(y)+S_r(y)-A_l(y)-A_r(y)}{S_l(x)+S_r(x)-A_l(x)-A_r(x)})^2}}\\- \frac{\Big(H_l(y)+H_r(y)\Big)}{\sqrt{1+(\frac{S_l(y)+S_r(y)-A_l(y)-A_r(y)}{S_l(x)+S_r(x)-A_l(x)-A_r(x)})^2}}\Bigg|.
\end{multline}
\endgroup
So, the lesser the displacement of the effective hip from the line joining effective shoulder and effective ankle, the more the straightness of the body. Again, this feature also needs to be analyzed at video-level for effective results.
\subsection{Central Distances}
\begin{figure}
\begin{center}
\includegraphics[width=0.53\linewidth,height=3cm]{images/center_distance2.pdf}
\includegraphics[width=0.32\linewidth,height=3cm]{images/mutual_distances.pdf}
\end{center}
\vspace{-4mm}
\caption{Central Distances and Mutual Distances}\label{fig:cd}
\end{figure}
We develop a feature named central distances to capture the distances of all the landmark points with what we call as effective key-point, as shown in Fig.\ref{fig:cd}. Such distances can serve interesting information to detect any anomalies in the gait of a person. Particularly for choreiform gait, these distances keep changing due to the kind of jerks involved in it. We define effective key-point as the centroid of all the landmark points. Let the central distance of a landmark point $P_i$ be denoted as CD(i). In this way, we have all $|P|=14$ distances per frame to serve as a piece of potential information to detect a person's anomalous gait. Note that there may be a person's size-variations in the video, which can affect the uniformity in the ranges of these distances across the frames. To account for this, we normalize these distances by dividing them with the maximum distance obtained.
\subsection{Mutual Distances}
Similar to central distances, we develop another feature named mutual distances to capture the distances of different landmark points with each other, as shown in Fig.\ref{fig:cd}. Such distances can also serve as other interesting information to detect any anomalies in a person's gait. Let distance between $P_i$ and $P_j$ be denoted $MD(i,j)$. In this way, we can have all the $^{|P|}C_2=91$ mutual distances per frame to serve as another piece of information to detect the abnormal gait of a person potentially. Note that, similar to central distances, here also, we normalize these distances by dividing them with the maximum distances obtained.
\subsection{Video-level Features}
The features discussed so far were all at frame-level, capturing important information about a person's pose in a particular frame. Their details are given in Table~\ref{tab:feature}. Note that abnormal poses in gait can be demonstrated by even healthy persons and persons once in a while. So, real patients are identifiable only over a while. We currently have a 4+2+1+1+14+91=113 dimensions feature vector at frame-level. To summarize these feature vectors at video level, we use statistical tools such as mean and standard deviation of these feature vectors across the frames in a video and concatenate them. In this way, we obtain a 113x2=226 dimensions feature vector at the video-level.
\begin{figure}
\begin{center}
\includegraphics[width=1\linewidth]{images/dataset.pdf}
\end{center}
\vspace{-1mm}
\caption{A glimpse of our dataset as we can see our participants mimicking different abnormal gaits}\label{fig:data}
\end{figure}
\begin{table}
\centering
\caption{Details of our features for a frame}\label{tab:feature}
\vspace{-1mm}
\resizebox{0.5\textwidth}{!}{\begin{tabular}{|l|c|c|}
\hline
Feature & Notations & Dimensions \\ \hline
Limb Straightness & $\{LS(S_l,E_l,W_l),LS(S_r,E_r,W_r),$ & \\ & $LS(H_l,K_l,A_l),LS(H_r,K_r,A_r)\}$ & 4 \\ \hline
Hand-Leg Coordination & $\{HL(S_l,W_l,H_r,A_r),$ & \\
& $HL(S_r,W_r,H_l,A_l)\}$ & 2 \\ \hline
Upper-body Straightness & $\{US\}$ & 1 \\ \hline
Body Straightness & $\{BS\}$ & 1 \\ \hline
Central Distances & $\{CD(i)|i=1,\cdots,|P|\}$ & 14 \\ \hline
Mutual Distances & $\{MD(i,j)|i,j=1,\cdots,|P|\}$ & 91 \\ \hline
\end{tabular}}
\vspace{2mm}
\centering
\caption{Description of our NeuroSynGait dataset}\label{tab:data}
\vspace{-1mm}
\resizebox{0.5\textwidth}{!}{
\begin{tabular}{|l|c|c||c|}
\hline
Abnormality & No. of Training Videos & No. of Testing Videos & Total Videos \\ \hline
Chorieform & 38 & 13 & 51 \\ \hline
Diplegia & 41 & 14 & 55 \\ \hline
Hemiplegia & 52 & 18 & 70 \\ \hline
Normal & 23 & 8 & 31 \\ \hline
Parkinson & 38 & 13 & 51 \\ \hline
\end{tabular}}
\end{table}
\begin{table*}[!htbp]
\centering
\caption{Cross-validation classification accuracy for multiple abnormalities detection using different methods and machine learning algorithms. }\label{tab:cvca}
\vspace{-1mm}
\resizebox{0.75\textwidth}{!}{%
\begin{tabular}{|l|c|c|c|c|c|c|c|c|c|}
\hline
\multicolumn{1}{|c|}{} & kNN & Tree & SVM & SGD & \begin{tabular}[c]{@{}c@{}}Random\\ Forest\end{tabular} & \begin{tabular}[c]{@{}c@{}}Neural\\ Network\end{tabular} & \begin{tabular}[c]{@{}c@{}}Naive\\ Bayes\end{tabular} & \begin{tabular}[c]{@{}c@{}}Logistic\\ Regression\end{tabular} & AdaBoost \\ \hline
AlphaPose\cite{fang2017rmpe} & 0.260 & 0.458 & 0.339 & 0.547 & 0.505 & 0.490 & 0.307 & 0.656 & 0.469 \\
\hline
3D-CNN\cite{tran2015learning} & 0.260 & 0.333 & 0.432 & 0.568 & 0.344 & 0.495 & 0.318 & 0.573 & 0.375 \\ \hline
AlphaPose\cite{fang2017rmpe}+&&&&&&&&&
\\
3D-CNN\cite{tran2015learning} & 0.479 & 0.396 & 0.531 & 0.635 & 0.453 & 0.609 & 0.469 & \textcolor{blue}{\textbf{0.667}} & 0.365 \\
\hline\hline
Ours & \textcolor{blue}{\textbf{0.557}} & \textcolor{blue}{\textbf{0.682}} & \textcolor{blue}{\textbf{0.820}} & \textcolor{blue}{\textbf{0.818}} & \textcolor{blue}{\textbf{0.714}} & \textcolor{blue}{\textbf{0.797}} & \textcolor{blue}{\textbf{0.661}} & 0.276 & \textcolor{blue}{\textbf{0.641}} \\ \hline
\end{tabular}}
\vspace{2mm}
\centering
\caption{Test classification accuracies for multiple abnormalities detection using different methods and machine learning algorithms.}\label{tab:tca}
\vspace{-1mm}
\resizebox{0.75\textwidth}{!}{%
\begin{tabular}{|l|c|c|c|c|c|c|c|c|c|}
\hline
\multicolumn{1}{|c|}{} & kNN & Tree & SVM & SGD & \begin{tabular}[c]{@{}c@{}}Random\\ Forest\end{tabular} & \begin{tabular}[c]{@{}c@{}}Neural\\ Network\end{tabular} & \begin{tabular}[c]{@{}c@{}}Naive\\ Bayes\end{tabular} & \begin{tabular}[c]{@{}c@{}}Logistic\\ Regression\end{tabular} & AdaBoost \\ \hline
AlphaPose\cite{fang2017rmpe} & 0.197 & 0.591 & 0.470 & 0.515 & 0.470 & 0.561 & 0.455 & \textcolor{blue}{\textbf{0.758}} & 0.576 \\ \hline
3D-CNN\cite{tran2015learning} & 0.273 & 0.379 & 0.455 & 0.530 & 0.379 & 0.485 & 0.288 & 0.591 & 0.348 \\ \hline
AlphaPose\cite{fang2017rmpe}+&&&&&&&&&
\\
3D-CNN\cite{tran2015learning} & 0.424 & 0.394 & 0.545 & 0.606 & 0.379 & 0.636 & 0.470 & 0.652 & 0.379 \\ \hline\hline
Ours & \textcolor{blue}{\textbf{0.636}} & \textcolor{blue}{\textbf{0.636}} & \textcolor{blue}{\textbf{0.788}} & \textcolor{blue}{\textbf{0.864}} & \textcolor{blue}{\textbf{0.833}} & \textcolor{blue}{\textbf{0.788}} & \textcolor{blue}{\textbf{0.773}} & 0.212 & \textcolor{blue}{\textbf{0.712}} \\ \hline
\end{tabular}}
\end{table*}
\begin{table}[!htbp]
\centering
\caption{The details of the best models for Parkinsonian gait detection using different methods across different machine learning algorithms. By best, we mean sum of cross validation and test classification accuracies are highest.}\label{tab:iip}
\vspace{-1mm}
\resizebox{0.5\textwidth}{!}{\begin{tabular}{|l|c|c|c||c|}
\hline
Details & AlphaPose\cite{fang2017rmpe} & 3D-CNN\cite{tran2015learning} & AlphaPose\cite{fang2017rmpe}+3D-CNN\cite{tran2015learning}& Ours\\ \hline
Cross Validation & \textcolor{blue}{\textbf{0.984}} & 0.918 & 0.967 & \textcolor{blue}{\textbf{0.984}} \\\hline
Test & \textcolor{blue}{\textbf{1.000}} & 0.905 & 1.000 & \textcolor{blue}{\textbf{1.000}} \\\hline
Algorithm & NN & LR & SVM & RF \\\hline
\end{tabular}}
\vspace{2mm}
\centering
\caption{The details of the best models for Hemiplegic gait detection using different methods across different machine learning algorithms. By best, we mean sum of cross validation and test classification accuracies are highest.}\label{tab:iih}
\vspace{-1mm}
\resizebox{0.5\textwidth}{!}{\begin{tabular}{|l|c|c|c||c|}
\hline
Details & AlphaPose\cite{fang2017rmpe} & 3D-CNN\cite{tran2015learning} & AlphaPose\cite{fang2017rmpe}+3D-CNN\cite{tran2015learning}& Ours\\ \hline
Cross Validation & 0.867 & 0.827 & 0.800 & \textcolor{blue}{\textbf{0.893}} \\\hline
Test & \textcolor{blue}{\textbf{0.962}} & 0.846 & 0.769 & 0.960 \\\hline
Algorithm & LR & LR & LR & NN \\\hline
\end{tabular}}
\end{table}
\section{Experimental Results}
In this section, we first discuss the dataset developed by us, named NeuroSynGait video dataset. Second, we discuss the details of the different experiments conducted. Third, we discuss the different results we have obtained.
\subsection{Dataset}
Since neurological disorders are rare, we show different videos of the patients' gait with these disorders to healthy individuals and request them to mimic those gait abnormalities. To mimic those videos properly, we also request them to read the publicly available descriptions of each gait\footnote{https://neurologicexam.med.utah.edu/adult/html/gait\_abnormal.html} before they mimic these gaits. In this way, we obtain a substantial number of videos of gait abnormalities. The details of these videos are given in the Table~\ref{tab:data}. We collected 258 videos and labeled them as either one of the four gait abnormality or as normal. In this way, our dataset has a total of 5 classes. We adopt the 3:1 ratio for distributing the collected videos into training and testing subsets. A glimpse of participants performing the abnormal gait is given in Fig.~\ref{fig:data}.
\subsection{Experiment Details}
We use various machine learning algorithms such as Ada Boost (AB) \cite{freund1997decision}, Decision Tree (DT) \cite{quinlan1986induction}, k-Nearest Neighbors (kNN) \cite{altman1992introduction}, Logistic Regression (LR) \cite{walker1967estimation}, Naive Bayes (NB) \cite{maron1961automatic}, Neural Networks (NN) \cite{mcculloch1943logical}, Random Forests (RF) \cite{ho1995random}, Stochastic Gradient Descent (SGD) \cite{robbins1951stochastic}, Support Vectors Machine (SVM) \cite{cortes1995support} to learn models that can predict the presence of a particular disorder. We report the classification accuracies of both cross-validation phase and testing phase.
We conduct two sets of experiments: multiple abnormality prediction and individual abnormality prediction. In multiple abnormality prediction, there are five classes (4 abnormalities and 1 normal). In individual abnormality prediction, there are only two classes: the concerned abnormality and the normal. We compare our method with existing 3D-CNN~\cite{tran2015learning} and AlphaPose~\cite{fang2017rmpe}. While \cite{tran2015learning} proposed spatiotemporal features using deep 3D ConvNets, \cite{fang2017rmpe} proposed a regional multi-person pose estimation framework, which we employ for developing our features. We compare with both the techniques and their combination in the following manner. (i) AlphaPose~\cite{fang2017rmpe}, where we use landmark points as features for a video-frame and summarize them at video-level just like we do. (ii) 3D-CNN~\cite{tran2015learning}, where features obtained for a set of frames are summarized at video-level just like we do. (iii) AlphaPose~\cite{fang2017rmpe} + 3D-CNN~\cite{tran2015learning}, where we extract video features using \cite{tran2015learning} on the skeleton videos generated by \cite{fang2017rmpe}.
\begin{table}
\centering
\caption{The details of the best models for Diplegic gait detection using different methods across different machine learning algorithms. By best, we mean the sum of cross-validation and test classification accuracies are highest.}\label{tab:iid}
\vspace{-1mm}
\resizebox{0.5\textwidth}{!}{\begin{tabular}{|l|c|c|c||c|}
\hline
Details & AlphaPose\cite{fang2017rmpe} & 3D-CNN\cite{tran2015learning} & AlphaPose\cite{fang2017rmpe}+3D-CNN\cite{tran2015learning}& Ours\\ \hline
Cross Validation & \textcolor{blue}{\textbf{0.891}} & 0.719 & 0.781 & 0.734 \\\hline
Test & 0.818 & 0.909 & 0.818 & \textcolor{blue}{\textbf{0.955}} \\\hline
Algorithm & LR & LR & NN & RF \\\hline
\end{tabular}}
\vspace{2mm}
\centering
\caption{The details of the best models for Choreiform gait detection using different methods across different machine learning algorithms. By best, we mean sum of cross validation and test classification accuracies are highest.}\label{tab:iic}
\vspace{-1mm}
\resizebox{0.5\textwidth}{!}{\begin{tabular}{|l|c|c|c||c|}
\hline
Details & AlphaPose\cite{fang2017rmpe} & 3D-CNN\cite{tran2015learning} & AlphaPose\cite{fang2017rmpe}+3D-CNN\cite{tran2015learning}& Ours\\ \hline
Cross Validation & 0.689 & 0.754 & 0.721 & \textcolor{blue}{\textbf{0.951}} \\\hline
Test & 0.905 & \textcolor{blue}{\textbf{0.952}} & 0.762 & \textcolor{blue}{\textbf{0.952}} \\\hline
Algorithm & RF & LR & NN & NN \\\hline
\end{tabular}}
\end{table}
\subsection{Results}
From Tables~\ref{tab:cvca}-\ref{tab:tca}, it's clear that, in the case of multiple abnormality prediction, our features demonstrate superior performance compared to all the three existing ones, as it outperforms them in 8/9 learning algorithms, both at cross-validation and test stages. Our multiple abnormality detector is best learned using the SGD algorithm as its sum of cross-validation (81.8\%) and test accuracy (86.4\%) is found to be best. Following the same idea of what is best, we identify the best individual gait abnormality detectors for each method and report the results in Tables~\ref{tab:iip}-\ref{tab:iic}. Compared to other methods, our best individual gait abnormality detectors consistently scored more than 95\% in terms of test classification accuracy and achieved the highest cross-validation and test classification accuracies for 3/4 abnormalities.
\subsection*{Conclusion}
We develop several novel gait features, namely limb straightness, hand-leg co-ordination, upper-body straightness, body straightness, central distances, and mutual distances to detect gait abnormalities caused by neurological disorders in videos. We employ the key-points of the human pose for designing them. Our experiments demonstrate their superior performance in comparison to the existing ones.
\bibliographystyle{IEEEtran}
| {'timestamp': '2020-08-18T02:16:17', 'yymm': '2008', 'arxiv_id': '2008.06861', 'language': 'en', 'url': 'https://arxiv.org/abs/2008.06861'} | arxiv |
\section{Introduction}
A dialog system should correctly understand speakers’ utterances and respond in natural language.
Dialog act recognition (DAR) and sentiment classification are two correlative tasks to realize the former.
The goal of DAR is to attach semantic labels to each utterance in a dialog and identify the underlying intentions \cite{kim2011review}.
Meanwhile, sentiment classification can detect the sentiments which are implicated in utterances and can help to capture speakers’ intentions \cite{kim2018integrated}.
\begin{figure}[t]
\centering
\includegraphics[scale=0.33]{5400-example.pdf}
\caption{\label{corpus-examples} A snippet of a dialog sample from the Mastodon Corpus and each utterance has a corresponding DA label and a sentiment label. (DA represents Dialog Act) }
\label{example1}
\end{figure}
Intuitively, the two tasks are closely related and the information of one task can be utilized in the other task.
For example, as illustrated in Figure~\ref{corpus-examples},
when predicting \texttt{User B} sentiment label, it's more likely to be \texttt{Negative} in the case of known \texttt{Agreement} DA label, since \texttt{Agreement} means
the current utterance agrees with previous \texttt{User A} utterance and hence \texttt{User B} sentiment label tends to be the same with the \texttt{User A} response sentiment \texttt{Negative}.
Similarly, knowing the sentiment information also contributes to the current DA prediction.
Hence, it's promising to take the cross-impact between the two tasks into account.
In recent years, \citep{mastodon} has explored the multi-task framework to model the correlation between sentiment classification and dialog act recognition.
Unfortunately, their work does not achieve the promising performance, even underperforms some works which consider them as separate tasks.
In this paper, we argue that this modeling method with no explicit interaction between the two tasks is not effective enough for transferring knowledge across the two tasks and has following weaknesses: (1) A simple multi-task learning framework just implicitly considers mutual connection between two tasks by sharing latent representations, which cannot achieve desirable results \cite{ijcai2019-296}.
(2) With the shared latent representations, it is hard to explicitly control knowledge transfer for both tasks, resulting in lack of interpretability.
To address the aforementioned issues, we propose a {\bf{D}}eep \textbf{C}o-Interactive \textbf{R}elation \textbf{N}etwork (\textbf{DCR-Net}) for joint dialog act recognition
and sentiment classification, which can explicitly model relation and interaction between two tasks with a \textit{co-interactive relation layer}.
In practice, we first adopt a shared hierarchical encoder with utterance-level self-attention mechanism to obtain the shared representations of dialog act and sentiment among utterances.
The shared representations are then fed into the \textit{co-interactive relation layer} to get fusion of dialog act and sentiment representations and we call the process of fusion as one step
of interaction.
With the \textit{co-interactive relation layer}, we can directly control knowledge transfer for both tasks, which makes our framework more interpretable.
Besides,
the \textit{relation layer} can be stacked to form a hierarchy that enables multi-step interactions between the two tasks, which can further better capture mutual knowledge.
The underlying motivation is that if a model extracts mutual knowledge in one step of interaction, then by stacking multiple such steps, the model can gradually accumulate useful information and finally
capture the semantic relation between the two tasks \cite{tao-etal-2019-one}.
Specifically, we explore several \textit{relation layers} including:
1) \textit{Concatenation} that concats the representation of dialog act and sentiment.
2) \textit{Multilayer Perceptron (MLP)} that uses the \textit{MLP} to learn the rich representation which contains both dialog act and sentiment information.
3) \textit{Co-Attention} that uses the co-attention mechanism \cite{xiong2016dynamic} to capture mutually important information to contribute to the two tasks (sentiment to act and act to sentiment).
Finally, the final integrated outputs are then fed to separate decoders for dialog act and sentiment prediction respectively.
We conduct experiments on two real-world benchmarks including
Mastodon dataset \cite{mastodon} and Dailydialog dataset \cite{li-etal-2017-dailydialog}. The experimental results show that our system achieves significant
and consistent improvement as compared to all baseline
methods and achieves the state-of-the-art performance.
Finally, Bidirectional Encoder Representation from Transformer (\citep{devlin-etal-2019-bert}, BERT), a pre-trained model, is used to further boost the performance.
To summarize, the contributions of this work are as follows:
\begin{itemize}
\item We propose a deep co-interactive relation network for joint dialog act recognition and sentiment classification
, which can explicitly control the cross knowledge transfer for both tasks and make our framework more interpretable.
\item Our \textit{relation layer} can be stacked to form a hierarchy for
multi-step interactions between the two tasks, which can gradually capture mutual relation and better transfer knowledge.
\item We thoroughly study different relation layers and present extensive experiments demonstrating the benefit of our proposed framework. Experiments on two publicly available datasets show substantial improvement and our framework achieves the state-of-the-art performance.
\item Finally, we analyze the effect of incorporating BERT in our framework. With BERT, our framework reaches a new state-of-the-art level.
\end{itemize}
\begin{figure*} [t]
\centering
\includegraphics[scale=0.9]{5400-framework.pdf}
\caption{The top part (a) illustrates the overflow of our framework and the bottom part (b) represents different relation layers.
}
\label{fig:framework}
\end{figure*}
\section{Problem Formulation}
In this section, we describe the formulation definition for dialog act recognition and sentiment classification in dialog.
\begin{itemize}
\item \textbf{Dialog Act Recognition} Given a dialog $C$ = $(u_{1},u_{2}...,u_{T})$ consisting of a sequence of $T$ utterances, dialog act recognition can be seen as a utterance-level sequence classification problem to decide the corresponding utterance dialog act label ($y_{1}^{d},y_{2}^{d},...,y_{T}^{d}$) for each utterance in dialog.
\item \textbf{Sentiment Classification in Dialog } Sentiment classification in dialog can also be treated as an utterance-level sequence classification task that maps the utterance sequence $(u_{1},u_{2}...,u_{T})$ to the corresponding utterance sequence sentiment label ($y_{1}^{s},y_{2}^{s},...,y_{T}^{s}$).
\end{itemize}
\section{Our Approach}
In this section, we describe the architecture of DCR-Net; see the top part (a) of Figure.~\ref{fig:framework} for its overview.
DCR-Net mainly consists of three components: a shared hierarchical encoder, a stack of \textit{co-interactive relation layers} that repeatedly fuse dialog act and sentiment representations to explicitly model the relation and interaction between the two tasks, and two separate decoders for dialog act and sentiment prediction.
In the following sections, the details of our framework are given.
\subsection{Hierarchical Encoder}
In our framework, dialog act recognition and sentiment classification share one hierarchical encoder that consists of a bidirectional LSTM (BiLSTM) \cite{hochreiter1997long}, which captures temporal relationships within the words, followed by a utterance-level self-attention layer to consider the dialog contextual information.
\subsubsection{Utterance Encoder with BiLSTM}
Given a dialog $C$ = $(u_{1},...,u_{T})$ consists of a sequence of $T$ utterances and $u_{t}$ = $(w_{t}^{1},..., w_{t}^{K_{t}})$ which consists of a sequence of $K_{t}$ words,
we first adopt the BiLSTM to encode each utterance $u_{t}$$\in$$C$ to produce a series of hidden states (${ \mathbf { h } } _ t^1,..., { \mathbf { h } } _ t^{K_{t}}$), and we define ${\bf{h}}_{t}^{i}$ as follows:
\def\mathop{\rm concat}{\mathop{\rm concat}}
\begin{equation}
\mathbf { h }_t^i = \mathop{\rm concat}{ \left( \overrightarrow { \mathbf { h } } _ t^i , \overleftarrow { \mathbf { h } } _ t^i \right)},
\end{equation}
where $\mathop{\rm concat}(\cdot,\cdot)$ is an operation for concatenating two vectors, and $\overrightarrow { \mathbf { h } } _ t^i$ and $\overleftarrow { \mathbf { h } } _ t^i$ are the $i$-th hidden state of the forward LSTM and backward LSTM for $w_t^i$ respectively.
Then, we regard the last hidden state $ \mathbf{ h }_t^{K_{t}}$ as the utterance $u_{t}$ representation.
Hence, the sequence of $T$ utterances in $C$ can be represented as $\textbf{H}$ = ( $ \mathbf{ h }_1^{K_{1}}$, \dots, $ \mathbf{ h }_T^{K_{t}}$).
\subsubsection{Utterance-Level Self-Attention}
Self-attention is an effective
method of leveraging context-aware features over
variable-length sequences for natural language
processing tasks \cite{yin2017chinese,tan2018deep}.
In our case, we use self-attention mechanism to capture dialog-level
contextual information for each utterance.
In this paper, we adopt the self-attention formulation by \newcite{NIPS2017_7181} .
We first map the matrix of input vectors $\textbf{H}$ $\in$ $\mathbb{R}^{T\times d}$
($d$ represents the
mapped dimension) to queries (${\textbf{Q}}$), keys (${\textbf{K}}$) and values
(${\textbf{V}}$) matrices by different linear projections:
\begin{equation}
\left[ \begin{array} { c } { \textbf{K} } \\ { \textbf{Q} } \\ {\textbf{V} } \end{array} \right] = \left[ \begin{array} { c } { \textbf{W} _ { k } \textbf{H} } \\ { \textbf{W} _ { q } \textbf{H} } \\ { \textbf{W} _ { v } \textbf{H} } \end{array} \right].
\end{equation}
The attention weight is then computed by dot product
between $\textbf{Q}$, $\textbf{K}$ and the self-attention output
{\bf{C}} $\in$ $\mathbb{R}^{T\times d}$ is a weighted sum of values $\textbf{V}$:
\begin{equation}
{{\textbf{C}}} = \text { Attention } ( \textbf{Q} ,\textbf{ K} , \textbf{V }) = \operatorname { Softmax } \left( \frac { \textbf{Q K }^ { T } } { \sqrt { d _ { k } } } \right) \textbf{V},
\end{equation}
where we can see ${\textbf{C}}$ = $(\mathbf { c }_1, ..., \mathbf { c }_T)$ as the sequence utterances representations and each utterance representation captures the whole dialogue history information. $d_{k}$ represents the dimension of keys.
Now, we obtain the initial shared representations of sequence utterances dialog act ${\textbf{D}}$ = $( { \textbf{c} }_1, ..., { \textbf{c} }_T)$ and sentiment representations $\bf{S}$ = $({ \textbf{c} }_1, ..., { \textbf{c} }_T)$.
\subsection{Stacked Co-Interactive Relation Layer}
We now describe the proposed \textit{co-interactive relation layer}; see the bottom part (b) of Figure.\ref{fig:framework}.
In our paper, we use the \textit{co-interactive relation layer} to explicitly model the relation and interaction between dialog act recognition and sentiment classification.
It takes the dialog act ${\textbf{D}}$ and sentiment representations ${\textbf{S}}$ as inputs and then outputs their updated versions which consider cross-impact on two tasks.
In particular, it can be stacked to perform multi-step interaction for better capturing mutual knowledge and relation.
In our framework, we explore several types of relation layers, which can either be used individually or combined together.
Formally, given the $l^\text{th}$ layer inputs $\textbf{D}^{l}$ = ($\textbf{d}_{1}^{l}$, ...,$\textbf{d}_{T}^{l}$) $\in$ $\mathbb{R}^{T\times d}$ and $\textbf{S}^{l}$ = ($\textbf{s}_{1}^{l}$, ...,$\textbf{s}_{T}^{l}$) $\in$ $\mathbb{R}^{T\times d}$, we can adopt the following strategies to integrate the mutual knowledge between the two tasks. Before fusing information, we first apply a BiLSTM and MLP over act information and sentiment information separately to make them more task-specific, which can be written as $\textbf{S}^{l^{'}}$ = MLP ($\textbf{S}^{l}$ ) and $\textbf{D}^{l^{'}}$ = BiLSTM ($\textbf{D}^{l}$ ).
{\bf{{Concatenation}}} Concatenation is an simple and effective method to combine two information \cite{wu2018improving}. Hence, we concatenate the $l^\text{th}$ layer of dialog act and sentiment representations as the updated representations.
\def\mathop{\rm Concat}{\mathop{\rm Concat}}
\begin{equation}
{ \textbf{D}}^{l+1} = \mathop{\rm Concat} ({ \textbf{S}}^{l^{'}},{ \textbf{D}}^{l^{'}}),
\end{equation}
\begin{equation}
{ \textbf{S}}^{l+1} = \mathop{\rm Concat} ({ \textbf{S}}^{l^{'}}, { \textbf{D}}^{l^{'}}).
\end{equation}
{\bf{{MLP}}} \textit{Multilayer Perceptron (MLP)} can automatically abstract the integrated representation \cite{nguyen2018improved}. Here, we add an MLP layer on the concatenation output to further learn the relation between two tasks and capture the mutual information, which can be formulated as follows:
\def\mathop{\rm MLP}{\mathop{\rm MLP}}
\def\mathop{\rm Concat}{\mathop{\rm Concat}}
\begin{equation}
{ \textbf{D}}^{l+1} = \mathop{\rm MLP} (\mathop{\rm Concat} ({ \textbf{S}}^{l^{'}},{ \textbf{D}}^{l^{'}})) ,
\end{equation}
\begin{equation}
{ \textbf{S}}^{l+1} = \mathop{\rm MLP} (\mathop{\rm Concat} ({ \textbf{S}}^{l^{'}},{ \textbf{D}}^{l^{'}})).
\end{equation}
{\bf{{Co-Attention}}} Co-Attention is a very effective method to grasp
the mutually important information on both correlated tasks \cite{xiong2016dynamic}.
Here, we extend the basic co-attention mechanism to utterance-level co-attention.
It can produce the updated dialog act representations considering sentiment information, and the updated
sentiment representations incorporating act knowledge.
By doing this, we can transfer mutually relevant knowledge for the two tasks.
The process can defined as follows:
\def\mathop{\rm Softmax}{\mathop{\rm Softmax}}
\def\mathop{\rm Concat}{\mathop{\rm Concat}}
\begin{equation}
{ \textbf{D}}^{l+1}= { \textbf{D}}^{l^{'}} + \mathop{\rm Softmax} ({ \textbf{D}}^{l^{'}}( ({ \textbf{S}}^{l^{'}}) ^\top)) { \textbf{S}}^{l^{'}},
\end{equation}
\begin{equation}
{ \textbf{S}}^{l+1} = { \textbf{S}}^{l^{'}} + \mathop{\rm Softmax} ({ \textbf{S}}^{l^{'}}( ({ \textbf{D}}^{l^{'}}) ^\top)){ \textbf{D}}^{l^{'}},
\end{equation}
where ${\textbf{D}}^{l+1}$ = ($\textbf{d}_{1}^{l+1}$, ...,$\textbf{d}_{T}^{l+1}$) and ${\textbf{S}}^{l+1}$ = ($\textbf{s}_{1}^{l+1}$, ...,$\textbf{s}_{T}^{l+1}$) are the $l^\text{th}$ layer updated representations.
\subsection{Decoder for Dialog Act Recognition and Sentiment Classification}
After multi-step interaction with stacked co-interactive relation layer, we can get the outputs ${\textbf{D}}^{L}$ = ($\textbf{d}_{1}^{L}$, ...,$\textbf{d}_{T}^{L}$) and $\textbf{S}^{L}$ = ($\textbf{s}_{1}^{L}$, ...,$\textbf{s}_{T}^{L}$) of the last relation layer. We then adopt separate decoder to perform dialog act and sentiment prediction, which can be denoted as follows:
\def\mathop{\rm softmax}{\mathop{\rm softmax}}
\begin{equation}
\textbf{y}_{t}^{d} = \mathop{\rm softmax} (\textbf{W}^{d}{ \textbf{d} }_{t}^{L} + \textbf{b}_{d}),
\end{equation}
\begin{equation}
\textbf{y}_{t}^{s} = \mathop{\rm softmax} (\textbf{W}^{s}{\textbf{s} }_{t}^{L} + \textbf{b}_{s}),
\end{equation}
where $\textbf{y}_{t}^{d} $ and $\textbf{y}_{t}^{s}$ are the predicted distribution for dialog act and sentiment respectively; $\textbf{W}^{d}$ and $\textbf{W}^{s}$ are transformation matrices; $\textbf{b}_{d}$ and $\textbf{b}_{s}$ are bias vectors; $L$ is the number of stacked relation layers in our framework.
\subsection{Joint Training}
The dialog act recognition objection is formulated as:
\begin{equation}
\mathcal { L } _ { 1 } = - \sum _ { i = 1 } ^ { T} \hat { {\bf{y}} } _ { i } ^ { d } \log \left( {\bf{y}} _ { i} ^ { d } \right).
\end{equation}
Similarly, the sentiment classification objection is defined as:
\begin{equation}
\mathcal { L } _ { 2 } = - \sum _ { i = 1 } ^ { T} \hat { {\bf{y}} } _ { i } ^ { s } \log \left( {\bf{y}} _ { i} ^ { s} \right),
\end{equation}
where ${\hat { {\bf{y}} } _ { i } ^ { d } }$ and
$ {\hat { {\bf{y}}} _ { i } ^ { s } }$ are gold utterance act label and
gold sentiment label separately.
To obtain dialog act recognition and sentiment classification jointly, we follow \newcite{qin-etal-2019-stack} to obtain the final joint objective:
\begin{equation}
\mathcal { L } _ { \theta } = \mathcal{ L }_{1} + \mathcal{ L }_{2}.
\end{equation}
\section{Experiments}
\subsection{Dataset} \label{sec:dataset}
We evaluate the performance of our model on two publicly available dialogue datasets, Mastodon \cite{mastodon} and Dailydialog \cite{li-etal-2017-dailydialog}.
{\bf{Mastodon}} The Mastodon dataset\footnote{https://github.com/cerisara/DialogSentimentMastodon} consists of 269 dialogues
for a total of 1075 utterances in training dataset and the test dataset is a corpus of 266 dialogues for a total of 1142 utterances. The vocabulary size is 5330.
We follow the same partition as \newcite{mastodon}.
{\bf{DailyDialog}} For Dailydialog dataset,\footnote{http://yanran.li/dailydialog} we adopt the standard split from the original dataset \cite{li-etal-2017-dailydialog}, employing 11,118 dialogues for training, 1,000 for validating, and 1,000 for testing.
\begin{table*}[th]
\small
\centering
\begin{adjustbox}{width=0.9\textwidth}
\begin{tabular}{l|ccc|ccc|ccc|ccc}
\hline
\multirow{3}*{\textbf{Model}} & \multicolumn{6}{c}{\textbf{Mastodon}} & \multicolumn{6}{c}{\textbf{Dailydialog}} \\
\cline{2-13}
~ & \multicolumn{3}{c|}{SC} & \multicolumn{3}{c|}{DAR} & \multicolumn{3}{c|}{SC} & \multicolumn{3}{c}{DAR} \\
\cline{2-13}
~ & F1 (\%) & R (\%) & P (\%) & F1 (\%) & R (\%) & P (\%) & F1 (\%) & R (\%) & P (\%) & F1 (\%) & R (\%) & P (\%) \\
\hline
HEC \cite{kumar2018dialogue} & - &- & -&56.1 &55.7 &56.5 &- &- &- &77.8 &76.5 &77.8 \\
CRF-ASN \cite{chen2018dialogue} & - & - &- &55.1 &53.9 &56.5 &- &- & -&76.0 &75.6 &78.2 \\
CASA \cite{raheja-tetreault-2019-dialogue} & - &- &- &56.4 &57.1 &55.7 & - &- &- &78.0 &76.5 &77.9 \\
\hline
VDCNN \cite{conneau-etal-2017-deep} &39.6 & 31.6& 44.0 & - & - & - & 39.7 & 35.6 & 55.2 & - & - & - \\
Region.emb \cite{qiao2018new} &40.3 & 33.6 & 42.8 & - & - & - & 41.0 & 36.6 & 56.4 & - & - & -\\
DRNN \cite{wang-2018-disconnected} &37.9 & 34.3 & 39.7 & - & - & - & 41.1 & 37.0 & 56.4 & - & - & - \\
DialogueRNN \cite{majumder2019dialoguernn} &41.5 &42.8 & 40.5 & - & - & - & 40.3 & 37.7 & 44.5 & - & - & - \\
\hline
JointDAS \cite{mastodon} & 37.6 & 41.6 & 36.1 & 53.2 & 51.9 & 55.6 & 31.2 & 28.8 & 35.4 & 75.1 & 74.5 & 76.2 \\
IIIM \cite{kim2018integrated} & 39.4 & 40.1 & 38.7 & 54.3 & 52.2 & 56.3 & 33.0 & 28.5 & 38.9 & 75.7 & 74.9 & 76.5 \\
\hline
DCR-Net + Concat &42.1 & 41.3 & 42.9 & 57.1 & 56.9 & 57.2 & 41.2 & 37.4 & 57.4 & 78.2 & 77.6 & 78.7 \\
DCR-Net + MLP & 42.3 & 43.7 & 45.4 & 57.2 & 56.7 & 57.7 & 42.7 & 37.5 & \textbf{58.8} & 79.1 & 78.5 &{ 79.2} \\
DCR-Net + Co-Attention & \bf{*45.1} & \bf{*47.3} & \bf{*43.2} & \bf{*58.6} & \bf{*56.9} & \bf{*60.3} & \bf{*45.4} & \bf{*40.1} & 56.0 & \bf{*79.1} & \bf{*79.0} & \bf{*79.1} \\
\hdashline
DCR-Net + Co-Attention + BERT & 55.1 & 56.5 & 56.5 & 67.1 & 65.2 & 69.2 & 48.9 & 46.9 & 63.2 & 80.0 & 79.9 & 80.2 \\
\hline
\end{tabular}
\end{adjustbox}
\caption{Comparison of our model with baselines on Mastodon and Dailydialog test datasets. SC represents Sentiment Classification and DAR represents Dialog Act Recognition. The numbers with * indicate that the improvement of our model over all baselines is statistically significant with $p<0.01$ under t-test.}
\label{table:over_all}
\end{table*}
\subsection{Experimental Settings}
In our experiment setting, dimensionality of the embedding and all hidden units is selected from $\{100, 128, 256, 512, 600, 700, 800, 1024\}$.
We do not use any pre-trained embedding and all word embeddings are trained from scratch.
L2 regularization used on our model is $1\times 10^{-8}$ and dropout ratio adopted is selected from $\{0.1, 0.2, 0.25, 0.3, 0.4, 0.5\}$.
In addition, we add a residual connection in self-attention and relation layer for reducing overfitting.
We use Adam \cite{kingma-ba:2014:ICLR} to
optimize the parameters in our model and adopt
the suggested hyper-parameters for optimization.
We set the stacked number of relation layer as 3.
For all experiments, we pick the model which works best on dev set, and then evaluate it on test set.
\subsection{Baselines}
We first make a comparison with the state-of-the-art dialog act recognition models: HEC, CRF-ASN and CASA, and then we compare our model with some state-of-the-art sentiment classification models: VDCNN, Region.emb, DRNN and DialogueRNN. Finally, we compare our framework with the existing state-of-the-art joint models including: JointDAS and IIIM.
We briefly describe these baseline models below: 1) \textbf{{HEC}} \cite{kumar2018dialogue}: This work uses a hierarchical Bi-LSTM-CRF (Bi-directional Long Short Term Memory with CRF) model for dialog act recognition, which can capture both kinds of dependencies including word-level and utterance-level. 2) \textbf{{CRF-ASN}} \cite{chen2018dialogue}: This model proposes a crf-attentive structured network for dialog act recognition, which can dynamically separate the utterances into cliques. 3) \textbf{{CASA}} \cite{raheja-tetreault-2019-dialogue}: This work leverages a context-aware self-attention mechanism coupled with a hierarchical deep neural network and achieves state-of-the-art performance. 4) \textbf{{VDCNN}} \cite{conneau-etal-2017-deep}: This work proposes a deep CNN with 29 convolutional layers for text classification. 5) \textbf{{Region.emb}} \cite{qiao2018new}: This work proposes a new method of region embedding for text classification, which can effectively learn and utilize task-specific distributed representations of n-grams. 6) \textbf{{DRNN}} \cite{wang-2018-disconnected}: This work proposes a disconnected recurrent neural network for
text classification which can incorporate position-invariance into RNN. 7) \textbf{{DialogueRNN}} \cite{majumder2019dialoguernn}: DialogueRNN is a RNN-based neural architecture for emotion detection in a conversation, which can keep track of the individual party states throughout the conversation and uses this information. 8) \textbf{{JointDAS}} \cite{mastodon}: This model uses a multi-task modeling framework for joint dialog act recognition and sentiment classification, which models relation and interaction between two tasks by sharing parameters. 9) \textbf{{IIIM}} \cite{kim2018integrated}: This work proposes an integrated neural network model which simultaneously identifies speech acts, predicators, and sentiments of dialogue utterances.
For \textit{HEC, CRF-ASN, CASA} and \textit{IIM} we re-implemented the models.
For \textit{VDCNN, Region.emb}, \textit{DRNN} and \textit{DialogueRNN}, we adopted the open-sourced code\footnote{https://github.com/Tencent/NeuralNLP-NeuralClassifier and https://github.com/senticnet/conv-emotion} to get the results.
For \textit{JointDAS}, we adopted the reported results from \newcite{mastodon} and run their open-source code on Dailydialog dataset to obtain results.
For \textit{IIIM}, we re-implemented the model and obtained results on the same datasets.\footnote{All experiments are conducted on the public datasets provided by \newcite{mastodon} and the dataset does not annotate the predictors. For direct comparison, we re-implemented the models excepting predicting the predicators and obtained the results on the same dataset.} For all BERT-based experiments, we just replace our utterance encoder LSTM with BERT base model.\footnote{The BERT model is fine-tuned with our framework.}
\subsection{Overall Results}
On Dailydialog dataset, following \newcite{kim2018integrated},
we adopt macro-average Precision, Recall and F1 for both sentiment classification and dialog act recognition.
On Mastodon dataset,
following \newcite{mastodon}, we ignore the neural sentiment label and adopt the average of the dialog-act specific F1 scores weighted by the prevalence of each dialog act for dar.
The experimental result is shown in Table~\ref{table:over_all}.
From the result, we can observe that:
\begin{enumerate}
\item We obtain large improvements compared with prior joint models. In Mastodon dataset, compared with \textit{IIIM} model, our framework with Co-Attention achieves 5.7\% improvement on F1 score on sentiment classification task and 4.3\% improvement on F1 score on dialog act recognition task.
In Dailydialog dataset,
we achieve 12.4\% improvement on F1 score on sentiment classification task and 3.4\% improvement on F1 score on dialog act recognition task.
It is worth noting that the prior joint models have modeled the relation between two tasks implicitly by sharing parameters. This result demonstrates the effectiveness of explicitly modeling the interaction between the two tasks and both tasks can boost performance from this mechanism.
\item Our framework with Co-Attention outperforms the state-of-the-art dialog act recognition models and sentiment classification models in all metrics in two datasets.
It illustrates the advantages and effectiveness of our proposed joint model where the information of one task can be effectively utilized in the other task.
\item The \textit{MLP} relation layer outperforms the \textit{concatenation}, which shows that the \textit{MLP} can further learn the deep implicit relation
between two tasks and improve the performance. Especially, we can see that the \textit{Co-Attention} relation layer gains the best performance among three relation layers on F1 scores on all datasets.
We attribute this to the fact that the \textit{Co-Attention} operation can automatically detect the mutually important information to each other and better interact with the two tasks.
\item{From the last block of Table~\ref{table:over_all}, the BERT-based model performs remarkably well on both two datasets and achieves a new state-of-the-art performance, which indicates the effectiveness of a strong pre-trained model in two tasks. We attribute this to the fact that pre-trained models can provide rich semantic features, which can help to improve the performance.
}
\end{enumerate}
Unless otherwise stated, we only apply the Co-Attention relation layer in the following experiments.
\subsection{Analysis} \label{sec:analysis}
Although achieving good performance, we would like to know the reason for the improvement. In this section, we study our model from several directions.
We first conduct several ablation experiments to analyze the effect of different components in our framework.
Next, we give a quantitative analysis to study how our proposed framework improves performance.
Finally, we provide a co-attention visualization to better understand how relation layer affects and contributes to the performance.
\subsubsection{Ablation}
In this section, we perform several ablation experiments in our framework on two datasets and the results are shown in Table~\ref{table:no_relation} .
The results demonstrate the effectiveness of different components of our framework to the final performance.
We give a detailed analysis in the following:
\begin{itemize}
\item \textbf{w/o relation layer:} In this settings, we conduct experiments on the multi-task framework where dialog act recognition and sentiment classification promote each other only by sharing parameters of the encoder,
which similar to \newcite{mastodon}.
From the result, we can see that 4.8\% drop in terms of F1 scores in sentiment classification while 2.6\% drops in dialog act recognition in Mastodon dataset.
In Dailydialog dataset, we can also observe the same trends that the F1 score drops a lot.
This demonstrates that explicitly modeling the strong relations between two tasks with relation layer can
benefit them effectively.
\begin{table}[t]
\centering
\begin{adjustbox}{width=0.45\textwidth}
\begin{tabular}{l|cc|cc}
\hline
\multirow{2}*{Model} & \multicolumn{2}{c|}{Mastodon} & \multicolumn{2}{c}{Dailydialog} \\
\cline{2-5}
~ & SC (F1) & DAR (F1) & SC (F1) & DAR (F1) \\
\hline
Full Model & 45.1 & 58.6 & 45.4 & 79.1 \\
\hline
w/o relation layer & 40.3 & 55.2 & 38.0 & 78.4 \\
w/o stacked relation layer & 42.5 & 57.4 & 42.1 & 78.5 \\
w/o self-attention & 43.2 & 57.3 & 42.1 & 77.2 \\
\ \ \ \ +CNN & 43.9 & 58.2 & 43.1 & 78.4 \\
\hline
\end{tabular}
\end{adjustbox}
\caption{Ablation study on Mastodon and Dailydialog test datasets.}
\label{table:no_relation}
\end{table}
\item \textbf{w/o stacked relation layer:} Here, we set the number of the stacked relation layer as 1 in our framework. From the result, we can see that performance drops in all metrics.
It indicates that stacked structure with multiple steps of interaction does better
model the semantic relation.
\item \textbf{w/o self-attention:} In this setting, we remove our self-attention layer and there is no hierarchical architecture to capture dialog-level context information.
The results show a significant drop in
performance, indicating that capturing the dialog-level context information by the hierarchical encoder is effective and important for dialog act recognition and sentiment classification.
In addition, we replace our self-attention with CNN \cite{kim-2014-convolutional} which can also model the dialog context information. The result is shown in the last row of Table~\ref{table:no_relation}.
We can see that CNN outperforms \textit{w/o self-attention} version and underperforms our full model, which further demonstrates the effectiveness of the dialog context information and self-attention mechanism.
\end{itemize}
\subsubsection{Quantitative Analysis}
In our DCR-Net model, we adopt the relation layer to model the interaction and relation between two tasks explicitly.
To better understand our model, we compare the DA and sentiment performance between DCR-Net
model and baseline without relation layer, as shown in Figure~\ref{fig:DA} and Figure~\ref{fig:sentiment}.
We choose several DA types with a large performance boost which are shown in Figure~\ref{fig:DA}.
From the results, we can see that our model yields significant improvements on the act type \texttt{Exclamation}, \texttt{Thanking}, \texttt{Agreement}, \texttt{Explicit Performative}.
We attribute the improvements to the fact that those acts are strong correlative with sentiment and our model can provide sentiment information explicitly for DAR rather than in an implicit method by sharing parameters.
Take the fourth utterance in Figure~\ref{fig:visual} for example, providing the current utterance \texttt{Negative} sentiment information explicitly and previous utterance sentiment \texttt{Negative} label can contribute to DA \texttt{Agreement} prediction, which demonstrates the effectiveness of our proposed framework.
In addition, from Figure~\ref{fig:sentiment}, we can observe that our model outperforms baseline in both positive and negative sentiment label.
We think that our relation layer can explicitly capture DA information which benefits sentiment classification task.
\begin{figure}[t]
\centering
\includegraphics[scale=0.5]{5400-act.pdf}
\caption{Quantitative analysis on different types of DA between our model with baseline.}
\label{fig:DA}
\end{figure}
\begin{figure}[t]
\centering
\includegraphics[scale=0.4]{5400-sentiment.pdf}
\caption{Quantitative analysis on different types of sentiments between our model with baseline.}
\label{fig:sentiment}
\end{figure}
\begin{figure*}[t]\label{visualization}
\centering
\includegraphics[scale=0.5]{5400-visiulation.pdf}
\caption{Co-Attention distribution score from the fifth utterance to the whole dialog utterances. The top is corresponding dialog context. The bottom left is the act-to-sentiment attention and the right is the sentiment-to-act attention. }
\label{fig:visual}
\end{figure*}
\subsection{Visualization of Co-Attention}
In this section, with the attempt to better understand what the model has learnt,
we visualized
the co-attention distribution among utterances in dialogues.
In particular,
we visualized the attention distribution of the fifth utterance corresponding to other utterances with the number of stacked relation layers varying from 1 to 6.
From Figure~\ref{fig:visual}, we can observe:
(1) the act-to-sentiment attention distribution score in the fourth utterance is larger than other utterances. This is due to that the fifth utterance is more related to the fourth utterance and the \texttt{Agreement} DA represents that current utterance agrees with the fourth utterance statement.
Similarly, we can see that sentiment-to-act attention
in the fourth utterance distribution score is also the largest compared to other utterances.
Those results demonstrate that our framework can correctly capture mutually important knowledge.
(2) Using deeper layers could generally lead to better performance, especially when the number of stacked layers is less than four. It is because the stacked relation layer can better model the relation between two tasks and learn mutual knowledge. When the number of stacked layers exceeds three, the experimental performance goes worse. We suggest that the reason might lie in the gradient vanishing or overfitting problem as the whole network goes deeper.
\section{Related Work}
In this section, we will introduce the related work about dialog act recognition, sentiment classification and the joint model for the two tasks.
\subsection{Dialog Act Recognition}
Recently, more and more neural networks have been propose to solve the DAR. \newcite{kalchbrenner2013recurrent} propose the hierarchical CNN to model the utterance sequence for DA classification.
\newcite{lee2016sequential} propose a model based on CNNs and RNNs which incorporated the previous utterance as context to classify the current DA and show the promising performance.
\newcite{ji2016latent} propose the latent variable recurrent neural network for jointly modeling sequences of words and discourse relations between adjacent sentences.
Furthermore, many work \cite{liu2017using,kumar2018dialogue,chen2018dialogue} explore different architectures to incorporate the context information for DAR.
\newcite{raheja-tetreault-2019-dialogue} propose the token-level self-attention mechanism for DAR and achieved state-of-the-art performance.
\subsection{Sentiment Classification}
Sentiment classification in dialog system can be seen as the sentence-level sequence classification problem.
One series of works are based on CNN \cite{zhang2015character,conneau-etal-2017-deep,johnson-zhang-2017-deep} to capture the local correlation and position-invariance.
Another series of works adopt RNN based models \cite{tang-etal-2015-document,yang-etal-2016-hierarchical,xu-etal-2016-cached} to leverage temporal features and contextual information to perform sentence classification.
Besides, Some works \cite{xiao2016efficient,shi-etal-2016-deep,wang-2018-disconnected} attempt to combine the advantages of CNN and RNN for sentence classification.
\subsection{Joint Model}
Considering the correlation between dialog act recognition and sentiment classification, joint models are proposed to solve two tasks simultaneously in a unified framework.
\newcite{mastodon} explore the multi-task framework to model the correlation between the two tasks.
Compared with their model, we propose a relation layer to explicitly model the correlation between dialog act recognition and sentiment classification while they model in an implicit way simply by sharing parameters.
Specifically, our relation layer can be stacked to capture mutual knowledge sufficiently.
\newcite{kim2018integrated} propose an integrated
neural network model for identifying dialog act, predicators, and sentiments of dialogue utterances.
Their framework classifies the current dialog act only considering the last time dialog act results, which can not make full use of context information, while we adopt the hierarchical encoder with utterance-level self-attention to leverage context information.
In addition, their model does not model the sentiment information for dialog act while our framework considers interaction and mutual relation between two tasks.
\section{Conclusion}
This paper focuses on explicitly establishing the bi-directional interrelated connections for dialog act recognition and sentiment information.
We propose a deep relation network to jointly model the interaction and relation between the two tasks, which adopts a stacked co-interactive relation layer to incorporate mutual knowledge explicitly.
In addition, we explore three different relation layers and make a thorough study on their effects on the two tasks.
Experiments on two datasets show the effectiveness of the proposed models and achieve the state-of-the-art performance.
Extensive analysis further confirms the correlation between two tasks and reveals that modeling the relation explicitly can boost their performance.
Besides, we analyze the effect of incorporating strong pre-trained BERT model in our joint model. With BERT, the result reaches a new state-of-the-art level.
\section{Acknowledgments}
We thank the anonymous reviewers for their helpful comments and suggestions.
This work was supported by the National Natural Science Foundation of China (NSFC) via grant 61976072, 61632011 and 61772153.
| {'timestamp': '2020-08-18T02:17:54', 'yymm': '2008', 'arxiv_id': '2008.06914', 'language': 'en', 'url': 'https://arxiv.org/abs/2008.06914'} | arxiv |
\section{Introduction}\label{sec:introduction}
Multi-agent planning is one of the fundamental research problems in multi-agent systems \cite{desJardins99,Ye17}.
Multi-agent planning research aims to improve agents' working efficiency by making plans in advance.
Research into collaborative multi-agent planning largely focuses on jointly automated planning \cite{Torreno17}.
During jointly automated planning, agents have to share information.
However, this kind of information sharing often results in the leaking of agents' private information.
Accordingly, to protect agents' privacy, privacy preservation is introduced into the collaborative multi-agent planning process~\cite{Shani18,Shekhar20}.
The main problem associated with privacy preservation in collaborative multi-agent planning is that of how to make plans for agents
while also preserving the privacy of each agent.
Privacy can be roughly classified into four levels:
weak privacy, strong privacy, object cardinality privacy, and agent privacy \cite{Torreno17}.
Strong privacy means that an agent, regardless of its reasoning power, cannot deduce the private information of other agents based on the information available to it.
Developing a planning method with strong privacy in distributed and communication-constrained environments is challenging for the following two reasons.
First, it is difficult to achieve strong privacy, completeness and efficiency simultaneously \cite{Tozicka17}.
Second, in communication-constrained environments, each agent is allowed to communicate only a limited number of times.
These two challenges are widespread in many real-world applications.
A typical application is military logistics.
In military logistics, it is vital that each military unit should strongly protect its private and sensitive facts.
Also, plans for military units must be complete and efficient to avoid any delay.
In addition, communication between units has to be constrained,
since the more communication takes place, the more likely it will be that sensitive information is leaked.
Most existing planning approaches are either weak privacy-preserving or overlook the issue of privacy preservation entirely \cite{Torreno17}.
Very few approaches are strong privacy-preserving \cite{Brafman15}.
These strong privacy-preserving planning approaches, however,
may not achieve strong privacy, completeness and efficiency simultaneously, as summarized in \cite{Tozicka17}.
Moreover, these approaches also may not work efficiently in distributed and communication-constrained environments,
as they implicitly assume that an agent can communicate directly with all other agents,
and overlook the analysis of communication overhead.
Accordingly, in this paper, we develop a novel strong privacy-preserving planning approach for distributed and communication-constrained environments.
Our approach focuses primarily on logistic-like problems,
which are typically used as running examples in multi-agent planning.
To achieve strong privacy, completeness and efficiency simultaneously,
we adopt the differential privacy technique.
Differential privacy is a promising privacy model,
which has been mathematically proven that
when this model is in use, an individual record being stored in or removed from a dataset makes little difference to the analytical output of the dataset \cite{Dwork06,Zhu17}.
To the best of our knowledge,
we are the first to apply differential privacy to the privacy-preserving planning problem.
Using a differential privacy mechanism to obfuscate an agent's private information can strongly preserve the agent's privacy
while also having minimal impact on the usability of the agent's private information.
Furthermore, we also address the communication-constrained environment issue by adopting the concept of a `privacy budget'.
In differential privacy, a privacy budget is applied to control privacy levels.
In our proposed approach, the privacy budget can naturally be used to control communication overhead,
with the result that only a limited number of messages are permitted during a planning phase.
In summary, the contributions of this paper are two-fold:
\begin{enumerate}
\item Improving upon existing strong privacy-preserving planning approaches,
our approach can achieve strong privacy, completeness and efficiency simultaneously in logistic-like problems using the differential privacy technique.
\item Our approach is more applicable to distributed and communication-constrained logistic-like problems than existing approaches.
\end{enumerate}
The remainder of this paper is organized as follows.
In the next section, a detailed review of related work is presented.
Then, a motivating example is given in Section \ref{sec:motivation example}.
Preliminaries are presented in Section \ref{sec:preliminaries}.
After that, the novel planning approach and the theoretical analysis are presented in Sections \ref{sec:method} and \ref{sec:theoretical analysis}, respectively.
The application of our approach to other domains is illustrated in Section \ref{sec:application}.
Next, the experimental results are provided in Section \ref{sec:experiment}.
Finally, Section \ref{sec:conclusion} concludes this paper.
\section{Related Work}\label{sec:related work}
\subsection{Weak privacy-preserving approaches}
Torreno et al. \cite{Torreno14} develop a framework known as FMAP (forward multi-agent planning).
In FMAP, agents maintain a common open list with unexplored refinement plans.
Agents then jointly select an unexplored refinement plan.
Each agent then expands the plan using a forward-chaining procedure.
Agents exchange these plans and use a distributed heuristic approach to evaluate them.
Later, based on the FMAP framework, Torreno et al. \cite{Torreno15} develop a set of global heuristic functions:
DTG (domain transition graphs) heuristic and landmarks heuristic, in order to improve the efficiency of the FMAP framework.
Stolba and Komenda \cite{Stolba17} present a multi-agent distributed and local asynchronous (MADLA) planner.
This planner adopts a distributed state-space forward-chaining multi-heuristic search.
The multi-heuristic search takes the advantages of both local and distributed heuristic searches by combining them together.
As a result, the combination of the two heuristics outperforms the two heuristics separately.
Maliah et al. \cite{Maliah17} propose a greedy privacy-preserving planner (GPPP).
In GPPP, agents collaboratively generate an abstract global plan
based on two privacy-preserving heuristics: landmark-based heuristic and privacy-preserving pattern database heuristic.
Each agent generates a local plan by extending the global plan.
\subsection{Strong privacy-preserving approaches}
Brafman \cite{Brafman15} is the first to theoretically prove strong privacy in multi-agent planning.
He proposes an approach referred to as Secure-MAFS (secure multi-agent forward search).
Secure-MAFS extends the MAFS approach \cite{Nissim14}
by reducing the amount of information exchanged between agents.
In Secure-MAFS, agents protect their privacy by opting not to communicate a given two states to others
if these two states differ only in their private elements.
This is because other agents could possibly deduce private information through the non-private or public part of the states.
Tozicka et al. \cite{Tozicka17} investigate the limits of strong privacy-preserving planning.
They formulate three aspects of strong privacy-preserving planning: privacy, completeness, and efficiency.
They theoretically find that these three aspects are difficult to achieve at the same time for a wide class of planning algorithms.
Also, they develop a strong privacy-preserving planner
that embodies a family of planning algorithms.
The planner is based on private set intersection,
which has been proven to be computationally secure.
Stolba et al. \cite{Stolba16a,Stolba16b,Stolba18} refine privacy metrics by quantifying the amount of privacy loss.
In this case, their analysis of privacy loss is conducted by assessing information leakage \cite{Braun09,Smith09}.
The amount of information leakage is measured as the difference between initial uncertainty and remaining uncertainty.
They also develop a general approach to compute the privacy loss of search-based multi-agent planners.
This computation is based on search tree reconstruction and classification of leaked information pertaining to the applicability of actions.
\tianqing{if we did not touch object cardinality and agent privacy preservatin, we can use a subsection titled other privacy preserving approachs}
\dayong{done}
\subsection{Other privacy-preserving approaches}
Some other existing works seem to be related to ours,
such as differentially private networks \cite{Fioretto19} and privacy-preserving distributed constraint optimization \cite{Yeoh12}.
However, the research aims of these works differ from ours.
The research of differentially private networks mainly aims at hiding specific information contained in a network,
which may be disclosed by answering queries regarding that network.
By contrast, multi-agent privacy-preserving planning aims at collaboratively making plans
without revealing the private facts of each participating agent.
In \cite{Kasi13}, Kasiviswanathan et al. develop a set of node-differentially private algorithms to engage in the private analysis of network data.
The key concept here is to obfuscate the input graph onto the set of graphs with maximum degree below a certain threshold.
Blocki et al. \cite{Blocki13} improve accuracy in differentially private data analysis
by introducing the notion of restricted sensitivity in order to reduce noise.
Restricted sensitivity represents the sensitivity of a query only over a specific subset of all possible networks.
Proserpio et al. \cite{Proserpio14} propose a platform for differentially private data analysis: wPINQ (weighted Privacy Integrated Query).
wPINQ treats edges as a weighted dataset
on which it performs $\epsilon$-differentially private computations,
such as manipulation of records and their weights.
Thus, the presence or absence of individual edges can be masked.
Fioretto et al. \cite{Fioretto19} design a privacy-preserving obfuscation mechanism for critical infrastructure networks.
Their mechanism consists of three phases: 1) obfuscating the locations of nodes using the exponential mechanism,
2) obfuscating the values of nodes using the Laplace mechanism,
and 3) redistributing the noise introduced in the previous two phases using a bi-level optimization problem.
These works assume the existence of adversaries
while in multi-agent planning, agents are typically assumed to be honest but curious.
Research into privacy-preserving distributed constraint optimization aims at
securely coordinating the value assignment for the variables under a set of constraints in order to optimize a global objective function \cite{Fioretto18b}.
By contrast, multi-agent privacy-preserving planning aims at securely making plans that enable individual agents to achieve their goals.
Grinshpoun and Tassa \cite{Grin14} devise a novel distributed constraint optimization problem (DCOP) algorithm that preserves constraint privacy.
In their problem, a group of agents needs to compare the sum of private inputs possessed by those agents against an upper bound held by another agent.
During this comparison, none of these agents learns information on either the sum or the private inputs of other agents.
Their algorithm accomplishes this through the use of a secure summation protocol and a secure comparison protocol.
Tassa et al. \cite{Tassa19} propose a DCOP algorithm that is immune to collusion
and offers constraint, topology and decision privacy.
To achieve this goal, they adopt a secure multi-party computation protocol \cite{Ben17}
which is capable of securely comparing the cost of the current full assignment and the upper bound
and guaranteeing the security of collusion of up to half of the total agents.
From an examination of the two above-mentioned works, it can be seen that
the privacy-preserving DCOP mainly focuses on securely comparing the values of variables against an upper bound,
while multi-agent privacy-preserving planning mainly focuses on the secure computation of each individual agent.
\section{A Motivating Example}\label{sec:motivation example}
\begin{figure}[ht]
\centering
\includegraphics[scale=0.28]{overview.pdf
\caption{An example of a logistic map}
\label{fig:example}
\end{figure}
Fig. \ref{fig:example} presents a military logistic map.
In this map, a circle denotes a military base while a rectangle denotes a logistic center.
The lines connecting the bases and logistic centers are routes.
Each route has a length, which is not indicated on the map in the interests of clarity.
Each letter in a circle indicates a military unit's name,
while each number in a circle is the index of a base in the military unit's local area.
For example, `$(a,3)$' denotes the third base in military unit $a$'s local area.
Six military units are included on this map: $a$, $b$, $c$, $d$, $e$, and $f$.
Each unit exclusively operates in a local area of the map.
Information about a local area is private to the corresponding military unit.
\tianqing{what is specific area? a,or a,3, or 3? }
This information includes 1) the number of military bases in this local area,
2) the number of routes in this local area,
3) the length of these routes in this local area,
and 4) the positions of packages in this local area.
However, information regarding whether a given package is or is not located in a particular logistic center is public.
For example, in Fig. \ref{fig:areaA}, we extract military unit $a$'s local area from Fig. \ref{fig:example}.
In Fig. \ref{fig:areaA}, there are five bases: $(a,1)$, $(a,2)$, $(a,3)$, $(a,4)$ and $(a,5)$.
The number of these bases and routes is private to military unit $a$.
Moreover, the length of these routes is also private to unit $a$.
As noted above, the information that a package is located in logistic center $A$ is public and known to all military units.
\tianqing{you have to use example of depict each items, for example, it seems that you did not define distance in this area, nor topology}
\dayong{An example has been added to explain these things.}
\begin{figure}[ht]
\centering
\includegraphics[scale=0.18]{areaA.pdf
\caption{Unit $a$'s local area}
\label{fig:areaA}
\end{figure}
The problem in this example is as follows:
how should a plan be made for a military unit to transport a package from one base to another,
while strongly preserving each military unit's privacy?
For example, unit $a$ wants to transport a package from $(a,2)$ to $(f,4)$, but $(f,4)$ is located in military unit $f$'s local area.
Thus, multiple units must collaborate to make a plan to deliver the package,
while each unit's privacy is required to be strongly preserved during this process.
This problem therefore includes the above-mentioned two challenges.
First, planning for military units is highly expected to achieve strong privacy, completeness and efficiency simultaneously,
especially when military units are involved in a war.
Second, the communication of each military unit may be constrained,
as increased level of communication may result in a higher chance of private information being leaked \cite{Niu18}.
As the above two challenges have not been adequately addressed by existing approaches,
these approaches may not be suitable for this environment.
Accordingly, in this paper, a novel strong privacy-preserving planning approach is proposed
that takes these two challenges into account.
\section{Preliminaries}\label{sec:preliminaries}
\subsection{The planning model}\label{sub:planning}
We propose a multi-agent planning model, Graph-STRIPS,
which is based on a widely used privacy-aware planning model, MA-STRIPS \cite{Brafman08}.
Graph-STRIPS is defined by a 12-tuple:
$\langle\mathcal{AG},\mathcal{V},\{\mathcal{V}_i\}_{i=1}^m,\mathcal{V}_{Pub},\mathcal{E},\{\mathcal{E}_i\}_{i=1}^m,\mathcal{P},\{\mathcal{P}_i\}_{i=1}^m,$
$\mathcal{A},\{\mathcal{A}_i\}_{i=1}^m,\mathcal{I},\mathcal{G}\rangle$:
\begin{itemize}
\item $\mathcal{AG}$ is a set of agents in the environment;
\item $\mathcal{V}$ is a set of nodes (e.g., physical entities) in the environment;
\item $\mathcal{V}_i$ is the set of nodes private to agent $i$;
\item $\mathcal{V}_{Pub}$ is the set of public nodes in the environment, $\mathcal{V}_{Pub}=\mathcal{V}-\cup^{|\mathcal{AG}|}_{l=1}\mathcal{V}_l$;
\item $\mathcal{E}$ is a set of edges (e.g., the relationships between physical entities) in the environment;
\item $\mathcal{E}_i$ is the set of edges private to agent $i$;
\item $\mathcal{P}$ is a set of possible facts about the environment;
\item $\mathcal{P}_i$ is the set of private facts of agent $i$;
\item $\mathcal{A}$ is a set of possible actions of all the agents;
\item $\mathcal{A}_i$ is the set of private actions of agent $i$;
\item $m$ is the number of agents in the environment;
\item $\mathcal{I}$ is the initial state of the environment;
\item $\mathcal{G}$ is the goal state.
\end{itemize}
For example, in Fig. \ref{fig:example}, each military unit is modelled as an agent.
In this case, we have the following:
\begin{itemize}
\item $\mathcal{AG}=\{a,b,c,d,e,f\}$ and $m=6$;
\item $\mathcal{V}$ is the set of military bases and logistic centers;
\item $\mathcal{V}_i$ denotes the set of bases in the local area of agent $i$;
for example, in agent $a$'s local area, $\mathcal{V}_a=\{(a,1),(a,2),(a,3),(a,4),(a,5)\}$;
\item $\mathcal{V}_{Pub}$ denotes the set of logistic centers;
\item $\mathcal{E}$ is the set of routes connecting bases and centers;
\item $\mathcal{E}_i$ denotes the set of routes in the local area of agent $i$;
for example, in agent $a$'s local area, $\mathcal{E}_a=\{(a,1)\sim(a,2),(a,2)\sim(a,3),(a,3)\sim(a,4),...\}$;
\item $\mathcal{P}$ includes the position of bases, logistic centers and packages;
\item $\mathcal{P}_i$ includes 1) the position of packages in the local area of agent $i$;
for example, if agent $a$ has a package in $(a,1)$, then $\mathcal{P}_a=\{package\_in\_(a,1)\}$;
2) the number of bases in the local area of agent $i$;
3) the number of routes in the local area of agent $i$
and 4) the length of these routes.
\item $\mathcal{A}$ includes the actions of moving from a base or a logistic center to another base or logistic center;
\item $\mathcal{A}_i$ includes the actions of moving from a base or a logistic center to another base or logistic center in the local area of agent $i$;
for example, an action of agent $a$ can be: \emph{moving from $(a,1$) to $(a,2)$} which is abbreviated as $(a,1)\rightarrow (a,2)$,
where the pre-condition of this action is $package\_in\_(a,1)$ and the effect of this action is $package\_in\_(a,2)$;
\item If $a$ wants to transport a package from $(a,3)$ to $(e,2)$,
then $\mathcal{I}=\{package\_ in\_ (a,3)\}$ and $\mathcal{G}=\{package\_ in\_ (e,2)\}$:
$\mathcal{V}_{\mathcal{I}}=(a,3)$ and $\mathcal{V}_{\mathcal{G}}=(e,2)$.
\end{itemize}
If agent $a$ is to transport a package from $(a,3)$ to $(e,2)$, the associated plan could be
$\Pi^{\rhd}_a=\langle\mathcal{V}_{\mathcal{I}}\rightarrow (a,4),(a,4)\rightarrow A, A\rightarrow B, B\rightarrow E, E\rightarrow\mathcal{V}_{\mathcal{G}}\rangle$.
In plan $\Pi^{\rhd}_a$, the details of how to move from $A$ to $B$, from $B$ to $E$ and from $E$ to $(e,2)$ are not included,
as these details involve other agents' private information
that is unknown to agent $a$.
In fact, as $(e,2)$ is private to agent $e$,
agent $a$ is unaware of the existence of $(e,2)$.
Agent $a$, however, knows that the destination is in agent $e$'s local area.
Specifically, each agent’s private information includes two parts: private facts and private actions.
An agent’s private facts include four components: 1) the number of nodes in its local area, i.e., the number of military bases in the logistic example,
2) the number of edges in its local area, i.e., the number of routes in the logistic example,
3) the length of these edges, i.e., the length of routes in the logistic example and
4) the positions of any items in its local area, i.e., the positions of packages in the logistic example.
An agent’s private actions are the movements of items in its local area.
In this private information, the positions and movements of items are not required by other agents.
Thus, these two pieces of information will not be disclosed to other agents.
For the other three pieces of information: the number of nodes, the number of edges and the length of edges,
since agents have to share the three pieces of information for planning,
we need to develop a privacy-preserving mechanism to protect them.
Formally, we have the following definition
\begin{definition}[Agents' privacy]\label{def:privacy}
An agent $i$'s privacy is defined as a 3-tuple: $\langle \mathcal{V}_i,\mathcal{E}_i,L(\mathcal{E}_i)\rangle$,
where $\mathcal{V}_i$ is the set of nodes in agent $i$’s local area,
$\mathcal{E}_i$ is the set of edges and $L(\mathcal{E}_i)$ denotes the set of length of the edges.
\end{definition}
To protect the privacy of $\mathcal{V}_i$ and $\mathcal{E}_i$,
we adopt the node-differential privacy technique
and uses the Laplace mechanism to mask the number of both nodes and edges.
To protect the privacy of $L(\mathcal{E}_i)$, we adopt the exponential mechanism along with a reinforcement learning algorithm.
\subsection{Privacy-preserving multi-agent planning}\label{sub:PPMAP}
The idea behind privacy-preserving multi-agent planning is based mainly on
research in the field of secure multi-party computation \cite{Zhao19},
where multiple agents jointly compute a function
while each agent possesses private input data.
The goal is to compute the function without revealing agents' private input data.
One intuitive solution would be to simply not disclose any private information to others.
However, since an agent must collaborate with other agents in order to achieve its goals,
it is infeasible to hide all private information completely.
To ensure that this private information is disclosed securely to the other agents,
it is necessary to use privacy-preserving techniques.
\begin{definition}[Strong Privacy \cite{Torreno17}]\label{def:strong}
A multi-agent planning approach is strong privacy-preserving
if none of the agents is able to infer any private facts regarding an agent’s tasks
from the public information it obtains during planning.
\end{definition}
In this paper, we adopt differential privacy,
which is one of the most promising techniques in this field \cite{Dwork06}, to achieve strong privacy.
In addition to a privacy guarantee, a planning approach also needs soundness and completeness guarantees.
\begin{definition}[Soundness \cite{Maliah17}]
A planning approach is sound iff, for a given task,
there is at least one valid plan
followed by all participating agents to reach the goal state.
\end{definition}
\begin{definition}[Completeness \cite{Tozicka17}]
A planning approach is complete iff, for a given task,
1) the approach is sound and
2) the approach can guarantee to create a valid plan.
\end{definition}
\tianqing{did we use below privacies? if not, we do not need to include those definitions.}
\dayong{I have removed them.}
\subsection{Differential privacy}\label{sub:DP}
Differential privacy (DP) can guarantee that
any individual record being stored in or removed from a dataset will make little difference to the analytical output of the dataset \cite{Dwork06,Zhu18}.
DP has already been successfully applied to agent advising \cite{Ye19,Zhu19} and model publishing \cite{Zhu18b,Zhang20}.
Therefore, this property may also be suitable for application to the planning problem.
In differential privacy, two datasets $D$ and $D'$ are deemed neighboring datasets if they differ in only one record.
A query $f$ is a function that maps dataset $D$ to an abstract range $\mathbb{R}$: $f: D\rightarrow\mathbb{R}$.
The goal of differential privacy is to mask the differences in the answers to query $f$ between the neighboring datasets.
In $\epsilon$-differential privacy, parameter $\epsilon$ is defined as the privacy budget,
which controls the privacy guarantee level of mechanism $\mathcal{M}$.
A smaller $\epsilon$ represents stronger privacy.
The formal definition of $\epsilon$-differential privacy is as follows:
\begin{definition}[$\epsilon$-Differential Privacy \cite{Dwork14}]\label{Def-DP}
A mechanism $\mathcal{M}$ gives $\epsilon$-differential privacy for any input pair of neighboring datasets $D$ and $D'$,
and for any possible output set $\Omega$, if $\mathcal{M}$ satisfies:
\begin{equation}
Pr[\mathcal{M}(D) \in \Omega] \leq \exp(\epsilon) \cdot Pr[\mathcal{M}(D') \in \Omega]
\end{equation}
\end{definition}
In Definition \ref{Def-DP}, mechanism $\mathcal{M}$ is a function
that takes a dataset as input and outputs a query result.
Definition \ref{Def-DP} states that if a mechanism,
applied on two neighboring datasets, can obtain very similar results,
then this mechanism is a differential privacy mechanism.
Sensitivity is a parameter that captures the magnitude by which a single individual's data can change the function $f$ in the worst case.
\begin{definition}[Sensitivity \cite{Dwork14}]\label{Def-GS} For a query $f:D\rightarrow\mathbb{R}$, the sensitivity of $f$ is defined as
\begin{equation}
\Delta S=\max_{D,D'} ||f(D)-f(D')||_{1}
\end{equation}
\end{definition}
Two of the most widely used differential privacy mechanisms are the Laplace mechanism and the exponential mechanism.
The Laplace mechanism adds Laplace noise to the true answer.
We use $Lap(b)$ to represent the noise sampled from the Laplace distribution with scaling $b$.
\begin{definition}[Laplace mechanism \cite{Dwork14}]\label{Def-LA}
Given a function $f: D \rightarrow \mathbb{R}$ over a dataset $D$, Equation~\ref{eq-lap} is the Laplace mechanism
that provides the $\epsilon$-differential privacy \cite{Dwork14}.
\begin{equation}\label{eq-lap}
\widehat{f}(D)=f(D)+Lap(\frac{\Delta S}{\epsilon})
\end{equation}
\end{definition}
\begin{definition}[The Exponential Mechanism \cite{Dwork14}]\label{Def-Ex}
The exponential mechanism $\mathcal{M}_E$ selects and outputs an element $r\in\mathcal{R}$
with probability proportional to $exp(\frac{\epsilon u(D,r)}{2\Delta u})$,
where $u(D,r)$ is the utility of a pair of dataset and output,
and $\Delta u=\max\limits_{r\in\mathcal{R}} \max\limits_{D,D':||D-D'||_1\leq 1} |u(D,r)-u(D',r)|$
is the sensitivity of utility.
\end{definition}
If a graph is treated as a dataset, a given node in the graph can be interpreted as a record in the dataset.
According to Definition \ref{Def-DP}, we can have a similar definition for $\epsilon$-node-differential privacy as follows.
\begin{definition}[$\epsilon$-node-Differential Privacy \cite{Rask15}]\label{Def-DP-node}
A mechanism $\mathcal{M}$ gives $\epsilon$-node-differential privacy for any input pair of neighboring graphs $G$ and $G'$,
where $G$ and $G'$ differ by at most one node,
and for any possible output set, $\Omega$, if $\mathcal{M}$ satisfies:
\begin{equation}
Pr[\mathcal{M}(G) \in \Omega] \leq \exp(\epsilon) \cdot Pr[\mathcal{M}(G') \in \Omega]
\end{equation}
\end{definition}
Node-differential privacy guarantees similar output distributions on any pair of neighboring graphs
that differ in one node and the edges adjacent to that node.
Thus, the privacy of both nodes and edges can be preserved.
\section{The strong privacy-preserving planning approach}\label{sec:method}
In this section, we first outline our approach in a general form,
then use the aforementioned logistic example to instantiate our approach.
A generalized form of our approach is presented in Algorithm \ref{alg:general}.
In Line 5 of Algorithm \ref{alg:general}, agent $i$ takes all the available public nodes into account to create a plan.
These available public nodes are on the way from the initial state to the goal state
and found by agent $i$ during its searching phase.
However, some of these available public nodes are not needed in the final plan.
Then, in Line 8, agent $i$ uses a reinforcement learning algorithm to find the shortest route from the initial state to the goal state,
and selects the public nodes on the shortest route to create a plan.
The learning is based on the information obtained in Lines 6 and 7.
\begin{algorithm}
\caption{The general form of our approach}
\label{alg:general}
/*Take agent $i\in\mathcal{AG}$ as an example;*/\\
\textbf{Input}: agent $i$'s local sets: $\mathcal{V}_i$, $\mathcal{E}_i$, $\mathcal{P}_i$, $\mathcal{A}_i$,
and all the public facts and actions;
also, the initial state $\mathcal{I}$ and the goal state $\mathcal{G}$;\\
\textbf{Output}: a complete plan $\Pi^{\rhd}_i$ from $\mathcal{I}$ to $\mathcal{G}$;\\
Agent $i$ identifies $\mathcal{V}_{\mathcal{I}}$ and $\mathcal{V}_{\mathcal{G}}$ from the initial state $\mathcal{I}$ and the goal state $\mathcal{G}$, respectively,
and initializes plan: $\Pi^{\rhd}_i=\langle \mathcal{V}_{\mathcal{I}}\rightarrow\mathcal{V}_{\mathcal{G}}\rangle$;\\
Agent $i$ searches the goal state,
and details plan $\Pi^{\rhd}_i$ by adding the available public actions into plan $\Pi^{\rhd}_i$:
$\Pi^{\rhd}_i=\langle \mathcal{V}_{\mathcal{I}}\rightarrow v_j,...,v_k\rightarrow\mathcal{V}_{\mathcal{G}}\rangle$,
where $\{v_j,...,v_k\}\subset\mathcal{V}_{Pub}$;\\
Agent $i$ queries the intermediate agents to request local private facts;\\
Each of these intermediate agents obfuscates its local private facts using the differential privacy technique;\\
Agent $i$ uses the obfuscated facts to refine the plan
by removing unnecessary public actions by means of a reinforcement learning algorithm:
$\Pi^{\rhd}_i=\langle \mathcal{V}_{\mathcal{I}}\rightarrow v_x,...,v_y\rightarrow\mathcal{V}_{\mathcal{G}}\rangle$,
where $j\leq x,y\leq k$;\\
Each action in plan $\Pi^{\rhd}_i$ is further refined by each agent creating a local plan;
for example, action $\mathcal{V}_{\mathcal{I}}\rightarrow v_x$ is refined by agent $i$ creating a local plan
as $\langle\mathcal{V}_{\mathcal{I}}\rightarrow v_{i_a},...,v_{i_b}\rightarrow v_x\rangle$,
where $\{v_{i_a},...,v_{i_b}\}\subset\mathcal{V}_i$;\\
Agent $i$ merges these local plans to form a complete plan:
$\Pi^{\rhd}_i=\langle\mathcal{V}_{\mathcal{I}}\rightarrow v_{i_a},...,v_{i_b}\rightarrow v_x,...,v_y\rightarrow\mathcal{V}_{\mathcal{G}}\rangle$;
note that the details of local plans, created by intermediate agents, are not shown in plan $\Pi^{\rhd}_i$,
since they contain non-obfuscated private facts belonging to the intermediate agents;\\
\end{algorithm}
To instantiate this general approach, we use the logistic example given in Section \ref{sec:motivation example}.
In this example, we assume that 1) all routes in the logistic map are bi-directional;
2) each individual agent controls only one local area;
and 3) there are no isolated nodes on the map.
An agent follows three steps to create a plan:
\begin{itemize}
\item Step 1: the agent creates a high-level logistic map;
\item Step 2: the agent asks the agents in the intermediate areas to provide route and map information;
\item Step 3: the agent uses the received information to create a complete plan.
\end{itemize}
\subsection{Step 1: Creating a high-level map}
In Fig. \ref{fig:example}, it is supposed that agent $a$ has a package to transport from $(a,2)$ to $(f,4)$.
As agent $f$ is not agent $a$'s neighbor,
$a$ must query its neighbors, $b$, $c$, and $d$, regarding the position of $f$.
Two agents are deemed neighbors if there is at least one logistic center connecting two military bases,
such that one of these bases belongs to each of the agents.
In the case that agents, $b$, $c$ and $d$, also do not have $f$ as a neighbor,
they pass this query on to their neighbors, e.g., agent $e$.
Finally, agent $f$ is found through agent $e$.
By using the information acquired while finding agent $f$,
agent $a$ can create a high-level logistic map, as shown in Fig. \ref{fig:exampleHighLevel}.
\begin{figure}[ht]
\centering
\includegraphics[scale=0.25]{exampleHighLevel.pdf
\caption{A high-level logistic map from agent $a$'s perspective}
\label{fig:exampleHighLevel}
\end{figure}
\subsection{Step 2: Each intermediate agent provides map and route information}\label{sub:Step2}
After creating the high-level map,
agent $a$ asks the agents in the intermediate areas to provide route and map information.
In Fig. \ref{fig:exampleHighLevel}, the intermediate agents are $b$, $c$, $d$ and $e$.
To protect the topological privacy of local maps, each intermediate agent uses the Laplace mechanism
to obfuscate its local map, i.e., modify the number of bases and routes.
Moreover, to protect length privacy,
each intermediate agent uses the exponential mechanism, along with a reinforcement learning algorithm,
to assign probability distributions over the routes on its obfuscated local map
while removing the distance information.
Finally, each intermediate agent presents an obfuscated local map, with probability distributions over routes, to agent $a$.
An example explaining this process is presented below.
\begin{figure}[ht]
\begin{minipage}{0.48\textwidth}
\subfigure[\scriptsize{Before using DP}]{
\includegraphics[scale=0.40]{beforeDP.pdf
\label{fig:beforeDP}}
\subfigure[\scriptsize{After using DP}]{
\includegraphics[scale=0.40]{afterDP.pdf}
\label{fig:afterDP}}\\[2ex]
\subfigure[\scriptsize{After route calculation}]{
\includegraphics[scale=0.40]{afterCalculation.pdf}
\label{fig:afterCalculation}}
\subfigure[\scriptsize{After probability redistribution}]{
\includegraphics[scale=0.40]{afterRedistribution.pdf}
\label{fig:afterRedistribution}}
\end{minipage}
\caption{Obfuscation of agent $b$'s local map}
\label{fig:transfer}
\end{figure}
In this example, Fig. \ref{fig:beforeDP} is agent $b$'s local map with route length.
Fig. \ref{fig:afterDP} is agent $b$'s obfuscated local map.
Referring to the obfuscated local map,
agent $b$ calculates the shortest route between logistic centers $A$ and $B$.
Then, agent $b$ marks the probability distributions over the routes, as shown in Fig. \ref{fig:afterCalculation}.
Each probability on a route indicates the probability of that route being selected.
To guarantee the route length privacy, agent $b$ uses the exponential mechanism to redistribute these probabilities over the routes,
as shown in Fig. \ref{fig:afterRedistribution}.
Agent $b$ then sends Fig. \ref{fig:afterRedistribution} to agent $a$.
Finally, agent $a$ receives a map
where the topology has been obfuscated
and the distance information has been replaced by probability distributions.
\subsubsection{Using the Laplace mechanism to obfuscate topologies}
The Laplace mechanism is applied to the statistical information contained in a map.
We utilize a $1K$-distribution \cite{Maha06} to obtain the statistical information.
More specifically, the $1K$-distribution is used to calculate the node degree distribution of a given graph.
To describe how the $1K$-distribution is utilized for this purpose, we employ the following example.
In Fig. \ref{fig:beforeDP}, the number of nodes with $1$ degree is $0$;
the number of nodes with $2$ degrees is $4$, (i.e., nodes $A$, $B$, $(b,4)$ and $(b,5)$);
the number of nodes with $3$ degrees is $2$, (i.e., nodes $(b,2)$ and $(b,3)$);
and the number of nodes with $4$ degrees is $1$, (i.e., node $(b,1)$).
Thus, the $1K$-distribution, i.e., the node degree distribution, of Fig. \ref{fig:beforeDP} is:
$P(1)=0$, $P(2)=4$, $P(3)=2$, and $P(4)=1$.
\begin{algorithm}
\caption{The Laplace mechanism-based obfuscation}
\label{alg:DP}
/*Take agent $b$ as an example*/\\
\textbf{Input}: agent $b$'s map (Fig. \ref{fig:beforeDP});\\
\textbf{Output}: agent $b$'s obfuscated map (Fig. \ref{fig:afterDP});\\
Use $1K$-distribution to obtain the statistical information of $b$'s map;\\
\For{$k=1$ to $d_{max}$}{
$\tilde{P}(k)\leftarrow P(k)+\lceil Lap(\frac{\Delta S\cdot d_{max}}{\epsilon})\rceil$;\\
}
Rewire nodes to satisfy each $\tilde{P}(k)$;\\
\end{algorithm}
The Laplace mechanism-based obfuscation is outlined in Algorithm \ref{alg:DP}.
In Line 4, the statistical information of $b$'s map is obtained using the $1K$-distribution.
In Lines 5-6, the Laplace noise is added to each $P(k)$ in order to randomize the node degree distribution;
accordingly the number of nodes now becomes $\sum_{1\leq k\leq d_{max}}\tilde{P}(k)$.
Here, $d_{max}$ is the maximum node degree in a map,
and $d_{max}=4$ in the example of Fig. \ref{fig:beforeDP}.
After adding Laplace noise,
the node degree distribution could be as follows: $\tilde{P}(1)=1$, $\tilde{P}(2)=2$, $\tilde{P}(3)=5$, and $\tilde{P}(4)=0$.
Next, in Line 7, nodes are rewired to satisfy each $\tilde{P}(k)$, where $k\in\{1,...,d_{max}\}$.
The node rewiring is carried out using the graph model generator provided in \cite{Maha06}.
After node rewiring is complete, fake routes may be introduced, such as route $A\rightarrow (b,6)$ in Fig. \ref{fig:afterDP}.
The length of a fake route is randomly generated based on the average length of the existing real routes.
The reason why the Laplace mechanism is used here is that
our aim is to obfuscate the topology of each agent’s local map by modifying the degree distribution.
Since a degree distribution consists of a set of numbers,
the Laplace mechanism is more appropriate here than the exponential mechanism
which is mainly used for proportionally selecting an element from a set.
It should also be noted at this point that the Laplace mechanism may generate negative numbers.
This, however, is not a problem in this paper,
as we need both positive and negative Laplace noise to ensure that our approach satisfies $\epsilon$-differential privacy.
Moreover, we adopt the Laplace mechanism to add noise to node degree distributions
rather than directly adding noise to the number of nodes or edges.
By adding noise to node degree distributions, our approach can not only guarantee the node and edge privacy of agents,
but also guarantee the connection of an obfuscated graph.
The connection of an obfuscated graph is a necessity for the completeness of our planning approach.
The detailed theoretical analysis will be given in the next section.
The rationale behind Algorithm \ref{alg:DP} is as follows.
According to the definitions of differential privacy,
a map is interpreted as a dataset $D$,
while a node on a map is interpreted as a record in a dataset.
As with the concept of neighboring datasets,
two maps are deemed neighbors if they differ by only one node.
Thus, using $1K$-distribution to obtain a map's statistical information
can be thought of as querying some interesting information from a dataset, $f(D)$.
If we compare Definition \ref{Def-LA} to Line 6 in Algorithm \ref{alg:DP},
we can see that just as the Laplace mechanism can guarantee the privacy of a dataset,
it can also guarantee the privacy of a map.
More discussion about the preservation of privacy will be provided in the next section.
In Algorithm \ref{alg:DP}, $\Delta S$ represents the sensitivity of the degree distribution in a map.
The value of $\Delta S$ is determined by the maximum change in degree distribution
when a node is added into or removed from the map.
For example, in Fig. \ref{fig:beforeDP}, the degree scaling is from $1$ to $4$: $P(1),P(2),P(3),P(4)$.
According to Algorithm \ref{alg:DP}, Line 6, when a node is added into or removed from the map,
one of the four values, $P(1),P(2),P(3),P(4)$, will be incremented or decremented by $1$.
Thus, the maximum change of degree distribution is $1$,
i.e., $\Delta S=1$ in Algorithm \ref{alg:DP}.
\subsubsection{Using reinforcement learning to compute probability distributions}
In a local area, such as the one in Fig. \ref{fig:beforeDP},
there is a set of local military bases and logistic centers,
along with a set of routes connecting these bases and centers.
As discussed in Section \ref{sec:preliminaries}, in the Graph-STRIPS model, $\mathcal{V}$ and $\mathcal{E}$ can be used to represent the topology of a map.
Accordingly, we use $\mathcal{V}$ to represent the military bases and logistic centers,
while $\mathcal{E}$ is used to denote the set of routes connecting these bases and centers.
Specifically, in Fig. \ref{fig:beforeDP}, $\mathcal{V}_b=\{(b,1),(b,2),(b,3),(b,4),(b,5)\}$,
and $\mathcal{E}_b=\{A\sim (b,1), A\sim(b,2), ...,(b,1)\sim B, (b,5)\sim B\}$.
Moreover, different bases or centers will have different routes available to them.
For example, in base $(b,1)$, there are four available routes: $\mathcal{E}_{(b,1)}=\{(b,1)\sim A, (b,1)\sim (b,2), (b,1)\sim (b,3), (b,1)\sim B\}$.
Furthermore, in center $A$, there are two available routes: $\mathcal{E}_A=\{A\sim (b,1), A\sim (b,2)\}$.
\begin{algorithm}
\caption{The reinforcement learning algorithm}
\label{alg:RL}
/*Take agent $b$ as an example*/\\
\textbf{Input}: agent $b$'s obfuscated map (Fig. \ref{fig:afterDP});\\
\textbf{Output}: agent $b$'s obfuscated map with probability distributions (Fig. \ref{fig:afterCalculation});\\
Initialize probability distributions;\\
Initialize the Q-value of each route;\\
Initialize the current position: $v\leftarrow A$;\\
\While{$v\neq B$}{
Agent $b$ selects a route, $e$, based on the probability distribution $\boldsymbol{\pi}(v)=\langle\pi(v,e_1),...,\pi(v,e_n)\rangle$,
where $e\in\mathcal{E}_v=\{e_1,...,e_n\}$;\\
$r\leftarrow\mathcal{R}(v,e)$;\\
$Q(v,e)\leftarrow (1-\alpha)Q(v,e)+\alpha[r+\gamma\underset{e_i\in\mathcal{E}_{v'}}{max_{e_i}} Q(v',e_i)]$;\\
$\overline{r}\leftarrow\sum_{e_i\in\mathcal{E}_v}\pi(v,e_i)Q(v,e_i)$;\\
\For{each route $e_i\in\mathcal{E}_v$}{
$\pi(v,e_i)\leftarrow\pi(v,e_i)+\zeta(Q(v,e_i)-\overline{r})$;\\
}
$\boldsymbol{\pi}(v)\leftarrow Normalise(\boldsymbol{\pi}(v))$;\\
$v\leftarrow v'$;\\
}
Agent $b$ marks the learned probability distributions over the routes;\\
\end{algorithm}
The reinforcement learning algorithm is outlined in Algorithm \ref{alg:RL}.
In Line 4, agent $b$ proportionally initializes probability distributions over actions,
where each action indicates the selection of a route.
The initialization is based on the lengths of the routes.
For example, in Fig. \ref{fig:afterDP}, the probability distribution over routes $A\sim (b,1)$ and $A\sim (b,6)$
can be initialized as $\frac{4}{9}$ and $\frac{5}{9}$, respectively.
In Line 5, agent $b$ initializes the Q-value of each route;
here, the Q-value is an indication of how good a route is.
In this algorithm, the initial Q-value of a route is set based on the length of the route,
such that a shorter route is allocated a higher Q-value.
For example, in Fig. \ref{fig:afterDP}, the initial Q-value of route $A\sim (b,1)$ can be set to $\frac{100}{50}=2$,
while the initial Q-value of route $A\sim (b,6)$ can be set to $\frac{100}{40}=2.5$.
In Line 6, agent $b$ sets the initial position to $A$ and the destination to $B$.
This setting is based on the fact that,
as an intermediate agent, agent $b$ will help agent $a$ to transport the package from $A$ to $B$.
Regarding the loop, in Line 8, agent $b$ selects a route $e$ based on the probability distribution over the available routes in base $v$.
After taking route $e$, agent $b$ receives a reward $r$ (Line 9),
which is inversely proportional to the route length.
For example, in Fig. \ref{fig:afterDP}, $r(A\sim (b,1))$ and $r(A\sim (b,6))$ can be set to $4$ and $5$, respectively.
The reward $r$ is used to update the Q-value of route $e$ in base $v$ (Line 10).
This update is based on: 1) the current Q-value of $e$ in base $v$, $Q(v,e)$;
2) the maximum Q-value of the routes in new base $v'$, $\underset{e_i\in\mathcal{E}_{v'}}{max_{e_i}} Q(v',e_i)$;
3) the immediate reward $r$;
and 4) a learning rate $\alpha$ and a discount rate $\gamma$.
In the next step, the updated Q-value and the probability distribution are used to compute the average reward $\overline{r}$ (Line 11),
where $\mathcal{E}_v$ is the set of available routes in base $v$.
In Lines 12 and 13, the probability of selecting each route $i\in\mathcal{E}_v$ is updated.
This update is based on: 1) the current probability of each route being selected $\pi(v,e_i)$;
2) the current Q-value of each route $Q(v,e_i)$;
3) the average reward $\overline{r}$; and
4) a learning rate $\zeta$.
In Line 14, the updated probability distribution is normalized to be valid,
meaning that for each $i\in\mathcal{E}_v$, $0<\pi(v,e_i)<1$ and $\sum_{e_i\in\mathcal{E}_v}\pi(v,e_i)=1$.
In Line 15, the new base, $v'$, is set as the current base.
The above steps are iterated over until the goal state is reached.
Finally, in Line 16, agent $b$ marks each of the routes with the learned probability distributions.
\subsubsection{Using the exponential mechanism to redistribute probabilities}
After using the reinforcement learning algorithm to replace distance information with probability distributions,
agents' local distance information can be hidden.
Hiding distance information can reduce the risk of leaking this information
but cannot guarantee the privacy preservation of this information.
Therefore, we adopt the exponential mechanism to redistribute probabilities.
We use an example to explain how to use the exponential mechanism to redistribute probabilities.
Suppose a node in a local map has two adjacent edges, $x$ and $y$,
and the probabilities of selecting $x$ and $y$ are $0.7$ and $0.3$, respectively.
Based on the definition of exponential mechanism, the exponential mechanism selects and outputs an element $r$ with probability proportional to $exp(\frac{\epsilon u_r}{2\Delta u})$,
where $\epsilon$ is the privacy budget, $u_r$ is the utility of selecting $r$ and $\Delta u$ is the sensitivity of utility.
If we set the utility of selecting a route to be the probability of selecting that route,
then we have: $u_x=0.7$ and $u_y=0.3$, and in this setting, $\Delta u=1$.
Then, if we set $\epsilon=2$, we have $exp(\frac{\epsilon u_x}{2\Delta u})=2.014$ and $exp(\frac{\epsilon u_y}{2\Delta u})=1.350$.
Finally, the probabilities of selecting $x$ and $y$ become $\frac{2.014}{2.014+1.350}=0.6$ and $\frac{1.350}{2.014+1.350}=0.4$, respectively.
The above process is performed on each node in the local map.
Another simple way to preserve the distance information privacy is to let each agent use the Dijkstra's algorithm \cite{Dijkstra59}
to compute the shortest route length between two logistic centers in its local area
and add a Laplace noise to that length.
However, other agents may still get an approximate idea about the route length.
For example, after adding a Laplace noise, the route length changes from $100$ to $105$.
Although other agents cannot deduce the real length,
they can still guess that the real length must be near $105$.
In some situations, e.g., the military logistic example, an approximate length is good enough for other agents.
By contrast, if an agent uses reinforcement learning and shares only probabilities,
other agents cannot obtain even an approximate length.
This idea is based on the spirit of federated learning by allowing agents to share only parameters \cite{Yang19}.
In federated learning, to protect each client’s training data privacy,
each client only sends the model parameters, trained based on her private data, to the server.
The server, thus, has only clients' model parameters without any clients' private data.
\subsection{Step 3: Creating a complete plan}
After receiving obfuscated local maps from intermediate agents,
agent $a$ creates a logistic map by combining these obfuscated local maps, as shown in Fig. \ref{fig:overviewObfuscated}.
On each obfuscated local map, although both real and fake nodes and edges are involved,
agent $a$ is unable to determine whether a given node or edge is real.
More detailed discussion on this matter will be presented in Section \ref{sec:theoretical analysis}.
\begin{figure}[ht]
\centering
\includegraphics[scale=0.45]{overviewObfuscated.pdf
\caption{A logistic map created by obfuscated local maps}
\label{fig:overviewObfuscated}
\end{figure}
Next, agent $a$ uses a reinforcement learning algorithm to calculate the length of the route between each pair of connected logistic centers, e.g., $A\rightarrow B$, $B\rightarrow E$ and so on.
The reinforcement learning algorithm is similar to Algorithm \ref{alg:RL}.
Since agent $a$ is only provided with probability distributions about the other areas,
agent $a$ must generate the distance information itself based on the probability distributions.
Agent $a$ relates the probabilities to the distance based on the average route length in agent $a$’s local area.
For example, in Fig. \ref{fig:overviewObfuscated}, the probabilities of selecting routes $A\sim (b,1)$ and $A\sim (b,6)$ are $0.7$ and $0.2$, respectively.
If the average route length in agent $a$’s local area is 45,
agent $a$ can simply set the distances from $A$ to $(b,1)$ and $A$ to $(b,6)$ to $20$ and $70$, respectively, whose average is $45$.
Here, we operate under the assumption that there are no significant differences between the average route length in each local area.
After agent $a$ calculates the length of the shortest route between each pair of connected logistic centers (as shown in Fig. \ref{fig:exampleA}),
the shortest route from the origin to the destination can also be obtained.
It is clear at this point that this calculation is not very accurate,
as it is based on estimated length.
However, the aim of this calculation is not to find the real shortest route,
rather to select the intermediate agents which are located on the shortest route.
In Fig \ref{fig:exampleA}, the agents on the shortest route are: $b$, $e$ and $f$.
\begin{figure}[ht]
\centering
\includegraphics[scale=0.28]{exampleA.pdf
\caption{A high-level map featuring relative distances from agent $a$'s perspective}
\label{fig:exampleA}
\end{figure}
The final plan, thus, can be expressed as $\Pi^{\rhd}_a=\langle\mathcal{I}\rightarrow (a,3)\rightarrow (a,4)\rightarrow A\rightarrow B\rightarrow E\rightarrow F\rightarrow\mathcal{G}\rangle$,
where $\mathcal{I}=\{package\_in\_(a,2)\}$ and $\mathcal{G}=\{package\_in\_(f,4)\}$.
In this plan, $\mathcal{I}\rightarrow (a,3)\rightarrow (a,4)\rightarrow A$ is the local plan formulated and carried out by agent $a$.
At logistic center $A$, agent $a$ gives its package to agent $b$, which makes a local plan to transport the package to logistic center $B$.
At center $B$, agent $e$ takes control of the package and devises a local plan to deliver the package to logistic center $F$.
Finally, agent $f$ picks up the package at center $F$ and makes a local plan to transfer the package to $(f,4)$.
\tianqing{at the end of this section, can we generate a new logistic map to show the 'new map' after the privacy preservation? }
\dayong{I have added a figure to show this new map.}
\subsection{A simplification of the proposed approach}
In some situations, if the distance information is not private,
we can let logistic centers do the routing planning and consider the routing only between logistic centers.
Each logistic center can directly communicate with the agent that is connected with the logistic center.
As the distance information is not private,
each logistic center is also aware of the local routing information within the agent.
Compared with the proposed approach,
this simplified approach can 1) significantly reduce the problem complexity;
and 2) enable agents to obtain accurate distance information for further calculation.
and 3) fully hide the topology information belonging to each agent from other agents.
A typical example is daily logistic, where the distance information between two public places do not need to be hidden. In daily logistic, packages are transported from their starting points to their destinations across multiple states or provinces. Here, the distance among states/provinces is not a privacy concern and can be considered as public information. The simplified version of our approach can be applied to this example. Each state/province is assumed to have a logistic center. To transport a package, the logistic center at the starting point utilizes the accurate distance information among states/provinces to make an optimal global plan. Then, each logistic center in the global planning path conducts the local routing planning.
\section{Theoretical analysis}\label{sec:theoretical analysis}
\subsection{Soundness analysis}
\begin{thm}\label{thm:soundness}
The proposed approach is sound.
\end{thm}
\begin{proof}
We prove this theorem by considering one task, e.g., delivering one package in the logistics example.
In Step 1 of our approach, we start from the initial agent
which has a task to complete and initializes a plan,
each queried agent sets up a link to the querying agent.
Thus, all the queried agents are reachable.
If a goal agent is identified whose private facts include the goal state,
there must be at least one plan connecting the initial agent to the goal agent through some or all of the queried agents.
\end{proof}
\subsection{Completeness analysis}
\begin{lem}\label{lem:step3}
Obfuscating local maps does not affect the completeness of the proposed approach.
\end{lem}
\begin{proof}
In Step 2 of our approach, each intermediate agent obfuscates its local map
by adding and/or removing nodes and/or edges (see Algorithm \ref{alg:DP}).
During the obfuscation process, Laplace noise is added to the node degree distribution of the local map: $P(1)$, ..., $P(d_{max})$.
As $P(0)$ is not counted, isolated nodes will not be created.
Moreover, as the obfuscated map is undirected,
it can be guaranteed that the obfuscated map will be connected.
Hence, there must be at least one route between the two logistic centers on the local map.
Since this property is common to the local maps of all intermediate areas,
there must be at least one route from the initial area to the goal area via intermediate logistic centers.
Thus, the completeness is not affected.
\end{proof}
\begin{thm}\label{thm:completeness}
The proposed approach is complete.
\end{thm}
\begin{proof}
Step 1 of our approach guarantees that a goal agent can be found.
According to Theorem \ref{thm:soundness}, there must be at least one plan connecting the initial agent to the goal agent.
We now need only to prove that our approach is capable of finding at least one of these plans.
According to Lemma \ref{lem:step3}, there is at least one route from the initial area to the goal area.
One of these routes can be treated as a high-level plan,
which can be identified using Algorithm \ref{alg:RL}.
Based on the high-level plan, each intermediate agent creates a local plan (Step 3).
Given that each agent is honest\footnote{It is a common assumption in privacy-preserving multi-agent planning that agents are honest but curious about others' private information \cite{Torreno17}.}, each local plan is valid,
which ensures that the two logistic centers in the local area will be connected.
Therefore, a high-level plan and a set of local plans constitute a complete plan.
\end{proof}
\subsection{Privacy-preserving analysis}
\begin{thm}\label{thm:DP}
The proposed planning approach satisfies $\epsilon$-differential privacy.
\end{thm}
\begin{proof}
To analyze the privacy guarantee, we apply two composite properties of the privacy budget: the sequential and the parallel compositions \cite{McSherry200794}.
The sequential composition determines the privacy budget $\epsilon$ of each step
when a series of private analysis are performed sequentially on a dataset.
The parallel composition corresponds to the case in which each private step is applied to disjoint subsets of a dataset.
The ultimate privacy guarantee depends on the step which has the maximal $\epsilon$.
In the proposed approach, the Laplace mechanism and the exponential mechanism consumes the privacy budget.
In the Laplace mechanism in Algorithm \ref{alg:DP}, the Laplace noise sampled from $Lap(\frac{\Delta S\cdot d_{max}}{\epsilon})$ is added in $d_{max}$ steps.
At each step, the Laplace mechanism consumes the $\frac{\epsilon}{d_{max}}$ privacy budget;
thus for each step, Algorithm \ref{alg:DP} satisfies $\frac{\epsilon}{d_{max}}$-differential privacy.
By using the sequential composition property, we can conclude that
at a total of $d_{max}$ steps, the Laplace mechanism consumes the $d_{max}\cdot\frac{\epsilon}{d_{max}}=\epsilon$ privacy budget,
meaning that Algorithm \ref{alg:DP} satisfies $\epsilon$-differential privacy.
By comparing Definition \ref{Def-DP} with Definition \ref{Def-DP-node},
since the Laplace mechanism can guarantee the data record privacy of a dataset,
it can also guarantee the node-privacy of a graph.
The exponential mechanism is used to redistribute probabilities on each agent's local graph.
For a given node in a local graph, suppose the node has $k$ adjacent edges.
Then, the exponential mechanism will be used $k$ times.
If we set privacy budget for this node to be $\frac{\epsilon}{k}$,
based on the sequential composition property, the privacy consumption of this node is $\epsilon$.
Thus, the probability redistribution on the adjacent edges of this node satisfies $\epsilon$-differential privacy.
When this method is used on every node,
based on the parallel composition property, the probability redistribution on this local graph satisfies $\epsilon$-differential privacy.
Since the Laplace mechanism and the exponential mechanism are used by each agent,
each agent is guaranteed $\epsilon$-differential privacy.
Although an environment may contain multiple agents,
each agent maintains a local area, and these local areas are disjoint with each other.
Since each agent is guaranteed $\epsilon$-differential privacy,
according to the parallel composition property, the proposed approach satisfies $\epsilon$-differential privacy.
\end{proof}
\textbf{Remark 1}: In Algorithm \ref{alg:DP}, Laplace noise is used to randomize the node degree distribution.
This implies that both the number of nodes and the number of edges in a local map will be perturbed.
Since the topology of a map consists of nodes and edges,
perturbing the numbers of nodes and edges incurs perturbation of the topology.
Accordingly, as Algorithm \ref{alg:DP} satisfies differential privacy,
the perturbation of the topology of a map also satisfies differential privacy.
\begin{cor}\label{cor:granularity}
No agent is able to conclude anything about the existence of any subset of $\lceil\frac{\Delta S\cdot d_{max}}{\epsilon}\rceil$ nodes in another agent's map.
\end{cor}
\begin{proof}
In Algorithm \ref{alg:DP}, the Laplace noise is sampled from $Lap(\frac{\Delta S\cdot d_{max}}{\epsilon})$,
meaning that the expected amount of noise is $\frac{\Delta S\cdot d_{max}}{\epsilon}$.
As this noise is used to change the number of nodes in a map (recall Lines 5-6 in Algorithm \ref{alg:DP}),
the expected number of nodes that will be changed is $\lceil\frac{\Delta S\cdot d_{max}}{\epsilon}\rceil$.
Therefore, any subset of $\lceil\frac{\Delta S\cdot d_{max}}{\epsilon}\rceil$ nodes could be fake nodes.
According to Definition \ref{Def-DP-node} and Theorem \ref{thm:DP},
since Algorithm \ref{alg:DP} can guarantee the node-privacy of a graph,
an agent will be unable to distinguish real from fake statistical information between two neighboring graphs, e.g., the number of real nodes.
This means that an agent cannot determine whether or not a node is fake.
Hence, the existence of any subset of $\lceil\frac{\Delta S\cdot d_{max}}{\epsilon}\rceil$ nodes in an agent's map
cannot be concluded by any other agents.
\end{proof}
\textbf{Remark 2}: From Corollary \ref{cor:granularity}, in the Laplace mechanism in Algorithm \ref{alg:DP},
the value of $\epsilon$ controls the granularity of privacy,
given that the values of $\Delta S$ and $d_{max}$ have been fixed.
A smaller $\epsilon$ implies a stronger privacy guarantee.
However, a smaller $\epsilon$ also introduces a larger amount of noise.
The increase of the amount of noise reduces the usability of a map.
Thus, the value of $\epsilon$ should be carefully set.
\textbf{Remark 3}: Similar to the Laplace mechanism, in the exponential mechanism,
the value of $\epsilon$ has a huge impact on probability redistribution results.
Given that a node has $k$ adjacent edges and the probabilities of selecting the $k$ edges are $u_1,...,u_k$,
if we set $\epsilon=0$, the probability of selecting each edge will equally become $\frac{1}{k}$;
if we set $\epsilon\rightarrow +\infty$, probability $u_m$ becomes $1$ and others become $0$,
where $u_m=max\{u_1,...,u_k\}$.
In addition to the two extreme situations, there is a median situation
which is that the redistributed probabilities are identical to the original probabilities: $u'_1=u_1,...,u'_k=u_k$.
Based on the computation method described in Section \ref{sub:Step2}, each probability $u'_i$, $1\leq i\leq k$, is computed as:
\begin{equation}
u'_i=\frac{exp(\frac{\epsilon u_i}{2\Delta u})}{\sum_{1\leq j\leq k}exp(\frac{\epsilon u_j}{2\Delta u})}.
\end{equation}
Let each $u'_i=u_i$, we have $k$ equations.
\begin{equation}\nonumber
\left\{
\begin{array}{lr}
\frac{exp(\frac{\epsilon u_1}{2\Delta u})}{\sum_{1\leq j\leq k}exp(\frac{\epsilon u_j}{2\Delta u})}=u_1, & \\
..., & \\
\frac{exp(\frac{\epsilon u_k}{2\Delta u})}{\sum_{1\leq j\leq k}exp(\frac{\epsilon u_j}{2\Delta u})}=u_k. &
\end{array}
\right.
\end{equation}
In our problem, $\Delta u=1$. By solving the $k$ equations, we have that
\begin{equation}\nonumber
\epsilon_i=\frac{2(k\cdot ln(u_i)-\sum_{1\leq j\leq k}ln(u_j))}{k\cdot u_i-\sum_{1\leq j\leq k}u_j},
\end{equation}
where $1\leq i\leq k$.
Thus, in applications, on one hand, these values of $\epsilon$ should be avoided,
as they will make the redistributed probabilities identical to the original probabilities,
which cannot offer any privacy preservation.
On the other hand, the values of $\epsilon$ should be set close to these values
to guarantee the usability of the redistributed probabilities.
\begin{thm}\label{thm:strong}
The proposed planning approach can strongly preserve agents' privacy.
\end{thm}
\begin{proof}
As defined in Section \ref{sub:planning}, an agent's private information includes
1) the number of nodes in an agent's local area,
2) the number of edges in the local area,
3) the length of these edges,
4) the positions of any items in the local area and
5) the movements of any items in the local area.
To prove this theorem,
we only need to prove that the private information possessed by an agent cannot be inferred by another agent.
First, according to Theorem \ref{thm:DP} and Corollary \ref{cor:granularity},
the proposed planning approach satisfies $\epsilon$-differential privacy
and guarantees the privacy of any subset of $\lceil\frac{\Delta S\cdot d_{max}}{\epsilon}\rceil$ nodes in an agent's local area.
By properly setting the value of $\epsilon$, the privacy of all nodes and edges in an agent's local area can be preserved.
Therefore, the privacy of the number of nodes and edges of an agent's local area will also be preserved.
Second, our approach dictates that the length information in a local area is replaced by probability distributions (recall Fig. \ref{fig:transfer}).
Also, these probabilities are redistributed using the exponential mechanism.
Thus, the length information is strictly hidden.
Therefore, an agent cannot infer the real length of any individual edge in another agent's local area.
Third, since the privacy of any node or edge in an agent's local area has been preserved,
the positions and movements of items have also been preserved.
Based on the definition of strong privacy (Definition \ref{def:strong}),
the proposed approach can strongly preserve agents' privacy.
\end{proof}
\subsection{Communication analysis}
Let us suppose that there are $m$ logistic centers.
Each logistic center, $i$, has a capacity, $lc_i$,
which is the maximum number of agents that can share the logistic center.
Accordingly, we derive the following theorem:
\begin{thm}\label{thm:communication}
In Step 1, the upper bound of the number of communication messages used to find a goal agent is $\sum_{1\leq i\leq m}lc_i$.
\end{thm}
\begin{proof}
In our approach, each agent is only aware of the existence of its own neighbors.
This means that 1) each agent does not know how many neighbors any other agent has, and
2) each agent is not aware of how far away the goal agent is.
As the information regarding logistic centers is public,
all agents know the capacity of each logistic center.
Thus, to guarantee that the query message is able to reach the goal agent,
an agent must assume that 1) each logistic center is using up its capacity, and
2) the goal agent is located in the most distant area.
In this situation, the number of generated communication messages is $\sum_{1\leq i\leq m}lc_i$.
\end{proof}
\textbf{Remark 4}: Theorem \ref{thm:communication} describes the communication overhead in the worst case.
However, as time progresses, this communication overhead can be significantly reduced.
This is because an agent memorizes the plans that it has previously created,
meaning that an agent memorizes the routes to goal agents.
Thus, in the future, an agent can simply exploit a route previously determined to reach a goal agent without the need for communication.
Even if an agent decides to explore a new route,
the communication overhead can be limited by setting the maximum number of query messages during the finding process.
The maximum number of query messages is set to be identical to the number of messages used to find the same goal agent last time.
Formally, we have the following corollary:
\begin{cor}\label{cor:communication}
As time progresses, the communication overhead of each agent monotonically decreases.
\end{cor}
\begin{proof}
Every time an agent explores a new route to a goal agent,
the maximum number of query messages is set to be equal to the number of messages used to find the same goal agent last time.
As each agent memorizes only the shortest routes to goal agents,
only routes that are shorter than these memorized routes will be taken by each agent.
This means that the number of request messages currently being used must be fewer than or equal to the number used previously.
Thus, the communication overhead of each agent monotonically decreases.
\end{proof}
In our approach, the setting of the communication budget $C$ can be controlled by the privacy budget $\epsilon$.
In a multi-agent system, each agent $k$ sets $\epsilon/C$ as their privacy budget
and ceases to communicate when $\epsilon$ is used up.
When $C>\sum_{1\leq i\leq m}lc_i$, the system can guarantee that all communication steps will be completed.
However, a large amount of noise will be added to the system under these circumstances.
When $C<\sum_{1\leq i\leq m}lc_i$, the system is likely to stop before finishing the communication steps.
However, the noise added to the system will be limited.
When $C=\sum_{1\leq i\leq m}lc_i$, the system will stop when all communication steps have been completed.
Therefore, by adjusting the privacy budget $\epsilon$ and the communication budget $C$,
the communication overhead of a multi-agent system can be controlled.
\section{Application of our approach to other domains}\label{sec:application}
This section illustrates how our approach can be applied to three other domains:
networks, air travel, and rovers.
\subsection{Packet routing in networks}
In a network, nodes often transmit packets between each other.
These nodes may belong to different areas,
which are connected by routers or access points.
In this domain, a router or access point can be thought of as similar to an agent,
which manages a corresponding area.
In a given area, the information possessed by each node, e.g., its load and performance, is private to the agent.
Moreover, the number of nodes in an area and their communication links are also private to the agent.
Thus, the agents expect that their privacy will be preserved.
As each node has only a limited range of communication, when a node transmits a packet to another node,
the packet may be relayed multiple times by intermediate nodes before reaching its destination.
Since it is highly desirable that nodes receive packets in a timely manner,
the transmission must be efficient so that huge delays can be avoided.
The proposed approach can be applied to create efficient plans for packet routing.
\subsection{Airplane transport}
The airplane transport problem consists of a set of planes and airports.
Moreover, the travel map is partitioned into a set of areas.
In the real world, each area can be thought of as a country.
Therefore, the planes and airports located in a given area are private to the area air traffic controller.
Clearly, each area controller wants to preserve information regarding the status and number of planes and airports in their area as private information.
The airports located on the boundary of two areas are public.
The goal is to transport passengers between airports.
In this problem, each area controller can be thought of as an agent.
When a plane travels from one airport to another,
as the plane has only limited fuel,
passengers may be transferred multiple times on their way to their destination.
Moreover, both area controllers and passengers would clearly prefer the plane to reach its destination as quickly as possible.
Thus, an efficient privacy-preserving planning approach is required.
The proposed approach can be applied to create efficient plans for passenger transport.
\subsection{Rover exploration}
This domain models Mars exploration rovers.
Each rover can be thought of as an agent.
The goal of these rovers is to collect samples.
Each rover has its own private sets of targets and reachable locations.
These targets and reachable locations can be thought of as private facts in our planning model,
the privacy of which must be preserved.
Each rover collects samples in its reachable locations.
When a rover needs to transmit the samples it has collected to another rover,
these samples may have to be transmitted by intermediate rovers in the interim,
as the number of locations reachable by each rover is limited.
Since samples may decay as time progresses,
it is desirable for the rovers to transmit the samples to the destination as quickly as possible.
Hence, an efficient privacy-preserving planning approach is required.
The proposed approach can be applied to create efficient plans for sample transmission.
In summary, our approach can be applied to all of the planning problems,
in which each party has private information and
local plans can be created by each party using reinforcement learning techniques.
Moreover, reinforcement learning has a broad range of applications,
including task scheduling in cloud computing \cite{Peng15}, traffic light control \cite{Arel10}, and robot coordination \cite{Kober13}.
Since most of these applications may also have privacy requirements,
our method has the potential to be applied to these real-world scheduling and coordination problems as well.
\tianqing{can we summarize the scenarios that can use our method? }
\dayong{I add a paragraph to summarize this.}
\section{Experiments}\label{sec:experiment}
\subsection{Experimental setup}
The experiments in the present research are conducted based on two scenarios: logistics and packet routing,
which are typical logistic-like problems.
In the logistics scenario, as described in Section \ref{sec:motivation example},
each military base has a set of packages to transport to other military bases.
These military bases may be located in different areas and managed by different military units.
The information pertaining to each military base is private to the managing military unit.
The packet routing scenario is similar to the logistics scenario,
in that each node in an ad hoc network houses a set of packets to be sent to other nodes.
Nodes may belong to different groups and are served by different access points.
The information of each node is private to the serving access point.
The key difference between these two scenarios is that in the packet routing scenario,
new nodes may dynamically join the network
and existing nodes may leave the network at any time,
while this is not the case for the logistics scenario.
These experiments have also been conducted on the air travel and rover scenarios.
As the results present a similar trend to logistics,
they are not discussed here.
Three evaluation metrics are used in the two scenarios:
1) average route length: the average length of the routes from initial states to goal states;
2) average communication overhead: the average number of communication messages used to make a plan;
3) success rate: the ratio of the number of the successfully transmitted packages/packets to the total number of packages/packets.
In both scenarios, the map shape or network topology is similar to that in Fig. \ref{fig:example}.
The size of the maps/neworks varies from $10$ logistic centers/access points to $50$ logistic centers/access points;
correspondingly the number of military bases/network nodes varies from $50$ to $250$
\footnote{The topologies of maps/networks are created by simulation,
as most real-world graph datasets \cite{CA,PA,TX} do not contain distance information and thus cannot be used in our experiments.
We leave the experiments with real-world datasets as one of our future studies.}.
The probability of a package/packet being generated on each military base/node is set to $0.2$.
The communication budget of each agent varies from $C=40$ to $C=80$ depending on variations in the map/network size.
The privacy budget of each agent is set to $\epsilon=0.5$.
Moreover, in the packet routing scenario, during the route finding process,
there is a probability of $0.1$ that an existing node will leave the network and a probability of $0.1$ that a new node will join the network.
The parameter values in the proposed algorithms are chosen experimentally,
and set to $\alpha=0.1$, $\gamma=0.9$ and $\zeta=0.95$.
The proposed planning approach, denoted as \emph{DP-based}, is evaluated in comparison with three closely related approaches.
The first approach, denoted as \emph{No-privacy}, is also developed by us.
The major features of \emph{No-privacy} are the same as \emph{DP-based},
but the privacy-preserving mechanism has been removed.
Although \emph{No-privacy} is not applicable to privacy-preserving planning, it can be used to evaluate
how the privacy-preserving mechanism impacts the performance of our \emph{DP-based} approach.
The second approach is based on best-first forward search, denoted as \emph{Best-first},
and has been used in \cite{Nissim14,Brafman15,Stolba17}.
In the \emph{Best-first} approach, when an agent transmits a package/packet to a logistic center/access point,
the agent broadcasts this state to all the other agents.
The nearest agent takes the package/packet based on this state
and transmits it to the next logistic center/access point.
This process continues until the goal agent is reached.
The third approach is GPPP (greedy privacy-preserving planner), denoted as \emph{Greedy},
which was developed in \cite{Maliah17}.
The \emph{Greedy} approach consists of two phases: global planning and local planning.
In the global planning phase, all agents collaboratively devise a global plan using a best-first search method.
Next, in the local planning phase, each agent creates a local plan by executing a single-agent planning procedure.
\subsection{Experimental results}
\subsubsection{The logistics scenario}
\begin{figure}[ht]
\centering
\begin{minipage}{0.48\textwidth}
\subfigure[\scriptsize{Average route length}]{
\includegraphics[width=0.32\textwidth, height=2.5cm]{S1Route.pdf
\label{fig:S1Route}}
\subfigure[\scriptsize{Average communication overhead}]{
\includegraphics[width=0.32\textwidth, height=2.5cm]{S1Communication.pdf}
\label{fig:S1Communication}
\subfigure[\scriptsize{Success rate}]{
\includegraphics[width=0.32\textwidth, height=2.5cm]{S1Success.pdf}
\label{fig:S1Success}}\\
\end{minipage}
\caption{Performance of the four approaches on the logistics scenario with variation of the map size}
\label{fig:S1}
\end{figure}
Fig. \ref{fig:S1} demonstrates the performance of the four approaches on the logistics scenario with variation of the map size.
As the map size grows larger, for all four approaches,
the average route length and the average communication overhead progressively increase,
while the success rate gradually decreases.
As the map size increases, the distance between an original agent and a destination agent may be enlarged accordingly.
Therefore, the average route length increases.
Moreover, when this occurs,
the number of intermediate agents also increases.
Thus, the average communication overhead rises as well.
Due to this increase in the average communication overhead,
the communication budget of some agents may be used up before a plan is made.
Hence, the success rate reduces.
The proposed \emph{DP-based} approach achieves much better performance than the \emph{Best-first} and \emph{Greedy} approaches.
The reinforcement learning algorithm in the \emph{DP-based} approach can find shorter routes than the other two approaches.
Moreover, in the \emph{DP-based} approach, agents are allowed to communicate only with neighbors,
and a privacy budget is adopted to control communication overhead.
Thus, the \emph{DP-based} approach uses less communication overhead than the other two approaches.
In addition, the \emph{DP-based} approach successfully makes more plans than the other two approaches
before the communication budget is used up.
Overall, the performance of \emph{No-privacy} approach is slightly better than the \emph{DP-based} approach.
As privacy is not taken into account in the \emph{No-privacy} approach,
the information shared between agents is accurate,
and agents can make accurate plans based on this accurate information.
However, the private information of each agent is entirely disclosed to other agents under this approach,
a situation that should be avoided in real-world applications.
More specifically, in Fig. \ref{fig:S1Route}, the average route length in the \emph{DP-based} approach is only about $2\%$ longer than for the \emph{No-privacy} approach.
This is because in the \emph{DP-based} approach, a plan is made up of
a set of local plans created by the initial agent and the intermediate agents.
Each of these local plans is created by an individual agent with reference to its private but accurate information.
Since most of the information used to create a plan is accurate,
the introduction of our privacy-preserving mechanism does not substantially impact the average route length.
The \emph{Best-first} approach achieves the worst performance out of the four approaches.
In the \emph{Best-first} approach, a package is transmitted to the nearest agent.
However, in large and complex maps, the nearest agent may not always be the best choice.
Moreover, always choosing the nearest agent may result in a transmission loop;
if this situation arises, packages will never reach their destinations.
In comparison, the performance of \emph{Greedy} approach is better than the \emph{Best-first} approach,
as the \emph{Greedy} approach features a global planning phase that involves selecting the appropriate logistic centers to create a high-level route,
which conserves communication overhead.
\begin{figure}[ht]
\centering
\begin{minipage}{0.48\textwidth}
\subfigure[\scriptsize{Average route length}]{
\includegraphics[width=0.32\textwidth, height=2.5cm]{S1PriRoute.pdf}
\label{fig:S1PriRoute}}
\subfigure[\scriptsize{Average communication overhead}]{
\includegraphics[width=0.32\textwidth, height=2.5cm]{S1PriComm.pdf}
\label{fig:S1PriComm}
\subfigure[\scriptsize{Success rate}]{
\includegraphics[width=0.32\textwidth, height=2.5cm]{S1PriSuccess.pdf}
\label{fig:S1PriSuccess}}\\
\end{minipage}
\caption{Performance of the \emph{DP-based} approach on the logistics scenario with variation of the privacy budget value}
\label{fig:S1Pri}
\end{figure}
Fig. \ref{fig:S1Pri} demonstrates the performance of the \emph{DP-based} approach on the logistics scenario
with variation of the privacy budget $\epsilon$ value from $0.2$ to $0.8$.
The number of logistic centers is fixed at $10$.
It can be seen that with the increase of the privacy budget $\epsilon$ value,
the performance of the \emph{DP-based} approach improves,
namely it achieves a shorter average route length (Fig. \ref{fig:S1PriRoute}),
lower average communication overhead (Fig. \ref{fig:S1PriComm}),
and higher success rate (Fig. \ref{fig:S1PriSuccess}).
According to the Laplace mechanism, when the $\epsilon$ value is small,
the noise, added to the map, is large.
A large noise value will significantly affect the agents planning.
For example, agent $a$ has two neighbors $b$ and $c$.
Now, suppose that 1) agent $a$ wants to send a package to $d$,
and 2) delegating the package to $b$ is a better choice than $c$.
However, when agents $b$ and $c$ obfuscate their maps,
due to the large noise, the obfuscation results may make $c$ appear to be a better choice than $b$.
Thus, agent $a$ may make a sub-optimal plan.
This situation is alleviated
when the $\epsilon$ value increases.
\subsubsection{The packet routing scenario}
\begin{figure}[ht]
\centering
\begin{minipage}{0.48\textwidth}
\subfigure[\scriptsize{Average route length}]{
\includegraphics[width=0.32\textwidth, height=2.5cm]{S2Route.pdf}
\label{fig:S2Route}}
\subfigure[\scriptsize{Average communication overhead}]{
\includegraphics[width=0.32\textwidth, height=2.5cm]{S2Communication.pdf}
\label{fig:S2Communication}
\subfigure[\scriptsize{Success rate}]{
\includegraphics[width=0.32\textwidth, height=2.5cm]{S2Success.pdf}
\label{fig:S2Success}}\\
\end{minipage}
\caption{Performance of the four approaches on the packet routing scenario with variation of the network size}
\label{fig:S2}
\end{figure}
\begin{figure}[ht]
\centering
\begin{minipage}{0.48\textwidth}
\subfigure[\scriptsize{Average route length}]{
\includegraphics[width=0.32\textwidth, height=2.5cm]{S2PriRoute.pdf}
\label{fig:S2PriRoute}}
\subfigure[\scriptsize{Average communication overhead}]{
\includegraphics[width=0.32\textwidth, height=2.5cm]{S2PriComm.pdf}
\label{fig:S2PriComm}
\subfigure[\scriptsize{Success rate}]{
\includegraphics[width=0.32\textwidth, height=2.5cm]{S2PriSuccess.pdf}
\label{fig:S2PriSuccess}}\\
\end{minipage}
\caption{Performance of the \emph{DP-based} approach on the packet routing scenario with variation of the privacy budget}
\label{fig:S2Pri}
\end{figure}
Fig. \ref{fig:S2} illustrates the performance of the four approaches on the packet routing scenario with variation of the network size,
while Fig. \ref{fig:S2Pri} depicts the performance of the \emph{DP-based} approach on the packet routing scenario with variation of the privacy budget $\epsilon$.
After comparing Fig. \ref{fig:S1} to Fig. \ref{fig:S2} and Fig. \ref{fig:S1Pri} to Fig. \ref{fig:S2Pri},
it can be concluded that these approaches exhibit similar trends in terms of their results on the two scenarios,
but that the performance of these approaches is worse on the packet routing scenario than on the logistic scenario.
This is mainly due to the dynamism of the packet routing scenario.
When a node leaves the network, the routes involving that node are broken.
Thus, agents have to re-find routes.
This incurs extra communication overhead and reduces success rates to some extent.
\begin{figure}[ht]
\centering
\begin{minipage}{0.48\textwidth}
\subfigure[\scriptsize{Average route length}]{
\includegraphics[width=0.32\textwidth, height=2.5cm]{S2DyRoute.pdf}
\label{fig:S2DyRoute}}
\subfigure[\scriptsize{Average communication overhead}]{
\includegraphics[width=0.32\textwidth, height=2.5cm]{S2DyCommunication.pdf}
\label{fig:S2DyCommunication}
\subfigure[\scriptsize{Success rate}]{
\includegraphics[width=0.32\textwidth, height=2.5cm]{S2DySuccess.pdf}
\label{fig:S2DySuccess}}\\
\end{minipage}
\caption{Performance of the three approaches on the packet routing scenario with variation of the dynamism}
\label{fig:S2Dy}
\end{figure}
Fig. \ref{fig:S2Dy} illustrates the performance of the four approaches on the packet routing scenario with variation of the dynamism,
such that the probability of a node leaving or joining the network varies from $0.05$ to $0.2$ and the network size is fixed at $10$ access points.
From Fig. \ref{fig:S2Dy}, it can be seen that an increase in the dynamism negatively affects the \emph{Best-first} and \emph{Greedy} approaches in terms of their average communication overhead and success rates,
but does not significantly impact the \emph{DP-based} and \emph{No-privacy} approaches.
As the dynamism increases, the frequency with which nodes leave or join the network also increases.
Thus, the number of affected routes increases as well.
In the \emph{Best-first} and \emph{Greedy} approaches, when a route is broken,
a new finding process is launched.
This may not significantly affect the average route length (Fig. \ref{fig:S2DyRoute}),
as route length depends on the positions of nodes rather than the number of nodes.
However, launching a new finding process results in additional communication overhead,
and may thus reduce success rates due to depletion of the communication budget.
By contrast, the \emph{DP-based} and \emph{No-privacy} approaches do not require a new finding process
when a route is broken.
In the \emph{DP-based} approach, routes are found by using reinforcement learning on obfuscated local network topologies.
These obfuscated local network topologies are obtained using differential privacy.
Differential privacy can guarantee that
a node being brought in or out of a local network will have minimum effect on the statistical information.
Therefore, when a node leaves or joins a local network,
the serving access point does not need to re-obfuscate the new network
or to communicate with the original access point about the change in the network.
Hence, the communication budget can be conserved,
and the success rate is preserved
\subsection{Summary}
According to the experimental results, the proposed \emph{DP-based} approach achieves better results than the \emph{Best-first} and \emph{Greedy} approaches in all experimental situations considered here.
The average length of routes found by the \emph{DP-based} approach is about $25\%$ and $15\%$ shorter, respectively, than those found using the \emph{Best-first} and \emph{Greedy} approaches.
The \emph{DP-based} approach also uses about $20\%$ and $10\%$ less communication overhead than the \emph{Best-first} and \emph{Greedy} approaches, respectively.
Moreover, the \emph{DP-based} approach achieves about $10\%$ and $5\%$ higher success rates than the \emph{Best-first} and \emph{Greedy} approaches, respectively.
Regarding performance, the \emph{DP-based} approach is slightly worse than the \emph{No-privacy} approach
by a factor of about $3\%$ in terms of average route length, $2\%$ in communication overhead and $2\%$ in success rate.
The \emph{DP-based} approach, however, strongly protects the privacy of agents,
which is entirely disregarded in the \emph{No-privacy} approach.
Therefore, based on the experimental results, the efficiency of our \emph{DP-based} approach can be proven.
\section{Conclusion and Future Work}\label{sec:conclusion}
This paper proposes a novel strong privacy-preserving planning approach for logistic-like problems.
In this approach, an agent creates a complete plan by using obfuscated private information from each intermediate agent,
where this obfuscation is achieved by adopting the differential privacy technique.
Due to the advantages of differential privacy,
following obfuscation, an agent's private information cannot be deduced by other agents regardless of their reasoning power.
\tianqing{please use two sentences to summrize the proposed method}
\dayong{done}
This approach is the first in existence to achieve strong privacy, completeness and efficiency simultaneously by taking advantage of differential privacy.
Moreover, this approach is communication-efficient.
Compared to the benchmark approaches, our approach achieves better performance in various aspects.
\tianqing{the proposed method can be applied in ******}
\dayong{done}
In the future, we intend to extend our approach by introducing malicious agents.
Existing approaches commonly assume that agents are honest but curious.
Introducing malicious agents, which provide false information to others,
may be a challenging and interesting addition to the field of multi-agent planning.
Also, as described in the experimental part (Section \ref{sec:experiment}),
we will continue to search usable real-world datasets and evaluate our approach with them.
\bibliographystyle{IEEEtran}
{\small | {'timestamp': '2020-08-18T02:14:14', 'yymm': '2008', 'arxiv_id': '2008.06832', 'language': 'en', 'url': 'https://arxiv.org/abs/2008.06832'} | arxiv |
\section{Introduction}
\label{sec.introduction}
Potholes are small concave depressions on the road surface \cite{mathavan2015review}. They arise due to a number of environmental factors, such as water permeating into the ground under the asphalt road surface \cite{fan2019pothole}. The affected road areas are further deteriorated due to the vibration of tires, making the road surface impracticable for driving. Furthermore, vehicular traffic can cause the subsurface materials to move, and this generates a weak spot under the street. With time, the road damage worsens due to the frequent movement of vehicles over the surface and this causes new road potholes to emerge. \cite{koch2015review}.
Road pothole is not just an inconvenience, but also poses a safety risk, because it can severely affect vehicle condition, driving comfort, and traffic safety \cite{fan2019pothole}. It was reported in 2015 that Danielle Rowe, an Olympic gold medalist as well as three-time world champion, had eight fractured ribs resulting in a punctured lung, after hitting a pothole during a race \cite{pothole_news_dani_king}. Therefore, it is crucial and necessary to regularly inspect road potholes and repair them in time.
Currently, manual visual inspection performed by certified inspectors is still the main form of road pothole detection \cite{fan2019road}. However, this process is not only time-consuming, exhausting and expensive, but also hazardous for the inspectors \cite{koch2015review}. For example, the city of San Diego repairs more than 30K potholes per year using hot patches compound and bagged asphalt, and they have been requesting residents to report potholes so as to relieve the burden on the local road maintenance department \cite{sandiego_pothole}. Elsewhere, the UK government is set to pledge billions of pounds for filling potholes across the country \cite{bbc_pothole_repairing}. Additionally, the pothole detection results are always subjective, as the decisions depend entirely on the inspector's experience and judgment \cite{fan2019real}. Hence, there has been a strong demand for automated road condition assessment systems, which can not only acquire 2D/3D road data, but also detect and predict road potholes accurately, robustly and objectively \cite{leo2018deep}.
Specifically, automated road pothole detection has been considered as more than an infrastructure maintenance problem in recent years, as many self-driving car companies have included road pothole detection into their autonomous car perception modules. For instance, Jaguar Land Rover announced their recent research achievements on road pothole detection/prediction \cite{land_rover_pothole}, where the vehicles can not only gather the location and severity data of the road potholes, but also send driver warnings to slow down the car. Ford also claimed that they were experimenting with data-driven technologies to warn drivers of the pothole locations \cite{ford_pothole}. Furthermore, during the Consumer Electronics Show (CES) 2020, Mobileye demonstrated their solutions\footnote{\url{s21.q4cdn.com/600692695/files/doc_presentations/2020/1/Mobileye-CES-2020-presentation.pdf}} for road pothole detection, which are based on machine vision and intelligence. With recent advances in image analysis and deep learning, especially for 3D vision data, depth/disparity image analysis and convolutional neural networks (CNNs) have become the mainstream techniques for road pothole detection \cite{fan2019real}.
Given the 3D road data, image segmentation algorithms are typically performed to detect potholes. For example, Jahanshahi {\textit{et al.}} \cite{jahanshahi2013unsupervised} employed Otsu's thresholding method \cite{otsu1979threshold} to segment depth images for road pothole detection. In \cite{fan2019pothole}, we proposed a disparity image transformation algorithm, which can better distinguish between damaged and undamaged road areas. The road potholes were then detected using a surface modeling approach. Subsequently, we minimized the computational complexity of our algorithm and successfully embedded it in a drone for real-time road inspection \cite{fan2019real}. Recently, the aforementioned algorithm was proved to have a numeric solution \cite{fan2019road}, which allows it to be easily deployed to any existing semantic segmentation networks for end-to-end road pothole detection.
In this paper, we first briefly introduce the disparity (or inverse depth, as disparity is in inverse proportion to depth) transformation (DT) algorithm proposed in \cite{fan2019road}. We then exploit the aggregation of different types of attention modules (AMs) so as to improve the semantic segmentation networks for better road pothole detection. Furthermore, we develop a novel adversarial domain adaptation framework for training set augmentation. Moreover, we publish our road pothole detection dataset, named \textit{Pothole-600}, at \url{sites.google.com/view/pothole-600} for research purposes. According to our experimental results presented in Section \ref{sec.exp}, training CNNs with augmented road data yields better semantic segmentation results, where convergence is achieved with fewer iterations at the same time.
\section{Related Works}
\label{sec.related_works}
\subsection{Semantic Segmentation}
\label{sec.semantic_segmentation}
Fully convolutional network (FCN) \cite{long2015fully} was the first end-to-end single-modal CNN designed for semantic segmentation. Based on FCN, U-Net \cite{ronneberger2015u} adopts an encoder-decoder architecture. It also adds skip connections between the encoder and decoder to help smooth the gradient flow and restore the locations of objects. Additionally, PSPNet \cite{zhao2017pyramid}, DeepLabv3+ \cite{chen2018encoder} and DenseASPP \cite{yang2018denseaspp} leverage a pyramid pooling module to extract context information for better segmentation performance. Furthermore, GSCNN \cite{takikawa2019gated} employs a two-branch framework consisting of a shape branch and a regular branch, which can effectively improve the semantic predictions on the boundaries.
Different from the above-mentioned single-modal networks, many data-fusion networks have also been proposed to improve semantic segmentation accuracy by extracting and fusing the features from multi-modalities of visual information \cite{wang2020applying}, \cite{fan2020sne-roadseg}. For instance, FuseNet \cite{hazirbas2016fusenet} and depth-aware CNN \cite{wang2018depth} adopt the popular encoder-decoder architecture, but employ different operations to fuse the feature maps obtained from the RGB and depth branches. Moreover, RTFNet \cite{sun2019rtfnet} was developed to improve semantic segmentation performance by fusing the features extracted from RGB images and thermal images. It also adopts an encoder-decoder architecture and an element-wise addition fusion strategy.
\subsection{Attention Module}
\label{sec.attention_module}
Due to their simplicity and effectiveness, AMs have been widely used in various computer vision tasks. AMs typically learn the weight distribution (WD) of an input feature map and output an updated feature map based on the learned WD \cite{vaswani2017attention}. Specifically, Squeeze-and-Excitation Network (SENet) \cite{hu2018squeeze} employs a channel-wise AM to improve image classification accuracy. Furthermore, Wang {\textit{et al.}} \cite{wang2018non} presented a non-local module to capture long-range dependencies for video classification. OCNet \cite{yuan2018ocnet} and DANet \cite{fu2019dual} proposed different self-attention modules that are capable of using contextual information for semantic segmentation. Moreover, CCNet \cite{huang2019ccnet} adopts a criss-cross AM to obtain dense contextual information in a more efficient way. Different from the aforementioned studies, we propose an attention aggregation (AA) framework that focuses on the combination of different AMs. Based on this idea, our proposed AA-UNet and AA-RTFNet can take advantage of different AMs and yield accurate results for road pothole detection.
\subsection{Adversarial Domain Adaptation}
Since the concept of ``generative adversarial network (GAN)'' \cite{goodfellow2014generative} was first introduced in 2014, great efforts have been made in this research area to improve the existing computer vision algorithms. The recipe for their success is the use of an adversarial loss, {which makes the generated synthetic images become indistinguishable from the real images when minimized \cite{zhu2017unpaired}.}
Recent image-to-image translation approaches typically utilize a dataset, which contains paired source and target images, to learn a parametric translation using CNNs. One of the most well-known work is the ``pix2pix'' framework \cite{isola2017image} proposed by Isola {\textit{et al.}}, which employs a conditional GAN to learn the mapping from source images to target images.
In addition to the paired image-to-image translation approaches mentioned above, many unsupervised approaches have also been proposed in recent years to tackle unpaired image-to-image translation problem, where the primary goal is to learn a mapping $G: \mathcal{S}\rightarrow\mathcal{T}$ from source domain $\mathcal{S}$ to target domain $\mathcal{T}$, so that the distribution of images from $G(\mathcal{S})$ is indistinguishable from the distribution $\mathcal{T}$. CycleGAN \cite{zhu2017unpaired} is a representative work handling unpaired image-to-image translation, where an inverse mapping $F:\mathcal{T}\rightarrow\mathcal{S}$ and a cycle-consistency loss (aiming at forcing $F(G(\mathcal{S}))\approxeq \mathcal{S}$) were coupled with $G: \mathcal{S}\rightarrow\mathcal{T}$. Our proposed training set augmentation technique is developed based on CycleGAN \cite{zhu2017unpaired}, but it performs paired image-to-image translation.
\section{Disparity (or Inverse Depth) Transformation}
\label{sec.quasi_dense_inverse_perspective}
\begin{figure*}[t]
\centering
\includegraphics[width=0.70\textwidth]{./figs/qipt_example.jpg}
\caption{Disparity transformation: (a) RGB image; (b) disparity image produced by PT-SRP \cite{fan2018road}; and (c) transformed disparity image.}
\label{fig.qipt}
\end{figure*}
DT aims at transforming a disparity or inverse depth image $\mathbf{G}$ into a quasi bird's eye view, whereby the pixels in the undamaged road areas possess similar values, while they differ significantly from those of the pothole pixels.
Since the concept of ``v-disparity domain'' was introduced in \cite{labayrade2003single}, disparity image analysis has become a common technique used for 3D driving scene understanding \cite{fan2019real}. The projections of the on-road disparity (or inverse depth) pixels in the v-disparity domain can be represented by a non-linear model as follows:
\begin{equation}
\tilde{\mathbf{q}}=\mathbf{M}\tilde{\mathbf{p}}={\varkappa}\begin{bmatrix*}[r]
-\sin\Phi & \cos\Phi & \kappa\\
0 & {1}/{\varkappa} & 0 \\
0 & 0 & {1}/{\varkappa}
\end{bmatrix*}\tilde{\mathbf{p}},
\end{equation}
where $\tilde{\mathbf{p}}=[u,v,1]^\top$ is the homogeneous coordinates of a pixel in the disparity (or inverse depth) image, and $\tilde{\mathbf{q}}=[g,v,1]^\top$ is the homogeneous coordinates of its projection in the v-disparity domain. $\Phi$ can be estimated via \cite{fan2019real}:
\begin{equation}
\underset{\Phi}{\arg\min}\ \mathbf{g}^\top\mathbf{g}-\mathbf{g}^\top\mathbf{T}(\Phi)\big(\mathbf{T}(\Phi)^\top\mathbf{T}(\Phi)\big)^{-1}\mathbf{T}(\Phi)^\top\mathbf{g},
\label{eq.energy}
\end{equation}
where $\mathbf{g}$ is a $k$-entry vector of disparity (or inverse depth) values, $\mathbf{1}_k$ is a $k$-entry vector of ones, $\mathbf{u}$ and $\mathbf{v}$ are two $k$-entry vectors storing the horizontal and vertical coordinates of the observed pixels, respectively, and $\mathbf{T}(\Phi)=[\mathbf{1}_k,\cos\Phi \mathbf{v}-\sin\Phi \mathbf{u}]$. (\ref{eq.energy}) has a closed-form solution as follows \cite{fan2019road}:
\begin{equation}
\Phi
\arctan\frac{\omega_4\omega_0-\omega_3\omega_1+q\sqrt{\Delta}}{\omega_3\omega_2+\omega_5\omega_1-\omega_5\omega_0-\omega_4\omega_2}
\ \ \text{s.t.} \ q\in\{-1,1\},
\label{eq.phi}
\end{equation}
where
\begin{equation}
\Delta=(\omega_4\omega_0-\omega_3\omega_1)^2+(\omega_3\omega_2-\omega_5\omega_0)^2-(\omega_4\omega_2-\omega_5\omega_1)^2.
\label{eq.delta}
\end{equation}
The expressions of $\omega_0$-$\omega_5$ are given in \cite{fan2019road}. $\kappa$ and $\varkappa$ can then be obtained using:
\begin{equation}
\mathbf{x}= \varkappa\begin{bmatrix}
\kappa \\
1
\end{bmatrix}=\big(\mathbf{T}(\Phi)^\top\mathbf{T}(\Phi)\big)^{-1}\mathbf{T}(\Phi)^\top\mathbf{g}.
\end{equation}
DT can therefore be realized using \cite{fan2019road}:
\begin{equation}
\mathbf{G}'(\mathbf{p})=\mathbf{G}(\mathbf{p})-\varkappa\big(\cos\Phi v - \sin\Phi u \big) - \varkappa\kappa + \Lambda,
\end{equation}
where $\Lambda$ is a constant used to ensure that the values in the transformed disparity (or depth inverse) image $\mathbf{G}'$ are non-negative.
An example of the transformed disparity (or inverse depth) image is shown in Fig. \ref{fig.qipt}, where it can be observed that the damaged road area becomes highly distinguishable. The effectiveness of DT on improving semantic segmentation is discussed in Section \ref{sec.performance_evaluation}.
\section{Attention Aggregation Framework}
\label{sec.attention_combination_framework}
\begin{figure*}[t]
\centering
\includegraphics[width=\textwidth]{./figs/framework.pdf}
\caption{The architecture of the proposed attention aggregation framework for our AA-UNet and AA-RTFNet.}
\label{fig.acnet}
\end{figure*}
The architecture of our proposed attention aggregation framework is illustrated in Fig. \ref{fig.acnet}. We add different AMs into the existing CNNs that adopt the popular encoder-decoder architecture. Firstly, U-Net \cite{ronneberger2015u} has demonstrated the effectiveness of employing skip connections, which concatenate the same-scale feature maps produced by the encoder and decoder. However, these two feature maps can present large difference because of the different numbers of transformations undergone, which can result in significant performance degradation. To alleviate this drawback, we add an AM for the encoder feature map before the concatenation in each skip connection, as shown in Fig. \ref{fig.acnet} (from the 1st to ($n-1$)-th AMs), where $n$ denotes the number of network levels. These AMs enable the encoder feature maps to focus on the potholes, which can shorten the gap between the same-scale feature maps produced by the encoder and decoder. This further improves pothole detection performance. Secondly, many studies \cite{fu2019dual,huang2019ccnet} have already demonstrated that adding an AM for a high-level feature map can significantly improve the overall performance. Therefore, we follow this paradigm and add an AM at the highest level, as shown in Fig. \ref{fig.acnet} ($n$-th AM).
\begin{figure*}[t]
\centering
\includegraphics[width=\textwidth]{./figs/attention.pdf}
\caption{The illustrations of the three AMs used in our attention aggregation framework.}
\label{fig.attention}
\end{figure*}
We use three AMs in our attention aggregation framework: 1) Channel Attention Module (CAM), 2) Position Attention Module (PAM) and 3) Dual Attention Module (DAM) \cite{fu2019dual}, as illustrated in Fig. \ref{fig.attention}. Similar to SENet \cite{hu2018squeeze}, our CAM is designed to assign each channel with a weight since some channels are more important. It first employs a global average pooling layer to squeeze spatial information, and then utilizes fully connected (FC) layers to generate the WD, which is finally combined with the input feature map by element-wise multiplication operation to generate the output feature map. Different from CAM, our PAM focuses on spatial information. It first generates the spatial WD and applies it on the input feature map to generate the output feature map. DAM \cite{fu2019dual} is composed of a channel attention submodule and a position attention submodule. Different from our CAM and PAM, these two submodules adopt the self-attention scheme to generate the WD, which can achieve better performance at the expense of a higher computational complexity. Since the memory consumed by DAM will grow significantly with the increase of feature map size, we only use it at the highest level ($n$-th AM) so as to ensure computational efficiency.
To demonstrate the effectiveness of our framework, we employ it in a single-modal network (U-Net) and a data-fusion network (RTFNet), and dub them as AA-UNet and AA-RTFNet, respectively. The specific architectures (the selection of each AM) of our AA-UNet and AA-RTFNet are discussed in Section \ref{sec.architecture_selection}.
\section{Adversarial Domain Adaptation for Training Set Augmentation}
\label{sec.gan_data_augmentation}
In this paper, adversarial domain adaptation is utilized to augment training set so that the semantic segmentation networks can perform more robustly. Our proposed training set augmentation framework is illustrated in Fig. \ref{fig.gan_block}, where $F_1:\mathcal{S}_1\rightarrow\mathcal{T}$ translates RGB images ${s_1}_i\in\mathcal{S}_1$ to pothole detection ground truth $t_i\in\mathcal{T}$;
$G_1:\mathcal{T}\rightarrow\mathcal{S}_1$ translates
pothole detection ground truth $t_i\in\mathcal{T}$ back to RGB images ${s_1}_i\in\mathcal{S}_1$; $F_2:\mathcal{S}_2\rightarrow\mathcal{T}$ translates our transformed disparity images ${s_2}_i\in\mathcal{S}_2$ to pothole detection ground truth $t_i\in\mathcal{T}$;
and $G_2:\mathcal{T}\rightarrow\mathcal{S}_2$ translates
pothole detection ground truth $t_i\in\mathcal{T}$ back to our transformed disparity images ${s_2}_i\in\mathcal{S}_2$. The learning of $G_1$ and $G_2$ is guided by the intra-class means. Our full objective is:
\begin{equation}
\begin{split}
\mathcal{L}(G_1,G_2,F_1,F_2,D_{\mathcal{S}_1},D_{\mathcal{S}_2},D_{\mathcal{T}})
&=\mathcal{L}_\text{GAN}(G_1,D_{\mathcal{S}_1},\mathcal{T},{\mathcal{S}_1})+\mathcal{L}_\text{GAN}(F_1,D_{\mathcal{T}},{\mathcal{S}_1},\mathcal{T})\\
&+\mathcal{L}_\text{GAN}(G_2,D_{\mathcal{S}_2},\mathcal{T},{\mathcal{S}_2})+\mathcal{L}_\text{GAN}(F_2,D_{\mathcal{T}},{\mathcal{S}_2},\mathcal{T})\\
&+\mathcal{L}_\text{cyc}(G_1,F_1)+\mathcal{L}_\text{cyc}(G_2,F_2),
\end{split}
\end{equation}
where
\begin{equation}
\mathcal{L}_{GAN}(G,D_\mathcal{S},\mathcal{T},\mathcal{S})=
\mathbb{E}_{s\sim p_\text{data}(s)}[\log D_\mathcal{S}(s)]
+\mathbb{E}_{t\sim p_\text{data}(t)}[\log (1-D_\mathcal{S}(G(t)))],
\end{equation}
\begin{equation}
\mathcal{L}_{GAN}(F,D_\mathcal{T},\mathcal{S},\mathcal{T})=
\mathbb{E}_{t\sim p_\text{data}(t)}[\log D_\mathcal{T}(t)]
+\mathbb{E}_{s\sim p_\text{data}(s)}[\log (1-D_\mathcal{T}(F(s)))],
\end{equation}
\begin{equation}
\mathcal{L}_{cyc}(G,F)=
\mathbb{E}_{s\sim p_\text{data}(s)}[G(F(s))-s]
+\mathbb{E}_{t\sim p_\text{data}(t)}[F(G(t))-t],
\end{equation}
$D_\mathcal{S}$ and $D_\mathcal{T}$ are two adversarial discriminators: $D_\mathcal{S}$ aims to distinguish between images $\{s\}$ and the translated images $\{G(t)\}$, while $D_\mathcal{T}$ aims to distinguish between images $\{t\}$ and the translated images $\{F(s)\}$; $s\sim p_\text{data}(s)$ and $t\sim p_\text{data}(t)$ denote the data distributions of the source and target domains, respectively.
\begin{figure*}[t]
\centering
\includegraphics[width=\textwidth]{./figs/gan_block_diagram.pdf}
\caption{Adversarial domain adaptation for training set augmentation.}
\label{fig.gan_block}
\end{figure*}
\begin{figure*}[t]
\centering
\includegraphics[width=\textwidth]{./figs/gan_results.pdf}
\caption{Examples of training set augmentation results: (a) randomly created pothole detection ground truth; (b) generated RGB images; and (c) generated transformed disparity images.}
\label{fig.gan_results}
\end{figure*}
With well-learned mapping functions $G_1$ and $G_2$, we can generate an infinite number of synthetic RGB images ${{s_1}_i}'\in\mathcal{S}_1'$ and their corresponding synthetic transformed disparity images ${{s_2}_i}'\in\mathcal{S}_2'$ from a randomly generated pothole detection ground truth $t_i'\in\mathcal{T}'$. In order to expand the distributions of the two domains ${s_1}'\sim p_\text{data}({s_1}')$ and ${s_2}'\sim p_\text{data}({s_2}')$, we add random Gaussian noises $Z_1$ and $Z_2$ into $G_1$ and $G_2$ when generating ${{s_1}_i}'$ and ${{s_2}_i}'$, as shown in Fig. \ref{fig.gan_block}. Some examples in the augmented training set are shown in Fig. \ref{fig.gan_results}. The benefits of our proposed training set augmentation technique for semantic segmentation are discussed in Section \ref{sec.performance_evaluation}.
\section{Experiments}
\label{sec.exp}
\subsection{Datasets}
\label{sec.datasets}
\subsubsection{Pothole-600}
In our experiments, we utilized a stereo camera to capture stereo road images. These images are then split into a training set, a validation set and a testing set, which contains 240, 180 and 180 pairs of RGB images and transformed disparity images, respectively.
\subsubsection{Augmented Training Set}
We use adversarial domain adaptation to produce an augmented training set, which contains 2,400 pairs of RGB images and transformed disparity images. The performance comparison between using the original training set and using the augmented training set is presented in Section \ref{sec.performance_evaluation}.
\subsection{Experimental Setup}
\label{sec.setup}
In our experiments, we first select the architecture of our AA-UNet and AA-RTFNet, as presented in Section \ref{sec.architecture_selection}. Then, we compare our AA-UNet and AA-RTFNet with eight state-of-the-art (SoA) CNNs (five single-modal ones and three data-fusion ones) for road pothole detection. Each single-modal CNN is trained using RGB images (RGB) and transformed disparity images (T-Disp), respectively; while each data-fusion CNN is trained using RGB and transformed disparity images (RGB+T-Disp). Furthermore, we also select different numbers of RGB images and transformed disparity images from our augmented training set to train the CNNs. The experimental results are presented in Section \ref{sec.performance_evaluation}.
To quantify the performance of these CNNs, we adopt the commonly used F-score (Fsc) and intersection over union (IoU) metrics, and compute their mean values across the testing set, denoted as mFsc and mIoU, respectively. Moreover, the stochastic gradient descent with momentum (SGDM) \cite{lecun2015deep} is used to optimize the CNNs.
\begin{table*}[t]
\caption{Performances of different AA-UNet variants on the Pothole-600 validation set, where (A) is the U-Net baseline; and (B)--(T) are different variants. Best Results are shown in bold type.}
\centering
\begin{tabular}{C{0.8cm}C{1.1cm}C{1.1cm}C{1.1cm}C{1.1cm}C{1.1cm}C{1.5cm}C{1.5cm}C{1.5cm}}
\toprule
\multicolumn{1}{c}{\multirow{2}{*}{No.}} & \multicolumn{5}{c}{Attention Aggregation Scheme} & \multicolumn{3}{c}{Evaluation Metrics} \\ \cmidrule(l){2-6} \cmidrule(l){7-9}
\multicolumn{1}{c}{} & \multicolumn{1}{c}{1st} & \multicolumn{1}{c}{2nd} & \multicolumn{1}{c}{3rd} & \multicolumn{1}{c}{4th} & \multicolumn{1}{c}{5th} & \multicolumn{1}{c}{mFsc~($\%$)} & \multicolumn{1}{c}{mIoU~($\%$)} & \multicolumn{1}{c}{Runtime~(ms)} \\ \midrule
(A) & -- & -- & -- & -- & -- & 75.9 & 61.2 & \textbf{31.3} \\ \midrule
(B) & -- & -- & -- & -- & DAM & 79.7 & 66.3 & 33.7 \\
(C) & -- & -- & -- & -- & CAM & 79.5 & 66.0 & 31.5 \\
(D) & -- & -- & -- & -- & PAM & 79.4 & 65.9 & 31.7 \\
(E) & -- & -- & -- & CAM & -- & 78.7 & 64.9 & 31.6 \\
(F) & -- & -- & -- & PAM & -- & 78.5 & 64.6 & 31.9 \\
(G) & -- & -- & CAM & -- & -- & 78.0 & 63.9 & 31.8 \\
(H) & -- & -- & PAM & -- & -- & 77.7 & 63.5 & 32.0 \\
(I) & -- & CAM & -- & -- & -- & 77.8 & 63.6 & 32.1 \\
(J) & -- & PAM & -- & -- & -- & 77.5 & 63.2 & 32.6 \\
(K) & CAM & -- & -- & -- & -- & 77.6 & 63.4 & 32.3 \\
(L) & PAM & -- & -- & -- & -- & 77.8 & 63.7 & 33.5 \\ \midrule
(M) & -- & -- & -- & CAM & DAM & 80.2 & 66.9 & 33.8 \\
(N) & -- & -- & -- & PAM & DAM & 77.1 & 62.7 & 34.0 \\
(O) & -- & -- & CAM & CAM & DAM & 80.7 & 67.6 & 33.9 \\
(P) & -- & -- & PAM & CAM & DAM & 77.8 & 63.6 & 34.2 \\
(Q) & -- & CAM & CAM & CAM & DAM & 81.0 & 68.0 & 34.1 \\
(R) & -- & PAM & CAM & CAM & DAM & 79.7 & 66.2 & 34.5 \\
(S) & CAM & CAM & CAM & CAM & DAM & 81.3 & 68.5 & 34.3 \\
(T) & PAM & CAM & CAM & CAM & DAM & \textbf{82.6} & \textbf{70.3} & 34.7 \\
\bottomrule
\end{tabular}
\label{tab.aa_unet}
\end{table*}
\begin{table*}[t]
\caption{Performances of different AA-RTFNet variants on the Pothole-600 validation set, where (A) is the RTFNet baseline; and (B)--(J) are different variants. Best Results are shown in bold type.}
\centering
\begin{tabular}{C{0.8cm}C{1.1cm}C{1.1cm}C{1.1cm}C{1.1cm}C{1.1cm}C{1.5cm}C{1.5cm}C{1.5cm}}
\toprule
\multicolumn{1}{c}{\multirow{2}{*}{No.}} & \multicolumn{5}{c}{Attention Aggregation Scheme} & \multicolumn{3}{c}{Evaluation Metrics} \\ \cmidrule(l){2-6} \cmidrule(l){7-9}
\multicolumn{1}{c}{} & \multicolumn{1}{c}{1st} & \multicolumn{1}{c}{2nd} & \multicolumn{1}{c}{3rd} & \multicolumn{1}{c}{4th} & \multicolumn{1}{c}{5th} & \multicolumn{1}{c}{mFsc~($\%$)} & \multicolumn{1}{c}{mIoU~($\%$)} & \multicolumn{1}{c}{Runtime~(ms)} \\ \midrule
(A) & -- & -- & -- & -- & -- & 81.3 & 68.5 & \textbf{46.7} \\ \midrule
(B) & -- & -- & -- & -- & DAM & 82.5 & 70.2 & 49.1 \\
(C) & -- & -- & -- & CAM & DAM & 82.6 & 70.4 & 49.2 \\
(D) & -- & -- & -- & PAM & DAM & 81.7 & 69.0 & 49.4 \\
(E) & -- & -- & CAM & CAM & DAM & 82.8 & 70.7 & 49.3 \\
(F) & -- & -- & PAM & CAM & DAM & 81.9 & 69.3 & 49.7 \\
(G) & -- & CAM & CAM & CAM & DAM & 83.4 & 71.6 & 49.6 \\
(H) & -- & PAM & CAM & CAM & DAM & 83.1 & 71.1 & 49.9 \\
(I) & CAM & CAM & CAM & CAM & DAM & 84.1 & 72.5 & 50.0 \\
(J) & PAM & CAM & CAM & CAM & DAM & \textbf{85.0} & \textbf{73.9} & 50.2 \\
\bottomrule
\end{tabular}
\label{tab.aa_rtfnet}
\end{table*}
\subsection{Architecture Selection of AA-UNet and AA-RTFNet}
\label{sec.architecture_selection}
In this subsection, we conduct experiments to select the best architecture for our AA-UNet and AA-RTFNet. All the AA-UNet variants use the same training setups, so do all the AA-RTFNet variants. It should be noted here that $n=5$ is for both AA-UNet and AA-RTFNet. We also record the inference time of each variant on an NVIDIA GTX 1080Ti graphics card for comparison. (B)--(L) in Table~\ref{tab.aa_unet} present the effects of a single AM at different network levels. We can see that an AM can bring in better performance improvement when it is added at a higher level, as this can influence the subsequent processes. Moreover, DAM outperforms CAM and PAM at the highest level, since DAM adopts the self-attention scheme, which can achieve better performance, as mentioned above. Furthermore, our CAM performs better than our PAM at higher levels, since feature maps at higher levels have more channels but limited spatial sizes and it is more useful to apply weights on channels. Conversely, feature maps at lower levels have larger spatial sizes but limited channels, and thus it is more useful to adopt our PAM.
Based on these observations, we test the performance of different attention aggregation schemes for our AA-UNet and AA-RTFNet on the validation set, as shown on (M)--(T) in Table \ref{tab.aa_unet} and (B)--(J) in Table \ref{tab.aa_rtfnet}, respectively. We can see that adopting PAM at the lowest network level, adopting DAM at the highest network level, and adopting CAM at other network levels can achieve the best performance for both AA-UNet and AA-RTFNet. Compared with the baseline models, our AA-UNet and AA-RTFNet can increase the mIoU by 9.1\% and 5.4\%, respectively, with acceptable extra runtime, which demonstrates the effectiveness and efficiency of our attention aggregation framework.
\begin{figure}[!htbp]
\centering
\includegraphics[width=0.999\textwidth]{./figs/evaluation.pdf}
\caption{Performance comparison among eight SoA CNNs, AA-UNet and AA-RTFNet on the Pothole-600 testing set, where the symbol ``\#'' in the $\lambda$ axis means that we use the original training set in the CNN. }
\label{fig.evaluation}
\end{figure}
\begin{figure}[!htbp]
\centering
\includegraphics[width=0.999\textwidth]{./figs/comparison.pdf}
\caption{An example of the experimental results on the Pothole-600 testing set. For the input and ground truth label block: (a) RGB, (b) T-Disp, and (c) ground truth label; For the single-modal network (including U-Net \cite{ronneberger2015u}, PSPNet \cite{zhao2017pyramid}, DeepLabv3+ \cite{chen2018encoder}, DenseASPP \cite{yang2018denseaspp}, GSCNN \cite{takikawa2019gated} and our AA-UNet) blocks: (a) input RGB from the original training set, (b) input RGB from the whole augmented training set, (c) input T-Disp from the original training set, and (d) input T-Disp from the whole augmented training set; For the data-fusion network (including FuseNet \cite{hazirbas2016fusenet}, Depth-aware CNN \cite{wang2018depth}, RTFNet \cite{sun2019rtfnet} and our AA-RTFNet) blocks: (a) input RGB+T-Disp from the original training set, and (b) input RGB+T-Disp from the whole augmented training set.}
\label{fig.comparison}
\end{figure}
\subsection{Performance Evaluation of Road Pothole Detection}
\label{sec.performance_evaluation}
In this subsection, we evaluate the performance of our AA-UNet and AA-RTFNet both qualitatively and quantitatively on the testing set. As mentioned previously, we use different numbers of images selected from the augmented training set to train each CNN. $\lambda$ denotes the number of samples used in the augmented training set versus the number of samples in the original training set. For example, $\lambda=2$ means that we train the CNN with $240 \times 2 = 480$ samples randomly selected from the augmented training set. In addition, we introduce a new evaluation metric $\delta$ for better comparison. For a given training setup, $\delta$ is defined as ratio of the number of iterations for the network to converge using the augmented training set to that of the original training set. $\delta < 1$ means that the training setup converges faster than the baseline setup.
The quantitative results are shown in Fig. \ref{fig.evaluation}, where we can clearly observe that the single-modal CNNs with our transformed disparity images as inputs generally perform better than they do with RGB images as inputs, and the mIoU increases by about 17--31\%. This is because our transformed disparity images can make the road potholes become highly distinguishable, and can thus benefit all CNNs for road pothole detection. Moreover, we can see that when $\lambda \geq 4$, the CNNs trained with the augmented training set generally outperform themselves when trained with the original training set, and $\delta < 1$ holds in most cases, which demonstrates that adversarial domain adaptation can not only significantly improve pothole detection accuracy but can also accelerate the network convergence. Compared with the training setup using the original training set, an increase of around 3--8\% is witnessed on the mIoU for the training setup using the whole augmented training set. This is because these two sets share very similar distributions, and our augmented training set possesses an expanded distribution, which can improve road pothole detection performance. In addition, our AA-UNet and AA-RTFNet outperform all other SoA single-modal and data-fusion networks for road pothole detection, respectively, which strongly validates the effectiveness and efficiency of our attention aggregation framework. Readers can see that our AA-UNet can increase the mIoU by approximately 3--14\% compared with the SoA single-modal networks, and our AA-RTFNet can increase the mIoU by about 5--8\% compared with the SoA data-fusion networks. The qualitative results shown in Fig. \ref{fig.comparison} can also confirm the superiority of our proposed approaches.
\section{Conclusion}
\label{sec.conclusion}
The major contributions of this paper include: a) a novel attention aggregation framework, which can help the CNNs focus more on salient objects, such as road potholes, so as to improve semantic segmentation for better pothole detection results; b) a novel training set augmentation technique developed based on adversarial domain adaptation, which can produce more synthetic road RGB images and their corresponding transformed road disparity (or inverse depth) images to improve both the efficiency and accuracy of CNN training; c) a large-scale road pothole detection dataset, publicly available at \url{sites.google.com/view/pothole-600} for research purposes. The experimental results validated the effectiveness and feasibility of our proposed attention aggregation framework and the training set augmentation technique for enhancing road pothole detection. Moreover, we believe our proposed techniques can also be used for many other semantic segmentation applications, such as freespace detection.
\section*{Acknowledgements}
This work was supported by the National Natural Science Foundation of China, under grant No. U1713211, Collaborative Research Fund by Research Grants Council Hong Kong, under Project No. C4063-18G, and the Research Grant Council of Hong Kong SAR Government, China, under Project No. 11210017, awarded to Prof. Ming Liu.
\clearpage
| {'timestamp': '2020-12-14T02:14:34', 'yymm': '2008', 'arxiv_id': '2008.06840', 'language': 'en', 'url': 'https://arxiv.org/abs/2008.06840'} | arxiv |
\section{Introduction}
Re-IDentification (Re-ID) aims to identify the same person across a set of images from nonoverlapping camera views, facilitating cross-camera tracking techniques used in video surveillance for public security and safety.
In general, person Re-ID is considered to be the next high-level task after a pedestrian detection system.
Therefore, as shown in Figure~\ref{fig:hard_case}(a), the basic assumption of Re-ID is that the detection model can provide a precise and highly-aligned bounding box for each individual.
However, in a crowded scene, off-shelf-detectors may draw a bounding box containing multiple people, as shown in Figure~\ref{fig:hard_case}(b).
This means the cropped images contain both the target and the interference pedestrians.
The interference pedestrian makes the feature ambiguous to identify the target person, which might lead to wrong retrieval results.
We call this the Pedestrian-Interference person Re-IDentification (PI Re-ID) problem.
\begin{figure*}[!tb]
\begin{center}
\includegraphics[width=8cm]{figure/motivation5.jpg}
\caption{Typical samples in the (a) traditional Re-ID, (b) Pedestrian-Interference Re-ID, and (c) Occluded Re-ID from Market-1501~\cite{zheng2015scalable}, our constructed PI-CUHK-SYSU, and Occluded-DukeMTMC~\cite{ristani2016MTMC,zheng2017unlabeled}, respectively.
%
(d) shows the query image (the first sample) and, the comparison of visualization results between the Occluded Re-ID method Foreground-aware Pyramid Reconstruction~\cite{He_2019_ICCV} (the second one) and our PISNet (the third one)
}
\label{fig:hard_case}
\end{center}
\end{figure*}
We observe that mutual occlusion of pedestrians often occurs in PI Re-ID.
Recent works~\cite{He_2019_ICCV,Miao_2019_ICCV,vpm_cvpr2019,Fan_2019} have well studied the Occluded Re-ID problem.
However, in their setting of Occluded Re-ID, the person images are mainly occluded by obstructions like cars, trees, or shelves.
This is also reflected in the existing benchmarking Occluded Re-ID datasets, most of which consist of non-pedestrian occlusion, as shown in Figure~\ref{fig:hard_case}(c).
The performance of their approaches degrades if directly applied to PI Re-ID, as shown in the second sample of Figure~\ref{fig:hard_case}(d).
Because they only focus on reducing the influence caused by obstructions and do not specifically consider the interference between pedestrians in a cropped image.
Moreover, they do not explicitly learn to draw a precise boundary between two overlapping people so that the extract features are corrupted by each other.
As for PI Re-ID, it is different from Occluded Re-ID in two aspects: 1) PI Re-ID focuses on the pedestrian interference, which is more confusing than the non-pedestrian obstructions.
2) PI Re-ID aims to re-identify all the pedestrians appearing in a cropped image, which might be interfered with the background pedestrians or the pedestrian occlusion.
Therefore, our setting is more challenging than Occluded Re-ID.
Moreover, our setting is more practical in the crowded situation (\textit{e.g.}, airports, railway stations, malls, and hospitals), where people always share overlapping regions under cameras.
To retrieve a person in the PI Re-ID setting, the extracted features should ensure 1) \textbf{location accuracy}: the strong activation on all the regions of targets, 2) \textbf{feature distinctiveness}: the trivial feature corruption by other pedestrians.
To achieve this goal, we propose a novel deep network termed Pedestrian-Interference Suppression Network (PISNet), which consists of a backbone Fully Convolutional Network (FCN), a Query-Guided Attention Block (QGAB) and a Guidance Reversed Attention Module (GRAM).
First, FCN is utilized to extract features for person images.
Since the target feature, in a gallery image containing multi-person information, differs on the query,
QGAB is designed to enhance the feature of the target in the gallery and suppress that of interference pedestrians, under the guidance of the query.
On the one hand, as shown Figure~\ref{fig:simple_illus}(a), for encouraging the \textbf{location accuracy} of the attention, our motivation is that, if the attention well covers the regions of the target, the attention feature can be further utilized as the guidance to search the target in other multi-person images.
Therefore, GRAM leverages the refined gallery features to guide other multi-person features to formulate attention for targets.
On the other hand, as shown in Figure~\ref{fig:simple_illus}(b), to facilitate the \textbf{feature distinctiveness} of the attention learning, PISNet utilizes the Multi-Person Separation Loss (MPSL) to maximize the distance between the features, which are extracted from the same gallery but guided by different queries.
In addition, as shown in the third sample of Figure~\ref{fig:hard_case}(d), our PISNet is more capable of depressing the pedestrian interference than the Occluded Re-ID method.
\begin{figure*}
\begin{center}
\includegraphics[width=10cm]{figure/method_illustration6.jpg}
\caption{(a) Enhance the location accuracy of the attention by GRAM. (b) Facilitate the feature distinctiveness of the attention by MPSL}
\label{fig:simple_illus}
\end{center}
\end{figure*}
Our {\bf contributions} are listed as follows: 1) To the best of our knowledge, it is the first work that particularly addresses the problem of PI Re-ID.
2) We propose a Pedestrian-Interference Suppression Network (PISNet), which utilizes a query-guided approach to extract the target feature. The involving GRAM and MPSL further promote the location accuracy and the feature distinctiveness of the attention learning, respectively.
3) Since the existing benchmarks largely ignored this problem, we contribute two new datasets, which are specifically designed for this problem with a great deal more pedestrian-interference instances.
Our experimental results on these two datasets show that the proposed model is effective in addressing the PI Re-ID problem, yielding significant improvement over representative Re-ID methods applied to the same problem.
The experimental results also demonstrate the generalization ability of our method on the general Re-ID datasets (Market-1501 and DukeMTMC-ReID).
\section{Related Work}
\subsection{Person Re-ID}
Generally, Person Re-ID can be divided into two steps: calculating a feature embedding and performing feature matching under some distance metric~\cite{weinberger2006distance,li2013learning,khamis2014joint}. We mainly review the former including both handcrafted feature~\cite{khamis2014joint,koestinger2012large,li2013locally,ma2012bicov} and learned feature~\cite{li2014deepreid,zhao2014learning,cheng2016person,hermans2017defense,liao2017triplet,zheng2018pyramidal} approaches.
In recent years, Re-ID has witnessed great progress owing to the prevailing success of convolutional neural networks (CNNs) in computer vision.
However, simply applying CNNs to feature extraction may not yield ideal Re-ID performance due to many problem-specific challenges such as partial body, background perturbance, view point variation, as well as occlusion/misalignment.
Combining the image-level information with the human-part information can enhance the robustness of Re-ID models.
Moreover, many part-based approaches have achieved considerable improvement~\cite{gray2008viewpoint,prosser2010person,liao2015person,ma2013domain,zheng2013reidentification,cheng2016person,su2017pose,wei2017glad,zheng2017pose,zhu2017part,suh2018part,zhao2017deeply,zhao2017spindle}. We refer readers to \cite{zheng2016person} for a more comprehensive review.
\subsection{Attention Mechanisms in Person Re-ID}
Several studies leverage attention mechanisms to address the misalignment problem in person Re-ID.
For example, Chen et al.~\cite{Chen_2019_ICCV} propose an attentive but diverse network which consists of a pair of complementary attention modules, focusing on channel aggregation and position awareness, respectively.
Si et al.~\cite{si2018dual} use an inter-class and an intra-class attention module to capture the context information for person Re-ID in video sequences.
Li et al.~\cite{Li_2018_CVPR} leverage hard region-level and soft pixel-level attention, which can jointly produce more discriminative feature representations.
Xu et al.~\cite{xu2018attention} utilize pose information to learn attention masks and then combine the global with the part features as feature embeddings.
Previous methods~\cite{Chen_2019_ICCV,Xia_2019_ICCV,xu2018attention} leverage attention mechanisms to enhance the feature of human bodies.
In contrast, in our proposed setting, images contain other pedestrians, which severely corrupt the feature of a target.
Since they cannot distinguish between the target and interference pedestrians, directly applying their approaches will cause the severe corruption of the target feature.
.
\subsection{Occluded Re-ID}
Some related works for the Occluded Re-ID have been well studied.
Zheng et al.~\cite{zheng_partial} propose an Ambiguity sensitive Matching Classifier (AMC) and a Sliding Window Matching (SWM) model for the local patch-level matching and the part-level matching, respectively.
He et al.~\cite{he2018deep} propose a Deep Spatial Feature Reconstruction (DSR) model for the alignment-free matching, which can sparsely reconstruct the spatial probe maps from spatial maps of gallery images.
He et al.~\cite{He_2019_ICCV} further present a Spatial Feature Reconstruction (SFR) method to match different sized feature maps for the Partial Re-ID.
Miao et al.~\cite{Miao_2019_ICCV} propose the Pose-Guided Feature Alignment (PGFA), which introduces the pose estimation algorithm to enhance the human part feature in an occlusion image.
Sun et al.~\cite{vpm_cvpr2019} propose a self-supervision model called Visibility-aware Part Model (VPM), which can perceive the visibility of regions.
Fan et al.~\cite{Fan_2019} propose a spatial-channel parallelism network (SCPNet), which enhances the feature of a given spatial part of the body in each channel of the feature map.
These methods ignore the interference between pedestrians within a cropped image.
Therefore, they cannot well address the PI Re-ID problem, where the large proportion of the pedestrian interference exists.
In contrast, in this paper, we focus on suppressing the pedestrian interference, by learning the query-guided attention with the location accuracy and the feature distinctiveness.
\section{Pedestrian-Interference Suppression Network}
\label{sec:method}
In this work, we assume that in PI Re-ID a query image contains only a single person and the task is to match this query with a gallery consisting of the pedestrian interference.
This is based on a practical scenario where a human operator has manually cropped the human body and sent a query to a Re-ID system to search for the same person in another camera view.
In this section, we first give an overview of our framework, and then describe more details for each component individually.
\subsection{Overview}
As shown in Figure~\ref{fig:sranet}, PISNet consists of (1) a backbone Fully Convolutional Network (FCN),
(2) a Query-Guided Attention Block (QGAB), and
(3) a Guidance Reversed Attention Module (GRAM).
For each forward propagation in the training stage, we pair a gallery image with a query image.
FCN can extract features for the query and the gallery.
QGAB finds the common regions between the query and gallery feature maps, and then enhances the common feature in the gallery feature.
For encouraging the location accuracy of the attention, GRAM aims to guarantee that the refined gallery feature has strong attention on all the regions of the target.
For the feature distinctiveness of the attention, the Multi-person Separation Loss (MPSL) magnifies distance of the features from the same gallery but guided by different queries.
In addition, GRAM is ignored in the testing stage.
\begin{figure*}[!tb]
\begin{center}
\includegraphics[width=12cm]{figure/PISNet10.jpg}
\caption{Illustration of our Pedestrian-Interference Suppression Network (PISNet).
%
For further clarity, the target feature represents the same ID information to the query.
%
PISNet consists of (1) a backbone Fully Convolutional Network (FCN),
%
(2) a Query-Guided Attention Block (QGAB), and
(3) a Guidance Reversed Attention Module (GRAM).
%
FCN can extract features for the query and the gallery.
%
QGAB leverages the query feature as the guiding feature (single-person) to formulate attention on the gallery feature (with pedestrian interference).
%
GRAM plays a role in encouraging QGAB to enhance the feature on the regions of a target.
%
The Multi-person Separation Loss promotes the attention to draw a more precise boundary for overlapping instances.
%
$g_{i}$ and $q_{i}$ denote the feature map of a gallery and a query, respectively.
%
$g^{a}_{i}$ and $q^{c}_{i}$ are the refined gallery feature and the corrupted query feature, respectively.
%
GMP denotes the Global Max Pooling.
%
QGABs share the same parameters.
%
(G) denotes the feature as the guidance to QGAB.
%
GRAM is only used in the training stage
}
\label{fig:sranet}
\end{center}
\end{figure*}
\subsection{Query-Guided Attention Block}
QGAB is depicted in Figure~\ref{fig:qgab}.
The main goal of this block is to search for spatial similarity between the query and the multi-person gallery.
The inputs of QGAB are the query and gallery feature maps.
The query is used as the guidance.
The output is the spatially enhanced gallery feature.
The spatial similarity calculates the inner product of the features from gallery and query branch first, after which Global Max Pooling (GMP) in the channel dimension is applied to formulate a pixel-wise attention matrix.
This matrix then is multiplied with the gallery feature in order to enforce a spatial similarity search between the query and gallery feature maps.
The overall process of this feature enhancement is formulated as:
\begin{equation}
QGAB(g_{i},q_{i}) = GMP\big(Softmax({c_{1}(g_{i})}^{T} \times {c_{2}(q_{i})})\big) \times g_{i} + g_{i},
\end{equation}
\noindent where $g_{i}$ is the multi-person feature (gallery), $q_{i}$ is the single-person feature (query), $c_{1}$ and $c_{2}$ are convolutional layers, $GMP$ is the Global Max Pooling in the channel dimension and $\times$ denotes matrix multiplication.
\begin{figure*}[!tb]
\begin{center}
\includegraphics[width=8cm]{figure/QGAB12.jpg}
\caption{Illustration of our proposed Query-Guided Attention Block (QGAB).
%
$g_{i}$ denotes the feature map of a gallery.
$q_{i}$ is the feature map of a query.
The feature maps are shown as the shape of their tensors.
$W$ and $H$ are the width and height of the gallery feature map.
$W^{'}$ and $H^{'}$ are the width and height of the query feature map.
$C$ is the number of channels after the backbone.
GMP denotes the Global Max Pooling
}
\label{fig:qgab}
\end{center}
\end{figure*}
\begin{figure*}
\begin{center}
\includegraphics[width=8cm]{figure/fc9.jpg}
\caption{Illustration of the feature corruption.
$q_{i}$ denotes the query feature map.
$s_{i}$ denotes the feature map of the sampled single-person image.
$PR$ denotes the function that extracts the relative position relationship of ground-truth boxes from a multi-person image.
Two features are combined following the relative position relationship
}
\label{fig:fc4}
\end{center}
\end{figure*}
\subsection{Guidance Reversed Attention Module}
GRAM aims to guarantee that the refined gallery feature has the strong attention on all the regions of the target.
As shown in Figure~\ref{fig:simple_illus}(a), our motivation is that a well-refined gallery feature can be used as the guidance to formulate the attention for another gallery feature containing the pedestrian interference.
For example, if a gallery contains IDs of A and B.
Using the query image of A, the well-refined gallery feature will have the strong activation on regions of A while the feature of B is suppressed.
Therefore, the refined feature should be capable of serving as the guidance to formulate attention for another gallery containing person A.
In this new attention mask, we expect the feature of A is still enhanced and the feature of another pedestrian is suppressed.
The attention formulation for person A in these two feature maps is encouraged by each other.
Therefore, as shown in Figure~\ref{fig:sranet}, we utilize the feature, which is refined by our query-guided attention operation, as the guidance feature to formulate the spatial attention on another gallery feature map.
In order to reduce the labour of the data collection, we construct the new gallery by a feature corruption operation.
Specifically, we randomly select a single-person image and a gallery image with the pedestrian interference.
We can extract the single-person feature from the former and the relative position relationship of the involving ground-truth bounding boxes from the latter.
Then we corrupt the query feature by combining it with the single-person feature.
Specifically, as shown in Figure~\ref{fig:fc4}, following the relative position relationship, we put two feature maps on the corresponding positions to generate a multi-person feature map and we pad the remaining regions with zero.
The process of this feature corruption is formulated as:
\begin{equation}
FC(q_{i}, s_{i}, m) = Combine(q_{i}, s_{i}, PR(m)),
\end{equation}
\noindent where $s_{i}$ is the feature map of the sampled single person image, $m$ denotes the image with pedestrian interference, $PR$ denotes the function that extracts the relative position relationship of ground-truth boxes from $m$, and $Combine$ denotes the function that can combine features depending on the relative position relationship of bounding boxes.
Then we input the corrupted query feature and the refined gallery feature into QGAB.
In contrast to the last QGAB operation, we reverse the roles of two features.
The refined gallery feature is served as a query feature that can guide QGAB to enhance the target feature in the corrupted query features.
The overall process of reversed feature enhancement is formulated as:
\begin{equation}
QGAB^{r}(g^{a}_{i},q^{c}_{i}) = GMP\big({Softmax(c_{1}(q^{c}_{i})}^{T} \times {c_{2}(g^{a}_{i})})\big) \times q^{c}_{i} + q^{c}_{i},
\end{equation}
\noindent where $g^{a}_{i}$ is the refined gallery feature, $q^{c}_{i}$ is the corrupted query feature, and $c_{1}$ and $c_{2}$ share parameters with the last QGAB.
\begin{figure*}[!tb]
\begin{center}
\includegraphics[width=10cm]{figure/mpsloss6.jpg}
\caption{The computation process of the Multi-Person Separation Loss.
%
$q_{a}$ and $q_{b}$ denote the queries.
%
$g_{ab}$ is the gallery.
%
The subscripts represent the IDs that appear in the image.
%
In one batch, we pair a multi-person gallery image with different query images as the guidances.
%
To promote the feature distinctiveness of the attention, the distance between the refined features guided by different query images should be maximized
}
\label{fig:mpsloss}
\end{center}
\end{figure*}
\subsection{Multi-Person Separation Loss}
In a pedestrian-interference image, people always share an overlapping area of their body.
This is the key reason that causes the failure detection.
Moreover, it also improves the difficulty of the attention learning.
Therefore, we conduct the feature distinctiveness enhancement by the Multi-Person Separation Loss for further guaranteeing the purity of refined features.
As shown in Figure~\ref{fig:simple_illus}(b), we expect that the refined feature should have a large distance to the feature guided by another query image with a different person ID.
For example, if a gallery image contains A and B, given the query image of A, we expect to extract the pure feature of A while suppressing the feature of B.
In contrast, given the query image of person B, the pure feature of B should be extracted.
In order to achieve this goal, as shown in Figure~\ref{fig:mpsloss}, we first construct the image batch for training, where a multi-person gallery image is paired with different query images as the guidances.
Then, the distances can be minimized and maximized, respectively, by the Multi-Person Separation Loss, which is given by,
\begin{equation}
\begin{aligned}
L_{m} = max(0, c + dist(QGAB(g_{ab},q_{a}), QGAB(g_{ab},q_{b})) - \\
dist(QGAB(g_{ab},q_{a}), q_{a})),
\end{aligned}
\end{equation}
\noindent where $dist$ is the cosine distance and $c$ denotes the margin coefficient.
We should maximize the distance between $QGAB(g_{ab},q_{a})$ and $QGAB(g_{ab},q_{b})$ and meanwhile minimize the distance between $QGAB(g_{ab},q_{a})$ and $q_{a}$, where the subscripts represent the IDs that appear in the image.
\subsection{Overall Objective Function}
We utilize the cross entropy loss for both the gallery branch and GRAM, which is denoted as $L_g$ and $L_q$, which is corresponding to $ID\ Loss_{1}$ and $ID\ Loss_{2}$, respectively, in Figure~\ref{fig:sranet}.
\begin{equation}
L_{g} = CE(\hat{y},y),
\end{equation}
\begin{equation}
L_{q} = CE(\bar{y},y),
\end{equation}
\noindent where $CE$ denotes the cross-entropy loss, $\hat{y}$ and $\bar{y}$ denote the prediction ID in the gallery branch and GRAM, respectively, and $y$ is the ground-truth ID.
By combining with the Multi-Person Separation Loss, the final loss for the network is formulated as
\begin{equation}
L_{final} = L_{g} + \alpha*L_{q} + \beta*L_{m},
\end{equation}
\noindent where $\alpha$ and $\beta$ are the coefficients to balance the contributions from the latter two losses.
\subsection{Implementation Details}
To implement our proposed model, we adopt Resnet-50~\cite{he2016deep} as our basic CNN for feature extraction, which is pretrained on ImageNet.
We first train the backbone on the single-person images using all training tricks in the strong baseline~\cite{luo2019bag}. Then we add QGAB on the top of the Siamese Network.
Both $c_{1}$ and $c_{2}$ are $1 \times 1$ convolutional layers with 1024 channels.
Then we freeze the backbone network and train QGAB by pairing the multi-person images with single person ones.
The batch size of samples for training is 64.
The SGD optimizer is applied, with a learning rate of 0.00035.
They are decayed by 0.1 after 20 epochs, and the training stops at 60 epochs.
Parameters for the final loss function are $\alpha=1.0$ and $\beta=0.5$.
\section{Experiments}
\subsection{Datasets and Evaluation Metrics}
To demonstrate the effectiveness of our model on the Person-Interference Re-ID problem, we carry out the experiment on our constructed PI-PRW and PI-CUHK-SYSU dataset.
Besides, in order to prove the generalization ability of our method on single-person images, we also evaluate the proposed PISNet on the another two datasets: Market-1501~\cite{zheng2015scalable} and DukeMTMC-ReID~\cite{ristani2016MTMC,zheng2017unlabeled}.
\noindent \textbf{PI-PRW} is derived from the PRW~\cite{Zheng_2017_CVPR} dataset.
We use the off-the-shelf detector Faster R-CNN~\cite{ren2015faster} to perform pedestrian detection. Then we select the bounding boxes with multiple pedestrians.
The selection criterion is: 1) At least 70\% area of each ground-truth bounding box should be contained in the multi-person boxes.
2) The contained part of bounding boxes is at least 0.3 times the size of multi-person boxes in order to ensure the degree of the person interference.
3) Each bounding box has the overlapping area with any other ones.
We get 1792 multi-person images with 273 IDs for training and 1258 multi-person gallery images and 211 single person query images for testing.
Besides, in order to get closer to the actual scene, we add another 10000 single-person images in the test set as gallery images.
\noindent \textbf{PI-CUHK-SYSU} is derived from the CUHK-SYSU~\cite{Xiao_2017_CVPR} dataset.
We get multi-person cropped images following the same procedure in PI-PRW, resulting 3600 multi-person images for training with 1485 IDs and 3018 multi-person gallery images and 1479 single person query images for testing.
We also add another 10000 single-person images in the test set as gallery images.
More details of PI-PRW and PI-CUHK-SYSU can be referred to our supplementary material.
\noindent \textbf{Evaluation Metrics.} We use Cumulative Matching Characteristic (CMC) curves and mean average precision (mAP) to evaluate the quality of different Re-ID models. All the experiments are performed in a single query setting.
\begin{table}
\begin{center}
\caption{\label{tbl:pre}Comparison results ($\%$) on PI-PRW and PI-CUHK-SYSU dataset at $4$ evaluation metrics: \textit{rank 1}, \textit{rank 5}, \textit{rank 10}, \textit{mAP} where the bold font denotes the best method.
The methods in the 1st group are proposed for the traditional Re-ID problem.
The methods in the 2nd group are proposed for the multi-label learning.
The 3rd group is the methods of Occluded Re-ID.
The 4th group is our method}
{\footnotesize
\begin{tabular}{l|ccc|c|ccc|c}
\hline
\hline
\multirow{2}{*}{Method} & \multicolumn{4}{c|}{PI-PRW} & \multicolumn{4}{c}{PI-CUHK-SYSU} \\
\cline{2-9}
& \textit{rank1} & \textit{rank 5} & \textit{rank 10} & \textit{mAP} &\textit{rank1} & \textit{rank 5} & \textit{rank 10} & \textit{mAP}\\
\hline\hline
HA-CNN~\cite{Li_2018_CVPR} & 32.4 & 56.9 & 68.0 & 32.0 & 71.3 & 82.0 & 87.5 & 65.3\\
PCB~\cite{sun2018beyond} & 31.3 & 55.1 & 67.5 & 30.2 & 70.1 & 80.4 & 86.9 & 63.1 \\
Strong Baseline~\cite{luo2019bag} & 34.7 & 59.4 & 70.3 & 36.0 & 72.5 & 83.9 & 88.2 & 70.1 \\
PyramidNet~\cite{Zheng_2019_CVPR} & 35.9 & 60.2 & 70.1 & 37.0 & 73.1 & 83.5 & 87.9 & 70.5 \\
ABD-Net~\cite{Chen_2019_ICCV} & 35.4 & 59.9 & 69.7 & 36.3 & 72.9 & 82.6 & 87.5 & 70.4 \\
QAConv~\cite{Shengcai_QG} & 36.0 & 61.2 & 70.9 & 38.2 & 73.2 & 84.7 & 88.3 & 70.9 \\
\hline
HCP~\cite{hcp_2016} & 30.2 & 49.7 & 61.2 & 29.6 & 67.2 & 75.3 & 83.5 & 61.9 \\
LIMOC~\cite{Yang_2016_CVPR} & 32.9 & 52.4 & 63.3 & 32.6 & 69.1 & 78.2 & 85.3 & 65.2 \\
\hline
FPR~\cite{He_2019_ICCV} & 36.3 & 60.7 & 70.4 & 37.9 & 73.7 & 85.0 & 89.1 & 71.2 \\
AFPB~\cite{occluded_icme} & 34.1 & 58.2 & 67.2 & 35.1 & 70.7 & 83.2 & 87.3 & 68.3 \\
\hline
Ours & \textbf{42.7} & \textbf{67.4} & \textbf{76.2} & \textbf{43.2} & \textbf{79.1} & \textbf{88.4} & \textbf{91.9} & \textbf{76.5} \\
\hline
\end{tabular}}
\end{center}
\end{table}
\subsection{Results Comparison}
\noindent \textbf{Results on PI-PRW and PI-CUHK-SYSU.}
We first compare the proposed approach with the existing methods on the two proposed PI Re-ID datasets.
Table~\ref{tbl:pre} shows the result of our method and previous works.
The compared methods (including six existing representative Re-ID models, two multi-label learning approaches, and two Occluded Re-ID methods) are listed in the table.
These results show: (1) Among existing methods, the Occluded Re-ID model FPR is superior.
For example, FPR achieves 36.3\% Rank-1 accuracy and 37.9\% mAP on PI-PRW, which outperforms all the previous Re-ID methods.
This is because, similar to our method, FPR~\cite{He_2019_ICCV} leverage query feature maps as multi-kernels to calculate the spatial affinity with the gallery feature maps, and then enhance the common features in the gallery features.
(2) The performance of LIMOC~\cite{Yang_2016_CVPR} and HCP~\cite{hcp_2016} proposed for the multi-label learning is ordinary.
For example, compared to the strong baseline~\cite{luo2019bag}, HCP~\cite{hcp_2016} is less by -4.5\% Rank-1 accuracy and -3.5\% mAP on PI-PRW.
(3) Our new model PISNet outperforms all competitors by significant margins.
For example, PISNet achieves 42.7\% Rank-1 accuracy and 43.2\% mAP on PI-PRW and 79.1\% Rank-1 accuracy and 76.5\% mAP on PI-CUHK-SYSU.
This is because our proposed method explicitly utilizes query information and learn a more precise boundary between pedestrians by GRAM and MPSL.
\begin{table}
\begin{center}
\caption{\label{tbl:component}Component analysis of the proposed method on the PI-PRW and PI-CUHK-SYSU datasets ($\%$)
}
{
\scriptsize
\begin{tabular}{l|ccc|c|ccc|c}
\hline
\hline
\multirow{2}{*}{Method} & \multicolumn{4}{c|}{PI-PRW} & \multicolumn{4}{c}{PI-CUHK-SYSU} \\
\cline{2-9}
& \textit{rank1} & \textit{rank 5} & \textit{rank 10} & \textit{mAP} &\textit{rank1} & \textit{rank 5} & \textit{rank 10} & \textit{mAP}\\
\hline\hline
Baseline & 34.7 & 59.4 & 70.3 & 36.0 & 72.5 & 83.9 & 88.2 & 70.1 \\
Baseline + QGAB & 38.9 & 61.5 & 72.4 & 38.0 & 73.9 & 85.0 & 89.1& 72.3 \\
Baseline + QGAB + MPSL & 39.7 & 63.2 & 74.1 & 40.1 & 76.2 & 87.1 & 91.4& 74.2 \\
Baseline + QGAB + GRAM & 41.8 & 66.1 & 75.2 & 42.4 & 77.9 & 87.5 & 91.0 & 75.0 \\
Baseline + QGAB + GRAM + MPSL & 42.7 & 67.4 & 76.2 & 43.2 & 79.1 & 88.4 & 91.9 & 76.5 \\
\hline
\end{tabular}
}
\end{center}
\end{table}
\renewcommand{\multirowsetup}{\centering}
\begin{table}[tb]\footnotesize
\begin{center}
\caption{\label{tab:single}Comparison results ($\%$) on the Market-1501 and DukeMTMC-ReID datasets.
%
$N_{f}$ is the number of features used in the inference stage.
%
The methods in the 1st group are proposed for the traditional Re-ID problem.
%
The 2nd group is the state-of-the-art methods of Occluded Re-ID.
%
The 3rd group is our method
}
\begin{tabular}{ cc|cc|cc}
\hline
& & \multicolumn{2}{c|}{Market1501} & \multicolumn{2}{c}{DukeMTMC-ReID} \\
Method & $N_f$ & r = 1 & mAP &r = 1 & mAP \\
\hline
\hline
PIE~\cite{zheng2017pose} & 3 &87.7 &69.0 &79.8 &62.0 \\
SPReID~\cite{kalayeh2018human} & 5 & 92.5 & 81.3 & 84.4 &71.0 \\
MaskReID~\cite{qi2018maskreid} & 3 &90.0 &75.3 &78.8 &61.9 \\
MGN~\cite{wang2018learning} &1& 95.7 & 86.9& 88.7 & 78.4 \\
SCPNet~\cite{Fan_2019} & 1 & 91.2 &75.2 &80.3 &62.6 \\
PCB~\cite{sun2018beyond} & 6 & 93.8 &81.6 &83.3 &69.2 \\
Pyramid~\cite{Zheng_2019_CVPR} & 1 & 92.8 &82.1 &- &- \\
Pyramid~\cite{Zheng_2019_CVPR} & 21 & 95.7 &88.2 &89.0 &79.0 \\
HA-CNN~\cite{Li_2018_CVPR} & 4 & 91.2 & 75.7 &80.5 &63.8 \\
ABD-Net~\cite{Chen_2019_ICCV} & 1 & 95.6 & 88.3 &89.0 &78.6\\
Camstyle~\cite{zhong2019camstyle} & 1 &88.1 &68.7 &75.3 &53.5 \\
PN-GAN~\cite{Qian_2018_ECCV} & 9 &89.4 &72.6 &73.6 &53.2 \\
IDE~\cite{zheng2018discriminatively} & 1 & 79.5 & 59.9 & - &- \\
SVDNet~\cite{Sun_2017_ICCV} & 1 & 82.3 & 62.1 & 76.7 &56.8 \\
TriNet~\cite{hermans2017defense} & 1 & 84.9 & 69.1 & - & - \\
SONA~\cite{Xia_2019_ICCV} & 1 & 95.6 & 88.8 & 89.6 & 78.2 \\
\hline
FPR~\cite{He_2019_ICCV} &1& 95.4& 86.5& 88.6&78.2\\
PGFA~\cite{Miao_2019_ICCV} &1& 91.2& 76.8& 82.6&65.5\\
\hline
Baseline &1 & 94.5 &85.9& 86.4&76.4 \\
\textbf{Ours} & 1 & 95.6& 87.1 & 88.8& 78.7 \\
\hline
\end{tabular}
\end{center}
\end{table}
\begin{figure*}
\begin{center}
\includegraphics[width=12cm]{figure/sa1.jpg}
\caption{Evaluation of different parameters of PISNet using Rank-1 and mAP accuracy on the PI-PRW dataset ($\%$)
}
\label{fig:sa}
\end{center}
\end{figure*}
\subsection{Further Analysis}
\noindent \textbf{Contributions of Individual Components.} In Table~\ref{tbl:component}, we evaluate the three components on how they contribute to the full model.
The results show that all of them are effective on their own (each outperforms all the compared methods).
Moreover, when combined, the best performance is achieved.
This validates our design consideration in that they are complementary and should be combined.
\noindent \textbf{Does PISNet Perform well on the General Re-ID Dataset?} We also apply our method on the general Re-ID datasets, Market-1501 and DukeMTMC-ReID.
The compared methods (including fifteen existing representative Re-ID models, and two state-of-the-art Occluded Re-ID methods) are listed in Table~\ref{tab:single}.
The results show that: 1) Compared to existing representative Re-ID models, our method achieves comparable performances with state-of-the-art on both datasets.
These models leverage complicated attention mechanisms or local-based methods to achieve the results, while our PISNet is specifically designed for PI Re-ID.
2) Our method outperforms the existing Occluded Re-ID models on both general Re-ID datasets.
Specifically, our method can reach 95.6\% rank-1 accuracy and 87.1\% mAP on Market1501, and 88.8\% rank-1 accuracy and 78.7\% mAP on DukeMTMC-ReID.
The results prove the generalization ability of PISNet on the general Re-ID datasets.
\noindent \textbf{Influence of Parameters.} We evaluate two key parameters in our modelling, the loss weights $\alpha$ and $\beta$ in Eq.(7).
The two parameters would influence the performance of the proposed method.
As shown in Figure~\ref{fig:sa}, when $\alpha$ and $\beta$ are set between 0.3 and 1.0, and 0.4 and 1.0, respectively, the performance does not change dramatically, which indicates that PISNet is not sensitive to the $\alpha$ and $\beta$ in the value ranges.
\subsection{Attention Visualisation}
\begin{figure*}
\begin{center}
\includegraphics[width=8cm]{figure/attention_vis.jpg}
\caption{Visualisation of our query-guided attention for multi-person images in PI-CUHK-SYSU.
%
In each group, from left to right, (1) the single-person query, (2) the
multi-person gallery and (3) the masked feature map.
%
In the heat map, the response increases from blue to red. Best viewed in color
}
\label{fig:vis}
\end{center}
\end{figure*}
We visualise our query-guided attention for multi-person images in the PI-CUHK-SYSU dataset.
Figure~\ref{fig:vis} shows that: (1) The attention mask filters out other pedestrians in multi-person images,
(2) When the multi-person gallery does not include the query, the attention is weak for the whole image (the third group in the second rows).
The visualisation results further prove that our method can suppress the pedestrian interference effectively.
\section{Conclusions}
We have considered a new and more realistic person Re-ID challenge: pedestrian-interference person re-identification problem.
To address the particular challenges associated with this new Re-ID problem, we propose a novel query-guided framework PISNet with a Guidance Reversed Attention Module and the Multi-Person Separation Loss.
Both are specifically designed to address the person interference problem.
The effectiveness of our model has been demonstrated by extensive experiments on two new pedestrian-interference Re-ID datasets introduced in this paper.
In our future work, we will extend this work to handle more kinds of hard cases caused by a non-perfect detector.
\section*{Acknowledgment}
This work was supported by the National Key R\&D Program of China No. 2018YFB1004602 and the Project of the National Natural Science Foundation of China No. 61876210.
\clearpage
\bibliographystyle{splncs04}
| {'timestamp': '2020-08-18T02:19:22', 'yymm': '2008', 'arxiv_id': '2008.06963', 'language': 'en', 'url': 'https://arxiv.org/abs/2008.06963'} | arxiv |
\section*{Abstract}
Experimental studies support the notion of spike-based neuronal information processing in the brain, with neural circuits exhibiting a wide range of temporally-based coding strategies to rapidly and efficiently represent sensory stimuli. Accordingly, it would be desirable to apply spike-based computation to tackling real-world challenges, and in particular transferring such theory to neuromorphic systems for low-power embedded applications.
Motivated by this, we propose a new supervised learning method that can train multilayer spiking neural networks to solve classification problems based on a rapid, first-to-spike decoding strategy. The proposed learning rule supports multiple spikes fired by stochastic hidden neurons, and yet is stable by relying on first-spike responses generated by a deterministic output layer. In addition to this, we also explore several distinct, spike-based encoding strategies in order to form compact representations of presented input data.
We demonstrate the classification performance of the learning rule as applied to several benchmark datasets, including MNIST. The learning rule is capable of generalising from the data, and is successful even when used with constrained network architectures containing few input and hidden layer neurons. Furthermore, we highlight a novel encoding strategy, termed `scanline encoding', that can transform image data into compact spatiotemporal patterns for subsequent network processing. Designing constrained, but optimised, network structures and performing input dimensionality reduction has strong implications for neuromorphic applications.
\section{Introduction}
Neurons constitute complex biological circuits, and work to convey information via rapid, spike-based signalling. These neural circuits interconnect with one another, forming the basis of large scale networks in the brain, and are often organised as consecutive processing layers operating at increasing levels of abstraction. For example, within the visual system, information regarding object features can be temporally encoded as spikes in little over just 10 ms, and its identity determined through feedforward processing pathways within 200 ms of pattern onset \citep{Kiani2005,Gollisch2008,Hung2005}.
In terms of forming such representations, the adaptation of synaptic connections between neurons is hypothesised to underlie the learning process: principally based on correlated neuronal activity patterns and regulatory, homeostatic plasticity mechanisms \citep{Morrison2008}. In particular, a Hebbian-like learning scheme, termed \ac{STDP}, is considered to play a prominent role \citep{Gerstner2002}, whereby the strength of a synaptic connection is modified according to the relative timing difference between paired pre- and postsynaptic firing events \citep{Bi1998}. Drawing on these principles, theoretical work has sought to model goal-directed learning in the brain using \acp{SNN}: typically incorporating concepts from machine learning such as supervised and reinforcement learning for this purpose \citep{Gruning2014}. Despite progress in this respect, a more comprehensive theoretical description of learning that also aims to more fully exploit the rapidity and precision of spike-based temporal coding is still largely lacking; consequently, finding real-world applications for spike-based learning and computing techniques, including their transfer to neuromorphic platforms, remains an open issue.
For the most part, theoretical studies into spike-based learning in neural networks have been devised based on the dynamics of the \ac{LIF} neuron model, typically when formalised as the simplified \acf{SRM} \citep{Gerstner2002}, owing to its convenient trade-off between analytical tractability and model realism in run simulations. Additionally, the application of gradient descent in order to minimise the value of some predefined cost function, as taken for supervised learning, is a useful starting point in order to obtain weight update rules for \acp{SNN} \citep{Gutig2014}. A common learning objective has been to train neurons to precisely fire at one or more prescribed target firing times; to this end, the cost function of an \ac{SNN} is usually defined in terms of the separation between target and actual firing times with respect to one or more of its readout neurons. Hence, by applying gradient descent, weight update rules for the network can be derived, and accordingly implemented during training in order to support neuronal firing at these target timings \citep{Bohte2002a,Florian2012,Sporea2013,Gardner2015,Zenke2018}.
Furthermore, some supervised approaches have incorporated a trained neuron's subthreshold voltage into the network cost function: for example to support a more efficient mode of operation in addition to learning target firing times \citep{Albers2016}. In a similar effort, the minimum distance between a neuron's voltage and its firing threshold, as measured over some predetermined observation period, has been selected as the point at which a neuron should be driven to fire, in order to provide a highly efficient spike-based classifier rule \citep{Gutig2006,Urbanczik2009}.
Aside from setting up an initial cost function, some studies have instead taken a statistical approach to learning; for instance, based on a maximum-likelihood principle that works to maximise the likelihood of an \ac{SNN} generating desired target firing times \citep{Pfister2006, Gardner2016}, or similarly by minimising an upper bound on the KL-divergence between the actual and target firing distribution for more complex, recurrent \ac{SNN} architectures \citep{Brea2013}. A variational, online learning rule for training recurrent \acp{SNN} has also recently been proposed in \cite{Jang2020}; a detailed review of probabilistic learning methods can be found in \cite{Jang2019}. Otherwise, the procedure used to learn target firing times may be mapped from Perceptron-like learning for high precision \citep{Memmesheimer2014}, or more heuristically by modifying weights according to a spike-based adaptation of the Widrow-Hoff rule \citep{Ponulak2010,Mohemmed2012,Yu2013}.
A large part of the studies described so far have been concerned with training \acp{SNN} to learn target output firing times, which in most cases tend to be arbitrarily selected; this usually follows from focusing on a proof-of-concept of a derived learning procedure, rather than measuring its technical performance on benchmark datasets. Moreover, biological plausibility is a common concern with spike-based learning approaches, which can place further constraints on a model and detract from its performance. Although there is likely to be strong potential in utilising spike-based computation for data classification purposes, it remains unclear which temporal coding strategy is best suited for this purpose. For instance, learning multiple, temporally-precise sequences of spikes in order to categorise input patterns into different classes might inadvertently lead to model overfitting, and hinder generalisation to previously unseen samples; this is more likely to be an issue with high precision rules, for example the E-learning variant of the Chronotron \citep{Florian2012} or the HTP algorithm \citep{Memmesheimer2014}. Therefore, a preferable coding strategy for a spike-based classifier might instead rely on selecting output responses which place the least constraint on the trained parameters: for example as demonstrated by the single-layer Tempotron rule \citep{Gutig2006}.
Although the minimally-constrained Tempotron has proven capable of high performance with respect to certain problem domains, such as vocabulary recognition \citep{Gutig2009}, there may arise limitations in terms of its flexibility as applied to increasingly challenging datasets such as MNIST, for which networks containing hidden neurons are indicated for its solution; interestingly, however, recently submitted work has addressed this issue by implementing a Tempotron-inspired cost function combined with a multilayer learning procedure, and to good effect \citep{Zenke2020}. Despite such progress, there still exist comparatively few learning rules for multilayer \acp{SNN} compared with single-layer ones, owing to the complexity in solving ill-defined gradients of hidden layer spike trains when applying the technique of backpropagation. A number of approaches have relied on approximating such gradients: for example by taking a linear approximation of a neuron's response close to its firing threshold \citep{Bohte2002a}, estimating a spike train by its underlying firing density \citep{Sporea2013} or using a surrogate gradient to substitute a neuron's spike-gradient with an analytically tractable one \citep{Zenke2018, Neftci2019}. Furthermore, some studies have taken a statistical approach which instead consider the likelihood of a neuron's firing response, as applied to feedforward \citep{Gardner2015} and recurrent \citep{Brea2013,Rezende2014} network structures. In these cases, however, the networks have been constrained to learning predefined, target firing patterns, with less of a focus on utilising efficient temporal encoding and decoding strategies for data classification purposes. Of the studies which have focused on applying multilayer or deep \acp{SNN} to more challenging datasets, some have demonstrated that training rate-based \acp{ANN} and transferring the learned weights to similarly designed \acp{SNN} for test inference can provide performance competitive with state-of-the-art systems \citep{Connor2013,Diehl2015}. A main limitation of this approach, however, is that these equivalent \acp{ANN} must be trained offline before being mapped to an online system, making this technique somewhat restrictive in terms of its application to adaptive learning tasks. A further study exploring deep \ac{SNN} architectures considered a scheme which involved low-pass filtering spike events in order to establish smooth gradients for backpropagation, although this came with the caveat of introducing auxiliary variables which needed to be computed separately \citep{Lee2016}. Other studies have arrived at alternative solutions by approximating simulated \ac{LIF} neurons as \acp{ReLU} \citep{Tavanaei2019}, or instead simulating non-leaky integrate-and-fire neurons for analytical tractability \citep{Mostafa2017}, thereby establishing closed-form expressions for the weight updates. These methods have resulted in competitive performance on the MNIST dataset, and the first-to-spike decoding method implemented by \cite{Mostafa2017}, which classifies data samples according to which output neuron is the first to respond with a spike, has proven to be particularly rapid at forming predictions. Interestingly, the recent work of \cite{Bagheri2018}, which examined training probabilistic, single-layer \acp{SNN} as applied to MNIST, has also indicated at the merits of utilising a rapid, first-to-spike decoding scheme.
In this article, we introduce a new supervised learning algorithm to train multilayer \acp{SNN} for data classification purposes, based on a first-to-spike decoding strategy. This algorithm extends on our previous MultilayerSpiker rule described in \cite{Gardner2015}, by redefining the network's objective function as a cost over first spike arrival times in the output layer, and instead implementing deterministic output neurons for more robust network responses. We test our new first-to-spike multilayer classifier rule on several benchmark classification tasks, including the ubiquitous MNIST dataset of handwritten digits, in order to provide an indication of its technical capability. Additionally, we explore several different spike-based encoding strategies to efficiently represent the input data, including one novel technique that can transform visual patterns into compact spatio-temporal patterns via `scanline encoding'. We determine that such an encoding strategy holds strong potential when applied to constrained network architectures, as might exist with a neuromorphic hardware platform. In the next section we start our analysis by describing the specifics of our first-to-spike neural classifier model.
\section{Methods}
\subsection{Neuron Model} \label{subsec:nrn_model}
We consider the simplified \ac{SRM}, as defined in \cite{Gerstner2002}, to describe the dynamics of a postsynaptic neuron's membrane potential with time $t$:
\begin{equation} \label{eq:SRM}
u_i(t) := \sum_{j \in \Gamma_i} w_{ij} \left( \epsilon \ast S_j \right)(t) + \left( \kappa \ast S_i \right)(t)\;,
\end{equation}
where the neuron is indexed $i$, and its membrane potential is measured with respect to an arbitrary resting potential. The first term on the RHS of the above equation describes a weighted sum over the neuron's received presynaptic spikes, where $\Gamma_i$ denotes the set of direct neural predecessors of neuron $i$, or its presynaptic neurons, and the parameter $w_{ij}$ refers to the synaptic weight projecting from presynaptic neuron $j$. The term $\left( \epsilon \ast S_j \right)(t) \equiv \int_0^t \epsilon(s) S_j(t - s) \mathrm{d}s$ refers to a convolution of the \ac{PSP} kernel $\epsilon$ and the $j^\mathrm{th}$ presynaptic spike train $S_j$, where a spike train is formalised as a sum of dirac-delta functions, $S_j(t) = \sum_f \delta_D (t - t_j^f)$, over a list of presynaptic firing times $\mathcal{F}_j = \{t_j^1, t_j^2, \dots\}$. The second term on the RHS of Eq~\eqref{eq:SRM} signifies the dependence of the postsynaptic neuron on its own firing history, where $\kappa$ is the reset kernel and $S_i$ is the neuron's spike train for postsynaptic firing times $\mathcal{F}_i = \{t_i^1, t_i^2, \dots\}$. A postsynaptic spike is considered to be fired at time $t_i^f$ when $u_i$ crosses the neuron's fixed firing threshold $\vartheta$ from below. The \ac{PSP} and reset kernels are, respectively, given by:
\begin{align}
\epsilon(s)
&= \epsilon_0 \left[ \exp\left( -\frac{s}{\tau_m} \right) - \exp\left( -\frac{s}{\tau_s} \right) \right] \Theta(s) \;, \label{eq:PSP_kernel} \\
\kappa(s)
&= \kappa_0 \exp\left(-\frac{s}{\tau_m}\right) \Theta(s) \;. \label{eq:reset_kernel}
\end{align}
With respect to Eq~\eqref{eq:PSP_kernel}, $\epsilon_0 = \SI{4}{mV}$ is a scaling constant, $\tau_m = \SI{10}{ms}$ the membrane time constant, $\tau_s = \SI{5}{ms}$ a synaptic time constant and $\Theta(s)$ the Heaviside step function. With respect to Eq~\eqref{eq:reset_kernel}, the reset strength is given by $\kappa_0 = -(\vartheta - u_r)$, where $u_r = \SI{0}{mV}$ is the value the neuron's membrane potential is reset to immediately after a postsynaptic spike is fired upon crossing the threshold $\vartheta = \SI{15}{mV}$. From Eq~\eqref{eq:SRM} it follows that the neuron's resting potential is equal to its reset value, i.e. $u_\mathrm{rest} = u_\mathrm{r} = \SI{0}{mV}$.
\subsection{Learning Rule} \label{subsec:learning_rule}
\subsubsection{Notation}
The technique of backpropagation is applied to a feedforward multilayer \ac{SNN} containing hidden layers of neurons, where the objective of the network is to perform pattern recognition on multiple input classes by learning error-minimising weights. Network layers are indexed by $l$, with $l \in \{1, 2, \dots, L - 1, L\}$, where $l = 1, L$ correspond to the input and last layers, respectively. The number of neurons in the $l^\mathrm{th}$ layer is denoted $N_l$. In our analysis, each input class corresponds to a distinct output neuron: hence, if the total number of classes is equal to $c$ then the number of output neurons is given by $N_L = c$. Using this notation, the \ac{SRM} defined by Eq~\eqref{eq:potential} is rewritten as
\begin{equation} \label{eq:potential}
u_i^l(t) := \sum_{j \in \Gamma_i^l} w_{ij}^l \left( \epsilon \ast S_j^{l-1} \right)(t) + \left( \kappa \ast S_i^l \right)(t) \;,
\end{equation}
for a postsynaptic neuron in the $l^\mathrm{th}$ layer receiving its input from previous layer neurons belonging to the set $\Gamma_i^l$. The spike train of a neuron $i$ in layer $l$ is now denoted by $S_i^l(t) = \sum_f \delta_D (t - t_i^f)$, and its associated list of firing times, $\mathcal{F}_i^l = \{t_i^1, t_i^2, \dots\}$.
\subsubsection{Cost Function}
The objective is to train a multilayer \ac{SNN} to efficiently classify input patterns based on a temporal decoding scheme. To this end, a first-to-spike code seems appropriate, since it encourages rapidity of neural processing and avoids arbitrarily constraining the network to generate spikes with specific timings. There is also experimental evidence supporting the notion of a latency code in relation to visual and neural processing pathways \citep{Hung2005,Gollisch2008}. Hence, we focus on implementing a minimally-constrained, competitive learning scheme: such that the output neuron with the earliest and strongest activation, resulting in a first-spike response, decides the class of input pattern.
Taking the above points into consideration, a suitable choice for the $i^\mathrm{th}$ output layer neuron's activation is a softmax, given by
\begin{equation} \label{eq:softmax}
a_i^L = \frac{\exp\left(-\nu \tau_i\right)}{\sum_{i'}\exp\left(-\nu \tau_{i'}\right)} \;,
\end{equation}
where $\nu$ is a scale parameter controlling the sharpness of the distribution, $i'$ indexes each output neuron, $1 \leq i' \leq c$, and $\tau_{i'}$ is the first firing time of neuron $i'$. If a neuron $i'$ fails to fire any spike, then it is assumed $\tau_{i'} \rightarrow \infty$. The set of activations can be interpreted as a conditional probability distribution over the predicted class labels. A natural choice of cost function using softmax activation is the cross-entropy, given by
\begin{equation} \label{eq:cross-entropy}
C(\mathbf{y}, \mathbf{a}^L) = -\sum_i y_i \log a_i^L \;,
\end{equation}
where $\mathbf{y} \in \mathbb{R}^c$ is a $c$-dimensional target activation vector of the network, associated with the presented input pattern, and $\mathbf{a}^L \in \mathbb{R}^{N_L}$ is the vector of output layer neuron activations. Since we are concerned with a classification problem a one-hot encoding scheme is used to describe a target vector, such that all components of $\mathbf{y}$ are set to zero except for the one corresponding to the pattern class. For example, if a dataset were comprised of three input pattern classes, then patterns belonging to the second class would be associated with $\mathbf{y} = (0, 1, 0)$. Hence, using this coding strategy, and using $y$ to denote the index of the target class label, Eq~\eqref{eq:cross-entropy} reduces to
\begin{equation} \label{eq:cross-entropy-onehot}
C(\mathbf{y}, \mathbf{a}^L) = -\log a_y^L \;,
\end{equation}
where $a_y^L$ now denotes the activation of the single output neuron corresponding to the correct class. The above choices of cost and activation functions is inspired by the approach taken in \cite{Mostafa2017}, although here we instead consider \ac{LIF} neurons and extend our analysis to include entire spike trains generated by input and hidden layer neurons.
\subsubsection{Error Signal}
The technique of backpropagation is applied in order to train weights within the multilayer network, by minimising the cross-entropy loss defined by Eq~\eqref{eq:cross-entropy-onehot}. We begin by taking the gradient of Eq~\eqref{eq:cross-entropy-onehot} with respect to the membrane potential of a neuron $i$ in the final layer, a term which will be useful later:
\begin{equation} \label{eq:grad_cost}
\frac{\partial C(\mathbf{y}, \mathbf{a}^L)}{\partial u_i^L} = -\frac{\partial \log a_y^L}{\partial u_i^L} \;,
\end{equation}
which can be rewritten, using the chain rule, as
\begin{equation} \label{eq:grad_cost2}
\frac{\partial C(\mathbf{y}, \mathbf{a}^L)}{\partial u_i^L} = -\frac{1}{a_y^L} \frac{\partial a_y^L}{\partial u_i^L} \;.
\end{equation}
Furthermore, the gradient of the neuron's activation can be expanded using the chain rule as follows:
\begin{equation} \label{eq:grad_cost3}
\frac{\partial a_y^L}{\partial u_i^L} = \frac{\partial a_y^L}{\partial \tau_i} \frac{\tau_i}{\partial u_i^L} \;.
\end{equation}
Using Eq~\eqref{eq:softmax}, the first gradient on the RHS of the above can be solved to provide one of two cases:
\begin{equation} \label{eq:grad_cost4}
\frac{\partial a_y^L}{\partial \tau_i} =
\begin{cases}
a_y^L (a_i^L - 1) & \text{if } i = y \;, \\
a_i^L a_y^L & \text{if } i \neq y \;.
\end{cases}
\end{equation}
The second gradient on the RHS of Eq~\eqref{eq:grad_cost3} is ill-defined, but can be approximated by making certain assumptions regarding the neuron's dynamics close to its firing threshold. Specifically, for a deterministic \ac{LIF} neuron it follows that the gradient of the neuron's membrane potential must be positive at its firing threshold when a spike is fired, such that $\partial u_i^L / \partial t(\tau_i) > 0$. Hence, following \cite{Bohte2002a}, we make a first order approximation of $u_i^L$ for a small region about $t=\tau_i$, giving rise to the relation $\delta \tau_i = -\delta u_i^L / \alpha$, where the local gradient is given by $\alpha = \partial u_i^L / \partial t(\tau_i)$. Taken together, the gradient of the neuron's first firing time is approximated by
\begin{align} \label{eq:grad_cost5}
\frac{\tau_i}{\partial u_i^L} &\approx \frac{\partial \tau_i(u_i^L)}{\partial u_i^L(t)}\bigg\rvert_{u_i^L = \theta} \nonumber \\
&\approx -\frac{1}{\partial u_i^L / \partial t}\bigg\rvert_{t = \tau_i} = -\frac{1}{\alpha} \;,
\end{align}
where for numerical stability reasons $\alpha$ is considered to be a positive, constant value. For the sake of brevity this constant is set to unity in the remainder of this analysis, and gives no qualitative change in the final result. Thus, Eqs~\eqref{eq:grad_cost2} to \eqref{eq:grad_cost5} are combined to give one of two possible output neuron error signals:
\begin{equation} \label{eq:grad_cost6}
\frac{\partial C(\mathbf{y}, \mathbf{a}^L)}{\partial u_i^L} =
\begin{cases}
a_i^L - 1 & \text{if } i = y \;, \\
a_i^L & \text{if } i \neq y \;,
\end{cases}
\end{equation}
depending on whether the $i^\mathrm{th}$ neuron corresponds to the target label $y$. Using our earlier notation for the network's target activation vector $\mathbf{y} = (y_1, y_2, \dots, y_c)$ as used in Eq~\eqref{eq:cross-entropy}, the above can be written more compactly as
\begin{align} \label{eq:errorL}
\delta_i^L
&:= \frac{\partial C(\mathbf{y}, \mathbf{a}^L)}{\partial u_i^L} \nonumber \\
&:= a_i^L - y_i \;,
\end{align}
where we define $\delta_i^L$ to be the error signal due to the $i^\mathrm{th}$ neuron in the final layer.
\subsubsection{Output Weight Updates}
We apply gradient descent to Eq~\eqref{eq:cross-entropy-onehot} with respect to final layer weights, such that the weight between the $i^\mathrm{th}$ output neuron and $j^\mathrm{th}$ previous layer, hidden neuron is modified according to
\begin{equation} \label{eq:grad_wo}
\Delta w_{ij}^L = -\eta \frac{\partial C(\mathbf{y}, \mathbf{a}^L)}{\partial w_{ij}^L} \;,
\end{equation}
where $\eta > 0$ is the learning rate. The second term on the RHS is expanded using the chain rule to give
\begin{equation} \label{eq:grad_wo_2}
\frac{\partial C(\mathbf{y}, \mathbf{a}^L)}{\partial w_{ij}^L} = \frac{\partial C(\mathbf{y}, \mathbf{a}^L)}{\partial u_i^L} \frac{\partial u_i^L(t)}{\partial w_{ij}^L} \bigg\rvert_{t = \tau_i} \;,
\end{equation}
where the gradient of the output neuron's membrane potential is evaluated at the time of its first spike. The first gradient term on the RHS of this equation corresponds to the neuron's error signal, as provided by Eq~\eqref{eq:errorL}, hence the above can be rewritten as
\begin{equation} \label{eq:grad_wo_3}
\frac{\partial C(\mathbf{y}, \mathbf{a}^L)}{\partial w_{ij}^L} = \delta_i^L \frac{\partial u_i^L(t)}{\partial w_{ij}^L} \bigg\rvert_{t = \tau_i} \;.
\end{equation}
Using the definition of the neuron's membrane potential given by Eq~\eqref{eq:potential}, and neglecting the contribution due to refractory effects which is valid for sufficiently low output firing rates, the above becomes
\begin{equation} \label{eq:dw_L}
\Delta w_{ij}^L = -\eta \delta_i^L \left( \epsilon \ast S_j^{L-1} \right)(\tau_i) \;,
\end{equation}
where the constant $\alpha$, as introduced by Eq~\eqref{eq:grad_cost5}, is folded into $\eta$ for simplicity. An example of the above weight update rule taking place in a simulated \ac{SNN} is visualised in Fig~\ref{fig:output_dw}.
\begin{figure}[t]
\centering
\includegraphics{figs/fig_output_dw}
\caption{
Example of the weight update process with respect to the output layer, $l=L$, of a multilayer \ac{SNN}, according to Eq~\eqref{eq:dw_L}. (Top row) The left panel shows the membrane potential of an excited presynaptic neuron $j$ in the second-to-last layer, $l=L-1$, over a small observation time $T$. The vertical lines indicate the neuron's firing times, and $\vartheta$ its firing threshold. The right panel shows the response of a postsynaptic neuron $i$ in the network's output layer, which is stimulated in part by neuron $j$. (Bottom row) The left panel shows the \ac{PSP} evoked due to neuron $j$. The first output spike fired by neuron $i$ is indicated by the green dotted line. Hence, as shown in the right panel, the magnitude of the weight change between neurons $j$ and $i$ is proportional to the value of the \ac{PSP} at the moment neuron $i$ fires its first spike. In this example the output neuron does not correspond to the class of the input pattern, therefore the direction of the weight change is negative to discourage early spiking.
}
\label{fig:output_dw}
\end{figure}
\paragraph{Integrated formula.} Integrating out the spike train in Eq~\eqref{eq:dw_L} gives
\begin{equation} \label{eq:dw_L_integrated}
\Delta w_{ij}^L = -\eta \delta_i^L \sum_{t_j^f \in \mathcal{F}_j^{L-1}} \epsilon (\tau_i - t_j^f) \;,
\end{equation}
where $\mathcal{F}_j^{L-1}$ is used to denote the list of spike times contributed by the $j^\mathrm{th}$ neuron in the previous layer, $L-1$.
\subsubsection{Hidden Weight Updates}
With respect to hidden layer weight updates, gradient descent is taken on Eq~\eqref{eq:cross-entropy-onehot} according to
\begin{equation} \label{eq:grad_wh}
\Delta w_{ij}^{L-1} = -\eta \frac{\partial C(\mathbf{y}, \mathbf{a}^L)}{\partial w_{ij}^{L-1}} \;,
\end{equation}
where the weight update between the $i^\mathrm{th}$ hidden neuron in layer $L-1$ and the $j^\mathrm{th}$ presynaptic neuron in layer $L-2$ is derived. Hence, using the chain rule, the gradient on the RHS is expanded as follows:
\begin{align} \label{eq:grad_wh_2}
\frac{\partial C(\mathbf{y}, \mathbf{a}^L)}{\partial w_{ij}^{L-1}}
&= \sum_{k \in \Gamma^{i, L-1}} \frac{\partial C(\mathbf{y}, \mathbf{a}^L)}{\partial u_{k}^L} \frac{\partial u_{k}^L(t)}{\partial w_{ij}^{L-1}} \bigg\rvert_{t = \tau_{k}} \nonumber \\
&= \sum_{k \in \Gamma^{i, L-1}} \delta_{k}^L \frac{\partial u_{k}^L(t)}{\partial w_{ij}^{L-1}} \bigg\rvert_{t = \tau_{k}} \;,
\end{align}
where $\Gamma^{i, L-1}$ denotes the immediate set of neural successors of neuron $i$ in layer $L-1$, or the set of output layer neurons, and having used the identity of the output error signal given by Eq~\eqref{eq:errorL}. Using Eq~\eqref{eq:potential}, the gradient of the $k^\mathrm{th}$ membrane potential becomes
\begin{align} \label{eq:grad_wh_3}
\frac{\partial u_{k}^L(t)}{\partial w_{ij}^{L-1}}\bigg\rvert_{t = \tau_{k}}
&= w_{ki}^L \frac{\partial}{\partial w_{ij}^{L-1}} \left( \epsilon \ast S_i^{L-1} \right)(\tau_k) \nonumber \\
&= w_{ki}^L \left( \epsilon \ast \frac{\partial S_i^{L-1}}{\partial w_{ij}^{L-1}} \right)(\tau_k) \;,
\end{align}
where we neglect the contribution from the refractory term. Evaluating the gradient of a spike train poses a challenge given its discontinuous nature when generated by \ac{LIF} neurons. One approach to resolving this might instead just consider the first spike contributed by hidden layer neurons, as used for SpikeProp \citep{Bohte2002a}, although this loses information about neural firing frequency and typically requires the addition of multiple subconnections with the next layer to support sufficient downstream activation. There have been extensions of SpikeProp to allow for multiple spikes in the hidden layers \citep{Booij2005,Ghosh2009}, although these methods rely on small learning rates and constrained weight gradients to allow for convergence. To circumvent this issue, we treat hidden layer neurons as being probabilistic in order to provide smoother gradients \citep{Gardner2015}. Specifically, we introduce stochastic spike generation for hidden neurons using the Escape Noise model \citep{Gerstner2014}. By this mechanism, hidden neuron firing events are distributed according to an inhomogeneous Poisson process with a time-dependent rate parameter that is a function of the neuron's membrane potential: $\rho_i^l(t) = g(u_i^l(t))$. This can be interpreted as the neuron's instantaneous firing rate, or firing density, where the probability of the neuron firing a spike over an infinitesimal time window $\delta t$ is given by $\rho_i^l(t) \delta t$. Here we take an exponential dependence of the firing density on the distance between the neuron's membrane potential and threshold \citep{Gerstner2014}:
\begin{equation} \label{eq:escape_rate}
g(u_i^l(t)) = \rho_0 \exp \left( \frac{u_i^l(t) - \vartheta}{\Delta u} \right) \;,
\end{equation}
where $\rho_0 = \SI{0.01}{ms^{-1}}$ is the instantaneous rate at threshold, and $\Delta u = \SI{1}{mV}$ controls the variability of generated spikes. Hence, following our previous method in \cite{Gardner2015}, we can substitute the gradient of the spike train in Eq~\eqref{eq:grad_wh_3} with the gradient of its expected value, conditioned on spike trains in the previous layer of the network, such that
\begin{equation} \label{eq:grad_wh_4}
\frac{\partial S_i^{L-1}(t)}{\partial w_{ij}^{L-1}} \rightarrow \frac{\partial \left\langle S_i^{L-1}(t) \right\rangle_{S_i^{L-1}|\{S_j^{L-2}\}}}{\partial w_{ij}^{L-1}} \;.
\end{equation}
If we also condition the expected spike train on the neuron's most recently fired spike, $\hat{t}_i < t$, then we can express Eq~\eqref{eq:grad_wh_4} as the gradient of the instantaneous value of the spike train, distributed according to its firing density \citep{Fremaux2013}:
\begin{align} \label{eq:grad_wh_5}
\frac{\partial \left\langle S_i^{L-1}(t) \right\rangle_{S_i^{L-1}|\{S_j^{L-2}\}, \hat{t}_i}}{\partial w_{ij}^{L-1}}
&= \frac{\partial}{\partial w_{ij}^{L-1}} \sum_{q \in \{0,\delta(t)\}} q(t) \rho_i^{L-1}(t|\{S_j^{L-2}\}, \hat{t}_i) \nonumber \\
&= \delta_D(t-\hat{t}) \frac{\partial \rho_i^{L-1}(t|\{S_j^{L-2}\}, \hat{t}_i)}{\partial w_{ij}^{L-1}} \;,
\end{align}
where $\delta_D(t-\hat{t})$ is the Dirac-delta function centred on some most recent spike time $\hat{t}$. Using Eqs.~\eqref{eq:potential} and \eqref{eq:escape_rate}, and denoting `$|\{S_j^{L-2}\}, \hat{t}_i$' as `$|L-2, i$' for brevity, we obtain
\begin{align} \label{eq:grad_wh_6}
\frac{\partial \left\langle S_i^{L-1}(t) \right\rangle_{S_i^{L-1}|L-2, i}}{\partial w_{ij}^{L-1}}
&= \frac{1}{\Delta u} \delta_D(t-\hat{t}) \rho_i^{L-1}(t|L-2, i) \left( \epsilon \ast S_j^{L-2} \right)(t) \nonumber \\
&= \frac{1}{\Delta u} \left\langle S_i^{L-1}(t) \left( \epsilon \ast S_j^{L-2} \right)(t) \right\rangle_{S_i^{L-1}|L-2, i} \;.
\end{align}
We can estimate the expected value of the spike train's gradient through samples generated by the network during simulations, hence the above can be approximated as
\begin{equation} \label{eq:grad_wh_7}
\frac{\partial \left\langle S_i^{L-1}(t) \right\rangle_{S_i^{L-1}|L-2, i}}{\partial w_{ij}^{L-1}} \approx \frac{1}{\Delta u} S_i^{L-1}(t) \left( \epsilon \ast S_j^{L-2} \right)(t) \;.
\end{equation}
Combining Eqs.~\eqref{eq:grad_wh_3}, \eqref{eq:grad_wh_4} and \eqref{eq:grad_wh_7} provides an estimate for the gradient of the $k^\mathrm{th}$ output neuron's membrane potential, evaluated at the time of its first fired spike:
\begin{equation} \label{eq:grad_wh_8}
\frac{\partial u_{k}^L(t)}{\partial w_{ij}^{L-1}}\bigg\rvert_{t = \tau_{k}} = \frac{1}{\Delta u} w_{ki}^L \left( \epsilon \ast \left[ S_i^{L-1} \left( \epsilon \ast S_j^{L-2} \right) \right] \right)(\tau_k) \;.
\end{equation}
Hence, combining the above with Eqs.~\eqref{eq:grad_wh} and \eqref{eq:grad_wh_2} gives the second-last layer weight update rule:
\begin{equation} \label{eq:dw_L-1}
\Delta w_{ij}^{L-1} = -\frac{\eta}{\Delta u} \sum_{k \in \Gamma^{i, L-1}} \delta_{k}^L w_{ki}^L \left( \epsilon \ast \left[ S_i^{L-1} \left( \epsilon \ast S_j^{L-2} \right) \right] \right)(\tau_k) \;.
\end{equation}
An example of a weight update taking place between the input and hidden layers of an \ac{SNN} is shown in Fig~\ref{fig:hidden_dw}.
\begin{figure}[!tp]
\centering
\includegraphics[width=\textwidth]{figs/fig_hidden_dw}
\caption{
Example of the weight update process with respect to a hidden layer, $l=L-1$, of a multilayer \ac{SNN}, according to Eq~\eqref{eq:dw_L-1}. (Top row) The left panel shows the spike train of a presynaptic neuron $j$ in the first layer, $l=L-2$, observed over $T$. As shown in the middle panel, a postsynaptic neuron $i$ in layer $l=L-1$ receives this input spike, among others, and responds by firing a sequence of hidden spikes. The right panel shows the response of all output neurons in the network, each of which are stimulated in part by neuron $i$. (Bottom row) The left panel shows the \ac{PSP} evoked by input neuron $j$ at its postsynaptic target $i$. The red dotted lines indicate the firing times of $i$, which capture input-to-hidden spike correlations as shown in the middle panel. Since the first hidden spike occurs before the input spike, this spike makes no contribution to the input-hidden correlation. The middle panel also indicates the first firing times of all neurons in the output layer, marked by the magenta (first output to respond) and green dotted lines. The values of the input-hidden correlation trace at these two moments are used to inform the candidate weight change between input and hidden neurons $j$ and $i$, as shown in the right panel. In this example, the output neuron corresponding to the correct class label (magenta) is the first to fire a spike, as desired. The hidden neuron $i$ projects positive- and negative-valued synaptic weights to the magenta and green output neurons, respectively, hence this translates into a positive change in $w_{ij}^{L-1}$ at each moment.
}
\label{fig:hidden_dw}
\end{figure}
\paragraph{Integrated formula.} Integrating out the spike trains in Eq~\eqref{eq:dw_L-1} gives
\begin{equation} \label{eq:dw_L-1_integrated}
\Delta w_{ij}^{L-1} = -\frac{\eta}{\Delta u} \sum_{k \in \Gamma^{i, L-1}} \delta_k^L w_{ki}^L \sum_{t_i^f \in \mathcal{F}_i^{L-1}} \epsilon (\tau_k - t_i^f) \sum_{t_j^g \in \mathcal{F}_j^{L-2}} \epsilon (t_i^f - t_j^g) \;,
\end{equation}
where $\mathcal{F}_i^{L-1}$ and $\mathcal{F}_j^{L-2}$ are the list of spike times from neurons $i$ and $j$ in layers $L-1$ and $L-2$, respectively. The weight update formulae described by Eqs.~\eqref{eq:dw_L_integrated} and \eqref{eq:dw_L-1_integrated} determine the supervised learning process of our first-to-spike neural classifier rule, as applied to multilayer \acp{SNN} containing a single hidden layer of stochastic neurons. The above procedure is not restricted to \acp{SNN} containing one hidden layer, however: as demonstrated in the Appendix, it is also possible to extend this approach to networks containing more than one hidden layer.
\subsection{Temporal Encoding} \label{subsec:temporal_encoding}
For demonstrative purposes, this article studies the performance of the proposed multilayer learning rule as applied to a selection of benchmark classification datasets. To this end, it was necessary to first convert input features into spike-based representations: to be conveyed by the input layer of an \ac{SNN} for downstream processing. Therefore, we made use of three distinct encoding strategies to achieve this, including: latency-based, receptive fields and scanline encoding. An overview of each strategy is described as follows.
\subsubsection{Latency Encoding}
A straightforward means to forming a temporal representation of an input feature is to signal its intensity based on the latency of a spike. Specifically, if we consider an encoding \ac{LIF} neuron that is injected with a fixed input current, then the time taken for it to respond with a spike can be determined as a function of the current's intensity: by interpreting the feature's value as a current, it is therefore possible for it to be mapped to a unique firing time. For an encoding \ac{LIF} neuron $i$ with a fixed firing threshold that only receives a constant current $I_i$, its first response time is given by \citep{Gerstner2002}:
\begin{equation} \label{eq:response_time}
t_i^1 =
\begin{cases}
\tau_m \log \left( \frac{R I_i}{R I_i - \vartheta} \right) & \text{if } R I_i > \vartheta \;, \\
\infty & \text{otherwise} \;,
\end{cases}
\end{equation}
where we use the same parameter selections for $\tau_m$ and $\vartheta$ as used in section~\ref{subsec:nrn_model}, and the resistance is set to $R = \SI{4}{M \Omega}$. In terms of relating feature values to current intensities, we take one of two different approaches. In the first approach we arbitrarily associate each feature value with a unique intensity value, which is ideally suited to the case where features are limited to a small number of discrete values. In the second approach, and in the case where features take real values, we devise a more direct association; specifically, each value $x_i$ belonging to a feature vector $\mathbf{x}$ is normalised to fall within the unit range before being scaled by a factor $I_\mathrm{max}$, providing the current intensity $I_i$. The specific choice of $I_\mathrm{max}$ used depends on the studied dataset. Regardless of the approach we take, and in order to maintain a tight distribution of early spike arrivals, we disregard spikes with timings greater than \SI{9}{ms} by setting them to infinity.
\subsubsection{Receptive Fields}
An alternative, population-based approach to encoding real-valued variables relies on the concept of receptive fields. This strategy was first described by \cite{Bohte2002a} in the context of \acp{SNN}, and involves setting up a population of neurons with overlapping, graded response curves which are individually sensitive to a certain subset of values an encoded feature can take. Typically, a Gaussian-shaped response curve (or receptive field) is assumed, where an early (late) spike fired by a neuron corresponds to strong (weak) overlap with its encoded feature. For the datasets that are encoded in this way, we assign $q$ neurons with Gaussian receptive fields to each feature. For the $i^\mathrm{th}$ feature, with values existing in the range $[x_i^\mathrm{min}, \dots, x_i^\mathrm{max}]$, its encoding neural fields are centred according to $x_i^\mathrm{min} + (2 j - 3) / 2 \cdot (x_i^\mathrm{max} - x_i^\mathrm{min}) / (q - 2)$, for encoder indices $1 \leq j \leq q$, and using the width parameter $\sigma_i = 2 / 3 \cdot (x_i^\mathrm{max} - x_i^\mathrm{min}) / (q - 2)$ \citep{Bohte2002a}. Hence, a data sample consisting of $n_f$ features results in a matrix of first-layer neural activations: $\mathbf{a}^1 \in \mathbb{R}^{n_f \times q}$, with values in the range $(0, 1]$. As in \cite{Bohte2002a}, these activations are then mapped to a matrix of single spike time encodings according to $\mathbf{t}^1 = 10 \cdot (1 - \mathbf{a}^1)$, where values greater than \num{9} are discarded since they are deemed insufficiently activated. For the datasets transformed by receptive fields in this article, we used a different number of encoding neurons to give the best performance.
\subsubsection{Scanline Encoding}
A promising strategy for transforming visual data into spike patterns is to apply `scanline encoding', a technique that has been described in \cite{Lin2018}. Scanline encoding is a method inspired by human saccadic eye movements, and works to detect object edges within images when scanned across multiple line projections; when an increase in pixel intensity is detected along one of these scanlines, an associated, encoding spike is generated. The efficiency of this method derives from its subsampling of image pixels using a limited number of scanlines, as well as its invariance to small, local image distortions; in this way, it is possible to perform dimensionality reduction on images with spatial redundancy. There are several ways in which scanline encoding can be implemented, and the specific approach taken by \cite{Lin2018} represents just one possible choice. In general, the first step involves setting up a number of scanlines with certain orientations that are fixed with respect to all training and test images; ideally, the directions of these scanlines should be selected to capture the most informative pixels, as determined through preliminary parameter sweeps. The next step is to then preprocess the images by reading the values of pixels along these directions. In \cite{Lin2018} these scanlines are additionally split into several segments, where each segment maps to a channel that injects spikes into an \ac{SNN}: if a contrast shift is detected anywhere along one of these segments, then a repeating spike train is generated for the corresponding channel. Although using segmented-scanlines provided the authors with a test accuracy of \SI{96.4}{\%} on MNIST, a large number of neurons was required to encode the images in this way and the significance of individual spike timings was disregarded.
In our approach we wish to fully utilise the timings of individual spikes to maintain sparse image representations, and also to avoid artificially segmenting scanlines in the first instance. To this end, we modify the spike generation process by instead interpreting the read-in pixel values underneath each line as a series of sequentially-occurring current stimulus values. Hence, if we assume these values are injected over some duration to an encoding \ac{LIF} neuron, then we arrive at a sequence of precisely-timed spikes representing each scanline. In terms of parameter selection, the encoding \ac{LIF} neurons are designed to be relatively fast responders: with their membrane time constants set to \SI{3}{ms}. The resistance of each neuron is set to $R = \SI{10}{M \ohm}$, with a firing threshold of just one millivolt to elicit a rapid response. Immediately after firing a spike an encoding neuron's membrane potential is reset to \SI{0}{mV}, and the neuron is forced to remain quiescent for \SI{1}{ms}. With respect to the scanlines, we first decide on a number $n_s$ according to the experimental design. Each scanline is then setup as follows. First, the orientation of each line is selected according to a uniform distribution over the range $[0, \pi)$. Each line is then set to intercept through a position that is normally-distributed about the image centre, where the scale parameter of this distribution is a quarter of the image width. These scanlines remain fixed across all training and test images. Hence, when an image is encoded, the pixels lying underneath a scanline are injected as current stimulus values into a corresponding \ac{LIF} encoder, after first normalising pixels to exist in the unit range. Pixels are always scanned-in from the bottom of an image upwards, over a duration of \SI{9}{ms}. An example of this encoding strategy is illustrated in Fig~\ref{fig:scanline_encoding}.
\begin{figure}[t]
\centering
\includegraphics{figs/fig_scan_example}
\caption{
Example of an MNIST digit being transformed into five spike trains using `scanline encoders'. In this case, the orientations of the scanlines were randomly predetermined, and pixel intensities lying underneath each line were read-in working from the bottom upwards over \SI{9}{ms}.
}
\label{fig:scanline_encoding}
\end{figure}
\subsection{Network Structure} \label{subsec:network_structure}
In all of the experiments we considered fully-connected, feedforward \acp{SNN} containing a single hidden layer of spiking neurons, such that $L=3$. Data samples presented to a network were encoded by the collective firing activity of input layer neurons, according to one of the temporal encoding strategies described above; hidden layer neurons were free to perform computations on these input patterns, and learn features useful for downstream processing. Neurons in the last, or output, layer of a network were tasked with forming class predictions on these data samples according to a first-to-spike mechanism, where the predicted class label was determined according to which one of $N_{l=3} = c$ output neurons was the first to respond with an output spike. The number of neurons implemented in the input and hidden layers, $N_1$ and $N_2$, respectively, depended on the type of input data and the run experiment, although we generally aimed to design a minimalistic setup for efficiency reasons. As described in section~\ref{subsec:learning_rule}, stochastic and deterministic \ac{SRM} neurons were simulated in the hidden and output layers, respectively, and, unless otherwise stated, all neurons within a layer shared the same cellular parameters. For all experiments, the internal simulation time step was set to $\delta t = \SI{0.1}{ms}$.
In terms of network connections, we initialised hidden and output weights to drive the initial firing rates of neurons to approximately one spike in response to presented data samples. Initial weight values were drawn from a uniform distribution, as detailed in the description of each experiment. Unless otherwise stated, each pre- and postsynaptic neuron pair had a single connection with no conduction delay in spike propagation.
\subsection{Synaptic Plasticity} \label{subsec:synaptic_plasticity}
Synaptic weights projecting onto the hidden and output layers of multilayer \acp{SNN} were modified during training via a combination of synaptic plasticity rules, while subject to certain constraints. This process is described in detail as follows.
\subsubsection{Learning Procedure}
During training, data samples were presented to a network iteratively as mini-batches, where computed weight gradients were accumulated over individual samples before actually being applied at the end of each mini-batch; this procedure was selected in order to reduce the variance of weight changes in a network to provide smoother convergence, as well as to obtain more reliable estimates of network activity as needed for regularisation. The order in which data samples were assigned as mini-batches was random, and, unless otherwise specified, the number of samples in each batch was 150. Furthermore, weight gradients were only computed after observing the entire response of a network when stimulated by a data sample, which in most cases was completed after duration $T = \SI{40}{ms}$ given input spikes arriving within \SI{10}{ms} of pattern onset. Hence, if the network was presented with a data sample described by an input vector $\mathbf{x}$ and a one-hot encoded class label $\mathbf{y}$, then, after applying a suitable temporal encoding strategy, a synaptic weight gradient in the $l^\mathrm{th}$ layer was determined as
\begin{equation} \label{eq:weight_update}
\Delta w_{ij}^l = -\eta \left( \frac{\partial C(\mathbf{y}, \mathbf{a}^L)}{\partial w_{ij}^l} + \lambda(S_i^l) - \gamma(S_i^l) \right) \;,
\end{equation}
where the first term in brackets on the RHS is the gradient of the cost function, which is evaluated following the steps of Eq~\eqref{eq:grad_wo} or \eqref{eq:grad_wh} for the output and hidden layers, respectively. The second term, $\lambda(S_i^l)$, is a regularisation function which depends on the postsynaptic neuron's firing activity, and the final term, $\gamma(S_i^l)$, is a synaptic scaling function. These two functions are defined as follows.
\subsubsection{Regularisation Term}
As a means to encourage network generalisation we enforced an L2 penalty term with respect to hidden and output layer weight gradients during training. Additionally, we also included a factor penalising high neuronal firing rates: a strategy that has been demonstrated in \cite{Zenke2018} to provide increased network stability as well as boosted performance. The regularisation term is defined by
\begin{equation} \label{eq:regularisation}
\lambda(S_i^l) = \lambda_0 w_{ij}^l \zeta(S_i^l) \;,
\end{equation}
where $\lambda_0$ is a scaling factor that is optimised for each experiment and the function $\zeta(S_i^l) = \left[ \int_{t=0}^{T} S_i^l(t) \mathrm{d}t \right]^2$ is an activity-dependent penalty term that depends on the number of spikes fired by a neuron $i$ in layer $l$. Since data samples were iteratively presented to the network, and the observation period $T$ was set sufficiently large, integrating over a spike train accurately reflected a neuron's firing rate. Through preliminary simulations we found that selecting an exponent greater than one with respect to the dependence of $\zeta$ on a neuron's firing rate gave the best results, consistent with that found in \cite{Zenke2018}.
\subsubsection{Synaptic Scaling Term}
It was necessary to include a synaptic scaling term as part of the weight gradient computation in order to sustain at least a minimum of activity in the network during training. This is because the weight update formulae described by Eqs~\eqref{eq:dw_L} and \eqref{eq:dw_L-1} both depend on presynaptic spikes in order to compute output and hidden weight gradients, which would result in non-convergent learning if no spikes could be acted upon. Adapting the synaptic scaling rule described in our previous work \citep{Gardner2015}, as well as taking inspiration from the scaling procedure used in \cite{Mostafa2017}, we define the synaptic scaling term as follows:
\begin{equation} \label{eq:syn_scaling}
\gamma(S_i^l) =
\begin{cases}
\gamma_0 |w_{ij}^l| & \text{if } \int_{t=0}^{T} S_i^l(t) \mathrm{d}t = 0 \;, \\
0 & \text{otherwise}\;,
\end{cases}
\end{equation}
where $\gamma_0 = 0.1$ is a scaling parameter. From a biological perspective, synaptic scaling can be interpreted as a homoeostatic learning factor that assists with maintaining desired activity levels \citep{vanRossum2000}.
\subsubsection{Learning Schedule}
The learning procedure used to compute weight gradients, defined by Eq~\eqref{eq:weight_update}, was accumulated over all data samples assigned to a mini-batch before weights were actually updated in a trained network. However, rather than directly using these computed gradients, we took the additional step of applying synapse-specific, adaptive learning rates to modulate the magnitude of the weight updates. As found in \cite{Zenke2018}, and through preliminary simulations, we found that a technique referred to as RMSProp \citep{Hinton2012} was more effective in providing convergent performance than applying a global, non-adaptive learning rate, and proved less sensitive to the experimental design. Specifically, an accumulated weight gradient $\Delta w_{ij}^l$, as determined using Eq~\eqref{eq:weight_update}, was used to inform a weight update via RMSProp according to
\begin{align} \label{eq:RMSProp}
w_{ij}^l
&\leftarrow w_{ij}^l + \frac{\eta_0}{\sqrt{m_{ij}^l + \varepsilon}} \Delta w_{ij}^l \nonumber \\
m_{ij}^l
&\leftarrow \beta m_{ij}^l + (1 - \beta) \left( \Delta w_{ij}^l \right)^2 \;,
\end{align}
where $\eta_0 > 0$ is a constant coefficient that was specific to each experiment, $m_{ij}^l$ is an auxiliary variable that keeps track of the recent weight gradient magnitudes, $\varepsilon = \num{1E-8}$ is a small offset that was included for numerical stability and $\beta = 0.9$ is a decay factor. The initial value of $m_{ij}^l$ was taken to be zero. Additionally, weights were constrained to a range, $w_{ij}^l \in [w_\mathrm{min}, w_\mathrm{max}]$, in order to prevent overlearning during training. The weight limits were specific to each of the studied experiments.
\section{Results}
\subsection{Solving the XOR Task} \label{subsec:xor_task}
As a first step in assessing the performance of the first-to-spike multilayer classifier, we tested its ability to classify data samples that were linearly non-separable. A classic benchmark for this is the \ac{XOR} classification task, a non-trivial problem for which a hidden layer of spiking neurons is indicated to be necessary for its solution \citep{Gruning2012,Gardner2015}.
An \ac{XOR} computation takes as its input two binary-valued input variables, and maps them to a single binary target output in the following way: $\{0, 0\} \rightarrow 0$, $\{0, 1\} \rightarrow 1$, $\{1, 0\} \rightarrow 1$ and $\{1, 1\} \rightarrow 0$, where 1 and 0 correspond to Boolean True and False, respectively. To make this scheme compatible with \ac{SNN} processing, we first transformed the input values into spike-based representations using an appropriate temporal encoding strategy. In this case, each binary value was encoded by the latency of an input spike, such that values of 1 and 0 corresponded to early and late spike timings, respectively. For simplicity, we selected the associated current intensities, as defined by Eq~\eqref{eq:response_time}, such that an input value of 1 resulted in a spike latency of \SI{0}{ms}, and an input value of 0 resulted in a spike latency of \SI{6}{ms}. Furthermore, in order to make the task non-trivial to solve, and to allow the network to discriminate between input patterns presenting both True or False values, we also included an input bias neuron that always fired a spike at \SI{0}{ms} to signal pattern onset \citep{Bohte2002a}. Hence, as illustrated in Fig~\ref{fig:xor_results}A, we setup an \ac{SNN} which contained three input neurons (one bias and two encoders), five hidden neurons and two output neurons to signal the two possible class labels (True / False). At the start of each experiment run, hidden and output weights were initialised by drawing their values from uniform distributions over the ranges: $[0, 16)$ and $[0, 6.4)$, respectively. The softmax scale parameter defining output activations was set to $\nu = 2$. In terms of network training, results were gathered from runs lasting 500 epochs, where each epoch corresponded to the presentation of all four input patterns. Regularisation was not required on this task, so we set $\lambda_0 = 0$. The RMSProp coefficient was set to $\eta_0 = 0.5$, and throughout training hidden and output weights were constrained between $[-30, 30]$.
\begin{figure}[!tp]
\centering
\includegraphics[width=\textwidth]{figs/fig_xor_results}
\caption{
Solving the \ac{XOR} computation in a multilayer \ac{SNN} using first-to-spike decoding. (A) Network setup: consisting of three, five and two neurons in the input, hidden and output layers, respectively. Input patterns were encoded by the latencies of spikes in the input layer, and their class labels were predicted based on which one of the two output neurons was the first to respond with a spike. (B) Network loss as a function of the number of training epochs, averaged over 100 independent runs. The shaded region shows the standard deviation. (C) Post-training hidden layer weight distributions. This panel breaks down the overall distribution of hidden weights into two components: one with respect to connections projecting from the input bias neuron, and the other due to input encoder neurons. The shaded width corresponds to the probability density of weights. (D) Post-training output layer weight distributions. This panel shows the distribution of output weights with respect to connections projecting from the hidden layer onto False- or True-signalling output neurons.
}
\label{fig:xor_results}
\end{figure}
As shown in Fig~\ref{fig:xor_results}B, the network was successful in learning the \ac{XOR} task: reaching a final training loss of \num{0.02 \pm 0.01} as obtained from 100 independent runs (error reported as \ac{SEM}). This reflected a final classification accuracy of \num{99.8 \pm 0.2}{\%}, which didn't reach precisely \num{100}{\%} due to the stochastic nature of hidden layer spike generation. In terms of the final weight distributions of the network (Fig~\ref{fig:xor_results}C, D), systematic trends were observed for certain connections in the hidden and output layers. With respect to the hidden layer, incoming connections received from the encoder neurons were widely distributed, with just over \num{70}{\%} being excitatory. By comparison, the bias neuron tended to project positively-skewed weights, with almost \num{90}{\%} being excitatory; the relatively large fraction of excitatory connections indicated its role in sustaining hidden layer activity, irrespective of the input pattern statistics. With respect to the final distribution of output layer weights, the False- and True-signalling neurons differed from each other by assuming a greater proportion of weight values saturating towards their lower and upper limits, respectively. The result of this distribution was to suppress the erroneous output neuron until the desired one received sufficient input activation to fire; this process can be inferred from the spike rasters depicted in Fig~\ref{fig:xor_rasters}, showing the hidden and output layer responses of a post-trained network when presented with each of the four input patterns. For example, when presented with patterns labelled as `False' the output neuron signalling `True' responded with a small number of delayed spikes, whereas the correct neuron promptly responded with multiple, rapid spikes.
\begin{figure}[!tp]
\centering
\includegraphics[width=\textwidth]{figs/fig_xor_rasters}
\caption{
Spike rasters depicting network activity on the \ac{XOR} task, with the same setup as in Fig~\ref{fig:xor_results}, after 200 epochs of training. Each of these four main panels depicts network activity in response to one of the four possible \ac{XOR} input patterns, where the associated class label is indicated as either `True' or `False'. Each main panel conists of three subplots: the top and middle subplots correspond to input and hidden spike patterns, respectively, where vertical lines indicate spikes. The bottom subplot displays the output layer voltage traces, where firing times are indicated by sharp discontinuities in these traces. Of the two output neurons, the first (blue trace) signals the class label `False', and the second (green trace) signals `True'. In this example, all of the input patterns were correctly identified.
}
\label{fig:xor_rasters}
\end{figure}
\subsection{Classifying the Iris and Wisconsin Datasets}
A key determinant of a classifier system's performance is its ability to generalise from training data to previously unseen test samples. In order to assess the generalisation ability of the proposed learning rule we applied it to classifying two benchmark datasets: Iris and Wisconsin.
The Iris dataset \citep{Fisher1936} presents a multi-class classification problem, containing 150 data samples evenly split between three different classes: two of which are not linearly separable from each other. Each sample is described by four real-valued features measuring some of the attributes of three types of Iris flower. The Wisconsin breast cancer dataset \citep{Wolberg1990} is a binary classification problem, containing 699 samples split between two different classes. Each sample consists of nine discrete-valued features measuring the likelihood of malignancy based on their intensity, and is labelled as either benign or malignant. We note that of these 699 original samples 16 contained missing values, which we discarded to provide a revised total of 683. In terms of our strategy for transforming these two datasets into spike-based representations, we followed the approach of \cite{Bohte2002a}; specifically, Gaussian receptive fields were applied as a means to converting the input features into first-layer spike latencies, resulting in spike-timings distributed between 0 and \SI{9}{ms} (see section~\ref{subsec:temporal_encoding}). For Iris, consisting of $n_f = 4$ features, we assigned a population of $q = 12$ input neurons to encode each feature, resulting in a total input layer size $N_1 = 48$. For Wisconsin, with $n_f = 9$ features, a population of $q = 7$ neurons per feature was assigned, resulting in $N_1 = 63$ input neurons. As usual, one output neuron was assigned to each input class, and for both Iris and Wisconsin we implemented a hidden layer size of 20. Hence, the \ac{SNN} structures were described by $48 \times 20 \times 3$ and $63 \times 20 \times 2$ for Iris and Wisconsin, respectively. At the start of each experimental run for Iris and Wisconsin, output weights were initialised with values drawn from a uniform distribution over $[0, 2)$. Hidden weights were initialised according to uniform distributions over $[0, 4)$ and $[0, 2.2)$ for Iris and Wisconsin, respectively. For both datasets the softmax scale parameter of Eq~\eqref{eq:softmax} was set to $\nu = 2$. With respect to network training, stratified three-fold cross-validation was used to obtain more accurate estimates for the network performance. Data samples were presented to the network as mini-batches, and one epoch of training corresponded to a complete sweep over all unique training samples presented in this way. The regularisation parameter was set to $\lambda_0 = \num{E-3}$ and the RMSProp coefficient: $\eta_0 = 0.1$. In all cases, hidden and output weights were constrained to values in the range $[-15, 15]$.
\begin{figure}[!tp]
\centering
\includegraphics{figs/fig_iris_wisc_loss_confTe}
\caption{
Training multilayer \acp{SNN} to classify the Iris and Wisconsin datasets using first-to-spike decoding. Iris and Wisconsin contain three and two pattern classes, respectively, with associated network structures: $48 \times 20 \times 3$ and $63 \times 20 \times 2$. (A--B): Evolution of the average training / test loss of the network on the two datasets, where the shaded region indicates the standard deviation. The vertical dashed line in each panel indicates the point at which early-stopping was applied, corresponding to the minimum recorded value in the test loss. Early-stopping was taken at 30 and 6 epochs for Iris and Wisconsin, respectively, which is equivalent to 30 and 24 (weight update) iterations. These results were obtained from 40 independent runs.
(C--D): Confusion matrices of the \acp{SNN}, post-training on Iris (C) and Wisconsin (D). The values report the percentage test accuracy, evaluated at the moment when early-stopping was applied. Iris data samples belonging to classes labelled `1' and `2' are linearly non-separable from each other, and for Wisconsin the labels `0' and `1' correspond to `benign' and `malignant', respectively. The null symbol, $\phi$, indicates that no clear prediction was formed by the network, being a consequence of either no output spiking or more than one output neuron sharing the same first spike response time (within the time resolution, $\delta t$).
}
\label{fig:iris_wisc_loss_confTe}
\end{figure}
For both Iris and Wisconsin the trained \acp{SNN} demonstrated success in fitting the data (Fig~\ref{fig:iris_wisc_loss_confTe}A--B), with final training accuracies of \num{99.88 \pm 0.04}{\%} and \num{98.04 \pm 0.04}{\%} after 100 epochs, respectively. In terms of their generalisation to test data, it was necessary to impose early-stopping to prevent overfitting. From multiple runs of the experiment, we determined the ideal training cut-off points to be approximately 30 and 6 epochs for Iris and Wisconsin, respectively. Since the number of weight update iterations / mini-batches per epoch was just one for Iris and four for Wisconsin, the equivalent number of iterations to early-stopping were 30 and 24, respectively. From the networks' confusion matrices (Fig~\ref{fig:iris_wisc_loss_confTe}C--D), evaluated at the point of early-stopping, the test accuracies were \num{95.2 \pm 0.2}{\%} and \num{97.12 \pm 0.08}{\%} for Iris and Wisconsin, respectively. As expected, the matrix for Iris indicated the relative challenge in separating the latter two, linearly non-separable classes. Furthermore, and as desired, the incidence of null predictions formed by the trained networks was kept to a minimum; in most cases a null prediction corresponded to a lack of firing activity in the network, typically preventing weight gradient computations, however this issue was mitigated by the addition of synaptic scaling in order to drive sufficient neuronal activation.
The spiking activity of the \acp{SNN} in response to selected data samples, upon early-stopping during training on Iris and Wisconsin, respectively, is shown in Fig~\ref{fig:iris_wisc_rasters}. It is clear for each of the presented samples that input spikes were confined to the first \SI{10}{ms}, which prompted phasic activity in the hidden layer. With respect to the Iris samples (Fig~\ref{fig:iris_wisc_rasters}A), the network formed rapid, and correct first-spike reponses in the output layer: in this case within just \SI{10}{ms}. Due to the parameterisation of the learning rule, firing responses generated by the remaining neurons in the output layer were not completely eliminated: since these other neurons fired with sufficiently delayed onset, their resulting contribution to the output error signals used to inform weight updates were minimal. This behaviour was encouraged, given that it minimised data overfitting and prevented unstable dynamics arising due to competition between the backpropagation and synaptic scaling components of the learning rule (c.f. Eq~\eqref{eq:weight_update}). As with Iris, the network generated desired, rapid first-spike responses in the output layer when responding to Wisconsin data samples (Fig~\ref{fig:iris_wisc_rasters}B). In this example the Wisconsin-trained network formed correct predictions on the two selected samples, and interestingly a ramp-up in both hidden and output layer activity was observed for the malignant-labelled sample in order to shift the desired first-spike response earlier.
\begin{figure}[!tp]
\centering
\includegraphics{figs/fig_iris_wisc_rasters}
\caption{
Spike rasters depicting network activity in response to selected Iris and Wisconsin data samples, corresponding to the experiment in Fig~\ref{fig:iris_wisc_loss_confTe} for networks trained with early-stopping applied. (A) The left and right main panels depict typical network responses to Iris samples belonging to the first and last classes, respectively. Both panels show spiking activity in the input, hidden and output layers of a trained network. (B) The left and right main panels depict network responses to benign (class id: 0) and malignant (class id: 1) Wisconsin samples, respectively. For both (A) and (B) desired first-spike responses in the output layer were observed, resulting in correct input classifications.
}
\label{fig:iris_wisc_rasters}
\end{figure}
\subsection{Sensitivity to the Learning Schedule}
The previous experiments have demonstrated the performance of the first-to-spike classifier rule using optimal parameter selections of the learning coefficient $\eta_0$, used as part of the definition of RMSProp (Eq~\eqref{eq:RMSProp}). The sensitivity of the rule to its learning schedule is an important consideration regarding its versatility and application to unfamiliar data, therefore we tested its robustness when swept over a wide range of $\eta_0$ values.
As the test case we used the Iris dataset, with the same temporal encoding procedure and network setup as described in the previous section. As previously, stratified three-fold cross-validation was used to estimate the test loss during training. The regularisation parameter was set to $\lambda_0 = \num{E-3}$, and weights were constrained to values between $[-15, 15]$. Each epoch corresponded to one iterative weight update procedure, using a mini-batch size of 100. The network was trained for a total of 150 epochs for each $\eta_0$ selection, where at the end of each run we identified the minimum value in the recorded test loss and its associated number of epochs. The minimum number of epochs was determined by finding the first point at which the average test loss fell within \SI{1}{\%} of its lowest value, and its error was estimated based on the margin from falling within \SI{10}{\%} of the lowest value.
The minimum test loss attained, including the associated number of training epochs, is shown in Fig~\ref{fig:iris_minima} for selections of $\eta_0$ between \num{E-2} and \num{E1}. From these results, it follows that a learning coefficient with a value of around \num{E-1} provided a reasonable trade-off between network performance and learning speed: larger $\eta_0$ values returned sub-optimal test loss minima, while smaller values led to an exponential increase in the training time with little change in the performance. Extended parameter sweeps also indicated similar behaviour with respect to the Wisconsin dataset as the test case. For these reasons we were motivated to select an optimal value of $\eta_0 = \num{E-1}$ for both Iris and Wisconsin.
\begin{figure}[!tp]
\centering
\includegraphics{figs/fig_iris_lossTe_epochs_minima}
\caption{
Parameter sweep over the RMSProp learning coefficient $\eta_0$, evaluated for an \ac{SNN} trained on Iris with the same network structure and training procedure as in Fig~\ref{fig:iris_wisc_loss_confTe}. (A) Minimum recorded test loss as a function of $\eta_0$, taken as the median value, where error bars indicate the \ac{SEM}. (B) The associated number of training epochs needed to reach the minimum test loss. These results were gathered from 20 independent runs.
}
\label{fig:iris_minima}
\end{figure}
These observations support our selection of RMSProp, as opposed to a fixed learning rate which demonstrated greater sensitivity to its parameter choice. In addition to the above, we found that RMSProp's learning coefficient exhibited a dependence on the number of input synapses per network layer, such that more optimal performance was attained by adjusting $\eta_0$ proportional to $1 / N_l$. This was used to inform our choice of $\eta_0$ used for the MNIST dataset.
\subsection{Classifying MNIST: Latency Encoding}
The MNIST dataset of handwritten digits \citep{LeCun1998} is commonly used to benchmark a classifier system's performance, owing to the relatively high structural complexity of the data and the large number of training and test samples. Although this problem is largely solved using deep convolutional neural networks, MNIST still poses a challenge to solve using spike-based computational approaches. For this reason, we apply our first-to-spike classifier rule to solving MNIST in order to get an indication of its potential for real world data classification.
MNIST consists of \num{60}{k} and \num{10}{k} training and test samples, respectively, where each sample corresponds to a \num{28x28}, 8-bit grayscale image depicting a handwritten digit between 0 and 9. In order to make these real-valued images compatible with spike-based processing we applied a latency encoding strategy: forming a one-one association between each input pixel and an encoding \ac{LIF} neuron. In this way, each image, consisting of 784 pixels, was transformed into 784 single-spike latencies presented by the first layer of a multilayer \ac{SNN}. Specifically, and as described in section~\ref{subsec:temporal_encoding}, the pixel values were transformed into current intensities using the scaling factor $I_\mathrm{max} = \SI{20}{nA}$, resulting in the following pixel-to-latency mapping: $[84, 256) \mapsto [9, 2) \mathrm{ms}$, where pixel values less than 84 were insufficient to elicit an encoded response. In terms of network structure, the simulated \acp{SNN} consisted of $784 \times N_{2} \times 10$ neurons, where the number of hidden neurons, $N_2$, was varied, and the the number of output neurons was matched to the 10 digit classes. According to the first-to-spike decoding strategy, the first output neuron to respond with a spike predicted the input sample's class. The network weights were initialised by drawing hidden and output values from uniform distributions over the ranges: $[0, 0.4)$ and $[0, 32 / N_2)$, respectively. The softmax scale parameter was set to $\nu = 4$ in order to tighten the conditional probability distribution of class label predictions formed by the output layer: this choice was supported by preliminary simulations, where it was found to boost the discriminative power of the \ac{SNN} when handling a larger number of input classes. In terms of network training, at the start of each run 600 of the MNIST training samples were set aside in a stratified manner for validation. The remaining training samples were then iteratively presented to the network as mini-batches, with a total of 4000 iterations. To get an indication of the network's performance during training the loss on the validation data was computed every 20 iterations. The regularisation parameter and RMSProp coefficient were set to $\lambda_0 = \num{E-4}$ and $\eta_0 = 0.01$, respectively. Throughout training, all weights were constrained to values in the range $[-2, 2]$ to avoid overfitting.
\begin{figure}[!tp]
\centering
\includegraphics{figs/fig_mnist_latency_results}
\caption{
Multilayer \acp{SNN} trained on the MNIST dataset, using a latency encoding strategy to transform pixels into single, precisely-timed input spikes. (A) Network loss as a function of the number of training iterations, evaluated using a validation set. Each curve corresponds to a different number of hidden layer neurons, $N_2$, from between 10 (lightest colour) and 160 (darkest colour). (B) The final accuracy of the network after 4000 training iterations, as evaluated on the \num{10}{k} test samples. (C) Confusion matrix of an \ac{SNN} containing 160 hidden neurons, as evaluated on the test samples at the end of training. Values less than \SI{1}{\%} are not indicated. These results were averaged from 10 independent runs.
}
\label{fig:mnist_latency}
\end{figure}
As shown by Fig~\ref{fig:mnist_latency}, the trained \acp{SNN} were capable of generalising from the MNIST training samples to the withheld test samples, with a highest recorded test accuracy of \num{89.4 \pm 0.4}{\%} for a network containing 160 hidden layer neurons. With the given selection of regularisation parameters and weight constraints, model overfitting was minimised and smooth convergence was observed within the maximum number of training iterations (Fig~\ref{fig:mnist_latency}A). Moreover, as the hidden layer size was increased, a speedup in the learning rate became apparent. As indicated by Fig~\ref{fig:mnist_latency}B, the accuracy of the network approached an asymptotic value of just under \SI{90}{\%} when containing up to 160 neurons. The confusion matrix depicted in Fig~\ref{fig:mnist_latency}C corresponds to a network containing 160 neurons, and provides some insight into the robustness of network classifications with respect to each of the presented MNIST test digits. As expected, digits `zero' and `one' were least challenging for the network to identify by virtue of their distinctive features, whereas the digit `five', for example, tended to share a greater feature overlap with several other digits, making it somewhat more difficult to discriminate. Furthermore, in the event of a digit not being recognised by the network there was a tendency towards a null prediction (no output spikes) being returned rather than an erroneous digit; technically this is a preferable outcome, since it reduces the likelihood of false-positives by the network.
In summary, the first-to-spike classifier rule has demonstrated generalisation capability on the MNIST dataset to a reasonable degree of accuracy. The results reported here do not reflect an upper bound on the classifier's MNIST performance, and with further parameter tuning and feature preprocessing further accuracy gains would be expected. For simplicity, this experiment considered a straightforward one-one mapping between each input pixel and encoding neuron in order to transform the data, although such a scheme is computationally prohibitive for spike-based processing and fails to fully exploit the precise timings of individual spikes. Utilising a fully temporal encoding strategy presents the next challenge, and is addressed in the following section.
\subsection{Classifying MNIST: Scanline Encoding}
So far, the technical capability of the first-to-spike classifier rule has been demonstrated on MNIST when encoded using a one-one association between input pixels and single-spike latencies. This encoding strategy is somewhat simplistic, however, and fails to take full advantage of the precise timings of multiple spikes as a means to perform dimensionality reduction on the data. To address this we consider an alternative encoding strategy, termed scanline encoding, that extends on the work of \cite{Lin2018}, and enables more compact feature representations of the MNIST digits using substantially fewer encoding neurons.
In order to transform the real-valued features of MNIST into sequences of precisely-timed spikes, we applied the scanline encoding strategy as described in \ref{subsec:temporal_encoding}. In summary, at the start of each simulation run we implemented a variable number of scanlines, $n_s$, ranging between 8 and 64. Each of these scanlines had an arbitrarily determined orientation, independent of the others, and was constrained to intersect through a point close to the centre of the image space. For the duration of each run these scanlines were held fixed, and in response to each presented sample a scanline read-in its sequence of input pixels and returned a time-varying current; this current in turn acted as the stimulus for an encoding \ac{LIF} neuron in the first layer of an \ac{SNN}, driving a spike train response (Fig~\ref{fig:scanline_encoding} illustrates this scanning process for an example image). Hence, the strategy we employed here was capable of transforming high-dimensional images into compact spatiotemporal spike patterns, whilst still retaining characteristics of their spatial organisation. With respect to the network structure, \acp{SNN} consisting of $N_1 \times N_2 \times 10$ neurons were simulated, where the number of input neurons was matched to the number of scanlines used, $N_1 = n_s$, and the number of hidden neurons $N_2$ was varied. As previously, the number of output neurons was matched to the 10 different digit classes of MNIST, and first-to-spike decoding was used to classify the data samples. In terms of network connections, two distinct modelling approaches were considered regarding input-to-hidden layer spike propagation: `delayless' and `delayed'. In the delayless case, spikes were instantaneously transmitted from input to hidden neurons, as has been implemented so far for all the previous experiments. In the delayed case, however, spikes transmitted from input to hidden neurons were subject to propagation delay: ranging from between \num{1} and \SI{10}{ms}, rounded to the nearest millisecond. At the start of each experimental run, these propagation, or conduction, delays were randomly drawn from a uniform distribution for each input-to-hidden connection, and held fixed thereafter. In all cases hidden-to-output layer spike conduction was delayless. The purpose of simulating conduction delays was to determine if this could assist a network in linking early / late spike arrival times arising from scanline-encoded digits. With respect to weight initialisation, hidden and output weights were initialised according to uniform distributions with values ranging between $[0, 40 / N_1)$ and $[0, 32 / N_2)$, respectively. The softmax scale parameter was set to $\nu = 4$. For each run, a network was trained and validated in a similar way to the latency encoding experiment: 600 MNIST training samples were set aside for validation every $20^\mathrm{th}$ iteration, and the remaining samples were iteratively presented as mini-batches for 1600 iterations. The regularisation parameter and RMSProp coefficient were set to $\lambda_0 = \num{E-4}$ and $\eta_0 = 0.05$, respectively. All of the network weights were constrained to values in the range $[-6, 6]$.
Shown in Fig~\ref{fig:mnist_scan_results} are results obtained from trained \acp{SNN}, with and without conduction delays between the input and hidden layers, for scanline-encoded MNIST samples. It can be seen that in all cases the trained networks converged in learning within the maximum 1600 iterations, with an additional small speedup as the number of hidden neurons was increased from 10 to 160 (Fig~\ref{fig:mnist_scan_results}A-B). It is also apparent that the inclusion of conduction delays reduced the final loss values, enabling the network to approach the same values as reported for latency-encoded MNIST (compare with Fig~\ref{fig:mnist_latency}A). In terms of the post-training performance on the withheld test samples, the highest attained accuracies were \num{76 \pm 6}{\%} and \num{87 \pm 2}{\%} for delayless and delayed networks, respectively, as evaluated using 160 hidden neurons and between 32 and 64 scanlines (Fig~\ref{fig:mnist_scan_results}C-D). From the gathered results, there was diminishing returns in the final test accuracy as the number of neurons and scanlines were increased beyond 160 and 32, respectively. Comparatively, the test accuracy returned by the best performing network with conduction delays fell within just \num{3}{\%} of that obtained based on a latency encoding strategy, but with the advantage of using an order of magnitude fewer input neurons.
\begin{figure}[!tp]
\centering
\includegraphics{figs/fig_mnist_scan_results}
\caption{
Multilayer \acp{SNN}, with or without input-to-hidden layer spike-propagation (conduction) delays, trained on the MNIST dataset. Scanline encoding was used to transform images into compact spatiotemporal spike patterns. (A and B) Network losses for 32 scanlines as a function of the number of training iterations, evaluated using a validation set. Panels A and B correspond to `delayless' and `delayed' networks, respectively: referring to the inclusion of conduction delays between the input and hidden layers. For each panel, the curve colour corresponds to a certain number of hidden layer neurons, $N_2$: from between 10 (lightest colour) and 160 (darkest colour). (C and D) The final accuracies of the network after 1600 training iterations, as evaluated on the \num{10}{k} test samples. Panels C and D correspond to delayless and delayed networks, respectively. These results were averaged from 10 independent runs.
}
\label{fig:mnist_scan_results}
\end{figure}
The confusion matrix of a post-trained $32 \times 160 \times 10$ network with conduction delays, as evaluated on the withheld MNIST test samples, is depicted in Fig~\ref{fig:mnist_scan_confusion_delay}. These results correspond to a high performing case from Fig~\ref{fig:mnist_scan_results}. As expected, the network demonstrated the least difficulty in recognising the digits `zero' and `one', closely followed by `six'. However, the network tended to confuse the digits `four' and `nine' with relatively high frequency, owing to their closer similarities. By comparison with the confusion matrix from Fig~\ref{fig:mnist_latency}C, the overall percentage of null predictions by the networks for both encoding strategies were consistent. Despite this, networks utilising scanline encoding gave rise to more variable predictions between experiment runs: the coefficients of variation with respect to correct predictions was \num{0.08 \pm 0.03} and \num{0.02 \pm 0.01} for scanline- and latency-based encoding, respectively; this discrepancy was attributed to the random selection of scanline orientations between runs, whereas latency-based representations of the same input samples remained fixed.
\begin{figure}[!tp]
\centering
\includegraphics{figs/fig_mnist_scan_confusion_delay}
\caption{
Confusion matrix of an \acp{SNN} with input-to-hidden layer conduction delays, after 1600 training iteration on MNIST encoded using 32 scanlines. This was evaluated on the withheld test samples. The network contained 160 hidden neurons. Values less than \SI{1}{\%} are not indicated. These results were averaged from 10 independent runs.
}
\label{fig:mnist_scan_confusion_delay}
\end{figure}
For illustrative purposes, an example of a scanline-encoded digit and the response it elicited in a post-trained \ac{SNN} is shown in Fig~\ref{fig:mnist_scan_raster_delay}. A sample of the digit `one', which was withheld during network training, was transformed into sequences of precisely-timed spikes, and represented by the first layer of neurons in a minimal $32 \times 40 \times 10$ network with input-to-hidden layer conduction delays. In this example, the network correctly identified the input sample by driving the corresponding output neuron to respond first with a spike. As indicated by panel A, most of the feature space was covered by the 32 scanlines: an increase in this number resulted in diminishing returns, relating to feature redundancy. In terms of the spike raster subplots in panel B, there is a relatively large offset in the emergence of hidden spiking with respect to the onset of input spikes, whereas there is a large degree of overlap between hidden-and-output spiking. This reflects the delayed propagation of input-to-hidden spikes, but which affords the network time to link early and late input spikes in order to inform its final decision. The activity of neurons in the output layer tended to be greater than that observed with the other datasets (compare with Fig~\ref{fig:iris_wisc_rasters}), indicative of the increased complexity in learning to discriminate between a larger number of classes with more feature overlap.
\begin{figure}[!tp]
\centering
\includegraphics[width=\textwidth]{figs/fig_mnist_scan_raster_delay}
\caption{
Illustration of the encoding and subsequent classification of the MNIST digit `one' based on scanlines. In this example, the digit is first transformed into spike trains via scanline encoding, before being processed by a previously trained \ac{SNN} containing 40 hidden neurons and input-to-hidden layer conduction delays. (A) The 32 scanlines encoding the digit `one' (red lines). (B) Spike raster of the network's response to the encoded digit. The top, middle and bottom subplots correspond to input, hidden and output spike patterns, respectively. In this case, the first neuron to respond with a spike (indicated by the blue arrow) corresponds to the desired class label, resulting in a correct classification.
}
\label{fig:mnist_scan_raster_delay}
\end{figure}
To summarise, this section has demonstrated a novel methodology to training \acp{SNN} on MNIST that are more constrained in their size, and yet more efficient in terms of their spike-based processing. This has been realised by the application of scanline encoding: a feature preprocessing method that can transform high dimensional images into compact spatiotemporal spike patterns. In particular, the results obtained using this method approach a similar level of accuracy to networks trained via a more commonly used, but more computationally expensive, one-one encoding scheme. Relying more on the precise timings of individual spikes for data classification massively reduces the number of encoding neurons required, and could find important applications in constrained network architectures, for example in neuromorphic systems like Heidelberg's HICANN-DLS device \citep{Friedmann2017}. It is expected that the performance of this method could be improved upon by making scanline encoding more domain specific: for example by optimising scanline orientations prior to network training, rather than setting them arbitrarily. Our choice of a random initialisation, however, indicates the potential in transferring this method to unfamiliar problem domains.
\section{Discussion}
In this article we have introduced a new supervised approach to training multilayer spiking neural networks, using a first-to-spike decoding strategy, with the proposed learning rule capable of providing robust performance on several benchmark classification datasets. The learning rule extends on our previous formulation in \cite{Gardner2015} by redefining the network's cost function to depend on the distribution of first spike arrival times in the output layer, rather than entire spike trains, and specifying the target signal according to which one of $c$ output neurons should be driven to fire first; this redefinition of the cost function is particularly advantageous for data classification purposes since it places much less of a constraint on the network's parameters during training, thereby avoiding overfitting of the data. Furthermore, restricting our focus to just first-spike arrival times in the output layer has allowed us to largely reduce the runtime of simulations: an important consideration when taking into account the relatively high computational cost in simulating spike-based models. Based on first-to-spike decoding, pattern classification was rapid: with predictions in some cases made within just \SI{10}{ms} of pattern onset. Such a decoding strategy has similarly been used to good effect in \citep{Mostafa2017,Bagheri2018}, and moreover avoids the ambiguity of decision making based on comparisons between entire target and actual output spike trains as used in \citep{Bohte2002a,Florian2012,Sporea2013,Gardner2015,Gardner2016}. We highlight the novel, hybrid nature of our learning model: which implements both deterministic, \ac{LIF}-type output neurons for more reliable network responses, and stochastic hidden layer neurons that should aid with its regularisation.
The formulation of our learning rule combines several different techniques, as found in \cite{Bohte2002a, Pfister2006, Gardner2015, Mostafa2017}. As our first step, we selected the network's cost function as the cross-entropy, dependent on the distribution of first-spike arrival times in the output layer, and set the target signal according to the index of the neuron associated with the correct class \citep{Mostafa2017}. Subsequently, and in order to apply the technique of spike-based backpropagation, we estimated the gradients of deterministically-generated output firing times by following the linear approximation used in \cite{Bohte2002a}; our choice here was motivated by simplicity reasons, since only single, first-spikes in the output layer were required for parameter optimisation. We then applied our previously described probabilistic method to solving hidden layer spike gradients for stochastic neurons \citep{Gardner2015}, which supports multiple firing times and is theoretically justified \citep{Pfister2006}. Therefore, in combining these methods, we arrive at a fully-fledged, supervised learning rule for multilayer \acp{SNN} that is extensible to $N$ number of hidden layers.
In terms of performance, we first demonstrated the learning rule to be capable of solving the non-trivial \ac{XOR} classification task: establishing its ability to classify linearly non-separable data, for which a hidden layer is required. Subsequently, the rule was found to be highly accurate in classifying more challenging data samples belonging to the Iris and Wisconsin datasets, and for which two of the Iris classes are linearly non-separable. In particular, we found that implementing the RMSProp learning schedule \citep{Hinton2012} made the network less sensitive to the choice of learning coefficient $\eta_0$, suggesting it as an effective mechanism to minimising the process of parameter fine-tuning; this in turn increased the flexibility of the rule as applied to different datasets. Additionally, we found in general that regularising the network by penalising high neuronal firing rates resulted in improved generalisation ability and accuracy, confirming the observations of \cite{Zenke2018}. Suppressing high firing rates also reduced the number of computational operations in the run simulations, since fewer hidden spikes were integrated over when computing the iterative weight updates, thereby enabling a large speedup in runtime. With respect to the rule's performance on MNIST, the test accuracy didn't reach state-of-the art: with our rule achieving around \SI{90}{\%}. It is noted, however, that attaining high accuracy on MNIST, including other structurally complex datasets such as Fashion-MNIST and ImageNET \citep{Xiao2017,Deng2009}, via spike-based processing still poses more of a challenge compared with traditional \ac{ANN} approaches. Many existing spike-based supervised learning methods have achieved accuracies ranging between \SI{90} and almost \SI{99}{\%} on MNIST, with the highest levels relating to deeper \ac{SNN} architectures and convolutional filtering optimised for image processing tasks \citep{Connor2013,Neftci2014,Diehl2015,Lee2016,Mostafa2017,Tavanaei2019,Zenke2020}. In our approach, we tested minimal \ac{SNN} architectures with their flexibility and transferrability to constrained neuromorphic hardware platforms such as HICANN-DLS \citep{Friedmann2017} in mind. Intriguingly, however, we found that our rule was still capable of achieving almost \SI{90}{\%} accuracy on MNIST when using our novel scanline encoding method, as inspired by \cite{Lin2018}, and relying on as little as 32 encoding input neurons. We also note that these results represent a lower bound on what is achievable using our learning method: with model refinement in the form of extended hyper-parameter fine-tuning and deeper network architectures, it is expected that the final accuracies could be further increased.
\section*{Appendix: Extending the Learning Rule}
The procedure used to derive weight updates in multilayer \acp{SNN} is also extensible to deeper network architectures. For demonstrative purposes, we consider a multilayer \ac{SNN} containing two hidden layers, and derive weight updates for hidden neurons residing in the third-last layer, i.e. for layer $l = L - 2$; refer to Fig~\ref{fig:snn_schematic} for a schematic of this network structure, and for the notation we use from this point onwards.
\begin{figure}[!tp]
\centering
\includegraphics{figs/fig_snn_schematic}
\caption{
Schematic of the multilayer \ac{SNN} architecture considered here, containing two hidden layers. The network is feedforward with all-to-all connectivity between adjacent layers. From the last layer, $L$, to the first layer, $L-3$, neurons are respectively indexed: $i' \in I'$, $j' \in J'$, $i \in I$, and $j \in J$. Synaptic weights are denoted with respect to the postsynaptic layer, for example $w_{ij}^{L-2}$ is the weight projecting from presynaptic neuron $j$ onto postsynaptic neuron $i$ residing in layer $L-2$.
}
\label{fig:snn_schematic}
\end{figure}
\paragraph{Weight update rule.} Gradient descent is applied to Eq~\eqref{eq:cross-entropy-onehot} with respect to weights projecting onto layer $L - 2$, according to
\begin{equation} \label{eq:grad_wh2}
\Delta w_{ij}^{L-2} = -\eta \frac{\partial C(\mathbf{y}, \mathbf{a}^L)}{\partial w_{ij}^{L-2}} \;.
\end{equation}
Similarly as in Eq~\eqref{eq:grad_wh_2}, the gradient term is expanded as follows:
\begin{align} \label{eq:grad_wh2_2}
\frac{\partial C(\mathbf{y}, \mathbf{a}^L)}{\partial w_{ij}^{L-2}}
&= \sum_{i' \in I'} \frac{\partial C(\mathbf{y}, \mathbf{a}^L)}{\partial u_{i'}^L} \frac{\partial u_{i'}^L(t)}{\partial w_{ij}^{L-2}} \bigg\rvert_{t = \tau_{i'}} \nonumber \\
&= \sum_{i' \in I'} \delta_{i'}^L \frac{\partial u_{i'}^L(t)}{\partial w_{ij}^{L-2}} \bigg\rvert_{t = \tau_{i'}} \;,
\end{align}
where for convenience we use the identity of the output error signal, defined by Eq~\eqref{eq:errorL}. Hence, using the \ac{SRM} defined by Eq~\eqref{eq:potential}, the gradient of the ${i'}^\mathrm{th}$ output neuron's membrane potential is given by
\begin{align} \label{eq:grad_wh2_3}
\frac{\partial u_{i'}^L(t)}{\partial w_{ij}^{L-2}}\bigg\rvert_{t = \tau_{i'}}
&= \sum_{j' \in \Gamma_{i'}^L} w_{i'j'}^L \frac{\partial}{\partial w_{ij}^{L-2}} \left( \epsilon \ast S_{j'}^{L-1} \right)(\tau_{i'}) \nonumber \\
&= \sum_{j' \in \Gamma_{i'}^L} w_{i'j'}^L \left( \epsilon \ast \frac{\partial S_{j'}^{L-1}}{\partial w_{ij}^{L-2}} \right)(\tau_{i'}) \;,
\end{align}
where $\Gamma_{i'}^L$ is the set of immediate neural predecessors of a last layer neuron $i'$. As in section~\ref{subsec:learning_rule}, we substitute the ill-defined gradient of a hidden layer spike train with the gradient of its expected value, and consider spikes to be distributed according to an underlying, instantaneous firing rate: $\rho_{j'}^{L-1}(t) = g(u_{j'}^{L-1}(t))$. Hence, following the same approach as Eqs~\eqref{eq:grad_wh_4} and \eqref{eq:grad_wh_5}, we arrive at the following expression for the gradient of the expected hidden spike train:
\begin{equation} \label{eq:grad_wh2_4}
\frac{\partial \left\langle S_{j'}^{L-1}(t) \right\rangle_{S_{j'}^{L-1}|L-2, j'}}{\partial w_{ij}^{L-2}}
= \delta_D(t-\hat{t}) \frac{\partial \rho_{j'}^{L-1}(t|L-2, j')}{\partial w_{ij}^{L-2}} \;,
\end{equation}
where the expected spike train is conditioned on activity in the previous layer, $L-2$, and its own last firing time, $\hat{t}_{j'}$. As before, $\delta_D$ is the Dirac-delta function: depending on an arbitrary, last firing time, $\hat{t}$. Combining the above with Eqs~\eqref{eq:potential} and \eqref{eq:escape_rate}, we find
\begin{align} \label{eq:grad_wh2_5}
\frac{\partial \left\langle S_{j'}^{L-1}(t) \right\rangle_{S_{j'}^{L-1}|L-2, j'}}{\partial w_{ij}^{L-2}}
&= \frac{1}{\Delta u} \delta_D(t-\hat{t}) \rho_{j'}^{L-1}(t|L-2, j') \frac{\partial u_{j'}^{L-1}(t)}{\partial w_{ij}^{L-2}} \nonumber \\
&= \frac{1}{\Delta u} \left\langle S_{j'}^{L-1}(t) \frac{\partial u_{j'}^{L-1}(t)}{\partial w_{ij}^{L-2}} \right\rangle_{S_{j'}^{L-1}|L-2, j'} \;.
\end{align}
Using Eq~\eqref{eq:potential}, the gradient of the $j^{'\mathrm{th}}$ neuron's membrane potential is expanded with respect to the previous layer as follows:
\begin{align} \label{eq:grad_wh2_6}
\frac{\partial u_{j'}^{L-1}(t)}{\partial w_{ij}^{L-2}}
&= w_{j'i}^{L-1} \frac{\partial}{\partial w_{ij}^{L-2}} \left( \epsilon \ast S_i^{L-2} \right)(t) \nonumber \\
&= w_{j'i}^{L-1} \left( \epsilon \ast \frac{\partial S_i^{L-2}}{\partial w_{ij}^{L-2}} \right)(t) \;,
\end{align}
where all spike train gradients in layer $L-2$ except for $i^\mathrm{th}$ one do not depend on $w_{ij}^{L-2}$, and therefore vanish. As usual, the gradient of a hidden spike train is substituted with the gradient of its expected value, conditioned on the neuron's last firing time and its received spike trains from the previous layer:
\begin{align} \label{eq:grad_wh2_7}
\frac{\partial \left\langle S_{i}^{L-2}(t) \right\rangle_{S_i^{L-2}|L-3, i}}{\partial w_{ij}^{L-2}}
&= \delta_D(t-\hat{t}) \frac{\partial \rho_i^{L-2}(t|L-3, i)}{\partial w_{ij}^{L-2}} \nonumber \\
&= \frac{1}{\Delta u} \left\langle S_i^{L-2}(t) \frac{\partial u_i^{L-2}(t)}{\partial w_{ij}^{L-2}} \right\rangle_{S_i^{L-2}|L-3, i} \;,
\end{align}
where hidden spikes in layer $L-2$ are distributed according to $\rho_i^{L-2}$.
The gradient of the neuron's membrane potential is determined using Eq~\eqref{eq:potential}:
\begin{equation} \label{eq:grad_wh2_8}
\frac{\partial u_i^{L-2}(t)}{\partial w_{ij}^{L-2}} = \left( \epsilon \ast S_j^{L-3} \right)(t) \;.
\end{equation}
Hence, combining Eqs~\eqref{eq:grad_wh2_5} to \eqref{eq:grad_wh2_8} provides the gradient of the expected value of the hidden spike train in layer $L-1$:
\begin{align} \label{eq:grad_wh2_9}
&\frac{\partial \left\langle S_{j'}^{L-1}(t) \right\rangle_{S_{j'}^{L-1}|L-2, j'}}{\partial w_{ij}^{L-2}} \nonumber \\
&\quad= \frac{w_{j'i}^{L-1}}{\left(\Delta u\right)^2} \left\langle S_{j'}^{L-1}(t) \left( \epsilon \ast \left\langle S_i^{L-2} \left( \epsilon \ast S_j^{L-3} \right) \right\rangle_{S_i^{L-2}|L-3, i} \right)(t) \right\rangle_{S_{j'}^{L-1}|L-2, j'} \;.
\end{align}
As usual, we estimate the above expected gradient by sampling hidden spike trains on each simulation run. Therefore, dropping the expectation operators provides the gradient estimator:
\begin{equation} \label{eq:grad_wh2_10}
\frac{\partial \left\langle S_{j'}^{L-1}(t) \right\rangle_{S_{j'}^{L-1}|L-2, j'}}{\partial w_{ij}^{L-2}} \approx \frac{w_{j'i}^{L-1}}{\left(\Delta u\right)^2} S_{j'}^{L-1}(t) \left( \epsilon \ast \left[ S_i^{L-2} \left( \epsilon \ast S_j^{L-3} \right) \right] \right)(t) \;.
\end{equation}
Substituting the above into Eq~\eqref{eq:grad_wh2_3} yields the gradient of a neuron's membrane potential in the final layer:
\begin{equation} \label{eq:grad_wh2_11}
\frac{\partial u_{i'}^L(t)}{\partial w_{ij}^{L-2}}\bigg\rvert_{t = \tau_{i'}} = \frac{1}{\left(\Delta u\right)^2} \sum_{j' \in \Gamma_{i'}^L} w_{i'j'}^L w_{j'i}^{L-1} \left( \epsilon \ast \left[ S_{j'}^{L-1} \left( \epsilon \ast \left[ S_i^{L-2} \left( \epsilon \ast S_j^{L-3} \right) \right] \right) \right] \right)(\tau_{i'}) \;,
\end{equation}
Combining the above with Eqs~\eqref{eq:grad_wh2} and \eqref{eq:grad_wh2_2} gives rise to the weight update rule for the third-last layer:
\begin{equation} \label{eq:dw_L-2}
\Delta w_{ij}^{L-2} = -\frac{\eta}{\left(\Delta u\right)^2} \sum_{i' \in I'} \delta_{i'}^L \sum_{j' \in \Gamma_{i'}^L} w_{i'j'}^L w_{j'i}^{L-1} \left( \epsilon \ast \left[ S_{j'}^{L-1} \left( \epsilon \ast \left[ S_i^{L-2} \left( \epsilon \ast S_j^{L-3} \right) \right] \right) \right] \right)(\tau_{i'}) \;.
\end{equation}
The above weight update formula depends on chained convolution operations, deriving from the intermediate synaptic processes occuring between distant, upstream spiking events and downstream target activity. By following a similar approach to the above steps, hidden weight updates for deeper network architectures can also be derived sharing this pattern.
\section*{Acknowledgments}
This research has received funding from the European Union’s Horizon 2020
Framework Programme for Research and Innovation under the Specific Grant Agreement
No. 785907 (Human Brain Project SGA2).
\bibliographystyle{apacite}
| {'timestamp': '2020-08-18T02:18:23', 'yymm': '2008', 'arxiv_id': '2008.06937', 'language': 'en', 'url': 'https://arxiv.org/abs/2008.06937'} | arxiv |
\section{CONCLUSIONS}
\label{sec:con}
In this paper, we proposed to investigate the important problem of knowledge graph validation, which aims to detect errors by ranking all triplets in the knowledge graph according to their possibilities of being true. To tackle this problem, we proposed a novel framework that can leverage external knowledge graph and learn confidence aware knowledge graph embedding for error detection.
Under the proposed framework, existing approaches have shown significantly improved performance for knowledge graph validation task on datasets collected from both general and medical domains. Furthermore, we analyze the role of each component of proposed framework, explore the effects of hyperparameters, investigate the performance with different amount of external information and show the efficiency of the proposed framework. This was demonstrated in a series of experiments conducted on the real datasets.
\vspace{-0.2in}
\section*{Acknowledgment}
The authors would like to thank the anonymous referees for their valuable comments and helpful suggestions. This work is supported in part by the US National Science Foundation under grants NSF-IIS 1747614 and NSF-IIS 1553411. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.
\section{Experiments}
\label{sec:exp}
In this section, we first introduce the datasets used in the experiments, and then present the settings of the experiments, including baselines, evaluation measures and implementation details. Finally, we show the effectiveness of the proposed framework and qualitatively analyze the insights obtained from the experiments.
\subsection{Knowledge Graphs \& Datasets}\label{subsection:kg_d}
In this subsection, we first introduce the knowledge graphs in the medical and general domains. In each domain, there are two KGs: one of the KGs is the target KG, which is used for validation purpose and the other is the external KG which is used to provide auxiliary information.
\vspace{-0.05in}
\subsubsection{Medical Domain}
\label{sec:medical}
\textbf{1) Target KG.} KnowLife~\cite{ernst2015knowlife} is a huge medical knowledge repository. It is automatically constructed based on scientific literature, and thus may contain errors. Hence the KG KnowLife is used as the target KG for validation. We crawled from their public website\footnote{http://knowlife.mpi-inf.mpg.de/} and obtained a KG, including 656,607 entities, 25 relations and 2,005,369 triplets. \textbf{2) External KG.} SemMedDB~\cite{kilicoglu2011constructing} is a large-scale human-curated biomedical knowledge graph whose facts are more likely to be correct. Therefore, SemMedDB is used as the external knowledge graph to provide auxiliary validation information. The SemMedDB contains 154,216 entities, 63 relations and 1,804,054 triplets. Based on the target KG KnowLife and the external KG SemMedDB, we construct a dataset with synthetic errors for the validation of the proposed framework.
\smallskip
$\bullet$ \textbf{Dataset}. Given a positive triplet $(e_s, r, e_o)$ from KnowLife, we randomly corrupt either head or tail entity to form a negative triplet $(e_s^\prime, r, e_o)$ or $(e_s, r, e_o^\prime)$. More specifically, we randomly sample 1,250 observed triplets and denote the collection of these triplets as $\mathcal{L}$. Negative samples are generated correspondingly, and the set is denoted as $\mathcal{G}^-$. $\mathcal{G}^- \nsubseteq \text{KnowLife}$, and its size is also 1,250.
In this dataset, we treat observed triplets as positive and generated triplets $\mathcal{G}^-$ as negative, and the positive/negative labels are the groundtruth. When we use the proposed framework, 20\% of triplets randomly selected from $\mathcal{L}$ and $\mathcal{G}^-$ are used to select the best parameters, and the remaining 80\% of data are used for evaluation.
\subsubsection{General Domain}
\textbf{1) Target KG.} NELL~\cite{mitchell2018never} is a huge and growing knowledge graph, which is constructed by automatic information extraction approaches on unstructured content. Since the information extractors are imperfect, it is inevitable to extract noisy and incorrect information. Thus, we use NELL as the target KG for validation. We first select the entities that appear in at least 5 triplets. Following the similar setting of knowledge graph completion, the reverse relations of NELL are then removed. Moreover, we remove the triplets of relation ``generalizations'' that are ambiguous to verify and are dominating compared with the other relations. After these processing steps, we obtain the target KG, denoted as NELL-314, which contains 13,965 entities, 314 relations, and 148,001 triplets. \textbf{2) External KG.} YAGO~\cite{yago} is a large-scale knowledge graph constructed on semi-structured content, and its accuracy is estimated as 95\%\footnote{https://en.wikipedia.org/wiki/YAGO\_(database)}. Here, YAGO is used as the external knowledge graph to assist the validation on the target KG NELL-314. To preprocess YAGO, we first remove the relations without any overlapping entities with NELL-314, and then select the entities that appear in at least 5 triplets. This results in the external knowledge graph YAGO$_e$ with 242,281 entities, 27 relations, and 2,324,069 triplets.
$\bullet$ \textbf{Dataset}. \textbf{1) Human-annotated Labels.} To fairly evaluate the performance of the proposed framework, we manually label triplets that are randomly selected from the target KG NELL.
We first employ two participants to manually label each triplet (e.g., true/positive or false/negative) by cross-checking with the information presented on Wikipedia.
If the labels of a triplet provided by the two participants are different, then this triplet will be assigned to the third one for further investigation. Majority voting is applied to decide the final label of each triplet.
Following this procedure, we label 2,500 triplets, which is divided into two sets, i.e., the set of positive samples $\mathcal{L}^+$ and the set of negative samples $\mathcal{L}^-$. For both, the size is 1,250. Note that $\mathcal{L}^+, \mathcal{L}^- \subset \text{NELL}$. \textbf{2) Synthetic Dataset}.
We first construct a dataset with synthetic errors based on NELL, referred to as synthetic dataset.
We follow the same procedure used to generate synthetic errors for our datasets in medical domain as introduced in Section~\ref{sec:medical}. In this way, we generate a set of negative samples with size 1,250, denoted as $\mathcal{G}^-$. Then 20\% of the triplets randomly selected from $\mathcal{L}^+$ and $\mathcal{G}^-$ are used to select the best parameters, and the remaining 80\% of data are used for evaluation.
\textbf{3) Real Dataset}\footnote{Since there is no publicly available human labeled datasets for the knowledge graph validation task, we will release this dataset to encourage the future research on this important problem.} In addition to a dataset with synthetic errors, we also construct a dataset whose errors are real and annotated by human. In this real dataset, we do not synthesize any erroneous fact for NELL. We use $\mathcal{L}^+$ and $\mathcal{L}^-$ as the groundtruth positive and negative cases for evaluation. Similarly, 20\% of data randomly chosen from them are used for the selection of parameters, and 80\% for performance evaluation.
\vspace{-0.05in}
\subsection{Experiment Settings}
\emph{Baseline Approaches.}
We compare the proposed framework \textsf{CrossVal} with the state-of-the-art basic embedding models, including DistMult~\cite{yang2014embedding}, TransE~\cite{bordes2013translating}, ComplEx~\cite{trouillon2017knowledge}, Analogy~\cite{liu2017analogical} and SimplE~\cite{kazemi2018simple}. Moreover, we add CKRL~\cite{xie2018does}, which employs the score function of TransE and adds the confidence estimation of triplets learned from the internal structural information to its objective function, as a baseline. We also add a multi-KG embedding method PTransE~\cite{zhu2017iterative} as a baseline, whose score function is same as that of TransE. Note that multi-KG embedding method PTransE~\cite{zhu2017iterative} assumes that different KGs use the same ontology, and thus the method is not directly applicable to the setting of this paper. We remove the matching loss of PTransE on predicates and only keep matching loss on entities. All of these baseline methods use the target KG and the external KG for training purpose, and we further investigate their performance on the target KG only in Subsection~\ref{subsec: ab}. In this paper, we do not compare our proposed models with rule-based models because many triplets in the given test sets are not covered by the rules.
\emph{The Proposed Approaches.} The proposed framework \textsf{CrossVal} can be easily applied to the state-of-the-art KG embedding methods that are based on multiplicative score functions. Thus, we propose four enhanced models: \textsf{CrossVal}$_{Dist}$, \textsf{CrossVal}$_{Comp}$, \textsf{CrossVal}$_{Ana}$, and \textsf{CrossVal}$_{Simp}$ based on DistMult, ComplEx, Analogy and SimpIE embedding approaches, respectively. TransE, CKRL and PTransE are translational based models, and thus they are not applicable to the proposed framework.
\smallskip
$\bullet$ \textbf{Evaluation Measures.}
We use ranking measures to evaluate the performance of all the compared approaches. The ranks can be obtained according to the scores outputted by the models for the triplets in the KG. A smaller score for a triplet means the lower possibility of it being true. We rank all the triplets in the target KG according to their scores in ascending order. The top ranked triplets are more likely to be wrong. To fairly evaluate the performance of the KG validation, we use three evaluation measures: \textbf{Mean Rank}, \textbf{Precision@K}, \textbf{Recall}. To mathematically introduce the measures, we define the evaluation set as $D$, which consists of the positive triplet set $D^+$ and negative triplet set $D^-$. For the $i$-th triplet, the $rank_i$ represents its rank in the evaluation set $D$
\emph{Mean Rank.} We follow previous work~\cite{melo2017detection} to evaluate the KG validation. We use the \textit{Mean Raw Rank}, as well as its filtered variation, named \textit{Mean Filter Rank}, which filters out correctly higher ranked predictions.
The measures are defined as follows:
\begin{equation}
\small
\text{Mean Raw Rank} = \frac{1}{|D^-|} \sum_{i=1}^{|D^-|} rank_i,
\normalsize
\end{equation}
\vspace{-0.1in}
\begin{equation}
\small
\text{Mean Filtered Rank} = \frac{1}{|D^-|} \sum_{i=1}^{|D^-|} rank_i - i.
\normalsize
\end{equation}
When we calculate the \textit{Mean Filter Rank}, we first order the incorrect triplets by their ranks in ascending order. For instance, if the ranks of incorrect triplet set $D^-$ are $\{1,2,4,7\}$, then the filtered sequence of ranks is $\{0,0,1,3\}$, and its \textit{ Mean Filter Rank} is 1.
The smaller both \textit{Mean Raw Rank} and \textit{Mean Filter Rank} are, the better the performance is.
\emph{Recall of Ranking.} Considering that the number of verified incorrect triplets is known, the rank of the incorrect triplets can be thought as correct if its rank is in the range $[1,|D^-|]$. Towards this end, we propose a metric called \textit{Recall of Rank}, denoted as \textit{Recall}, which is equivalent to the Precision@$|D^-|$.
\begin{equation}
\small
\begin{aligned}
\text{Recall} = \frac{1}{|D^-|} \sum_{{i=1}}^{|D^-|} \mathbbm{1}_{[1,|D^-|]}~(rank_i).
\end{aligned}
\normalsize
\end{equation}
\smallskip
$\bullet$ \textbf{Implementation Details.}
We implement all the deep learning based baselines and the proposed framework with PyTorch 1.2. We use Nvidia Titan Xp GPU server and train our proposed framework using Adam~\cite{kingma2014adam} for optimization. We select the hyper-parameters following the same way used by \cite{zhao2019scef, transH, kazemi2018simple, liu2017analogical}. The overall learning rate for the proposed framework is selected among $\{0.0001, 0.0005, 0.001, 0.01\}$, which is fixed during the learning procedure. The embedding dimensionality is selected among $\{32, 64, 128, 256\}$, and the mini-batch size is selected among $\{64, 128, 256, 512, 1024\}$. We use the regularization term (i.e., l2 norm with the coefficient 0.001). The threshold $\theta$ is set to 0.5 and $\lambda$ is set to 1. The optimal configurations of the proposed approaches are optimized on the 20\% labeled evaluation set as described in Subsection~\ref{subsection:kg_d}.
\subsection{Performance Comparison}
\label{subsec:peformance}
Table~\ref{tab: medical} and \ref{tab: nell-341} show the performance of different approaches across different domains. We can observe that the proposed framework \textsf{CrossVal} achieves the best results in terms of all the evaluation metrics.
\subsubsection{Medical Domain}
As shown in Table~\ref{tab: medical}, on the medical datasets, Analogy achieves the best \emph{Recall} value among all the multiplicative embedding baselines. It is because Analogy explicitly models analogical structures in multi-relational embedding and is able to capture more information of KG. Compared with multiplicative embedding baselines, translational methods achieve relative lower recall values and precision values. The reason is that it is difficult for TransE (or CKRL, PTransE) to capture 1-to-N relationships~\cite{bordes2013translating} which widely exist in the medical KGs. To bridge two KGs, PTransE incorporates the alignment loss and achieves more than 3\% improvement on \textit{Recall} compared with TransE. Due to unavoidable extraction errors existing in the target KG, CKRL which is equipped with the confidence estimation procedure achieves a higher recall value compared with TransE and PTransE. Compared with these baselines, the proposed framework achieves improvement in terms of all the metrics. For example, CrossVal$_{Ana}$ achieves a recall value as high as 0.890, which is about 12.66\% improvement compared with that of Analogy.
\begin{table}[htb]
\vspace{-0.1in}
\centering
\caption{The performance comparison of different methods on the Medical KG datasets.}
\label{tab: medical}
\vspace{-0.1in}
\resizebox{0.9\linewidth}{!}{
\begin{tabular}{c|c|c|c|c|c|c|c}
\toprule
\multirow{2}{*}{Category}&\multirow{2}{*}{Method} & \multirow{2}{*}{Recall}&
\multicolumn{2}{c|}{Mean Rank}
&
\multicolumn{3}{c}{Precision@K} \\
\cline{4-8}
&&&Filter&Raw &
100 & 200 & 500\\
\midrule
\midrule
\multirow{4}{*}{Multiplicative}&\textsf{DistMult} & 0.765 & 140 & 638 & \textbf{1.000} & 0.990 & 0.960 \\
&\textsf{ComplEx} & 0.774 & 142 & 641 & \textbf{1.000} & 0.995 & 0.92 \\
&\textsf{Analogy} & 0.790 & 122 & 620 & \textbf{1.000} & 0.995 & 0.978 \\
&\textsf{SimplE} & 0.752 & 156 & 654 & \textbf{1.000} & 1.000 & 0.960 \\
\cline{1-8}
\multirow{3}{*}{Translational}&\textsf{TransE} & 0.704 & 237 & 735 & 0.990 & 0.940 & 0.838 \\
&\textsf{CKRL} & 0.751 & 184 & 682 & 0.990 & 0.955 & 0.880 \\
&\textsf{PTransE} & 0.729 & 198 & 696 & 0.980 & 0.965 & 0.874 \\
\cline{1-8}
\multirow{4}{*}{Proposed}&\textsf{CrossVal}$_{Dist}$ & 0.859 & 69 & 567 & \textbf{1.000} & \textbf{1.000} & 0.996 \\
&\textsf{CrossVal}$_{Comp}$ & 0.884 & 54 & 552 & \textbf{1.000} & \textbf{1.000} & \textbf{1.000} \\
&\textsf{CrossVal}$_{Ana}$ & \textbf{0.890} & \textbf{53} & \textbf{551} & \textbf{1.000} & \textbf{1.000} & 0.996 \\
&\textsf{CrossVal}$_{Simp}$ & 0.863 & 68 & 567 & \textbf{1.000} & \textbf{1.000} & 0.994 \\
\bottomrule
\end{tabular}
}
\vspace{-0.1in}
\end{table}
\subsubsection{General Domain}
\begin{table*}[htb]
\centering
\caption{The performance comparison of different methods in the Synthetic and Real settings on the NELL-314. }
\vspace{-0.1in}
\label{tab: nell-341}
\resizebox{0.75\textwidth}{!}{
\begin{tabular}{c|c|c|c|c|c|c|ccc|c|c|c|c|c}
\toprule
&&\multicolumn{6}{c}{Synthetic} && \multicolumn{6}{c}{Real}\\
\cline{3-8}
\cline{10-15}
\multirow{2}{*}{Category}&\multirow{2}{*}{Method} & \multirow{2}{*}{Recall}&
\multicolumn{2}{c|}{Mean Rank}
&
\multicolumn{3}{c}{Precision@K} && \multirow{2}{*}{Recall}&
\multicolumn{2}{c|}{Mean Rank}
&
\multicolumn{3}{c}{Precision@K}\\
\cline{4-8}
\cline{11-15}
&&&Filter&Raw &
100 & 200 & 500 &&&Filter&Raw & 100 & 200 & 500\\
\midrule
\midrule
\multirow{4}{*}{Multiplicative}&\textsf{DistMult} & 0.842 & 86 & 585 & 0.950 & 0.900 & 0.898 && 0.584 & 395 & 894 & 0.660 & 0.670 & 0.604 \\
&\textsf{ComplEx} & 0.871 & 78 & 577 & 0.950 & 0.895 & 0.878 && 0.570 & 403 & 902 & 0.690 & 0.680 & 0.598 \\
&\textsf{Analogy} & 0.862 & 78 & 576 & 0.940 & 0.905 & 0.902 && 0.587 & 376 & 874 & 0.680 & 0.650 & 0.600 \\
&\textsf{SimplE} & 0.879 & 48 & 547 & \textbf{1.000} & 0.995 & 0.984 && 0.591 & 380 & 879 & 0.680 & 0.700 & 0.596 \\
\cline{1-15}
\multirow{3}{*}{Translational}&\textsf{TransE} & 0.884 & 44 & 542 & 1.000 & 1.000 & 0.986 && 0.548 & 448 & 946 & 0.540 & 0.555 & 0.552 \\
&\textsf{CKRL} & 0.889 & 40 & 539 & \textbf{1.000} & \textbf{1.000} & 0.980 && 0.531 & 442 & 941 & 0.690 & 0.630 & 0.586 \\
&\textsf{PTransE}& 0.854 & 74 & 572 & \textbf{1.000} & \textbf{1.000} & 0.986 && 0.609 & 371 & 870 & 0.590 & 0.625 & 0.580\\
\cline{1-15}
\multirow{4}{*}{Proposed}&\textsf{CrossVal}$_{Dist}$ & \textbf{0.923} & 30 & 531 & \textbf{1.000} & \textbf{1.000} & 0.982 && 0.641 & 305 & 803 & 0.780 & 0.720 & \textbf{0.704} \\
&\textsf{CrossVal}$_{Comp}$ & 0.921 & \textbf{28} & \textbf{528} & \textbf{1.000} & 0.995 & \textbf{0.988} && 0.639 & 306 & 805 & 0.740 & 0.695 & 0.700 \\
&\textsf{CrossVal}$_{Ana}$ & \textbf{0.923} & 29 & 530 & 0.990 & 0.990 & 0.986 && \textbf{0.645} & 299 & 798 & \textbf{0.800} & \textbf{0.765} & \textbf{0.704} \\
&\textsf{CrossVal}$_{Simp}$ & 0.920 & 31 & 531 & \textbf{1.000} & 0.995 & 0.980 && 0.634 & \textbf{298} & \textbf{797} & \textbf{0.800} & 0.740 & 0.692 \\
\bottomrule
\end{tabular}
}
\vspace{-0.1in}
\end{table*}
\textbf{Synthetic Dataset}.
Compared with other KG embedding models, the \emph{Recall} value of DistMult is the lowest, as shown in Table~\ref{tab: nell-341}. It is because DisMult is based on simple multiplicative score function which cannot model the anti-symmetric relations.
Although CompIEx, Analogy and SimpIE are also multiplicative models, their performance is much better than that of DisMult. The reason is that they modify the score functions to model more complex relationships. Especially, the \textit{Recall} of SimpIE improves 4.4\% compared with that of DistMult.
Different from multiplicative based models, TransE and CKRL are translational methods, which use the additive score functions and employ the margin loss function to increase the margin between positive and negative samples.
Although the score function of TransE is very simple, its margin loss function is robust to noise, which leads to high \textit{Recall} of the model (i.e., 88.4\%).
PTransE and CKRL are built upon TransE. CKRL considers the confidence value estimation of triplets, which further improves the performance compared with TransE.
From all the baselines, we can observe that translational methods outperform multiplicative based models on the synthetic error detection. Though the proposed models \textsf{CrossVal}$_{Dist}$, \textsf{CrossVal}$_{Comp}$, \textsf{CrossVal}$_{Ana}$ and \textsf{CrossVal}$_{Simp}$ are multiplicative models, their performance is better than not only their basic models but also translational methods. The improvement is more than 4\% on \textit{Recall} and more than 30\% on \textit{Mean Filter Rank}.
\textbf{Real Dataset.} As observed from Table~\ref{tab: nell-341}, the \textit{Recall} of all the methods significantly decreases around 30\% compared with that on the synthetic dataset. The performance gap between two datasets demonstrates that the real errors are more difficult to be detected than synthetic ones.
The \textit{Recall} and \textit{Mean Rank} values of CKRL are the best among all the baselines on the synthetic dataset. However, on the real dataset, it achieves lowest \textit{Recall} values compared with other baselines. The reason is that CKRL estimates the confidence of triplets by the margin between observed triplets and generated errors. However, the real errors are difficult to tell and hence the scores of real errors are usually higher than those of the generated negative samples accordingly. Based on the mechanism of CKRL, the confidence of real errors will be increased and this further hurts the performance. Different from CKRL, the proposed framework only relies on the observed samples when conducting the confidence estimation. Thus, such mechanism leads to more accurate confidence estimation compared with CKRL's. Besides, the proposed framework \textsf{CrossVal} uses the cross-KG negative sampling to transfer information from YAGO$_e$ to NELL-314. Our framework \textsf{CrossVal} is general and its score function component can be replaced by any multiplicative score function. Thus, the framework can benefit from the improvements in the score functions and hence further improve its performance. As observed in Table~\ref{tab: nell-341}, the proposed models achieve significant improvement--more than 7\% on \textit{Recall} compared with their corresponding approaches on the real dataset.
\vspace{-0.1in}
\subsubsection{Comparison between Synthetic \& Real Data}
On the synthetic dataset, all the injected incorrect triplets are generated by corrupting head or tail of observed triplets. It means that corresponding correct samples are contained in the dataset. Thus, the correct information can guide the models to find incorrect triplets. As observed from Table~\ref{tab: nell-341}, all the approaches can achieve relatively good performance on the synthetic dataset.
However, on the real dataset, we do not have enough information for validating incorrect triples, which limits the models for spotting more errors. It can also be validated from Table~\ref{tab: nell-341} that the difference between synthetic and real errors further leads to a general 30\% gap in terms of \textit{Recall} between two datasets. This shows that the synthetic dataset may not include the key challenge of the KG validation task.
\begin{figure*}[htbp]
\centering
\begin{minipage}[t]{0.3\textwidth}
\centering
\includegraphics[width=1.6in]{./figs/external_data.eps}
\vspace{-0.1in}
\caption{The performance w.r.t. size of the external KG.}
\label{fig:external_data}
\end{minipage}
\hspace{0.1in}
\begin{minipage}[t]{0.3\textwidth}
\centering
\includegraphics[width=1.6in]{./figs/ratio.eps}
\vspace{-0.1in}
\caption{The performance w.r.t. different $\lambda$.}
\label{fig:lambda}
\end{minipage}
\hspace{0.1in}
\begin{minipage}[t]{0.3\textwidth}
\centering
\includegraphics[width=1.6in]{./figs/running_time}
\vspace{-0.1in}
\caption{ The validation time of CrossVal$_{Dist}$ w.r.t. \# triplets}
\label{fig:validation_time}
\end{minipage}
\vspace{-0.1in}
\end{figure*}
\vspace{-0.1in}
\subsection{Analysis of Real Errors}
To understand what kinds of incorrect triplets that the proposed framework is able to detect, we first check the detected incorrect triplets on the NELL official website\footnote{http://rtw.ml.cmu.edu/rtw/}, which provides the extract patterns and source links for the extracted triplets. We then roughly classify those errors into three categories: \textit{entity error}, \textit{relation error} and \textit{propagation error}. The entity errors usually occur during the procedure of named-entity recognition (NER). When the extracted entities are correct, the triplet still have a probability to be wrong, which stems from the incorrect relation between a pair of entities. This kind of errors is relation errors.
The propagation error refers to the knowledge reasoning errors originated from rules or other mechanisms. We conduct case studies using representative examples for each category of errors and provide the detailed reasons by analyzing the corresponding information sources of examples.
$\bullet$ \textbf{Entity Errors} (\emph{Fred\_Goodwin, ceoof, Scotland}). According to the definition of relations provided by the NELL official website, ``ceoof'' specifies that a particular person is the CEO of a particular company\footnote{http://rtw.ml.cmu.edu/rtw/kbbrowser/predmeta:ceoof}.
Therefore, this triplet means \emph{Fred Goodwin} is the CEO of \emph{Scotland}. We check the information source and find that the related textual statement is \textit{``Former Royal Bank of \underline{Scotland} boss \underline{Fred Goodwin} has had his knighthood removed.''}\footnote{https://www.bbc.com/news/uk-politics-16821650} The correct triplet based on this sentence should be (\emph{Fred\_Goodwin, ceoof, Royal\_Bank\_of\_ Scotland}). The algorithm mistakenly recognizes the object entity ``Royal Bank of Scotland'' as ``Scotland'' and this leads to a incorrect triplet. This kind of errors is very common in the current KG.
$\bullet$ \textbf{Relation Errors}
(\emph{two\_million\_people, isshorterthan, washington}). The meaning of ``isshorterthan'' indicates that object entity has a greater height than subject entity\footnote{http://rtw.ml.cmu.edu/rtw/kbbrowser/predmeta:isshorterthan}. Thus, this triplet means that the height of Washington is greater than that of two million people.
This triplet is extracted from the following news:
\textit{``\underline{WASHINGTON}, Dec 31 (Reuters) - Over \underline{two million people} have enrolled in health insurance plans through the federally run HealthCare.gov and state healthcare enrollment websites, a U.S. administration official said on Tuesday.''}\footnote{https://www.huffpost.com/entry/obamacare-signups\_n\_4524556}
The NER tool can correctly recognize the entities ``washington'' and ``two\_million\_people''. However, when extracting the relation between them, the algorithm considers that ``over'' is the key word, and mistakenly assigns the relation ``isshorterthan'' between them.
This type of errors is difficult to be detected using type constraints because the types of both ``washington'' and ``two\_million\_perople'' are the same: \emph{Person}. This triplet does not violate the constraints for the type ``isshorterthan''.
Since one entity usually has multiple correct entity types, how to correctly predict the type of the entity based on the specific context in the information source is very important for relation extraction task.
$\bullet$ \textbf{Propagation Errors} (\emph{two\_million\_people, isshorterthan, dc}) and (\emph{washington, istallerthan, two\_million\_people}).
We provide two representative examples to illustrate the propagation errors through entities and relations, respectively.
In the previous example, there is an incorrect triplet (\emph{two\_million\_people, isshorterthan, washington}). Since ``Washington'' is usually equivalent to ``DC'', the error is propagated by the extraction algorithm, which produces a new incorrect triplet (\emph{two\_million\_people, isshorterthan, dc}).
The second example shows the error caused by reasoning on relations. The relation ``istallerthan'' is the inverse relation of ``isshorterthan''. Thus, the triplets with the relation ``istallerthan'' can be created by exchanging the subject and object entities' orders of triplets with the relation ``isshorterthan''. In such a way, the error information can be propagated over the KG.
\subsection{Ablation Study}
\label{subsec: ab}
\textbf{Importance of External Information.}
In this study, we aim to analyze the performance changes of baseline methods incurred by incorporating an external knowledge graph. Note that we use conventional negative sampling instead of the proposed cross-KG negative sampling method to generate negative samples.
\begin{figure}[hbt]
\vspace{-0.2in}
\subfloat[Recall]{
\vspace{-0.2in}
\begin{minipage}{.21\textwidth}
\includegraphics[height=1.0in]{./figs/double_recall.eps}
\label{subfig:double_recall}
\end{minipage}}
\vspace{-0.1in}
\subfloat[Filter Mean Rank]{
\begin{minipage}{.22\textwidth}
\includegraphics[height=1.in]{./figs/double_rank.eps}
\label{subfig:double_rank}
\end{minipage}}
\caption{The performance comparison of methods on single and two knowledge graphs.}\label{fig:single_double}
\vspace{-0.1in}
\end{figure}
Fig.~\ref{fig:single_double} shows the \textit{Recall} and \textit{Filter Mean Rank} of all the baselines (except CKRL\footnote{The score function of CKRL is similar to that of TransE, and CKRL's performance is highly related to the tuning of hyper-parameters. Thus, we only show the performance of TransE as a representative in this experiment.}) when incorporating the external KG YAGO$_e$. ``Single'' denotes the KG embedding methods on the target KG NELL-314, and ``double'' represents that the embedding methods are learned on both YAGO$_e$ and NELL-314. We can observe that the \textit{Recall} and \textit{Mean Filter Rank} of every method improves when incorporating the external YAGO$_e$ . This again validates the importance of external information in the error detection.
\textbf{Importance of Confidence Estimation Component.}
The confidence estimation step not only helps the KG embedding methods to lower the influence of errors, but also filter out the incorrect samples to reduce the spread of the misinformation. To show the importance of confidence estimation component, we conduct ablation study on multiplicative embedding methods, including DistMult, ComplEx, Analogy and SimplE. We add the proposed confidence estimation component into all the four multiplicative embedding methods.
\begin{figure}[hbt]
\vspace{-0.1in}
\subfloat[Recall]{
\vspace{-0.1in}
\begin{minipage}{.21\textwidth}
\includegraphics[height=1in]{./figs/confidence_recall.eps}
\label{subfig:confidence_recall}
\end{minipage}}
\vspace{-0.1in}
\subfloat[Filter Mean Rank]{
\begin{minipage}{.23\textwidth}
\includegraphics[height=1in]{./figs/confidence_rank.eps}
\label{subfig:confidence_rank}
\end{minipage}}
\caption{The performance comparison of methods w/ and w/o confidence estimation.}\label{fig:confidence}
\vspace{-0.1in}
\end{figure}
Fig.~\ref{fig:confidence} shows the results in terms of \textit{Recall} and \textit{Filter Mean Rank}. In Fig.~\ref{fig:confidence}, ``w/ confidence'' means that we add confidence estimation component to the corresponding approaches, and ``w/o confidence'' denotes the original approaches. Take Fig.~\ref{subfig:confidence_recall} as an example, the \textit{Recall} of knowledge graph embedding methods ``w/ confidence'' is greater than that of the corresponding original approaches. We can conclude that incorporating confidence estimation component is essential and effective for the task of error detection.
\textbf{Discussion.} The performance boost of the proposed framework mainly comes from the incorporation of the external KG, the confidence estimation and cross-KG negative sampling procedure. Take DistMult as an example, the \textit{Recall} value of DistMult on NELL-314 is around 0.529. After incorporating the external KG via entity alignment and joint training, the \textit{Recall} value reaches 0.584. Adding confidence estimation component can improve the \textit{Recall} value to 0.604. The cross-negative sampling method can further improve the \textit{Recall} value from 0.604 to 0.641.
We can observe that \emph{joint training}, \emph{cross-negative sampling}, and \emph{confidence estimation} all contribute to the performance boost.
\vspace{-0.05in}
\subsection{Hyperparameter Analysis}
\label{experiment:second_loss}
\textbf{Weight $\lambda$.} We train the proposed framework using different weights $\lambda$ on the KG YAGO$_e$ and NELL-314. Fig.~\ref{fig:lambda} shows the \textit{Recall} changes of the proposed models with respect to different $\lambda$'s. When $\lambda$ is 0, the cross-KG negative sampling component is then removed from the proposed framework. We can observe that, without the cross-KG negative sampling methods, the proposed approaches cannot effectively take advantage of the information from the external KG. Thus, the recall values are lower compared with the corresponding proposed approaches with negative sampling component. After incorporating cross-KG negative sampling component, the proposed approaches achieve significant improvement in terms of \textit{Recall} values. Take \textsf{CrossVal}$_{Dist}$ as an example, when $\lambda$ is $1$, the performance of the model achieves around 10\% improvement compared with the model without cross-KG sampling component.
As observed from Fig.~\ref{fig:lambda}, the performance of the four approaches stay stable when $\lambda$ is larger than 0.1. This shows that the proposed framework is not very sensitive to the $\lambda$ value.
\textbf{Threshold $\theta$.} This threshold is used in the confidence estimation component to filter out samples with low confidence values. We train \textsf{CrossVal}$_{Dist}$ with the threshold values $0$, $0.3$, $0.5$ and $0.7$, and show the performance with respect to different $\theta$ values in Table~\ref{tab: threshold}. When $\theta$ is 0, \textsf{CrossVal}$_{Dist}$ can achieve the highest \textit{Recall} value among all the model variants but the lowest value on \textit{Precision@K}. As $\theta$ increases, the model can achieve higher value on \textit{Precision@K} but lower \textit{Recall} value. This may be because the model filters out more correct samples as the threshold value increases.
\begin{table}[htb]
\centering
\vspace{-0.1in}
\caption{The performance w.r.t. different threshold $\theta$ values.}
\vspace{-0.1in}
\label{tab: threshold}
\resizebox{0.7\linewidth}{!}{
\begin{tabular}{c|c|c|c|c|c|c}
\toprule
\multirow{2}{*}{$\theta$} & \multirow{2}{*}{Recall}&
\multicolumn{2}{c|}{Mean Rank}
&
\multicolumn{3}{c}{Precision@K} \\
\cline{3-7}
&&Filter&Raw &
100 & 200 & 500\\
\midrule
\midrule
0& \textbf{0.649} & 330 & 828 & 0.720 & 0.735 & 0.670 \\
0.3&0.643 & 330 & 828 & 0.770 & 0.755 & 0.668\\
0.5& 0.643 & \textbf{310}&\textbf{808}&\textbf{0.780}&\textbf{0.765}&\textbf{0.704} \\
0.7& 0.641 & 320 & 819 & 0.850 & 0.745 & 0.676\\
\bottomrule
\end{tabular}
\vspace{-0.1in}
}
\vspace{-0.1in}
\end{table}
\textbf{Number of negative samples.} The number of negative samples is also an important hyperparameter for knowledge graph embedding model training. We train \textsf{CrossVal}$_{Dist}$ with different numbers of negative samples (i.e., 1, 5 and 10). The results are shown in Table~\ref{tab: neg_ent}. We can observe that adding more negative samples can help improve the \textit{Precision@K} values especially \textit{Precision@100} and \textit{Precision@200}. When the number of negative samples is set to be 10, the \textit{Recall} value decreases compared with the \textsf{CrossVal}$_{Dist}$ using 5 negative samples.
\begin{table}[htb]
\centering
\caption{The performance comparison w.r.t different number of negative samples.}
\label{tab: neg_ent}
\resizebox{\linewidth}{!}{
\begin{tabular}{c|c|c|c|c|c|c}
\toprule
\multirow{2}{*}{\# of Negative Samples} & \multirow{2}{*}{Recall}&
\multicolumn{2}{c|}{Mean Rank}
&
\multicolumn{3}{c}{Precision@K} \\
\cline{3-7}
&&Filter&Raw &
100 & 200 & 500\\
\midrule
\midrule
1& 0.641 & 305 & 803 & 0.780 & 0.720 & 0.704 \\
5 & \textbf{0.662}& \textbf{297} & \textbf{795} & 0.820 & 0.745 & \textbf{0.708}\\
10 & 0.643 & 310&808&\textbf{0.840}&\textbf{0.765}&0.704 \\
\bottomrule
\end{tabular}
}
\vspace{-0.1in}
\end{table}
\subsection{Analysis of the External KG}
We conduct experiments to show the performance changes of the proposed framework when varying the size of the external KG and varying the number of overlapping entities between the external and target KGs.
We sample different numbers of triplets and sample different numbers of overlapping entities from the external KG for model training and report \textit{Recall} values of the proposed model \textsf{CrossVal}$_{Dist}$ on the real test dataset of NELL.
\textbf{Varying size of the external KG.} To clearly show the difference brought by the external KG, we use the \textit{Recall} value obtained from the baseline method \textsf{DistMult} that is trained on NELL-314 as the starting point. The triplet size of the incorporated external KG varies from 10,000 to 150,000. As can be seen in Fig.~\ref{fig:external_data}, only using 10k external triplets, the proposed model even achieves improvement around 10\% on \textit{Recall} compared with the baseline method \textsf{DistMult}. This demonstrates that the proposed framework is effective for KG validation even with a small external KG.
\textbf{Varying size of the overlapping entities.} Since overlapping entities play an important role in bridging two KGs, we vary the size of overlapping entities (30\%, 50\%, 70\% and 100\%) to explore its impacts and report the performance in Table~\ref{tab: overlap_entity}. We can observe that the performance is improved as the size of overlapping entities increases. Moreover, 50\% of overlapping entities can help model achieve a \textit{Recall} value of 0.613.
\begin{table}[htb]
\centering
\caption{The performance w.r.t. different percentages of the overlapping entities between NELL-314 and YAGO$_e$.}
\vspace{-0.1in}
\label{tab: overlap_entity}
\resizebox{\linewidth}{!}{
\begin{tabular}{c|c|c|c|c|c|c}
\toprule
\multirow{2}{*}{Percentage of Overlapping Entities} & \multirow{2}{*}{Recall}&
\multicolumn{2}{c|}{Mean Rank}
&
\multicolumn{3}{c}{Precision@K} \\
\cline{3-7}
&&Filter&Raw &
100 & 200 & 500\\
\midrule
\midrule
30\%& 0.513 & 493 & 992 & 0.660 & 0.635 & 0.552 \\
50\%& 0.613 & 358 & 856 & 0.740 & 0.685 & 0.660\\
70\%& 0.633 & 324&823&0.760&0.695&0.678 \\
100\%& \textbf{0.641} & \textbf{305} & \textbf{803} & \textbf{0.780} & \textbf{0.720} & \textbf{0.704} \\
\bottomrule
\end{tabular}
}
\vspace{-0.1in}
\end{table}
\vspace{-0.1in}
\subsection{Efficiency Evaluation}
\label{sec:efficiency}
The time complexity of the proposed framework is linear with respect to the number of the triplets. To clearly demonstrate this claim, we sample different numbers of triplets from the dataset to show the validation time of the proposed framework on a single GPU server. Take the proposed approach \textsf{CrossVal}$_{Dist}$ as an example. As shown in Fig.~\ref{fig:validation_time}, the proposed approach \textsf{CrossVal}$_{Dist}$ has linear time complexity with the number of triplets and validates 100k triplets with less than 0.4 seconds. Based on the observations from Fig.~\ref{fig:validation_time}, we can conclude that the proposed framework is efficient for large-scale KG validation.
\section{Introduction}
Recent advances in information extraction have motivated the automatic construction of huge Knowledge Graphs (KGs) from large-scale text corpus. Examples include KnlowledgeVault~\cite{dong2014knowledge}, NELL~\cite{mitchell2018never} and commercial projects~\cite{dong2018challenges,dong2020autoknow, gao2018building}. These KGs contain
millions or billions of relational facts in the form of \emph{subject-predicate-object}
(SPO) triplets, e.g., (\emph{albert\_einstein, marriedTo, mileva\_marici}), and thus they are the backbone for many downstream applications, including question answering~\cite{zheng2018question} and recommendation~\cite{ noia2016sprank}. However, there often exist noisy facts in those KGs, which are introduced by the information extraction methods~\cite{stepanova2018rule}. For example, the precision of NELL is estimated to be only around 50\% on some relations ~\cite{mitchell2018never}. The existence of such errors in KGs may significantly degrade the performance of downstream applications.
However, the magnitude of KGs does not allow for manual validation. Thus, there is an urgent need for the development of automatic yet effective knowledge graph validation algorithms.
Some automatic approaches~\cite{ortona2018rudik, tanon2019learning, paulheim2017knowledge, pujara2013knowledge} are proposed to validate the KGs by utilizing type constraints or mined rules.
Although these approaches can be used to validate a subset of triplets covered by type constraints or rules, there may exist many facts that are not covered by type constraints or rules but need validation.
An intuitive way to validate all the facts is to learn a function that maps each triplet, including the subject, relation, and object, to a low-dimensional feature vector space, which represents the semantic meaning of the given triplet. Using the learned function, the questionable facts can be inferred when the triplets do not satisfy the relationship in the new representation space.
We may adopt widely used knowledge graph embedding (i.e., representation learning) technique ~\cite{nickel2016review, wang2017knowledge} as the function to infer such representations that capture the semantic meanings of triplets. However, such methods are not suitable for the validation task. There is a strong assumption held by existing knowledge graph embedding methods, i.e., the observed triplets are all correct~\cite{bordes2013translating, yang2014embedding, balavzevic2019tucker}. Therefore, there is a high chance of overfitting if these approaches are directly applied to knowledge graphs that contain noisy facts. To address this issue, Xie et al.~\cite{xie2018does} propose a confidence-aware knowledge graph learning method, which estimates the confidence of observed triplets based on internal structure information and further detects errors in the KG. However, as discussed in~\cite{xie2018does}, it is very challenging to spot the errors without external validation information.
To conduct effective validation on the target KG, one valuable external source we can rely on is other human-curated knowledge graphs, referred to as external KGs, whose facts are more likely to be correct. Such KGs~\cite{yago, lehmann2015dbpedia} are typically built by extracting from the semi-structured content of Wikipedia pages. As human curation is involved in Wikipedia and the extraction from semi-structured content incurs less errors, these KGs usually have high precision. However, compared with KGs constructed from texts, in these KGs, it is not easy to include new knowledge or knowledge specific to a certain domain (such as medical domain) that are not in Wikipedia or other human-curated knowledge repositories. Leveraging these high-precision KGs for the validation of the target KG built upon text corpus is thus very helpful. In this way, we can improve the precision of a KG that is built by information extraction from texts, and thus can benefit many applications that need domain-specific or up-to-date knowledge that is only contained in texts. One intuitive approach~\cite{liu2017measuring} is to find matched triplets between the target KG and the external KGs, and correct the errors in these matched triplets. However, matched triplets are usually only a small portion of the triplets and thus this method is not useful for the validation of majority of the triplets.
In light of the aforementioned challenges, we propose a \underline{cross}-graph \underline{val}idation framework~(\textsf{CrossVal}), which can leverage an external KG for the task of automatic knowledge graph validation. Specifically, to facilitate the information transfer between the target KG and the external KG for validation, we propose a novel negative sampling method, which generates the negative triplets that consist of relations and entities from different KGs. More specifically, we generate informative negative triplets based on the mutually conflicting relations that exist in both KGs. The questionable facts in the target KG can be spotted by comparison with generated negative samples. By applying the proposed negative sampling method, an effective bridge over two graphs can be built.
In this way, we can not only validate matched triplets, but also borrow the information from the external KG to validate the majority of triplets that are not covered by the external KG. Moreover, many state-of-the-art KG embedding models can be plugged into the proposed framework for validation. We relax the assumption held by KG embedding methods and incorporate the confidence estimation component into model training to
alleviate the effect of misinformation during embedding.
In the end, we validate the proposed framework on KGs in both \emph{medical} and \emph{general} domains to show its applicability and effectiveness. More specifically, we evaluate our proposed framework on synthetic datasets, i.e., real KGs with synthetic errors, following the similar setting in the previous work~\cite{xie2018does, melo2017detection}. Experimental results show that the proposed framework outperforms the state-of-the-art approaches.
We also introduce a manually labeled dataset based on NELL KG and conduct extensive experiments on this real dataset. Experimental results show that: (1) Regarding error detection by all the methods, there exists a big gap in the performance on synthetic and real datasets. This big gap demonstrates the significant difference between synthetic and real errors. (2) Our proposed framework can generally improve the validation performance around 8\% on the \textit{Recall of Ranking metric} and over 20\% on the \textit{Filtered Mean Rank metric} compared with the state-of-the-art KG embedding methods on the real dataset. (3) Our proposed framework can conduct effective validation even with a small portion of external information. (4) The efficiency experiments demonstrate that our proposed framework can scale well to large-scale KGs. Finally, quantitative and qualitative experiments are conducted to further demonstrate the effectiveness of the proposed framework. We will publicly release the manually labeled dataset to the community to encourage further research on knowledge graph validation.
\section{Problem Formulation}
\section{Methodology}\label{sec:methodology}
In this section, we first define knowledge graph validation problem and then introduce how to leverage an auxiliary knowledge graph to validate the facts in the target KG.
\subsection{Overview}
\textbf{Knowledge Graph Validation.} The problem addressed in this paper is to validate knowledge triplets contained in a target knowledge graph. Following the previous
work~\cite{paulheim2017knowledge}, we define the knowledge graph validation as a \emph{ranking problem}, i.e., given a knowledge graph which may contain errors, the goal is to rank all the knowledge triplets according to their probabilities of being true.
Fig.~\ref{fig:framework} shows the proposed knowledge graph validation framework \textsf{CrossVal}, which leverages an external KG to estimate the probabilities of being true for all the triplets in the target KG.
There are three main components in the proposed framework: \emph{knowledge graph embedding}, \emph{cross-KG negative sampling}, and \emph{confidence estimation}.
The knowledge graph embedding framework can learn the semantic meanings of both entities and relations, which are valuable for error detection. To facilitate information transfer between the external KG and the target KG for validation,
we propose a cross-KG negative sampling method, which can be considered as an effective bridge to connect both graphs. Existing knowledge graph embedding approaches~\cite{yang2014embedding, trouillon2017knowledge, liu2017analogical} randomly generate negative samples. Instead, we propose to use the mutually conflicting relations existing in both graphs to create negative samples.
To validate the correctness of triplets, we further design a confidence estimation component, which aims to degrade the influence of misinformation by automatically learning an score for each triplet.
The proposed framework tightly integrates these three components that work jointly to enhance the validation performance.
In the following subsections, we first present the conventional knowledge graph embedding framework and its limitations for the validation task. Then we illustrate how to address these limitations and introduce the proposed cross-graph validation framework.
\begin{figure}[hbt]
\includegraphics[width=2.9in]{./figs/cikm_framework.eps}
\centering
\vspace{-0.1in}
\caption{The proposed framework \textsf{CrossVal}. Nodes represent entities, and edges represent existing relationships. }
\label{fig:framework}
\end{figure}
\subsection{Knowledge Graph Embedding}
\label{sec:kge}
Knowledge Graph embedding methods aim to project the entities and relations in a KG to low-dimensional dense vectors. To mathematically introduce the KG embedding methods, we represent the entities of the KG as $\mathcal{E}$ and the relations as $\mathcal{R}$. The KG can be represented as a set of triplets $(e_s, r, e_o)$ denoted as $S$, where $e_s, e_o \in \mathcal{E}$ denote subject and object entities respectively, and $r \in \mathcal{R}$ denotes the relation between them. For every triplet $ (e_s, r, e_o)$, the function $\phi$ of KG embedding models assigns a score, $\phi(e_s, r, e_o) \in \mathbb{R}$, indicating whether this triplet is true or not.
Most of knowledge graph embedding works~\cite{transH, yang2014embedding, bordes2013translating} follow the open world assumption (OWA), which states that KGs contain only true facts, and non-observed facts can be either false or just missing. To learn the embeddings of the given KG, it needs to generate negative samples based on the \textit{local-closed world assumption}~\cite{nickel2016review}, i.e., a KG is assumed to be locally complete. More specifically, if $(e_s, r, e_o)$ is a triplet in the given KG, the subject or object entity can be replaced by a random entity. In such a way, the negative triplet $(\cdot, r, e_o)$ or $(e_s, r, \cdot)$ is generated. If the generated negative samples do not exist in the original KG, they can be used as negative samples. The set of negative samples is denoted as $S^\prime$.
The objective function of knowledge graph embedding models can be formulated as a pairwise ranking loss:
\begin{equation*}
L =\sum_{s \in S} \sum_{s^\prime \in S^\prime} \max(\phi(s^\prime) -\phi(s) + \gamma,0),
\end{equation*}
which intends to minimize the confidence value margin between negative samples and positive samples. When the confidence values of negative values are lower than those of positive samples, the loss values are zero. Here $\gamma$ denotes the margin. The objective function can also be defined as the minimization of the logistic loss between the embedding and the label of a triplet:
$$
L =\sum_{s \in S \bigcup S^\prime} (1 + exp(-y_{s} \cdot \phi(s^\prime))),
$$
where $y_s = \pm 1$ is the label (i.e., positive or negative) of triplet $s$.
The assumption held by most KG embedding studies is that \emph{all of the observed triplets $S$ are correct}. However, this assumption may not hold in the real world because \textbf{no KG is really free from errors}. Therefore, to validate the KG, we propose a new framework, which takes the probability estimation of triplets into consideration.
Besides, to obtain more information for the validation, an external KG is incorporated.
The challenge of using another KG for validation is how to construct a bridge between the target and the external KG. Thus, we introduce our entity alignment procedure and cross-KG negative sampling method.
\vspace{-0.05in}
\subsection{Entity Alignment}
The goal of entity alignment is to discover overlapping entities that represent the same real-world entity in two knowledge graphs. Through this procedure, the bridge between two different KGs can be constructed. Before introducing entity alignment procedure, we first introduce notations and define the overlapping entity.
\textbf{Notations.} Let $G_1$ and $G_2$ represent two KGs. $G_1$ is the target graph for validation, and $G_2$ is the external KG that is used to provide validation information. The entity sets of two KGs are denoted as $\mathcal{E}^1$ and $\mathcal{E}^2$, and the relation sets are $\mathcal{R}^1$ and $\mathcal{R}^2$, respectively.
\begin{example}
Take $G_1$ as an example. In Fig.~\ref{fig:framework}, $\mathcal{E}^1$ = $\{$USA, Washington, Obama, Mexico City$\}$ and $\mathcal{R}^1$ = $\{$locatedat, livesin$\}$. Three observed triplets are (Mexico City, locatedat, USA), (Washington, locatedat, USA) and (Obama, livesin, Washington).
\end{example}
\begin{definition} [\textbf{Overlapping Entity}]
Given two entities $e^1 \in \mathcal{E}^1$ and $e^2 \in \mathcal{E}^2$, entities $e^1$ and $e^2$ are \emph{overlapping entities} if $e^1$ and $e^2$ represent the same real-world entity. The relationship of entities $e^1$ and $e^2$ can be denoted as $e^1 = e^2$.
\end{definition}
To align the overlapping entities in two KGs, we can take advantage of their name conventions. For example, in the medical KGs, they usually employ the Concept Unique Identifier (CUI) to represent the entities with the same meaning. In the general domain, the entities are represented as string expressions. We employ exact string matching algorithm on entity name conventions to align the overlapping entities existing in different KGs. Then we further take advantage of KG ontologies, which include the relations like \emph{acronyms} and \emph{known aliases}. Such relations usually indicate the same entities with different string expressions. Once overlapping entities are identified, we ensure that these aligned entities share the same embeddings because they refer to the same entities in the real world.
\subsection{Cross-KG Negative Sampling}\label{subsec:ckg}
In this subsection, we introduce the proposed cross-KG negative sampling method.
This method not only constructs an effective bridge between different KGs efficiently but also generates more informative negative samples compared with existing knowledge graph embedding models. Our proposed method is designed based on the negative relationship between relations from different KGs. The negative relationship indicates that two relations do not have any \emph{overlapping entity pair}. The definitions of \emph{overlapping entity pair} is provided as follows.
\vspace{-0.05in}
\begin{definition} [\textbf{Overlapping Entity Pair}]
Given two triplets $(e_s^1, r^1, e_o^1)$ and $(e_s^2, r^2, e_o^2)$ from different KGs, if $e_s^1 = e_s^2$ and $e_o^1 = e_o^2$, we define $(e_s^1, e_o^1)$ and $(e_s^2, e_o^2)$ as \emph{overlapping entity pair} for $r^1$ and $r^2$. The set of entity pair for $r^1$ and $r^2$ can be written as $O(r^1, r^2)$.
\end{definition}
\vspace{-0.1in}
\begin{example}\label{example:oec}
In Fig.~\ref{fig:framework}, (Washington, locatedat, USA) is in the target graph, and (Washington, locatedin, USA) is in the external graph. For the relations ``locatedat'' and ``locatedin'', they share the overlapping entities ``Washiongton'' and ``USA''. Thus, the overlapping entity pair of relations ``locatedat'' and ``locatedin'' is $\{(Washington, USA)\}$, i.e., $O(locatedat, locatedin)$ = \{(Washington, USA)\}.
\end{example}
\vspace{-0.05in}
According to the definition of overlapping entity pair, we can introduce the concept of cross-KG negative relation.
\vspace{-0.05in}
\begin{definition}[\textbf{Cross-KG Negative Relation}]
For two relations $r^1 \in \mathcal{R}^1, r^2 \in \mathcal{R}^2$, if they do not have any overlapping entity pair, i.e., $O(r^1, r^2) = \emptyset$, then the relations $r^1, r^2$ can be written as $r^1 \perp r^2$, which is denoted as cross-KG negative relation for each other.
\end{definition}
\vspace{-0.05in}
For a given relation $r_*^1 \in \mathcal{E}^1$, the cross-KG negative relation set $N(r_*^1)$ of $r_*^1$ can be represented as
$$
N(r_*^1) = \{r^2 | r^2 \perp r_*^1, r^2 \in \mathcal{E}^2\},
$$
and the cross-KG negative set $N(r_*^2)$ of the relation $r_*^2 \in \mathcal{E}^2$ can be represented as
$$
N(r_*^2) = \{r^1 | r^1 \perp r_*^2, r^1 \in \mathcal{E}^1\}.
$$
\begin{example}\label{example:negative_set}
Take the relation ``livesin'' in Fig.~\ref{fig:framework} as an example. The pair of entities on this relation is (Obama, Washington). This pair of entities does not satisfy any relation in the external graph. Thus, all the relations in the external graph are its cross-KG negative relations, i.e., $N(livesin) = \{locatedin, hasneighbor\}$. For the relation ``hasneighbor'' in the external graph, its cross-KG negative relation set is $N(livesin, locatedat)$.
\end{example}
Next, we present how to generate cross-KG negative samples over two KGs based on cross-KG negative relation sets. The cross-KG negative samples can be generated based on two strategies: \emph{relation replacement} and \emph{entity replacement}.
\begin{figure}[hbt]
\includegraphics[width=2.5in]{./figs/Cross-KG.eps}
\centering
\vspace{-0.1in}
\caption{A simple example of cross-KG negative sampling. The nodes and edges with orange color represent the target KG, and the blue colored ones denote the external KG. $\perp$ denotes the negative relationship between two relations.}
\label{fig:cross-kg}
\vspace{-0.2in}
\end{figure}
\begin{definition}[\textbf{Relation Replacement}]
Let $S_2$ represent the set of triplets in the external KG $G_2$. For a triplet $(e_s^2, r^2, e_o^2) \in S_2$, if we replace $r^2$ with any relation $r^1 \in N(r^2)$, the new triplet $(e_s^2, r^1, e_o^2)$ can be seen as a cross-KG negative sample. This new negative sample is made up of entities $e_s^2, e_o^2 \in \mathcal{E}^2$ and $r^1 \in \mathcal{R}^1$. $S^\prime_r$ is represented as the set of cross-KG negative samples generated by relation replacement.
\end{definition}
\vspace{-0.05in}
The intuition of relation replacement is that if a triplet $(e_s^2, r^2, e_o^2)$ is correct, but
$r^1$ and $r^2$ do not have any overlapping entity pair, i.e., no triplets can satisfy the relation $r^1, r^2$ at the same time, then the new triplet $(e_s^2, r^1, e_o^2)$ tends to be incorrect.
\vspace{-0.05in}
\begin{example}
As shown in Fig.~\ref{fig:cross-kg} and Example~\ref{example:negative_set}, since $hasneighbor \perp locatedat$, we can replace the relation ``hasneighbor'' between the entities ``Mexico'' and ``USA'' by the negative relation ``locatedat'' to obtain a negative sample (Mexico, locatedat, USA).
\end{example}
\vspace{-0.05in}
\begin{definition}[\textbf{Entity Replacement}]
Given a triplet $(e_s^2, r^2, e_o^2) \in S_2$ and $r^1 \in N(r^2)$, if we replace $(e_s^2, e_o^2)$ with any entity pair $(e_s^1, e_o^1)$ of triplets which satisfy $r^1$, the new triplet $(e_s^1, r^2, e_o^1)$ can be seen as a cross-KG negative sample.
\end{definition}
\begin{example}
Since (Washington, USA) satisfies the relation ``locatedat'' shown in Fig.~\ref{fig:cross-kg}, and $hasneighbor \perp locatedat$, instead of replacing the negative relation ``locatedat'', we can replace the entity pairs on the relation ``hasneighbor''. Thus, we have a new negative sample (Washington, hasneighbor, USA).
\end{example}
\vspace{-0.05in}
There may be many pairs of entities that satisfy the relation $r^1$. We only choose one pair of entities as the replacement by random sampling. The proposed cross-KG negative sampling efficiently transfers validation information from the external KG for the target KG validation.
It is worth noting that although many negative samples generated may not be semantically close, they are still very helpful for the embedding learning. The reason is that the proposed model needs to learn from easy cases (e.g., the negative relations ``hasneighbor'' and ``hasPresident'') to difficult cases (e.g., ``hasneighbor'' and ``locatedat''). Thus, a negative sample set including many easy cases is beneficial for model learning in the early stage. Difficult negative samples are more informative for models at the late stage.
\vspace{-0.05in}
\subsection{Validation Optimization Framework}
\label{subsec:vof}
The goal of the proposed validation framework is to estimate the probabilities of triplets being true for \emph{the target KG}. To achieve this goal, we incorporate the confidence estimation into the proposed framework to guide the model learning by assigning larger weights to correct samples and lowering the weights of incorrect samples.
\subsubsection{Confidence Estimation in the Target KG}
To estimate the confidence of observed triplets $S^1$ in the target KG, we propose to apply a non-linear function $\sigma(\cdot)$ (e.g., \textit{Sigmoid} function) to transform the score values from knowledge graph embedding to $[0, 1]$. This operation can be applied to any knowledge graph embedding with a \textbf{multiplicative based score function}.
Mathematically, the confidence of a triplet $ s_1 =(e^1_s, r^1, e^1_o)$ in the target KG can be measured by the output probability $P(s_1) = \sigma(\phi (s_1))$, where $\phi$ is the score function of a knowledge graph embedding model. The initial confidence scores can be set as 1 for all the triplets.
The probabilities of corrupted samples being incorrect should be greater than or equal to the probabilities of corresponding observed samples being correct. For conventional corrupted negative samples $s^\prime_1 \in S^\prime_1$, where $S^\prime_1$ represents the set of negative samples of the target $G_1$, we can analyze their probabilities based on two cases: If the observed sample $s_1$ is correct, then the corrupted negative sample $s^\prime_1$ should be incorrect following the locally closed world assumption; If the observed sample $s_1$ is incorrect, then the corrupted negative sample $s^\prime_1$ is still possibly incorrect.
Based on the aforementioned two cases, the probability of negative sample $s^\prime_1$ being incorrect is greater than or equal to the probability of corresponding observed sample $s_1$ being correct. Thus, we can use the lower bound confidence, i.e., the confidence of corresponding observed triplet $P(s_1)$, as the confidence of corrupted sample $s^\prime_1$ to decrease the influence of false positive samples.
To reduce the effect caused by the spread of misinformation during training, we introduce the confidence estimation component, denoted as $\pi(\cdot)$. The samples with low confidence usually indicate the noisy ones. Thus, $\pi(\cdot)$ takes $P(s_1)$ as the input and outputs $P(s_1)$ if $P(s_1)$ is greater than a threshold $\theta$; otherwise 0. The confidence estimation component $\pi(\cdot)$ can be written as:
\[
\pi(P(s_1)) =
\begin{cases}
P(s_1), & \quad \text{if } P(s_1)\geq \theta\\
0, & \quad \text{otherwise }
\end{cases}.
\]
We add the confidence estimation component $\pi(\cdot)$ into the loss function that derives the embedding for KG $G_1$. The loss function is defined as:
\begin{equation}
\small
\label{eq:ob1}
\begin{aligned}
L_{G_1} = - \sum_{s_1 \in S_1} \sum_{s_1^\prime \in S_1^\prime} \pi(P(s_1)) \left[ \log(P(s_1)) + \log(1- P(s_1^\prime)\right].
\end{aligned}
\end{equation}
The goal would be to obtain triplet embeddings such that the confidence of positive samples in $S_1$ is high while the confidence of negative samples in $S'_1$ is low. We incorporate the confidence estimation component $\pi(P(s_1))$ into the loss so that we rely more on the samples with high confidence to derive the embeddings.
Although the above loss function can incorporate the confidence values to decrease the influence of the misinformation, the errors in the target KG are still challenging to spot due to the limited information. To tackle this challenge, we need to incorporate an external KG to detect errors from the target KG.
\subsubsection{Cross-KG Negative Sampling}
To transfer information from the external KG to the target KG, we use the proposed cross-KG negative sampling method to generate cross-KG negative samples. To avoid incorporating false negative samples, the negative sample generation is only conducted based on the triplets from the external KG. In other words, given a triplet from the external KG, we use entity replacement and relation replacement strategies to generate cross-KG negative samples, which guarantee the information transfer between two KGs.
The generated cross-KG negative samples can be added to the representation learning framework following the similar strategy adopted by conventional negative sampling methods. The loss function that infers the embeddings of the external KG $G_2$ is defined as follows:
\begin{equation}
\small
\label{eq:ob2}
\begin{aligned}
L_{G_2} = & - \sum_{s_2 \in S_2}\Big[ \log(P(s_2)) + \sum_{s^\prime_2 \in S^\prime_2} \log(1-P(s^\prime_2)) \\
& + \sum_{s^\prime_e \in S^\prime_e} \log(1-P(s^\prime_e)) + \sum_{s^\prime_r \in S^\prime_r}\log(1-P(s^\prime_r)) \Big].
\end{aligned}
\vspace{-0.1in}
\end{equation}
For each triplet $s_2$, we generate its corresponding negative sample set $S'_e$ , $S'_r$ and $S'_2$. In Eq.~\ref{eq:ob2}, $S'_2$ denotes conventional negative samples, $S'_e$ denotes the negative samples generated from entity replacement, and $S'_r$ denotes the negative samples generated from relation replacement. Note that the confidence estimation component is only used on the \emph{target} graph which has errors to be detected.
\subsubsection{Objective Function}
Our ultimate goal is to validate the target KG by jointly learning over both target and external KGs. Thus, the final objective function is a combination of two parts:
\begin{equation}
\label{eq:final}
L_{final} = L_{G_1} + \lambda L_{G_2}.
\end{equation}
Here, $\lambda$ controls the balance between $L_{G_1}$ and $L_{G_2}$, and we simply set the value of $\lambda$ as 1. In practice, the proposed framework is not sensitive to this hyper-parameter, and we investigate the impact of $\lambda$ in Subsection~\ref{experiment:second_loss}.
\section{Related Work}
\label{sec:related_work}
In this section, we briefly review the work related to the proposed model.
The errors in the knowledge graph can negatively impact the related applications and knowledge acquisition~\cite{manago1987noise}. To tackle this problem, knowledge graph validation and other related tasks (e.g., error detection) recently attract wide attention~\cite{xie2018does, wang2020automatic, melo2017detection, tanon2019learning, wang2017discovering, paulheim2017knowledge, chu2016data}. Since the magnitude of current knowledge graphs does not allow for human curation, lots of researchers focus on automatic knowledge graph validation~\cite{nickel2016review, paulheim2017knowledge, tanon2019learning}. More specifically, related work includes numerical error detection~\cite{li2015probabilistic}, validation via triple query from external KGs~\cite{liu2017measuring}, fact validation via web-search~\cite{gerber2015defacto}, etc. However, most of the existing methods~\cite{lehmann2010ore, ma2014learning} do not scale well on large-scale KGs and may only cover triplets that have certain patterns. In ~\cite{ortona2018rudik}, the authors propose to detect errors based on the discovery of declarative rules over knowledge-bases. Though such a method can precisely detect errors, it can only validate a subset of triplets, which are covered by discovered rules. Melo et al.~\cite{melo2017detection} propose to detect error based on the hand-crafted path and type features. Although this approach can cover all the triplets, it can only detect errors that are captured by the hand-crafted features and complicated errors may escape the detection.
\begin{table}
\caption{Scoring functions of several state-of-the-art KG representation learning methods. $d_e$ is the dimensionality of entity embeddings. $\overline{\textbf{e}}_o \in \mathbb{C}^{d_e}$
is the complex conjugate of $\textbf{e}_o$ and $\operatorname{Re}(\cdot)$ means taking the real of a complex value. $h_{e_s}$, $t_{e_s}$ are the head and tail entity embedding of entity $e_s$. $M_r \in \mathbb{R}^{d_e \times d_e}$ is a linear mapping associated with the relation $r$. $\textbf{r}^{-1}$ represents the embedding relation $r^{-1}$ which is inverse relation of $r$. $\langle \cdot \rangle$ denotes the dot product operation. }
\vspace{-0.1in}
\label{tab: embedding}
\centering
\resizebox{\linewidth}{!}{
\begin{tabular}{c|c|c|c}
\toprule
Method& Score Function & Relation Parameters &Type \\
\midrule
\midrule
TransE~\cite{bordes2013translating} & $-|| \textbf{e}_s + \textbf{r} - \textbf{e}_o||_{1/2}$& $\textbf{r} \in \mathbb{R}^{d_e}$ & Translational \\
DistMult~\cite{yang2014embedding} &$\langle \textbf{e}_s,\textbf{r},\textbf{e}_o \rangle$&$\textbf{r} \in \mathbb{R}^{d_e}$ & Multiplicative \\
ComplEx~\cite{trouillon2017knowledge} &$\operatorname{Re}(\langle \textbf{e}_s,\textbf{r},\overline{\textbf{e}}_o \rangle)$&$\textbf{r} \in \mathbb{C}^{d_e}$ & Multiplicative \\
Analogy~\cite{liu2017analogical} &$\textbf{e}_s^T M_r \textbf{e}_s$&$M_r \in \mathbb{R}^{d_e \times d_e}$ & Multiplicative \\
SimplE~\cite{kazemi2018simple} &$\frac{1}{2}(\langle \textbf{h}_{e_s},\textbf{r},\textbf{t}_{e_o} \rangle + \langle \textbf{h}_{e_o},\textbf{r}^{-1},\textbf{t}_{e_s} \rangle))$ &$\textbf{r} \in \mathbb{R}^{d_e}$& Multiplicative \\
\bottomrule
\end{tabular}
}
\vspace{-0.25in}
\end{table}
Knowledge graph representation learning, which aims to learn the semantic meaning of entities and relations, have received lots of attention recently~\cite{nickel2016review, wang2017knowledge}. The knowledge graph embedding methods can be broadly summarized into two types based on the type of score function they adopt: translational and multiplicative approaches. The translational approaches~\cite{ lin2015learning, ji2015knowledge} define additive score functions over embeddings and the multiplicative approaches~\cite{yang2014embedding, trouillon2017knowledge, liu2017analogical, kazemi2018simple} define product-based score functions over embeddings.
We list the score function, relation parameters and corresponding types of several state-of-the-art knowledge graph embedding methods in Table~\ref{tab: embedding}. Due to strong assumption on the correctness of observed triplets, most of the existing graph embedding frameworks cannot be directly applied to knowledge graph validation task. To tackle this limitation, the confidence aware knowledge graph embedding methods~\cite{xie2018does, zhao2019scef} are proposed to detect errors in the knowledge graph. Different from existing work, we leverage information from external KGs for large scale KG validation purpose. To leverage external KG for validation, we propose a novel cross-graph representation learning framework which can effectively coordinate with state-of-the-art multiplicative KG embedding methods.
| {'timestamp': '2020-08-18T02:20:31', 'yymm': '2008', 'arxiv_id': '2008.06995', 'language': 'en', 'url': 'https://arxiv.org/abs/2008.06995'} | arxiv |
\section{Introduction}
In this paper we introduce Bardo Composer, or Composer for short, a system for generating
musical pieces that match the emotion of
stories told in tabletop role-playing games (TRPGs). For example, if the players are fighting a
dragon, Composer should generate a piece matching such an epic moment of the story. TRPG players often manually choose songs to play as background music to enhance their experience~\cite{bergstrom2014case}. Our goal is to develop an intelligent system that augments the players' experience with soundtracks that match the story being told in the game.
Importantly, the system should allow players to concentrate on the role-playing part of the game, and not on the disruptive task of selecting the next music piece to be played.
The object of our research is Dungeons and Dragons (D\&D), a TRPG where players interpret characters of a story conducted by a special player called the dungeon master.
\citeauthor{padovani2017}~\shortcite{padovani2017,padovaniFL19} introduced Bardo, a system that automatically selects the background music of a D\&D session based on the story being told by the players. This paper builds upon their system. Bardo uses a speech recognition system to transcribe voice into text, which is then classified into an emotion. Bardo then selects a song of the classified emotion from a library of labeled songs. In this work we extend Bardo to include a neural model for generating musical pieces conveying the emotions detected in the game story, instead of selecting a song from a labeled library---thus the name Bardo Composer.
We expect that by generating pieces we can capture the exact emotional tone of the story, while methods that select from a set of pre-composed pieces have a more limited ``emotional palette''.
Language models (LMs) are able to generate coherent music pieces~\cite{ferreira_2019}. However, it is still
challenging
to generate music with a given emotion.
For that we introduce Stochastic Bi-Objective Beam Search (\texttt{SBBS}), a variant of Stochastic Beam Search \cite{poole2010artificial} to guide the generative process while maximizing the probability given by a LM jointly with the probability of pieces matching an emotion.
The emotion in the story is detected by a
BERT model \cite{devlin2018bert} and is given
as input to \texttt{SBBS}, which uses a GPT-2 model \cite{radford2019language} to classify the emotion of
the generated pieces.
We evaluated Composer on the Call of the Wild (CotW) dataset~\cite{padovani2017}, which is a campaign of D\&D available on YouTube. Since our primary goal is to generate music pieces conveying the current emotion of the game's story, we used Composer to generate pieces of parts of CotW that featured a transition in the story's emotion. Then, in a user study with 116 participants, we evaluated whether people correctly perceive the intended emotions in pieces generated by Composer.
We also measured if the participants were able to distinguish the emotion of human-composed pieces by using Bardo's original system as a baseline. Our results show that the participants were able to identify the emotions in generated pieces as accurately as they were able to identify emotions in human-composed pieces. This is an important result towards the goal of a fully-automated music composition system for TRPGs.
\section{Related Work}
Our work is mostly related to machine learning models that generate music with a given emotion. For example,
\citeauthor{monteith2010automatic}~\shortcite{monteith2010automatic}
trained Hidden Markov models to generate music from a corpus labeled
according to a categorical model of emotion. These models are trained for
each emotion to generate melodies and underlying harmonies.
Ferreira and Whitehead \shortcite{ferreira_2019} used a genetic algorithm to fine-tune a pre-trained LSTM,
controlling the LSTM to generate either positive or negative pieces.
Our work differs from \citeauthor{monteith2010automatic}'s because we train a single LM
that is controlled to generate music with different emotions. It is also different
from \cite{ferreira_2019} once we control
the LM at sampling time and not at training
time.
Our work is also related to rule-based systems that map musical features
to a given emotion \cite{williams2015investigating}.
For example, \citeauthor{williams2015dynamic}~\shortcite{williams2015dynamic} generate
soundtracks for video games using a rule-based system to transform pre-generated melodies,
matching the emotion of annotated game scenes.
\citeauthor{davis2014generating}~\shortcite{davis2014generating}
follow a similar approach in TransPose, a system that generates piano melodies
for novels.
Our work differs from these rule-based systems because we learn mappings from musical features to emotion directly from data.
Our work is also related
to neural models that generate text with a given characteristic.
For example, CTRL \cite{keskar2019ctrl} is a
Transformer LM trained to generate text conditioned on
special tokens that inform the LM about the characteristics of the text to be generated (e.g., style).
Our work differs
from CTRL because we control the LM with
a search procedure and not with an extra input to the LM. Conditioning the LM requires a large amount of labeled data, which is expensive
in our domain.
The Plug and Play LM
\cite{dathathri2019plug} combines a pre-trained LM
with a small attribute classifier to guide text generation.
Although both Composer and the Plug and Play LM control the generation procedure at sampling time, we use search as a means of generation control while Plug and Play LM uses a classifier to alter the structure of the model.
\citeauthor{vijayakumar2018diverse}~\shortcite{vijayakumar2018diverse} and \citeauthor{Kool2019SBS}~\shortcite{Kool2019SBS} proposed variations of Beam search
to solve the problem of generating repetitive sentences.
Our work differs from both these works because our variation of Beam search optimizes for two independent objectives.
\section{Background}
\vspace{0.05in}
\noindent
\textbf{Symbolic Music Composition} Symbolic music is typically generated by sampling from a LM that computes the likelihood of the next musical symbols (e.g., note) in a piece. Typically,
the LM is defined as a neural network and the symbols are extracted from MIDI or piano roll representations of music ~\cite{briot2017deep}. Let $x = [x_0, \cdots, x_{t-2}, x_{t-1}]$ be the first $t$ symbols of a piece and $P(x_t|{x_0, \cdots, x_{t-2}, x_{t-1}})$ be the probability of the next symbol being $x_t$, according to a trained LM. One can sample the next symbol of the sequence according to the probability distribution $P$~\cite{briot2017deep}. We denote the trained language
model as $L$ and $L(x)$ is a function that returns the next symbol given a sequence $x$.
To generate a piece with $L$, one
provides as input a sequence of symbols $x = [x_0, x_1, \cdots, x_t]$ to bias the generation process.
This input sequence
is fed into $L$ which computes $L(x) = x_{t + 1}$.
Next, $x_{t + 1}$ is concatenated with $x$ and the process
repeats until a special end-of-piece symbol is found or
a given number of symbols are generated.
\vspace{0.05in}
\noindent
\textbf{Bardo} \citeauthor{padovani2017}~\shortcite{padovani2017,padovaniFL19} presented Bardo, a system to select background music for tabletop games. Bardo classifies sentences produced by a speech recognition system into one of the
four story emotions: Happy, Calm, Agitated, and Suspenseful. Bardo then selects a song from a
library of songs corresponding to the classified emotion.
The selected song is then played as background
music at the game table.
In this paper we use Padovani et al.'s dataset to train an emotion classifier for the story being told at a game session. Their dataset includes 9 episodes of CotW, which contains 5,892 sentences and 45,247 words, resulting in 4 hours, 39 minutes, and 24 seconds of gameplay. There are 2,005 Agitated, 2,493 Suspenseful, 38 Happy, and 1,356 Calm sentences in the dataset.
\vspace{0.05in}
\noindent
\textbf{Valence-Arousal Model of Emotion} We use a two-dimensional emotion model that generalizes the emotion model used in Bardo.
We consider the dimensions of valence and arousal, denoted by a pair $(v,a)$, where $v \in [0, 1]$
and $a \in [0, 1]$~\cite{russell1980circumplex}.
Valence measures sentiment and thus $v = 0$ means a negative input and $v = 1$ means a positive input. Arousal measures the
energy of the input and thus $a = 0$ means that the input has low energy whereas $a = 1$ means that the input has high energy. We use this model for classifying both the emotion of the player's speeches and the emotion of the generated music.
\section{Bardo Composer: System Description}
\begin{algorithm}[t]
\caption{Bardo Composer}
\label{alg:bardo}
\begin{algorithmic}[1]
\REQUIRE Speech recognition system $S$, Text emotion classifier $E_s$, Music emotion classifier $E_m$, LM $L$, speech signal $v$, previously composed symbols $x$, beam size $b$, number of symbols $k$
\ENSURE Music piece $x$
\STATE $s, l \gets S(v)$ \label{line:voice2text}
\STATE $v, a \gets E_s(s)$ \label{line:emotion_classification}
\STATE $y \gets$ \texttt{SBBS}$(L, E_m, x, v, a, b, k, l)$ \# \emph{see Algorithm~\ref{alg:sbs}} \label{line:sbs}
\RETURN $x \cup y$ \label{line:generation2}
\end{algorithmic}
\end{algorithm}
A general overview of Composer is shown in Algorithm~\ref{alg:bardo}. It receives as input a speech recognition system $S$, an emotion classifier for text $E_s$, an emotion classifier for music $E_m$, a LM for symbolic music generation $L$, a speech signal $v$ with the last sentences spoken by the players, and a sequence $x$ of musical symbols composed in previous calls to Composer. The algorithm also receives parameters $b$ and $k$, which are used in the search procedure described in Algorithm
~\ref{alg:sbs}. Composer returns a symbolic piece that tries to match the emotion in the players' speeches.
Composer starts by converting the speech signal $v$ into text $s$ with $S$ (line~\ref{line:voice2text}). In addition to text, $S$ returns the duration of the signal $v$ in seconds, this is stored in $l$. Then, Composer classifies the emotion of $s$ in terms of valence $v$ and arousal $a$ and it
invokes our Stochastic Bi-Objective Beam Search (\texttt{SBBS}) to generate a sequence of symbols $y$ that matches the desired length $l$ and emotion with arousal $a$ and valence $v$.
\texttt{SBBS} receives as input the models $L$ and $E_m$, the current sequence $x$, the desired emotion values $v$ and $a$, \texttt{SBBS}'s parameter values $b$ and $k$, which are explained below, and the desired length $l$ of the piece to be generated.
In the first call to Composer, the sequence $x$
is initialized with the the symbols of the first 4 timesteps of a random human-composed piece with the emotion $v, a$, as returned by $E_s$.
Every time
there is a transition from one emotion to another, we reinitialize the sequence $x$ using the same process. This is used to bias the generative process and to emphasize emotion transitions.
To be used in real-time, Composer is invoked with the most recently captured speech signal $v$ and returns a composed piece of music. While the most recent piece is being played at the game table, Composer receives another signal $v$ and composes the next excerpt. One also needs to define the length of the signal $v$. In our implementation, similar to Padovani et al.~\shortcite{padovani2017}, we use YouTube's subtitle system as the speech recognition system $S$. Therefore, signals $v$ are long enough to form a
subtitle.
\subsection{Classifying the Story's Emotion}
In order to have a common model of emotion between stories and music,
we use a mapping from Bardo's four emotion model to the valence-arousal model. Namely, we have Suspenseful mapping to low valence and arousal $(v = 0, a = 0)$; Agitated to low valence and high arousal $(v = 0, a = 1)$; Calm to high valence and low arousal $(v = 1, a = 0)$; and Happy to high valence and arousal $(v = 1, a = 1)$.
For example, in the context of the game Dungeons and Dragons, the sentence ``Roll initiative'' is normally said
at the beginning of battles and it can be considered $(v = 0, a = 1)$, once a battle
is a negative (dangerous) moment with high energy. ``Roll initiative'' is normally classified as Agitated in Padovani et al.'s dataset. This mapping allows us to use the valence-arousal model with the labeled CotW dataset.
The valence-arousal mapping is based on the model used to annotate the VGMIDI dataset. When human subjects annotated that dataset, they used a continuous valence/arousal model with labels defining a fixed set of discrete basic emotions (e.g. happy or sad) \cite{ferreira_2019}.
Given the limited amount of TRPG stories labeled according
to emotion (there are only 5,892 sentences in the CotW dataset), we use a transfer learning
approach to classify
the sentences~\cite{Radford2018}. We fine-tune a high-capacity BERT architecture with the CotW dataset \cite{devlin2018bert}. We use BERT because it outperforms
several other transformers across different NLP tasks \cite{devlin2018bert}.
Although in Algorithm~\ref{alg:bardo} we depict the classifier for story emotions as a single $E_s$ model,
in our implementation we treat valence and arousal independently, thus we
fine-tune a pre-trained BERT for each dimension.
\subsection{Classifying the Music's Emotion}
As was the case with the TRPG stories, given the limited amount of MIDI pieces
labeled according to emotion, we also apply a transfer
learning approach to classify emotion in music ($E_m$).
However, different than the $E_s$ model
where we fine-tune a BERT architecture, for $E_m$ we fine-tune a GPT-2 architecture~\cite{radford2019language}.
We use GPT-2 for $E_m$ because it is better suited for sequence generation than BERT.
Similarly to $E_s$, model $E_m$ also treats valence and arousal independently.
Thus, we fine-tune a pre-trained GPT-2 for each of these
dimensions.
To the best of our knowledge, in the symbolic music domain, there are no publicly available high-capacity LM pre-trained with large (general) datasets. Typically, models in this domain are trained with relatively small and specific datasets. For example, the MAESTRO dataset \cite{hawthorne2018enabling}, the Bach Chorales \cite{hadjeres2017deepbach} and the VGMIDI \cite{ferreira_2019} dataset. We pre-train a general high-capacity GPT-2 architecture as a language model ~\cite{radford2019language} using a new dataset we created called ADL (Augmented Design Lab) Piano MIDI dataset \footnote{https://github.com/lucasnfe/adl-piano-midi}.
The ADL Piano MIDI dataset is based on the Lakh MIDI dataset \cite{raffel2016learning}, which, to the best of our knowledge,
is the largest MIDI dataset publicly available. The Lakh MIDI dataset contains a collection of 45,129 unique MIDI files that
have been matched to entries in the Million Song dataset~\cite{bertin2011million}. Among these files, there are many versions of the same piece. We kept only one version of each piece. Given that the datasets for emotion classification in music are limited to piano only, we extracted from the Lakh MIDI dataset only the tracks with instruments from the ``piano family''(MIDI program numbers 1-8 in the dataset).
This process generated a total of 9,021 unique piano MIDI files. These files are mainly Rock and Classical pieces, so to increase the genre diversity (e.g. Jazz, Blues, and Latin) of the dataset, we
included an additional 2,065 files scraped from public sources on the Internet\footnote{\url{https://bushgrafts.com/midi/} and \url{http://midkar.com/jazz/}}. All files in the final collection were de-duped according to their MD5 checksum. The final dataset has 11,086 pieces.
After pre-training the high-capacity GPT-2 model, we
fine-tune two independent models (one for valence and one for arousal) with an extended version of the VGMIDI dataset~\cite{ferreira_2019}.
We extended the VGMIDI dataset from 95 to 200 labeled pieces using the same annotation method of the original dataset.
All the 200 pieces are piano arrangements of video game soundtracks labeled according to the valence-arousal model of emotion.
\subsubsection{Encoding}
We encode a MIDI file by parsing all notes from the
\texttt{NOTE\_ON} and \texttt{NOTE\_OFF}
events in the MIDI. We define a note as a set $z = (z_p, z_s, z_d, z_v)$,
where $\{z_p \in \mathbb{Z} \vert 0 \leq z_p < 128 \}$ is the
pitch number, $\{z_s \in \mathbb{Z} \vert z_s \geq 0 \}$ is the note starting time
in timesteps, $\{z_d \in \mathbb{Z} \vert 0 \leq z_d \leq 56\}$ is note duration
in timesteps and $\{z_v \in \mathbb{Z} \vert 0 \leq z_v < 128 \}$ is the
note velocity.
Given a MIDI \texttt{NOTE\_ON} event, we parse a note $z$ by retrieving
the starting time $z_s$ (in seconds), the pitch number $z_p$ and
the velocity $z_v$ from that event. To calculate the note duration
$z_d$, we find the correspondent \texttt{NOTE\_OFF} event of the given \texttt{NOTE\_ON}
and retrieve the \texttt{NOTE\_OFF} end time $z_e$ (in seconds). We discretize
$z_s$ and $z_e$ to compute the note duration $z_d = t \cdot z_e - t \cdot z_s$ in timesteps,
where $t$ is a parameter defining the sampling frequency of the timesteps.
We derive a sequence $x = \{z_v^1, z_{d}^1, z_{p}^1, \cdots, z_v^n,
z_{d}^n, z_p^n\}$ of tokens for a given MIDI file by (a)
parsing all notes $z^i$ from the file, (b) sorting them by
starting time $z_s^j$ and (c) concatenating their velocity $z_v^j$,
duration $z_d^j$ and pitch $z_p^j$. We add two special tokens
\texttt{TS} and \texttt{END} in the sequence $x$, to mark
the end of a timestep and the end of a piece, respectively.
This encoding yields a vocabulary $V$ of size $|V| = 314$.
\subsection{Stochastic Bi-Objective Beam Search}
Next, we describe how one can use a LM and a music emotion classifier to bias the process of music generation to match a particular emotion (line~\ref{line:sbs} of Algorithm~\ref{alg:bardo}). For that we introduce Stochastic Bi-Objective Beam Search (\texttt{SBBS}), a search algorithm guided by the LM $L$ and the music emotion classifiers, denoted as $E_{m, v}$ and $E_{m, a}$, for valence and arousal. The goal of \texttt{SBBS} is to allow for the generation of pieces that sound ``good'' (i.e., have high probability value according to the trained LM), but that also match the current emotion of the story being told by the players.
We call \texttt{SBBS} ``stochastic'' because it samples from a distribution instead of greedily selecting the best sequences of symbols, as a regular beam search does. The stochasticity of \texttt{SBBS} allows it to generate a large variety of musical pieces for the same values of $v$ and $a$. We
also call it ``bi-objective'' because it optimizes for realism and emotion.
The pseudocode of \texttt{SBBS} is shown in Algorithm~\ref{alg:sbs}. In the pseudocode we use letters $x, y$ and $m$ to denote sequences of musical symbols. Function $p_L(y) = \prod_{y_t \in y} P(y_t|y_0, \cdots, y_{t-1})$ is the probability of sequence $y$ according to the LM $L$; a high value of $p_L(y)$ means that $y$ is recognized as a piece of
``good quality'' by $L$. We denote as $l(y)$ the duration in seconds of piece $y$. Finally, we write $x[i:j]$ for $j \geq i$ to denote the subsequence of $x$ starting at index $i$ and finishing at index $j$.
\begin{algorithm}[t]
\caption{Stochastic Bi-Objective Beam Search}
\label{alg:sbs}
\begin{algorithmic}[1]
\REQUIRE Music emotion classifier $E_m$, LM $L$, previously composed symbols $x$, valence and arousal values $v$ and $a$, number $k$ of symbols to consider, beam size $b$, length $l$ in seconds of the generated piece.
\ENSURE Sequence of symbols of $l$ seconds.
\STATE $B \gets [x]$, $j \gets 0$ \label{line:sbs:init}
\WHILE{$l(y[t:t+j]) < l$, $\forall y \in B$} \label{line:sbs:stopping_condition}
\STATE $C \gets \{\}$ \label{line:sbs:init_while}
\FORALL{$m \in B$}
\STATE $C_m \gets \{m \cup s \vert s \in V\}$ \label{line:sbs:children}
\STATE $C_m \gets k$ elements $y$ from $C_m$ with largest $p_L(y)$ \label{line:sbs:pruning_model}
\STATE $C \gets C \cup C_i$ \label{line:sbs:total_children}
\ENDFOR
\STATE $B \gets b$ sequences $y$ sampled from $C$ proportionally to $p_L(y) (1 - |v - E_{m,v}(y)|) (1 - |a - E_{m,a}(y)|)$ \label{line:sbs:sample_next_beam}
\STATE $j \gets j + 1$ \label{line:sbs:end_while}
\ENDWHILE
\RETURN $m \in B$ such that $p_L(m) = \max_{y \in B}p_L(y)$ and $l(y[t: t+j]) \geq l$ \label{line:sbs:return}
\end{algorithmic}
\end{algorithm}
\texttt{SBBS} initializes the beam structure $B$ with the sequence $x$ passed as input (line~\ref{line:sbs:init}).
\texttt{SBBS} also initializes variable $j$ for counting the number of symbols added by the search. \texttt{SBBS} keeps in memory at most $b$ sequences and, while all sequences are shorter than the desired duration $l$ (line
~\ref{line:sbs:stopping_condition}), it adds a symbol to each sequence (lines~\ref{line:sbs:init_while}--\ref{line:sbs:end_while}). \texttt{SBBS} then generates all sequences by adding one symbol from vocabulary $V$ to each sequence $m$ from $B$ (line~\ref{line:sbs:children}); these extended sequences, known as the children of $m$, are stored in $C_m$.
The operations performed in lines~\ref{line:sbs:pruning_model} and \ref{line:sbs:sample_next_beam} attempt to ensure the generation of good pieces that convey the desired emotion. In line~\ref{line:sbs:pruning_model}, \texttt{SBBS} selects the $k$ sequences with largest $p_L$-value among the children of $m$. This is because some of the children with low $p_L$-value could be attractive from the perspective of the desired emotion and,
although the resulting piece could convey the desired emotion, the piece would be of low quality according to the LM. The best $k$ children of each sequence in the beam are added to set $C$ (line
~\ref{line:sbs:total_children}). Then, in line~\ref{line:sbs:sample_next_beam}, \texttt{SBBS} samples the sequences that will form the beam of the next iteration. Sampling occurs proportionally to the values of $p_L(y) (1 - |v - E_{m,v}(y)|) (1 - |a - E_{m,a}(y)|)$, for sequences $y$ in $C$. A sequence $y$ has higher chance of being selected if $L$ attributes a high probability value to $y$ and if the music emotion model classifies the values of valence and arousal of $y$ to be similar to the desired emotion.
When at least one of the sequences is longer than the desired duration of the piece, \texttt{SBBS} returns the sequence with largest $p_L$-value that satisfies the duration constraint (line~\ref{line:sbs:return}).
\section{Empirical Evaluation}
Our empirical evaluation is divided into two parts. First, we evaluate the accuracy of the models used for story and music emotion classification. We are interested in comparing the fine-tuned BERT model for story emotion classification with the simpler Na\"ive Bayes approach of \citeauthor{padovani2017}~\shortcite{padovani2017}. We are also interested in comparing the fine-tuned GPT-2 model for music emotion classification with the simpler LSTM of \citeauthor{ferreira_2019}~\shortcite{ferreira_2019}. In the second part of our experiments we evaluate with a user study whether human subjects can recognize different emotions in pieces generated by Composer for the CotW campaign.
\subsection{Emotion Classifiers}
\subsubsection{Story Emotion}
The story emotion classifier we use with Composer is a pair of BERT models, one for valence and one for arousal. For both models, we use the pre-trained BERT$_{BASE}$ of \citeauthor{devlin2018bert}~\shortcite{devlin2018bert},
which has 12 layers, 768 units per layer, and 12 attention heads. BERT$_{BASE}$ was pre-trained using both the BooksCorpus (800M words) \cite{zhu2015aligning} and
the English Wikipedia (2,500M words).
We independently fine-tune these two BERT models as valence and arousal
classifiers using the CotW dataset \cite{padovani2017}. Fine-tuning consists of adding a
classification head on top the pre-trained model and training all the
parameters (including the pre-trained ones) of the resulting model
end-to-end. All these parameters were fine-tuned with an Adam optimizer~\cite{adam14} with learning rate of 3e-5 for 10 epochs. We used mini-batches of size 32 and dropout of 0.5.
The CotW dataset is divided into 9 episodes, thus we evaluate
the accuracy of each BERT classifier using a leave-one-out strategy.
For each episode $e$, we leave $e$ out for
testing and train in the remaining episodes. For example,
when testing on episode 1, we use episodes 2-8 for training.
Every sentence is encoded using a
WordPiece embedding \cite{wu2016google} with a 30,000 token vocabulary.
We compare the fine-tuned BERT classifiers with a Na\"ive
Bayes (NB) approach (baseline), chosen because it is the method underlying the original Bardo system. NB encodes sequences using a traditional bag-of-words with tf–idf approach.
Table~\ref{tab:valence} shows the accuracy of the valence classification of both these methods per episode. The best accuracy for a given episode is highlighted in bold. The BERT classifier outperforms NB in all the episodes, having an average accuracy 7\% higher.
For valence classification, the hardest episode for both the models is episode 7, where BERT had the best performance improvement when compared to NB. The story told in episode 7 of CotW is different from all other episodes. While the other episodes are full of battles and ability checks, episode 7 is mostly the players talking with non-player characters.
Therefore, what is learned in the other episodes does not generalize well to episode 7. The improvement in accuracy of the BERT model in that episode is likely due to the model's pre-training. Episodes 5 and 9 were equally easy for both methods because they are similar to one another. The system trained in one of these two episodes generalizes well to the other.
\begin{table}[!t]
\centering
\setlength{\tabcolsep}{4pt}
\begin{tabular}{crrrrrrrrrr}
\toprule
\multirow{2}{*}{\textbf{Alg.}} & \multicolumn{9}{c}{\textbf{Episodes}} & \multirow{2}{*}{\textbf{Avg.}} \\
\cmidrule{2-10}
& \multicolumn{1}{c}{\textbf{1}} & \multicolumn{1}{c}{\textbf{2}} & \multicolumn{1}{c}{\textbf{3}} & \multicolumn{1}{c}{\textbf{4}} & \multicolumn{1}{c}{\textbf{5}} & \multicolumn{1}{c}{\textbf{6}} & \multicolumn{1}{c}{\textbf{7}} & \multicolumn{1}{c}{\textbf{8}} & \multicolumn{1}{c}{\textbf{9}} & \\
\midrule
\multicolumn{1}{l}{\textbf{NB}} & 73 & 88 & 91 & 85 & 94 & 81 & 41 & 74 & 94 & 80 \\
\multicolumn{1}{l}{\textbf{BERT}} & \textbf{89} & \textbf{92} & \textbf{96} & \textbf{88} & \textbf{97} & \textbf{81} & \textbf{66} & \textbf{83} & \textbf{96} & \textbf{87} \\
\bottomrule
\end{tabular}
\caption{Valence accuracy in \% of Na\"ive Bayes (NB) and BERT for story emotion classification.}
\label{tab:valence}
\end{table}
Table \ref{tab:arousal} shows the accuracy of arousal classification
of both NB and BERT. The best accuracy for a given episode is highlighted in bold. Again BERT outperforms NB in all the episodes, having an average accuracy 5\% higher. In contrast with the valence results, here there is no episode in which the BERT model substantially outperforms NB.
\begin{table}[!h]
\centering
\setlength{\tabcolsep}{4pt}
\begin{tabular}{crrrrrrrrrr}
\toprule
\multirow{2}{*}{\textbf{Alg.}} & \multicolumn{9}{c}{\textbf{Episodes}} & \multirow{2}{*}{\textbf{Avg.}} \\
\cmidrule{2-10}
& \multicolumn{1}{c}{\textbf{1}} & \multicolumn{1}{c}{\textbf{2}} & \multicolumn{1}{c}{\textbf{3}} & \multicolumn{1}{c}{\textbf{4}} & \multicolumn{1}{c}{\textbf{5}} & \multicolumn{1}{c}{\textbf{6}} & \multicolumn{1}{c}{\textbf{7}} & \multicolumn{1}{c}{\textbf{8}} & \multicolumn{1}{c}{\textbf{9}} & \\
\midrule
\multicolumn{1}{l}{\textbf{NB}} & 82 & 88 & 75 & 79 & 82 & 76 & 98 & 86 & 84 & 83 \\
\multicolumn{1}{l}{\textbf{BERT}} & \textbf{86} & \textbf{90} & \textbf{77} & \textbf{86} & \textbf{89} & \textbf{88} & \textbf{99} & \textbf{90} & \textbf{88} & \textbf{88} \\
\bottomrule
\end{tabular}
\caption{Arousal accuracy in \% of Na\"ive Bayes (NB) and BERT for story emotion classification.}
\label{tab:arousal}
\end{table}
\subsubsection{Music Emotion}
The music emotion classifier is a pair of GPT-2 models, one for valence and one for arousal.
We first pre-trained a GPT-2 LM with our ADL Piano MIDI dataset. We augmented each piece $p$ of this dataset by (a) transposing $p$ to every key, (b)
increasing and decreasing $p$'s tempo by 10\% and (c) increasing and decreasing
the velocity of all notes in $p$ by 10\% \cite{oore2017learning}. Thus, each
piece generated $12 \cdot 3 \cdot 3 = 108$ different examples.
The pre-trained GPT-2 LM has 4 layers (transformer blocks), context size of 1024
tokens, 512 embedding units, 1024 hidden units, and 8 attention heads. We then fine-tuned the GPT-2 LM independently using the VGMIDI dataset, for valence
and for arousal. Similarly to BERT, fine-tuning a GPT-2
architecture consists of adding an extra classification head on top of the pre-trained model and training all parameters end-to-end. Similar to the story emotion classifiers, we
fine-tuned the GPT-2 classifiers for 10 epochs using an Adam optimizer with learning rate 3e-5. Different from the story emotion classifiers, we used mini-batches of size 16 (due to GPU memory constrains) and dropout of 0.25. The VGMIDI dataset is defined with a train and test splits of 160 and 40 pieces, respectively. We augmented the dataset by slicing each piece
into 2, 4, 8 and 16 parts of equal length and emotion. Thus, each part of each slicing
generated one extra example. This augmentation is intended
to help the classifier generalize for pieces
with different lengths.
We compare the fine-tuned GPT-2 classifiers with LSTM models that were also
pre-trained with the ADL Piano Midi dataset and fine-tuned with the VGMIDI dataset. We chose LSTMs because they are the state-of-the-art model in the VGMIDI dataset~\cite{ferreira_2019}. The LSTMs have same size as the GPT-2 models (4 hidden layers, 512 embedding units, 1024 hidden units) and were pre-trained and fine-tuned with the same hyper-parameters.
Table \ref{tab:sent_accuracy} shows the accuracy of both models for valence and arousal. We also report the performance of these models
without pre-training (i.e., trained only on the VGMIDI dataset). We call
these the baseline versions of the models.
\begin{table}[!t]
\centering
\begin{tabular}{ccc}
\toprule
\textbf{Algorithm} & \textbf{Valence} & \textbf{Arousal} \\
\midrule
Baseline LSTM & 69 & 67 \\
Fine-tuned LSTM & 74 & 79 \\
Baseline GPT-2 & 70 & 76 \\
Fine-tuned GPT-2 & \textbf{80} & \textbf{82} \\
\bottomrule
\end{tabular}
\caption{Accuracy in \% of both the GPT-2 and LSTM models for music emotion classification. }
\label{tab:sent_accuracy}
\end{table}
Results show that using transfer learning can substantially boost the performance
of both models. The fine-tuned GPT-2 is 10\% more accurate in terms of valence and 8\% in terms of arousal. The fine-tuned LSTM is 5\% more accurate in terms of
valence and 12\% in terms of arousal. Finally, the fine-tuned GPT-2
outperformed the fine-tuned LSTM by 6\% and 3\% in terms of valence and arousal, respectively.
\begin{table*}[!t]
\centering
\setlength{\tabcolsep}{4pt}
\begin{tabular}{crrrrrrrrrrrrrrrrrrrrrrr}
\toprule
\multirow{3}{*}{\textbf{Method}} & \multicolumn{20}{c}{\textbf{Episodes}} & \multicolumn{3}{c}{\multirow{3}{*}{\textbf{Average}}} \\
\cmidrule{2-21}
& \multicolumn{2}{c}{\textbf{e1-p1}} & \multicolumn{2}{c}{\textbf{e1-p2}} & \multicolumn{2}{c}{\textbf{e2-p1}} & \multicolumn{2}{c}{\textbf{e2-p2}} & \multicolumn{2}{c}{\textbf{e3-p1}} & \multicolumn{2}{c}{\textbf{e3-p2}} & \multicolumn{2}{c}{\textbf{e4-p1}} & \multicolumn{2}{c}{\textbf{e4-p2}} & \multicolumn{2}{c}{\textbf{e5-p1}} & \multicolumn{2}{c}{\textbf{e5-p2}} \\
& \textbf{v} & \textbf{a} & \textbf{v} & \textbf{a} & \textbf{v} & \textbf{a} & \textbf{v} & \textbf{a} & \textbf{v} & \textbf{a} & \textbf{v} & \textbf{a} & \textbf{v} & \textbf{a} & \textbf{v} & \textbf{a} & \textbf{v} & \textbf{a} & \textbf{v} & \textbf{a} & \textbf{v} & \textbf{a} & \textbf{va}\\
\cmidrule{2-21}
\multicolumn{1}{l}{\textbf{Baseline}} & 56 & \textbf{65} & 39 & 56 & 39 & 62 & 39 & \textbf{79} & \textbf{48} & \textbf{60} & \textbf{67} & \textbf{53} & \textbf{58} & 70 & \textbf{63} & \textbf{75} & 25 & 36 & \textbf{72} & 58 & \textbf{51} & \textbf{32} & \textbf{34}\\
\multicolumn{1}{l}{\textbf{Composer}} & \textbf{62} & 60 & \textbf{44} & \textbf{65} & \textbf{82} & \textbf{68} & \textbf{53} & 68 & 24 & 55 & 46 & 43 & 25 & \textbf{87} & 37 & 55 & \textbf{81} & \textbf{86} & 51 & \textbf{67} & \textbf{51} & 30 & \textbf{34}\\
\bottomrule
\end{tabular}
\caption{The percentage of participants that correctly identified the valence and arousal (v and a, respectively) intended by the methods for the pieces parts (p1 and p2).
}
\label{tab:user_study}
\end{table*}
\subsection{User Study}
In our study we measure Composer's performance at generating music
that matches the emotions of a story. We use Composer to generate
a piece for a snippet composed of 8 contiguous sentences of each of the first 5 episodes of the CotW dataset.
Each snippet has one emotion transition that happens in between sentences. The sentences are 5.18 seconds long on average.
To test Composer's ability to generate
music pieces with emotion changes, we asked human subjects to listen
to the 5 generated pieces and evaluate the transitions of emotion in
each generated piece.\footnote{Generated pieces can be downloaded from the following link: \url{https://github.com/lucasnfe/bardo-composer}}
The user study was performed via Amazon Mechanical Turk and had an expected completion time of approximately 10 minutes. A reward
of USD \$1 was given to each participant who completed the
study.
In the
first section of the study, the participants were presented an illustrated description
of the valence-arousal model of emotion and listened to 4 examples of pieces
from the VGMIDI dataset labeled with the valence-arousal model. Each piece had a different emotion: low valence and arousal, low valence and high arousal, high valence and low arousal, high valence and arousal.
In the second section of the study, participants were asked to
listen to the 5 generated pieces (one per episode). After listening to each piece, participants had
to answer 2 questions: (a) ``What emotion do you perceive in the 1st part of the piece?'' and (b) ``What emotion do you perceive in the 2nd part of the piece?'' To answer these two questions, participants selected one of the
four emotions: low valence and arousal, low valence and high arousal, high valence and low arousal, high valence and arousal.
Subjects were allowed to play the pieces as many times as they
wanted before answering the questions.
The final section of the study was a demographics questionnaire including ethnicity, first language, age, gender, and
experience as a musician. To answer the experience as a musician,
we used a 1-to-5 Likert scale where 1
means ``I've never studied music theory or practice'' and 5 means ``I
have an undergraduate degree in music''.
We compare Composer with a baseline method that selects a random piece from the
VGMIDI dataset whenever there is a transition of emotion. The selected piece has
the same emotion of the sentence (as given by the story emotion classifier). To compare these two methods, we used a
between-subject strategy where Group $A$ of 58 participants evaluated the
5 pieces generated by Composer and another Group $B$ of 58 participants
evaluated the 5 pieces from the baseline.
We used this
strategy to avoid possible learning effects where subjects
could learn emotion transitions from one method and apply the same evaluation directly to the other method. The average age of
groups $A$ and $B$ are 34.96 and 36.98 years, respectively. In Group
$A$, 69.5\% of participants are male and 30.5\% are female. In Group
$B$, 67.2\% are male and 32.8\% are female. The average musicianship of the groups $A$ and $B$ are 2.77 and 2.46, respectively.
Table \ref{tab:user_study} shows the results of the user study.
We consider both parts (p1 and p2 in the table) of each episode as an independent piece.
The table presents the percentage of participants that correctly identified the pieces' valence and arousal (``v'' and ``a'' in the table, respectively), as intended by the methods.
For example, 87\% of the participants correctly identified the arousal value that Composer intended the generated piece for part p1 of episode 4 (e4-p1) to have. We refer to the percentage of participants that are able to identify the approach's intended emotion as the approach's accuracy.
We also present the approaches' average accuracy across all pieces (``Average'' in the table)
in terms of valence, arousal, and jointly for valence and arousal (``va'' in the table). The ``va''-value of 34 for Composer means that 34\% of the participants correctly identified the system's intended values for valence and arousal across all pieces generated.
Composer outperformed the Baseline in e1-p2, e2-p1, and e5-p1. Baseline outperformed
Composer e3-p1, e3-p2 and e4-p2. In the other four parts,
one method performed better for valence whereas
the other method performance better for arousal.
Overall, the average results show that both systems performed very
similarly. Both of them had an average accuracy on the combined
dimensions equal to 34\%. The difference between these two methods and a
system that selects pieces at random (expected accuracy of 25\%)
is significant according to a Binomial test ($p = 0.02$).
These results show that the participants were able to identify the emotions in the generated pieces as accurately as they were able to identify the emotions in human-composed pieces. This is an important
result towards the development of a fully automated system for music composition for story-based tabletop games.
\section{Conclusions}
This paper presented Bardo Composer, a system that
automatically composes music for tabletop role-playing games. The system processes sequences
from speech and generates pieces one sentence after the other. The emotion of the sentence is classified using a fine-tuned BERT. This emotion is given as
input to a Stochastic Bi-Objective Beam Search algorithm that tries to generate a piece that matches the emotion.
We evaluated Composer with a user study and results showed that human subjects correctly identified the emotion of the generated music pieces as accurately as they were able to identify the emotion of pieces composed by humans.
| {'timestamp': '2020-08-18T02:20:51', 'yymm': '2008', 'arxiv_id': '2008.07009', 'language': 'en', 'url': 'https://arxiv.org/abs/2008.07009'} | arxiv |
\section{Introduction}
Adversarial attacks \cite{szegedy2013intriguing, goodfellow2014explaining, carlini2017towards, madry2017towards, su2019one, 8807315, 9072347, 9063523, 8725541, 8423654, 9025211, GHOSH2022108279} have revealed the fragility of Deep Neural Networks (DNNs) by fooling them with elaborately-crafted imperceptible perturbations. Among them, the black-box attack, i.e., attacking without knowledge of their inner structure and weights, is much harder, more aggressive, and closer to real-world scenarios. For classifiers, there exist some promising black-box attacks \cite{dong2018boosting, xie2019improving, lin2019nesterov, 9238430}. It is also severe to attack object detection \cite{zhang2019towards} in a black-box manner, e.g., hiding certain objects from unknown detectors \cite{thys2019fooling}. By that, life-concerning systems based on detection such as autonomous driving and security surveillance could be hurt when the black-box attack is conducted physically \cite{huang2020universal, Wang_2021_CVPR}.
To the best of our knowledge, no existing attack is specifically designed for black-box transferability in detectors, because they have multiple-outputs and a high diversity across architectures. In such situations, adversarial samples do not transfer well \cite{su2018robustness}, and most imperceivable attacks only decrease mAP of black-box detectors by 5 to 10\% \cite{xie2017adversarial, li2018robust, li2018exploring}. To overcome this, we propose one feasible way to find common properties across detectors inspired by our AoA attack \cite{9238430}, which facilitates the discovery of common weaknesses. Based on them, the designed attack can threaten various victims.
In this paper, we adopt the relevance map from DNN interpreters as common property, on which different detectors have similar interpretable results, as shown in Fig. \ref{intro} and \ref{visualrlv}. Based on relevance maps, we design a Relevance Attack on Detectors (RAD). RAD focuses on suppressing the relevance map rather than directly attacking the prediction as in existing works \cite{xie2017adversarial, li2018robust, li2018attacking, LI2021107584, XIAO2021107903}. Because the relevance maps are quite similar across models, those of black-box models are influenced and misled as well in attack, leading to great transferability. Although some works have adopted the relevance map as an indicator or reference of success attacks \cite{9238430, dong2019evading, zhang2019interpreting, wu2020boosting}, there is no work to directly attack the relevance maps of detectors to the best of our knowledge.
\begin{figure}[!htpb]
\centering
\includegraphics[width=\hsize]{imgs/heatmap.png}\\
\caption{Relevance maps for models with different architectures. Three models not only predict the ``stop sign'' right, but also share similar relevance maps.}
\label{intro}
\end{figure}
In our comprehensive evaluation, RAD achieves the state-of-the-art transferability on 8 black-box models for COCO) dataset \cite{lin2014microsoft}, nearly halving the detection mAP under the common $\ell_\infty$-bounded settings, and impairing detectors' performance in three sub-tasks. Interestingly, the adversarial samples of RAD also greatly influence the performance of instance segmentation, even only detectors are attacked. Given the high transferability of RAD, we create Adversarial Objects in COntext (AOCO), the first adversarial dataset for object detection and instance segmentation. AOCO contains 10K samples that significantly decrease the performance of black-box models for detection and segmentation. AOCO may serve as a benchmark to test the robustness of a DNN or improve it by adversarial training. To reproduce our results and access our dataset, one could visit \url{https://github.com/AllenChen1998/RAD}.
\subsection*{Contributions}
\begin{itemize}
\item We propose a novel attack framework on relevance maps for detectors. We extend DNN interpreters to detectors, find out the most suitable outputs to attack by relevance maps, and explore the best update techniques to increase the transferability.
\item We evaluate RAD on 8 black-box models and find its state-of-the-art transferability, which exceeds existing results by above 20\% in mAP. Detection and segmentation performance is greatly impaired in various metrics, invalidating the state-of-the-art DNN to a very rudimentary counterpart.
\item By RAD, we create the first adversarial dataset for object detection and instance segmentation, i.e., AOCO. As a potential benchmark, AOCO is generated from COCO and contains 10K high-transferable samples. AOCO helps to quickly evaluate and improve the robustness of detectors.
\end{itemize}
\section{Related Work}\label{related}
Since \cite{szegedy2013intriguing}, there have been lots of promising adversarial attacks \cite{goodfellow2014explaining, carlini2017towards, madry2017towards}. Generally, they fix the network weights and change the input slightly to optimize the attack loss. The network then predicts incorrectly on adversarial samples with high confidence. \cite{papernot2017practical} find that adversarial samples crafted by attacking a white-box surrogate model may transfer to other black-box models as well. Input modification \cite{xie2019improving, dong2019evading, lin2019nesterov} or other optimization ways \cite{dong2018boosting, lin2019nesterov} are validated to be effective in enhancing the transferability.
\cite{xie2017adversarial} extends adversarial attacks to detectors. It proposes to attack on densely generated bounding boxes. After that, losses about localization and classification are designed \cite{li2018robust} for attacking detectors. \cite{lu2017adversarial} and \cite{li2018attacking} propose to attack detectors in a restricted area. Existing restricted digital attacks achieve good results in white-box scenarios but are not specifically designed for transferability. The adversarial impact on black-box models is quite limited, i.e., a 5 to 10\% decrease from the original mAP, even when two models only differ in backbone \cite{xie2017adversarial, li2018robust, li2018exploring}. \cite{wang2020adversarial} discusses black-box attacks towards detectors based on queries rather than the transferability as we do. The performance is satisfactory, but it requires over 30K queries, which is easy to be discovered by the model owner. Besides, physical attacks on white-box detectors are also feasible \cite{huang2019adversarial, wu2020making, xu2020adversarial}.
For great transferability, we propose to attack relevance maps, which are calculated by DNN interpreters \cite{zeiler2014visualizing, selvaraju2017grad, shrikumar2017learning, montavon2017explaining}. They are originally developed to interpret how DNNs predict and help users gain trust in them. Specifically, they display how the input contributes to a certain output in a pixel-wise manner. Typical works include Layer-wise Relevance Propagation (LRP) \cite{bach2015pixel}, Contrastive LRP \cite{gu2018understanding} and Softmax Gradient LRP (SGLRP) \cite{iwana2019explaining}. These methods encourage the reference of relevance maps in attack \cite{9238430, dong2019evading, zhang2019interpreting, wu2020boosting}, and also inspire us. However, none of them attack relevance maps for detectors.
RAD differs from \cite{ghorbani2019interpretation, zhang2020interpretable} in the goal. RAD misleads detectors by suppressing relevance maps. \cite{ghorbani2019interpretation} misleads the relevance maps while keeping the prediction unchanged. \cite{zhang2020interpretable} also misleads DNNs, but it keeps the relevance maps unchanged.
\section{Relevance Attack on Detectors}
We propose an attack specifically designed for black-box transferability, named Relevance Attack on Detectors (RAD). RAD suppresses multi-node relevance maps for several bounding boxes. Since the relevance map is commonly shared by different detectors as shown in Fig. \ref{intro}, attacking it in the white-box surrogate model achieves a high transferability towards black-box models. In this section, we first provide a high-level overview of RAD, and analyze the potential reasons for its transferability. Then we thoroughly discuss three crucial concrete issues in RAD.
\begin{itemize}
\item In Section \ref{what}, we extend existing classifier interpreters to detector ones.
\item In Section \ref{where}, we study the proper output scalars to attack by RAD.
\item In Section \ref{how}, we explore the suitable techniques to update samples.
\end{itemize}
\subsection{What is RAD?}
We present the framework of RAD in Fig. \ref{architecture}. Initialized by the original sample $x_0$, the adversarial sample $x_k$ in the $k^\text{th}$ iteration is forward propagated in the surrogate model, getting the prediction $f(x_k)$. Current attacks generally suppress the prediction values of all attacked output nodes in $T$, where an output node stands for an output scalar of the detector. In contrast, RAD suppresses the corresponding relevance map $h(x_k, T)$. To restrain that, gradients of $h(x_k, T)$ back propagate to $x_k$, which is then modified to $x_{k+1}$.
\begin{figure}[!htpb]
\centering
\includegraphics[width=\hsize]{imgs/architecture.png}\\
\caption{Framework of RAD. $x_k$ is the sample in iteration $k$ and $f(x_k)$ is the network prediction for it. $h(x_k, T)$ stands for the relevance map for all attacked nodes in $T$. RAD works by repeating processes denoted by ``black'', ``red'' and ``blue'' arrows in turn.}
\label{architecture}
\end{figure}
Notably, RAD is a complete framework to attack detectors, and its components require special design. Besides the calculation of relevance maps of detectors, other components in RAD, e.g., the attacked nodes or the update techniques, also need a customized analysis. The reason is that no existing work directly attacks the relevance of detectors, and the experience in attacking predictions is not applicable here. For example, \cite{zhang2019towards} emphasizes classification loss and localization loss equally, but the former is validated to be significantly better in attacking the relevance in Section \ref{where}.
\subsection{Why RAD Transfers?}
RAD's transferability comes from the attack goal: changing the common properties, i.e., the relevance maps, which are the same for different detectors because they are developed to interpret the salient parts in the data, and thus is data-dependent and model-independent \cite{simonyan2013deep, zeiler2014visualizing, selvaraju2017grad} for diverse well-trained models, which could be observed in Fig. \ref{intro} and \ref{visualrlv}. As shown in Fig. \ref{white}, the relevance maps are clear and structured for the original sample in both detectors. After RAD, the relevance maps are induced to be meaningless without a correct focus, leading to wrong predictions, i.e., no or false detection. Because relevance maps transfer well across models, those for black-box detectors are also significantly influenced, causing a great performance drop, which is illustrated visually in Section \ref{expvisual}.
\begin{figure}[!htpb]
\centering
\includegraphics[width=\hsize]{imgs/white.png}\\
\caption{RAD's transferability origins from the change of relevance maps. The image contains a person and a skateboard. By attacking on relevance maps, both surrogate models make extremely confusing predictions.}
\label{white}
\end{figure}
RAD also attacks quite ``precisely'', i.e., the perturbation pattern is significantly focused on distinct areas and has a clear structure as shown in Fig. \ref{per}. That is to say, RAD accurately locates the most discriminating parts of a sample and concentrates the perturbation on them, leading to a great transferability when the perturbations are equally bounded.
\begin{figure}[!htpb]
\centering
\includegraphics[width=0.24\hsize]{imgs/p_sample_001532.png}
\includegraphics[width=0.24\hsize]{imgs/p_Dfool.png}
\includegraphics[width=0.24\hsize]{imgs/p_DAG.png}
\includegraphics[width=0.24\hsize]{imgs/p_ATTACTION.png}\\
\caption{The original image and the adversarial perturbations ($\times 5$ in magnitude for demonstration) generated by Dfool \cite{lu2017adversarial}, DAG \cite{xie2017adversarial}, and RAD (from left to right)}
\label{per}
\end{figure}
\subsection{What is the Relevance Maps for Detectors?}\label{what}
We analyze the potential of RAD above, below we make it feasible by addressing three crucial issues. To conduct the relevance attack, we first need to know the relevance maps for detectors.
Currently, there exist lots of interpreters to calculate the relevance maps for classifiers as described in Section \ref{related}, but none of them are suitable for detectors. We take SGLRP \cite{iwana2019explaining} as an example to introduce the relevance map for classifiers and then modify it for detectors because it excels in discriminating against irrelevant regions.
For a given deep classifier, the relevance map is defined as a normalized heat map with the same dimensions as input $x$, visualizing how $x$ contributes to a specific output node $t$ in pixel-wise manners. We denote this map as $h(x, t)$, which, in SGLRP, is obtained by back-propagating the ``relevance'' $R$ from the output layer (layer $L$) to the input layer (layer $1$) after the forward inference. Suppose layer $l$ has $N$ nodes (dimension of features) and layer $l+1$ has $M$ nodes, the relevance $R_n^{(l)}$ at node $n$ in layer $l$ is defined recursively by
\begin{equation*}
R_{n}^{(l)}=\sum_{m} \frac{a_{n}^{(l)} w_{n, m}^{+(l)}}{\sum_{n^{\prime}} a_{n^{\prime}}^{(l)} w_{n^{\prime}, m}^{+(l)}} R_{m}^{(l+1)},
\end{equation*}
for nodes with definite positive values (such as after ReLU), and
\begin{equation*}
R_{n}^{(l)}=\sum_{m} \frac{z_{n}^{(l)} w_{n, m}^{(l)}-b_{n}^{(l)} w_{n, m}^{+(l)}-h_{n}^{(l)} w_{n, m}^{-(l)}}{\sum_{n^{\prime}} z_{n^{\prime}}^{(l)} w_{n^{\prime}, m}^{(l)}-b_{n^{\prime}}^{(l)} w_{n^{\prime}, m}^{+(l)}-h_{n^{\prime}}^{(l)} w_{n^{\prime}, m}^{-(l)}} R_{m}^{(l+1)},
\end{equation*}
for nodes that may have negative values. In the formulas above, $a_n^{(l)}$ is the post-activation output of node $n$ in layer $l$ and $z_n^{(l)}$ is the pre-activation one. The range $[b_n^{(l)}, h_n^{(l)}]$ stands for the minimum and maximum of $z_n^{(l)}$, and $w_{n, m}^{+(l)}=\max \left(w_{n, m}^{(l)}, 0\right)$, $w_{n, m}^{-(l)}=\min \left(w_{n, m}^{(l)}, 0\right)$.
According to the relevance propagation rules above, the relevance map $h(x, t) = R^{(1)}$ is calculated by recursively back-propagating the relevance in the output layer $R^{(L)}$, of which the $n^\text{th}$ component $R_n^{(L)}$ is defined in SGLRP as
\begin{eqnarray}\label{sglrp}
R_n^{(L)}=\left\{\begin{array}{ll}
y_n\left(1-y_n\right) & n=t, \\
-y_n y_t & n \neq t,
\end{array}\right.
\end{eqnarray}
where $y_n$ is the predicted probability of class $n$, and $y_t$ is that for the single target class $t$.
In detectors, however, we need the pixel-wise contributions from the input to $m$ bounding boxes. This multi-node relevance map could not be directly calculated by (\ref{sglrp}), so we naturally modify SGLRP as
\begin{eqnarray}\label{mn-sglrp}
R_{n}^{(L)}=\left\{\begin{array}{ll}
{y}_{n}\left(1-{y}_{n}\right) & n \in T, \\
- \frac{1}{m} {y}_{n} \sum_{i=1}^{m} {y}_{t_i} & n \notin T,
\end{array}\right.
\end{eqnarray}
where ${y}_{t_i}$ is the predicted probabilities for one target output node $t_i$. $T$ is the set containing all target output nodes $\{t_1, t_2, ..., t_m\}$. With iNNvestigate Library \cite{alber2019innvestigate} to implement Multi-Node SGLRP and Deep Learning platforms supporting auto-gradient, the gradients from RAD loss $L_\text{RAD}(x) = h(x, T)$ to sample $x$ could be obtained according to the relevance propagation rules.
We illustrate the difference between SGLRP and our Multi-Node SGLRP in Fig. \ref{mnsglrp}. SGLRP only displays the relevance map for one bounding box, e.g., ``TV'', ``chair'' and ``bottle''. Multi-Node SGLRP, in contrast, visualizes the overall relevance.
\begin{figure}[!htpb]
\centering
\includegraphics[width=\hsize]{imgs/multi.png}\\
\caption{Difference between relevance maps from SGLRP and Multi-Node SGLRP. The relevance maps are for YOLOv3 \cite{redmon2018yolov3}.}
\label{mnsglrp}
\end{figure}
\subsection{Where to Attack?}\label{where}
Besides the calculation of relevance maps, it is also important to choose a proper node-set $T$ to attack. Specifically, we need to select certain bounding boxes and the corresponding output nodes for RAD.
Heuristically, the most ``obvious'' bounding boxes are desired to be eliminated, so we select the bounding boxes with the highest confidence, following \cite{xie2017adversarial}. Concretely, it is feasible to \emph{statically} choose several bounding boxes to attack in each iteration, or \emph{dynamically} attack all bounding boxes whose confidence exceeds a threshold. In our evaluation, the two strategies differ a little in performance and are not sensitive to hyper-parameter as demonstrated in \ref{strategy}. This shows that RAD does not require a sophisticated tuning of parameters, which is user-friendly. In our following experiments, we statically attack 20 nodes.
After selecting bounding boxes, we could attack their size, leading them to shrink; or their localization, leading them to shift; or their confidence, leading them to be misclassified. To adopt the best strategy, we conduct a toy experiment by attacking YOLOv3 \cite{redmon2018yolov3}, denoted as M2 (other models are specified in Table \ref{models}), following the settings later in Sec. \ref{expsec}. Given the results in Table \ref{strategytable}, the classification loss induces a better black-box transferability. This may be because detectors generally include a pre-trained classification as the feature extractor, and relevance maps are believed to be an indicator of successful attacks \cite{dong2019evading, zhang2019interpreting}. Note that our method is applicable to both one-stage detectors and two-stage ones because they both have classification outputs which we target on.
\begin{table}[!htpb]
\caption{Detection mAP in RAD with different attacked nodes}
\label{strategytable}
\centering
\begin{tabular}{r|ccccccccc}
\toprule
Strategy & M1 & M2 & M3 & M4 & M5 & M6 & M7 & M8 & M9\\ \hline
No Attack & 29.3 & 33.4 & 38.1 & 40.7 & 42.1 & 42.5 & 45.7 & 46.9 & 53.9\\
Size & 26.0 & 14.7 & 31.9 & 32.5 & 35.6 & 35.4 & 38.6 & 40.0 & 47.8 \\
Local. & 22.8 & 6.4 & 27.4 & 28.1 & 31.7 & 30.8 & 34.4 & 35.9 & 45.1 \\
Class. & \textbf{18.1} & \textbf{1.2} & \textbf{19.9} & \textbf{20.5} & \textbf{24.3} & \textbf{22.6} & \textbf{26.4} & \textbf{28.2} & \textbf{39.9} \\
\bottomrule
\end{tabular}
\end{table}
\subsection{How to Update?}\label{how}
With the relevance map $h(x, T)$ for certain attacked nodes $T$, we are able to attack, i.e., update the original sample to become adversarial by suppressing the relevance map according to the attack gradients $g(x)$ as
\begin{eqnarray}\label{grad}
g(x)=\frac{\partial L_\text{RAD}(x)}{\partial x}=\frac{\partial h(x, T)}{\partial x}.
\end{eqnarray}
Some update techniques are validated to be effective for enhancing the transferability in classification. For example, Scale-Invariant (SI) \cite{lin2019nesterov} proposes to average the attack gradients by scale copies of the samples as
\begin{eqnarray}\label{updatesi}
\begin{split}
g_\text{si}(x)= \frac{1}{k} \sum_{i=0}^{k} g(x/2^i).
\end{split}
\end{eqnarray}
Besides SI, Diverse Input (DI) \cite{xie2019improving}, Translation-Invariant (TI) \cite{dong2019evading} are also promising in classification. We are curious about whether they also work well in object detection. To explore this, we adopt these techniques in RAD as the setting suggested by their designers (see Sec. \ref{expsec} and \ref{detail}). From the results in Table \ref{technique}, we discover that SI is quite effective, further decreasing the mAP from the baseline significantly. Accordingly, RAD adopts (\ref{updatesi}) to update.
\begin{table}[!htpb]
\caption{Detection mAP in RAD with different update techniques}
\label{technique}
\centering
\begin{tabular}{r|ccccccccc}
\toprule
Technique & M1 & M2 & M3 & M4 & M5 & M6 & M7 & M8 & M9\\ \hline
None & 18.1 & 1.2 & 19.9 & 20.5 & 24.3 & 22.6 & 26.4 & 28.2 & 39.9 \\
DI & 18.1 & 1.0 & 19.9 & 20.5 & 23.9 & 22.4 & 26.3 & 27.9 & 39.6 \\
TI & 17.0 & 2.4 & 20.8 & 20.8 & 25.2 & 23.0 & 27.9 & 29.7 & 41.5 \\
SI & \textbf{14.6} & \textbf{0.7} & \textbf{16.3} & \textbf{17.0} & \textbf{20.4} & \textbf{19.1} & \textbf{22.3} & \textbf{23.8} & \textbf{35.0} \\
\bottomrule
\end{tabular}
\end{table}
With the calculated gradient, we update the sample like PGD attack \cite{madry2017towards} as
\begin{eqnarray}\label{update}
\begin{split}
x_{k+1} &= \text{clip}_\varepsilon\left(x_{k} - \alpha \frac{g_\text{si}(x_k)}{||g_\text{si}(x_k)||_1/N}\right),
\end{split}
\end{eqnarray}
where $\alpha$ stands for the step length. $x$ is $\ell_\infty$-norm bounded by $\varepsilon$ from the original sample in each iteration as in \cite{xie2019improving, lin2019nesterov, dong2019evading}. Gradient $g(x)$ is normalized by its average $\ell_1$-norm,i.e., $||g(x)||_1 /N$ to prevent numerical errors and control the degree of perturbations. $N$ is the dimension of the image, i.e., $N=height \times width \times channel$. Division by $N$ is necessary because $\ell_1$-norm sums all components of the tensor $x$, which is too large as a normalization factor. We do not adopt the mainstream sign method because it is not suitable to generate small perturbations as shown in other attacks in detectors \cite{xie2017adversarial}.
\section{Experiments}\label{expsec}
In this section, we evaluate the performance of RAD on various detectors, especially its transferability. The results are presented visually and numerically. In comprehensive evaluation, RAD achieves great transferability across models and even across tasks.
\subsection{Setup}
Our experiments are based on Keras \cite{chollet2015keras}, Tensorflow \cite{tensorflow2015-whitepaper} and PyTorch \cite{paszke2019pytorch} in 4 NVIDIA GeForce RTX 2080Ti GPUs. Library iNNvestigate \cite{alber2019innvestigate} is used to implement Multi-Node SGLRP.
We conduct experiments on MS COCO 2017 dataset \cite{lin2014microsoft}, which is a large-scale benchmark for object detection, instance segmentation, and image captioning. For a fair evaluation, we generate adversarial samples from all 5K samples in its validation set and test several black-box models on their mAP, a standard measure in many works \cite{he2017mask, chen2019hybrid}.
All attacks are conducted with the step length $\alpha=2$ for 10 iterations and the perturbation is $\ell_\infty$-bounded in $\varepsilon=16$ to guarantee the imperceptibility as in \cite{dong2019evading} if not particularly specified. To validate that the mAP drop comes from the attack instead of resizing or perturbation, we add large Gaussian noises ($\sigma=9$) to the resized images, and report it as ``Ablation''.
We choose 8 typical detectors ranging from the first end-to-end detector to state-of-the-art counterparts for attack and test. The variety of models guarantees the validity of results. We specify their information in Table \ref{models} and the corresponding pre-processing or details in \ref{detail}.
\begin{table}[!htpb]
\caption{Model backbone and mAPs}
\centering
\renewcommand\tabcolsep{4.5pt}
\label{models}
\begin{tabular}{ccccc}
\toprule
ID & Model & Type & Backbone & mAP \\ \hline
M1 & SSD512 \cite{liu2016ssd} & one-stage & VGG16 & 29.3 \\
M2 & YOLOv3 \cite{redmon2018yolov3} & one-stage & Darknet & 33.4 \\
M3 & RetinaNet \cite{lin2017focal} & one-stage & ResNet-101 & 38.1 \\
M4 & Faster R-CNN \cite{ren2015faster} & two-stage & ResNeXt-101-64*4d & 40.7 \\
M5 & Mask R-CNN \cite{he2017mask} & two-stage & ResNeXt-101-64*4d & 42.1 \\
M6 & Cascade RCNN \cite{cai2018cascade} & two-stage & ResNet-101 & 42.5 \\
M7 & Cascade Mask R-CNN \cite{cai2018cascade} & two-stage & ResNeXt-101-64*4d & 45.7 \\
M8 & Hyrbrid Task Cascade \cite{chen2019hybrid} & two-stage & ResNeXt-101-64*4d & 46.9 \\
M9 & EfficientDet \cite{tan2020efficientdet} & one-stage & EfficientNet + BiFPN & 53.9 \\
\bottomrule
\end{tabular}
\end{table}
\subsection{Visual Results of RAD}\label{expvisual}
We first intuitively illustrate the attack process in Fig. \ref{convergence} and the attack transferability in Fig. \ref{black}.
\begin{figure}[!htpb]
\centering
\includegraphics[width=\hsize]{imgs/convergence.png}\\
\caption{The model predictions and the relevance map in different attack iterations during RAD on YOLOv3. We could see from top to bottom how RAD gradually influences the prediction of YOLOv3 (left column) by distorting its relevance map (right column).}
\label{convergence}
\end{figure}
\begin{figure}[!htpb]
\centering
\includegraphics[width=\hsize]{imgs/black.png}\\
\caption{RAD has a great transferability. The same adversarial sample generated by attacking Mask R-CNN fools all 5 black-box detectors.}
\label{black}
\end{figure}
By RAD, the relevance map is attacked to be meaningless and loses its focus. In Fig. \ref{convergence}, the initial prediction is correct and the relevance map is clear. RAD constantly misleads the relevance map to be unstructured without the outline of objects. Finally, all bounding boxes vanish.
In Fig. \ref{black}, we visualize several predictions on the same adversarial sample by black-box models. The objects in the image, e.g., the laptop and keyboard, are quite large and obvious to detect. However, with a small perturbation from RAD, 5 black-box models all fail to detect the laptop, keyboard, and mouse. Surprisingly, 4 of them even detect a non-existent ``bed'', which is neither relevant nor similar in the image.
\subsection{RAD's Transferability in Object Detection}\label{transcompare}
To evaluate the in-domain transferability of detection attacks and cross-domain transferability of classification attacks, we test the detection mAP of 8 models in COCO adversarial samples generated in the setting stated before.
For detection attacks, adversarial samples are crafted by attacking surrogate model M2 (YOLOv3 \cite{redmon2018yolov3}). For classification attacks, we use the model output on the clean sample as the label. By several state-of-the-art attacks on surrogate classifiers (InceptionV3 \cite{szegedy2016rethinking} here as in \cite{xie2019improving, dong2019evading}), the adversarial samples are generated and tested the mAP as the transferability towards detectors. Details of implementation are described in \ref{detail}.
We present the results in Table \ref{trans}. Among the classification attacks and detection ones, cross-domain attack \cite{naseer2019cross} is effective, but RAD is more aggressive. RAD enjoys a state-of-the-art transferability towards most black-box models, outperforming other methods for above 20\%. The detection mAPs are more than halved, making state-of-the-art detectors similar to the early elementary counterpart. Also, the adversarial samples from the one-stage detector (M1) could be transferred to two-stage ones (M4 - M8, seeing Table \ref{models}) as the case in attacking classifiers \cite{dong2018boosting, xie2019improving, lin2019nesterov}.
\begin{table}[!htpb]
\caption{Detection mAP in different attacks}
\label{trans}
\centering
\renewcommand\tabcolsep{4pt}
\begin{tabular}{r|ccccccccc}
\toprule
Method & M1 & M2 & M3 & M4 & M5 & M6 & M7 & M8 & M9 \\ \hline
No Attack & 29.3 & 33.4 & 38.1 & 40.7 & 42.1 & 42.5 & 45.7 & 46.9 & 53.9 \\
Ablation & 24.9 & 31.4 & 31.2 & 31.6 & 35.0 & 34.3 & 37.5 & 38.8 & 48.6 \\ \midrule
PGD \cite{madry2017towards} & 26.4 & 30.4 & 34.4 & 35.4 & 38.4 & 38.3 & 41.7 & 43.1 & 51.1 \\
SI-PGD \cite{lin2019nesterov} & 27.5 & 31.6 & 36.1 & 37.1 & 40.0 & 40.1 & 43.5 & 44.8 & 52.4 \\
MI-DI-PGD \cite{dong2018boosting, xie2019improving} & 22.9 & 26.2 & 29.3 & 30.0 & 33.2 & 32.1 & 36.0 & 37.5 & 48.0 \\
MI-TI-PGD \cite{dong2018boosting, dong2019evading} & 20.1 & 23.7 & 24.9 & 25.4 & 30.1 & 27.4 & 32.8 & 34.5 & 47.1 \\
CD-painting \cite{naseer2019cross} & 16.4 & 20.8 & 21.3 & 22.8 & 26.6 & 24.5 & 28.9 & 29.5 & 42.3 \\
CD-comics \cite{naseer2019cross} & 16.6 & 21.6 & 21.7 & 22.7 & 26.8 & 24.3 & 29.1 & 42.3 & 43.7 \\ \midrule
Dfool \cite{lu2017adversarial} & 23.3 & 2.5 & 29.2 & 29.8 & 33.3 & 32.9 & 36.5 & 38.0 & 47.5 \\
Loc \cite{zhang2019towards} & 21.9 & \textbf{0.2} & 25.8 & 26.6 & 29.8 & 29.4 & 33.2 & 33.2 & 45.2 \\
DAG \cite{xie2017adversarial}& 20.8 & 0.6 & 22.8 & 23.4 & 26.8 & 25.6 & 28.9 & 31.0 & 40.6 \\
RAD (ours)& \textbf{14.6} & 0.7 & \textbf{16.3} & \textbf{17.0} & \textbf{20.4} & \textbf{19.1} & \textbf{22.3} & \textbf{23.8} & \textbf{35.0} \\
\bottomrule
\end{tabular}
\end{table}
\begin{figure}[!htpb]
\centering
\includegraphics[width=\hsize]{imgs/epsilon.png}\\
\caption{The influence of $\varepsilon$ on detection mAP in RAD}
\label{eps}
\end{figure}
\subsection{Comprehensive Evaluations of RAD's Transferability}\label{investigate}
Although mAP is a general metric to test detectors under a fixed bound of perturbations, it is also interesting to investigate RAD's transferability under different bounds and sub-tasks, i.e., classification accuracy, the shift of bounding boxes, and their invisibility to detectors.
Here we first vary the $\ell_\infty$ bound of RAD, and report the mAP in Fig. \ref{eps}. With the $\ell_\infty$ bound increases, the resulting mAP greatly decreases for all black-box models especially for $\varepsilon$ from 8 to 12.
We further study RAD's transferability in different metrics, which is necessary because mAP measures the overall performance of detectors, and thus could not decouple the RAD's aggression on, e.g., shifting and hiding bounding boxes. For subsequent evaluations on sub-tasks, we define the metrics below.
\begin{itemize}
\item \textbf{Accuracy} for \textbf{classification} of bounding boxes: Without considering locations, we use the predicted box classes to calculate the classification accuracy. For each image, $a$ predicted bounding boxes with the highest confidence (after non-maximum suppression) are considered, where $a$ is the number of ground truth bounding boxes for rationality. For example, if the detector predicts 3 cats, 2 dogs, and 1 car in an image, which has 2 cats, 3 dogs, and 1 person, we count $2+2=4$ hits and 2 misses.
\item \textbf{Intersection over Union (IoU)} for \textbf{shifting} of bounding boxes: Focused on locations, we average the IoU, the measure of location correctness, on all predictions to quantify the shifting. Also, we select $a$ predicted bounding boxes with the highest confidence, and compute the IoU for each box with the nearest ground truth in the same class (IoU=0 for wrong prediction).
\item \textbf{Mean Average Recall (mAR)} for \textbf{hiding} of bounding boxes: To see how attacks hide the object, the common recall value is appropriate, and the mAR is calculated from recall in the same way that mAP is from precision, which has been adopted in detection libraries.
\end{itemize}
To the best of our knowledge, existing works mostly focus on mAP \cite{li2018robust, li2018exploring, liu2018dpatch}, and we here suggest a more comprehensive way to evaluate attacks on detectors. The results are reported in Table \ref{bboxrc}, from which one could observe that RAD also outperforms its counterparts in different sub-tasks to a large extent, i.e., up to 10\%. The predicted bounding boxes in attacking white-box M2 are too few to evaluate fairly, so we do not show their results.
\begin{table}[!htpb]
\caption{Accuracy (\%), IoU (\%), mAR (\%) in different attacks}
\label{bboxrc}
\centering
\renewcommand\tabcolsep{5pt}
\begin{tabular}{c|r|cccccccc}
\toprule
Metric & Method & M1 & M3 & M4 & M5 & M6 & M7 & M8 & M9 \\ \hline
\multirow{4}{*}{Acc}
& Dfool \cite{lu2017adversarial} & 68.9 & 71.7 & 72.6 & 74.8 & 73.5 & 75.9 & 76.6 & 82.9 \\
& Loc \cite{zhang2019towards} & 67.8 & 69.8 & 70.7 & 73.0 & 71.5 & 74.0 & 74.8 & 81.6 \\
& DAG \cite{xie2017adversarial}& 64.4 & 62.4 &63.3 & 67.2 & 65.0 & 68.5 & 69.3 & 77.1 \\
& RAD (ours) & \textbf{58.6} & \textbf{56.9} & \textbf{58.0} &\textbf{62.2} & \textbf{60.3} & \textbf{63.5} & \textbf{64.2} & \textbf{72.9} \\ \midrule
\multirow{4}{*}{IoU}
& Dfool \cite{lu2017adversarial} & 43.9 & 47.9 & 48.5 & 51.3 & 50.1 & 52.6 & 53.1 & 61.5 \\
& Loc \cite{zhang2019towards} & 42.2 & 44.6 & 45.1 & 47.9 & 46.7 & 49.3 & 49.8 & 59.6 \\
& DAG \cite{xie2017adversarial}& 40.9 & 41.1 & 41.7 & 45.3 & 43.7 & 46.8 & 46.9 & 56.3 \\
& RAD (ours) & \textbf{34.4} & \textbf{34.5} & \textbf{35.6} &\textbf{39.5} & \textbf{37.9} & \textbf{41.1} & \textbf{40.9} & \textbf{51.7} \\ \midrule
\multirow{4}{*}{mAR}
& Dfool \cite{lu2017adversarial} & 36.3 & 45.9 & 43.9 & 47.1 & 45.9 & 48.8 & 54.8 & 60.7 \\
& Loc \cite{zhang2019towards} & 34.7 & 42.3 & 40.5 & 43.7 & 42.5 & 45.4 & 51.1 & 58.3 \\
& DAG \cite{xie2017adversarial}& 32.9 & 38.5 & 35.3 & 39.2 & 36.7 & 39.4 & 47.4 & 52.8 \\
& RAD (ours) & \textbf{27.4} & \textbf{32.2} & \textbf{29.0} &\textbf{32.7} & \textbf{30.1} & \textbf{32.9} & \textbf{41.6} & \textbf{47.9} \\
\bottomrule
\end{tabular}
\end{table}
\subsection{RAD's Transferability to Instance Segmentation}
Detection and segmentation are similar in some aspects, so they could be implemented in one network \cite{he2017mask, cai2018cascade, chen2019hybrid}. Also, adversarial samples for object detection tend to transfer to instance segmentation \cite{xie2017adversarial}. Accordingly, we evaluate this cross-task transferability by RAD on surrogate detectors YOLOv3 (\cite{redmon2018yolov3}, M2), RetinaNet (\cite{lin2017focal}, M3) and Mask R-CNN (\cite{he2017mask}, M5). From the results in Table \ref{segm}, we find that RAD also greatly hurts the performance of instance segmentation, leading to a drop in mAP of over 70\%. This inspires the segmentation attackers to indirectly attack detectors.
\begin{table}[!htpb]
\caption{Segmentation mAP of RAD}
\label{segm}
\centering
\begin{tabular}{r|ccc|ccc|ccc}
\toprule
& \multicolumn{3}{c}{mAP} & \multicolumn{3}{c}{mAP50} & \multicolumn{3}{c}{mAP75} \\
Surrogate & M5 & M7 & M8 & M5 & M7 & M8 & M5 & M7 & M8 \\ \hline
None & 38.0 & 39.4 & 40.8 & 60.6 & 61.3 & 63.3 & 40.9 & 42.9 & 44.1 \\
Ablation & 31.0 & 31.9 & 33.5 & 51.2 & 51.0 & 53.7 & 32.4 & 34.3 & 35.4 \\ \midrule
M2 & 17.9 & 18.6 & 20.3 & 31.6 & 31.7 & 34.5 & 18.0 & 18.9 & 20.7 \\
M3 & 11.6 & 11.9 & 12.9 & 19.2 & 19.1 & 20.7 & 12.1 & 12.6 & 13.7 \\
M5 & 1.2 & 11.1 & 11.8 & 2.4 & 17.9 & 18.9 & 1.0 & 11.9 & 12.6 \\
\bottomrule
\end{tabular}
\end{table}
\section{Adversarial Objects in Context}
Given the great transferability of RAD, we create Adversarial Objects in COntext (AOCO), the first adversarial dataset for object detection and instance segmentation. AOCO dataset serves as a potential benchmark to evaluate the robustness of detectors, which is beneficial to network designers. It will also be useful for adversarial training, as the most effective practice to improve the robustness of DNNs. Notice that there is no other adversarial dataset for detection and segmentation at all. This is not because the dataset is useless, but due to the low transferability of attack methods such that the examples are detector-dependent. Now we have achieved high transferability and can then make such an adversarial dataset publicly available.
AOCO is generated from the full COCO 2017 validation set \cite{lin2014microsoft} with 5k samples. It contains 5K adversarial samples for evaluating object detection (AOCO detection) and 5K for instance segmentation (AOCO segmentation). All 10K samples in AOCO are crafted by RAD. The surrogate model we attack is YOLOv3 for AOCO detection and Mask R-CNN for AOCO segmentation given the results in Table \ref{trans} and Table \ref{segm}.
We measure the perturbation $\Delta x$ in AOCO by Root Mean Squared Error (RMSE) as in \cite{xie2017adversarial}. It is calculated as $\sqrt{\sum_i (\Delta x_i)^{2} / N}$ in a pixel-wise way, and $N$ is the size of the image. Performance of AOCO is reported in Table \ref{aoco}. The RMSE in AOCO is 6.469 for detection and 6.606 for segmentation, which is lower than that in \cite{wu2019skip}, and the perturbations are quite imperceptible. We show in Fig. \ref{aocoappendix} the AOCO samples. More details are presented in \ref{moreaoco}.
\begin{table}[!htpb]
\caption{Detection mAP and segmentation mAP on COCO and AOCO}
\label{aoco}
\centering
\begin{tabular}{l|ccccccccc}
\toprule
& M1 & M2 & M3 & M4 & M5 & M6 & M7 & M8 & M9 \\ \hline
COCO det. & 29.3 & 33.4 & 38.1 & 40.7 & 42.1 & 42.5 & 45.7 & 46.9 & 53.9 \\
AOCO det. & 14.6 & 0.7 & 16.3 & 17 & 20.4 & 19.1 & 22.3 & 23.8 & 35.0\\ \midrule
COCO seg. & $\backslash$ & $\backslash$ & $\backslash$ & $\backslash$ & 38.0 & $\backslash$ & 39.4 & 40.8 & $\backslash$\\
AOCO seg. & $\backslash$ & $\backslash$ & $\backslash$ & $\backslash$ & 1.2 & $\backslash$ & 11.1 & 11.8 & $\backslash$\\
\bottomrule
\end{tabular}
\end{table}
\begin{figure}[!htpb]
\centering
\includegraphics[width=\hsize]{imgs/aoco.png}\\
\caption{Detection and segmentation results in COCO and AOCO by YOLOv3 and Mask R-CNN. For COCO, both networks predict correctly. For AOCO segmentation results, the top image contains two big masks for ``chair'' and ``potted plan''; the second image contains one false mask for ``sports ball''; the bottom image contains ``dog'' in green, ``car'' in purple and ``elephant'' in red.}
\label{aocoappendix}
\end{figure}
\section{Conclusion and Future Work}
To pursue a high transferability, this paper proposes Relevance Attack on Detectors (RAD), which works by suppressing the multi-node relevance, a common property across detectors calculated by our Multi-Node SGLRP. We also thoroughly discuss where to attack and how to update in attacking relevance maps. RAD achieves a state-of-the-art transferability towards 8 diverse black-box models, exceeding existing results by above 20\%, and also significantly hurts the instance segmentation. Given the great transferability of RAD, we generate the first adversarial dataset for object detection and instance segmentation, i.e., Adversarial Objects in COntext (AOCO), which helps to quickly evaluate and improve the robustness of detectors.
In the future, it is promising to attack other common properties for good transferability. Besides, RAD could be modified for patch-based attacks by releasing the bound of perturbations and focusing them only on the regions with the largest perturbations.
\section*{Acknowledgments}
The authors are grateful to the anonymous reviewers for their insightful comments. This work was partially supported by National Key Research Development Project (No. 2018AAA0100702), National Natural Science Foundation of China (No. 61977046), 1000-Talent Plan (Young Program), and Shanghai Municipal Science and Technology Major Project (2021SHZDZX0102).
\newpage
| {'timestamp': '2021-11-24T02:20:48', 'yymm': '2008', 'arxiv_id': '2008.06822', 'language': 'en', 'url': 'https://arxiv.org/abs/2008.06822'} | arxiv |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.